#include <DistanceMapCalculator.hpp>
Public Member Functions | |
DistanceMapCalculator (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh) | |
~DistanceMapCalculator () | |
void | ComputeDistanceMap (const std::vector< unsigned > &rSourceNodeIndices, std::vector< double > &rNodeDistances) |
Private Member Functions | |
void | WorkOnLocalQueue (std::vector< c_vector< double, SPACE_DIM > > &rWitnessPoints, std::vector< double > &rNodeDistances) |
bool | UpdateQueueFromRemote (std::vector< c_vector< double, SPACE_DIM > > &rWitnessPoints, std::vector< double > &rNodeDistances) |
void | PushLocal (unsigned nodeIndex) |
Private Attributes | |
AbstractTetrahedralMesh < ELEMENT_DIM, SPACE_DIM > & | mrMesh |
unsigned | mNumNodes |
unsigned | mLo |
unsigned | mHi |
bool | mWorkOnEntireMesh |
unsigned * | mNumHalosPerProcess |
std::vector< unsigned > | mHaloNodeIndices |
unsigned | mRoundCounter |
std::queue< unsigned > | mActiveNodeIndexQueue |
Friends | |
class | TestDistanceMapCalculator |
This class provides functionalities to compute a distance map in a given mesh from a given surface, specifying the distance from each node to the surface.
The mesh is specified in the constructor, and the ComputeDistanceMap computes (and returns by reference) the map.
Definition at line 45 of file DistanceMapCalculator.hpp.
DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & | rMesh | ) | [inline] |
Constructor
rMesh | the mesh for which to compute maps |
Definition at line 33 of file DistanceMapCalculator.cpp.
References DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetHaloNodeIndices(), PetscTools::GetNumProcs(), PetscTools::IsSequential(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHaloNodeIndices, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHi, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mLo, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumHalosPerProcess, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumNodes, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh, and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mWorkOnEntireMesh.
DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::~DistanceMapCalculator | ( | ) | [inline] |
Destructor - cleans up mNumHalosPerProcess (which is normally set to NULL anyway).
Definition at line 119 of file DistanceMapCalculator.hpp.
References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumHalosPerProcess.
void DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap | ( | const std::vector< unsigned > & | rSourceNodeIndices, | |
std::vector< double > & | rNodeDistances | |||
) | [inline] |
Generates a distance map of all the nodes of the mesh to the given source
rSourceNodeIndices | set of node indexes defining the source set orsurface | |
rNodeDistances | distance map computed. The method will resize it if it's not big enough. |
Definition at line 65 of file DistanceMapCalculator.cpp.
References PetscTools::GetNumProcs(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHi, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mLo, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumNodes, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mRoundCounter, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mWorkOnEntireMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
Referenced by HeartGeometryInformation< SPACE_DIM >::HeartGeometryInformation(), and PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WritePostProcessingFiles().
void DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal | ( | unsigned | nodeIndex | ) | [inline, private] |
Push a node index onto the queue. In the parallel case this will only push a locally-owned (not halo) node. Halo nodes will be updated, but never pushed to the local queue
nodeIndex | A global node index. |
Definition at line 99 of file DistanceMapCalculator.hpp.
References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActiveNodeIndexQueue, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHi, and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mLo.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
bool DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote | ( | std::vector< c_vector< double, SPACE_DIM > > & | rWitnessPoints, | |
std::vector< double > & | rNodeDistances | |||
) | [inline, private] |
Update the local Queue of node indices using data that are from the halo nodes of remote processes.
rWitnessPoints | The witness points in the source which supply the current minimum distance of each node | |
rNodeDistances | distance map computed |
Definition at line 118 of file DistanceMapCalculator.cpp.
References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActiveNodeIndexQueue, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHaloNodeIndices, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumHalosPerProcess, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mWorkOnEntireMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), and PetscTools::ReplicateBool().
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap().
void DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue | ( | std::vector< c_vector< double, SPACE_DIM > > & | rWitnessPoints, | |
std::vector< double > & | rNodeDistances | |||
) | [inline, private] |
Work on the Queue of node indices (grass-fire across the mesh)
rWitnessPoints | The witness points in the source which supply the current minimum distance of each node | |
rNodeDistances | distance map computed |
Definition at line 184 of file DistanceMapCalculator.cpp.
References Node< SPACE_DIM >::ContainingElementsBegin(), Node< SPACE_DIM >::ContainingElementsEnd(), Node< SPACE_DIM >::GetIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActiveNodeIndexQueue, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), and Node< SPACE_DIM >::rGetLocation().
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap().
std::queue<unsigned> DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActiveNodeIndexQueue [private] |
Queue of nodes to be processed (initialised with the nodes defining the surface)
Definition at line 70 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
std::vector<unsigned> DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHaloNodeIndices [private] |
(Only used when mWorkOnEntrireMesh == false). This is a local cache of halo node indices.
Definition at line 63 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote().
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHi [private] |
Local cache of the nodes owned by this process, from mesh's DistributedVectorFactory
Definition at line 57 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal().
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mLo [private] |
Local cache of the nodes owned by this process, from mesh's DistributedVectorFactory
Definition at line 55 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal().
unsigned* DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumHalosPerProcess [private] |
(Only used when mWorkOnEntrireMesh == false). This forms an array of with the number of halo nodes known by each process.
Definition at line 61 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::~DistanceMapCalculator().
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumNodes [private] |
Number of nodes in the mesh
Definition at line 53 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator().
AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>& DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh [private] |
The mesh
Definition at line 51 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mRoundCounter [private] |
Used to check parallel implementation
Definition at line 65 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap().
bool DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mWorkOnEntireMesh [private] |
Whether we should work on the entire mesh. True if sequential. True is the mesh is a plain TetrahedralMesh.
Definition at line 59 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote().