Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ***** ===== FILE_IO::READ_GEOM_GRID() ===== *****
- void File_Io::readGeomGrid(const char* filename, Geometry_3d::Table* geomTable, Grid_3d::Table* gridTable, int* withNumbers, int* withPotentials)
- {
- std::ifstream file(filename,std::ifstream::in);
- if (!file.good()) throw std::runtime_error("File_Io::readGeomGrid()");
- // ***
- std::string headerLine;
- do
- std::getline(file,headerLine);
- while (headerLine.empty() || headerLine.at(0) == '#');
- bool asciiMode;
- if (headerLine.substr(0,5) == "ASCII")
- {
- asciiMode = true;
- headerLine = headerLine.substr(5,std::string::npos);
- }
- else if (headerLine.substr(0,6) == "BINARY")
- {
- asciiMode = false;
- headerLine = headerLine.substr(6,std::string::npos);
- }
- else
- throw std::runtime_error("File_Io::readGeomGrid()");
- int size(0);
- bool readNumbers(false);
- bool readPotentials(false);
- {
- std::istringstream line(headerLine);
- line >> size;
- if (line.fail()) throw std::runtime_error("File_Io::readGeomGrid()");
- line >> std::noboolalpha >> readNumbers;
- if (line.fail()) throw std::runtime_error("File_Io::readGeomGrid()");
- line >> std::noboolalpha >> readPotentials;
- if (line.fail()) throw std::runtime_error("File_Io::readGeomGrid()");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement