101 std::vector<double> node_data;
104 GetNextLineFromStream(mNodesFile, buffer);
106 std::stringstream buffer_stream(buffer);
109 buffer_stream >> index;
111 unsigned offset = mIndexFromZero ? 0 : 1;
112 if (index != mNodesRead + offset)
114 EXCEPTION(
"Data for node " << mNodesRead <<
" missing");
118 for (
unsigned i=0; i<SPACE_DIM+1; i++)
120 buffer_stream >> node_value;
121 node_data.push_back(node_value);
135 GetNextLineFromStream(mElementsFile, buffer);
137 std::stringstream buffer_stream(buffer);
139 unsigned element_index;
140 buffer_stream >> element_index;
142 unsigned offset = mIndexFromZero ? 0 : 1;
143 if (element_index != mElementsRead + offset)
145 EXCEPTION(
"Data for element " << mElementsRead <<
" missing");
148 unsigned num_nodes_in_element;
149 buffer_stream >> num_nodes_in_element;
153 for (
unsigned i=0; i<num_nodes_in_element; i++)
155 buffer_stream >> node_index;
156 element_data.
NodeIndices.push_back(node_index - offset);
159 if (mNumElementAttributes > 0)
161 assert(mNumElementAttributes==1);
163 unsigned attribute_value;
164 buffer_stream >> attribute_value;
214 GetNextLineFromStream(mNodesFile, buffer);
215 std::stringstream buffer_stream(buffer);
216 buffer_stream >> mNumNodes >> mNumNodeAttributes;
219 GetNextLineFromStream(mNodesFile, buffer);
220 std::stringstream node_buffer_stream(buffer);
222 unsigned first_index;
223 node_buffer_stream >> first_index;
224 assert(first_index == 0 || first_index == 1);
225 mIndexFromZero = (first_index == 0);
230 GetNextLineFromStream(mNodesFile, buffer);
232 GetNextLineFromStream(mElementsFile, buffer);
233 std::stringstream element_buffer_stream(buffer);
235 element_buffer_stream >> mNumElements >> mNumElementAttributes;
252 getline(fileStream, rawLine);
254 if (fileStream.eof())
256 EXCEPTION(
"Cannot get the next line from node or element file due to incomplete data");
260 rawLine = rawLine.substr(0,rawLine.find(
'#', 0));
262 line_is_blank = (rawLine.find_first_not_of(
" \t", 0) == std::string::npos);
264 while (line_is_blank);