Chaste  Release::2018.1
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 ()
 
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 ()
 
void Clear ()
 
unsigned GetNumNodes () const
 
unsigned GetNumElements () const
 
unsigned GetNumBoundaryElements () const
 
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, bool isPeriodic=false)
 
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

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

Default constructor to initialise BoxCollection to NULL.

Definition at line 41 of file NodesOnlyMesh.cpp.

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

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 370 of file NodesOnlyMesh.cpp.

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

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

Definition at line 606 of file NodesOnlyMesh.cpp.

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 406 of file NodesOnlyMesh.cpp.

References Node< SPACE_DIM >::AddNodeAttribute(), Node< SPACE_DIM >::GetRadius(), Node< SPACE_DIM >::SetIsParticle(), Node< SPACE_DIM >::SetRadius(), and Node< SPACE_DIM >::SetRegion().

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

Definition at line 385 of file NodesOnlyMesh.cpp.

References Node< SPACE_DIM >::SetIndex().

Referenced by Cylindrical2dNodesOnlyMesh::AddNode(), and ParallelCellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateParallelCells().

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

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

Definition at line 593 of file NodesOnlyMesh.cpp.

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 341 of file NodesOnlyMesh.cpp.

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

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.

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.

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.

References PetscTools::GetMyRank().

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

Overridden Clear() method for NodesOnlyMesh.

Reimplemented from TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 140 of file NodesOnlyMesh.cpp.

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

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

Clear the BoxCollection

Definition at line 550 of file NodesOnlyMesh.cpp.

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

Delete all the halo nodes on this process.

Definition at line 377 of file NodesOnlyMesh.cpp.

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 665 of file NodesOnlyMesh.cpp.

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

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(), PottsBasedCellPopulation< DIM >::WriteVtkResultsToFile(), and MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM >::WriteVtkResultsToFile().

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.

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.

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 451 of file NodesOnlyMesh.cpp.

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 436 of file NodesOnlyMesh.cpp.

References EXCEPTION.

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 488 of file NodesOnlyMesh.cpp.

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

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 677 of file NodesOnlyMesh.cpp.

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

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

Definition at line 152 of file NodesOnlyMesh.cpp.

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

Definition at line 203 of file NodesOnlyMesh.cpp.

Referenced by ParallelCellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateParallelCells().

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

Referenced by ParallelCellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateParallelCells().

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 468 of file NodesOnlyMesh.cpp.

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

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.

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 AbstractMesh< ELEMENT_DIM, SPACE_DIM >.

Definition at line 185 of file NodesOnlyMesh.cpp.

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

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

Definition at line 209 of file NodesOnlyMesh.cpp.

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

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

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 510 of file NodesOnlyMesh.cpp.

References PetscTools::GetWorld().

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.

Referenced by ParallelCellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateParallelCells().

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.

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 646 of file NodesOnlyMesh.cpp.

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

Referenced by ParallelCellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateParallelCells().

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.

References NodeMap::SetDeleted().

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 632 of file NodesOnlyMesh.cpp.

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 335 of file NodesOnlyMesh.cpp.

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 329 of file NodesOnlyMesh.cpp.

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.

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

Definition at line 317 of file NodesOnlyMesh.cpp.

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

Definition at line 323 of file NodesOnlyMesh.cpp.

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.

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.

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 560 of file NodesOnlyMesh.cpp.

Referenced by ParallelCellsGenerator< CELL_CYCLE_MODEL, DIM >::GenerateParallelCells().

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.

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 460 of file NodesOnlyMesh.cpp.

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

Definition at line 396 of file NodesOnlyMesh.cpp.

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 566 of file NodesOnlyMesh.cpp.

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

Referenced by Cylindrical2dNodesOnlyMesh::SetUpBoxCollection().

template<unsigned SPACE_DIM>
void NodesOnlyMesh< SPACE_DIM >::SetUpBoxCollection ( double  cutOffLength,
c_vector< double, 2 *SPACE_DIM >  domainSize,
int  numLocalRows = PETSC_DECIDE,
bool  isPeriodic = false 
)
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.
isPeriodicwhether the DistributedBoxCollection should be periodic.

Definition at line 583 of file NodesOnlyMesh.cpp.

References DistributedBoxCollection< DIM >::SetupLocalBoxesHalfOnly().

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

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 619 of file NodesOnlyMesh.cpp.

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 Function Documentation

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

Needed for serialization.

Definition at line 59 of file NodesOnlyMesh.hpp.

Member Data Documentation

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.

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.

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.

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.

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< 2 >::load().

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.

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< 2 >::load().

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< 2 >::load(), and NodesOnlyMesh< 2 >::save().

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< 2 >::load(), and NodesOnlyMesh< 2 >::save().

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< 2 >::load().

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.

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.

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: