![]() |
OGS
|
|
Classes | |
| struct | PropertyBuffer |
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. | |
| template<std::size_t N> | |
| std::optional< std::vector< std::array< std::size_t, N > > > | parseNodeIdTuples (std::ifstream &in, std::string_view const keyword) |
| template<typename ElementType> | |
| bool | createElements (std::vector< std::array< std::size_t, ElementType::n_all_nodes > > const &element_data, std::vector< MeshLib::Node * > const &nodes, std::vector< MeshLib::Element * > &elems, std::map< std::size_t, std::size_t > const &node_id_map) |
| template<typename ElementType> | |
| std::optional< std::size_t > | parseAndCreateElements (std::ifstream &in, std::string_view const keyword, std::vector< MeshLib::Node * > const &nodes, std::vector< MeshLib::Element * > &elems, std::map< std::size_t, std::size_t > const &node_id_map) |
| bool | appendSectionMaterialIds (MeshLib::Properties &mesh_prop, std::size_t const count) |
| 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 | 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 32 of file GocadAsciiReader.cpp.
| bool FileIO::Gocad::GocadAsciiReader::appendSectionMaterialIds | ( | MeshLib::Properties & | mesh_prop, |
| std::size_t const | count ) |
Assigns a fresh material ID to the count elements of the Gocad section that has just been parsed.
All Gocad sections of a data set share one MaterialIDs vector. Each section gets a material ID one larger than the current maximum in that vector (or 0 if it is still empty). The IDs already assigned to earlier sections are not modified.
Called after the elements have been appended, so on a missing MaterialIDs vector the element vector already holds the section's elements. That is not observable: the caller aborts the parsing of the whole data set, which discards all nodes and elements read so far.
Definition at line 513 of file GocadAsciiReader.cpp.
References ERR(), MeshLib::Properties::getPropertyVector(), mat_id_name, MeshLib::nextUnusedMaterialId(), and MeshLib::PropertyVector< PROP_VAL_TYPE >::resize().
Referenced by parseLine(), and parseSurface().
| 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 124 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 45 of file GocadAsciiReader.cpp.
References getName().
Referenced by readFile().
| bool FileIO::Gocad::GocadAsciiReader::createElements | ( | std::vector< std::array< std::size_t, ElementType::n_all_nodes > > const & | element_data, |
| std::vector< MeshLib::Node * > const & | nodes, | ||
| std::vector< MeshLib::Element * > & | elems, | ||
| std::map< std::size_t, std::size_t > const & | node_id_map ) |
Creates elements from parsed node ID tuples. All elements are constructed first and appended to elems only if every element could be created, i.e. elems is left unchanged on error. The number of nodes per element is taken from the element type.
Definition at line 443 of file GocadAsciiReader.cpp.
References ERR().
Referenced by parseAndCreateElements().
| 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 618 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 254 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 92 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 64 of file GocadAsciiReader.cpp.
Referenced by datasetFound(), parseNodeIdTuples(), 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 85 of file GocadAsciiReader.cpp.
References FileIO::Gocad::dataType2String().
Referenced by datasetFound().
| std::optional< std::size_t > FileIO::Gocad::GocadAsciiReader::parseAndCreateElements | ( | std::ifstream & | in, |
| std::string_view const | keyword, | ||
| std::vector< MeshLib::Node * > const & | nodes, | ||
| std::vector< MeshLib::Element * > & | elems, | ||
| std::map< std::size_t, std::size_t > const & | node_id_map ) |
Parses the node ID tuples of all lines starting with keyword and creates the corresponding elements. Returns the number of created elements, or nothing on error, in which case elems is left unchanged.
Definition at line 481 of file GocadAsciiReader.cpp.
References createElements(), and parseNodeIdTuples().
Referenced by parseLine(), and parseSurface().
| 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 265 of file GocadAsciiReader.cpp.
Referenced by parseNodes().
| 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 145 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 528 of file GocadAsciiReader.cpp.
References appendSectionMaterialIds(), eof_error, ERR(), parseAndCreateElements(), parseLine(), parseNodes(), BaseLib::splitString(), and WARN().
Referenced by parseLine(), and readData().
| std::optional< std::vector< std::array< std::size_t, N > > > FileIO::Gocad::GocadAsciiReader::parseNodeIdTuples | ( | std::ifstream & | in, |
| std::string_view const | keyword ) |
Parses the node ID tuples of all consecutive lines starting with keyword, e.g. the segments of a line ("SEG") or the triangles of a surface ("TRGL"). The stream is rewound to the first line that does not start with keyword. Returns std::nullopt if the file ended while parsing, or if a line does not carry the expected number of node IDs.
Definition at line 401 of file GocadAsciiReader.cpp.
References eof_error, ERR(), and isCommentLine().
Referenced by parseAndCreateElements().
| 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 287 of file GocadAsciiReader.cpp.
References MeshLib::appendValues(), 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 203 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 170 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 566 of file GocadAsciiReader.cpp.
References appendSectionMaterialIds(), eof_error, ERR(), parseAndCreateElements(), 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 185 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 647 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 722 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 70 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 40 of file GocadAsciiReader.cpp.
Referenced by parseHeader(), parseLine(), parseNodeIdTuples(), parseNodes(), parseProperties(), parsePropertyClass(), parseSurface(), readData(), and skipToEND().
| const std::string FileIO::Gocad::GocadAsciiReader::mat_id_name = "MaterialIDs" |
Definition at line 39 of file GocadAsciiReader.cpp.
Referenced by appendSectionMaterialIds(), parseNodes(), and readData().