249 std::ifstream &file_handle,
251 std::vector< T > &
Data
260std::streamoff start_pos;
261std::string word, line;
262std::stringstream sline;
270if (!file_handle.good()) {
return(1); }
276start_pos = file_handle.tellg();
277dgf::scanData(file_handle, n);
279file_handle.seekg(start_pos);
291while (!file_handle.eof() && check) {
294 start_pos = file_handle.tellg();
295 std::getline(file_handle, line);
296 line = utils::string::trim(line);
302 check = ((word.compare(
"#") != 0)
303 && (word.compare(
"VERTEX") != 0)
304 && (word.compare(
"SIMPLEX") != 0)
305 && (word.compare(
"VERTEXDATA") != 0)
306 && (word.compare(
"SIMPLEXDATA") != 0));
314if (word.compare(
"#") != 0) {
316 file_handle.seekg(start_pos);
342 std::ifstream &file_handle,
344 std::vector< T > &data,
345 const std::string &data_name
354long int current_pos, start_pos;
355std::string header, line, word;
356std::stringstream sline;
363if (!file_handle.good()) {
return(1); }
368sline <<
"VERTEXDATA " << data_name << std::endl;
370header = utils::string::trim(header);
376start_pos = file_handle.tellg();
378while (start_pos != current_pos) {
381 std::getline(file_handle, line);
382 line = utils::string::trim(line);
387 if (file_handle.eof()) {
389 file_handle.seekg(0);
391 current_pos = file_handle.tellg();
394 if ((sline >> word) && (word.compare(
"VERTEXDATA") == 0)) {
395 if (data_name.compare(
"") == 0) {
396 start_pos = current_pos;
400 if (line.compare(header) == 0) {
401 start_pos = current_pos;
437 std::ifstream &file_handle,
439 std::vector< T > &data,
440 const std::string &data_name
449std::streamoff current_pos, start_pos;
450std::string header, line, word;
451std::stringstream sline;
458if (!file_handle.good()) {
return(1); }
463sline <<
"SIMPLEXDATA " << data_name << std::endl;
465header = utils::string::trim(header);
471start_pos = file_handle.tellg();
473while (start_pos != current_pos) {
476 std::getline(file_handle, line);
477 line = utils::string::trim(line);
482 if (file_handle.eof()) {
484 file_handle.seekg(0);
486 current_pos = file_handle.tellg();
489 if ((sline >> word) && (word.compare(
"SIMPLEXDATA") == 0)) {
490 if (data_name.compare(
"") == 0) {
491 start_pos = current_pos;
495 if (line.compare(header) == 0) {
496 start_pos = current_pos;
575 std::ofstream &file_handle,
577 std::vector< T > &
Data,
578 const std::string &Data_name
587std::stringstream sheader;
597if (!file_handle.good()) {
return(1); }
605dataset = utils::string::trim(dataset);
606sheader <<
"VERTEXDATA " << dataset << std::endl;
607header = sheader.str();
608header = utils::string::trim(header);
609file_handle << header << std::endl;
631 std::ofstream &file_handle,
633 std::vector< T > &
Data,
634 const std::string &Data_name
643std::stringstream sheader;
653if (!file_handle.good()) {
return(1); }
661dataset = utils::string::trim(dataset);
662sheader <<
"SIMPLEXDATA " << dataset << std::endl;
663header = sheader.str();
664header = utils::string::trim(header);
665file_handle << header << std::endl;