29 #ifndef PlaneElement_h 30 #define PlaneElement_h 32 #include <domain/mesh/element/ElemWithMaterial.h> 33 #include "xc_utils/src/geom/d2/Polygon3d.h" 34 #include "xc_utils/src/geom/d1/Segment3d.h" 35 #include "xc_utils/src/geom/pos_vec/Pos3d.h" 36 #include "preprocessor/Preprocessor.h" 38 #include "domain/mesh/node/Node.h" 47 template <
int NNODES,
class PhysProp>
51 mutable std::vector<double> tributaryAreas;
57 virtual Polygon3d
getPolygon(
bool initialGeometry=
true)
const;
58 virtual Segment3d
getSide(
const size_t &i,
bool initialGeometry=
true)
const;
61 double getArea(
bool initialGeometry=
true)
const;
65 double getDist2(
const Pos2d &p,
bool initialGeometry=
true)
const;
66 double getDist(
const Pos2d &p,
bool initialGeometry=
true)
const;
67 double getDist2(
const Pos3d &p,
bool initialGeometry=
true)
const;
68 double getDist(
const Pos3d &p,
bool initialGeometry=
true)
const;
75 template <
int NNODES,
class PhysProp>
77 :
ElemWithMaterial<NNODES, PhysProp>(tag,classTag,physProp), tributaryAreas(NNODES,0.0)
81 template <
int NNODES,
class PhysProp>
84 if(this->getNodePtrs().hasNull())
85 std::cerr <<
"the element: " << this->getTag()
86 <<
" tiene pointers to node, nulos." << std::endl;
89 const double area= this->getArea();
92 std::cerr <<
"Element: " << this->getTag() <<
" with nodes: [";
93 const std::vector<int> inodes= this->getNodePtrs().getTags();
94 std::vector<int>::const_iterator i= inodes.begin();
97 for(;i!=inodes.end();i++)
98 std::cerr <<
"," << *i;
99 std::cerr <<
"] has a very little area (" << area <<
").\n";
105 template <
int NNODES,
class PhysProp>
112 std::cerr <<
"PlaneElement::setDomain -- Domain is null\n";
116 template <
int NNODES,
class PhysProp>
118 {
return getPolygon(initialGeometry).getCenterOfMass(); }
121 template <
int NNODES,
class PhysProp>
126 template <
int NNODES,
class PhysProp>
128 {
return getPolygon(initialGeometry).getPerimeter(); }
133 template <
int NNODES,
class PhysProp>
135 {
return getPolygon(initialGeometry).getArea(); }
138 template <
int NNODES,
class PhysProp>
141 tributaryAreas= getPolygon(initialGeometry).getTributaryAreas();
142 this->dumpTributaries(tributaryAreas);
146 template <
int NNODES,
class PhysProp>
150 const int i= this->theNodes.find(nod);
152 retval= tributaryAreas[i];
157 template <
int NNODES,
class PhysProp>
160 const std::list<Pos3d> positions= this->getPosNodes(initialGeometry);
161 return Polygon3d(positions.begin(),positions.end());
166 template <
int NNODES,
class PhysProp>
171 const size_t sz= nodes.size();
174 const Pos3d p1= nodes.
getPosNode(i,initialGeometry);
176 retval= Segment3d(p1,nodes.
getPosNode(i+1,initialGeometry));
178 retval= Segment3d(p1,nodes.
getPosNode(0,initialGeometry));
185 template <
int NNODES,
class PhysProp>
187 {
return getDist2(To3dXY2d(p),initialGeometry); }
191 template <
int NNODES,
class PhysProp>
193 {
return getDist(To3dXY2d(p),initialGeometry); }
197 template <
int NNODES,
class PhysProp>
199 {
return getPolygon(initialGeometry).dist2(p); }
203 template <
int NNODES,
class PhysProp>
205 {
return getPolygon(initialGeometry).dist(p); }
double getDist2(const Pos2d &p, bool initialGeometry=true) const
Returns the squared distance from the element to the point being passed as parameter.
Definition: PlaneElement.h:186
Pos3d getPosNode(const size_t &i, bool initialGeometry=true) const
Return the position of the i-th node.
Definition: NodePtrs.cc:349
double getArea(bool initialGeometry=true) const
Returns element area.
Definition: PlaneElement.h:134
double getTributaryArea(const Node *) const
Returns tributary area for the node being passed as parameter.
Definition: PlaneElement.h:147
void checkElem(void)
Sets nodes and checks the element.
Definition: PlaneElement.h:82
PlaneElement(int tag, int classTag, const PhysProp &)
Constructor.
Definition: PlaneElement.h:76
virtual void computeTributaryAreas(bool initialGeometry=true) const
Computes tributary areas that correspond to each node.
Definition: PlaneElement.h:139
virtual Segment3d getSide(const size_t &i, bool initialGeometry=true) const
Returns a lado of the element.
Definition: PlaneElement.h:167
void setDomain(Domain *theDomain)
Sets the element domain.
Definition: PlaneElement.h:106
double getDist(const Pos2d &p, bool initialGeometry=true) const
Return the distance from the element to the point being passed as parameter.
Definition: PlaneElement.h:192
Pos3d getCenterOfMassPosition(bool initialGeometry=true) const
Return the position of the element centroid.
Definition: PlaneElement.h:117
Node pointer container for elements.
Definition: NodePtrsWithIDs.h:45
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
double getPerimeter(bool initialGeometry=true) const
Returns the perimeter of the element.
Definition: PlaneElement.h:127
Element with material.
Definition: ElemWithMaterial.h:40
size_t getDimension(void) const
Return the element dimension (0, 1, 2 o3 3).
Definition: PlaneElement.h:122
virtual Polygon3d getPolygon(bool initialGeometry=true) const
Returns the element contour as a polygon.
Definition: PlaneElement.h:158
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:116
Mesh node.
Definition: Node.h:110
Base class for plane elements.
Definition: PlaneElement.h:48