32 #include <domain/mesh/element/ElemWithMaterial.h> 33 #include "xc_utils/src/geom/d2/Poligono3d.h" 34 #include "xc_utils/src/geom/d1/Segmento3d.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 NNODOS,
class PhysProp>
51 mutable std::vector<double> areasTributarias;
53 ElemPlano(
int tag,
int classTag,
const PhysProp &);
57 virtual Poligono3d
getPoligono(
bool initialGeometry=
true)
const;
58 virtual Segmento3d
getLado(
const size_t &i,
bool initialGeometry=
true)
const;
59 Pos3d
getPosCdg(
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 NNODOS,
class PhysProp>
77 :
ElemWithMaterial<NNODOS, PhysProp>(tag,classTag,physProp), areasTributarias(NNODOS,0.0)
81 template <
int NNODOS,
class PhysProp>
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: [";
94 std::vector<int>::const_iterator i= inodos.begin();
97 for(;i!=inodos.end();i++)
98 std::cerr <<
"," << *i;
99 std::cerr <<
"] has a very little area (" << area <<
").\n";
105 template <
int NNODOS,
class PhysProp>
112 std::cerr <<
"ElemPlano::setDomain -- Domain is null\n";
116 template <
int NNODOS,
class PhysProp>
121 template <
int NNODOS,
class PhysProp>
126 template <
int NNODOS,
class PhysProp>
128 {
return getPoligono(initialGeometry).Perimetro(); }
131 template <
int NNODOS,
class PhysProp>
136 template <
int NNODOS,
class PhysProp>
139 areasTributarias=
getPoligono(initialGeometry).getAreasTributarias();
144 template <
int NNODOS,
class PhysProp>
150 retval= areasTributarias[i];
155 template <
int NNODOS,
class PhysProp>
158 const std::list<Pos3d> posiciones= this->
getPosNodos(initialGeometry);
159 return Poligono3d(posiciones.begin(),posiciones.end());
164 template <
int NNODOS,
class PhysProp>
169 const size_t sz= nodos.size();
172 const Pos3d p1= nodos.
getPosNodo(i,initialGeometry);
174 retval= Segmento3d(p1,nodos.
getPosNodo(i+1,initialGeometry));
176 retval= Segmento3d(p1,nodos.
getPosNodo(0,initialGeometry));
183 template <
int NNODOS,
class PhysProp>
185 {
return getDist2(To3dXY2d(p),initialGeometry); }
189 template <
int NNODOS,
class PhysProp>
191 {
return getDist(To3dXY2d(p),initialGeometry); }
195 template <
int NNODOS,
class PhysProp>
201 template <
int NNODOS,
class PhysProp>
void checkElem(void)
Sets nodes and checks the element.
Definition: ElemPlano.h:82
double getArea(bool initialGeometry=true) const
Returns element area.
Definition: ElemPlano.h:132
Element with material.
Definition: ElemWithMaterial.h:40
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:98
NodePtrsWithIDs theNodes
pointers to node.
Definition: ElementBase.h:49
void setDomain(Domain *theDomain)
Sets the element domain.
Definition: ElemPlano.h:106
Mesh node.
Definition: Node.h:99
const std::vector< int > & getTags(void) const
Returns a vector con los tags of the nodes.
Definition: NodePtrs.cc:261
virtual Segmento3d getLado(const size_t &i, bool initialGeometry=true) const
Returns a lado of the element.
Definition: ElemPlano.h:165
std::list< Pos3d > getPosNodos(bool initialGeometry=true) const
Returns the coordinates of the nodes.
Definition: Element.cpp:765
size_t getDimension(void) const
Return the element dimension (0, 1, 2 o3 3).
Definition: ElemPlano.h:122
Base class for plane elements.
Definition: ElemPlano.h:48
virtual void calculaAreasTributarias(bool initialGeometry=true) const
Computes tributary areas that correspond to each node.
Definition: ElemPlano.h:137
Node pointer container for elements.
Definition: NodePtrsWithIDs.h:45
Pos3d getPosCdg(bool initialGeometry=true) const
Return the position of the element centroid.
Definition: ElemPlano.h:117
double getPerimetro(bool initialGeometry=true) const
Returns the perimeter of the element.
Definition: ElemPlano.h:127
iterator find(const int &)
Returns an iterator to the node identified by the tag being passed as parameter.
Definition: NodePtrs.cc:146
double getAreaTributaria(const Node *) const
Returns tributary area for the node being passed as parameter.
Definition: ElemPlano.h:145
double getDist2(const Pos2d &p, bool initialGeometry=true) const
Returns the squared distance from the element to the point being passed as parameter.
Definition: ElemPlano.h:184
void vuelcaTributarias(const std::vector< double > &) const
Adds to the tributary magnitude of each node the vector being passed as parameter.
Definition: Element.cpp:800
double getDist(const Pos2d &p, bool initialGeometry=true) const
Return the distance from the element to the point being passed as parameter.
Definition: ElemPlano.h:190
NodePtrsWithIDs & getNodePtrs(void)
Returns a pointer to the vector de nodos.
Definition: ElementBase.h:107
virtual Poligono3d getPoligono(bool initialGeometry=true) const
Returns the element contour as a polygon.
Definition: ElemPlano.h:156
================================================================================
Definition: ContinuaReprComponent.h:34
void setDomain(Domain *theDomain)
Sets the domain for the element.
Definition: Element.cpp:170
ElemPlano(int tag, int classTag, const PhysProp &)
Constructor.
Definition: ElemPlano.h:76
Pos3d getPosNodo(const size_t &i, bool initialGeometry=true) const
Return the position of the i-th node.
Definition: NodePtrs.cc:352