Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
NodeMap Class Reference

#include <NodeMap.hpp>

+ Collaboration diagram for NodeMap:

Public Member Functions

 NodeMap (unsigned size)
 
void Resize (unsigned size)
 
void ResetToIdentity ()
 
void SetNewIndex (unsigned oldIndex, unsigned newIndex)
 
void SetDeleted (unsigned index)
 
bool IsDeleted (unsigned index)
 
unsigned GetNewIndex (unsigned oldIndex) const
 
bool IsIdentityMap ()
 
unsigned GetSize ()
 

Private Attributes

std::vector< unsignedmMap
 
bool mIsIdentity
 

Detailed Description

Nodemap class used when remeshing. The map associates the indices of nodes in the old mesh with indices of nodes in the new mesh.

Definition at line 46 of file NodeMap.hpp.

Constructor & Destructor Documentation

◆ NodeMap()

NodeMap::NodeMap ( unsigned  size)

Constructor.

Parameters
sizethe size of the NodeMap

Definition at line 46 of file NodeMap.cpp.

References mMap.

Member Function Documentation

◆ GetNewIndex()

unsigned NodeMap::GetNewIndex ( unsigned  oldIndex) const
Returns
the new index associated with a given old index.
Parameters
oldIndexthe old index of a node

Definition at line 87 of file NodeMap.cpp.

References EXCEPTION, mIsIdentity, and mMap.

Referenced by Cylindrical2dMesh::ReMesh(), Toroidal2dMesh::ReMesh(), MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostNodesAfterReMesh(), and NodeBasedCellPopulation< DIM >::UpdateMapsAfterRemesh().

◆ GetSize()

unsigned NodeMap::GetSize ( )

◆ IsDeleted()

bool NodeMap::IsDeleted ( unsigned  index)
Returns
whether a given old index is marked as 'deleted'.
Parameters
indexthe old index of a node

Definition at line 82 of file NodeMap.cpp.

References mMap.

Referenced by Cylindrical2dMesh::ReMesh(), Toroidal2dMesh::ReMesh(), MeshBasedCellPopulationWithGhostNodes< DIM >::UpdateGhostNodesAfterReMesh(), and NodeBasedCellPopulation< DIM >::UpdateMapsAfterRemesh().

◆ IsIdentityMap()

bool NodeMap::IsIdentityMap ( )

◆ ResetToIdentity()

void NodeMap::ResetToIdentity ( )

Reset the NodeMap to the identity map.

Definition at line 57 of file NodeMap.cpp.

References mIsIdentity, and mMap.

Referenced by NodesOnlyMesh< SPACE_DIM >::ReMesh(), Cylindrical2dMesh::ReMesh(), and Toroidal2dMesh::ReMesh().

◆ Resize()

void NodeMap::Resize ( unsigned  size)

Resize the NodeMap.

Parameters
sizethe new size of the NodeMap

Definition at line 52 of file NodeMap.cpp.

References mMap.

Referenced by MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReIndex(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), Cylindrical2dMesh::ReMesh(), and Toroidal2dMesh::ReMesh().

◆ SetDeleted()

void NodeMap::SetDeleted ( unsigned  index)

Mark a given old index as 'deleted' by associating it with the new index UINT_MAX.

Parameters
indexthe old index of a node

Definition at line 76 of file NodeMap.cpp.

References mIsIdentity, and mMap.

Referenced by NodesOnlyMesh< 2 >::ConstructNodesWithoutMesh(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ExportToMesher(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReIndex(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), Cylindrical2dMesh::ReMesh(), and Toroidal2dMesh::ReMesh().

◆ SetNewIndex()

void NodeMap::SetNewIndex ( unsigned  oldIndex,
unsigned  newIndex 
)

Associate a given old index with a new index.

Parameters
oldIndexthe old index of a node
newIndexthe new index of a node

Definition at line 66 of file NodeMap.cpp.

References mIsIdentity, and mMap.

Referenced by TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ExportToMesher(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReIndex(), MutableMesh< ELEMENT_DIM, SPACE_DIM >::ReMesh(), Cylindrical2dMesh::ReMesh(), and Toroidal2dMesh::ReMesh().

Member Data Documentation

◆ mIsIdentity

bool NodeMap::mIsIdentity
private

Redundant data to provide a shortcut when the map is empty or the identity. This is initialised to true, since an empty map is equivalent to the identity.

Definition at line 56 of file NodeMap.hpp.

Referenced by GetNewIndex(), IsIdentityMap(), ResetToIdentity(), SetDeleted(), and SetNewIndex().

◆ mMap

std::vector<unsigned> NodeMap::mMap
private

The map is stored as an ordered vector of node indices. Note that a vector is more efficient than std::map in this case where we know the exact size of the map and can benefit from O(1) lookup

Definition at line 53 of file NodeMap.hpp.

Referenced by NodeMap(), GetNewIndex(), GetSize(), IsDeleted(), ResetToIdentity(), Resize(), SetDeleted(), and SetNewIndex().


The documentation for this class was generated from the following files: