Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
NodesOnlyMesh< SPACE_DIM > Class Template Reference

#include <NodesOnlyMesh.hpp>

+ Inheritance diagram for NodesOnlyMesh< SPACE_DIM >:
+ Collaboration diagram for NodesOnlyMesh< SPACE_DIM >:

Public Member Functions

 NodesOnlyMesh ()
 
virtual ~NodesOnlyMesh ()
 
void ConstructNodesWithoutMesh (const std::vector< Node< SPACE_DIM > * > &rNodes, double maxInteractionDistance)
 
void ConstructNodesWithoutMesh (const std::vector< boost::shared_ptr< Node< SPACE_DIM > > > &rNodes, double maxInteractionDistance)
 
void ConstructNodesWithoutMesh (const AbstractMesh< SPACE_DIM, SPACE_DIM > &rGeneratingMesh, double maxInteractionDistance)
 
std::vector< bool > & rGetInitiallyOwnedNodes ()
 
void Clear ()
 
unsigned SolveNodeMapping (unsigned index) const
 
Node< SPACE_DIM > * GetNodeOrHaloNode (unsigned index) const
 
bool IsOwned (c_vector< double, SPACE_DIM > &location)
 
unsigned GetNumNodes () const
 
virtual unsigned GetMaximumNodeIndex ()
 
void SetMaximumInteractionDistance (double maxDistance)
 
double GetMaximumInteractionDistance ()
 
double GetWidth (const unsigned &rDimension) const
 
void SetCalculateNodeNeighbours (bool calculateNodeNeighbours)
 
void CalculateInteriorNodePairs (std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > &rNodePairs)
 
void CalculateBoundaryNodePairs (std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > &rNodePairs)
 
void ReMesh (NodeMap &rMap)
 
void SetInitialBoxCollection (const c_vector< double, 2 *SPACE_DIM > domainSize, double maxInteractionDistance)
 
void UpdateBoxCollection ()
 
void ResizeBoxCollection ()
 
bool GetIsPeriodicAcrossProcsFromBoxCollection () const
 
void AddNodesToBoxes ()
 
void AddHaloNodesToBoxes ()
 
void CalculateNodesOutsideLocalDomain ()
 
std::vector< unsigned > & rGetNodesToSendLeft ()
 
std::vector< unsigned > & rGetNodesToSendRight ()
 
std::vector< unsigned > & rGetHaloNodesToSendRight ()
 
std::vector< unsigned > & rGetHaloNodesToSendLeft ()
 
void AddHaloNode (boost::shared_ptr< Node< SPACE_DIM > > pNewNode)
 
void ClearHaloNodes ()
 
void SetNode (unsigned nodeIndex, ChastePoint< SPACE_DIM > point, bool concreteMove=false)
 
unsigned AddNode (Node< SPACE_DIM > *pNewNode)
 
void AddMovedNode (boost::shared_ptr< Node< SPACE_DIM > > pMovedNode)
 
void DeleteNode (unsigned index)
 
void DeleteMovedNode (unsigned index)
 
void SetMinimumNodeDomainBoundarySeparation (double separation)
 
void LoadBalanceMesh ()
 
void ConstructFromMeshReader (AbstractMeshReader< SPACE_DIM, SPACE_DIM > &rMeshReader)
 
std::vector< unsignedGetAllNodeIndices () const
 
- Public Member Functions inherited from MutableMesh< SPACE_DIM, SPACE_DIM >
bool CheckIsVoronoi (double maxPenetration=0.0)
 
 MutableMesh ()
 
 MutableMesh (std::vector< Node< SPACE_DIM > * > nodes)
 
virtual ~MutableMesh ()
 
unsigned GetNumElements () const
 
unsigned GetNumBoundaryElements () const
 
void RescaleMeshFromBoundaryNode (ChastePoint< 1 > updatedPoint, unsigned boundaryNodeIndex)
 
void RescaleMeshFromBoundaryNode (ChastePoint< 1 > updatedPoint, unsigned boundaryNodeIndex)
 
unsigned AddElement (Element< ELEMENT_DIM, SPACE_DIM > *pNewElement)
 
void MoveMergeNode (unsigned index, unsigned targetIndex, bool concreteMove=true)
 
virtual void DeleteElement (unsigned index)
 
void DeleteNodePriorToReMesh (unsigned index)
 
unsigned RefineElement (Element< ELEMENT_DIM, SPACE_DIM > *pElement, ChastePoint< SPACE_DIM > point)
 
void DeleteBoundaryNodeAt (unsigned index)
 
void ReIndex (NodeMap &map)
 
void ReMesh ()
 
std::vector< c_vector< unsigned, 5 > > SplitLongEdges (double cutoffLength)
 
