Class xlifepp::Polyhedron#

class Polyhedron : public xlifepp::Volume#

definition of a polyhedral geometry in R^3 Generally, a polyhedron is a list of polygonal faces.

But data is storages differently to avoid pointer manipulation So, we decide to store:

  • the list of vertices -> Vector<Point> p_

  • the definition of faces as a list of points -> Vector<Vector<number_t> > faces_ it is so that p_[faces_[i][j]] is the j-st vertex of the i-st face of the polyhedron

  • the number of nodes on each edge -> Vector<Vector<number_t> > n_ it is so that n_[i][j] is the number of nodes on j-st edge [ p_[faces_[i][j]] p_[faces_[i][j+1]] ] of the i-st face of the polyhedron

Polyhedron constructors are based on a key-value system. Here are the available keys:

  • _faces: the geometrical faces defining the Polyhedron

  • _nnodes: to define the number of nodes on each edge of the Polyhedron

  • _hsteps: to define the local mesh steps on the vertices of the Polyhedron

  • _domain_name: to define the domain name

  • _varnames: to define the variable names for print purpose Domain names on boundaries (faces, edges and vertices) are defined by the Geometry objects given to _faces key

Subclassed by xlifepp::Hexahedron, xlifepp::Tetrahedron

Public Functions

Polyhedron()#

default constructor

default polyhedron is tetrahedron (0,0,0) (1,0,0) (0,1,0) (0,0,1)

Polyhedron(const Polyhedron &ph)#

copy constructor

Polyhedron(Parameter p1)#

key-value constructor

inline virtual ~Polyhedron()#

destructor

virtual string_t asString() const#

format as string

virtual std::vector<const Point*> boundNodes() const#

returns list of points on boundary (const)

virtual Geometry &buildBoundary() const#

create boundary geometry

create boundary geometry of polyhedron as a composite (union of faces)

inline virtual Geometry *clone() const#

virtual copy constructor

virtual void collect(const string_t &n, std::list<Geometry*>&) const#

collect in a list all canonical geometry’s with name n

inline virtual void computeMB()#

computes the minimal box

virtual std::vector<std::pair<ShapeType, std::vector<const Point*>>> curves() const#

returns list of edges

inline const std::vector<Polygon*> &faces() const#

accessor to faces

inline virtual Polyhedron &homothetize(const Parameter &p1)#

apply a homothety on a Polyhedron (1 key)

inline virtual Polyhedron &homothetize(const Parameter &p1, const Parameter &p2)#

apply a homothety on a Polyhedron (2 keys)

inline virtual Polyhedron &homothetize(const Point &c = Point(0., 0., 0.), real_t factor = 1.)#

apply a homothety on a Polyhedron

inline virtual Polyhedron &homothetize(real_t factor)#

apply a homothety on a Polyhedron

virtual std::vector<number_t> nbElementsForGmshGeneration() const#

return number of points/arcs/lines/loops/surfaces/extrudable elementsof a geometry (only for gmsh generation)

inline number_t nbFaces() const#

accessor to number of faces

inline virtual number_t nbSides() const#

returns the number of sides return number of points/arcs/lines/loops/surfaces/extrudable elementsof a geometry (only for gmsh generation)

virtual std::vector<Point*> nodes()#

returns list of nodes (non const)

virtual std::vector<const Point*> nodes() const#

returns list of nodes (const)

inline number_t nOnEdge(number_t i, number_t j) const#

accessor to number of nodes on edge i

inline virtual Polyhedron &pointReflect(const Parameter &p1)#

apply a point reflection on a Polyhedron (1 key)

inline virtual Polyhedron &pointReflect(const Point &c = Point(0., 0., 0.))#

apply a point reflection on a Polyhedron

inline virtual Polyhedron *polyhedron()#

access to child Polyhedron object

inline virtual const Polyhedron *polyhedron() const#

access to child Polyhedron object (const)

inline virtual Polyhedron &reflect2d(const Parameter &p1)#

apply a reflection2d on a Polyhedron (1 key)

inline virtual Polyhedron &reflect2d(const Parameter &p1, const Parameter &p2)#

apply a reflection2d on a Polyhedron (2 keys)

inline virtual Polyhedron &reflect2d(const Point &c, real_t dx, real_t dy = 0.)#

apply a reflection2d on a Polyhedron

inline virtual Polyhedron &reflect2d(const Point &c = Point(0., 0.), std::vector<real_t> d = std::vector<real_t>(2, 0.))#

apply a reflection2d on a Polyhedron

inline virtual Polyhedron &reflect3d(const Parameter &p1)#

apply a reflection3d on a Polyhedron (1 key)

inline virtual Polyhedron &reflect3d(const Parameter &p1, const Parameter &p2)#

apply a reflection3d on a Polyhedron (2 keys)

inline virtual Polyhedron &reflect3d(const Point &c, real_t nx, real_t ny, real_t nz = 0.)#

apply a reflection3d on a Polyhedron

inline virtual Polyhedron &reflect3d(const Point &c = Point(0., 0., 0.), std::vector<real_t> n = std::vector<real_t>(3, 0.))#

apply a reflection3d on a Polyhedron

inline virtual Polyhedron &rotate2d(const Parameter &p1)#

apply a rotation 2D on a Polyhedron (1 key)

inline virtual Polyhedron &rotate2d(const Parameter &p1, const Parameter &p2)#

apply a rotation 2D on a Polyhedron (2 keys)

inline virtual Polyhedron &rotate2d(const Point &c, real_t angle = 0.)#

apply a rotation 2D on a Polyhedron

inline virtual Polyhedron &rotate3d(const Parameter &p1)#

apply a rotation 3D on a Polyhedron (1 key)

inline virtual Polyhedron &rotate3d(const Parameter &p1, const Parameter &p2)#

apply a rotation 3D on a Polyhedron (2 keys)

inline virtual Polyhedron &rotate3d(const Parameter &p1, const Parameter &p2, const Parameter &p3)#

apply a rotation 3D on a Polyhedron (3 keys)

inline virtual Polyhedron &rotate3d(const Point &c, real_t dx, real_t dy, real_t angle)#

apply a rotation on a Polyhedron

inline virtual Polyhedron &rotate3d(const Point &c, real_t dx, real_t dy, real_t dz, real_t angle)#

apply a rotation on a Polyhedron

inline virtual Polyhedron &rotate3d(const Point &c, std::vector<real_t> d = std::vector<real_t>(3, 0.), real_t angle = 0.)#

apply a rotation 3D on a Polyhedron

inline virtual Polyhedron &rotate3d(real_t dx, real_t dy, real_t angle)#

apply a rotation 3D on a Polyhedron

inline virtual Polyhedron &rotate3d(real_t dx, real_t dy, real_t dz, real_t angle)#

apply a rotation 3D on a Polyhedron

inline virtual void setFaces()#

set the faces vector

virtual std::vector<std::pair<ShapeType, std::vector<const Point*>>> surfs() const#

returns list of faces

virtual Polyhedron &transform(const Transformation &t)#

apply a geometrical transformation on a Polyhedron

inline virtual Polyhedron &translate(const Parameter &p1)#

apply a translation on a Polyhedron (1 key)

inline virtual Polyhedron &translate(real_t ux, real_t uy = 0., real_t uz = 0.)#

apply a translation on a Polyhedron (3 reals version)

inline virtual Polyhedron &translate(std::vector<real_t> u)#

apply a translation on a Polyhedron (vector version)

void updateSideNames()#

update side names from face domain names (do not use for child of Polyhedron)

inline virtual std::vector<const Point*> wholeNodes() const#

< returns list of every point (const)

inline virtual bool withNnodes() const#

check if Polyhedron is defined only with _nnodes or with _hsteps option