Geophysical Inversion and Modelling Library  v1.5.1
GIMLI::Shape Class Referenceabstract

A Shape defines a geometrical primitive. More...

Collaboration diagram for GIMLI::Shape:

## Public Member Functions

Shape (MeshEntity *ent)

virtual ~Shape ()

virtual int rtti () const =0

virtual int dim () const =0

virtual std::string name () const

Index nodeCount () const

Nodenode (Index i) const

void setNodesPtr (const std::vector< Node * > &n)

const std::vector< Node * > & nodes () const

virtual std::vector< PolynomialFunction< double > > createShapeFunctions () const

void createJacobian (RMatrix3 &J) const

RMatrix3 createJacobian () const

const RMatrix3invJacobian () const

virtual RVector N (const RVector3 &L) const

virtual void N (const RVector3 &L, RVector &ret) const

virtual void dNdrst (const RVector3 &rst, RMatrix &MdNdrst) const

virtual RMatrix dNdrst (const RVector3 &L) const

virtual void rst2xyz (const RVector3 &rst, RVector3 &xyz) const

virtual RVector3 xyz (const RVector3 &rst) const

virtual void xyz2rst (const RVector3 &xyz, RVector3 &rst) const

virtual RVector3 rst (const RVector3 &xyz) const

virtual RVector3 rst (Index i) const

double drstdxyz (uint rstI, uint xyzJ) const

virtual bool isInside (const RVector3 &xyz, bool verbose=false) const

virtual bool isInside (const RVector3 &xyz, RVector &sf, bool verbose=false) const

virtual bool touch (const RVector3 &pos, double tol=1e-6, bool verbose=false) const

virtual bool intersectRay (const RVector3 &start, const RVector3 &dir, RVector3 &pos)

double domainSize () const

RVector3 center () const

virtual RVector3 norm () const

double h () const

virtual Plane plane () const

void changed ()

double jacobianDeterminant () const

void resizeNodeSize_ (Index n)

## Protected Member Functions

virtual double domainSize_ () const

## Protected Attributes

Index nodeCount_

double domSize_

bool hasDomSize_

double _h

RMatrix3 invJacobian_

const std::vector< Node * > * nodeVector_

## Detailed Description

A Shape defines a geometrical primitive.

A Shape defines a geometrical primitive. And is the geometrical base of a MeshEntity.

## ◆ Shape()

 GIMLI::Shape::Shape ( MeshEntity * ent )

Default constructor.

References setNodesPtr().

## ◆ ~Shape()

 GIMLI::Shape::~Shape ( )
virtual

Default destructor.

## ◆ center()

 RVector3 GIMLI::Shape::center ( ) const

Returns the middle position of this shape

References node(), and nodeCount().

Referenced by GIMLI::MeshEntity::center().

## ◆ changed()

 void GIMLI::Shape::changed ( )

Notify this shape that the inverse Jacobian matrix and the domain size are not longer valid and need recalculation. This method is called if a node has bee transformed.

Referenced by GIMLI::MeshEntity::changed().

## ◆ createJacobian()

 void GIMLI::Shape::createJacobian ( RMatrix3 & J ) const

Create and return the Jacobian matrix for this shape at the local coordinate .
The Jacobian matrix is a 3x3 matrix representing the absolute derivative matrix for this shape regarding the shape functions:

for i = [1,2,3]

the inverse of the Jacobian results in:

Referenced by invJacobian().

## ◆ createShapeFunctions()

 std::vector< PolynomialFunction< double > > GIMLI::Shape::createShapeFunctions ( ) const
virtual

Return a reference to all nodes.

Reimplemented in GIMLI::TriPrismShape.

References rtti().

## ◆ dNdrst()

 void GIMLI::Shape::dNdrst ( const RVector3 & rst, RMatrix & MdNdrst ) const
virtual

Return the derivative matrix of size ( ) for the shape functions at the local coordinate. . Result is independent of L for linear shape function (TODO Remove on cleanup) for

References GIMLI::Singleton< ShapeFunctionCache >::instance(), and rst().

Referenced by createJacobian().

## ◆ domainSize()

 double GIMLI::Shape::domainSize ( ) const

Get the domain size of this shape, i.e., length, area or volume

References domainSize_().

Referenced by GIMLI::MeshEntity::size().

## ◆ domainSize_()

 virtual double GIMLI::Shape::domainSize_ ( ) const
inlineprotectedvirtual

Virtual method to calculate the domain size i.e length, area, volume of the shapes

Reimplemented in GIMLI::TriPrismShape, GIMLI::TriangleShape, GIMLI::EdgeShape, and GIMLI::NodeShape.

Referenced by domainSize().

## ◆ drstdxyz()

 double GIMLI::Shape::drstdxyz ( uint rstI, uint xyzJ ) const
inline

Return derivative from local coordinates to Cartesian coordinates. These are the elements of the inverse Jacobian matrix.

## ◆ h()

 double GIMLI::Shape::h ( ) const

Returns maximum distance between 2 nodes.

References node(), and nodeCount().

## ◆ intersectRay()

 virtual bool GIMLI::Shape::intersectRay ( const RVector3 & start, const RVector3 & dir, RVector3 & pos )
inlinevirtual
• Return true if the ray intersects the shape. On boundary means inside too. The intersection position is stored in pos.

Reimplemented in GIMLI::TriangleShape, and GIMLI::EdgeShape.

Referenced by GIMLI::Mesh::findCellsAlongRay().

## ◆ invJacobian()

 const RMatrix3 & GIMLI::Shape::invJacobian ( ) const

Return the inverse of the Jacobian Matrix. And create and cache it on demand. The matrix is no more valid if the shape was transformed.

## ◆ isInside() [1/2]

 bool GIMLI::Shape::isInside ( const RVector3 & xyz, bool verbose = false ) const
virtual

Return true if the Cartesian coordinates xyz are inside the shape. On boundary means inside too. Works only for shapes dedicated as cells because they need to be aligned to the dimension. See also touch.

Reimplemented in GIMLI::PolygonShape.

References xyz().

Referenced by GIMLI::TriangleShape::intersectRay().

## ◆ isInside() [2/2]

 bool GIMLI::Shape::isInside ( const RVector3 & xyz, RVector & sf, bool verbose = false ) const
virtual

Return true if the Cartesian coordinates xyz are inside the shape. On boundary means inside too. sf contains the complete shape function to identify next neighbor. Works only for shapes dedicated as cells because they need to be aligned to the dimension. See also touch.

References GIMLI::Pos::abs(), N(), rst(), and xyz().

## ◆ N() [1/2]

 RVector GIMLI::Shape::N ( const RVector3 & L ) const
virtual

Return a RVector for the shape functions at the local coordinate .

References nodeCount(), and rst().

Referenced by isInside(), N(), and rst2xyz().

## ◆ N() [2/2]

 void GIMLI::Shape::N ( const RVector3 & L, RVector & ret ) const
virtual

TODO replace this with expressions.
Fill the allocated RVector n of size for the \mathcal{N} shape functions for the local coordinate . For performance reasons the size of L will not be checked. This method needs to be specialized in the corresponding child classes.

References GIMLI::Singleton< ShapeFunctionCache >::instance(), N(), and rst().

## ◆ name()

 virtual std::string GIMLI::Shape::name ( ) const
inlinevirtual

Return an identification name for the shape.

## ◆ node()

 Node & GIMLI::Shape::node ( Index i ) const

Return a read only reference to the i-th Node of this shape.

References nodeCount().

## ◆ nodeCount()

 Index GIMLI::Shape::nodeCount ( ) const
inline

Return the amount of nodes for this shape.

## ◆ nodes()

 const std::vector< Node * >& GIMLI::Shape::nodes ( ) const
inline

Return a read only reference to all nodes.

## ◆ norm()

 RVector3 GIMLI::Shape::norm ( ) const
virtual

Returns the norm vector if possible otherwise returns non valid Vector3

Reimplemented in GIMLI::PolygonShape, GIMLI::TriangleShape, GIMLI::EdgeShape, and GIMLI::NodeShape.

Referenced by GIMLI::Boundary::norm(), and plane().

## ◆ plane()

 Plane GIMLI::Shape::plane ( ) const
virtual

Returns the a plane for this shape if its possible (2D or 3D plane shapes) otherwise returns non valid Plane.

References GIMLI::Pos::abs(), node(), nodeCount(), and norm().

## ◆ rst() [1/2]

 RVector3 GIMLI::Shape::rst ( const RVector3 & xyz ) const
virtual

Return local coordinates for Cartesian coordinates regarding the shape function.

References xyz(), and xyz2rst().

## ◆ rst() [2/2]

 RVector3 GIMLI::Shape::rst ( Index i ) const
virtual

Return local coordinates for node i.

References rtti().

## ◆ rst2xyz()

 void GIMLI::Shape::rst2xyz ( const RVector3 & rst, RVector3 & xyz ) const
virtual

Perform coordinate transformation from the locale coordinates of this shape to Cartesian coordinates regarding to the shape functions N with
This is the opposite to xyz2rst().

This is a generic function and may be overwritten by faster methods for shape simplexes.

References N(), node(), nodeCount(), and xyz().

Referenced by xyz().

## ◆ rtti()

 virtual int GIMLI::Shape::rtti ( ) const
pure virtual

Pure virtual methode for runtime identification.

## ◆ setNodesPtr()

 void GIMLI::Shape::setNodesPtr ( const std::vector< Node * > & n )
inline

Return a reference to the i-th Node of this shape. *‍/ Node & node(Index i);

/*! Set the ptr to nodes array from, which the MeshEntity holds.


Referenced by Shape().

## ◆ touch()

 bool GIMLI::Shape::touch ( const RVector3 & pos, double tol = 1e-6, bool verbose = false ) const
virtual

Check if the position touches the entity. Works only for shapes dedicated as boundaries. On edge of the boundary means inside too. See also isInside.

Reimplemented in GIMLI::EdgeShape.

Referenced by GIMLI::Mesh::copyBoundary().

## ◆ xyz()

 RVector3 GIMLI::Shape::xyz ( const RVector3 & rst ) const
virtual

Return the Cartesian coordinates for the locale coordinates rst. See rst2xyz.

References rst(), and rst2xyz().

## ◆ xyz2rst()

 void GIMLI::Shape::xyz2rst ( const RVector3 & xyz, RVector3 & rst ) const
virtual

Convert Cartesian coordinates into locale coordinates regarding the shape functions. This is the opposite to xyz2rst. This is a generic function and may be overwritten by faster methods for shape simplexes. Solve the nonlinear system of equations by newton method

Reimplemented in GIMLI::TetrahedronShape, and GIMLI::TriangleShape.

References GIMLI::Pos::abs(), invJacobian(), rst(), and xyz().

Referenced by rst().