c_vector< unsigned, 3 > SplitEdge (Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
 
- Public Member Functions inherited from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
 TetrahedralMesh ()
 
void ConstructFromMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
 
void ReadNodesPerProcessorFile (const std::string &rNodesPerProcessorFile)
 
bool CheckIsConforming ()
 
double GetVolume ()
 
double GetSurfaceArea ()
 
void RefreshMesh ()
 
void PermuteNodes ()
 
void PermuteNodes (const std::vector< unsigned > &perm)
 
unsigned GetContainingElementIndexWithInitialGuess (const ChastePoint< SPACE_DIM > &rTestPoint, unsigned startingElementGuess, bool strict=false)
 
unsigned GetNearestElementIndex (const ChastePoint< SPACE_DIM > &rTestPoint)
 
std::vector< unsignedGetContainingElementIndices (const ChastePoint< SPACE_DIM > &rTestPoint)
 
double GetAngleBetweenNodes (unsigned indexA, unsigned indexB)
 
virtual void RefreshJacobianCachedData ()
 
virtual void GetJacobianForElement (unsigned elementIndex, c_matrix< double, SPACE_DIM, SPACE_DIM > &rJacobian, double &rJacobianDeterminant) const
 
virtual void GetInverseJacobianForElement (unsigned elementIndex, c_matrix< double, SPACE_DIM, ELEMENT_DIM > &rJacobian, double &rJacobianDeterminant, c_matrix< double, ELEMENT_DIM, SPACE_DIM > &rInverseJacobian) const
 
virtual void GetWeightedDirectionForElement (unsigned elementIndex, c_vector< double, SPACE_DIM > &rWeightedDirection, double &rJacobianDeterminant) const
 
virtual void GetWeightedDirectionForBoundaryElement (unsigned elementIndex, c_vector< double, SPACE_DIM > &rWeightedDirection, double &rJacobianDeterminant) const
 
EdgeIterator EdgesBegin ()
 
EdgeIterator EdgesEnd ()
 
- Public Member Functions inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
ElementIterator GetElementIteratorBegin (bool skipDeletedElements=true)
 
ElementIterator GetElementIteratorEnd ()
 
 AbstractTetrahedralMesh ()
 
virtual ~AbstractTetrahedralMesh ()
 
virtual unsigned GetNumLocalElements () const
 
virtual unsigned GetNumLocalBoundaryElements () const
 
unsigned GetNumAllElements () const
 
unsigned GetNumAllBoundaryElements () const
 
virtual unsigned GetNumCableElements () const
 
virtual unsigned GetNumVertices () const
 
Element< ELEMENT_DIM, SPACE_DIM > * GetElement (unsigned index) const
 
BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * GetBoundaryElement (unsigned index) const
 
void ConstructFromMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rOtherMesh)
 
BoundaryElementIterator GetBoundaryElementIteratorBegin () const
 
BoundaryElementIterator GetBoundaryElementIteratorEnd () const
 
void CheckOutwardNormals ()
 
virtual void ConstructLinearMesh (unsigned width)
 
virtual void ConstructRectangularMesh (unsigned width, unsigned height, bool stagger=true)
 
virtual void ConstructCuboid (unsigned width, unsigned height, unsigned depth)
 
void ConstructRegularSlabMesh (double spaceStep, double width, double height=0, double depth=0)
 
void ConstructRegularSlabMeshWithDimensionSplit (unsigned dimension, double spaceStep, double width, double height=0, double depth=0)
 
virtual bool CalculateDesignatedOwnershipOfBoundaryElement (unsigned faceIndex)
 
virtual bool CalculateDesignatedOwnershipOfElement (unsigned elementIndex)
 
unsigned CalculateMaximumNodeConnectivityPerProcess () const
 
virtual void GetHaloNodeIndices (std::vector< unsigned > &rHaloIndices) const
 
void CalculateNodeExchange (std::vector< std::vector< unsigned > > &rNodesToSendPerProcess, std::vector< std::vector< unsigned > > &rNodesToReceivePerProcess)
 
virtual c_vector< double, 2 > CalculateMinMaxEdgeLengths ()
 
unsigned GetContainingElementIndex (const ChastePoint< SPACE_DIM > &rTestPoint, bool strict=false, std::set< unsigned > testElements=std::set< unsigned >(), bool onlyTryWithTestElements=false)
 
unsigned GetNearestElementIndexFromTestElements (const ChastePoint< SPACE_DIM > &rTestPoint, std::set< unsigned > testElements)
 
- Public Member Functions inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM >
NodeIterator GetNodeIteratorBegin (bool skipDeletedNodes=true)
 
NodeIterator GetNodeIteratorEnd ()
 
 AbstractMesh ()
 
virtual ~AbstractMesh ()
 
unsigned GetNumBoundaryNodes () const
 
virtual unsigned GetNumAllNodes () const
 
unsigned GetNumNodeAttributes () const
 
Node< SPACE_DIM > * GetNode (unsigned index) const
 
Node< SPACE_DIM > * GetNodeFromPrePermutationIndex (unsigned index) const
 
virtual DistributedVectorFactoryGetDistributedVectorFactory ()
 
virtual void SetDistributedVectorFactory (DistributedVectorFactory *pFactory)
 
BoundaryNodeIterator GetBoundaryNodeIteratorBegin () const
 
BoundaryNodeIterator GetBoundaryNodeIteratorEnd () const
 
std::string GetMeshFileBaseName () const
 
bool IsMeshOnDisk () const
 
const std::vector< unsigned > & rGetNodePermutation () const
 
virtual c_vector< double, SPACE_DIM > GetVectorFromAtoB (const c_vector< double, SPACE_DIM > &rLocationA, const c_vector< double, SPACE_DIM > &rLocationB)
 
double GetDistanceBetweenNodes (unsigned indexA, unsigned indexB)
 
virtual ChasteCuboid< SPACE_DIM > CalculateBoundingBox () const
 
virtual unsigned GetNearestNodeIndex (const ChastePoint< SPACE_DIM > &rTestPoint)
 
virtual void Scale (const double xFactor=1.0, const double yFactor=1.0, const double zFactor=1.0)
 
virtual void Translate (const c_vector< double, SPACE_DIM > &rDisplacement)
 
void Translate (const double xMovement=0.0, const double yMovement=0.0, const double zMovement=0.0)
 
virtual void Rotate (c_matrix< double, SPACE_DIM, SPACE_DIM > rotationMatrix)
 
void Rotate (c_vector< double, 3 > axis, double angle)
 
void RotateX (const double theta)
 
void RotateY (const double theta)
 
void RotateZ (const double theta)
 
void Rotate (double theta)
 
bool IsMeshChanging () const
 
unsigned CalculateMaximumContainingElementsPerProcess () const
 
void SetMeshHasChangedSinceLoading ()
 

Protected Member Functions

void ClearBoxCollection ()
 
virtual void SetUpBoxCollection (double cutOffLength, c_vector< double, 2 *SPACE_DIM > domainSize, int numLocalRows=PETSC_DECIDE, c_vector< bool, SPACE_DIM > isDimPeriodic=zero_vector< bool >(SPACE_DIM))
 
DistributedBoxCollection< SPACE_DIM > * GetBoxCollection ()
 
- Protected Member Functions inherited from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
unsigned SolveNodeMapping (unsigned index) const
 
unsigned SolveElementMapping (unsigned index) const
 
unsigned SolveBoundaryElementMapping (unsigned index) const
 
template<class MESHER_IO >
void ExportToMesher (NodeMap &map, MESHER_IO &mesherInput, int *elementList=nullptr)
 
template<class MESHER_IO >
void ImportFromMesher (MESHER_IO &mesherOutput, unsigned numberOfElements, int *elementList, unsigned numberOfFaces, int *faceList, int *edgeMarkerList)
 
void InitialiseTriangulateIo (triangulateio &mesherIo)
 
void FreeTriangulateIo (triangulateio &mesherIo)
 
- Protected Member Functions inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
void SetElementOwnerships ()
 
- Protected Member Functions inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM >
ChasteCuboid< SPACE_DIM > CalculateBoundingBox (const std::vector< Node< SPACE_DIM > * > &rNodes) const
 

Private Member Functions

template<class Archive >
void save (Archive &archive, const unsigned int version) const
 
template<class Archive >
void load (Archive &archive, const unsigned int version)
 
unsigned GetNextAvailableIndex ()
 
void EnlargeBoxCollection ()
 
bool IsANodeCloseToDomainBoundary ()
 
void SetUpBoxCollection (const std::vector< Node< SPACE_DIM > * > &rNodes)
 
void RemoveDeletedNodes (NodeMap &map)
 
void UpdateNodeIndices ()
 
void AddNodeWithFixedIndex (Node< SPACE_DIM > *pNewNode)
 

Private Attributes

std::vector< boost::shared_ptr< Node< SPACE_DIM > > > mHaloNodes
 
double mMaximumInteractionDistance
 
std::map< unsigned, unsignedmNodesMapping
 
std::map< unsigned, unsignedmHaloNodesMapping
 
unsigned mIndexCounter
 
double mMinimumNodeDomainBoundarySeparation
 
std::vector< unsignedmDeletedGlobalNodeIndices
 
std::vector< unsignedmNodesToSendRight
 
std::vector< unsignedmNodesToSendLeft
 
std::vector< boolmLocalInitialNodes
 
unsigned mMaxAddedNodeIndex
 
DistributedBoxCollection< SPACE_DIM > * mpBoxCollection
 
bool mCalculateNodeNeighbours
 

Friends

class TestNodesOnlyMesh
 
class boost::serialization::access
 

Additional Inherited Members

- Public Types inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
typedef std::vector< BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * >::const_iterator BoundaryElementIterator
 
- Public Types inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM >
typedef std::vector< Node< SPACE_DIM > * >::const_iterator BoundaryNodeIterator
 
- Protected Attributes inherited from MutableMesh< SPACE_DIM, SPACE_DIM >
std::vector< unsignedmDeletedElementIndices
 
std::vector< unsignedmDeletedBoundaryElementIndices
 
std::vector< unsignedmDeletedNodeIndices
 
bool mAddedNodes
 
- Protected Attributes inherited from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
std::vector< c_vector< double, SPACE_DIM > > mElementWeightedDirections
 
std::vector< c_matrix< double, SPACE_DIM, ELEMENT_DIM > > mElementJacobians
 
std::vector< c_matrix< double, ELEMENT_DIM, SPACE_DIM > > mElementInverseJacobians
 
std::vector< doublemElementJacobianDeterminants
 
std::vector< c_vector< double, SPACE_DIM > > mBoundaryElementWeightedDirections
 
std::vector< doublemBoundaryElementJacobianDeterminants
 
- Protected Attributes inherited from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >
bool mMeshIsLinear
 
std::vector< Element< ELEMENT_DIM, SPACE_DIM > * > mElements
 
std::vector< BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * > mBoundaryElements
 
- Protected Attributes inherited from AbstractMesh< ELEMENT_DIM, SPACE_DIM >
std::vector< Node< SPACE_DIM > * > mNodes
 
std::vector< Node< SPACE_DIM > * > mBoundaryNodes
 
DistributedVectorFactorympDistributedVectorFactory
 
std::vector< unsignedmNodePermutation
 
std::string mMeshFileBaseName
 
bool mMeshChangesDuringSimulation
 

Detailed Description

template<unsigned SPACE_DIM>
class NodesOnlyMesh< SPACE_DIM >

Mesh class for storing lists of nodes (no elements). This inherits from MutableMesh because we want to be able to add and delete nodes.

Definition at line 52 of file NodesOnlyMesh.hpp.

Constructor & Destructor Documentation

◆ NodesOnlyMesh()

template<unsigned SPACE_DIM>
NodesOnlyMesh< SPACE_DIM >::NodesOnlyMesh ( )

Default constructor to initialise BoxCollection to NULL.

Definition at line 41 of file NodesOnlyMesh.cpp.

◆ ~NodesOnlyMesh()

template<unsigned SPACE_DIM>
NodesOnlyMesh< SPACE_DIM >::~NodesOnlyMesh ( )
virtual

Over-written destructor to delete pointer to BoxCollection.

Definition at line 53 of file NodesOnlyMesh.cpp.

Member Function Documentation

◆ AddHaloNode()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::AddHaloNode ( boost::shared_ptr< Node< SPACE_DIM > >  pNewNode)

Add a temporary halo node on this process.

Parameters
pNewNodea shared pointer to the new node to add.

Definition at line 388 of file NodesOnlyMesh.cpp.

References Node< SPACE_DIM >::GetIndex().

◆ AddHaloNodesToBoxes()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::AddHaloNodesToBoxes ( )

Iterate through each halo node and add it to its appropriate box.

Definition at line 651 of file NodesOnlyMesh.cpp.

◆ AddMovedNode()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::AddMovedNode ( boost::shared_ptr< Node< SPACE_DIM > >  pMovedNode)

Add a node to this process that has moved from another process.

Parameters
pMovedNodethe node to add to this mesh.

Definition at line 424 of file NodesOnlyMesh.cpp.

◆ AddNode()

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::AddNode ( Node< SPACE_DIM > *  pNewNode)
virtual

Overridden AddNode() method.

Parameters
pNewNodepointer to the new node.
Returns
index of new node.

Reimplemented from MutableMesh< SPACE_DIM, SPACE_DIM >.

Reimplemented in PeriodicNodesOnlyMesh< SPACE_DIM >.

Definition at line 403 of file NodesOnlyMesh.cpp.

References Node< SPACE_DIM >::SetIndex().

Referenced by Cylindrical2dNodesOnlyMesh::AddNode(), and PeriodicNodesOnlyMesh< SPACE_DIM >::AddNode().

◆ AddNodesToBoxes()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::AddNodesToBoxes ( )

Iterate through each node and add it to its appropriate box.

Definition at line 638 of file NodesOnlyMesh.cpp.

◆ AddNodeWithFixedIndex()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::AddNodeWithFixedIndex ( Node< SPACE_DIM > *  pNewNode)
private

Add pNewNode to the mesh, maintaining its current global index. Called by AddNode and AddMovedNode.

Parameters
pNewNodethe new node to add to this mesh.

Definition at line 359 of file NodesOnlyMesh.cpp.

◆ CalculateBoundaryNodePairs()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::CalculateBoundaryNodePairs ( std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > &  rNodePairs)

Calculate pairs of nodes from boxes on the process boundary using the BoxCollection

Parameters
rNodePairsreference to the set of node pairs to populate.

Definition at line 234 of file NodesOnlyMesh.cpp.

◆ CalculateInteriorNodePairs()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::CalculateInteriorNodePairs ( std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > &  rNodePairs)

Calculate pairs of nodes from interior boxes using the BoxCollection.

Parameters
rNodePairsreference to the set of node pairs to populate.

Definition at line 226 of file NodesOnlyMesh.cpp.

◆ CalculateNodesOutsideLocalDomain()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::CalculateNodesOutsideLocalDomain ( )

Work out which nodes lie outside the local domain and add their indices to the vectors mNodesToSendLeft and mNodesToSendRight.

Definition at line 291 of file NodesOnlyMesh.cpp.

◆ Clear()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::Clear ( )
virtual

Overridden Clear() method for NodesOnlyMesh.

Reimplemented from MutableMesh< SPACE_DIM, SPACE_DIM >.

Definition at line 140 of file NodesOnlyMesh.cpp.

References MutableMesh< ELEMENT_DIM, SPACE_DIM >::Clear().

◆ ClearBoxCollection()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ClearBoxCollection ( )
protected

Clear the BoxCollection

Definition at line 570 of file NodesOnlyMesh.cpp.

◆ ClearHaloNodes()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ClearHaloNodes ( )

Delete all the halo nodes on this process.

Definition at line 395 of file NodesOnlyMesh.cpp.

◆ ConstructFromMeshReader()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ConstructFromMeshReader ( AbstractMeshReader< SPACE_DIM, SPACE_DIM > &  rMeshReader)

Overridden ConstructFromMeshReader to correctly assign global node indices on load.

Parameters
rMeshReaderthe mesh reader for input.

Definition at line 716 of file NodesOnlyMesh.cpp.

References TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructFromMeshReader().

◆ ConstructNodesWithoutMesh() [1/3]

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh ( const AbstractMesh< SPACE_DIM, SPACE_DIM > &  rGeneratingMesh,
double  maxInteractionDistance 
)

A Helper method to enable you to construct a nodes-only mesh by stripping the nodes TetrahedralMesh, this calls the ConstructNodesWithoutMesh method with the nodes

Parameters
rGeneratingMeshany mesh with nodes, used to generate the NodesOnlyMesh.
maxInteractionDistancethe distance that defines node neighbours in CalculateNodePairs.

Definition at line 115 of file NodesOnlyMesh.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes.

◆ ConstructNodesWithoutMesh() [2/3]

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh ( const std::vector< boost::shared_ptr< Node< SPACE_DIM > > > &  rNodes,
double  maxInteractionDistance 
)

Construct the mesh using only nodes. No mesh is created, but the nodes are stored. The original vector of nodes is deep-copied: new node objects are made with are independent of the pointers in the input so that they can be safely deleted.

If this is the only way of constructing a mesh of this type, then we can be certain that elements and boundary elements are always unused.

Parameters
rNodesa vector of shared pointers to nodes.
maxInteractionDistancethe distance that defines node neighbours in CalculateNodePairs.

Definition at line 102 of file NodesOnlyMesh.cpp.

◆ ConstructNodesWithoutMesh() [3/3]

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ConstructNodesWithoutMesh ( const std::vector< Node< SPACE_DIM > * > &  rNodes,
double  maxInteractionDistance 
)

Construct the mesh using only nodes. No mesh is created, but the nodes are stored. The original vector of nodes is deep-copied: new node objects are made with are independent of the pointers in the input so that they can be safely deleted.

If this is the only way of constructing a mesh of this type, then we can be certain that elements and boundary elements are always unused.

Parameters
rNodesa vector of pointers to nodes.
maxInteractionDistancethe distance that defines node neighbours in CalculateNodePairs.

Definition at line 60 of file NodesOnlyMesh.cpp.

References Node< SPACE_DIM >::GetIndex(), Node< SPACE_DIM >::rGetNodeAttributes(), and Node< SPACE_DIM >::SetRadius().

Referenced by CaBasedCellPopulation< DIM >::WriteVtkResultsToFile(), and PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile().

◆ DeleteMovedNode()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::DeleteMovedNode ( unsigned  index)

Make a clean delete of a node that has moved off this process.

Parameters
indexthe global index of the node moving off this process.

Definition at line 469 of file NodesOnlyMesh.cpp.

◆ DeleteNode()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::DeleteNode ( unsigned  index)
virtual

Overridden DeleteNode() method.

Parameters
indexof the node to be deleted

Reimplemented from MutableMesh< SPACE_DIM, SPACE_DIM >.

Definition at line 454 of file NodesOnlyMesh.cpp.

◆ EnlargeBoxCollection()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::EnlargeBoxCollection ( )
private

Increase box collection size by adding an extra row/face to each edge.

Definition at line 506 of file NodesOnlyMesh.cpp.

References PetscTools::AmMaster(), and PetscTools::AmTopMost().

◆ GetAllNodeIndices()

template<unsigned SPACE_DIM>
std::vector< unsigned > NodesOnlyMesh< SPACE_DIM >::GetAllNodeIndices ( ) const

Get all node indices in order of appearance.

Returns
Node vector of node indices for this process ignoring all delete nodes

Definition at line 728 of file NodesOnlyMesh.cpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::save().

◆ GetBoxCollection()

template<unsigned SPACE_DIM>
DistributedBoxCollection< SPACE_DIM > * NodesOnlyMesh< SPACE_DIM >::GetBoxCollection ( )
protected
Returns
mpBoxCollection

Definition at line 152 of file NodesOnlyMesh.cpp.

◆ GetIsPeriodicAcrossProcsFromBoxCollection()

template<unsigned SPACE_DIM>
bool NodesOnlyMesh< SPACE_DIM >::GetIsPeriodicAcrossProcsFromBoxCollection ( ) const

Gets the periodicity across processors information from mpBoxCollection

Returns
whether the periodicity occurs across multipke processors

Definition at line 691 of file NodesOnlyMesh.cpp.

◆ GetMaximumInteractionDistance()

template<unsigned SPACE_DIM>
double NodesOnlyMesh< SPACE_DIM >::GetMaximumInteractionDistance ( )
Returns
mMaxInteractionDistance.

Definition at line 203 of file NodesOnlyMesh.cpp.

◆ GetMaximumNodeIndex()

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::GetMaximumNodeIndex ( )
virtual

Get the largest node global index on this process.

Returns
the maximum node index.

Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 191 of file NodesOnlyMesh.cpp.

References PetscTools::GetMyRank(), and PetscTools::GetNumProcs().

◆ GetNextAvailableIndex()

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::GetNextAvailableIndex ( )
private

Calculate the next unique global index available on this process. Uses a hashing function to ensure that a unique index is given to every node.

For example for 3 process they will have access to the following integers:

Proc 0: 0 3 6 9 12 ...

Proc 1: 1 4 7 10 13 ...

Proc 2: 2 5 8 11 14 ...

Deleted node indices can be locally re-used.

Deleted node indices of nodes that have *moved* process cannot be re-used.

Returns
the next available index.

Definition at line 486 of file NodesOnlyMesh.cpp.

◆ GetNodeOrHaloNode()

template<unsigned SPACE_DIM>
Node< SPACE_DIM > * NodesOnlyMesh< SPACE_DIM >::GetNodeOrHaloNode ( unsigned  index) const
virtual

Overridden method to get node or halo node from the mesh.

Parameters
indexthe global index of the node.
Returns
a pointer to the node.

Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 158 of file NodesOnlyMesh.cpp.

◆ GetNumNodes()

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::GetNumNodes ( ) const
virtual
Returns
the local number of nodes that are actually in use. Does not include halo nodes.

Reimplemented from MutableMesh< SPACE_DIM, SPACE_DIM >.

Definition at line 185 of file NodesOnlyMesh.cpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::load().

◆ GetWidth()

template<unsigned SPACE_DIM>
double NodesOnlyMesh< SPACE_DIM >::GetWidth ( const unsigned rDimension) const
virtual

Overridden GetWidth method to work in parallel.

Parameters
rDimensionthe dimension along which to get the width.
Returns
the width.

Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.

Reimplemented in PeriodicNodesOnlyMesh< SPACE_DIM >.

Definition at line 209 of file NodesOnlyMesh.cpp.

References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetWidth().

Referenced by CaBasedCellPopulation< DIM >::WriteVtkResultsToFile().

◆ IsANodeCloseToDomainBoundary()

template<unsigned SPACE_DIM>
bool NodesOnlyMesh< SPACE_DIM >::IsANodeCloseToDomainBoundary ( )
private
Returns
Whether any node (deleted or otherwise) is close to the domain boundary.

Definition at line 532 of file NodesOnlyMesh.cpp.

References PetscTools::GetWorld().

◆ IsOwned()

template<unsigned SPACE_DIM>
bool NodesOnlyMesh< SPACE_DIM >::IsOwned ( c_vector< double, SPACE_DIM > &  location)

A method to identify whether a location is owned in the parallel space decomposition.

Parameters
locationthe location to test
Returns
whether the point is owned.

Definition at line 179 of file NodesOnlyMesh.cpp.

◆ load()

template<unsigned SPACE_DIM>
template<class Archive >
void NodesOnlyMesh< SPACE_DIM >::load ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

Load member variables of the object which have to be preserved during its lifetime.

Note that we must archive any member variables FIRST so that this method can call a ReMesh (to convert from TrianglesMeshReader input format into our native format).

Parameters
archivethe archive
versionthe current version of this class

Definition at line 94 of file NodesOnlyMesh.hpp.

References NodesOnlyMesh< SPACE_DIM >::GetNumNodes(), NodesOnlyMesh< SPACE_DIM >::mIndexCounter, NodesOnlyMesh< SPACE_DIM >::mMaxAddedNodeIndex, NodesOnlyMesh< SPACE_DIM >::mMaximumInteractionDistance, NodesOnlyMesh< SPACE_DIM >::mMinimumNodeDomainBoundarySeparation, AbstractMesh< ELEMENT_DIM, SPACE_DIM >::mNodes, and NodesOnlyMesh< SPACE_DIM >::mNodesMapping.

◆ LoadBalanceMesh()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::LoadBalanceMesh ( )

Re-allocate the underlaying BoxCollection rows based on the load-balance algorithm implemented in the box collection.

Definition at line 697 of file NodesOnlyMesh.cpp.

◆ ReMesh()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ReMesh ( NodeMap rMap)
virtual

Overridden ReMesh() method. Since only Nodes are stored, this method cleans up mNodes by removing nodes marked as deleted and reallocating mNodes to 'fill the gaps'.

Parameters
rMapa reference to a NodeMap which associates the indices of the old mesh with the new mesh. It should be large enough to contain all node indices.

Reimplemented from MutableMesh< SPACE_DIM, SPACE_DIM >.

Definition at line 242 of file NodesOnlyMesh.cpp.

References NodeMap::ResetToIdentity().

◆ RemoveDeletedNodes()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::RemoveDeletedNodes ( NodeMap map)
private

Remove all nodes that return mIsDeleted as true.

Parameters
mapthe NodeMap to record which nodes have been removed.

Definition at line 257 of file NodesOnlyMesh.cpp.

◆ ResizeBoxCollection()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::ResizeBoxCollection ( )

Check whether any nodes are close to the edge of the box collection and increase the size of it if necessary.

Definition at line 677 of file NodesOnlyMesh.cpp.

◆ rGetHaloNodesToSendLeft()

template<unsigned SPACE_DIM>
std::vector< unsigned > & NodesOnlyMesh< SPACE_DIM >::rGetHaloNodesToSendLeft ( )
Returns
the indices of halo nodes, owned by this process, on the left hand boundary.

Definition at line 353 of file NodesOnlyMesh.cpp.

◆ rGetHaloNodesToSendRight()

template<unsigned SPACE_DIM>
std::vector< unsigned > & NodesOnlyMesh< SPACE_DIM >::rGetHaloNodesToSendRight ( )
Returns
the indices of halo nodes, owned by this process, on the right hand boundary.

Definition at line 347 of file NodesOnlyMesh.cpp.

◆ rGetInitiallyOwnedNodes()

template<unsigned SPACE_DIM>
std::vector< bool > & NodesOnlyMesh< SPACE_DIM >::rGetInitiallyOwnedNodes ( )
Returns
whether each initial node given to ConstructNodesWithoutMesh is owned by this process.

