DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <DistanceMapCalculator.hpp>

Collaboration diagram for DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >

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.


Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator ( AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh  )  [inline]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::~DistanceMapCalculator (  )  [inline]

Destructor - cleans up mNumHalosPerProcess (which is normally set to NULL anyway).

Definition at line 131 of file DistanceMapCalculator.hpp.

References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumHalosPerProcess.


Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue ( std::vector< double > &  rNodeDistances  )  [inline, private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote ( std::vector< double > &  rNodeDistances  )  [inline, private]

Update the local Queue of node indices using data that are from the halo nodes of remote processes.

Parameters:
rNodeDistances distance map computed
Returns:
true when this update was active => there are non-empty queues left to work on

false without working or side-effects if we don't have a true distributed mesh

Definition at line 136 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().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal ( double  priority,
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

Parameters:
priority Current priority/distance of this node.
nodeIndex A global node index.

Definition at line 110 of file DistanceMapCalculator.hpp.

References DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActivePriorityNodeIndexQueue, 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().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap ( const std::vector< unsigned > &  rSourceNodeIndices,
std::vector< double > &  rNodeDistances 
) [inline]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
double DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance ( unsigned  sourceNodeIndex,
unsigned  destinationNodeIndex 
) [inline]

Calculates a single point-to-point distance

Parameters:
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

Todo:
#1414 premature termination when we find the correct one (parallel)

Definition at line 266 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.


Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>& DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mrMesh [private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mNumNodes [private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mLo [private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mHi [private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mWorkOnEntireMesh [private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
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().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
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().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
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().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mPopCounter [private]

Used to check implementation for number of queue pops per calculation

Definition at line 67 of file DistanceMapCalculator.hpp.

Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodeIndex [private]

Used in the calculation of point-to-point distances.

Definition at line 69 of file DistanceMapCalculator.hpp.

Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mSingleTarget [private]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector<double, SPACE_DIM> DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mTargetNodePoint [private]

Also used in the calculation of point-to-point distances with A* heuristic -- this requires a parallel communication

Definition at line 73 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().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::priority_queue<std::pair<double, unsigned> > DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::mActivePriorityNodeIndexQueue [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 81 of file DistanceMapCalculator.hpp.

Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::ComputeDistanceMap(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::PushLocal(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::SingleDistance(), DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::UpdateQueueFromRemote(), and DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::WorkOnLocalQueue().


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

Generated on Mon Apr 18 11:37:02 2011 for Chaste by  doxygen 1.5.5