SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes > Class Template Reference

#include <DynamicSparseGridGeometryAlgorithms.h>

Inheritance diagram for sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >:

Detailed Description

template<class DataTypes>
class sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >

A class that provides geometry information on an HexahedronSet.

Protected Attributes

DynamicSparseGridTopologyContainertopoContainer
 
MObjectdof
 
- Protected Attributes inherited from sofa::component::topology::HexahedronSetGeometryAlgorithms< DataTypes >
bool initializedHexahedronCubatureTables
 
Data< boold_showHexaIndices
 Debug : view Hexa indices. More...
 
Data< boold_drawHexahedra
 if true, draw the Hexahedron in the topology More...
 
Data< floatd_drawScaleHexahedra
 Scale of the hexahedra (between 0 and 1; if <1.0, it produces gaps between the hexahedra) More...
 
Data< sofa::helper::types::RGBAColord_drawColorHexahedra
 
NumericalIntegrationDescriptor< Real, 3 > hexahedronNumericalIntegration
 include cubature points More...
 
- Protected Attributes inherited from sofa::component::topology::QuadSetGeometryAlgorithms< DataTypes >
Data< boolshowQuadIndices
 Debug : view Quad indices. More...
 
Data< bool_drawQuads
 if true, draw the quads in the topology More...
 
Data< sofa::helper::types::RGBAColor_drawColor
 RGB code color used to draw quads. More...
 
- Protected Attributes inherited from sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >
bool initializedEdgeCubatureTables
 
Data< boolshowEdgeIndices
 Debug : view Edge indices. More...
 
Data< boold_drawEdges
 if true, draw the edges in the topology. More...
 
Data< RGBAColor_drawColor
 
NumericalIntegrationDescriptor< Real, 1 > edgeNumericalIntegration
 include cubature points More...
 
- Protected Attributes inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
sofa::core::behavior::MechanicalState< DataTypes > * object
 
sofa::core::topology::BaseMeshTopologym_topology
 
Data< floatd_showIndicesScale
 Debug : scale for view topology indices. More...
 
Data< boold_showPointIndices
 
Data< std::string > d_tagMechanics
 Tage of the Mechanical State associated with the vertex position. More...
 
SingleLink< PointSetGeometryAlgorithms< DataTypes >, sofa::core::topology::BaseMeshTopology, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINKl_topology
 Link to be set to the topology container in the component graph. More...
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(DynamicSparseGridGeometryAlgorithms, DataTypes), SOFA_TEMPLATE(HexahedronSetGeometryAlgorithms, DataTypes))
 
int findNearestElementInRestPos (const Coord &pos, defaulttype::Vector3 &baryC, Real &distance) const override
 finds a hexahedron, in its rest position, which is nearest to a given point. Computes barycentric coordinates and a distance measure. More...
 
void init () override
 
core::topology::BaseMeshTopology::HexaID getTopoIndexFromRegularGridIndex (unsigned int index, bool &existing)
 
unsigned int getRegularGridIndexFromTopoIndex (core::topology::BaseMeshTopology::HexaID index)
 
template<>
int findNearestElementInRestPos (const Coord &pos, sofa::defaulttype::Vector3 &baryC, Real &distance) const
 
template<>
int findNearestElementInRestPos (const Coord &pos, sofa::defaulttype::Vector3 &baryC, Real &distance) const
 
template<>
int SOFA_SOFANONUNIFORMFEM_API findNearestElementInRestPos (const Coord &pos, sofa::defaulttype::Vector3 &baryC, Real &distance) const
 
template<>
int SOFA_SOFANONUNIFORMFEM_API findNearestElementInRestPos (const Coord &pos, sofa::defaulttype::Vector3 &baryC, Real &distance) const
 
- Public Member Functions inherited from sofa::component::topology::HexahedronSetGeometryAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(HexahedronSetGeometryAlgorithms, DataTypes), SOFA_TEMPLATE(QuadSetGeometryAlgorithms, DataTypes))
 
void computeHexahedronAABB (const HexaID h, Coord &minCoord, Coord &maxCoord) const
 
void computeHexahedronRestAABB (const HexaID h, Coord &minCoord, Coord &maxCoord) const
 
Coord computeHexahedronCenter (const HexaID h) const
 
Coord computeHexahedronRestCenter (const HexaID h) const
 
void getHexahedronVertexCoordinates (const HexaID h, Coord[8]) const
 
void getRestHexahedronVertexCoordinates (const HexaID h, Coord[8]) const
 
Real computeHexahedronVolume (const HexaID h) const
 computes the volume of hexahedron no h and returns it More...
 
