SOFA API  014b24ea
Open source framework for multi-physics simuation
sofa::component::topology::EdgeSetTopologyContainer Class Reference

#include <EdgeSetTopologyContainer.h>

Inheritance diagram for sofa::component::topology::EdgeSetTopologyContainer:

Detailed Description

a class that stores a set of edges and provides access to the adjacency between points and edges

Public Attributes

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...
 

Protected Attributes

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 (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 (int a, int 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...
 
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...
 
virtual int getNumberConnectedComponents (sofa::helper::vector< unsigned int > &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
 
int 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 (int 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 (int i) const override
 Returns the X coordinate of the ith DOF. More...
 
SReal getPY (int i) const override
 Returns the Y coordinate of the ith DOF. More...
 
SReal getPZ (int 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 unsigned int 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 unsigned int nPoints)
 remove a number of DOFs in this topology (simply decrease the number of DOF according to this parameter) More...
 

Protected Member Functions

 EdgeSetTopologyContainer ()
 
 ~EdgeSetTopologyContainer () override
 
virtual void createEdgeSetArray ()
 Creates the EdgeSet array. More...
 
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 (int 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 EdgeSetTopologyModifier
 

Attribute details

Data< sofa::helper::vector<Edge> > sofa::component::topology::EdgeSetTopologyContainer::d_edge

List of edge indices.

The array that stores the set of edges in the edge set

Data<bool> sofa::component::topology::EdgeSetTopologyContainer::m_checkConnexity

It true, will check the connexity of the mesh.

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

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

sofa::helper::vector< EdgesAroundVertex > sofa::component::topology::EdgeSetTopologyContainer::m_edgesAroundVertex
protected

the array that stores the set of edge-vertex shells, ie for each vertex gives the set of adjacent edges

bool sofa::component::topology::EdgeSetTopologyContainer::m_edgeTopologyDirty
protected

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

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

List of engines related to this specific container.

Constructor details

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

Function details

void sofa::component::topology::EdgeSetTopologyContainer::addEdge ( int  a,
int  b 
)
override
bool sofa::component::topology::EdgeSetTopologyContainer::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::EdgeSetTopologyContainer::checkTopology ( ) const
override

Checks if the topology is coherent.

Check if the arrays are coherent.

See also
m_edgesAroundVertex
m_edge
Returns
bool true if topology is coherent.
void sofa::component::topology::EdgeSetTopologyContainer::cleanEdgeTopologyFromDirty ( )
protected
void sofa::component::topology::EdgeSetTopologyContainer::clear ( )
override

Procedural creation methods

void sofa::component::topology::EdgeSetTopologyContainer::clearEdges ( )
protected
void sofa::component::topology::EdgeSetTopologyContainer::clearEdgesAroundVertex ( )
protected
void sofa::component::topology::EdgeSetTopologyContainer::createEdgesAroundVertexArray ( )
protectedvirtual

Creates the EdgesAroundVertex array.

This function is only called if EdgesAroundVertex member is required. EdgesAroundVertex[i] contains the indices of all edges having the ith DOF as one of their ends.

void sofa::component::topology::EdgeSetTopologyContainer::createEdgeSetArray ( )
protectedvirtual

Creates the EdgeSet array.

This function must be implemented by derived classes to create a list of edges from a set of triangles or tetrahedra

Reimplemented in sofa::component::topology::TetrahedronSetTopologyContainer, sofa::component::topology::HexahedronSetTopologyContainer, sofa::component::topology::TriangleSetTopologyContainer, and sofa::component::topology::QuadSetTopologyContainer.

const EdgeSetTopologyContainer::VecEdgeID sofa::component::topology::EdgeSetTopologyContainer::getConnectedElement ( EdgeID  elem)
override

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

const EdgeSetTopologyContainer::Edge sofa::component::topology::EdgeSetTopologyContainer::getEdge ( EdgeID  i)
override

Get an Edge from its ID.

Parameters
iThe ID of the Edge.
Returns
The corresponding Edge.
const sofa::helper::vector< EdgeSetTopologyContainer::Edge > & sofa::component::topology::EdgeSetTopologyContainer::getEdgeArray ( )
virtual

Returns the Edge array.

Data< sofa::helper::vector<Edge> >& sofa::component::topology::EdgeSetTopologyContainer::getEdgeDataArray ( )
inline

Returns a reference to the Data of edges array container.

EdgeSetTopologyContainer::EdgeID sofa::component::topology::EdgeSetTopologyContainer::getEdgeIndex ( PointID  v1,
PointID  v2 
)
override

Get the index of the edge joining two vertices.

Parameters
v1The first vertex
v
const sofa::helper::vector< EdgeSetTopologyContainer::Edge > & sofa::component::topology::EdgeSetTopologyContainer::getEdges ( )
override

Returns the edge array.

BaseMeshTopology API

const EdgeSetTopologyContainer::EdgesAroundVertex & sofa::component::topology::EdgeSetTopologyContainer::getEdgesAroundVertex ( PointID  id)
override

Get the indices of the edges around a vertex.

Parameters
iThe ID of the vertex.
Returns
An EdgesAroundVertex containing the indices of the edges.
const sofa::helper::vector< sofa::helper::vector< EdgeSetTopologyContainer::EdgeID > > & sofa::component::topology::EdgeSetTopologyContainer::getEdgesAroundVertexArray ( )
virtual

Returns the list of Edge indices around each DOF.

Returns
EdgesAroundVertex lists.
sofa::helper::vector< EdgeSetTopologyContainer::EdgeID > & sofa::component::topology::EdgeSetTopologyContainer::getEdgesAroundVertexForModification ( const PointID  i)
protectedvirtual

Returns a non-const list of Edge indices around the ith DOF for subsequent modification.

Returns
EdgesAroundVertex lists in non-const.
See also
getEdgesAroundVertex()
const EdgeSetTopologyContainer::VecEdgeID sofa::component::topology::EdgeSetTopologyContainer::getElementAroundElement ( EdgeID  elem)
override

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

const EdgeSetTopologyContainer::VecEdgeID sofa::component::topology::EdgeSetTopologyContainer::getElementAroundElements ( VecEdgeID  elems)
override

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

int sofa::component::topology::EdgeSetTopologyContainer::getNumberConnectedComponents ( sofa::helper::vector< unsigned int > &  components)
virtual

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)

Parameters
componentsthe array containing the optimal vertex permutation according to the Reverse CuthillMckee algorithm
Returns
The number of components connected together.
size_t sofa::component::topology::EdgeSetTopologyContainer::getNumberOfConnectedComponent ( )
override

Returns the number of connected component.

size_t sofa::component::topology::EdgeSetTopologyContainer::getNumberOfEdges ( ) const

Returns the number of edges in this topology.

The difference to getNbEdges() is that this method does not generate the edge array if it does not exist.

Returns
the number of edges.
size_t sofa::component::topology::EdgeSetTopologyContainer::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::PointSetTopologyContainer.

Reimplemented in sofa::component::topology::HexahedronSetTopologyContainer, sofa::component::topology::TetrahedronSetTopologyContainer, sofa::component::topology::QuadSetTopologyContainer, and sofa::component::topology::TriangleSetTopologyContainer.

sofa::core::topology::TopologyObjectType sofa::component::topology::EdgeSetTopologyContainer::getTopologyType ( ) const
inlineoverride

Returns the type of the topology.

bool sofa::component::topology::EdgeSetTopologyContainer::hasEdges ( ) const
bool sofa::component::topology::EdgeSetTopologyContainer::hasEdgesAroundVertex ( ) const
void sofa::component::topology::EdgeSetTopologyContainer::init ( void  )
override
void sofa::component::topology::EdgeSetTopologyContainer::initTopology ( )

Dynamic Topology API

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

const bool& sofa::component::topology::EdgeSetTopologyContainer::isEdgeTopologyDirty ( )
inlineprotected
void sofa::component::topology::EdgeSetTopologyContainer::reinit ( )
override
void sofa::component::topology::EdgeSetTopologyContainer::setEdgeTopologyToDirty ( )
protected

Use a specific boolean

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

Function creating the data graph linked to d_triangle.

Related details

friend class EdgeSetTopologyModifier
friend