36 #include "AbstractCachedMeshReader.hpp" 45 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
47 : mNumNodeAttributes(0),
50 mNumElementAttributes(0),
57 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
59 const std::string& rFileName)
63 std::vector<std::string> raw_data;
64 std::ifstream data_file(rFileName.c_str());
68 if (!data_file.is_open())
70 EXCEPTION(
"Could not open data file " + rFileName);
75 getline(data_file, raw_line);
82 long hash_location = raw_line.find(
'#', 0);
83 if (hash_location >= 0)
85 raw_line = raw_line.substr(0, hash_location);
89 long not_blank_location = raw_line.find_first_not_of(
" \t", 0);
90 if (not_blank_location >= 0)
92 raw_data.push_back(raw_line);
96 getline(data_file, raw_line);
103 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
107 std::vector<std::vector<unsigned> >::iterator the_iterator;
109 unsigned max_node_index = 0;
113 std::vector<unsigned> indices = *the_iterator;
115 for (
unsigned i = 0; i < ELEMENT_DIM+1; i++)
117 if (indices[i] > max_node_index)
119 max_node_index = indices[i];
124 return max_node_index;
127 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
131 std::vector<std::vector<unsigned> >::iterator the_iterator;
133 unsigned min_node_index = UINT_MAX;
137 std::vector<unsigned> indices = *the_iterator;
139 for (
unsigned i = 0; i < ELEMENT_DIM+1; i++)
141 if (indices[i] < min_node_index)
143 min_node_index = indices[i];
148 return min_node_index;
151 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
168 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
187 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
195 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
202 EXCEPTION(
"All faces (or edges) already got");
214 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
220 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
226 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
std::vector< std::vector< unsigned > > mFaceData
unsigned GetMaxNodeIndex()
unsigned GetMinNodeIndex()
std::vector< std::vector< unsigned > > mElementData
std::vector< std::vector< unsigned > >::iterator mpFaceIterator
std::vector< std::vector< unsigned > >::iterator mpElementIterator
ElementData GetNextFaceData()
#define EXCEPTION(message)
std::vector< std::string > GetRawDataFromFile(const std::string &rFileName)
ElementData GetNextElementData()
std::vector< std::vector< double > > mNodeData
std::vector< unsigned > NodeIndices
AbstractCachedMeshReader()
unsigned GetNumElements() const
unsigned GetNumFaces() const
std::vector< double > GetNextNode()
std::vector< std::vector< double > >::iterator mpNodeIterator
unsigned GetNumNodes() const