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;
113 std::vector<ImmersedBoundaryElement<ELEMENT_DIM, SPACE_DIM>*>
mElements;
187 c_vector<double, SPACE_DIM> centroid,
188 c_vector<double, SPACE_DIM> axisOfDivision);
200 template <
class Archive>
201 void save(Archive& archive,
const unsigned int version)
const
203 archive& boost::serialization::base_object<AbstractMesh<ELEMENT_DIM, SPACE_DIM> >(*this);
218 template <
class Archive>
219 void load(Archive& archive,
const unsigned int version)
221 archive& boost::serialization::base_object<AbstractMesh<ELEMENT_DIM, SPACE_DIM> >(*this);
226 BOOST_SERIALIZATION_SPLIT_MEMBER()
230 class ImmersedBoundaryElementIterator;
233 class ImmersedBoundaryLaminaIterator;
276 unsigned numGridPtsX = 128u,
277 unsigned numGridPtsY = 128u);
354 c_vector<double, SPACE_DIM>
GetVectorFromAtoB(
const c_vector<double, SPACE_DIM>& rLocation1,
const c_vector<double, SPACE_DIM>& rLocation2);
474 virtual void Clear();
637 c_vector<double, SPACE_DIM> axisOfDivision,
638 bool placeOriginalElementBelow =
false);
649 bool placeOriginalElementBelow =
false);
682 void ReMesh(
bool randomOrder=
false);
806 bool skipDeletedElements =
true);
813 typename std::vector<ImmersedBoundaryElement<ELEMENT_DIM, SPACE_DIM>*>::iterator
mElementIter;
875 bool skipDeletedLaminas =
true);
908template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
910 bool skipDeletedElements)
915template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
921template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
928template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
932 return *mElementIter;
935template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
941template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
947 }
while (!IsAtEnd() && !IsAllowedElement());
952template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
956 bool skipDeletedElements)
958 mElementIter(elementIter),
959 mSkipDeletedElements(skipDeletedElements)
976template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
979 return mElementIter == mrMesh.mElements.end();
982template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
985 return !(mSkipDeletedElements && (*this)->IsDeleted());
992template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
994 bool skipDeletedLaminas)
999template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1005template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1009 return **mLaminaIter;
1012template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1016 return *mLaminaIter;
1019template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1025template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1031 }
while (!IsAtEnd() && !IsAllowedLamina());
1036template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1040 bool skipDeletedLaminas)
1042 mLaminaIter(laminaIter),
1043 mSkipDeletedLaminas(skipDeletedLaminas)
1060template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1063 return mLaminaIter == mrMesh.mLaminas.end();
1066template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1069 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
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)
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