30 #ifndef PlaneElement_h    31 #define PlaneElement_h    33 #include <domain/mesh/element/ElemWithMaterial.h>    34 #include "utility/geom/d2/Polygon3d.h"    35 #include "utility/geom/d1/Segment3d.h"    36 #include "utility/geom/pos_vec/Pos3d.h"    37 #include "utility/geom/lists/utils_list_pos3d.h"    38 #include "preprocessor/Preprocessor.h"    40 #include "domain/mesh/node/Node.h"    44 const double elem_warning_area= 1e-6; 
    54 template <
int NNODES,
class PhysProp>
    58     mutable std::vector<double> tributaryAreas;
    73     virtual double getPerimeter(
bool initialGeometry= 
true) 
const;
    74     virtual double getArea(
bool initialGeometry= 
true) 
const;
    80     double getDist2(
const Pos2d &p,
bool initialGeometry= 
true) 
const;
    81     double getDist(
const Pos2d &p,
bool initialGeometry= 
true) 
const;
    82     double getDist2(
const Pos3d &p,
bool initialGeometry= 
true) 
const;
    83     double getDist(
const Pos3d &p,
bool initialGeometry= 
true) 
const;
    93 template <
int NNODES,
class PhysProp>
    95   :
ElemWithMaterial<NNODES, PhysProp>(tag,classTag,physProp), tributaryAreas(NNODES,0.0)
   101 template <
int NNODES,
class PhysProp>
   104     if(this->getNodePtrs().hasNull())
   105       std::cerr << this->getClassName() << 
"::" << __FUNCTION__
   106         << 
"; the element: " << this->getTag()
   107                 << 
" pointers to nodes not set." << std::endl;
   110         const double area= this->getArea();
   111         if(area<elem_warning_area)
   113             std::clog << this->getClassName() << 
"::" << __FUNCTION__
   114               << 
"; element: " << this->getTag() << 
" with nodes: [";
   115             const std::vector<int> inodes= this->getNodePtrs().getTags();
   116             std::vector<int>::const_iterator i= inodes.begin();
   119             for(;i!=inodes.end();i++)
   120           std::clog << 
"," << *i;
   121             std::clog << 
"] has a very little area (" << area << 
").\n";
   129 template <
int NNODES,
class PhysProp>
   136       std::cerr << this->getClassName() << 
"::" << __FUNCTION__
   137             << 
"; Domain is null\n";
   143 template <
int NNODES,
class PhysProp>
   145   { 
return getPolygon(initialGeometry).getCenterOfMass(); }
   150 template <
int NNODES,
class PhysProp>
   157 template <
int NNODES,
class PhysProp>
   159   { 
return getPolygon(initialGeometry).getPerimeter(); }
   166 template <
int NNODES,
class PhysProp>
   168   { 
return getPolygon(initialGeometry).getArea(); }
   173 template <
int NNODES,
class PhysProp>
   176     tributaryAreas= getPolygon(initialGeometry).getTributaryAreas();
   177     this->dumpTributaries(tributaryAreas);
   181 template <
int NNODES,
class PhysProp>
   183   { 
return this->tributaryAreas; }
   189 template <
int NNODES,
class PhysProp>
   193     if((i>0) && (i<NNODES)) 
   194       retval= tributaryAreas[i];
   201 template <
int NNODES,
class PhysProp>
   204     const int i= this->theNodes.find(nod);
   205     return getTributaryArea(i);
   211 template <
int NNODES,
class PhysProp>
   214     const std::deque<Pos3d> positions= getNodePositions(initialGeometry);
   215     return getMaxCornerAngle(positions.begin(),positions.end());
   222 template <
int NNODES,
class PhysProp>
   225     const std::deque<Pos3d> tmp= this->getPosNodes(initialGeometry);
   227     std::deque<Pos3d> retval;
   228     std::deque<Pos3d>::const_iterator i= tmp.begin();
   231     retval.push_back(p0);
   232     for(;i!= tmp.end();i++)
   235     if(dist2(p0,p1)>1e-12)
   236       retval.push_back(p1);
   246 template <
int NNODES,
class PhysProp>
   249     const std::deque<Pos3d> positions= getNodePositions(initialGeometry);
   250     return Plane(positions.begin(),positions.end());
   257 template <
int NNODES,
class PhysProp>
   260     const std::deque<Pos3d> positions= getNodePositions(initialGeometry);
   261     Polygon3d retval(positions.begin(),positions.end());
   262     const double maxAngle= getMaximumCornerAngle();
   265         std::cerr << this->getClassName() << 
"::" << __FUNCTION__
   266                   << 
" element with tag: " << this->getTag()
   267               << 
" has maximum corner angle of "   268           << RadToDeg(maxAngle)
   269           << 
" degrees (too distorted)."   270           << 
" Returning empty polygon."   279 template <
int NNODES,
class PhysProp>
   282     const Pos3d tmp(getProjection(
Pos3d(p.x(),p.y(),0.0)));
   289 template <
int NNODES,
class PhysProp>
   292     const Plane plane= getPlane(initialGeometry);
   300 template <
