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>
49#include <boost/foreach.hpp>
51#include "AbstractMesh.hpp"
52#include "BoundaryElement.hpp"
54#include "GenericMeshReader.hpp"
55#include "AbstractMeshReader.hpp"
56#include "TrianglesMeshReader.hpp"
57#include "TrianglesMeshWriter.hpp"
58#include "ArchiveLocationInfo.hpp"
59#include "FileFinder.hpp"
63template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
70template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
74 friend class CentroidWriter;
117 template<
class Archive>
118 void save(Archive & archive,
const unsigned int version)
const
120 archive & boost::serialization::base_object<AbstractMesh<ELEMENT_DIM,SPACE_DIM> >(*this);
131 archive & permutation_available;
133 if (permutation_available)
136 archive & rPermutation;
146 unsigned& order_of_boundary_element = order_of_element;
150 std::shared_ptr<AbstractMeshReader<ELEMENT_DIM, SPACE_DIM> > p_original_mesh_reader
151 = GenericMeshReader<ELEMENT_DIM, SPACE_DIM>(original_file, order_of_element, order_of_boundary_element);
153 if (p_original_mesh_reader->IsFileFormatBinary())
161 std::vector<FileFinder> mesh_files = mesh_folder.
FindMatches(mesh_leaf_name +
".*");
163 BOOST_FOREACH(
const FileFinder& r_mesh_file, mesh_files)
189 template<
class Archive>
190 void load(Archive & archive,
const unsigned int version)
192 archive & boost::serialization::base_object<AbstractMesh<ELEMENT_DIM,SPACE_DIM> >(*this);
195 bool permutation_available=
false;
196 std::vector<unsigned> permutation;
200 archive & permutation_available;
202 if (permutation_available)
204 archive & permutation;
227 p_our_factory =
nullptr;
235 if (permutation_available)
272 BOOST_SERIALIZATION_SPLIT_MEMBER()
437 double& rJacobianDeterminant,
438 c_matrix<
double, ELEMENT_DIM, SPACE_DIM>& rInverseJacobian) const;
449 c_vector<
double, SPACE_DIM>& rWeightedDirection,
450 double& rJacobianDeterminant) const;
503 virtual
void ConstructCuboid(
unsigned width,
unsigned height,
unsigned depth);
587 std::vector<std::vector<
unsigned> >& rNodesToReceivePerProcess);
615 std::set<
unsigned> testElements=std::set<
unsigned>(),
616 bool onlyTryWithTestElements = false);
624 std::set<
unsigned> testElements);
660 inline ElementIterator& operator++();
674 bool skipDeletedElements=
true);
681 typename std::vector<Element<ELEMENT_DIM, SPACE_DIM> *>::iterator
mElementIter;
690 inline bool IsAtEnd();
696 inline bool IsAllowedElement();
703namespace serialization {
710template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
724template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
726 bool skipDeletedElements)
731template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
737template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
744template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
748 return *mElementIter;
751template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
757template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
764 while (!IsAtEnd() && !IsAllowedElement());
769template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
773 bool skipDeletedElements)
775 mElementIter(elementIter),
776 mSkipDeletedElements(skipDeletedElements)
793template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
796 return mElementIter == mrMesh.mElements.end();
799template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
802 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::string GetExtension() const
std::vector< FileFinder > FindMatches(const std::string &rPattern) const
FileFinder GetParent() const
FileFinder CopyTo(const FileFinder &rDest) 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.