36#ifndef IMMERSEDBOUNDARYMESH_HPP_
37#define IMMERSEDBOUNDARYMESH_HPP_
40template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
46#include <boost/polygon/voronoi.hpp>
47#include <boost/serialization/base_object.hpp>
48#include <boost/serialization/split_member.hpp>
49#include <boost/serialization/vector.hpp>
51#include "AbstractMesh.hpp"
52#include "ArchiveLocationInfo.hpp"
54#include "FluidSource.hpp"
55#include "ImmersedBoundaryArray.hpp"
56#include "ImmersedBoundaryElement.hpp"
57#include "ImmersedBoundaryMeshReader.hpp"
58#include "ImmersedBoundaryMeshWriter.hpp"
68template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
71 friend class TestImmersedBoundaryMesh;
116 std::vector<ImmersedBoundaryElement<ELEMENT_DIM, SPACE_DIM>*>
mElements;
190 c_vector<double, SPACE_DIM> centroid,
191 c_vector<double, SPACE_DIM> axisOfDivision);
203 template <
class Archive>
204 void save(Archive& archive,
const unsigned int version)
const
206 archive& boost::serialization::base_object<AbstractMesh<ELEMENT_DIM, SPACE_DIM> >(*this);
221 template <
class Archive>
222 void load(Archive& archive,
const unsigned int version)
224 archive& boost::serialization::base_object<AbstractMesh<ELEMENT_DIM, SPACE_DIM> >(*this);
229 BOOST_SERIALIZATION_SPLIT_MEMBER()
233 class ImmersedBoundaryElementIterator;
236 class ImmersedBoundaryLaminaIterator;
279 unsigned numGridPtsX = 128u,
280 unsigned numGridPtsY = 128u);
357 c_vector<double, SPACE_DIM>
GetVectorFromAtoB(
const c_vector<double, SPACE_DIM>& rLocation1,
const c_vector<double, SPACE_DIM>& rLocation2);
477 virtual void Clear();
641 c_vector<double, SPACE_DIM> axisOfDivision,
642 bool placeOriginalElementBelow =
false);
653 bool placeOriginalElementBelow =
false);
696 void ReMesh(
bool randomOrder=
false);
820 bool skipDeletedElements =
true);
827 typename std::vector<ImmersedBoundaryElement<ELEMENT_DIM, SPACE_DIM>*>::iterator
mElementIter;
889 bool skipDeletedLaminas =
true);
922template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
924 bool skipDeletedElements)
929template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
935template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
942template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
946 return *mElementIter;
949template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
955template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
961 }
while (!IsAtEnd() && !IsAllowedElement());
966template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
970 bool skipDeletedElements)
972 mElementIter(elementIter),
973 mSkipDeletedElements(skipDeletedElements)
990template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
993 return mElementIter == mrMesh.mElements.end();
996template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
999 return !(mSkipDeletedElements && (*this)->IsDeleted());
1006template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1008 bool skipDeletedLaminas)
1013template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1019template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1023 return **mLaminaIter;
1026template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1030 return *mLaminaIter;
1033template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1039template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1045 }
while (!IsAtEnd() && !IsAllowedLamina());
1050template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1054 bool skipDeletedLaminas)
1056 mLaminaIter(laminaIter),
1057 mSkipDeletedLaminas(skipDeletedLaminas)
1074template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1077 return mLaminaIter == mrMesh.mLaminas.end();
1080template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1083 return !(mSkipDeletedLaminas && (*this)->IsDeleted());
gcov doesn't like this file...
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
static std::string GetMeshFilename()
static std::string GetArchiveDirectory()
static std::string GetArchiveRelativePath()
void WriteFilesUsingMesh(ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
std::vector< ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > * >::iterator mElementIter
ImmersedBoundaryElementIterator(ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, typename std::vector< ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > * >::iterator elementIter, bool skipDeletedElements=true)
ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > & operator*()
ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > * operator->()
bool mSkipDeletedElements
bool operator!=(const typename ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::ImmersedBoundaryElementIterator &rOther)
ImmersedBoundaryMesh & mrMesh
ImmersedBoundaryElementIterator & operator++()
bool operator!=(const typename ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM >::ImmersedBoundaryLaminaIterator &rOther)
ImmersedBoundaryElement< ELEMENT_DIM - 1, SPACE_DIM > & operator*()
ImmersedBoundaryLaminaIterator(ImmersedBoundaryMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, typename std::vector< ImmersedBoundaryElement< ELEMENT_DIM - 1, SPACE_DIM > * >::iterator laminaIter, bool skipDeletedLaminas=true)
ImmersedBoundaryLaminaIterator & operator++()
ImmersedBoundaryMesh & mrMesh
std::vector< ImmersedBoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * >::iterator mLaminaIter
ImmersedBoundaryElement< ELEMENT_DIM - 1, SPACE_DIM > * operator->()
ChasteCuboid< SPACE_DIM > CalculateBoundingBoxOfElement(unsigned index)
std::vector< ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > * > mElements
void ReMesh(bool randomOrder=false)
double mElementDivisionSpacing
double GetCellRearrangementThreshold()
virtual double GetVolumeOfElement(unsigned index)
double GetCharacteristicNodeSpacing() const
void SetNeighbourDist(double neighbourDist)
bool NodesInDifferentElementOrLamina(Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
unsigned DivideElement(ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > *pElement, unsigned nodeAIndex, unsigned nodeBIndex, c_vector< double, SPACE_DIM > centroid, c_vector< double, SPACE_DIM > axisOfDivision)
const std::vector< Node< SPACE_DIM > * > & rGetNodes() const
unsigned GetMaxNodeIndex() const
unsigned GetMaxElementIndex() const
std::vector< unsigned > mVoronoiCellIdsIndexedByNodeIndex
multi_array< double, 3 > & rGetModifiable2dVelocityGrids()
void save(Archive &archive, const unsigned int version) const
std::vector< unsigned > mDeletedNodeIndices
unsigned SolveElementMapping(unsigned index) const
ImmersedBoundaryElement< ELEMENT_DIM - 1, SPACE_DIM > * GetLamina(unsigned index) const
void load(Archive &archive, const unsigned int version)
double GetTortuosityOfMesh()
void ReMeshLamina(ImmersedBoundaryElement< ELEMENT_DIM - 1, SPACE_DIM > *pLamina, bool randomOrder)
void SetNode(unsigned nodeIndex, ChastePoint< SPACE_DIM > point)
ImmersedBoundaryElementIterator GetElementIteratorEnd()
ImmersedBoundaryLaminaIterator GetLaminaIteratorBegin(bool skipDeletedLaminas=true)
double GetSkewnessOfElementMassDistributionAboutAxis(unsigned elemIndex, c_vector< double, SPACE_DIM > axis)
double mSummaryOfNodeLocations
ImmersedBoundaryElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
multi_array< double, 4 > m3dVelocityGrids
double mCharacteristicNodeSpacing
static constexpr double mVoronoiHalo
void SetNumGridPtsXAndY(unsigned numGridPts)
double ScaleDistanceDownFromVoronoi(const double distance) const
void SetCharacteristicNodeSpacing(double nodeSpacing)
ImmersedBoundaryLaminaIterator GetLaminaIteratorEnd()
std::array< unsigned, 13 > GetPolygonDistribution()
double CalculateLengthOfVoronoiEdge(const boost::polygon::voronoi_diagram< double >::edge_type &rEdge)
double mCellRearrangementThreshold
void SetCellRearrangementThreshold(double cellRearrangementThreshold)
std::vector< std::shared_ptr< FluidSource< SPACE_DIM > > > mElementFluidSources
std::vector< std::shared_ptr< FluidSource< SPACE_DIM > > > & rGetElementFluidSources()
void TagBoundaryElements()
virtual unsigned GetNumNodes() const
std::vector< unsigned > mDeletedElementIndices
double GetElongationShapeFactorOfElement(unsigned elementIndex)
unsigned SolveNodeMapping(unsigned index) const
boost::polygon::voronoi_diagram< double > mNodeLocationsVoronoiDiagram
std::vector< std::shared_ptr< FluidSource< SPACE_DIM > > > mBalancingFluidSources
virtual ~ImmersedBoundaryMesh()
unsigned AddNode(Node< SPACE_DIM > *pNewNode)
double GetAverageNodeSpacingOfElement(unsigned index, bool recalculate=true)
virtual c_vector< double, 3 > CalculateMomentsOfElement(unsigned index)
unsigned GetNumGridPtsX() const
void ConformToGeometry(c_vector< double, SPACE_DIM > &rLocation)
double GetNeighbourDist() const
const boost::polygon::voronoi_diagram< double > & rGetNodeLocationsVoronoiDiagram(bool update=true)
void ReMeshElement(ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > *pElement, bool randomOrder)
multi_array< double, 3 > m2dVelocityGrids
std::set< unsigned > GetNeighbouringNodeIndices(unsigned nodeIndex)
unsigned DivideElementAlongGivenAxis(ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > *pElement, c_vector< double, SPACE_DIM > axisOfDivision, bool placeOriginalElementBelow=false)
virtual unsigned GetNumElements() const
friend class boost::serialization::access
void SetNumGridPtsX(unsigned meshPointsX)
std::vector< std::shared_ptr< FluidSource< SPACE_DIM > > > & rGetBalancingFluidSources()
double GetAverageNodeSpacingOfLamina(unsigned index, bool recalculate=true)
int ScaleUpToVoronoiCoordinate(double location) const
unsigned SolveBoundaryElementMapping(unsigned index) const
unsigned DivideElementAlongShortAxis(ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > *pElement, bool placeOriginalElementBelow=false)
unsigned GetNumGridPtsY() const
void UpdateNodeLocationsVoronoiDiagramIfOutOfDate()
unsigned GetMaxLaminaIndex() const
double GetElementDivisionSpacing()
virtual c_vector< double, SPACE_DIM > GetCentroidOfElement(unsigned index)
void SetElementDivisionSpacing(double elementDivisionSpacing)
c_vector< double, SPACE_DIM > GetShortAxisOfElement(unsigned index)
double GetSpacingRatio() const
std::set< unsigned > GetNeighbouringElementIndices(unsigned elemIdx)
const multi_array< double, 3 > & rGet2dVelocityGrids() const
std::vector< ImmersedBoundaryElement< ELEMENT_DIM - 1, SPACE_DIM > * > mLaminas
void ConstructFromMeshReader(AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)
ImmersedBoundaryElement< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
double GetVoronoiSurfaceAreaOfElement(unsigned elemIdx)
virtual double GetSurfaceAreaOfElement(unsigned index)
const std::vector< unsigned int > & GetVoronoiCellIdsIndexedByNodeIndex() const
unsigned GetNumLaminas() const
c_vector< double, SPACE_DIM > GetVectorFromAtoB(const c_vector< double, SPACE_DIM > &rLocation1, const c_vector< double, SPACE_DIM > &rLocation2)
void SetNumGridPtsY(unsigned meshPointsY)
unsigned GetNumAllElements() const