Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <ImmersedBoundaryMeshWriter.hpp>

+ Inheritance diagram for ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 ImmersedBoundaryMeshWriter (const std::string &rDirectory, const std::string &rBaseName, bool clearOutputDir=true)
 
 ~ImmersedBoundaryMeshWriter ()
 
void WriteFilesUsingMesh (ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
 
void WriteVtkUsingMesh (ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, std::string stamp="")
 
void MakeVtkMesh (ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
 
void AddCellData (std::string dataName, std::vector< double > dataPayload)
 
void AddPointData (std::string dataName, std::vector< double > dataPayload)
 
std::vector< doubleGetNextNode ()
 
ImmersedBoundaryElementData GetNextImmersedBoundaryElement ()
 
ImmersedBoundaryElementData GetNextImmersedBoundaryLamina ()
 
void WriteFiles ()
 
void FindElementOverlaps (ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
 
const std::vector< std::vector< unsigned > > & rGetElementParts () const
 
void MakeVtkMesh (ImmersedBoundaryMesh< 1, 1 > &rMesh)
 
- Public Member Functions inherited from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >
 AbstractMeshWriter (const std::string &rDirectory, const std::string &rBaseName, const bool clearOutputDir=true)
 
virtual ~AbstractMeshWriter ()
 
std::string GetOutputDirectory ()
 
virtual unsigned GetNumNodes ()
 
unsigned GetNumElements ()
 
unsigned GetNumBoundaryFaces ()
 
unsigned GetNumCableElements ()
 
virtual ElementData GetNextElement ()
 
virtual ElementData GetNextBoundaryElement ()
 
virtual ElementData GetNextCableElement ()
 
void WriteFilesUsingMeshReader (AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
 

Private Types

using geom_point = boost::geometry::model::point< double, 2, boost::geometry::cs::cartesian >
 
using geom_segment = boost::geometry::model::segment< geom_point >
 

Private Member Functions

c_vector< double, SPACE_DIM > GetIntersectionOfEdgeWithBoundary (const c_vector< double, SPACE_DIM > &rStart, const c_vector< double, SPACE_DIM > &rEnd)
 
c_vector< double, SPACE_DIM > GetNearestCorner (const c_vector< double, SPACE_DIM > &rA, const c_vector< double, SPACE_DIM > &rB) const
 

Private Attributes

ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
 
MeshWriterIterators< ELEMENT_DIM, SPACE_DIM > * mpIters
 
unsigned mNumLaminas
 
std::vector< std::vector< unsigned > > mElementParts
 
std::array< geom_segment, 4 > mBoundaryEdges
 
vtkUnstructuredGrid * mpVtkUnstructedMesh
 

Additional Inherited Members

- Protected Attributes inherited from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >
OutputFileHandlermpOutputFileHandler
 
std::string mBaseName
 
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpMeshReader
 
unsigned mNumNodes
 
unsigned mNumElements
 
unsigned mNumBoundaryElements
 
unsigned mNumCableElements
 

Detailed Description

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

A mesh writer class for immersed boundary meshes.

Definition at line 76 of file ImmersedBoundaryMeshWriter.hpp.

Member Typedef Documentation

◆ geom_point

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
using ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::geom_point = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
private

Shorthand for a 2d cartesian point

Definition at line 96 of file ImmersedBoundaryMeshWriter.hpp.

◆ geom_segment

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
using ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::geom_segment = boost::geometry::model::segment<geom_point>
private

Shorthand for a segment of geom_points

Definition at line 99 of file ImmersedBoundaryMeshWriter.hpp.

Constructor & Destructor Documentation

◆ ImmersedBoundaryMeshWriter()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::ImmersedBoundaryMeshWriter ( const std::string &  rDirectory,
const std::string &  rBaseName,
bool  clearOutputDir = true 
)

Constructor.

Parameters
rDirectoryreference to the output directory, relative to where Chaste output is stored
rBaseNamereference to the base name for results files
clearOutputDirwhether to clear the output directory prior to writing files (defaults to true)

Definition at line 62 of file ImmersedBoundaryMeshWriter.cpp.

References ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBoundaryEdges, ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpIters, ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh, and NEVER_REACHED.

◆ ~ImmersedBoundaryMeshWriter()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::~ImmersedBoundaryMeshWriter ( )

Destructor.

Definition at line 101 of file ImmersedBoundaryMeshWriter.cpp.

Member Function Documentation

◆ AddCellData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddCellData ( std::string  dataName,
std::vector< double dataPayload 
)

Add data to a future VTK file.

Parameters
dataNamea tag to go into the VTK file
dataPayloada pay-load of length (number of elements)

Definition at line 482 of file ImmersedBoundaryMeshWriter.cpp.

Referenced by ImmersedBoundaryCellPopulation< DIM >::WriteVtkResultsToFile().

◆ AddPointData()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::AddPointData ( std::string  dataName,
std::vector< double dataPayload 
)

Add data to a future VTK file.

Parameters
dataNamea tag to go into the VTK file
dataPayloada pay-load of length (number of nodes)

Definition at line 499 of file ImmersedBoundaryMeshWriter.cpp.

Referenced by ImmersedBoundaryCellPopulation< DIM >::WriteVtkResultsToFile().

◆ FindElementOverlaps()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::FindElementOverlaps ( ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh)

Analyses the mesh to determine where (if at all) each element overlaps due to the periodic boundaries.

Parameters
rMeshthe immersed boundary mesh

Definition at line 733 of file ImmersedBoundaryMeshWriter.cpp.

References ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetNumAllElements(), and NEVER_REACHED.

Referenced by ImmersedBoundaryCellPopulation< DIM >::WriteVtkResultsToFile().

◆ GetIntersectionOfEdgeWithBoundary()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector< double, SPACE_DIM > ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetIntersectionOfEdgeWithBoundary ( const c_vector< double, SPACE_DIM > &  rStart,
const c_vector< double, SPACE_DIM > &  rEnd 
)
private

When elements cross the periodic boundary they are broken up into pieces for visualisation. Some additional points are needed where the element edge crosses the boundary to produce good output polygons.

This function returns the location on the boundary where an edge (given by rStart and rEnd) crosses d[0,1]x[0,1].

Parameters
rStartthe start point of the edge that crosses the boundary
rEndthe end point of the edge that crosses the boundary
Returns
the point at which the edge rStart->rEnd crosses d[0,1]x[0,1]

Definition at line 768 of file ImmersedBoundaryMeshWriter.cpp.

References NEVER_REACHED.

◆ GetNearestCorner()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
c_vector< double, SPACE_DIM > ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNearestCorner ( const c_vector< double, SPACE_DIM > &  rA,
const c_vector< double, SPACE_DIM > &  rB 
) const
private

Helper function to get the nearest corner to the average of two points on the boundary.

Parameters
rAone of the boundary points
rBthe other boundary point
Returns
the coordinates of the nearest corner of [0,1]x[0,1]

Definition at line 800 of file ImmersedBoundaryMeshWriter.cpp.

◆ GetNextImmersedBoundaryElement()

◆ GetNextImmersedBoundaryLamina()

◆ GetNextNode()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector< double > ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextNode ( )
virtual
Returns
the coordinates of the next node to be written to file

Reimplemented from AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >.

Definition at line 119 of file ImmersedBoundaryMeshWriter.cpp.

References AbstractMeshWriter< ELEMENT_DIM, SPACE_DIM >::GetNextNode().

◆ MakeVtkMesh() [1/2]

void ImmersedBoundaryMeshWriter< 1, 1 >::MakeVtkMesh ( ImmersedBoundaryMesh< 1, 1 > &  rMesh)

Template instnantiation for unused code path

Parameters
rMeshthe mesh

Definition at line 476 of file ImmersedBoundaryMeshWriter.cpp.

◆ MakeVtkMesh() [2/2]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::MakeVtkMesh ( ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh)

Populate mpVtkUnstructedMesh using a vertex-based mesh. Called by WriteVtkUsingMesh().

Parameters
rMeshreference to the vertex-based mesh

To allow viewing in Paraview, we have to treat differently cells which overlap the boundaries, as there is no support for periodicity in Paraview.

We overcome this by first identifying which cells overlap, and breaking them in to pieces as necessary, so that each cell when displayed stays contiguous.

Cell overlaps should have already been calculated - this is done by a call to FindElementOverlaps() from ImmersedBoundaryCellPopulation::WriteVtkResultsToFile().

Because no node can be present in more than one cell, it is safe to add points to mpVtkUnstructuredMesh as we go through each cell, rather than having to add nodes before cells.

Definition at line 282 of file ImmersedBoundaryMeshWriter.cpp.

References ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorBegin(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetElementIteratorEnd(), Node< SPACE_DIM >::GetIndex(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetLaminaIteratorBegin(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetLaminaIteratorEnd(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetVectorFromAtoB(), NEVER_REACHED, and Node< SPACE_DIM >::rGetLocation().

◆ rGetElementParts()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
const std::vector< std::vector< unsigned > > & ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::rGetElementParts ( ) const
Returns
reference to mElementParts

Definition at line 811 of file ImmersedBoundaryMeshWriter.cpp.

Referenced by ImmersedBoundaryCellPopulation< DIM >::WriteVtkResultsToFile().

◆ WriteFiles()

◆ WriteFilesUsingMesh()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh ( ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh)

Write files using a mesh.

Parameters
rMeshreference to the vertex-based mesh

Definition at line 516 of file ImmersedBoundaryMeshWriter.cpp.

References ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes().

Referenced by ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::save().

◆ WriteVtkUsingMesh()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteVtkUsingMesh ( ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &  rMesh,
std::string  stamp = "" 
)

Write VTK file using a mesh.

Parameters
rMeshreference to the immersed boundary mesh
stampis an optional stamp (like a time-stamp) to put into the name of the file

Definition at line 243 of file ImmersedBoundaryMeshWriter.cpp.

References NEVER_REACHED.

Referenced by ImmersedBoundaryCellPopulation< DIM >::WriteVtkResultsToFile().

Member Data Documentation

◆ mBoundaryEdges

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::array<geom_segment, 4> ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mBoundaryEdges
private

Array of geom_segments; a helper array, filled by the constructor, for GetIntersectionOfEdgeWithBoundary

Definition at line 102 of file ImmersedBoundaryMeshWriter.hpp.

Referenced by ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::ImmersedBoundaryMeshWriter().

◆ mElementParts

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<std::vector<unsigned> > ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mElementParts
private

Vector containing, for each element, the node indices at which it must be split for visualisation

Definition at line 92 of file ImmersedBoundaryMeshWriter.hpp.

◆ mNumLaminas

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mNumLaminas
private

The number of laminas in the mesh

Definition at line 89 of file ImmersedBoundaryMeshWriter.hpp.

◆ mpIters

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
MeshWriterIterators<ELEMENT_DIM,SPACE_DIM>* ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpIters
private

◆ mpMesh

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
ImmersedBoundaryMesh<ELEMENT_DIM,SPACE_DIM>* ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpMesh
private

If writing from a mesh object, the mesh to write to disk. Otherwise NULL.

Definition at line 83 of file ImmersedBoundaryMeshWriter.hpp.

◆ mpVtkUnstructedMesh

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
vtkUnstructuredGrid* ImmersedBoundaryMeshWriter< ELEMENT_DIM, SPACE_DIM >::mpVtkUnstructedMesh
private

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