SOFA API  7352f41a
Open source framework for multi-physics simuation
sofa::component::topology::container::grid::SparseGridTopology Class Reference

#include <SparseGridTopology.h>

Inheritance diagram for sofa::component::topology::container::grid::SparseGridTopology:

Detailed Description

A sparse grid topology. Like a sparse FFD building from the bounding box of the object. Starting from a RegularGrid, only valid cells containing matter (ie intersecting the original surface mesh or totally inside the object) are considered. Valid cells are tagged by a Type BOUNDARY or INSIDE WARNING: the corresponding node in the XML file has to be placed BEFORE the MechanicalObject node, in order to excute its init() before the MechanicalObject one in order to be able to give dofs

Public Attributes

HierarchicalCubeMap _hierarchicalCubeMap
 
InverseHierarchicalCubeMap _inverseHierarchicalCubeMap
 
HierarchicalPointMap _hierarchicalPointMap
 
InverseHierarchicalPointMap _inverseHierarchicalPointMap
 
PointMap _pointMap
 a coarse point indice -> corresponding point in finer level More...
 
PointMap _inversePointMap
 a fine point indice -> corresponding point in coarser level More...
 
NodeAdjacency _nodeAdjacency
 
NodeCubesAdjacency _nodeCubesAdjacency
 
NodeCornersAdjacency _nodeCornersAdjacency
 
type::vector< SparseGridTopology::SPtr_virtualFinerLevels
 saving the virtual levels (cf _nbVirtualFinerLevels) More...
 
sofa::core::sptr< RegularGridTopology_regularGrid
 based on a corresponding RegularGrid More...
 
type::vector< Index_indicesOfRegularCubeInSparseGrid
 to redirect an indice of a cube in the regular grid to its indice in the sparse grid More...
 
type::vector< Index_indicesOfCubeinRegularGrid
 to redirect an indice of a cube in the sparse grid to its indice in the regular grid More...
 
Data< type::vector< unsigned char > > dataVoxels
 
Data< bool_fillWeighted
 is quantity of matter inside a cell taken into account? More...
 
Data< boold_bOnlyInsideCells
 Select only inside cells (exclude boundary cells) More...
 
Data< type::Vec3idataResolution
 Dimension of the voxel File. More...
 
Data< type::Vec3voxelSize
 Dimension of one voxel. More...
 
Data< unsigned int > marchingCubeStep
 Step of the Marching Cube algorithm. More...
 
Data< unsigned int > convolutionSize
 Dimension of the convolution kernel to smooth the voxels. 0 if no smoothing is required. More...
 
Data< type::vector< type::vector< Index > > > facets
 Input mesh facets. More...
 
- Public Attributes inherited from sofa::component::topology::container::constant::MeshTopology
Data< SeqPointsseqPoints
 List of point positions. More...
 
Data< SeqEdgesseqEdges
 List of edge indices. More...
 
Data< SeqTrianglesseqTriangles
 List of triangle indices. More...
 
Data< SeqQuadsseqQuads
 List of quad indices. More...
 
Data< SeqTetrahedraseqTetrahedra
 List of tetrahedron indices. More...
 
Data< SeqHexahedraseqHexahedra
 List of hexahedron indices. More...
 
Data< SeqUVseqUVs
 List of uv coordinates. More...
 
int revision
 
Data< bool_drawEdges
 if true, draw the topology Edges More...
 
Data< bool_drawTriangles
 if true, draw the topology Triangles More...
 
Data< bool_drawQuads
 if true, draw the topology Quads More...
 
Data< bool_drawTetra
 if true, draw the topology Tetrahedra More...
 
Data< bool_drawHexa
 if true, draw the topology hexahedra More...
 
- Public Attributes inherited from sofa::core::objectmodel::BaseObject
Data< boolf_listening
 if true, handle the events, otherwise ignore the events More...
 
- Public Attributes inherited from sofa::core::objectmodel::Base
std::vector< lifecycle::DeprecatedData * > m_oldAttributes
 
Data< int > d_messageLogCount
 
Data< std::string > name
 Name of the object. More...
 
Data< boolf_printLog
 if true, emits extra messages at runtime. More...
 
Data< sofa::core::objectmodel::TagSetf_tags
 list of the subsets the objet belongs to More...
 
Data< sofa::type::BoundingBoxf_bbox
 this object bounding box More...
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 the object state More...
 
std::string m_definitionSourceFileName {""}
 
int m_definitionSourceFilePos {-1}
 
std::string m_instanciationSourceFileName {""}
 
int m_instanciationSourceFilePos {-1}
 

Static Public Attributes

static const float WEIGHT27 [8][27]
 
static const Index cornerIndicesFromFineToCoarse [8][8]
 
- Static Public Attributes inherited from sofa::core::topology::BaseMeshTopology
static constexpr EdgesInTriangle InvalidEdgesInTriangles = type::makeHomogeneousArray<EdgesInTriangle>(sofa::InvalidID)
 
static constexpr EdgesInQuad InvalidEdgesInQuad = type::makeHomogeneousArray<EdgesInQuad>(sofa::InvalidID)
 
static constexpr TrianglesInTetrahedron InvalidTrianglesInTetrahedron = type::makeHomogeneousArray<TrianglesInTetrahedron>(sofa::InvalidID)
 
static constexpr EdgesInTetrahedron InvalidEdgesInTetrahedron = type::makeHomogeneousArray<EdgesInTetrahedron>(sofa::InvalidID)
 
static constexpr QuadsInHexahedron InvalidQuadsInHexahedron = type::makeHomogeneousArray<QuadsInHexahedron>(sofa::InvalidID)
 
static constexpr EdgesInHexahedron InvalidEdgesInHexahedron = type::makeHomogeneousArray<EdgesInHexahedron>(sofa::InvalidID)
 
- Static Public Attributes inherited from sofa::core::topology::Topology
static constexpr Index InvalidID = sofa::InvalidID
 
static const auto InvalidSet = sofa::topology::InvalidSet
 
static constexpr auto InvalidEdge = sofa::topology::InvalidEdge
 
static constexpr auto InvalidTriangle = sofa::topology::InvalidTriangle
 
static constexpr auto InvalidQuad = sofa::topology::InvalidQuad
 
static constexpr auto InvalidTetrahedron = sofa::topology::InvalidTetrahedron
 
static constexpr auto InvalidPentahedron = sofa::topology::InvalidPentahedron
 
static constexpr auto InvalidHexahedron = sofa::topology::InvalidHexahedron
 
static constexpr auto InvalidPyramid = sofa::topology::InvalidPyramid
 

Protected Attributes

bool isVirtual
 
Data< sofa::type::Vec< 3, int > > n
 cutting number in all directions More...
 
Data< type::Vec3_min
 Min. More...
 
Data< type::Vec3_max
 Max. More...
 
Data< SReal > _cellWidth
 if > 0 : dimension of each cell in the created grid More...
 
Data< int > _nbVirtualFinerLevels
 create virtual (not in the animation tree) finer sparse grids in order to dispose of finest information (usefull to compute better mechanical properties for example) More...
 
sofa::helper::MarchingCubeUtility marchingCubes
 
bool _usingMC
 
type::vector< Type_types
 BOUNDARY or FULL filled cells. More...
 
type::vector< float_stiffnessCoefs
 a stiffness coefficient per hexa (BOUNDARY=.5, FULL=1) More...
 
type::vector< float_massCoefs
 a stiffness coefficient per hexa (BOUNDARY=.5, FULL=1) More...
 
SparseGridTopology_finerSparseGrid
 an eventual finer sparse grid that can be used to built this coarser sparse grid More...
 
SparseGridTopology_coarserSparseGrid
 an eventual coarser sparse grid More...
 
bool _alreadyInit
 
- Protected Attributes inherited from sofa::component::topology::container::constant::MeshTopology
Size nbPoints
 
bool validTetrahedra
 
bool validHexahedra
 
type::vector< EdgesAroundVertexm_edgesAroundVertex
 
type::vector< EdgesAroundVertexm_orientedEdgesAroundVertex
 
type::vector< EdgesInTrianglem_edgesInTriangle
 
type::vector< EdgesInQuadm_edgesInQuad
 provides the 4 edges in each quad More...
 
type::vector< EdgesInTetrahedronm_edgesInTetrahedron
 provides the set of edges for each tetrahedron More...
 
type::vector< EdgesInHexahedronm_edgesInHexahedron
 provides the set of edges for each hexahedron More...
 
type::vector< TrianglesAroundVertexm_trianglesAroundVertex
 for each vertex provides the set of triangles adjacent to that vertex More...
 
type::vector< TrianglesAroundVertexm_orientedTrianglesAroundVertex
 for each vertex provides the set of oriented triangles adjacent to that vertex More...
 
type::vector< TrianglesAroundEdgem_trianglesAroundEdge
 for each edge provides the set of triangles adjacent to that edge More...
 
type::vector< TrianglesInTetrahedronm_trianglesInTetrahedron
 provides the set of triangles adjacent to each tetrahedron More...
 
type::vector< QuadsAroundVertexm_quadsAroundVertex
 for each vertex provides the set of quads adjacent to that vertex More...
 
type::vector< QuadsAroundVertexm_orientedQuadsAroundVertex
 for each vertex provides the set of oriented quads adjacent to that vertex More...
 
type::vector< QuadsAroundEdgem_quadsAroundEdge
 for each edge provides the set of quads adjacent to that edge More...
 
type::vector< QuadsInHexahedronm_quadsInHexahedron
 provides the set of quads adjacents to each hexahedron More...
 
type::vector< TetrahedraAroundVertexm_tetrahedraAroundVertex
 provides the set of tetrahedrons adjacents to each vertex More...
 
type::vector< TetrahedraAroundEdgem_tetrahedraAroundEdge
 for each edge provides the set of tetrahedra adjacent to that edge More...
 
type::vector< TetrahedraAroundTrianglem_tetrahedraAroundTriangle
 for each triangle provides the set of tetrahedrons adjacent to that triangle More...
 
type::vector< HexahedraAroundVertexm_hexahedraAroundVertex
 provides the set of hexahedrons for each vertex More...
 
type::vector< HexahedraAroundEdgem_hexahedraAroundEdge
 for each edge provides the set of tetrahedra adjacent to that edge More...
 
type::vector< HexahedraAroundQuadm_hexahedraAroundQuad
 for each quad provides the set of hexahedrons adjacent to that quad More...
 
sofa::geometry::ElementType m_upperElementType
 Type of higher topology element contains in this container. More...
 
- Protected Attributes inherited from sofa::core::topology::BaseMeshTopology
sofa::core::objectmodel::DataFileName fileTopology
 
- Protected Attributes inherited from sofa::core::objectmodel::BaseObject
SingleLink< BaseObject, BaseContext, BaseLink::FLAG_DOUBLELINKl_context
 
LinkSlaves l_slaves
 
SingleLink< BaseObject, BaseObject, BaseLink::FLAG_DOUBLELINKl_master
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
std::map< std::string, sofa::core::DataTrackerCallbackm_internalEngine
 
VecData m_vecData
 List of fields (Data instances) More...
 
MapData m_aliasData
 name -> Data multi-map (includes names and aliases) More...
 
VecLink m_vecLink
 List of links. More...
 
MapLink m_aliasLink
 name -> Link multi-map (includes names and aliases) More...
 

Public Member Functions

 SOFA_CLASS (SparseGridTopology, MeshTopology)
 
 SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER (Vector3, sofa::type::Vec3)
 
 SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER (Vec3i, sofa::type::Vec3i)
 
 SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER (BoundingBox, sofa::type::BoundingBox)
 
void init () override
 Initialization method called at graph creation and modification, during top-down traversal. More...
 
virtual void buildAsFinest ()
 building from a mesh file More...
 
virtual void buildFromFiner ()
 building by condensating a finer sparse grid (used if setFinerSparseGrid has initializated _finerSparseGrid before calling init() ) More...
 
virtual void buildVirtualFinerLevels ()
 building eventual virtual finer levels (cf _nbVirtualFinerLevels) More...
 
int getNbVirtualFinerLevels () const
 
void setNbVirtualFinerLevels (int n)
 
sofa::type::Vec< 3, int > getN () const
 Resolution. More...
 
int getNx () const
 
int getNy () const
 
int getNz () const
 
void setN (type::Vec3i _n)
 
void setNx (int _n)
 
void setNy (int _n)
 
void setNz (int _n)
 
void setMin (type::Vec3 val)
 
void setXmin (SReal val)
 
void setYmin (SReal val)
 
void setZmin (SReal val)
 
void setMax (type::Vec3 val)
 
void setXmax (SReal val)
 
void setYmax (SReal val)
 
void setZmax (SReal val)
 
type::Vec3 getMin ()
 
SReal getXmin ()
 
SReal getYmin ()
 
SReal getZmin ()
 
type::Vec3 getMax ()
 
SReal getXmax ()
 
SReal getYmax ()
 
SReal getZmax ()
 
bool hasPos () const override
 
virtual Index findCube (const type::Vec3 &pos, SReal &fx, SReal &fy, SReal &fz)
 
virtual Index findNearestCube (const type::Vec3 &pos, SReal &fx, SReal &fy, SReal &fz)
 
virtual type::fixed_array< Index, 6 > findneighboorCubes (Index indice)
 return indices of 6 neighboor cubes More...
 
virtual Type getType (Index i)
 return the type of the i-th cube More...
 
virtual float getStiffnessCoef (Index elementIdx)
 return the stiffness coefficient of the i-th cube More...
 
virtual float getMassCoef (Index elementIdx)
 return the mass coefficient of the i-th cube More...
 
SparseGridTopologygetFinerSparseGrid () const
 
void setFinerSparseGrid (SparseGridTopology *fsp)
 
SparseGridTopologygetCoarserSparseGrid () const
 
void setCoarserSparseGrid (SparseGridTopology *csp)
 
void updateMesh ()
 
type::Vec3 getPointPos (Index i)
 
void getMesh (sofa::helper::io::Mesh &m)
 
void setDimVoxels (int a, int b, int c)
 
void setSizeVoxel (SReal a, SReal b, SReal c)
 
bool getVoxel (unsigned int x, unsigned int y, unsigned int z)
 
bool getVoxel (unsigned int index) const
 
void buildFromData (type::Vec3i numPoints, type::BoundingBox box, const type::vector< bool > &filling)
 
const SeqHexahedragetHexahedra () override
 
Size getNbPoints () const override
 
Size getNbHexahedra () override
 TODO 2018-07-23 epernod: check why this method is override to return the same result as parent class. More...
 
- Public Member Functions inherited from sofa::component::topology::container::constant::MeshTopology
 SOFA_CLASS (MeshTopology, core::topology::BaseMeshTopology)
 
void setNbPoints (Size n) override
 
const SeqEdgesgetEdges () override
 
const SeqTrianglesgetTriangles () override
 
const SeqQuadsgetQuads () override
 
const SeqTetrahedragetTetrahedra () override
 
Size getNbEdges () override
 
Size getNbTriangles () override
 
Size getNbQuads () override
 
Size getNbTetrahedra () override
 
const Edge getEdge (EdgeID i) override
 
const Triangle getTriangle (TriangleID i) override
 
const Quad getQuad (QuadID i) override
 
const Tetra getTetrahedron (TetraID i) override
 
const Hexa getHexahedron (HexaID i) override
 
virtual const SeqUVgetUVs ()
 
virtual Size getNbUVs ()
 
virtual const UV getUV (UVID i)
 
void addUV (SReal u, SReal v)
 
SReal getPosX (Index i) const
 
SReal getPosY (Index i) const
 
SReal getPosZ (Index i) const
 
SReal getPX (Index i) const override
 
SReal getPY (Index i) const override
 
SReal getPZ (Index i) const override
 
void clear () override
 
void addPoint (SReal px, SReal py, SReal pz) override
 
void addEdge (Index a, Index b) override
 
void addTriangle (Index a, Index b, Index c) override
 
void addQuad (Index a, Index b, Index c, Index d) override
 
void addTetra (Index a, Index b, Index c, Index d) override
 
void addHexa (Index a, Index b, Index c, Index d, Index e, Index f, Index g, Index h) override
 
int getRevision () const override
 get the current revision of this mesh (use to detect changes) More...
 
void draw (const core::visual::VisualParams *vparams) override
 Render internal data of this object, for debugging purposes. More...
 
virtual bool hasVolume ()
 
virtual bool hasSurface ()
 
virtual bool hasLines ()
 
virtual bool isVolume ()
 
virtual bool isSurface ()
 
virtual bool isLines ()
 
virtual const EdgesAroundVertexgetOrientedEdgesAroundVertex (PointID i)
 Returns the set of edges adjacent to a given vertex. More...
 
virtual const TrianglesAroundVertexgetOrientedTrianglesAroundVertex (PointID i)
 Returns the set of oriented triangle adjacent to a given vertex. More...
 
virtual const QuadsAroundVertexgetOrientedQuadsAroundVertex (PointID i)
 Returns the set of oriented quad adjacent to a given vertex. More...
 
int computeRelativeOrientationInTri (const PointID ind_p0, const PointID ind_p1, const PointID ind_t)
 
int computeRelativeOrientationInQuad (const PointID ind_p0, const PointID ind_p1, const PointID ind_q)
 
void reOrientateTriangle (TriangleID id) override
 Will change order of vertices in triangle: t[1] <=> t[2]. More...
 
EdgeID getEdgeIndex (PointID v1, PointID v2) override
 Returns the index of the edge joining vertex v1 and vertex v2; returns InvalidID if no edge exists. More...
 
TriangleID getTriangleIndex (PointID v1, PointID v2, PointID v3) override
 
QuadID getQuadIndex (PointID v1, PointID v2, PointID v3, PointID v4) override
 Returns the index of the quad joining vertex v1, v2, v3 and v4; returns InvalidID if none. More...
 
TetrahedronID getTetrahedronIndex (PointID v1, PointID v2, PointID v3, PointID v4) override
 Returns the index of the tetrahedron given four vertex indices; returns InvalidID if none. More...
 
HexahedronID getHexahedronIndex (PointID v1, PointID v2, PointID v3, PointID v4, PointID v5, PointID v6, PointID v7, PointID v8) override
 Returns the index of the hexahedron given eight vertex indices; returns InvalidID if none. More...
 
int getVertexIndexInTriangle (const Triangle &t, PointID vertexIndex) const override
 Returns the index (either 0, 1 ,2 or 3) of the vertex whose global index is vertexIndex. Returns -1 if none. More...
 
int getEdgeIndexInTriangle (const EdgesInTriangle &t, EdgeID edgeIndex) const override
 Returns the index (either 0, 1 ,2) of the edge whose global index is edgeIndex. Returns -1 if none. More...
 
int getVertexIndexInQuad (const Quad &t, PointID vertexIndex) const override
 Returns the index (either 0, 1 ,2 or 3) of the vertex whose global index is vertexIndex. Returns -1 if none. More...
 
int getEdgeIndexInQuad (const EdgesInQuad &t, EdgeID edgeIndex) const override
 Returns the index (either 0, 1 ,2, 3) of the edge whose global index is edgeIndex. Returns -1 if none. More...
 
int getVertexIndexInTetrahedron (const Tetra &t, PointID vertexIndex) const override
 Returns the index (either 0, 1 ,2 or 3) of the vertex whose global index is vertexIndex. Returns -1 if none. More...
 
int getEdgeIndexInTetrahedron (const EdgesInTetrahedron &t, EdgeID edgeIndex) const override
 Returns the index (either 0, 1 ,2 ,3, 4, 5) of the edge whose global index is edgeIndex. Returns -1 if none. More...
 
int getTriangleIndexInTetrahedron (const TrianglesInTetrahedron &t, TriangleID triangleIndex) const override
 Returns the index (either 0, 1 ,2 ,3) of the triangle whose global index is triangleIndex. Returns -1 if none. More...
 
int getVertexIndexInHexahedron (const Hexa &t, PointID vertexIndex) const override
 Returns the index (either 0, 1 ,2, 3, 4, 5, 6, or 7) of the vertex whose global index is vertexIndex. Returns -1 if none. More...
 
int getEdgeIndexInHexahedron (const EdgesInHexahedron &t, EdgeID edgeIndex) const override
 Returns the index (either 0, 1 ,2 ,3, 4, 5, 6, 7, 8, 9, 10, 11) of the edge whose global index is edgeIndex. Returns -1 if none. More...
 
int getQuadIndexInHexahedron (const QuadsInHexahedron &t, QuadID quadIndex) const override
 Returns the index (either 0, 1 ,2 ,3, 4, 5) of the quad whose global index is quadIndex. Returns -1 if none. More...
 
Edge getLocalEdgesInTetrahedron (const HexahedronID i) const override
 Returns for each index (between 0 and 5) the two vertex indices that are adjacent to that edge. More...
 
Edge getLocalEdgesInHexahedron (const HexahedronID i) const override
 Returns for each index (between 0 and 12) the two vertex indices that are adjacent to that edge. More...
 
sofa::geometry::ElementType getTopologyType () const override
 
void invalidate ()
 
virtual void updateTetrahedra ()
 
virtual void updateHexahedra ()
 
const EdgesAroundVertexgetEdgesAroundVertex (PointID i) override
 Returns the set of edges adjacent to a given vertex. More...
 
const type::vector< EdgesAroundVertex > & getEdgesAroundVertexArray ()
 Returns the TrianglesAroundVertex array (i.e. provide the triangles indices adjacent to each vertex). More...
 
const TrianglesAroundVertexgetTrianglesAroundVertex (PointID i) override
 Returns the set of triangles adjacent to a given vertex. More...
 
const type::vector< TrianglesAroundVertex > & getTrianglesAroundVertexArray ()
 Returns the TrianglesAroundVertex array (i.e. provide the triangles indices adjacent to each vertex). More...
 
const EdgesInTrianglegetEdgesInTriangle (TriangleID i) override
 Returns the set of 3 edge indices of a given triangle. More...
 
const type::vector< EdgesInTriangle > & getEdgesInTriangleArray ()
 Returns the EdgesInTriangle array (i.e. provide the 3 edge indices for each triangle). More...
 
const TrianglesAroundEdgegetTrianglesAroundEdge (EdgeID i) override
 Returns the set of triangle adjacent to a given edge. More...
 
const type::vector< TrianglesAroundEdge > & getTrianglesAroundEdgeArray ()
 Returns the TrianglesAroundEdge array (i.e. provide the triangles indices adjacent to each edge). More...
 
const QuadsAroundVertexgetQuadsAroundVertex (PointID i) override
 Returns the set of quads adjacent to a given vertex. More...
 
const type::vector< QuadsAroundVertex > & getQuadsAroundVertexArray ()
 Returns the QuadsAroundVertex array (i.e. provide the quad indices adjacent to each vertex). More...
 
const EdgesInQuadgetEdgesInQuad (QuadID i) override
 Returns the set of edges adjacent to a given quad. More...
 
const type::vector< EdgesInQuad > & getEdgesInQuadArray ()
 Returns the EdgesInQuadArray array (i.e. provide the 4 edge indices for each quad) More...
 
const QuadsAroundEdgegetQuadsAroundEdge (EdgeID i) override
 Returns the set of quad adjacent to a given edge. More...
 
const type::vector< QuadsAroundEdge > & getQuadsAroundEdgeArray ()
 Returns the QuadsAroundEdge array (i.e. provide the quad indices adjacent to each edge). More...
 
const TetrahedraAroundVertexgetTetrahedraAroundVertex (PointID i) override
 Returns the set of tetrahedra adjacent to a given vertex. More...
 
const type::vector< TetrahedraAroundVertex > & getTetrahedraAroundVertexArray ()
 Returns the TetrahedraAroundVertex array (i.e. provide the tetrahedron indices adjacent to each vertex). More...
 
const EdgesInTetrahedrongetEdgesInTetrahedron (TetraID i) override
 Returns the set of edges adjacent to a given tetrahedron. More...
 
const type::vector< EdgesInTetrahedron > & getEdgesInTetrahedronArray ()
 Returns the EdgesInTetrahedron array (i.e. provide the 6 edge indices for each tetrahedron). More...
 
const TetrahedraAroundEdgegetTetrahedraAroundEdge (EdgeID i) override
 Returns the set of tetrahedra adjacent to a given edge. More...
 
const type::vector< TetrahedraAroundEdge > & getTetrahedraAroundEdgeArray ()
 Returns the TetrahedraAroundEdge array (i.e. provide the tetrahedron indices adjacent to each edge). More...
 
const TrianglesInTetrahedrongetTrianglesInTetrahedron (TetraID i) override
 Returns the set of triangles adjacent to a given tetrahedron. More...
 
const type::vector< TrianglesInTetrahedron > & getTrianglesInTetrahedronArray ()
 Returns the TrianglesInTetrahedron array (i.e. provide the 4 triangle indices for each tetrahedron). More...
 
const TetrahedraAroundTrianglegetTetrahedraAroundTriangle (TriangleID i) override
 Returns the set of tetrahedra adjacent to a given triangle. More...
 
const type::vector< TetrahedraAroundTriangle > & getTetrahedraAroundTriangleArray ()
 Returns the TetrahedraAroundTriangle array (i.e. provide the tetrahedron indices adjacent to each triangle). More...
 
const HexahedraAroundVertexgetHexahedraAroundVertex (PointID i) override
 Returns the set of hexahedra adjacent to a given vertex. More...
 
const type::vector< HexahedraAroundVertex > & getHexahedraAroundVertexArray ()
 Returns the HexahedraAroundVertex array (i.e. provide the hexahedron indices adjacent to each vertex). More...
 
const EdgesInHexahedrongetEdgesInHexahedron (HexaID i) override
 Returns the set of edges adjacent to a given hexahedron. More...
 
const type::vector< EdgesInHexahedron > & getEdgesInHexahedronArray ()
 Returns the EdgesInHexahedron array (i.e. provide the 12 edge indices for each hexahedron).
More...
 
const HexahedraAroundEdgegetHexahedraAroundEdge (EdgeID i) override
 Returns the set of hexahedra adjacent to a given edge. More...
 
const type::vector< HexahedraAroundEdge > & getHexahedraAroundEdgeArray ()
 Returns the HexahedraAroundEdge array (i.e. provide the hexahedron indices adjacent to each edge). More...
 
const QuadsInHexahedrongetQuadsInHexahedron (HexaID i) override
 Returns the set of quads adjacent to a given hexahedron. More...
 
const type::vector< QuadsInHexahedron > & getQuadsInHexahedronArray ()
 Returns the QuadsInHexahedron array (i.e. provide the 8 quad indices for each hexahedron).
More...
 
const HexahedraAroundQuadgetHexahedraAroundQuad (QuadID i) override
 Returns the set of hexahedra adjacent to a given quad. More...
 
const type::vector< HexahedraAroundQuad > & getHexahedraAroundQuadArray ()
 Returns the HexahedraAroundQuad array (i.e. provide the hexahedron indices adjacent to each quad). More...
 
bool checkConnexity () override
 Checks if the topology has only one connected component. More...
 
Size getNumberOfConnectedComponent () override
 Returns the number of connected component. More...
 
virtual const type::vector< IndexgetConnectedElement (Index elem) override
 Returns the set of element indices connected to an input one (i.e. which can be reached by topological links) More...
 
virtual const type::vector< IndexgetElementAroundElement (Index elem) override
 Returns the set of element indices adjacent to a given element (i.e. sharing a link) More...
 
virtual const type::vector< IndexgetElementAroundElements (type::vector< Index > elems) override
 Returns the set of element indices adjacent to a given list of elements (i.e. sharing a link) More...
 
- Public Member Functions inherited from sofa::core::topology::BaseMeshTopology
 SOFA_ABSTRACT_CLASS (BaseMeshTopology, core::topology::Topology)
 
void init () override
 Initialization method called at graph creation and modification, during top-down traversal. More...
 
virtual bool load (const char *filename)
 
virtual std::string getFilename () const
 
virtual Triangle getLocalTrianglesInTetrahedron (const PointID i) const
 Returns for each index (between 0 and 3) the three local vertices indices that are adjacent to that triangle. More...
 
virtual Quad getLocalQuadsInHexahedron (const PointID i) const
 Returns for each index (between 0 and 6) the four vertices indices that are adjacent to that quad. More...
 
virtual const sofa::type::vector< TriangleID > & getTrianglesOnBorder ()
 Returns the set of triangles on the border of the triangulation. More...
 
virtual const sofa::type::vector< EdgeID > & getEdgesOnBorder ()
 Returns the set of edges on the border of the triangulation. More...
 
virtual const sofa::type::vector< PointID > & getPointsOnBorder ()
 Returns the set of points on the border of the triangulation. More...
 
bool insertInNode (objectmodel::BaseNode *node) override
 
bool removeInNode (objectmodel::BaseNode *node) override
 
virtual Size getNbTetras ()
 
virtual Size getNbHexas ()
 
virtual Tetra getTetra (TetraID i)
 
virtual Hexa getHexa (HexaID i)
 
virtual const SeqTetrahedragetTetras ()
 
virtual const SeqHexahedragetHexas ()
 
virtual const VerticesAroundVertex getVerticesAroundVertex (PointID i)
 Returns the set of vertices adjacent to a given vertex (i.e. sharing an edge) More...
 
const SeqLinesgetLines ()
 
Size getNbLines ()
 
Line getLine (LineID i)
 
bool hasPos () const override
 
SReal getPX (Index) const override
 
SReal getPY (Index) const override
 
SReal getPZ (Index) const override
 
void addLine (Index a, Index b)
 
virtual bool checkTopology () const
 Checks if the topology is coherent. More...
 
virtual std::list< const TopologyChange * >::const_iterator beginChange () const
 Provides an iterator on the first element in the list of TopologyChange objects. More...
 
virtual std::list< const TopologyChange * >::const_iterator endChange () const
 Provides an iterator on the last element in the list of TopologyChange objects. More...
 
virtual std::list< const TopologyChange * >::const_iterator beginStateChange () const
 Provides an iterator on the first element in the list of StateChange objects. More...
 
virtual std::list< const TopologyChange * >::const_iterator endStateChange () const
 Provides an iterator on the last element in the list of StateChange objects. More...
 
- Public Member Functions inherited from sofa::core::topology::Topology
 SOFA_CLASS (Topology, core::objectmodel::BaseObject)
 
bool insertInNode (objectmodel::BaseNode *node) override
 
bool removeInNode (objectmodel::BaseNode *node) override
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseObject
 SOFA_CLASS (BaseObject, Base)
 