Definition at line 121 of file NodesOnlyMesh.cpp.

◆ rGetNodesToSendLeft()

template<unsigned SPACE_DIM>
std::vector< unsigned > & NodesOnlyMesh< SPACE_DIM >::rGetNodesToSendLeft ( )
Returns
mNodesToSendLeft.

Definition at line 335 of file NodesOnlyMesh.cpp.

◆ rGetNodesToSendRight()

template<unsigned SPACE_DIM>
std::vector< unsigned > & NodesOnlyMesh< SPACE_DIM >::rGetNodesToSendRight ( )
Returns
mNodesToSendRight.

Definition at line 341 of file NodesOnlyMesh.cpp.

◆ save()

template<unsigned SPACE_DIM>
template<class Archive >
void NodesOnlyMesh< SPACE_DIM >::save ( Archive &  archive,
const unsigned int  version 
) const
inlineprivate

Archives the member variables of the object which have to be preserved during its lifetime.

Note that we must archive any member variables FIRST so that this method can call a ReMesh (to convert from TrianglesMeshReader input format into our native format).

Parameters
archivethe archive
versionthe current version of this class

Definition at line 73 of file NodesOnlyMesh.hpp.

References NodesOnlyMesh< SPACE_DIM >::GetAllNodeIndices(), NodesOnlyMesh< SPACE_DIM >::mMaximumInteractionDistance, and NodesOnlyMesh< SPACE_DIM >::mMinimumNodeDomainBoundarySeparation.

◆ SetCalculateNodeNeighbours()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetCalculateNodeNeighbours ( bool  calculateNodeNeighbours)

Set whether to calculate node neighbours for the rNodeNeigbours set in CalculateNodePairs. Switch off for efficiency

Parameters
calculateNodeNeighbourswhether to store the neighbours.

Definition at line 220 of file NodesOnlyMesh.cpp.

◆ SetInitialBoxCollection()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetInitialBoxCollection ( const c_vector< double, 2 *SPACE_DIM >  domainSize,
double  maxInteractionDistance 
)

Set the initial box collection without passing nodes to the mesh. Used for memory efficient construction in parallel.

Parameters
domainSizethe initial domain size of the mesh.
maxInteractionDistancethe max interaction distance between nodes.

Definition at line 580 of file NodesOnlyMesh.cpp.

◆ SetMaximumInteractionDistance()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetMaximumInteractionDistance ( double  maxDistance)

Set the maximum node interaction distance.

Parameters
maxDistancethe new maximum distance.

Definition at line 197 of file NodesOnlyMesh.cpp.

◆ SetMinimumNodeDomainBoundarySeparation()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetMinimumNodeDomainBoundarySeparation ( double  separation)

Set the value of mMinimumNodeDomainBoundarySeparation.

Parameters
separationthe new value for the separation.

Definition at line 478 of file NodesOnlyMesh.cpp.

◆ SetNode()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetNode ( unsigned  nodeIndex,
ChastePoint< SPACE_DIM >  point,
bool  concreteMove = false 
)
virtual

Overridden SetNode() method.

Parameters
nodeIndexis the index of the node to be moved
pointis the new target location of the node
concreteMoveis set to false if we want to skip the signed area tests in the parent Class Note this should always be false here

Reimplemented from MutableMesh< SPACE_DIM, SPACE_DIM >.

Reimplemented in PeriodicNodesOnlyMesh< SPACE_DIM >.

Definition at line 414 of file NodesOnlyMesh.cpp.

◆ SetUpBoxCollection() [1/2]

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetUpBoxCollection ( const std::vector< Node< SPACE_DIM > * > &  rNodes)
private

Set up a DistributedBoxCollection by calculating the correct domain size from the node locations.

Parameters
rNodesthe nodes that will be contained in the box collection.

Definition at line 586 of file NodesOnlyMesh.cpp.

References ChasteCuboid< SPACE_DIM >::GetLongestAxis(), ChasteCuboid< SPACE_DIM >::GetWidth(), ChasteCuboid< SPACE_DIM >::rGetLowerCorner(), and ChasteCuboid< SPACE_DIM >::rGetUpperCorner().

Referenced by Cylindrical2dNodesOnlyMesh::SetUpBoxCollection(), and PeriodicNodesOnlyMesh< SPACE_DIM >::SetUpBoxCollection().

◆ SetUpBoxCollection() [2/2]

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetUpBoxCollection ( double  cutOffLength,
c_vector< double, 2 *SPACE_DIM >  domainSize,
int  numLocalRows = PETSC_DECIDE,
c_vector< bool, SPACE_DIM >  isDimPeriodic = zero_vector<bool>(SPACE_DIM) 
)
protectedvirtual

Set up the box collection. Overridden in subclasses to implement periodicity.

Parameters
cutOffLengththe cut off length for node neighbours.
domainSizethe size of the domain containing the nodes.
numLocalRowsthe number of rows that should be owned by this process.
isDimPeriodicwhether the DistributedBoxCollection should be periodic.

Reimplemented in PeriodicNodesOnlyMesh< SPACE_DIM >.

Definition at line 609 of file NodesOnlyMesh.cpp.

◆ SolveNodeMapping()

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::SolveNodeMapping ( unsigned  index) const
virtual

