AdaptiveTetrahedralMesh Class Reference

#include <AdaptiveTetrahedralMesh.hpp>

Collaboration diagram for AdaptiveTetrahedralMesh:

Collaboration graph
[legend]

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< double > max_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 64 of file AdaptiveTetrahedralMesh.hpp.


Constructor & Destructor Documentation

AdaptiveTetrahedralMesh::AdaptiveTetrahedralMesh (  ) 

Constructor

Definition at line 43 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

AdaptiveTetrahedralMesh::~AdaptiveTetrahedralMesh (  ) 

Destructor

Definition at line 59 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid, and Reset().


Member Function Documentation

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

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

Parameters:
fileName File name and full path to the file

Definition at line 65 of file AdaptiveTetrahedralMesh.cpp.

References mNumElements, mNumLocalNodes, mNumNodes, and mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::Solve().

void AdaptiveTetrahedralMesh::ConstructFromMesh ( AbstractTetrahedralMesh< 3, 3 > *  rMesh  ) 

void AdaptiveTetrahedralMesh::ConstructFromDistributedMesh ( DistributedTetrahedralMesh< 3, 3 > *  rMesh  ) 

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:
dataName Name of the data to be stored
dataPayload std::vector containing the values at each point

Definition at line 169 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:
dataName Name of the data to be stored
dataPayload std::vector containing the values at each point

Definition at line 183 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

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

Remove vtkPointData from the mpVtkUnstructuredGrid

Parameters:
dataName Name of the data to be removed

Definition at line 197 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptMesh().

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

Write out mpVtkUnstructured grid in .vtu format

Parameters:
directory Directory to write the file in
fileName File name

Definition at line 202 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::Solve().

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

Write out mpVtkUnstructured grid in .pvtu format

Parameters:
directory Directory to write the file in
fileName File name

Definition at line 219 of file AdaptiveTetrahedralMesh.cpp.

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

vtkUnstructuredGrid * AdaptiveTetrahedralMesh::GetVtkUnstructuredGrid (  ) 

Return a pointer to mpVtkUnstructuredGrid

Definition at line 242 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

Referenced by AdaptiveBidomainProblem::AdaptMesh().

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:
range Value of mGoodEdgeRange to be used
criterion Value of mBadEdgeCriterion to be used

Definition at line 247 of file AdaptiveTetrahedralMesh.cpp.

References mBadEdgeCriterion, and mGoodEdgeRange.

unsigned AdaptiveTetrahedralMesh::GetNumNodes (  ) 

Return the number of nodes in the mesh

Definition at line 253 of file AdaptiveTetrahedralMesh.cpp.

References mNumNodes.

Referenced by AdaptiveBidomainProblem::AdaptMesh().

unsigned AdaptiveTetrahedralMesh::GetNumLocalNodes (  ) 

Return the number of locally owned nodes, excluding halos

Definition at line 258 of file AdaptiveTetrahedralMesh.cpp.

References mNumLocalNodes.

unsigned AdaptiveTetrahedralMesh::GetNumLocalAndHaloNodes (  ) 

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

Definition at line 263 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

unsigned AdaptiveTetrahedralMesh::GetNumElements (  ) 

Return the number of elements in the mesh

Definition at line 268 of file AdaptiveTetrahedralMesh.cpp.

References mNumElements.

unsigned AdaptiveTetrahedralMesh::GetNumLocalElements (  ) 

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

Definition at line 273 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

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 278 of file AdaptiveTetrahedralMesh.cpp.

References sids.

void AdaptiveTetrahedralMesh::CalculateSENListAndSids ( double  coplanarTolerance = 0.9999999  ) 

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

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

Definition at line 283 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid, mVerbose, SENList, and sids.

Referenced by AdaptiveBidomainProblem::Solve().

double AdaptiveTetrahedralMesh::GetEdgeLengthDistribution ( double  range  ) 

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

Parameters:
range The size of the interval that we are interested in

Definition at line 330 of file AdaptiveTetrahedralMesh.cpp.

References mpVtkUnstructuredGrid.

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 381 of file AdaptiveTetrahedralMesh.cpp.

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

Referenced by AdaptiveBidomainProblem::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 393 of file AdaptiveTetrahedralMesh.cpp.

References mpAdapt, mpDiscreteGeometryConstraints, and mpErrorMeasure.

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

bool AdaptiveTetrahedralMesh::GetAdaptSuccess (  ) 

Return mAdaptSuccess

Definition at line 403 of file AdaptiveTetrahedralMesh.cpp.

References mAdaptSuccess.

Referenced by AdaptiveBidomainProblem::AdaptMesh().

void AdaptiveTetrahedralMesh::MakeVerbose ( bool  verbose = true  ) 

Switch to verbose mode

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

Definition at line 408 of file AdaptiveTetrahedralMesh.cpp.

References mVerbose.

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 296 of file AdaptiveTetrahedralMesh.cpp.

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

Referenced by AdaptMesh().

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 307 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::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 338 of file AdaptiveTetrahedralMesh.cpp.

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

Referenced by AdaptMesh().


Member Data Documentation

vtkUnstructuredGrid* AdaptiveTetrahedralMesh::mpVtkUnstructuredGrid [private]

Number of nodes in the mesh

Definition at line 75 of file AdaptiveTetrahedralMesh.hpp.

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

Number of elements in the mesh

Definition at line 78 of file AdaptiveTetrahedralMesh.hpp.

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

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

Definition at line 81 of file AdaptiveTetrahedralMesh.hpp.

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

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

Definition at line 84 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and GetAdaptSuccess().

DiscreteGeometryConstraints* AdaptiveTetrahedralMesh::mpDiscreteGeometryConstraints [private]

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

Definition at line 87 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 89 of file AdaptiveTetrahedralMesh.hpp.

Referenced by CalculateErrorMetric(), and Reset().

Adaptivity* AdaptiveTetrahedralMesh::mpAdapt [private]

Adaptivity object from adaptivity library: controls the mesh adaption

Definition at line 91 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and Reset().

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

Adaptivity library requirement

Definition at line 94 of file AdaptiveTetrahedralMesh.hpp.

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

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

Adaptivity library requirement

Definition at line 96 of file AdaptiveTetrahedralMesh.hpp.

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

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

Adaptivity library requirement

Definition at line 98 of file AdaptiveTetrahedralMesh.hpp.

Referenced by CalculateErrorMetric(), and GetGeometryConstraints().

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 104 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and SetAdaptCriterion().

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

Definition at line 107 of file AdaptiveTetrahedralMesh.hpp.

Referenced by Adapt(), and SetAdaptCriterion().

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

Definition at line 110 of file AdaptiveTetrahedralMesh.hpp.

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


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

Generated on Tue May 31 14:32:35 2011 for Chaste by  doxygen 1.5.5