Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
|
#include <DistributedTetrahedralMesh.hpp>
Public Types | |
typedef std::vector< Node< SPACE_DIM > * >::const_iterator | HaloNodeIterator |
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 Member Functions | |
unsigned | SolveNodeMapping (unsigned index) const |
unsigned | SolveElementMapping (unsigned index) const |
unsigned | SolveBoundaryElementMapping (unsigned index) const |
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 | serialize (Archive &archive, const unsigned int version) |
void | SetElementOwnerships () |
void | RegisterNode (unsigned index) |
void | RegisterHaloNode (unsigned index) |
void | RegisterElement (unsigned index) |
void | RegisterBoundaryElement (unsigned index) |
void | ComputeMeshPartitioning (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader, std::set< unsigned > &rNodesOwned, std::set< unsigned > &rHaloNodesOwned, std::set< unsigned > &rElementsOwned, std::vector< unsigned > &rProcessorsOffset) |
void | ParMetisLibraryNodeAndElementPartitioning (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader, std::set< unsigned > &rElementsOwned, std::set< unsigned > &rNodesOwned, std::set< unsigned > &rHaloNodesOwned, std::vector< unsigned > &rProcessorsOffset) |
void | ReorderNodes () |
Private Attributes | |
unsigned | mTotalNumElements |
unsigned | mTotalNumBoundaryElements |
unsigned | mTotalNumNodes |
std::vector< Node< SPACE_DIM > * > | mHaloNodes |
std::map< unsigned, unsigned > | mNodesMapping |
std::map< unsigned, unsigned > | mHaloNodesMapping |
std::map< unsigned, unsigned > | mElementsMapping |
std::map< unsigned, unsigned > | mBoundaryElementsMapping |
ChasteCuboid< SPACE_DIM > * | mpSpaceRegion |
DistributedTetrahedralMeshPartitionType::type | mPartitioning |
Friends | |
class | TestDistributedTetrahedralMesh |
class | TestDistributedQuadraticMesh |
class | boost::serialization::access |
Additional Inherited Members | |
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 |
DistributedVectorFactory * | mpDistributedVectorFactory |
std::vector< unsigned > | mNodePermutation |
std::string | mMeshFileBaseName |
bool | mMeshChangesDuringSimulation |
Parallel implementation of a mesh Nodes are distributed such that each process has A set of nodes (possibly reordered) with contiguous global indices A local copy of all the elements supporting those nodes A local copy of ghost/halo nodes which are all the nodes used in the supporting elements, but not owned outright.
Definition at line 62 of file DistributedTetrahedralMesh.hpp.
typedef std::vector<Node<SPACE_DIM>*>::const_iterator DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::HaloNodeIterator |
Definition of halo node Iterator type.
Definition at line 449 of file DistributedTetrahedralMesh.hpp.
DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::DistributedTetrahedralMesh | ( | DistributedTetrahedralMeshPartitionType::type | partitioningMethod = DistributedTetrahedralMeshPartitionType::PARMETIS_LIBRARY | ) |
Constructor.
partitioningMethod | defaults to PARMETIS_LIBRARY, but in 1-D is always overridden in this constructor to be the DUMB partition |
Definition at line 75 of file DistributedTetrahedralMesh.cpp.
References DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::mPartitioning.
|
virtual |
Destructor.
Definition at line 91 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Calculate the bounding box (width extremes for all dimensions of the mesh). Override for distributed case
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1614 of file DistributedTetrahedralMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::CalculateBoundingBox(), PetscTools::ReplicateException(), ChasteCuboid< SPACE_DIM >::rGetLowerCorner(), and ChasteCuboid< SPACE_DIM >::rGetUpperCorner().
|
virtual |
Determine whether or not the current process owns node 0 of this boundary element (tie breaker to determine which process writes to file for when two or more share ownership of a face).
faceIndex | is the global index of the face |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 567 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Determine whether or not the current process owns node 0 of this element (tie breaker to determine which process writes to file for when two or more share ownership of an element).
elementIndex | is the global index of the element |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 554 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Computes the minimum and maximum lengths of the edges in the mesh. This method overrides the default implementation in the parent class
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1678 of file DistributedTetrahedralMesh.cpp.
References AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::CalculateMinMaxEdgeLengths().
|
private |
Compute a parallel partitioning of a given mesh using specialised methods below based on the value of mPartitioning
rMeshReader | is the reader pointing to the mesh to be read in and partitioned |
rNodesOwned | is a set to be filled with the indices of nodes owned by this process |
rHaloNodesOwned | is a set to be filled with the indices of halo nodes owned by this process |
rElementsOwned | is a set to be filled with the indices of elements owned by this process |
rProcessorsOffset | a vector of length NumProcs to be filled with the index of the lowest indexed node owned by each process |
Definition at line 107 of file DistributedTetrahedralMesh.cpp.
References PetscTools::HasParMetis().
|
virtual |
Construct a 3D cuboid grid on [0,width]x[0,height]x[0,depth].
Distributed version splits the mesh in layers in the z-direction. That is, the zeroth process will own from z=0 to about z=depth/num_procs etc.
width | width of the mesh (in the x-direction) |
height | height of the mesh (in the y-direction) |
depth | depth of the mesh (in the z-direction) |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1018 of file DistributedTetrahedralMesh.cpp.
References PetscTools::AmMaster(), PetscTools::Barrier(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructCuboid(), EXCEPTION, DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLocalOwnership(), DistributedVectorFactory::GetLow(), OutputFileHandler::GetOutputDirectoryFullPath(), and AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
|
virtual |
Construct the mesh using a MeshReader.
rMeshReader | the mesh reader |
Implements AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Reimplemented in MixedDimensionMesh< ELEMENT_DIM, SPACE_DIM >, and MixedDimensionMesh< ELEMENT_DIM, ELEMENT_DIM >.
Definition at line 232 of file DistributedTetrahedralMesh.cpp.
Referenced by DistributedQuadraticMesh< DIM >::ConstructFromMeshReader(), MixedDimensionMesh< ELEMENT_DIM, SPACE_DIM >::ConstructFromMeshReader(), and Load2dMeshAndSetCircularTissue().
|
virtual |
Construct a 1D linear grid on [0,width]
Throws if there are more processes than the number of nodes (width+1)
width | width of the mesh (in the x-direction) |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 697 of file DistributedTetrahedralMesh.cpp.
References PetscTools::AmMaster(), PetscTools::Barrier(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructLinearMesh(), EXCEPTION, OutputFileHandler::GetOutputDirectoryFullPath(), and AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
|
virtual |
Construct a 2D rectangular grid on [0,width]x[0,height].
Diagonals can be staggered so that there is no preferred diffusion propagation direction.
Distributed version splits the mesh in layers in the y-direction. That is, the zeroth process will own from y=0 to about y=height/num_procs etc.
width | width of the mesh (in the x-direction) |
height | height of the mesh (in the y-direction) |
stagger | whether the mesh should 'jumble' up the elements (defaults to true) |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 815 of file DistributedTetrahedralMesh.cpp.
References PetscTools::AmMaster(), PetscTools::Barrier(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ConstructRectangularMesh(), EXCEPTION, DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLocalOwnership(), DistributedVectorFactory::GetLow(), OutputFileHandler::GetOutputDirectoryFullPath(), and AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
|
virtual |
Utility method to give the functionality of iterating through the halo nodes of a process
rHaloIndices | A vector to fill with the global indices of the nodes which are locally halos |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 520 of file DistributedTetrahedralMesh.cpp.
Referenced by DistanceMapCalculator< ELEMENT_DIM, SPACE_DIM >::DistanceMapCalculator().
DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::HaloNodeIterator DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetHaloNodeIteratorBegin | ( | ) | const |
Definition at line 1690 of file DistributedTetrahedralMesh.cpp.
DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::HaloNodeIterator DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetHaloNodeIteratorEnd | ( | ) | const |
Definition at line 1730 of file DistributedTetrahedralMesh.cpp.
|
virtual |
GetNearestNodeIndex iterates through all nodes in the mesh and returns the global index with the smallest distance to the provided point.
This method is overridden in the distributed case to return the global node index.
rTestPoint | reference to the point |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1648 of file DistributedTetrahedralMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNearestNodeIndex(), and ChastePoint< DIM >::rGetLocation().
|
virtual |
We first search halo node (as there are fewer), then search totally owned nodes. Otherwise throw.
index | the global index of the node |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 649 of file DistributedTetrahedralMesh.cpp.
References EXCEPTION, and PetscTools::GetMyRank().
|
virtual |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 496 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 514 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 502 of file DistributedTetrahedralMesh.cpp.
unsigned DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumHaloNodes | ( | ) | const |
Definition at line 472 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 484 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 478 of file DistributedTetrahedralMesh.cpp.
Referenced by VtkMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().
unsigned DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetNumLocalNodes | ( | ) | const |
Definition at line 466 of file DistributedTetrahedralMesh.cpp.
Referenced by Hdf5ToVtkConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToVtkConverter().
|
virtual |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 490 of file DistributedTetrahedralMesh.cpp.
DistributedTetrahedralMeshPartitionType::type DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetPartitionType | ( | ) | const |
serialization uses this method.
Definition at line 508 of file DistributedTetrahedralMesh.cpp.
ChasteCuboid< SPACE_DIM > * DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetProcessRegion | ( | ) |
Get the local region of space owned by this process
Definition at line 531 of file DistributedTetrahedralMesh.cpp.
References EXCEPTION.
|
private |
Specialised method to compute a parallel partitioning of a given mesh with the ParMetis library (called by ComputeMeshPartitioning, based on the value of mPartitioning)
rMeshReader | is the reader pointing to the mesh to be read in and partitioned |
rElementsOwned | is an empty set to be filled with the indices of elements owned by this process |
rNodesOwned | is an empty set to be filled with the indices of nodes owned by this process |
rHaloNodesOwned | is an empty set to be filled with the indices of halo nodes owned by this process |
rProcessorsOffset | a vector of length NumProcs to be filled with the index of the lowest indexed node owned by each process |
Definition at line 1308 of file DistributedTetrahedralMesh.cpp.
References AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetElementData(), PetscTools::GetMyRank(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNextElementData(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumElements(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), PetscTools::GetNumProcs(), AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::IsFileFormatBinary(), PetscTools::IsParallel(), ElementData::NodeIndices, Timer::Reset(), and AbstractMeshReader< ELEMENT_DIM, SPACE_DIM >::Reset().
|
private |
Add the most recently constructed boundary element to the global->local boundary element mapping
index | is the global index of boundary element to be registered |
Definition at line 598 of file DistributedTetrahedralMesh.cpp.
|
private |
Add the most recently constructed element to the global->local element mapping
index | is the global index of element to be registered |
Definition at line 592 of file DistributedTetrahedralMesh.cpp.
|
private |
Add the most recently constructed halo node to the global->local halo node mapping
index | is the global index of halo node to be registered |
Definition at line 586 of file DistributedTetrahedralMesh.cpp.
|
private |
Add the most recently constructed node to the global->local node mapping
index | is the global index of node to be registered |
Definition at line 580 of file DistributedTetrahedralMesh.cpp.
|
private |
Reorder the node indices in this mesh by applying the permutation give in mNodePermutation.
The node indexed with "i" will be re-assigned with the new index mNodePermutation[i]
Definition at line 668 of file DistributedTetrahedralMesh.cpp.
References PetscTools::IsParallel().
|
virtual |
Do a general mesh rotation with a positive determinant orthonormal rotation matrix. This is the rotation method that actually does the work. This override is because class has halo nodes.
rotationMatrix | is a Ublas rotation matrix of the correct form |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1696 of file DistributedTetrahedralMesh.cpp.
|
virtual |
Scale the mesh - uses the parent class for scaling the nodes. This derived specialisation is for scaling halo nodes.
xFactor | is the scale in the x-direction (defaults to 1.0) |
yFactor | is the scale in the y-direction (defaults to 1.0) |
zFactor | is the scale in the z-direction (defaults to 1.0) |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1285 of file DistributedTetrahedralMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::Scale().
|
inlineprivate |
Serialize the mesh.
archive | the archive |
version | the current version of this class |
Definition at line 107 of file DistributedTetrahedralMesh.hpp.
|
virtual |
Specify the node distribution across processes. This also makes sure we don't try to use METIS to partition the mesh.
pFactory | a factory to use for this mesh |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 100 of file DistributedTetrahedralMesh.cpp.
References AbstractMesh< ELEMENT_DIM, SPACE_DIM >::SetDistributedVectorFactory().
|
privatevirtual |
Sets the ownership of each element according to which nodes are owned by the process.
Information on node ownership comes from the distributed vector factory and an element is "owned" if one or more of its nodes are owned
Reimplemented from AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 541 of file DistributedTetrahedralMesh.cpp.
void DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::SetProcessRegion | ( | ChasteCuboid< SPACE_DIM > * | pRegion | ) |
Set the local region of space to be owned by this process
pRegion | The region, defined by a ChasteCuboid. |
Definition at line 548 of file DistributedTetrahedralMesh.cpp.
|
protectedvirtual |
Overridden solve boundary element mapping method.
index | the global index of the boundary element |
Implements AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 636 of file DistributedTetrahedralMesh.cpp.
References EXCEPTION, and PetscTools::GetMyRank().
|
protectedvirtual |
Overridden solve element mapping method.
index | the global index of the element |
Implements AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 623 of file DistributedTetrahedralMesh.cpp.
References EXCEPTION, and PetscTools::GetMyRank().
|
protectedvirtual |
Overridden solve node mapping method.
index | the global index of the node |
Implements AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 604 of file DistributedTetrahedralMesh.cpp.
References EXCEPTION, and PetscTools::GetMyRank().
|
virtual |
Translate the mesh given the displacement vector. This is the translation method that actually does the work. This override is because class has halo nodes.
rDisplacement | is a translation vector of the correct size |
Reimplemented from AbstractMesh< ELEMENT_DIM, SPACE_DIM >.
Definition at line 1713 of file DistributedTetrahedralMesh.cpp.
Needed for serialization.
Definition at line 99 of file DistributedTetrahedralMesh.hpp.
Definition at line 65 of file DistributedTetrahedralMesh.hpp.
|
friend |
Definition at line 64 of file DistributedTetrahedralMesh.hpp.
|
private |
A map from boundary element global index to local index used by this process.
Definition at line 90 of file DistributedTetrahedralMesh.hpp.
|
private |
A map from element global index to local index used by this process.
Definition at line 87 of file DistributedTetrahedralMesh.hpp.
|
private |
Vector of pointer to halo nodes used by this process.
Definition at line 78 of file DistributedTetrahedralMesh.hpp.
|
private |
A map from halo node global index to local index used by this process.
Definition at line 84 of file DistributedTetrahedralMesh.hpp.
|
private |
A map from node global index to local index used by this process.
Definition at line 81 of file DistributedTetrahedralMesh.hpp.
|
private |
Partitioning method.
Definition at line 96 of file DistributedTetrahedralMesh.hpp.
Referenced by DistributedTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::DistributedTetrahedralMesh().
|
private |
The region of space owned by this process, if using geometric partition.
Definition at line 93 of file DistributedTetrahedralMesh.hpp.
|
private |
The total number of boundary elements in the mesh.
Definition at line 72 of file DistributedTetrahedralMesh.hpp.
|
private |
The total number of elements in the mesh.
Definition at line 69 of file DistributedTetrahedralMesh.hpp.
|
private |
The total number of nodes in the mesh.
Definition at line 75 of file DistributedTetrahedralMesh.hpp.