Overridden solve node mapping method

Parameters
indexthe global index of the node.
Returns
the local index of the node in mNodes.

Implements AbstractMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 127 of file NodesOnlyMesh.cpp.

References EXCEPTION, and PetscTools::GetMyRank().

◆ UpdateBoxCollection()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::UpdateBoxCollection ( )

Clear the old box collection and set up a new one if necessary.

Definition at line 664 of file NodesOnlyMesh.cpp.

◆ UpdateNodeIndices()

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::UpdateNodeIndices ( )
private

Make sure that node indices match their location, and update mNodesMapping.

Definition at line 280 of file NodesOnlyMesh.cpp.

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<unsigned SPACE_DIM>
friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 59 of file NodesOnlyMesh.hpp.

◆ TestNodesOnlyMesh

template<unsigned SPACE_DIM>
friend class TestNodesOnlyMesh
friend

Definition at line 56 of file NodesOnlyMesh.hpp.

Member Data Documentation

◆ mCalculateNodeNeighbours

template<unsigned SPACE_DIM>
bool NodesOnlyMesh< SPACE_DIM >::mCalculateNodeNeighbours
private

Whether to calculate node neighbours in the box collection. Switch off for efficiency

Definition at line 153 of file NodesOnlyMesh.hpp.

◆ mDeletedGlobalNodeIndices

template<unsigned SPACE_DIM>
std::vector<unsigned> NodesOnlyMesh< SPACE_DIM >::mDeletedGlobalNodeIndices
private

A list of the global indices of nodes that have been deleted from this process and can be reused.

Definition at line 133 of file NodesOnlyMesh.hpp.

◆ mHaloNodes

template<unsigned SPACE_DIM>
std::vector<boost::shared_ptr<Node<SPACE_DIM> > > NodesOnlyMesh< SPACE_DIM >::mHaloNodes
private

Vector of shared-pointers to halo nodes used by this process.

Definition at line 115 of file NodesOnlyMesh.hpp.

◆ mHaloNodesMapping

template<unsigned SPACE_DIM>
std::map<unsigned, unsigned> NodesOnlyMesh< SPACE_DIM >::mHaloNodesMapping
private

A map from halo node global index to local index in mHaloNodes.

Definition at line 124 of file NodesOnlyMesh.hpp.

◆ mIndexCounter

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::mIndexCounter
private

A counter of the number of fresh node indices used on this process. Ensures unique indices in parallel.

Definition at line 127 of file NodesOnlyMesh.hpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::load().

◆ mLocalInitialNodes

template<unsigned SPACE_DIM>
std::vector<bool> NodesOnlyMesh< SPACE_DIM >::mLocalInitialNodes
private

A list of flags showing which initial nodes passed to ConstructNodesWithoutMesh were created on this process.

Definition at line 143 of file NodesOnlyMesh.hpp.

◆ mMaxAddedNodeIndex

template<unsigned SPACE_DIM>
unsigned NodesOnlyMesh< SPACE_DIM >::mMaxAddedNodeIndex
private

A variable to keep track of added node indices so we know the largest on this process. Used to create a large enough NodeMap when remeshing.

Definition at line 147 of file NodesOnlyMesh.hpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::load().

◆ mMaximumInteractionDistance

template<unsigned SPACE_DIM>
double NodesOnlyMesh< SPACE_DIM >::mMaximumInteractionDistance
private

Nodes separated by a distance less than mMaximumInteractionDistance are neighbours.

Definition at line 118 of file NodesOnlyMesh.hpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::load(), and NodesOnlyMesh< SPACE_DIM >::save().

◆ mMinimumNodeDomainBoundarySeparation

template<unsigned SPACE_DIM>
double NodesOnlyMesh< SPACE_DIM >::mMinimumNodeDomainBoundarySeparation
private

A minimum separation to maintain between nodes and the boundary of mpBoxCollection, which grows with the mesh.

Definition at line 130 of file NodesOnlyMesh.hpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::load(), and NodesOnlyMesh< SPACE_DIM >::save().

◆ mNodesMapping

template<unsigned SPACE_DIM>
std::map<unsigned, unsigned> NodesOnlyMesh< SPACE_DIM >::mNodesMapping
private

A map from node global index to local index in mNodes.

Definition at line 121 of file NodesOnlyMesh.hpp.

Referenced by NodesOnlyMesh< SPACE_DIM >::load().

◆ mNodesToSendLeft

template<unsigned SPACE_DIM>
std::vector<unsigned> NodesOnlyMesh< SPACE_DIM >::mNodesToSendLeft
private

A list of global indices of nodes that need to be moved to the left hand process.

Definition at line 139 of file NodesOnlyMesh.hpp.

◆ mNodesToSendRight

template<unsigned SPACE_DIM>
std::vector<unsigned> NodesOnlyMesh< SPACE_DIM >::mNodesToSendRight
private

A list of global indices of nodes that need to be moved to the right hand process.

Definition at line 136 of file NodesOnlyMesh.hpp.

◆ mpBoxCollection

template<unsigned SPACE_DIM>
DistributedBoxCollection<SPACE_DIM>* NodesOnlyMesh< SPACE_DIM >::mpBoxCollection
private

A pointer to the DistributedBoxCollection.

Definition at line 150 of file NodesOnlyMesh.hpp.


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