OGS
|
Enumerations | |
enum class | NodeType { UNSPECIFIED , VRTX , PVRTX } |
Functions | |
void | checkMeshNames (std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes) |
bool | isCommentLine (std::string const &str) |
Checks if the current line is a comment. | |
bool | skipToEND (std::ifstream &in) |
Parses current section until END-tag is reached. | |
bool | isKeyword (DataType const t, std::string const &line) |
Checks if current line is a designated keyword for a GoCAD data set. | |
DataType | datasetFound (std::ifstream &in) |
Checks if a GoCAD data set begins at the current stream position. | |
void | checkLineEndings (std::string const &file_name) |
Checks if current line is a designated keyword for a GoCAD data set. | |
bool | parseHeader (std::ifstream &in, std::string &mesh_name) |
Parses the HEADER section (everything except the name is ignored right now) | |
bool | parsePropertyClass (std::ifstream &in) |
std::string | propertyCheck (std::string const &string) |
Checks if the current line starts with one of the allowed keywords. | |
bool | parseProperties (std::ifstream &in, std::vector< std::string > const &names, MeshLib::Properties &mesh_prop) |
MeshLib::Node * | createNode (std::stringstream &sstr) |
bool | parseAtomRegionIndicators (std::ifstream &in) |
bool | parseNodes (std::ifstream &in, std::vector< MeshLib::Node * > &nodes, std::map< std::size_t, std::size_t > &node_id_map, MeshLib::Properties const &mesh_prop) |
Parses the node data for the current mesh. | |
bool | parseLineSegments (std::ifstream &in, std::vector< MeshLib::Node * > const &nodes, std::vector< MeshLib::Element * > &elems, std::map< std::size_t, std::size_t > const &node_id_map, MeshLib::Properties &mesh_prop) |
Parses the segments of the current line. | |
bool | parseLine (std::ifstream &in, std::vector< MeshLib::Node * > &nodes, std::vector< MeshLib::Element * > &elems, std::map< std::size_t, std::size_t > &node_id_map, MeshLib::Properties &mesh_prop) |
Parses line information (nodes, segments, properties) | |
bool | parseElements (std::ifstream &in, std::vector< MeshLib::Node * > const &nodes, std::vector< MeshLib::Element * > &elems, std::map< std::size_t, std::size_t > const &node_id_map, MeshLib::Properties &mesh_prop) |
Parses the element data for the current mesh. | |
bool | parseSurface (std::ifstream &in, std::vector< MeshLib::Node * > &nodes, std::vector< MeshLib::Element * > &elems, std::map< std::size_t, std::size_t > &node_id_map, MeshLib::Properties &mesh_prop) |
Parses the surface information (nodes, triangles, properties) | |
template<typename T > | |
MeshLib::Mesh * | createMesh (std::ifstream &in, DataType type, std::string &mesh_name, MeshLib::Properties &mesh_prop, T parser, bool const flip_elevation) |
Converts parsed data into mesh. | |
MeshLib::Mesh * | readData (std::ifstream &in, DataType const &type, std::string &mesh_name) |
Reads one mesh contained in the file (there may be more than one!) | |
bool | readFile (std::string const &file_name, std::vector< std::unique_ptr< MeshLib::Mesh > > &meshes, DataType const export_type=DataType::ALL) |
Reads the specified file and writes data into internal mesh vector. | |
Variables | |
const std::string | mat_id_name = "MaterialIDs" |
const std::string | eof_error = "Error: Unexpected end of file." |
|
strong |
Enumerator | |
---|---|
UNSPECIFIED | |
VRTX | |
PVRTX |
Definition at line 30 of file GocadAsciiReader.cpp.
void FileIO::Gocad::GocadAsciiReader::checkLineEndings | ( | std::string const & | file_name | ) |
Checks if current line is a designated keyword for a GoCAD data set.
Definition at line 122 of file GocadAsciiReader.cpp.
References OGS_FATAL.
Referenced by readFile().
void FileIO::Gocad::GocadAsciiReader::checkMeshNames | ( | std::vector< std::unique_ptr< MeshLib::Mesh > > const & | meshes | ) |
A GoCAD file may contain multiple datasets with the same name. To avoid conflicts when writing meshes, a unique id is appended to the mesh name if another dataset with the same name exists.
Definition at line 43 of file GocadAsciiReader.cpp.
References getName().
Referenced by readFile().
MeshLib::Mesh * FileIO::Gocad::GocadAsciiReader::createMesh | ( | std::ifstream & | in, |
DataType | type, | ||
std::string & | mesh_name, | ||
MeshLib::Properties & | mesh_prop, | ||
T | parser, | ||
bool const | flip_elevation ) |
Converts parsed data into mesh.
Definition at line 553 of file GocadAsciiReader.cpp.
References BaseLib::cleanupVectorElements(), FileIO::Gocad::dataType2ShortString(), ERR(), and INFO().
Referenced by readData().
MeshLib::Node * FileIO::Gocad::GocadAsciiReader::createNode | ( | std::stringstream & | sstr | ) |
Definition at line 252 of file GocadAsciiReader.cpp.
References MeshLib::Node.
Referenced by parseNodes().
DataType FileIO::Gocad::GocadAsciiReader::datasetFound | ( | std::ifstream & | in | ) |
Checks if a GoCAD data set begins at the current stream position.
Definition at line 90 of file GocadAsciiReader.cpp.
References ERR(), isCommentLine(), isKeyword(), FileIO::Gocad::MODEL3D, FileIO::Gocad::PLINE, FileIO::Gocad::TSURF, FileIO::Gocad::UNDEFINED, and FileIO::Gocad::VSET.
Referenced by readFile().
bool FileIO::Gocad::GocadAsciiReader::isCommentLine | ( | std::string const & | str | ) |
Checks if the current line is a comment.
Definition at line 62 of file GocadAsciiReader.cpp.
Referenced by datasetFound(), parseElements(), parseLineSegments(), parseNodes(), and readData().
bool FileIO::Gocad::GocadAsciiReader::isKeyword | ( | DataType const | t, |
std::string const & | line ) |
Checks if current line is a designated keyword for a GoCAD data set.
Definition at line 83 of file GocadAsciiReader.cpp.
References FileIO::Gocad::dataType2String().
Referenced by datasetFound().
bool FileIO::Gocad::GocadAsciiReader::parseAtomRegionIndicators | ( | std::ifstream & | in | ) |
parse Atom Region Indicator section for current TFACE (currently the information in this section is ignored)
Definition at line 263 of file GocadAsciiReader.cpp.
Referenced by parseNodes().
bool FileIO::Gocad::GocadAsciiReader::parseElements | ( | std::ifstream & | in, |
std::vector< MeshLib::Node * > const & | nodes, | ||
std::vector< MeshLib::Element * > & | elems, | ||
std::map< std::size_t, std::size_t > const & | node_id_map, | ||
MeshLib::Properties & | mesh_prop ) |
Parses the element data for the current mesh.
Definition at line 448 of file GocadAsciiReader.cpp.
References eof_error, ERR(), MeshLib::Properties::getPropertyVector(), isCommentLine(), and mat_id_name.
Referenced by parseSurface().
bool FileIO::Gocad::GocadAsciiReader::parseHeader | ( | std::ifstream & | in, |
std::string & | mesh_name ) |
Parses the HEADER section (everything except the name is ignored right now)
Definition at line 143 of file GocadAsciiReader.cpp.
References eof_error, ERR(), and BaseLib::trim().
Referenced by readData().
bool FileIO::Gocad::GocadAsciiReader::parseLine | ( | std::ifstream & | in, |
std::vector< MeshLib::Node * > & | nodes, | ||
std::vector< MeshLib::Element * > & | elems, | ||
std::map< std::size_t, std::size_t > & | node_id_map, | ||
MeshLib::Properties & | mesh_prop ) |
Parses line information (nodes, segments, properties)
Definition at line 412 of file GocadAsciiReader.cpp.
References eof_error, ERR(), parseLine(), parseLineSegments(), parseNodes(), BaseLib::splitString(), and WARN().
Referenced by parseLine(), and readData().
bool FileIO::Gocad::GocadAsciiReader::parseLineSegments | ( | std::ifstream & | in, |
std::vector< MeshLib::Node * > const & | nodes, | ||
std::vector< MeshLib::Element * > & | elems, | ||
std::map< std::size_t, std::size_t > const & | node_id_map, | ||
MeshLib::Properties & | mesh_prop ) |
Parses the segments of the current line.
Definition at line 357 of file GocadAsciiReader.cpp.
References eof_error, ERR(), MeshLib::Properties::getPropertyVector(), isCommentLine(), and mat_id_name.
Referenced by parseLine().
bool FileIO::Gocad::GocadAsciiReader::parseNodes | ( | std::ifstream & | in, |
std::vector< MeshLib::Node * > & | nodes, | ||
std::map< std::size_t, std::size_t > & | node_id_map, | ||
MeshLib::Properties const & | mesh_prop ) |
Parses the node data for the current mesh.
Definition at line 277 of file GocadAsciiReader.cpp.
References createNode(), eof_error, ERR(), isCommentLine(), mat_id_name, parseAtomRegionIndicators(), PVRTX, BaseLib::splitString(), UNSPECIFIED, VRTX, and WARN().
Referenced by parseLine(), and parseSurface().
bool FileIO::Gocad::GocadAsciiReader::parseProperties | ( | std::ifstream & | in, |
std::vector< std::string > const & | names, | ||
MeshLib::Properties & | mesh_prop ) |
Parses information of node properties. Only property names and array sizes are currently used.
Definition at line 201 of file GocadAsciiReader.cpp.
References MeshLib::Properties::createNewPropertyVector(), eof_error, ERR(), MeshLib::Node, propertyCheck(), BaseLib::splitString(), and BaseLib::str2number().
Referenced by readData().
bool FileIO::Gocad::GocadAsciiReader::parsePropertyClass | ( | std::ifstream & | in | ) |
Reads PROPERTY_CLASS_HEADER sections of the file. All this information is currently ignored.
Definition at line 168 of file GocadAsciiReader.cpp.
References eof_error, and ERR().
Referenced by readData().
bool FileIO::Gocad::GocadAsciiReader::parseSurface | ( | std::ifstream & | in, |
std::vector< MeshLib::Node * > & | nodes, | ||
std::vector< MeshLib::Element * > & | elems, | ||
std::map< std::size_t, std::size_t > & | node_id_map, | ||
MeshLib::Properties & | mesh_prop ) |
Parses the surface information (nodes, triangles, properties)
Definition at line 503 of file GocadAsciiReader.cpp.
References eof_error, ERR(), parseElements(), parseNodes(), parseSurface(), BaseLib::splitString(), and WARN().
Referenced by parseSurface(), and readData().
std::string FileIO::Gocad::GocadAsciiReader::propertyCheck | ( | std::string const & | string | ) |
Checks if the current line starts with one of the allowed keywords.
Definition at line 183 of file GocadAsciiReader.cpp.
References BaseLib::splitString().
Referenced by parseProperties().
MeshLib::Mesh * FileIO::Gocad::GocadAsciiReader::readData | ( | std::ifstream & | in, |
DataType const & | type, | ||
std::string & | mesh_name ) |
Reads one mesh contained in the file (there may be more than one!)
Definition at line 582 of file GocadAsciiReader.cpp.
References MeshLib::Cell, createMesh(), MeshLib::Properties::createNewPropertyVector(), FileIO::Gocad::CoordinateSystem::Depth, eof_error, ERR(), isCommentLine(), mat_id_name, FileIO::Gocad::CoordinateSystem::parse(), parseHeader(), parseLine(), parseProperties(), parsePropertyClass(), parseSurface(), FileIO::Gocad::PLINE, BaseLib::splitString(), FileIO::Gocad::TSURF, WARN(), and FileIO::Gocad::CoordinateSystem::z_positive.
Referenced by readFile().
bool FileIO::Gocad::GocadAsciiReader::readFile | ( | std::string const & | file_name, |
std::vector< std::unique_ptr< MeshLib::Mesh > > & | meshes, | ||
DataType const | export_type ) |
Reads the specified file and writes data into internal mesh vector.
Definition at line 657 of file GocadAsciiReader.cpp.
References FileIO::Gocad::ALL, checkLineEndings(), checkMeshNames(), datasetFound(), FileIO::Gocad::dataType2String(), BaseLib::dropFileExtension(), ERR(), FileIO::Gocad::MODEL3D, readData(), skipToEND(), FileIO::Gocad::UNDEFINED, and FileIO::Gocad::VSET.
Referenced by MainWindow::loadFile(), and main().
bool FileIO::Gocad::GocadAsciiReader::skipToEND | ( | std::ifstream & | in | ) |
Parses current section until END-tag is reached.
Definition at line 68 of file GocadAsciiReader.cpp.
References eof_error, and ERR().
Referenced by readFile().
const std::string FileIO::Gocad::GocadAsciiReader::eof_error = "Error: Unexpected end of file." |
Definition at line 38 of file GocadAsciiReader.cpp.
Referenced by parseElements(), parseHeader(), parseLine(), parseLineSegments(), parseNodes(), parseProperties(), parsePropertyClass(), parseSurface(), readData(), and skipToEND().
const std::string FileIO::Gocad::GocadAsciiReader::mat_id_name = "MaterialIDs" |
Definition at line 37 of file GocadAsciiReader.cpp.
Referenced by parseElements(), parseLineSegments(), parseNodes(), and readData().