37 #ifndef _ABSTRACTMESHREADER_HPP_ 38 #define _ABSTRACTMESHREADER_HPP_ 44 #include <boost/iterator/iterator_facade.hpp> 75 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
85 virtual unsigned GetNumElements()
const =0;
88 virtual unsigned GetNumNodes()
const =0;
91 virtual unsigned GetNumFaces()
const =0;
94 virtual unsigned GetNumCableElements()
const;
97 virtual unsigned GetNumElementAttributes()
const;
100 virtual unsigned GetNumFaceAttributes()
const;
103 virtual unsigned GetNumCableElementAttributes()
const;
112 virtual std::vector<double> GetNodeAttributes();
115 unsigned GetNumEdges()
const;
118 virtual std::vector<double> GetNextNode()=0;
121 virtual void Reset()=0;
142 virtual std::vector<double> GetNode(
unsigned index);
150 virtual ElementData GetElementData(
unsigned index);
175 virtual std::vector<unsigned> GetContainingElementIndices(
unsigned index);
180 virtual std::string GetMeshFileBaseName();
185 virtual unsigned GetOrderOfElements();
190 virtual unsigned GetOrderOfBoundaryElements();
195 virtual bool GetReadContainingElementOfBoundaryElement();
204 virtual bool IsFileFormatBinary();
212 virtual bool HasNclFile();
220 virtual bool HasNodePermutation();
228 virtual const std::vector<unsigned>& rGetNodePermutation();
236 class ElementIterator :
public boost::iterator_facade<ElementIterator, const ElementData,
237 boost::single_pass_traversal_tag>
255 CacheData(mIndex,
true);
277 friend class boost::iterator_core_access;
286 void CacheData(
unsigned index,
bool firstRead =
false);
299 return mIndex == rOther.
mIndex;
312 assert(mIndex < mpReader->GetNumElements());
314 return mLastDataRead;
351 ElementIterator GetElementIteratorBegin(
const std::set<unsigned>& rIndices);
362 class NodeIterator :
public boost::iterator_facade<NodeIterator, const std::vector<double>,
364 boost::single_pass_traversal_tag>
382 CacheData(mIndex,
true);
404 friend class boost::iterator_core_access;
413 void CacheData(
unsigned index,
bool firstRead =
false);
426 return mIndex == rOther.
mIndex;
438 assert(mIndex < mpReader->GetNumNodes());
440 return mLastDataRead;
477 NodeIterator GetNodeIteratorBegin(
const std::set<unsigned>& rIndices);
485 #endif //_ABSTRACTMESHREADER_HPP_ unsigned GetIndex() const
std::set< unsigned >::const_iterator mIndicesIterator
std::set< unsigned >::const_iterator mIndicesIterator
NodeIterator(unsigned index, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *pReader)
unsigned ContainingElement
bool equal(const NodeIterator &rOther) const
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpReader
const std::set< unsigned > * mpIndices
ElementIterator(unsigned index, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *pReader)
const double DOUBLE_UNSET
std::vector< unsigned > NodeIndices
unsigned GetIndex() const
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpReader
const ElementData & dereference() const
const unsigned UNSIGNED_UNSET
ElementData mLastDataRead
const std::set< unsigned > * mpIndices
const std::vector< double > & dereference() const
std::vector< double > mLastDataRead
bool equal(const ElementIterator &rOther) const