void computeHexahedronVolume (BasicArrayInterface< Real > &ai) const
 computes the hexahedron volume of all hexahedra are store in the array interface More...
 
Real computeRestHexahedronVolume (const HexaID h) const
 computes the hexahedron volume of hexahedron no i and returns it More...
 
Real computeShapeFunction (const LocalCoord nc, const HexahedronBinaryIndex bi) const
 computes the shape function value for a given binary index More...
 
Coord computeNodalValue (const HexaID h, const LocalCoord nc, const VecCoord &p) const
 computes the nodal position given the hexahedron index, its natural coordinates and the vector of nodal values More...
 
void computePositionDerivative (const HexaID h, const LocalCoord nc, const VecCoord &p, Coord dpos[3]) const
 computes the nodal position derivative along the 3 natural coordinates given the hexahedron index, its natural coordinates and the vector of nodal values More...
 
Real computeJacobian (const HexaID h, const LocalCoord nc, const VecCoord &p) const
 computes the Jacobian i.e. determinant of dpos/dnc on the geometry given by p (could be rest geometry) More...
 
bool isHexahedronAffine (const HexaID h, const VecCoord &p, const Real tolerance=(Real) 1e-5) const
 test if the heaxahedron is a simple affine warp of a cube More...
 
LocalCoord computeHexahedronBarycentricCoeficients (const HexaID h, const Coord &p) const
 computes barycentric coordinates corresponding to a given position. Warning: this method is only correct if the hexahedron is not deformed More...
 
LocalCoord computeHexahedronRestBarycentricCoeficients (const HexaID h, const Coord &p) const
 computes barycentric coordinates corresponding to a given position in the hexa 'h' in its rest position. Warning: this method is only correct if the hexahedron is not deformed More...
 
Coord getPointPositionInHexahedron (const HexaID h, const LocalCoord &baryC) const
 computes a position corresponding to given barycentric coordinates More...
 
Coord getRestPointPositionInHexahedron (const HexaID h, const LocalCoord &baryC) const
 
Coord getPointPositionInHexahedron (const HexaID h, const Real baryC[3]) const
 computes a position corresponding to given barycentric coordinates More...
 
Coord getRestPointPositionInHexahedron (const HexaID h, const Real baryC[3]) const
 
virtual int findNearestElement (const Coord &pos, LocalCoord &baryC, Real &distance) const
 finds a hexahedron which is nearest to a given point. Computes barycentric coordinates and a distance measure. More...
 
virtual void findNearestElements (const VecCoord &pos, helper::vector< int > &elem, helper::vector< LocalCoord > &baryC, helper::vector< Real > &dist) const
 given a vector of points, find the nearest hexa for each point. Computes barycentric coordinates and a distance measure. More...
 
virtual void findNearestElementsInRestPos (const VecCoord &pos, helper::vector< int > &elem, helper::vector< LocalCoord > &baryC, helper::vector< Real > &dist) const
 given a vector of points, find the nearest hexa, in its rest position, for each point. Computes barycentric coordinates and a distance measure. More...
 
virtual Real computeElementDistanceMeasure (const HexaID h, const Coord p) const
 If the point is inside the element, the distance measure is < 0. If the point is outside the element, the distance measure is a squared distance to the element center. More...
 
virtual Real computeElementRestDistanceMeasure (const HexaID h, const Coord p) const
 If the point is inside the element in its rest position, the distance measure is < 0. If the point is outside the element in its rest position, the distance measure is a squared distance to the element center. More...
 
NumericalIntegrationDescriptor< Real, 3 > & getHexahedronNumericalIntegrationDescriptor ()
 return a pointer to the container of cubature points More...
 
void writeMSHfile (const char *filename) const
 Write the current mesh into a msh file. More...
 
void draw (const core::visual::VisualParams *vparams) override
 
- Public Member Functions inherited from sofa::component::topology::QuadSetGeometryAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(QuadSetGeometryAlgorithms, DataTypes), SOFA_TEMPLATE(EdgeSetGeometryAlgorithms, DataTypes))
 
void computeQuadAABB (const QuadID i, Coord &minCoord, Coord &maxCoord) const
 
Coord computeQuadCenter (const QuadID i) const
 
void getQuadVertexCoordinates (const QuadID i, Coord[4]) const
 
void getRestQuadVertexCoordinates (const QuadID i, Coord[4]) const
 
Real computeQuadArea (const QuadID i) const
 Computes the area of quad no i and returns it. More...
 
void computeQuadArea (BasicArrayInterface< Real > &ai) const
 Computes the quad area of all quads are store in the array interface. More...
 
Real computeRestQuadArea (const QuadID i) const
 Computes the initial area of quad no i and returns it. More...
 
defaulttype::Vec< 3, doublecomputeQuadNormal (const QuadID ind_q) const
 Computes the normal vector of a quad indexed by ind_q (not normed) More...
 
bool isQuadInPlane (const QuadID ind_q, const PointID ind_p, const defaulttype::Vec< 3, Real > &plane_vect) const
 Tests if a quad indexed by ind_q (and incident to the vertex indexed by ind_p) is included or not in the plane defined by (ind_p, plane_vect) More...
 
bool isPointInQuad (const QuadID ind_q, const sofa::defaulttype::Vec< 3, Real > &p) const
 
void writeMSHfile (const char *filename) const
 Write the current mesh into a msh file. More...
 
void draw (const core::visual::VisualParams *vparams) override
 
- Public Member Functions inherited from sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(EdgeSetGeometryAlgorithms, DataTypes), SOFA_TEMPLATE(PointSetGeometryAlgorithms, DataTypes))
 
void draw (const core::visual::VisualParams *vparams) override
 
Real computeEdgeLength (const EdgeID i) const
 computes the length of edge no i and returns it More...
 
void computeEdgeLength (BasicArrayInterface< Real > &ai) const
 computes the edge length of all edges and stores it in the array interface More...
 
Real computeRestEdgeLength (const EdgeID i) const
 computes the initial length of edge no i and returns it More...
 
Real computeRestSquareEdgeLength (const EdgeID i) const
 computes the initial square length of edge no i and returns it More...
 
void computeEdgeAABB (const EdgeID i, CPos &minCoord, CPos &maxCoord) const
 
Coord computeEdgeCenter (const EdgeID i) const
 
Coord computeEdgeDirection (const EdgeID i) const
 
Coord computeRestEdgeDirection (const EdgeID i) const
 
void getEdgeVertexCoordinates (const EdgeID i, Coord[2]) const
 
void getRestEdgeVertexCoordinates (const EdgeID i, Coord[2]) const
 
bool isPointOnEdge (const sofa::defaulttype::Vec< 3, double > &pt, const EdgeID ind_e) const
 
sofa::helper::vector< doublecompute2PointsBarycoefs (const sofa::defaulttype::Vec< 3, double > &p, PointID ind_p1, PointID ind_p2) const
 
sofa::helper::vector< doublecomputeRest2PointsBarycoefs (const sofa::defaulttype::Vec< 3, double > &p, PointID ind_p1, PointID ind_p2) const
 
sofa::helper::vector< doublecomputePointProjectionOnEdge (const EdgeID i, sofa::defaulttype::Vec< 3, double > coord_x, bool &intersected)
 Compute the projection coordinate of a point C on the edge i. Using compute2EdgesIntersection(). More...
 
Coord compute2EdgesIntersection (const Coord edge1[2], const Coord edge2[2], bool &intersected)
 Compute the intersection coordinate of the 2 input straight lines. Lines vector director are computed using coord given in input. More...
 
bool computeEdgePlaneIntersection (EdgeID edgeID, sofa::defaulttype::Vec< 3, Real > pointOnPlane, sofa::defaulttype::Vec< 3, Real > normalOfPlane, sofa::defaulttype::Vec< 3, Real > &intersection)
 
bool computeRestEdgePlaneIntersection (EdgeID edgeID, sofa::defaulttype::Vec< 3, Real > pointOnPlane, sofa::defaulttype::Vec< 3, Real > normalOfPlane, sofa::defaulttype::Vec< 3, Real > &intersection)
 
void writeMSHfile (const char *filename) const
 Write the current mesh into a msh file. More...
 
void computeLocalFrameEdgeWeights (helper::vector< EdgeID > &numEdges, helper::vector< Edge > &edges, helper::vector< Vec3d > &weights) const
 
void initPointAdded (PointID indice, const core::topology::PointAncestorElem &ancestorElem, const helper::vector< VecCoord * > &coordVecs, const helper::vector< VecDeriv * > &derivVecs) override
 Process the added point initialization according to the topology and local coordinates. More...
 
NumericalIntegrationDescriptor< Real, 1 > & getEdgeNumericalIntegrationDescriptor ()
 
- Public Member Functions inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(PointSetGeometryAlgorithms, DataTypes), core::topology::GeometryAlgorithms)
 
Angle computeAngle (PointID ind_p0, PointID ind_p1, PointID ind_p2) const
 
void init () override
 
void reinit () override
 
void draw (const core::visual::VisualParams *vparams) override
 
Coord getPointSetCenter () const
 
void getEnclosingSphere (Coord &center, Real &radius) const
 
void getAABB (Real bb[6]) const
 
void getAABB (CPos &minCoord, CPos &maxCoord) const
 Returns the axis aligned bounding box. More...
 
const CoordgetPointPosition (const PointID pointId) const
 
const CoordgetPointRestPosition (const PointID pointId) const
 
sofa::core::behavior::MechanicalState< DataTypes > * getDOF () const
 Returns the object where the mechanical DOFs are stored. More...
 
float getIndicesScale () const
 
void initPointsAdded (const helper::vector< unsigned int > &indices, const helper::vector< core::topology::PointAncestorElem > &ancestorElems, const helper::vector< core::VecCoordId > &coordVecs, const helper::vector< core::VecDerivId > &derivVecs) override
 Called by the MechanicalObject state change callback to initialize added points according to the topology (topology element & local coordinates) More...
 

Protected Member Functions

 DynamicSparseGridGeometryAlgorithms ()
 
virtual ~DynamicSparseGridGeometryAlgorithms ()
 
- Protected Member Functions inherited from sofa::component::topology::HexahedronSetGeometryAlgorithms< DataTypes >
 HexahedronSetGeometryAlgorithms ()
 
virtual ~HexahedronSetGeometryAlgorithms ()
 
void defineHexahedronCubaturePoints ()
 
- Protected Member Functions inherited from sofa::component::topology::QuadSetGeometryAlgorithms< DataTypes >
 QuadSetGeometryAlgorithms ()
 
virtual ~QuadSetGeometryAlgorithms ()
 
- Protected Member Functions inherited from sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >
 EdgeSetGeometryAlgorithms ()
 
 ~EdgeSetGeometryAlgorithms () override
 
void defineEdgeCubaturePoints ()
 
- Protected Member Functions inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
 PointSetGeometryAlgorithms ()
 
 ~PointSetGeometryAlgorithms () override
 

Additional Inherited Members

- Static Public Member Functions inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
template<class T >
static bool canCreate (T *&obj, core::objectmodel::BaseContext *context, core::objectmodel::BaseObjectDescription *arg)
 

Attribute details

template<class DataTypes >
MObject* sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::dof
protected
template<class DataTypes >
DynamicSparseGridTopologyContainer* sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::topoContainer
protected

Constructor details

template<class DataTypes >
virtual sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::~DynamicSparseGridGeometryAlgorithms ( )
inlineprotectedvirtual

Function details

template<>
int sofa::component::topology::DynamicSparseGridGeometryAlgorithms< Vec2Types >::findNearestElementInRestPos ( const Coord pos,
sofa::defaulttype::Vector3 &  baryC,
Real distance 
) const
template<>
int sofa::component::topology::DynamicSparseGridGeometryAlgorithms< Vec1Types >::findNearestElementInRestPos ( const Coord pos,
sofa::defaulttype::Vector3 &  baryC,
Real distance 
) const
template<class DataTypes >
int sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::findNearestElementInRestPos ( const Coord pos,
defaulttype::Vector3 &  baryC,
Real distance 
) const
overridevirtual

finds a hexahedron, in its rest position, which is nearest to a given point. Computes barycentric coordinates and a distance measure.

Reimplemented from sofa::component::topology::HexahedronSetGeometryAlgorithms< DataTypes >.

template<>
int SOFA_SOFANONUNIFORMFEM_API sofa::component::topology::DynamicSparseGridGeometryAlgorithms< defaulttype::Vec2Types >::findNearestElementInRestPos ( const Coord pos,
sofa::defaulttype::Vector3 &  baryC,
Real distance 
) const
template<>
int SOFA_SOFANONUNIFORMFEM_API sofa::component::topology::DynamicSparseGridGeometryAlgorithms< defaulttype::Vec1Types >::findNearestElementInRestPos ( const Coord pos,
sofa::defaulttype::Vector3 &  baryC,
Real distance 
) const
template<class DataTypes >
unsigned int sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::getRegularGridIndexFromTopoIndex ( core::topology::BaseMeshTopology::HexaID  index)
template<class DataTypes >
core::topology::BaseMeshTopology::HexaID sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::getTopoIndexFromRegularGridIndex ( unsigned int  index,
bool existing 
)
template<class DataTypes >
void sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::init ( void  )
override
template<class DataTypes >
sofa::component::topology::DynamicSparseGridGeometryAlgorithms< DataTypes >::SOFA_CLASS ( SOFA_TEMPLATE(DynamicSparseGridGeometryAlgorithms< DataTypes >, DataTypes)  ,
SOFA_TEMPLATE(HexahedronSetGeometryAlgorithms, DataTypes)   
)