36#ifndef ABSTRACTTETRAHEDRALMESH_HPP_
37#define ABSTRACTTETRAHEDRALMESH_HPP_
42#include <boost/serialization/vector.hpp>
43#include <boost/serialization/base_object.hpp>
44#include <boost/serialization/split_member.hpp>
50#include "AbstractMesh.hpp"
51#include "BoundaryElement.hpp"
53#include "GenericMeshReader.hpp"
54#include "AbstractMeshReader.hpp"
55#include "TrianglesMeshReader.hpp"
56#include "TrianglesMeshWriter.hpp"
57#include "ArchiveLocationInfo.hpp"
58#include "FileFinder.hpp"
62template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
69template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
73 friend class CentroidWriter;
116 template<
class Archive>
117 void save(Archive & archive,
const unsigned int version)
const
119 archive & boost::serialization::base_object<AbstractMesh<ELEMENT_DIM,SPACE_DIM> >(*this);
130 archive & permutation_available;
132 if (permutation_available)
135 archive & rPermutation;
145 unsigned& order_of_boundary_element = order_of_element;
149 std::shared_ptr<AbstractMeshReader<ELEMENT_DIM, SPACE_DIM> > p_original_mesh_reader
150 = GenericMeshReader<ELEMENT_DIM, SPACE_DIM>(original_file, order_of_element, order_of_boundary_element);
152 if (p_original_mesh_reader->IsFileFormatBinary())
160 std::vector<FileFinder> mesh_files = mesh_folder.
FindMatches(mesh_leaf_name +
".*");
162 for (
const FileFinder& r_mesh_file : mesh_files)
188 template<
class Archive>
189 void load(Archive & archive,
const unsigned int version)
191 archive & boost::serialization::base_object<AbstractMesh<ELEMENT_DIM,SPACE_DIM> >(*this);
194 bool permutation_available=
false;
195 std::vector<unsigned> permutation;
199 archive & permutation_available;
201 if (permutation_available)
203 archive & permutation;
226 p_our_factory =
nullptr;
234 if (permutation_available)
271 BOOST_SERIALIZATION_SPLIT_MEMBER()
436 double& rJacobianDeterminant,
437 c_matrix<
double, ELEMENT_DIM, SPACE_DIM>& rInverseJacobian) const;
448 c_vector<
double, SPACE_DIM>& rWeightedDirection,
449 double& rJacobianDeterminant) const;
502 virtual
void ConstructCuboid(
unsigned width,
unsigned height,
unsigned depth);
586 std::vector<std::vector<
unsigned> >& rNodesToReceivePerProcess);
614 std::set<
unsigned> testElements=std::set<
unsigned>(),
615 bool onlyTryWithTestElements = false);
623 std::set<
unsigned> testElements);
659 inline ElementIterator& operator++();
673 bool skipDeletedElements=
true);
680 typename std::vector<Element<ELEMENT_DIM, SPACE_DIM> *>::iterator
mElementIter;
689 inline bool IsAtEnd();
695 inline bool IsAllowedElement();
702namespace serialization {
709template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
723template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
725 bool skipDeletedElements)
730template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
736template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
743template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
747 return *mElementIter;
750template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
756template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
763 while (!IsAtEnd() && !IsAllowedElement());
768template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
772 bool skipDeletedElements)
774 mElementIter(elementIter),
775 mSkipDeletedElements(skipDeletedElements)
792template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
795 return mElementIter == mrMesh.mElements.end();
798template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
801 return !(mSkipDeletedElements && (*this)->IsDeleted());
gcov doesn't like this file...
#define TEMPLATED_CLASS_IS_ABSTRACT_2_UNSIGNED(T)
#define ABORT_IF_THROWS(block)
Forward declaration which is going to be used for friendship.
bool mMeshChangesDuringSimulation
virtual void SetDistributedVectorFactory(DistributedVectorFactory *pFactory)
std::string GetMeshFileBaseName() const
bool IsMeshOnDisk() const
const std::vector< unsigned > & rGetNodePermutation() const
DistributedVectorFactory * mpDistributedVectorFactory
virtual void WriteFilesUsingMesh(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, bool keepOriginalElementIndexing=true)
void WriteFilesUsingMeshReaderAndMesh(AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
Element< ELEMENT_DIM, SPACE_DIM > & operator*()
bool mSkipDeletedElements
ElementIterator & operator++()
AbstractTetrahedralMesh & mrMesh
std::vector< Element< ELEMENT_DIM, SPACE_DIM > * >::iterator mElementIter
Element< ELEMENT_DIM, SPACE_DIM > * operator->()
ElementIterator(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rMesh, typename std::vector< Element< ELEMENT_DIM, SPACE_DIM > * >::iterator elementIter, bool skipDeletedElements=true)
bool operator!=(const typename AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::ElementIterator &rOther)
void load(Archive &archive, const unsigned int version)
void ConstructRegularSlabMesh(double spaceStep, double width, double height=0, double depth=0)
virtual unsigned SolveBoundaryElementMapping(unsigned index) const =0
virtual unsigned GetNumLocalBoundaryElements() const
virtual bool CalculateDesignatedOwnershipOfElement(unsigned elementIndex)
void CalculateNodeExchange(std::vector< std::vector< unsigned > > &rNodesToSendPerProcess, std::vector< std::vector< unsigned > > &rNodesToReceivePerProcess)
unsigned GetContainingElementIndex(const ChastePoint< SPACE_DIM > &rTestPoint, bool strict=false, std::set< unsigned > testElements=std::set< unsigned >(), bool onlyTryWithTestElements=false)
virtual void ConstructFromMeshReader(AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > &rMeshReader)=0
virtual void GetWeightedDirectionForBoundaryElement(unsigned elementIndex, c_vector< double, SPACE_DIM > &rWeightedDirection, double &rJacobianDeterminant) const
virtual unsigned GetNumBoundaryElements() const
virtual unsigned SolveElementMapping(unsigned index) const =0
virtual void GetInverseJacobianForElement(unsigned elementIndex, c_matrix< double, SPACE_DIM, ELEMENT_DIM > &rJacobian, double &rJacobianDeterminant, c_matrix< double, ELEMENT_DIM, SPACE_DIM > &rInverseJacobian) const
virtual bool CalculateDesignatedOwnershipOfBoundaryElement(unsigned faceIndex)
void ConstructFromMesh(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > &rOtherMesh)
unsigned GetNumAllBoundaryElements() const
virtual unsigned GetMaximumNodeIndex()
virtual unsigned GetNumVertices() const
ElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
void ConstructRegularSlabMeshWithDimensionSplit(unsigned dimension, double spaceStep, double width, double height=0, double depth=0)
virtual void GetHaloNodeIndices(std::vector< unsigned > &rHaloIndices) const
std::vector< BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * >::const_iterator BoundaryElementIterator
virtual unsigned GetNumLocalElements() const
void SetElementOwnerships()
ElementIterator GetElementIteratorEnd()
unsigned GetNearestElementIndexFromTestElements(const ChastePoint< SPACE_DIM > &rTestPoint, std::set< unsigned > testElements)
Element< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
unsigned CalculateMaximumNodeConnectivityPerProcess() const
virtual c_vector< double, 2 > CalculateMinMaxEdgeLengths()
std::vector< Element< ELEMENT_DIM, SPACE_DIM > * > mElements
void save(Archive &archive, const unsigned int version) const
virtual void ConstructRectangularMesh(unsigned width, unsigned height, bool stagger=true)
BoundaryElementIterator GetBoundaryElementIteratorBegin() const
BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * GetBoundaryElement(unsigned index) const
friend class boost::serialization::access
virtual unsigned GetNumCableElements() const
void CheckOutwardNormals()
virtual void ConstructCuboid(unsigned width, unsigned height, unsigned depth)
virtual unsigned GetNumElements() const
unsigned GetNumAllElements() const
virtual void ConstructLinearMesh(unsigned width)
BoundaryElementIterator GetBoundaryElementIteratorEnd() const
std::vector< BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > * > mBoundaryElements
static std::string GetMeshFilename()
static std::string GetArchiveDirectory()
static std::string GetArchiveRelativePath()
DistributedVectorFactory * GetOriginalFactory()
void SetFromFactory(DistributedVectorFactory *pFactory)
unsigned GetNumProcs() const
std::string GetLeafNameNoExtension() const
std::vector< FileFinder > FindMatches(const std::string &rPattern) const
FileFinder GetParent() const
void SetNodePermutation(std::vector< unsigned > &rPermutationVector)
void SetWriteFilesAsBinary()
CHASTE_VERSION_CONTENT(1)
Macro to set the version number of templated archive in known versions of Boost.