xc
QuadBase9N.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 //QuadBase9N.h
28 
29 #include "PlaneElement.h"
30 
31 #ifndef QuadBase9N_h
32 #define QuadBase9N_h
33 
34 #include "preprocessor/multi_block_topology/matrices/ElemPtrArray3d.h"
35 #include "preprocessor/multi_block_topology/aux_meshing.h"
36 #include "preprocessor/prep_handlers/LoadHandler.h"
37 #include "domain/load/plane/BidimStrainLoad.h"
38 #include "vtkCellType.h"
39 
40 namespace XC {
43 template <class PhysProp>
44 class QuadBase9N : public PlaneElement<9,PhysProp>
45  {
46  protected:
47  ElemPtrArray3d put_on_mesh(const NodePtrArray3d &,meshing_dir dm) const;
48 
49  public:
50 
51  QuadBase9N(int classTag);
52  QuadBase9N(int tag, int classTag,const PhysProp &);
53 
54  Element::NodesEdge getNodesEdge(const size_t &i) const;
55  ID getLocalIndexNodesEdge(const size_t &i) const;
56  int getEdgeNodes(const Node *,const Node *) const;
57  Polygon3d getPolygon(bool initialGeometry= true) const;
58  Segment3d getSide(const size_t &i,bool initialGeometry= true) const;
59 
60  int getVtkCellType(void) const;
61 
62  void zeroLoad(void);
63  int addLoad(ElementalLoad *theLoad, double loadFactor);
64  };
65 
67 template <class PhysProp>
69  : PlaneElement<9,PhysProp>(0,classTag) {}
70 
72 template <class PhysProp>
73 XC::QuadBase9N<PhysProp>::QuadBase9N(int tag,int classTag,const PhysProp &pp)
74  :PlaneElement<9,PhysProp>(tag,classTag,pp) {}
75 
76 
78 template <class PhysProp>
80  { return put_quad9N_on_mesh(*this,nodes,dm); }
81 
83 template <class PhysProp>
84 Polygon3d XC::QuadBase9N<PhysProp>::getPolygon(bool initialGeometry) const
85  {
86  Polygon3d retval;
87  std::cerr << this->getClassName() << "::" << __FUNCTION__
88  << "; not implemented." << std::endl;
89  return retval;
90  }
91 
93 template <class PhysProp>
94 Segment3d XC::QuadBase9N<PhysProp>::getSide(const size_t &i,bool initialGeometry) const
95  {
96  Segment3d retval;
97  std::cerr << this->getClassName() << "::" << __FUNCTION__
98  << "; not implemented." << std::endl;
99  return retval;
100  }
101 
103 template <class PhysProp>
105  {
106  Element::NodesEdge retval(3,static_cast<Node *>(nullptr));
107  std::cerr << this->getClassName() << "::" << __FUNCTION__
108  << "; not implemented." << std::endl;
109  return retval;
110  }
111 
114 template <class PhysProp>
115 int XC::QuadBase9N<PhysProp>::getEdgeNodes(const Node *n1,const Node *n2) const
116  {
117  int retval= -1;
118  std::cerr << this->getClassName() << "::" << __FUNCTION__
119  << "; not implemented." << std::endl;
120  return retval;
121  }
122 
124 template <class PhysProp>
126  {
127  ID retval(2);
128  std::cerr << this->getClassName() << "::" << __FUNCTION__
129  << "; not implemented." << std::endl;
130  return retval;
131  }
132 
134 template <class PhysProp>
136  {
138  this->physicalProperties.getMaterialsVector().zeroInitialGeneralizedStrains(); //Removes initial deformations.
139  return;
140  }
141 
143 template <class PhysProp>
144 int XC::QuadBase9N<PhysProp>::addLoad(ElementalLoad *theLoad, double loadFactor)
145  {
146  if(this->isDead())
147  std::cerr << this->getClassName()
148  << "; load over inactive elements: "
149  << this->getTag() << std::endl;
150  else
151  {
152  if(const BidimStrainLoad *strainLoad= dynamic_cast<const BidimStrainLoad *>(theLoad)) //Prescribed strains.
153  {
154  static std::vector<Vector> initStrains;
155  initStrains= strainLoad->getStrains();
156  for(std::vector<Vector>::iterator i= initStrains.begin();i!=initStrains.end();i++)
157  (*i)*= loadFactor;
158  this->physicalProperties.getMaterialsVector().addInitialGeneralizedStrains(initStrains);
159  }
160  else
161  {
162  std::cerr << this->getClassName() << "::" << __FUNCTION__
163  << "; load type unknown for element with tag: " <<
164  this->getTag() << std::endl;
165  return -1;
166  }
167  }
168  return 0;
169  }
170 
172 template <class PhysProp>
174  { return VTK_QUADRATIC_QUAD; }
175 
176 } // end of XC namespace
177 #endif
Element::NodesEdge getNodesEdge(const size_t &i) const
Returns the nodes of the element edge.
Definition: QuadBase9N.h:104
std::vector< const Node * > NodesEdge
Nodes on an element edge.
Definition: Element.h:113
ElemPtrArray3d put_on_mesh(const NodePtrArray3d &, meshing_dir dm) const
Put the element on the mesh being passed as parameter.
Definition: QuadBase9N.h:79
QuadBase9N(int classTag)
Constructor.
Definition: QuadBase9N.h:68
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:115
ID getLocalIndexNodesEdge(const size_t &i) const
Returns the local indexes of the nodes that lie on the i-th edge.
Definition: QuadBase9N.h:125
Vector of integers.
Definition: ID.h:93
int addLoad(ElementalLoad *theLoad, double loadFactor)
Adds to the element the load being passed as parameter.
Definition: QuadBase9N.h:144
Three-dimensional array of pointers to elements.
Definition: ElemPtrArray3d.h:43
Base class for nine node quads.
Definition: QuadBase9N.h:44
Polygon3d getPolygon(bool initialGeometry=true) const
Returns the element contour as a polygon.
Definition: QuadBase9N.h:84
int getVtkCellType(void) const
Interfaz con Vtk.
Definition: QuadBase9N.h:173
void zeroLoad(void)
Zeroes loads on element.
Definition: QuadBase9N.h:135
Three-dimensional array of pointers to nodes.
Definition: NodePtrArray3d.h:50
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Segment3d getSide(const size_t &i, bool initialGeometry=true) const
Returns the element edge.
Definition: QuadBase9N.h:94
Base class for loads over elements.
Definition: ElementalLoad.h:77
Load due to restricted material expansion or contraction on bidimensional elements.
Definition: BidimStrainLoad.h:38
Mesh node.
Definition: Node.h:110
Base class for plane elements.
Definition: PlaneElement.h:48
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:252