36#include "AbstractMeshReader.hpp"
43template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
51template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
57template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
65template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
70 std::vector<double> empty;
74template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
77 return GetNextFaceData();
80template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
83 EXCEPTION(
"Random access is only implemented in mesh readers for binary mesh files.");
86template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
89 EXCEPTION(
"Random access is only implemented in mesh readers for binary mesh files.");
92template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
95 EXCEPTION(
"Random access is only implemented in mesh readers for binary mesh files.");
98template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
101 return GetFaceData(index);
104template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
107 EXCEPTION(
"Ncl files are only implemented in mesh readers for binary mesh files.");
110template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
116template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
122template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
128template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
134template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
140template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
146template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
152template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
155 EXCEPTION(
"Node permutations aren't supported by this reader");
160template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
166template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
172template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
175 EXCEPTION(
"Cable elements are not supported by this mesh format.");
181template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
185 return ElementIterator(0u,
this);
188template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
195template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
202template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
205 : mpIndices(&rIndices),
208 if (mpIndices->empty())
210 mIndex = mpReader->GetNumElements();
214 mIndicesIterator = mpIndices->begin();
216 CacheData(*mIndicesIterator,
true);
220template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
236 next_index =
mpReader->GetNumElements();
247template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
251 assert(mIndex < index || mIndex == 0u || index == mpReader->
GetNumElements());
254 if (mpReader->IsFileFormatBinary())
256 mLastDataRead = mpReader->GetElementData(index);
262 assert(mIndex == 0u);
264 mLastDataRead = mpReader->GetNextElementData();
267 while (mIndex < index)
269 mLastDataRead = mpReader->GetNextElementData();
277template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
284template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
288 return NodeIterator(rIndices,
this);
291template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
298template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
301 : mpIndices(&rIndices),
316template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
324 if (mIndicesIterator != mpIndices->end())
326 next_index = *mIndicesIterator;
332 next_index = mpReader->GetNumNodes();
338 next_index = mIndex + 1;
340 CacheData(next_index);
343template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
347 assert(mIndex < index || mIndex == 0u || index == mpReader->
GetNumNodes());
350 if (mpReader->IsFileFormatBinary())
352 mLastDataRead = mpReader->GetNode(index);
358 assert(mIndex == 0u);
360 mLastDataRead = mpReader->GetNextNode();
363 while (mIndex < index)
365 mLastDataRead = mpReader->GetNextNode();
#define EXCEPTION(message)
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpReader
ElementIterator(unsigned index, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *pReader)
void CacheData(unsigned index, bool firstRead=false)
std::set< unsigned >::const_iterator mIndicesIterator
const std::set< unsigned > * mpIndices
const std::set< unsigned > * mpIndices
AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > * mpReader
std::set< unsigned >::const_iterator mIndicesIterator
NodeIterator(unsigned index, AbstractMeshReader< ELEMENT_DIM, SPACE_DIM > *pReader)
void CacheData(unsigned index, bool firstRead=false)
ElementIterator GetElementIteratorBegin()
virtual unsigned GetNumCableElementAttributes() const
ElementData GetEdgeData(unsigned index)
ElementData GetNextEdgeData()
virtual unsigned GetNumElements() const =0
virtual std::vector< unsigned > GetContainingElementIndices(unsigned index)
virtual bool GetReadContainingElementOfBoundaryElement()
virtual unsigned GetOrderOfBoundaryElements()
virtual std::string GetMeshFileBaseName()
NodeIterator GetNodeIteratorEnd()
virtual unsigned GetNumElementAttributes() const
virtual std::vector< double > GetNode(unsigned index)
virtual const std::vector< unsigned > & rGetNodePermutation()
virtual ElementData GetNextCableElementData()
unsigned GetNumEdges() const
virtual bool HasNclFile()
virtual unsigned GetNumCableElements() const
virtual std::vector< double > GetNodeAttributes()
virtual ElementData GetFaceData(unsigned index)
virtual unsigned GetNumFaceAttributes() const
virtual bool HasNodePermutation()
virtual bool IsFileFormatBinary()
virtual unsigned GetNumNodes() const =0
NodeIterator GetNodeIteratorBegin()
virtual ElementData GetElementData(unsigned index)
ElementIterator GetElementIteratorEnd()
virtual unsigned GetOrderOfElements()