SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::component::topology::QuadSetTopologyContainer Class Reference

#include <QuadSetTopologyContainer.h>

Inheritance diagram for sofa::component::topology::QuadSetTopologyContainer:

Detailed Description

Object that stores a set of quads and provides access to each quad and its edges and vertices

Protected Attributes

Data< sofa::helper::vector< Quad > > d_quad
 provides the set of quads. More...
 
sofa::helper::vector< EdgesInQuadm_edgesInQuad
 provides the 4 edges in each quad. More...
 
sofa::helper::vector< QuadsAroundVertexm_quadsAroundVertex
 for each vertex provides the set of quads adjacent to that vertex. More...
 
sofa::helper::vector< QuadsAroundEdgem_quadsAroundEdge
 for each edge provides the set of quads adjacent to that edge. More...
 
bool m_quadTopologyDirty
 Boolean used to know if the topology Data of this container is dirty. More...
 
std::list< sofa::core::topology::TopologyEngine * > m_enginesList
 List of engines related to this specific container. More...
 
sofa::helper::vector< sofa::helper::vector< std::string > > m_dataGraph
 variables used to display the graph of Data/DataEngines linked to this Data array. More...
 
sofa::helper::vector< sofa::helper::vector< std::string > > m_enginesGraph
 
- Protected Attributes inherited from sofa::component::topology::EdgeSetTopologyContainer
sofa::helper::vector< EdgesAroundVertexm_edgesAroundVertex
 
bool m_edgeTopologyDirty
 Boolean used to know if the topology Data of this container is dirty. More...
 
std::list< sofa::core::topology::TopologyEngine * > m_enginesList
 List of engines related to this specific container. More...
 
sofa::helper::vector< sofa::helper::vector< std::string > > m_dataGraph
 variables used to display the graph of Data/DataEngines linked to this Data array. More...
 
sofa::helper::vector< sofa::helper::vector< std::string > > m_enginesGraph
 
- Protected Attributes inherited from sofa::component::topology::PointSetTopologyContainer
bool m_pointTopologyDirty
 Boolean used to know if the topology Data of this container is dirty. More...
 
std::list< sofa::core::topology::TopologyEngine * > m_enginesList
 List of engines related to this specific container. More...
 
sofa::helper::vector< sofa::helper::vector< std::string > > m_dataGraph
 variables used to display the graph of Data/DataEngines linked to this Data array. More...
 
sofa::helper::vector< sofa::helper::vector< std::string > > m_enginesGraph
 

Public Member Functions

 SOFA_CLASS (QuadSetTopologyContainer, EdgeSetTopologyContainer)
 
void init () override
 
size_t getNumberOfQuads () const
 Returns the number of quads in this topology. The difference to getNbQuads() is that this method does not generate the quad array if it does not exist. More...
 
size_t getNumberOfElements () const override
 Returns the number of topological element of the current topology. This function avoids to know which topological container is in used. More...
 
const sofa::helper::vector< Quad > & getQuadArray ()
 Returns the Quad array. More...
 
const sofa::helper::vector< EdgesInQuad > & getEdgesInQuadArray ()
 Returns the EdgesInQuadArray array (i.e. provide the 4 edge indices for each quad) More...
 
const sofa::helper::vector< QuadsAroundVertex > & getQuadsAroundVertexArray ()
 Returns the QuadsAroundVertex array (i.e. provide the quad indices adjacent to each vertex). More...
 
const sofa::helper::vector< QuadsAroundEdge > & getQuadsAroundEdgeArray ()
 Returns the QuadsAroundEdge array (i.e. provide the quad indices adjacent to each edge). More...
 
bool hasQuads () const
 
bool hasEdgesInQuad () const
 
bool hasQuadsAroundVertex () const
 
bool hasQuadsAroundEdge () const
 
sofa::core::topology::TopologyObjectType getTopologyType () const override
 Returns the type of the topology. More...
 
void clear () override
 
void addQuad (index_type a, index_type b, index_type c, index_type d) override
 
const SeqQuadsgetQuads () override
 Returns the quad array. More...
 
Data< sofa::helper::vector< Quad > > & getQuadDataArray ()
 Returns a reference to the Data of quads array container. More...
 
const Quad getQuad (QuadID id) override
 Returns the quad corresponding to the QuadID i. More...
 
QuadID getQuadIndex (PointID v1, PointID v2, PointID v3, PointID v4) override
 
const EdgesInQuadgetEdgesInQuad (QuadID id) override
 Returns the set of edges adjacent to a given quad. More...
 
const QuadsAroundVertexgetQuadsAroundVertex (PointID id) override
 Returns the set of quads adjacent to a given vertex. More...
 
const QuadsAroundEdgegetQuadsAroundEdge (EdgeID id) override
 Returns the set of quads adjacent to a given edge. More...
 
int getVertexIndexInQuad (const Quad &t, PointID vertexIndex) const override
 Returns the index (either 0, 1, 2, 3) of the vertex whose global index is vertexIndex. More...
 
int getEdgeIndexInQuad (const EdgesInQuad &t, EdgeID edheIndex) const override
 Returns the index (either 0, 1, 2, 3) of the edge whose global index is edgeIndex. More...
 
void initTopology ()
 
bool checkTopology () const override
 Checks if the topology is coherent. More...
 
bool checkConnexity () override
 Checks if the topology has only one connected component. More...
 
size_t getNumberOfConnectedComponent () override
 Returns the number of connected component. More...
 
const VecQuadID getConnectedElement (QuadID elem) override
 Returns the set of element indices connected to an input one (i.e. which can be reached by topological links) More...
 
const VecQuadID getElementAroundElement (QuadID elem) override
 Returns the set of element indices adjacent to a given element (i.e. sharing a link) More...
 