virtual void computeBBox (const core::ExecParams *, bool=false)
 
void setSrc (const std::string &v, std::vector< std::string > *attributeList=nullptr)
 Sets a source Object and parses it to collect dependent Data. More...
 
void setSrc (const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr)
 
BasefindLinkDestClass (const BaseClass *destType, const std::string &path, const BaseLink *link) override
 
virtual std::string getPathName () const override
 Return the full path name of this object. More...
 
SReal getTime () const
 Current time. More...
 
const BaseContextgetContext () const
 
BaseContextgetContext ()
 
const BaseObjectgetMaster () const
 
BaseObjectgetMaster ()
 
const VecSlavesgetSlaves () const
 
BaseObjectgetSlave (const std::string &name) const
 
virtual void addSlave (BaseObject::SPtr s)
 
virtual void removeSlave (BaseObject::SPtr s)
 
virtual void handleEvent (Event *)
 Handle an event. More...
 
virtual void handleTopologyChange ()
 
virtual void handleTopologyChange (core::topology::Topology *t)
 
void parse (BaseObjectDescription *arg) override
 Parse the given description to assign values to this object's fields and potentially other parameters. More...
 
virtual void bwdInit ()
 Initialization method called at graph creation and modification, during bottom-up traversal. More...
 
virtual void reinit ()
 Update method called when variables used in precomputation are modified. More...
 
void updateInternal ()
 Update method called when variables (used to compute other internal variables) are modified. More...
 
virtual void storeResetState ()
 Save the initial state for later uses in reset() More...
 
virtual void reset ()
 Reset to initial state. More...
 
virtual void cleanup ()
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addDeprecatedAttribute (lifecycle::DeprecatedData *attribute)
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputsToCallback (const std::string &name, std::initializer_list< BaseData * > outputs)
 
const std::string & getName () const
 Accessor to the object name. More...
 
void setName (const std::string &n)
 Set the name of this object. More...
 
void setName (const std::string &n, int counter)
 Set the name of this object, adding an integer counter. More...
 
std::string getTypeName () const
 Get the type name of this object (i.e. class and template types) More...
 
virtual std::string getClassName () const
 Get the class name of this object. More...
 
virtual std::string getTemplateName () const final
 Get the template type names (if any) used to instantiate this object. More...
 
std::string getNameSpaceName () const
 Get the template type names (if any) used to instantiate this object. More...
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 Set the source filename (where the component is implemented) More...
 
const std::string & getDefinitionSourceFileName () const
 Get the source filename (where the component is implemented) More...
 
void setDefinitionSourceFilePos (const int)
 Set the source location (where the component is implemented) More...
 
int getDefinitionSourceFilePos () const
 Get the source location (where the component is implemented) More...
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
const sofa::core::objectmodel::TagSetgetTags () const
 Represents the subsets the object belongs to. More...
 
bool hasTag (Tag t) const
 Return true if the object belong to the given subset. More...
 
void addTag (Tag t)
 Add a subset qualification to the object. More...
 
void removeTag (Tag t)
 Remove a subset qualification to the object. More...
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 Assign one field value (Data or Link) More...
 
virtual bool hasField (const std::string &attribute) const
 Check if a given Data field or Link exists. More...
 
void parseFields (const std::list< std::string > &str)
 Assign the field values stored in the given list of name + value pairs of strings. More...
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 Assign the field values stored in the given map of name -> value pairs. More...
 
void writeDatas (std::map< std::string, std::string * > &str)
 Write the current field values to the given map of name -> value pairs. More...
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 Find data fields given a name: several can be found as we look into the alias map. More...
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 Find link fields given a name: several can be found as we look into the alias map. More...
 
virtual void updateLinks (bool logErrors=true)
 Update pointers in case the pointed-to objects have appeared. More...
 
template<class T >
BaseData::BaseInitData initData (::sofa::core::objectmodel::Data< T > *field, const char *name, const char *help, ::sofa::core::objectmodel::BaseData::DataFlags dataflags)
 Helper method used to initialize a data field containing a value of type T. More...
 
template<class T >
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
template<class T >
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 Remove a data field. More...
 
void addAlias (BaseData *field, const char *alias)
 Add an alias to a Data. More...
 
void addLink (BaseLink *l)
 Add a link. More...
 
void addAlias (BaseLink *link, const char *alias)
 Add an alias to a Link. More...
 
const VecDatagetDataFields () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapDatagetDataAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
const VecLinkgetLinks () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapLinkgetLinkAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
template<class T >
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 

Protected Member Functions

 SparseGridTopology (bool _isVirtual=false)
 
 SparseGridTopology (type::Vec3i numVertices, type::BoundingBox box, bool _isVirtual=false)
 Define using the resolution and the spatial size. The resolution corresponds to the number of points if all the cells were filled. More...
 
virtual void updateEdges ()
 
virtual void updateQuads ()
 
void launchPropagationFromSeed (const type::Vec3i &point, sofa::core::sptr< RegularGridTopology > regularGrid, type::vector< Type > &regularGrdidTypes, type::vector< bool > &alreadyTested, std::stack< type::Vec3i > &seed) const
 start from a seed cell (i,j,k) the OUTSIDE filling is propagated to neighboor cells until meet a BOUNDARY cell (this function is called from all border cells of the RegularGrid) More...
 
void propagateFrom (const type::Vec3i &point, sofa::core::sptr< RegularGridTopology > regularGrid, type::vector< Type > &regularGridTypes, type::vector< bool > &alreadyTested, std::stack< sofa::type::Vec< 3, int > > &seed) const
 
void computeBoundingBox (const type::vector< type::Vec3 > &vertices, SReal &xmin, SReal &xmax, SReal &ymin, SReal &ymax, SReal &zmin, SReal &zmax) const
 
void voxelizeTriangleMesh (helper::io::Mesh *mesh, sofa::core::sptr< RegularGridTopology > regularGrid, type::vector< Type > &regularGridTypes) const
 
void buildFromTriangleMesh (sofa::helper::io::Mesh *mesh)
 
void buildFromRegularGridTypes (sofa::core::sptr< RegularGridTopology > regularGrid, const type::vector< Type > &regularGridTypes)
 
void buildFromVoxelFile (const std::string &filename)
 
void buildFromRawVoxelFile (const std::string &filename)
 
void buildFromVoxelLoader (sofa::core::loader::VoxelLoader *loader)
 
template<class T >
void constructCollisionModels (const sofa::type::vector< sofa::core::topology::BaseMeshTopology * > &list_mesh, const type::vector< Data< type::vector< sofa::type::Vec< 3, T > > > * > &list_X)
 
void setVoxel (int index, unsigned char value)
 
- Protected Member Functions inherited from sofa::component::topology::container::constant::MeshTopology
 MeshTopology ()
 
void createEdgesAroundVertexArray ()
 Creates the EdgeSetIndex. More...
 
void createEdgesInTriangleArray ()
 Creates the array of edge indices for each triangle. More...
 
void createEdgesInQuadArray ()
 Creates the array of edge indices for each quad. More...
 
void createEdgesInTetrahedronArray ()
 Creates the array of edge indices for each tetrahedron. More...
 
void createEdgesInHexahedronArray ()
 Creates the array of edge indices for each hexahedron. More...
 
void createTrianglesAroundVertexArray ()
 Creates the TrianglesAroundVertex Array. More...
 
void createOrientedTrianglesAroundVertexArray ()
 Creates the oriented Triangle Vertex Shell Array. More...
 
void createTrianglesAroundEdgeArray ()
 Creates the TrianglesAroundEdge Array. More...
 
void createTrianglesInTetrahedronArray ()
 Creates the array of triangle indices for each tetrahedron. More...
 
void createQuadsAroundVertexArray ()
 Creates the QuadsAroundVertex Array. More...
 
void createOrientedQuadsAroundVertexArray ()
 Creates the Quad Vertex Shell Array. More...
 
void createQuadsAroundEdgeArray ()
 Creates the quadsAroundEdge Array. More...
 
void createQuadsInHexahedronArray ()
 Creates the array of quad indices for each hexahedron. More...
 
void createTetrahedraAroundVertexArray ()
 Creates the TetrahedraAroundVertex Array. More...
 
void createTetrahedraAroundEdgeArray ()
 Creates the TetrahedraAroundEdge Array. More...
 
void createTetrahedraAroundTriangleArray ()
 Creates the TetrahedraAroundTriangle Array. More...
 
void createHexahedraAroundVertexArray ()
 Creates the HexahedraAroundVertex Array. More...
 
void createHexahedraAroundEdgeArray ()
 Creates the HexahedraAroundEdge Array. More...
 
void createHexahedraAroundQuadArray ()
 Creates the HexahedraAroundQuad Array. More...
 
- Protected Member Functions inherited from sofa::core::topology::BaseMeshTopology
 BaseMeshTopology ()
 
- Protected Member Functions inherited from sofa::core::topology::Topology
 Topology ()
 
virtual ~Topology ()
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseObject
 BaseObject ()
 
 ~BaseObject () override
 
virtual void doUpdateInternal ()
 Implementation of the internal update. More...
 
void changeContextLink (BaseContext *before, BaseContext *&after)
 
void changeSlavesLink (BaseObject::SPtr ptr, std::size_t, bool add)
 This method insures that slaves objects have master and context links set correctly. More...
 
void trackInternalData (const BaseData &data)
 Method called to add the Data to the DataTracker (listing the Data to track) More...
 
void cleanTracker ()
 
bool hasDataChanged (const BaseData &data)
 Method called to know if a tracked Data has changed. More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 Helper method used by initData() More...
 
template<class T >
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 

Additional Inherited Members

- Static Public Member Functions inherited from sofa::core::objectmodel::BaseObject
template<class T >
static bool canCreate (T *, BaseContext *, BaseObjectDescription *)
 Pre-construction check method called by ObjectFactory. More...
 
template<class T >
static T::SPtr create (T *, BaseContext *context, BaseObjectDescription *arg)
 Construction method called by ObjectFactory. More...
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
template<class T >
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 

Attribute details

◆ _alreadyInit

bool sofa::component::topology::container::grid::SparseGridTopology::_alreadyInit
protected

◆ _cellWidth

Data< SReal > sofa::component::topology::container::grid::SparseGridTopology::_cellWidth
protected

if > 0 : dimension of each cell in the created grid

◆ _coarserSparseGrid

SparseGridTopology* sofa::component::topology::container::grid::SparseGridTopology::_coarserSparseGrid
protected

an eventual coarser sparse grid

◆ _fillWeighted

Data<bool> sofa::component::topology::container::grid::SparseGridTopology::_fillWeighted

is quantity of matter inside a cell taken into account?

◆ _finerSparseGrid

SparseGridTopology* sofa::component::topology::container::grid::SparseGridTopology::_finerSparseGrid
protected

an eventual finer sparse grid that can be used to built this coarser sparse grid

◆ _hierarchicalCubeMap

HierarchicalCubeMap sofa::component::topology::container::grid::SparseGridTopology::_hierarchicalCubeMap

◆ _hierarchicalPointMap

HierarchicalPointMap sofa::component::topology::container::grid::SparseGridTopology::_hierarchicalPointMap

◆ _indicesOfCubeinRegularGrid

type::vector< Index > sofa::component::topology::container::grid::SparseGridTopology::_indicesOfCubeinRegularGrid

to redirect an indice of a cube in the sparse grid to its indice in the regular grid

◆ _indicesOfRegularCubeInSparseGrid

type::vector< Index > sofa::component::topology::container::grid::SparseGridTopology::_indicesOfRegularCubeInSparseGrid

to redirect an indice of a cube in the regular grid to its indice in the sparse grid

◆ _inverseHierarchicalCubeMap

InverseHierarchicalCubeMap sofa::component::topology::container::grid::SparseGridTopology::_inverseHierarchicalCubeMap

◆ _inverseHierarchicalPointMap

InverseHierarchicalPointMap sofa::component::topology::container::grid::SparseGridTopology::_inverseHierarchicalPointMap

◆ _inversePointMap

PointMap sofa::component::topology::container::grid::SparseGridTopology::_inversePointMap

a fine point indice -> corresponding point in coarser level

◆ _massCoefs

type::vector< float > sofa::component::topology::container::grid::SparseGridTopology::_massCoefs
protected

a stiffness coefficient per hexa (BOUNDARY=.5, FULL=1)

◆ _max

Data< type::Vec3 > sofa::component::topology::container::grid::SparseGridTopology::_max
protected

Max.

◆ _min

Data< type::Vec3 > sofa::component::topology::container::grid::SparseGridTopology::_min
protected

Min.

◆ _nbVirtualFinerLevels

Data< int > sofa::component::topology::container::grid::SparseGridTopology::_nbVirtualFinerLevels
protected

create virtual (not in the animation tree) finer sparse grids in order to dispose of finest information (usefull to compute better mechanical properties for example)

◆ _nodeAdjacency

NodeAdjacency sofa::component::topology::container::grid::SparseGridTopology::_nodeAdjacency

◆ _nodeCornersAdjacency

NodeCornersAdjacency sofa::component::topology::container::grid::SparseGridTopology::_nodeCornersAdjacency

◆ _nodeCubesAdjacency

NodeCubesAdjacency sofa::component::topology::container::grid::SparseGridTopology::_nodeCubesAdjacency

◆ _pointMap

PointMap sofa::component::topology::container::grid::SparseGridTopology::_pointMap

a coarse point indice -> corresponding point in finer level

◆ _regularGrid

sofa::core::sptr<RegularGridTopology> sofa::component::topology::container::grid::SparseGridTopology::_regularGrid

based on a corresponding RegularGrid

◆ _stiffnessCoefs

type::vector< float > sofa::component::topology::container::grid::SparseGridTopology::_stiffnessCoefs
protected

a stiffness coefficient per hexa (BOUNDARY=.5, FULL=1)

◆ _types

type::vector<Type> sofa::component::topology::container::grid::SparseGridTopology::_types
protected

BOUNDARY or FULL filled cells.

◆ _usingMC

bool sofa::component::topology::container::grid::SparseGridTopology::_usingMC
protected

◆ _virtualFinerLevels

type::vector< SparseGridTopology::SPtr > sofa::component::topology::container::grid::SparseGridTopology::_virtualFinerLevels

saving the virtual levels (cf _nbVirtualFinerLevels)

◆ convolutionSize

Data< unsigned int > sofa::component::topology::container::grid::SparseGridTopology::convolutionSize

Dimension of the convolution kernel to smooth the voxels. 0 if no smoothing is required.

◆ cornerIndicesFromFineToCoarse

const SparseGridTopology::Index sofa::component::topology::container::grid::SparseGridTopology::cornerIndicesFromFineToCoarse
static
Initial value:
=
{
{ 0, 9, 3, 12, 1, 10, 4, 13},
{ 9, 18, 12, 21, 10, 19, 13, 22},
{ 3, 12, 6, 15, 4, 13, 7, 16},
{ 12, 21, 15, 24, 13, 22, 16, 25},
{ 1, 10, 4, 13, 2, 11, 5, 14},
{ 10, 19, 13, 22, 11, 20, 14, 23},
{ 4, 13, 7, 16, 5, 14, 8, 17},
{ 13, 22, 16, 25, 14, 23, 17, 26}
}

◆ d_bOnlyInsideCells

Data<bool> sofa::component::topology::container::grid::SparseGridTopology::d_bOnlyInsideCells

