Chaste
Release::2017.1
|
#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) |
double | SingleDistance (unsigned sourceNodeIndex, unsigned destinationNodeIndex) |
Private Member Functions | |
bool | WorkOnLocalQueue (std::vector< double > &rNodeDistances) |
bool | UpdateQueueFromRemote (std::vector< double > &rNodeDistances) |
void | PushLocal (double priority, 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 |
unsigned | mPopCounter |
unsigned | mTargetNodeIndex |
bool | mSingleTarget |
c_vector< double, SPACE_DIM > | mTargetNodePoint |
std::priority_queue< std::pair< double, unsigned > > | mActivePriorityNodeIndexQueue |
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 52 of file DistanceMapCalculator.hpp.
DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & | rMesh | ) |
Constructor
rMesh | the mesh for which to compute maps |
Definition at line 40 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.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal().
|
inline |
Destructor - cleans up mNumHalosPerProcess (which is normally set to NULL anyway).
Definition at line 139 of file DistanceMapCalculator.hpp.
References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumHalosPerProcess, and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance().
void DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap | ( | const std::vector< unsigned > & | rSourceNodeIndices, |
std::vector< double > & | rNodeDistances | ||
) |
Generates a distance map of all the nodes of the mesh to the given source
rSourceNodeIndices | set of node indices defining the source set or surface If the vector of source nodes is empty then the results will be a vector of node distance which are all of size DBL_MAX |
rNodeDistances | distance map computed. The method will resize it if it's not big enough. |
Definition at line 77 of file DistanceMapCalculator.cpp.
References PetscTools::GetNumProcs(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActivePriorityNodeIndexQueue, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHi, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mLo, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumNodes, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mPopCounter, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mRoundCounter, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mSingleTarget, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodePoint, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mWorkOnEntireMesh, NEVER_REACHED, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), PetscTools::ReplicateBool(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
Referenced by HeartGeometryInformation< SPACE_DIM >::HeartGeometryInformation(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), PostProcessingWriter< ELEMENT_DIM, SPACE_DIM >::WritePostProcessingFiles(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::~DistanceMapCalculator().
|
inlineprivate |
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
priority | Current priority/distance of this node. |
nodeIndex | A global node index. |
Definition at line 117 of file DistanceMapCalculator.hpp.
References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator().
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
double DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance | ( | unsigned | sourceNodeIndex, |
unsigned | destinationNodeIndex | ||
) |
sourceNodeIndex | node index for source of distance computation. Calculations will be cached so that multiple point-to-point distance computations will get faster. |
destinationNodeIndex | target destination node |
Definition at line 277 of file DistanceMapCalculator.cpp.
References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActivePriorityNodeIndexQueue, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mSingleTarget, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodeIndex, and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodePoint.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::~DistanceMapCalculator().
|
private |
Update the local Queue of node indices using data that are from the halo nodes of remote processes.
rNodeDistances | distance map computed |
Definition at line 144 of file DistanceMapCalculator.cpp.
References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActivePriorityNodeIndexQueue, 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().
|
private |
Work on the Queue of node indices (grass-fire across the mesh)
rNodeDistances | distance map computed |
Definition at line 199 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(), PetscTools::GetNumProcs(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActivePriorityNodeIndexQueue, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumNodes, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mPopCounter, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mSingleTarget, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodeIndex, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodePoint, DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), and Node< SPACE_DIM >::rGetLocation().
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap().
|
private |
Queue of nodes to be processed (initialised with the nodes defining the surface) Priorities (given as the first in the pair for lexographical ordering) are initialised to -best_distance_to_source so that nodes closest to the source are dealt with first.
Definition at line 88 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
|
private |
(Only used when mWorkOnEntrireMesh == false). This is a local cache of halo node indices.
Definition at line 70 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote().
|
private |
Local cache of the nodes owned by this process, from mesh's DistributedVectorFactory
Definition at line 64 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator().
|
private |
Local cache of the nodes owned by this process, from mesh's DistributedVectorFactory
Definition at line 62 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator().
|
private |
(Only used when mWorkOnEntrireMesh == false). This forms an array of with the number of halo nodes known by each process.
Definition at line 68 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().
|
private |
Number of nodes in the mesh
Definition at line 60 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().
|
private |
Used to check implementation for number of queue pops per calculation
Definition at line 74 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
|
private |
The mesh
Definition at line 58 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
|
private |
Used to check parallel implementation
Definition at line 72 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap().
|
private |
True for point-to-point distances.
Definition at line 78 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
|
private |
Used in the calculation of point-to-point distances.
Definition at line 76 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
|
private |
Also used in the calculation of point-to-point distances with A* heuristic – this requires a parallel communication
Definition at line 80 of file DistanceMapCalculator.hpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().
|
private |
Whether we should work on the entire mesh. True if sequential. True is the mesh is a plain TetrahedralMesh.
Definition at line 66 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().