xc
QuadBase9N.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 //QuadBase9N.h
29 
30 #include "PlaneElement.h"
31 
32 #ifndef QuadBase9N_h
33 #define QuadBase9N_h
34 
35 #include "preprocessor/multi_block_topology/matrices/ElemPtrArray3d.h"
36 #include "preprocessor/multi_block_topology/aux_meshing.h"
37 #include "preprocessor/prep_handlers/LoadHandler.h"
38 #include "domain/load/plane/BidimStrainLoad.h"
39 #include "vtkCellType.h"
40 
41 namespace XC {
44 template <class PhysProp>
45 class QuadBase9N: public PlaneElement<9,PhysProp>
46  {
47  protected:
48  ElemPtrArray3d put_on_mesh(const NodePtrArray3d &,meshing_dir dm) const;
49 
50  public:
51  QuadBase9N(int classTag);
52  QuadBase9N(int tag, int classTag,const PhysProp &);
53 
54  BoolArray3d getNodePattern(void) const;
55  Element::NodesEdge getNodesEdge(const size_t &i) const;
56  ID getLocalIndexNodesEdge(const size_t &i) const;
57  int getEdgeNodes(const Node *,const Node *) const;
58  Polygon3d getPolygon(bool initialGeometry= true) const;
59  Segment3d getSide(const size_t &i,bool initialGeometry= true) const;
60 
61  int getVtkCellType(void) const;
62  std::vector<int> getIdxNodes(void) const;
63 
64  void zeroLoad(void);
65  int addLoad(ElementalLoad *theLoad, double loadFactor);
66  };
67 
69 template <class PhysProp>
71  : PlaneElement<9,PhysProp>(0,classTag) {}
72 
74 template <class PhysProp>
75 XC::QuadBase9N<PhysProp>::QuadBase9N(int tag,int classTag,const PhysProp &pp)
76  :PlaneElement<9,PhysProp>(tag,classTag,pp) {}
77 
81 template <class PhysProp>
83  {
84  BoolArray3d retval(1,3,3,true); //One layer, three rows, three columns.
85  return retval;
86  }
87 
89 template <class PhysProp>
91  { return put_quad9N_on_mesh(*this,nodes,dm); }
92 
94 //
95 // 3 6 2
96 // +---+---+
97 // | |
98 // 7 + +8 + 5
99 // | |
100 // +---+---+
101 // 0 4 1
102 template <class PhysProp>
104  {
105  const std::deque<Pos3d> positions= this->getPosNodes(initialGeometry);
106  //Not collinear nodes:
107  Polygon3d retval(positions[7], positions[0], positions[4]);
108  //rest of the nodes:
109  retval.push_back(positions[1]);
110  retval.push_back(positions[5]);
111  retval.push_back(positions[2]);
112  retval.push_back(positions[6]);
113  retval.push_back(positions[3]);
114  return retval;
115  }
116 
119 template <class PhysProp>
120 std::vector<int> XC::QuadBase9N<PhysProp>::getIdxNodes(void) const
121  {
122  std::vector<int> retval= this->getNodePtrs().getIdx();
123  retval.pop_back(); //Node at center removed.
124  return retval;
125  }
126 
127 
129 template <class PhysProp>
130 Segment3d XC::QuadBase9N<PhysProp>::getSide(const size_t &i,bool initialGeometry) const
131  {
132  Segment3d retval;
133  std::cerr << this->getClassName() << "::" << __FUNCTION__
134  << "; not implemented." << std::endl;
135  return retval;
136  }
137 
139 template <class PhysProp>
141  {
142  Element::NodesEdge retval(3,static_cast<Node *>(nullptr));
143  std::cerr << this->getClassName() << "::" << __FUNCTION__
144  << "; not implemented." << std::endl;
145  return retval;
146  }
147 
150 template <class PhysProp>
151 int XC::QuadBase9N<PhysProp>::getEdgeNodes(const Node *n1,const Node *n2) const
152  {
153  int retval= -1;
154  std::cerr << this->getClassName() << "::" << __FUNCTION__
155  << "; not implemented." << std::endl;
156  return retval;
157  }
158 
160 template <class PhysProp>
162  {
163  ID retval(2);
164  std::cerr << this->getClassName() << "::" << __FUNCTION__
165  << "; not implemented." << std::endl;
166  return retval;
167  }
168 
170 template <class PhysProp>
172  {
174  this->physicalProperties.getMaterialsVector().zeroInitialGeneralizedStrains(); //Removes initial deformations.
175  return;
176  }
177 
179 template <class PhysProp>
180 int XC::QuadBase9N<PhysProp>::addLoad(ElementalLoad *theLoad, double loadFactor)
181  {
182  if(this->isDead())
183  std::cerr << this->getClassName()
184  << "; load over inactive elements: "
185  << this->getTag() << std::endl;
186  else
187  {
188  if(const BidimStrainLoad *strainLoad= dynamic_cast<const BidimStrainLoad *>(theLoad)) //Prescribed strains.
189  {
190  static std::vector<Vector> initStrains;
191  initStrains= strainLoad->getStrains();
192  for(std::vector<Vector>::iterator i= initStrains.begin();i!=initStrains.end();i++)
193  (*i)*= loadFactor;
194  this->physicalProperties.getMaterialsVector().incrementInitialGeneralizedStrains(initStrains);
195  }
196  else
197  {
198  std::cerr << this->getClassName() << "::" << __FUNCTION__
199  << "; load type unknown for element with tag: " <<
200  this->getTag() << std::endl;
201  return -1;
202  }
203  }
204  return 0;
205  }
206 
208 template <class PhysProp>
210  { return VTK_QUADRATIC_QUAD; }
211 
212 } // end of XC namespace
213 #endif
Element::NodesEdge getNodesEdge(const size_t &i) const
Returns the nodes of the element edge.
Definition: QuadBase9N.h:140
std::vector< int > getIdxNodes(void) const
Return the indexes of the nodes (used when creating VTK meshes).
Definition: QuadBase9N.h:120
std::vector< const Node * > NodesEdge
Nodes on an element edge.
Definition: Element.h:116
ElemPtrArray3d put_on_mesh(const NodePtrArray3d &, meshing_dir dm) const
Put the element on the mesh being passed as parameter.
Definition: QuadBase9N.h:90
Plane polygon in a 3D space.
Definition: Polygon3d.h:35
Segment en tres dimensiones.
Definition: Segment3d.h:41
Base class for grids of bool in 3D (used to express if something exists or not in a (layer...
Definition: BoolArray3d.h:34
QuadBase9N(int classTag)
Constructor.
Definition: QuadBase9N.h:70
int getEdgeNodes(const Node *, const Node *) const
Returns the edge of the element that ends in the nodes being passed as parameters.
Definition: QuadBase9N.h:151
ID getLocalIndexNodesEdge(const size_t &i) const
Returns the local indexes of the nodes that lie on the i-th edge.
Definition: QuadBase9N.h:161
Vector of integers.
Definition: ID.h:95
int addLoad(ElementalLoad *theLoad, double loadFactor)
Adds to the element the load being passed as parameter.
Definition: QuadBase9N.h:180
Three-dimensional array of pointers to elements.
Definition: ElemPtrArray3d.h:47
Base class for nine node quads.
Definition: QuadBase9N.h:45
Polygon3d getPolygon(bool initialGeometry=true) const
Returns the element contour as a polygon.
Definition: QuadBase9N.h:103
int getVtkCellType(void) const
Interfaz con Vtk.
Definition: QuadBase9N.h:209
BoolArray3d getNodePattern(void) const
Return a grid of booleans, one for each of the element nodes.
Definition: QuadBase9N.h:82
void zeroLoad(void)
Zeroes loads on element.
Definition: QuadBase9N.h:171
Three-dimensional array of pointers to nodes.
Definition: NodePtrArray3d.h:51
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Segment3d getSide(const size_t &i, bool initialGeometry=true) const
Returns the element edge.
Definition: QuadBase9N.h:130
Base class for loads over elements.
Definition: ElementalLoad.h:79
Load due to restricted material expansion or contraction on bidimensional elements.
Definition: BidimStrainLoad.h:39
Mesh node.
Definition: Node.h:111
Base class for plane elements.
Definition: PlaneElement.h:55
ElemPtrArray3d put_quad9N_on_mesh(const Element &e, const NodePtrArray3d &, meshing_dir dm)
Places the elements on the mesh passed as parameter.
Definition: aux_meshing.cc:288