Select only inside cells (exclude boundary cells)

◆ dataResolution

Data< type::Vec3i > sofa::component::topology::container::grid::SparseGridTopology::dataResolution

Dimension of the voxel File.

◆ dataVoxels

Data< type::vector< unsigned char > > sofa::component::topology::container::grid::SparseGridTopology::dataVoxels

◆ facets

Data< type::vector< type::vector<Index> > > sofa::component::topology::container::grid::SparseGridTopology::facets

Input mesh facets.

◆ isVirtual

bool sofa::component::topology::container::grid::SparseGridTopology::isVirtual
protected

◆ marchingCubes

sofa::helper::MarchingCubeUtility sofa::component::topology::container::grid::SparseGridTopology::marchingCubes
protected

◆ marchingCubeStep

Data< unsigned int > sofa::component::topology::container::grid::SparseGridTopology::marchingCubeStep

Step of the Marching Cube algorithm.

◆ n

Data< sofa::type::Vec< 3, int > > sofa::component::topology::container::grid::SparseGridTopology::n
protected

cutting number in all directions

◆ voxelSize

Data< type::Vec3 > sofa::component::topology::container::grid::SparseGridTopology::voxelSize

Dimension of one voxel.

◆ WEIGHT27

const float sofa::component::topology::container::grid::SparseGridTopology::WEIGHT27
static
Initial value:
=
{
{1.0, 0.5, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 0.25, 0.125, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 0.25, 0.125, 0.0, 0.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 1.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.25, 0.125, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.125, 0.0, 0.5, 0.25, 0.0, 0.0, 0.0, 0.0, 0.5, 0.25, 0.0, 1.0, 0.5, 0.0},
{0.0, 0.5, 1.0, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.125, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.125, 0.25, 0.0, 0.0, 0.0, 0.0, 0.5, 1.0, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.25, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.25, 0.0, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.25, 0.5, 0.0, 0.5, 1.0}
}

Constructor details

◆ SparseGridTopology() [1/2]

sofa::component::topology::container::grid::SparseGridTopology::SparseGridTopology ( bool  _isVirtual = false)
protected

◆ SparseGridTopology() [2/2]

sofa::component::topology::container::grid::SparseGridTopology::SparseGridTopology ( type::Vec3i  numVertices,
type::BoundingBox  box,
bool  _isVirtual = false 
)
protected

Define using the resolution and the spatial size. The resolution corresponds to the number of points if all the cells were filled.

Function details

◆ buildAsFinest()

void sofa::component::topology::container::grid::SparseGridTopology::buildAsFinest ( )
virtual

◆ buildFromData()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromData ( type::Vec3i  numPoints,
type::BoundingBox  box,
const type::vector< bool > &  filling 
)

Create the data structure based on resolution, size and filling.

Parameters
numPointsNumber of points in the x,y,and z directions
boxVolume occupied by the grid
fillingVoxel filling: true if the cell is defined, false if the cell is empty. Voxel order is: for(each z){ for(each y){ for(each x) }}}

◆ buildFromFiner()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromFiner ( )
virtual

building by condensating a finer sparse grid (used if setFinerSparseGrid has initializated _finerSparseGrid before calling init() )

Reimplemented in sofa::component::topology::container::grid::SparseGridRamificationTopology, and sofa::component::topology::container::grid::SparseGridMultipleTopology.

◆ buildFromRawVoxelFile()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromRawVoxelFile ( const std::string &  filename)
protected

◆ buildFromRegularGridTypes()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromRegularGridTypes ( sofa::core::sptr< RegularGridTopology regularGrid,
const type::vector< Type > &  regularGridTypes 
)
protected

◆ buildFromTriangleMesh()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromTriangleMesh ( sofa::helper::io::Mesh mesh)
protected

◆ buildFromVoxelFile()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromVoxelFile ( const std::string &  filename)
protected

Create a sparse grid from a .voxel file .voxel file format (ascii): 512 // num voxels x 512 // num voxels y 246 // num voxels z 0.7 // voxels size x [mm] 0.7 // voxels size y [mm] 2 // voxels size z [mm] 0 0 255 0 0 ... // data

◆ buildFromVoxelLoader()

void sofa::component::topology::container::grid::SparseGridTopology::buildFromVoxelLoader ( sofa::core::loader::VoxelLoader loader)
protected

◆ buildVirtualFinerLevels()

void sofa::component::topology::container::grid::SparseGridTopology::buildVirtualFinerLevels ( )
virtual

◆ computeBoundingBox()

void sofa::component::topology::container::grid::SparseGridTopology::computeBoundingBox ( const type::vector< type::Vec3 > &  vertices,
SReal &  xmin,
SReal &  xmax,
SReal &  ymin,
SReal &  ymax,
SReal &  zmin,
SReal &  zmax 
) const
protected

◆ constructCollisionModels()

template<class T >
void sofa::component::topology::container::grid::SparseGridTopology::constructCollisionModels ( const sofa::type::vector< sofa::core::topology::BaseMeshTopology * > &  list_mesh,
const type::vector< Data< type::vector< sofa::type::Vec< 3, T > > > * > &  list_X 
)
protected

◆ findCube()

SparseGridTopology::Index sofa::component::topology::container::grid::SparseGridTopology::findCube ( const type::Vec3 pos,
SReal &  fx,
SReal &  fy,
SReal &  fz 
)
virtual

return the cube containing the given point (or -1 if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e. barycentric coordinates).

return the cube containing the given point (or InvalidID if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e. barycentric coordinates).

Reimplemented in sofa::component::topology::container::grid::SparseGridRamificationTopology, and sofa::component::topology::container::grid::SparseGridMultipleTopology.

◆ findNearestCube()

SparseGridTopology::Index sofa::component::topology::container::grid::SparseGridTopology::findNearestCube ( const type::Vec3 pos,
SReal &  fx,
SReal &  fy,
SReal &  fz 
)
virtual

return the cube containing the given point (or -1 if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e. barycentric coordinates).

return the cube containing the given point (or InvalidID if not found), as well as deplacements from its first corner in terms of dx, dy, dz (i.e. barycentric coordinates).

Reimplemented in sofa::component::topology::container::grid::SparseGridRamificationTopology, and sofa::component::topology::container::grid::SparseGridMultipleTopology.

◆ findneighboorCubes()

type::fixed_array< Index, 6 > sofa::component::topology::container::grid::SparseGridTopology::findneighboorCubes ( Index  indice)
virtual

return indices of 6 neighboor cubes

◆ getCoarserSparseGrid()

SparseGridTopology* sofa::component::topology::container::grid::SparseGridTopology::getCoarserSparseGrid ( ) const
inline

◆ getFinerSparseGrid()

SparseGridTopology* sofa::component::topology::container::grid::SparseGridTopology::getFinerSparseGrid ( ) const
inline

◆ getHexahedra()

const SeqHexahedra& sofa::component::topology::container::grid::SparseGridTopology::getHexahedra ( )
inlineoverridevirtual

◆ getMassCoef()

float sofa::component::topology::container::grid::SparseGridTopology::getMassCoef ( Index  elementIdx)
virtual

return the mass coefficient of the i-th cube

◆ getMax()

type::Vec3 sofa::component::topology::container::grid::SparseGridTopology::getMax ( )
inline

◆ getMesh()

void sofa::component::topology::container::grid::SparseGridTopology::getMesh ( sofa::helper::io::Mesh m)

◆ getMin()

type::Vec3 sofa::component::topology::container::grid::SparseGridTopology::getMin ( )
inline

◆ getN()

sofa::type::Vec<3, int> sofa::component::topology::container::grid::SparseGridTopology::getN ( ) const
inline

Resolution.

◆ getNbHexahedra()

Size sofa::component::topology::container::grid::SparseGridTopology::getNbHexahedra ( )
inlineoverridevirtual