int NNODES,
class PhysProp>
   303     const Polygon3d plg= this->getPolygon(initialGeometry);
   311 template <
int NNODES,
class PhysProp>
   313 { 
return !this->clockwise(vPoint, initialGeometry); }
   319 template <
int NNODES,
class PhysProp>
   322     std::string retval= 
"counterclockwise";
   323     if(this->clockwise(vPoint, initialGeometry))
   324       { retval= 
"clockwise"; }
   330 template <
int NNODES,
class PhysProp>
   335     const size_t sz= nodes.size();
   351 template <
int NNODES,
class PhysProp>
   353   { 
return getDist2(To3dXY2d(p),initialGeometry); }
   359 template <
int NNODES,
class PhysProp>
   361   { 
return getDist(To3dXY2d(p),initialGeometry); }
   367 template <
int NNODES,
class PhysProp>
   369   { 
return getPolygon(initialGeometry).dist2(p); }
   375 template <
int NNODES,
class PhysProp>
   377   { 
return getPolygon(initialGeometry).dist(p); }
 bool counterclockwise(const Pos3d &, bool initialGeometry=true) const
Return true if the nodes are counterclockwise ordered with respect to the element. 
Definition: PlaneElement.h:312
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:352
Pos3d getPosNode(const size_t &i, bool initialGeometry=true) const
Return the position of the i-th node. 
Definition: NodePtrs.cc:352
Plane polygon in a 3D space. 
Definition: Polygon3d.h:35
virtual double getArea(bool initialGeometry=true) const
Returns element area. 
Definition: PlaneElement.h:167
Segment en tres dimensiones. 
Definition: Segment3d.h:41
virtual void checkElem(void)
Sets nodes and checks the element. 
Definition: PlaneElement.h:102
PlaneElement(int tag, int classTag, const PhysProp &)
Constructor. 
Definition: PlaneElement.h:94
virtual void computeTributaryAreas(bool initialGeometry=true) const
Computes tributary areas that correspond to each node. 
Definition: PlaneElement.h:174
double getTributaryArea(const int &) const
Returns tributary area for the i-th node. 
Definition: PlaneElement.h:190
virtual Segment3d getSide(const size_t &i, bool initialGeometry=true) const
Returns a side of the element. 
Definition: PlaneElement.h:331
Posición en dos dimensiones. 
Definition: Pos2d.h:41
Plane getPlane(bool initialGeometry=true) const
Returns the plane that contains the element. 
Definition: PlaneElement.h:247
Pos2d XY2DProjection(void) const
Return the projection onto XY plane. 
Definition: Pos3d.cc:169
void setDomain(Domain *theDomain)
Sets the element domain. 
Definition: PlaneElement.h:130
Plane in a three-dimensional space. 
Definition: Plane.h:49
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:360
std::string orientation(const Pos3d &, bool initialGeometry=true) const
Return the orientation of the element (clockwise or counterclockwise). 
Definition: PlaneElement.h:320
const std::vector< double > & getTributaryAreas(void) const
Return tributary areas that correspond to each node. 
Definition: PlaneElement.h:182
double getMaximumCornerAngle(bool initialGeometry=true) const
Returns the maximum corner angle quality parameter. 
Definition: PlaneElement.h:212
Pos3d getCenterOfMassPosition(bool initialGeometry=true) const
Return the position of the element centroid. 
Definition: PlaneElement.h:144
Pos2d getProjection(const Pos2d &p, bool initialGeometry=true) const
Return the projection of the argument on the element. 
Definition: PlaneElement.h:280
bool clockwise(const Pos3d &) const
Return true if the point list is oriented clockwise. 
Definition: Polygon3d.cc:468
Pos3d Projection(const Pos3d &) const
Return the projection of the point onto this plane. 
Definition: Plane.cc:176
Node pointer container for elements. 
Definition: NodePtrsWithIDs.h:46
Posición en tres dimensiones. 
Definition: Pos3d.h:44
Open source finite element program for structural analysis. 
Definition: ContinuaReprComponent.h:35
virtual double getPerimeter(bool initialGeometry=true) const
Returns the perimeter of the element. 
Definition: PlaneElement.h:158
Element with material. 
Definition: ElemWithMaterial.h:45
size_t getDimension(void) const
Return the element dimension (0, 1, 2 o3 3). 
Definition: PlaneElement.h:151
virtual Polygon3d getPolygon(bool initialGeometry=true) const
Returns the element contour as a polygon. 
Definition: PlaneElement.h:258
Domain (mesh and boundary conditions) of the finite element model. 
Definition: Domain.h:117
Mesh node. 
Definition: Node.h:111
Base class for plane elements. 
Definition: PlaneElement.h:55
std::deque< Pos3d > getNodePositions(bool initialGeometry=true) const
Returns the positions of the element nodes (without duplicates corresponding to degenerated elements)...
Definition: PlaneElement.h:223
bool clockwise(const Pos3d &, bool initialGeometry=true) const
Return true if the nodes are clockwise ordered with respect to the element. 
Definition: PlaneElement.h:301