Chaste Release::3.1
AdaptiveTetrahedralMesh Class Reference

#include <AdaptiveTetrahedralMesh.hpp>

Collaboration diagram for AdaptiveTetrahedralMesh:

List of all members.

Public Member Functions

 AdaptiveTetrahedralMesh ()
 ~AdaptiveTetrahedralMesh ()
void ConstructFromVtuFile (std::string fileName)
void ConstructFromMesh (AbstractTetrahedralMesh< 3, 3 > *rMesh)
void ConstructFromDistributedMesh (DistributedTetrahedralMesh< 3, 3 > *rMesh)
void AddPointData (std::string dataName, std::vector< double > dataPayload)
void AddPointData (std::string dataName, std::vector< unsigned > dataPayload)
void RemoveArray (std::string dataName)
void WriteMeshToFile (std::string directory, std::string fileName)
void WriteMeshToDistributedFile (std::string directory, std::string fileName)
vtkUnstructuredGrid * GetVtkUnstructuredGrid ()
void SetAdaptCriterion (double range, double criterion)
unsigned GetNumNodes ()
unsigned GetNumLocalNodes ()
unsigned GetNumLocalAndHaloNodes ()
unsigned GetNumElements ()
unsigned GetNumLocalElements ()
unsigned GetNumSurfaceElements ()
void CalculateSENListAndSids (double coplanarTolerance=0.9999999)
double GetEdgeLengthDistribution (double range)
void AdaptMesh ()
void Reset ()
bool GetAdaptSuccess ()
void MakeVerbose (bool verbose=true)

Protected Member Functions

void GetGeometryConstraints ()
void CalculateErrorMetric ()
void Adapt ()

Private Attributes

vtkUnstructuredGrid * mpVtkUnstructuredGrid
unsigned mNumNodes
unsigned mNumElements
unsigned mNumLocalNodes
bool mAdaptSuccess
DiscreteGeometryConstraints * mpDiscreteGeometryConstraints
ErrorMeasure * mpErrorMeasure
Adaptivity * mpAdapt
std::vector< int > SENList
std::vector< int > sids
std::vector< doublemax_len
double mGoodEdgeRange
double mBadEdgeCriterion
bool mVerbose

Friends

class TestAdaptivityLibrary
class TestAdaptiveTetrahedralMesh
class TestAdaptiveTetrahedralMeshLargeMeshes

Detailed Description

An adaptive tetrahedral mesh class. Basically just a vtkUnstructuredGrid object with some additional methods and variables to wrap the Imperial College adaptivity library.

Definition at line 71 of file AdaptiveTetrahedralMesh.hpp.


Constructor & Destructor Documentation

AdaptiveTetrahedralMesh::AdaptiveTetrahedralMesh ( )

Constructor

Definition at line 50 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

AdaptiveTetrahedralMesh::~AdaptiveTetrahedralMesh ( )

Destructor

Definition at line 66 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid, and Reset().


Member Function Documentation

void AdaptiveTetrahedralMesh::Adapt ( ) [protected]

Adapt the mesh based on the error metric calculated using CalculateErrorMetric() and subject to the constraints given by GetGeometryConstraints()

Updates mpVtkUnstructuredGrid to point at a new VTK object that represents the adapted mesh

Users should call AdaptMesh() to calculate geometry constraints, error metric and new mesh in one step

Todo:
I can't see the point of this, since the VTK mesh is discarded (but not garbage collected)

Definition at line 345 of file AdaptiveTetrahedralMesh.cpp.

References HeartConfig::Instance(), mAdaptSuccess, mBadEdgeCriterion, mGoodEdgeRange, mNumElements, mNumLocalNodes, mNumNodes, mpAdapt, mpVtkUnstructuredGrid, mVerbose, Reset(), SENList, and sids.

Referenced by AdaptMesh().

void AdaptiveTetrahedralMesh::AdaptMesh ( )

Calculate the discrete geometry constraints for the mesh and an error metric, then adapt the mesh based on these (i.e. without the need to call GetGeometryConstraints() or CalculateErrorMetric())

Updates mpVtkUnstructuredGrid to point at a new VTK object that represents the adapted mesh

Definition at line 388 of file AdaptiveTetrahedralMesh.cpp.

References Adapt(), CalculateErrorMetric(), GetGeometryConstraints(), and RemoveArray().

Referenced by AdaptiveBidomainProblem::AdaptMesh().

void AdaptiveTetrahedralMesh::AddPointData ( std::string  dataName,
std::vector< double dataPayload 
)

Add vtkPointData to mpVtkUnstructuredGrid, e.g. to store the values of a variable at each node of the mesh

Parameters:
dataNameName of the data to be stored
dataPayloadstd::vector containing the values at each point

Definition at line 176 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::AddCurrentSolutionToAdaptiveMesh(), and ConstructFromDistributedMesh().

void AdaptiveTetrahedralMesh::AddPointData ( std::string  dataName,
std::vector< unsigned dataPayload 
)

Add vtkPointData to mpVtkUnstructuredGrid, e.g. to store the values of a variable at each node of the mesh

Parameters:
dataNameName of the data to be stored
dataPayloadstd::vector containing the values at each point

Definition at line 190 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

void AdaptiveTetrahedralMesh::CalculateErrorMetric ( ) [protected]

Calculate an error metric in preparation for adapting (currently uses Vm as the adaptive variable)

Users should call AdaptMesh() to calculate geometry constraints, error metric and new mesh in one step

Definition at line 314 of file AdaptiveTetrahedralMesh.cpp.

References HeartConfig::GetGradationForAdaptivity(), HeartConfig::GetMaxEdgeLengthForAdaptivity(), HeartConfig::GetMaxNodesForAdaptivity(), HeartConfig::GetMinEdgeLengthForAdaptivity(), HeartConfig::GetSigmaForAdaptivity(), HeartConfig::GetTargetErrorForAdaptivity(), HeartConfig::Instance(), max_len, mpErrorMeasure, mpVtkUnstructuredGrid, and mVerbose.

Referenced by AdaptMesh().

void AdaptiveTetrahedralMesh::CalculateSENListAndSids ( double  coplanarTolerance = 0.9999999)

Calculate the surface element-node list and the surface IDs for use in Adaptivity library

Parameters:
coplanarToleranceTolerance to be used when determining whether or not two surface elements are coplanar

Definition at line 290 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid, mVerbose, SENList, and sids.

Referenced by AdaptiveBidomainProblem::Solve().

void AdaptiveTetrahedralMesh::ConstructFromVtuFile ( std::string  fileName)

Method to construct an AdaptiveTetrahedralMesh object from a .vtu (vtkUnstructuredGrid format) file

Parameters:
fileNameFile name and full path to the file

Definition at line 72 of file AdaptiveTetrahedralMesh.cpp.

References mNumElements, mNumLocalNodes, mNumNodes, and mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::Solve().

bool AdaptiveTetrahedralMesh::GetAdaptSuccess ( )

Return mAdaptSuccess

Definition at line 410 of file AdaptiveTetrahedralMesh.cpp.

References mAdaptSuccess.

Referenced by AdaptiveBidomainProblem::AdaptMesh().

double AdaptiveTetrahedralMesh::GetEdgeLengthDistribution ( double  range)

Return the proportion of edges with an error metric value in the range [1 - range, 1 + range].

Parameters:
rangeThe size of the interval that we are interested in

Definition at line 337 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

void AdaptiveTetrahedralMesh::GetGeometryConstraints ( ) [protected]

Calculate the discrete geometry constraints for the mesh

Users should call AdaptMesh() to calculate geometry constraints, error metric and new mesh in one step

Definition at line 303 of file AdaptiveTetrahedralMesh.cpp.

References max_len, mpDiscreteGeometryConstraints, mpVtkUnstructuredGrid, mVerbose, SENList, and sids.

Referenced by AdaptMesh().

unsigned AdaptiveTetrahedralMesh::GetNumElements ( )

Return the number of elements in the mesh

Definition at line 275 of file AdaptiveTetrahedralMesh.cpp.

References mNumElements.

unsigned AdaptiveTetrahedralMesh::GetNumLocalAndHaloNodes ( )

Return the number of locally owned nodes, including halos (i.e. mpVtkUnstructuredGrid->GetNumberOfPoints())

Definition at line 270 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

unsigned AdaptiveTetrahedralMesh::GetNumLocalElements ( )

Return the number of locally owned elements (i.e. mpVtkUnstructuredGrid->GetNumberOfCells())

Definition at line 280 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

unsigned AdaptiveTetrahedralMesh::GetNumLocalNodes ( )

Return the number of locally owned nodes, excluding halos

Definition at line 265 of file AdaptiveTetrahedralMesh.cpp.

References mNumLocalNodes.

unsigned AdaptiveTetrahedralMesh::GetNumNodes ( )

Return the number of nodes in the mesh

Definition at line 260 of file AdaptiveTetrahedralMesh.cpp.

References mNumNodes.

Referenced by AdaptiveBidomainProblem::AdaptMesh().

unsigned AdaptiveTetrahedralMesh::GetNumSurfaceElements ( )

Return the number of surface elements in the mesh. Can only be called after CalculateSENListAndSids(), since vtkUnstructuredGrids do not know about surface elements.

Definition at line 285 of file AdaptiveTetrahedralMesh.cpp.

References sids.

vtkUnstructuredGrid * AdaptiveTetrahedralMesh::GetVtkUnstructuredGrid ( )

Return a pointer to mpVtkUnstructuredGrid

Definition at line 249 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::AdaptMesh().

void AdaptiveTetrahedralMesh::MakeVerbose ( bool  verbose = true)

Switch to verbose mode

Parameters:
verboseBool to specify whether we are switching verbose mode on (true - default) or off (false)

Definition at line 415 of file AdaptiveTetrahedralMesh.cpp.

References mVerbose.

void AdaptiveTetrahedralMesh::RemoveArray ( std::string  dataName)

Remove vtkPointData from the mpVtkUnstructuredGrid

Parameters:
dataNameName of the data to be removed

Definition at line 204 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptMesh().

void AdaptiveTetrahedralMesh::Reset ( )

Delete mpDiscreteGeoemtryConstraints, mpErrorMetric and mpAdapt (these need to be created from scratch for each adapt) and clear the entries in SENList, sids and max_len

Definition at line 400 of file AdaptiveTetrahedralMesh.cpp.

References mpAdapt, mpDiscreteGeometryConstraints, and mpErrorMeasure.

Referenced by Adapt(), and ~AdaptiveTetrahedralMesh().

void AdaptiveTetrahedralMesh::SetAdaptCriterion ( double  range,
double  criterion 
)

Set the values of mGoodEdgeRange and mBadEdgeCriterion to be used in determining whether an adapt is necessary or if the current mesh is of sufficient quality

Parameters:
rangeValue of mGoodEdgeRange to be used
criterionValue of mBadEdgeCriterion to be used

Definition at line 254 of file AdaptiveTetrahedralMesh.cpp.

References mBadEdgeCriterion, and mGoodEdgeRange.

void AdaptiveTetrahedralMesh::WriteMeshToDistributedFile ( std::string  directory,
std::string  fileName 
)

Write out mpVtkUnstructured grid in .pvtu format

Parameters:
directoryDirectory to write the file in
fileNameFile name

Definition at line 226 of file AdaptiveTetrahedralMesh.cpp.

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

void AdaptiveTetrahedralMesh::WriteMeshToFile ( std::string  directory,
std::string  fileName 
)

Write out mpVtkUnstructured grid in .vtu format

Parameters:
directoryDirectory to write the file in
fileNameFile name

Definition at line 209 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::Solve().


Member Data Documentation

Record whether an adapt has succeeded (i.e. whether or not the adaptivity library has run without returning an error)

Definition at line 91 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and GetAdaptSuccess().

std::vector<double> AdaptiveTetrahedralMesh::max_len [private]

Adaptivity library requirement

Definition at line 105 of file AdaptiveTetrahedralMesh.hpp.

Referenced by CalculateErrorMetric(), and GetGeometryConstraints().

Proportion of edges that must be deemed "bad" (i.e. not good) before an adapt takes place

Definition at line 114 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and SetAdaptCriterion().

Determine whether or not an edge of the mesh is of sufficient quality. Edge is "good" if the error metric associated with it is in the range [ 1 - mGoodEdgeRange , 1 + mGoodEdgeRange ]

Definition at line 111 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and SetAdaptCriterion().

Number of nodes privately owned by this process (i.e. excluding halos)

Definition at line 88 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), ConstructFromDistributedMesh(), ConstructFromMesh(), ConstructFromVtuFile(), and GetNumLocalNodes().

Adaptivity* AdaptiveTetrahedralMesh::mpAdapt [private]

Adaptivity object from adaptivity library: controls the mesh adaption

Definition at line 98 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and Reset().

DiscreteGeometryConstraints* AdaptiveTetrahedralMesh::mpDiscreteGeometryConstraints [private]

DiscreteGeoemtryConstraints object from adaptivity library: identifies co-planar surface elements

Definition at line 94 of file AdaptiveTetrahedralMesh.hpp.

Referenced by GetGeometryConstraints(), and Reset().

ErrorMeasure* AdaptiveTetrahedralMesh::mpErrorMeasure [private]

ErrorMeasure object from adaptivity library: calculates the metric field

Definition at line 96 of file AdaptiveTetrahedralMesh.hpp.

Referenced by CalculateErrorMetric(), and Reset().

Whether or not Adaptivity library should be in verbose mode (default = false)

Definition at line 117 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), CalculateErrorMetric(), CalculateSENListAndSids(), GetGeometryConstraints(), and MakeVerbose().

std::vector<int> AdaptiveTetrahedralMesh::SENList [private]

Adaptivity library requirement

Definition at line 101 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), CalculateSENListAndSids(), and GetGeometryConstraints().

std::vector<int> AdaptiveTetrahedralMesh::sids [private]

Adaptivity library requirement

Definition at line 103 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), CalculateSENListAndSids(), GetGeometryConstraints(), and GetNumSurfaceElements().


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