TODO 2018-07-23 epernod: check why this method is override to return the same result as parent class.

Reimplemented from sofa::component::topology::container::constant::MeshTopology.

◆ getNbPoints()

Size sofa::component::topology::container::grid::SparseGridTopology::getNbPoints ( ) const
inlineoverridevirtual

◆ getNbVirtualFinerLevels()

int sofa::component::topology::container::grid::SparseGridTopology::getNbVirtualFinerLevels ( ) const
inline

◆ getNx()

int sofa::component::topology::container::grid::SparseGridTopology::getNx ( ) const
inline

◆ getNy()

int sofa::component::topology::container::grid::SparseGridTopology::getNy ( ) const
inline

◆ getNz()

int sofa::component::topology::container::grid::SparseGridTopology::getNz ( ) const
inline

◆ getPointPos()

type::Vec3 sofa::component::topology::container::grid::SparseGridTopology::getPointPos ( Index  i)
inline

◆ getStiffnessCoef()

float sofa::component::topology::container::grid::SparseGridTopology::getStiffnessCoef ( Index  elementIdx)
virtual

return the stiffness coefficient of the i-th cube

◆ getType()

SparseGridTopology::Type sofa::component::topology::container::grid::SparseGridTopology::getType ( Index  i)
virtual

return the type of the i-th cube

◆ getVoxel() [1/2]

bool sofa::component::topology::container::grid::SparseGridTopology::getVoxel ( unsigned int  index) const
inline

◆ getVoxel() [2/2]

bool sofa::component::topology::container::grid::SparseGridTopology::getVoxel ( unsigned int  x,
unsigned int  y,
unsigned int  z 
)
inline

◆ getXmax()

SReal sofa::component::topology::container::grid::SparseGridTopology::getXmax ( )
inline

◆ getXmin()

SReal sofa::component::topology::container::grid::SparseGridTopology::getXmin ( )
inline

◆ getYmax()

SReal sofa::component::topology::container::grid::SparseGridTopology::getYmax ( )
inline

◆ getYmin()

SReal sofa::component::topology::container::grid::SparseGridTopology::getYmin ( )
inline

◆ getZmax()

SReal sofa::component::topology::container::grid::SparseGridTopology::getZmax ( )
inline

◆ getZmin()

SReal sofa::component::topology::container::grid::SparseGridTopology::getZmin ( )
inline

◆ hasPos()

bool sofa::component::topology::container::grid::SparseGridTopology::hasPos ( ) const
inlineoverridevirtual

◆ init()

void sofa::component::topology::container::grid::SparseGridTopology::init ( void  )
overridevirtual

Initialization method called at graph creation and modification, during top-down traversal.

Reimplemented from sofa::component::topology::container::constant::MeshTopology.

◆ launchPropagationFromSeed()

void sofa::component::topology::container::grid::SparseGridTopology::launchPropagationFromSeed ( const type::Vec3i point,
sofa::core::sptr< RegularGridTopology regularGrid,
type::vector< Type > &  regularGrdidTypes,
type::vector< bool > &  alreadyTested,
std::stack< type::Vec3i > &  seed 
) const
protected

start from a seed cell (i,j,k) the OUTSIDE filling is propagated to neighboor cells until meet a BOUNDARY cell (this function is called from all border cells of the RegularGrid)

◆ propagateFrom()

void sofa::component::topology::container::grid::SparseGridTopology::propagateFrom ( const type::Vec3i point,
sofa::core::sptr< RegularGridTopology regularGrid,
type::vector< Type > &  regularGridTypes,
type::vector< bool > &  alreadyTested,
std::stack< sofa::type::Vec< 3, int > > &  seed 
) const
protected

◆ setCoarserSparseGrid()

void sofa::component::topology::container::grid::SparseGridTopology::setCoarserSparseGrid ( SparseGridTopology csp)
inline

◆ setDimVoxels()

void sofa::component::topology::container::grid::SparseGridTopology::setDimVoxels ( int  a,
int  b,
int  c 
)
inline

◆ setFinerSparseGrid()

void sofa::component::topology::container::grid::SparseGridTopology::setFinerSparseGrid ( SparseGridTopology fsp)
inline

◆ setMax()

void sofa::component::topology::container::grid::SparseGridTopology::setMax ( type::Vec3  val)
inline

◆ setMin()

void sofa::component::topology::container::grid::SparseGridTopology::setMin ( type::Vec3  val)
inline

◆ setN()

void sofa::component::topology::container::grid::SparseGridTopology::setN ( type::Vec3i  _n)
inline

◆ setNbVirtualFinerLevels()

void sofa::component::topology::container::grid::SparseGridTopology::setNbVirtualFinerLevels ( int  n)
inline

◆ setNx()

void sofa::component::topology::container::grid::SparseGridTopology::setNx ( int  _n)
inline

◆ setNy()

void sofa::component::topology::container::grid::SparseGridTopology::setNy ( int  _n)
inline

◆ setNz()

void sofa::component::topology::container::grid::SparseGridTopology::setNz ( int  _n)
inline

◆ setSizeVoxel()

void sofa::component::topology::container::grid::SparseGridTopology::setSizeVoxel ( SReal  a,
SReal  b,
SReal  c 
)
inline

◆ setVoxel()

void sofa::component::topology::container::grid::SparseGridTopology::setVoxel ( int  index,
unsigned char  value 
)
inlineprotected

◆ setXmax()

void sofa::component::topology::container::grid::SparseGridTopology::setXmax ( SReal  val)
inline

◆ setXmin()

void sofa::component::topology::container::grid::SparseGridTopology::setXmin ( SReal  val)
inline

◆ setYmax()

void sofa::component::topology::container::grid::SparseGridTopology::setYmax ( SReal  val)
inline

◆ setYmin()

void sofa::component::topology::container::grid::SparseGridTopology::setYmin ( SReal  val)
inline

◆ setZmax()

void sofa::component::topology::container::grid::SparseGridTopology::setZmax ( SReal  val)
inline

◆ setZmin()

void sofa::component::topology::container::grid::SparseGridTopology::setZmin ( SReal  val)
inline

◆ SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER() [1/3]

sofa::component::topology::container::grid::SparseGridTopology::SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER ( BoundingBox  ,
sofa::type::BoundingBox   
)

◆ SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER() [2/3]

sofa::component::topology::container::grid::SparseGridTopology::SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER ( Vec3i  ,
sofa::type::Vec3i   
)

◆ SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER() [3/3]

sofa::component::topology::container::grid::SparseGridTopology::SOFA_ATTRIBUTE_REPLACED__TYPEMEMBER ( Vector3  ,
sofa::type::Vec3   
)

◆ SOFA_CLASS()

sofa::component::topology::container::grid::SparseGridTopology::SOFA_CLASS ( SparseGridTopology  ,
MeshTopology   
)

◆ updateEdges()

void sofa::component::topology::container::grid::SparseGridTopology::updateEdges ( )
protectedvirtual

◆ updateMesh()

void sofa::component::topology::container::grid::SparseGridTopology::updateMesh ( )

◆ updateQuads()

void sofa::component::topology::container::grid::SparseGridTopology::updateQuads ( )
protectedvirtual

◆ voxelizeTriangleMesh()

void sofa::component::topology::container::grid::SparseGridTopology::voxelizeTriangleMesh ( helper::io::Mesh mesh,
sofa::core::sptr< RegularGridTopology regularGrid,
type::vector< Type > &  regularGridTypes 
) const
protected

Enum details

◆ anonymous enum

anonymous enum
Enumerator
UP 
DOWN 
RIGHT 
LEFT 
BEFORE 
BEHIND 
NUM_CONNECTED_NODES 

◆ Type

Enumerator
OUTSIDE 
INSIDE 
BOUNDARY