Class xlifepp::Trunk#

class Trunk : public xlifepp::Volume#

A Trunk is a volume defined by a cylinder or a trunk of cone.

A cylinder is a trunk of a cylinder !!! To define it, we need a basis, a translation and a homothety to build the other basis. To make it more simple, we will need a basis, the first point of the other basis (determining the translation and the center of the homothety), and a scale factor. This “first point” of a basis is defined as basis.p(1) : it is the first vertex for a polygon, but the center for an ellipse or a disk

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

  • _basis: to define the geometrical basis of a Trunk (a child object of Surface)

  • _origin: the origin point of the second basis (the first vertex of a Polygon, but the center of an Ellipse or a Disk)

  • _scale: the scale factor to define the second basis

  • _center1, _center2: to define centers of bases when they are elliptical

  • _v1, _v2: to define apogees of the basis when it is elliptical

  • _nnodes: to define the number of nodes on the edges of the Trunk

  • _hsteps: to define the local mesh steps on build points of the Trunk

  • _domain_name: to define the domain name

  • _side_names/_face_name: to define the side names

  • _edge_name: to define the side of side names

  • _vertex_name: to define the side of side of side names

  • _varnames: to define the variable names for print purpose

Subclassed by xlifepp::Cone, xlifepp::Cylinder, xlifepp::RevTrunk

Public Functions

Trunk(const Trunk &t)#

copy constructor

Trunk(Parameter p1, Parameter p2, Parameter p3)#

key-value constructor

Trunk(real_t scale = 1, bool defineBasisAndP = true)#

default constructor

inline virtual ~Trunk()#

destructor

virtual string_t asString() const#

format as string

inline Surface *basis() const#

accessor to basis of trunk

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 trunk as a composite (union of faces)

void buildTop() const#

create top geometry

create top geometry (top_ is mutable)

inline const Point &center1() const#

accessor to origin_ of trunk

inline const Point &center2() const#

accessor to origin_ of trunk

inline virtual Geometry *clone() const#

virtual copy constructor

inline virtual void computeMB()#

compute the minimal box for a composite/loop geometry

compute the minimal box

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

returns list of curves (const)

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

apply a homothety on a Trunk (1 key)

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

apply a homothety on a Trunk (2 keys)

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

apply a homothety on a Trunk

inline virtual Trunk &homothetize(real_t factor)#

apply a homothety on a Trunk

virtual real_t measure() const#

return the length/area/volume of the geometry

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

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

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()#

return list of every point (non const)

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

returns list of every point (const)

inline const Point &origin() const#

accessor to origin_ of trunk

inline const Point &p1() const#

accessor to origin_ of trunk

inline const Point &p2() const#

accessor to origin_ of trunk

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

apply a point reflection on a Trunk (1 key)

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

apply a point reflection on a Trunk

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

apply a reflection2d on a Trunk (1 key)

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

apply a reflection2d on a Trunk (2 keys)

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

apply a reflection2d on a Trunk

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

apply a reflection2d on a Trunk

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

apply a reflection3d on a Trunk (1 key)

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

apply a reflection3d on a Trunk (2 keys)

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

apply a reflection3d on a Trunk

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

apply a reflection3d on a Trunk

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

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

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

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

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

apply a rotation 2D on a Trunk

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

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

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

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

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

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

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

apply a rotation on a Trunk

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

apply a rotation on a Trunk

inline virtual Trunk &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 Trunk

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

apply a rotation 3D on a Trunk

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

apply a rotation 3D on a Trunk

inline real_t scale() const#

accessor to scale factor of trunk

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

returns list of faces (const)

Surface *top() const#

access to top geometry, created if not exist

virtual Trunk &transform(const Transformation &t)#

apply a geometrical transformation on a Trunk

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

apply a translation on a Trunk (1 key)

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

apply a translation on a Trunk (3 reals version)

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

apply a translation on a Trunk (vector version)

inline virtual Trunk *trunk()#

access to child Trunk object

inline virtual const Trunk *trunk() const#

access to child Trunk object (const)

inline virtual bool withNnodes() const#

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