119 std::vector<double> node_data;
121 std::string buffer =
"";
122 GetNextLineFromStream(mNodesFile, buffer);
124 std::stringstream buffer_stream(buffer);
127 buffer_stream >> index;
129 unsigned offset = mIndexFromZero ? 0 : 1;
130 if (index != mNodesRead + offset)
132 EXCEPTION(
"Data for node " << mNodesRead <<
" missing");
136 for (
unsigned i=0; i<SPACE_DIM+1; i++)
138 buffer_stream >> node_value;
139 node_data.push_back(node_value);
173 std::string buffer =
"";
174 GetNextLineFromStream(mElementsFile, buffer);
176 std::stringstream buffer_stream(buffer);
178 unsigned element_index;
179 buffer_stream >> element_index;
181 unsigned offset = mIndexFromZero ? 0 : 1;
182 if (element_index != mElementsRead + offset)
184 EXCEPTION(
"Data for element " << mElementsRead <<
" missing");
187 unsigned num_nodes_in_element;
188 buffer_stream >> num_nodes_in_element;
192 for (
unsigned i=0; i<num_nodes_in_element; i++)
194 buffer_stream >> node_index;
195 element_data.
NodeIndices.push_back(node_index - offset);
198 if (mNumElementAttributes > 0)
200 assert(mNumElementAttributes == 1);
216 unsigned num_corner_nodes;
217 buffer_stream >> num_corner_nodes;
218 for (
unsigned i = 0; i < num_corner_nodes; i++) {
219 buffer_stream >> node_index;
237 std::string buffer =
"";
238 GetNextLineFromStream(mLaminasFile, buffer);
240 std::stringstream buffer_stream(buffer);
243 buffer_stream >> lamina_idx;
245 unsigned offset = mIndexFromZero ? 0 : 1;
246 if (lamina_idx != mLaminasRead + offset)
248 EXCEPTION(
"Data for lamina " << mLaminasRead <<
" missing");
251 unsigned num_nodes_in_lamina;
252 buffer_stream >> num_nodes_in_lamina;
256 for (
unsigned i=0; i<num_nodes_in_lamina; i++)
258 buffer_stream >> node_index;
259 lamina_data.
NodeIndices.push_back(node_index - offset);
262 if (mNumLaminaAttributes > 0)
264 assert(mNumLaminaAttributes == 1);
280 unsigned num_corner_nodes;
281 buffer_stream >> num_corner_nodes;
282 for (
unsigned i = 0; i < num_corner_nodes; i++) {
283 buffer_stream >> node_index;
362 std::string buffer =
"";
363 GetNextLineFromStream(mNodesFile, buffer);
365 unsigned local_space_dim;
367 std::stringstream buffer_stream(buffer);
368 buffer_stream >> mNumNodes >> local_space_dim >> mNumNodeAttributes >> mCharacteristicNodeSpacing;
371 GetNextLineFromStream(mNodesFile, buffer);
372 std::stringstream node_buffer_stream(buffer);
374 unsigned first_index;
375 node_buffer_stream >> first_index;
376 assert(first_index == 0 || first_index == 1);
377 mIndexFromZero = (first_index == 0);
382 GetNextLineFromStream(mNodesFile, buffer);
385 GetNextLineFromStream(mElementsFile, buffer);
386 std::stringstream element_buffer_stream(buffer);
387 element_buffer_stream >> mNumElements >> mNumElementAttributes;
390 GetNextLineFromStream(mLaminasFile, buffer);
391 std::stringstream lamina_buffer_stream(buffer);
392 lamina_buffer_stream >> mNumLaminas >> mNumLaminaAttributes;
395 GetNextLineFromStream(mGridFile, buffer);
396 std::stringstream grid_buffer_stream(buffer);
397 grid_buffer_stream >> mNumGridPtsX >> mNumGridPtsY;
416 getline(fileStream, rawLine);
418 if (fileStream.eof())
420 EXCEPTION(
"Cannot get the next line from node, element, lamina or grid file due to incomplete data");
424 rawLine = rawLine.substr(0,rawLine.find(
'#', 0));
426 line_is_blank = (rawLine.find_first_not_of(
" \t", 0) == std::string::npos);
428 while (line_is_blank);