const VecQuadID getElementAroundElements (VecQuadID 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::component::topology::EdgeSetTopologyContainer
 SOFA_CLASS (EdgeSetTopologyContainer, PointSetTopologyContainer)
 
void init () override
 
void reinit () override
 
sofa::core::topology::TopologyObjectType getTopologyType () const override
 Returns the type of the topology. More...
 
void clear () override
 
void addEdge (index_type a, index_type b) override
 
const SeqEdgesgetEdges () override
 Returns the edge array. More...
 
const Edge getEdge (EdgeID i) override
 Get an Edge from its ID. More...
 
EdgeID getEdgeIndex (PointID v1, PointID v2) override
 Get the index of the edge joining two vertices. More...
 
const EdgesAroundVertexgetEdgesAroundVertex (PointID id) override
 Get the indices of the edges around a vertex. More...
 
void initTopology ()
 
bool checkTopology () const override
 Checks if the topology is coherent. More...
 
size_t getNumberOfEdges () const
 Returns the number of edges in this topology. More...
 
virtual int getNumberConnectedComponents (sofa::helper::vector< EdgeID > &components)
 Returns the number of connected components from the graph containing all edges and give, for each vertex, which component it belongs to (use BOOST GRAPH LIBRAIRY) More...
 
virtual const sofa::helper::vector< Edge > & getEdgeArray ()
 Returns the Edge array. More...
 
Data< sofa::helper::vector< Edge > > & getEdgeDataArray ()
 Returns a reference to the Data of edges array container. More...
 
virtual const sofa::helper::vector< sofa::helper::vector< EdgeID > > & getEdgesAroundVertexArray ()
 Returns the list of Edge indices around each DOF. More...
 
bool hasEdges () const
 
bool hasEdgesAroundVertex () const
 
bool checkConnexity () override
 Checks if the topology has only one connected component. More...
 
size_t getNumberOfConnectedComponent () override
 Returns the number of connected component. More...
 
const VecEdgeID getConnectedElement (EdgeID elem) override
 Returns the set of element indices connected to an input one (i.e. which can be reached by topological links) More...
 
const VecEdgeID getElementAroundElement (EdgeID elem) override
 Returns the set of element indices adjacent to a given element (i.e. sharing a link) More...
 
const VecEdgeID getElementAroundElements (VecEdgeID 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::component::topology::PointSetTopologyContainer
 SOFA_CLASS (PointSetTopologyContainer, core::topology::TopologyContainer)
 
void init () override
 
const sofa::helper::vector< PointID > & getPoints () const
 
void clear () override
 
void addPoint (double px, double py, double pz) override
 
std::size_t getNbPoints () const override
 Returns the number of vertices in this topology. More...
 
Data< InitTypes::VecCoord > & getPointDataArray ()
 Returns a reference to the Data of points array container. More...
 
void setNbPoints (std::size_t n) override
 Set the number of vertices in this topology. More...
 
bool hasPos () const override
 check if vertices in this topology have positions. More...
 
SReal getPX (index_type i) const override
 Returns the X coordinate of the ith DOF. More...
 
SReal getPY (index_type i) const override
 Returns the Y coordinate of the ith DOF. More...
 
SReal getPZ (index_type i) const override
 Returns the Z coordinate of the ith DOF. More...
 
sofa::core::topology::TopologyObjectType getTopologyType () const override
 Returns the type of the topology. More...
 
bool checkTopology () const override
 Checks if the Topology is coherent. More...
 
void addPoint ()
 add one DOF in this topology (simply increment the number of DOF) More...
 
void addPoints (const std::size_t nPoints)
 add a number of DOFs in this topology (simply increase the number of DOF according to this parameter) More...
 
void removePoint ()
 remove one DOF in this topology (simply decrement the number of DOF) More...
 
void removePoints (const std::size_t nPoints)
 remove a number of DOFs in this topology (simply decrease the number of DOF according to this parameter) More...
 

Protected Member Functions

 QuadSetTopologyContainer ()
 
 ~QuadSetTopologyContainer () override
 
virtual void createQuadSetArray ()
 Creates the QuadSet array. More...
 
void createEdgeSetArray () override
 Creates the EdgeSet array. More...
 
virtual void createEdgesInQuadArray ()
 Creates the array of edge indices for each quad. More...
 
virtual void createQuadsAroundVertexArray ()
 Creates the QuadsAroundVertex Array. More...
 
virtual void createQuadsAroundEdgeArray ()
 Creates the quadsAroundEdge Array. More...
 
void clearQuads ()
 
void clearEdgesInQuad ()
 
void clearQuadsAroundVertex ()
 
void clearQuadsAroundEdge ()
 
virtual QuadsAroundVertexgetQuadsAroundVertexForModification (const PointID vertexIndex)
 Returns a non-const list of quad indices around a given DOF for subsequent modification. More...
 
virtual QuadsAroundEdgegetQuadsAroundEdgeForModification (const EdgeID edgeIndex)
 Returns a non-const list of quad indices around a given edge for subsequent modification. More...
 
void updateTopologyEngineGraph () override
 Function creating the data graph linked to d_quad. More...
 
void setQuadTopologyToDirty ()
 
void cleanQuadTopologyFromDirty ()
 
const boolisQuadTopologyDirty ()
 
- Protected Member Functions inherited from sofa::component::topology::EdgeSetTopologyContainer
 EdgeSetTopologyContainer ()
 
 ~EdgeSetTopologyContainer () override
 
virtual void createEdgesAroundVertexArray ()
 Creates the EdgesAroundVertex array. More...
 
void clearEdges ()
 
void clearEdgesAroundVertex ()
 
void updateTopologyEngineGraph () override
 Function creating the data graph linked to d_triangle. More...
 
void setEdgeTopologyToDirty ()
 
void cleanEdgeTopologyFromDirty ()
 
const boolisEdgeTopologyDirty ()
 
virtual EdgesAroundVertexgetEdgesAroundVertexForModification (const PointID i)
 Returns a non-const list of Edge indices around the ith DOF for subsequent modification. More...
 
- Protected Member Functions inherited from sofa::component::topology::PointSetTopologyContainer
 PointSetTopologyContainer (std::size_t nPoints=0)
 
 ~PointSetTopologyContainer () override
 
void updateTopologyEngineGraph () override
 Function creating the data graph linked to d_point. More...
 
virtual void updateDataEngineGraph (sofa::core::objectmodel::BaseData &my_Data, std::list< sofa::core::topology::TopologyEngine * > &my_enginesList)
 functions to really update the graph of Data/DataEngines linked to the different Data array, using member variable. More...
 
void setPointTopologyToDirty ()
 
void cleanPointTopologyFromDirty ()
 
const boolisPointTopologyDirty ()
 
void addEngineToList (sofa::core::topology::TopologyEngine *_engine)
 function to add a topologyEngine to the current list of engines. More...
 
virtual void displayDataGraph (sofa::core::objectmodel::BaseData &my_Data)
 functions to display the graph of Data/DataEngines linked to the different Data array, using member variable. More...
 

Friends

class QuadSetTopologyModifier
 

Additional Inherited Members

- Public Attributes inherited from sofa::component::topology::EdgeSetTopologyContainer
Data< sofa::helper::vector< Edge > > d_edge
 List of edge indices. More...
 
Data< boolm_checkConnexity
 It true, will check the connexity of the mesh. More...
 
- Public Attributes inherited from sofa::component::topology::PointSetTopologyContainer
Data< InitTypes::VecCoordd_initPoints
 Initial position of points. More...
 
Data< boold_checkTopology
 Bool parameter to activate internal topology checks in several methods. More...
 

Attribute details

Data< sofa::helper::vector<Quad> > sofa::component::topology::QuadSetTopologyContainer::d_quad
protected

provides the set of quads.

sofa::helper::vector< sofa::helper::vector <std::string> > sofa::component::topology::QuadSetTopologyContainer::m_dataGraph
protected

variables used to display the graph of Data/DataEngines linked to this Data array.

sofa::helper::vector<EdgesInQuad> sofa::component::topology::QuadSetTopologyContainer::m_edgesInQuad
protected

provides the 4 edges in each quad.

sofa::helper::vector< sofa::helper::vector <std::string> > sofa::component::topology::QuadSetTopologyContainer::m_enginesGraph
protected
std::list<sofa::core::topology::TopologyEngine *> sofa::component::topology::QuadSetTopologyContainer::m_enginesList
protected

List of engines related to this specific container.

sofa::helper::vector< QuadsAroundEdge > sofa::component::topology::QuadSetTopologyContainer::m_quadsAroundEdge
protected

for each edge provides the set of quads adjacent to that edge.

sofa::helper::vector< QuadsAroundVertex > sofa::component::topology::QuadSetTopologyContainer::m_quadsAroundVertex
protected

for each vertex provides the set of quads adjacent to that vertex.

bool sofa::component::topology::QuadSetTopologyContainer::m_quadTopologyDirty
protected

Boolean used to know if the topology Data of this container is dirty.

Constructor details

sofa::component::topology::QuadSetTopologyContainer::QuadSetTopologyContainer ( )
protected
sofa::component::topology::QuadSetTopologyContainer::~QuadSetTopologyContainer ( )
inlineoverrideprotected

Function details

void sofa::component::topology::QuadSetTopologyContainer::addQuad ( index_type  a,
index_type  b,
index_type  c,
index_type  d 
)
override
bool sofa::component::topology::QuadSetTopologyContainer::checkConnexity ( )
override

Checks if the topology has only one connected component.

Get information about connexity of the mesh

Returns
true if only one connected component

Get information about connexity of the mesh

bool sofa::component::topology::QuadSetTopologyContainer::checkTopology ( ) const
override

Checks if the topology is coherent.

Check if the shell arrays are coherent

See also
m_quad
m_edgesInQuad
m_quadsAroundVertex
m_quadsAroundEdge
void sofa::component::topology::QuadSetTopologyContainer::cleanQuadTopologyFromDirty ( )
protected
void sofa::component::topology::QuadSetTopologyContainer::clear ( )
override

Procedural creation methods

void sofa::component::topology::QuadSetTopologyContainer::clearEdgesInQuad ( )
protected
void sofa::component::topology::QuadSetTopologyContainer::clearQuads ( )
protected
void sofa::component::topology::QuadSetTopologyContainer::clearQuadsAroundEdge ( )
protected
void sofa::component::topology::QuadSetTopologyContainer::clearQuadsAroundVertex ( )
protected
void sofa::component::topology::QuadSetTopologyContainer::createEdgeSetArray ( )
overrideprotectedvirtual

Creates the EdgeSet array.

Create the set of edges when needed.

Reimplemented from sofa::component::topology::EdgeSetTopologyContainer.

void sofa::component::topology::QuadSetTopologyContainer::createEdgesInQuadArray ( )
protectedvirtual

Creates the array of edge indices for each quad.

This function is only called if the EdgesInQuad array is required. m_edgesInQuad[i] contains the 4 indices of the 4 edges composing the ith quad.

void sofa::component::topology::QuadSetTopologyContainer::createQuadsAroundEdgeArray ( )
protectedvirtual

Creates the quadsAroundEdge Array.

This function is only called if the QuadsAroundVertex array is required. m_quadsAroundEdge[i] contains the indices of all quads adjacent to the ith edge

void sofa::component::topology::QuadSetTopologyContainer::createQuadsAroundVertexArray ( )
protectedvirtual

Creates the QuadsAroundVertex Array.

This function is only called if the QuadsAroundVertex array is required. m_quadsAroundVertex[i] contains the indices of all quads adjacent to the ith vertex.

void sofa::component::topology::QuadSetTopologyContainer::createQuadSetArray ( )
protectedvirtual

Creates the QuadSet array.

This function must be implemented by derived classes to create a list of quads from a set of hexahedra for instance.

Reimplemented in sofa::component::topology::HexahedronSetTopologyContainer.

const QuadSetTopologyContainer::VecQuadID sofa::component::topology::QuadSetTopologyContainer::getConnectedElement ( QuadID  elem)
override

Returns the set of element indices connected to an input one (i.e. which can be reached by topological links)

int sofa::component::topology::QuadSetTopologyContainer::getEdgeIndexInQuad ( const EdgesInQuad t,
EdgeID  edheIndex 
) const
override

Returns the index (either 0, 1, 2, 3) of the edge whose global index is edgeIndex.

Parameters
Refto an EdgesInQuad.
Idof an edge .
Returns
the position of this edge in the quad (i.e. either 0, 1, 2, 3).
-1 if none.
const QuadSetTopologyContainer::EdgesInQuad & sofa::component::topology::QuadSetTopologyContainer::getEdgesInQuad ( QuadID  id)
override

Returns the set of edges adjacent to a given quad.

Parameters
IDof a quad.
Returns
EdgesInQuad list composing the input quad.
const sofa::helper::vector< QuadSetTopologyContainer::EdgesInQuad > & sofa::component::topology::QuadSetTopologyContainer::getEdgesInQuadArray ( )

Returns the EdgesInQuadArray array (i.e. provide the 4 edge indices for each quad)

const QuadSetTopologyContainer::VecQuadID sofa::component::topology::QuadSetTopologyContainer::getElementAroundElement ( QuadID  elem)
override

Returns the set of element indices adjacent to a given element (i.e. sharing a link)

const QuadSetTopologyContainer::VecQuadID sofa::component::topology::QuadSetTopologyContainer::getElementAroundElements ( VecQuadID  elems)
override

Returns the set of element indices adjacent to a given list of elements (i.e. sharing a link)

size_t sofa::component::topology::QuadSetTopologyContainer::getNumberOfConnectedComponent ( )
override

Returns the number of connected component.

size_t sofa::component::topology::QuadSetTopologyContainer::getNumberOfElements ( ) const
overridevirtual

Returns the number of topological element of the current topology. This function avoids to know which topological container is in used.

Reimplemented from sofa::component::topology::EdgeSetTopologyContainer.

size_t sofa::component::topology::QuadSetTopologyContainer::getNumberOfQuads ( ) const

Returns the number of quads in this topology. The difference to getNbQuads() is that this method does not generate the quad array if it does not exist.

const QuadSetTopologyContainer::Quad sofa::component::topology::QuadSetTopologyContainer::getQuad ( QuadID  id)
override

Returns the quad corresponding to the QuadID i.

Parameters
IDof a Quad.
Returns
The corresponding Quad.
const sofa::helper::vector< QuadSetTopologyContainer::Quad > & sofa::component::topology::QuadSetTopologyContainer::getQuadArray ( )

Returns the Quad array.

Data< sofa::helper::vector<Quad> >& sofa::component::topology::QuadSetTopologyContainer::getQuadDataArray ( )
inline

Returns a reference to the Data of quads array container.

QuadSetTopologyContainer::QuadID sofa::component::topology::QuadSetTopologyContainer::getQuadIndex ( PointID  v1,
PointID  v2,
PointID  v3,
PointID  v4 
)
override

Returns the indices of a quad given four vertex indices.

Parameters
thefour vertex indices.
Returns
the ID of the corresponding quad.
InvalidID if none
const SeqQuads& sofa::component::topology::QuadSetTopologyContainer::getQuads ( )
inlineoverride

Returns the quad array.

BaseMeshTopology API

const QuadSetTopologyContainer::QuadsAroundEdge & sofa::component::topology::QuadSetTopologyContainer::getQuadsAroundEdge ( EdgeID  id)
override

Returns the set of quads adjacent to a given edge.

Parameters
IDof an edge.
Returns
QuadsAroundEdge list around the input edge.
const sofa::helper::vector< QuadSetTopologyContainer::QuadsAroundEdge > & sofa::component::topology::QuadSetTopologyContainer::getQuadsAroundEdgeArray ( )

Returns the QuadsAroundEdge array (i.e. provide the quad indices adjacent to each edge).

QuadSetTopologyContainer::QuadsAroundEdge & sofa::component::topology::QuadSetTopologyContainer::getQuadsAroundEdgeForModification ( const EdgeID  edgeIndex)
protectedvirtual

Returns a non-const list of quad indices around a given edge for subsequent modification.

Returns
QuadsAroundEdge lists in non-const.
See also
getQuadsAroundEdge()
const QuadSetTopologyContainer::QuadsAroundVertex & sofa::component::topology::QuadSetTopologyContainer::getQuadsAroundVertex ( PointID  id)
override

Returns the set of quads adjacent to a given vertex.

Parameters
IDof a vertex.
Returns
QuadsAroundVertex list around the input vertex.
const sofa::helper::vector< QuadSetTopologyContainer::QuadsAroundVertex > & sofa::component::topology::QuadSetTopologyContainer::getQuadsAroundVertexArray ( )

Returns the QuadsAroundVertex array (i.e. provide the quad indices adjacent to each vertex).

QuadSetTopologyContainer::QuadsAroundVertex & sofa::component::topology::QuadSetTopologyContainer::getQuadsAroundVertexForModification ( const PointID  vertexIndex)
protectedvirtual

Returns a non-const list of quad indices around a given DOF for subsequent modification.

Returns
QuadsAroundVertex lists in non-const.
See also
getQuadsAroundVertex()
sofa::core::topology::TopologyObjectType sofa::component::topology::QuadSetTopologyContainer::getTopologyType ( ) const
inlineoverride

Returns the type of the topology.

int sofa::component::topology::QuadSetTopologyContainer::getVertexIndexInQuad ( const Quad t,
PointID  vertexIndex 
) const
override

Returns the index (either 0, 1, 2, 3) of the vertex whose global index is vertexIndex.

Parameters
Refto a quad.
Idof a vertex.
Returns
the position of this vertex in the quad (i.e. either 0, 1, 2, 3).
-1 if none.
bool sofa::component::topology::QuadSetTopologyContainer::hasEdgesInQuad ( ) const
bool sofa::component::topology::QuadSetTopologyContainer::hasQuads ( ) const
bool sofa::component::topology::QuadSetTopologyContainer::hasQuadsAroundEdge ( ) const
bool sofa::component::topology::QuadSetTopologyContainer::hasQuadsAroundVertex ( ) const
void sofa::component::topology::QuadSetTopologyContainer::init ( void  )
override
void sofa::component::topology::QuadSetTopologyContainer::initTopology ( )

Dynamic Topology API

Method called by component Init method. Will create all the topology neighboorhood buffers and call

See also
EdgeSetTopologyContainer::initTopology()
const bool& sofa::component::topology::QuadSetTopologyContainer::isQuadTopologyDirty ( )
inlineprotected
void sofa::component::topology::QuadSetTopologyContainer::setQuadTopologyToDirty ( )
protected

Use a specific boolean

See also
m_quadTopologyDirty in order to know if topology Data is dirty or not. Set/Get function access to this boolean
sofa::component::topology::QuadSetTopologyContainer::SOFA_CLASS ( QuadSetTopologyContainer  ,
EdgeSetTopologyContainer   
)
void sofa::component::topology::QuadSetTopologyContainer::updateTopologyEngineGraph ( )
overrideprotected

Function creating the data graph linked to d_quad.

Related details

friend class QuadSetTopologyModifier
friend