OGS
GocadAsciiReader.cpp File Reference
#include "GocadAsciiReader.h"
#include <algorithm>
#include <fstream>
#include <iterator>
#include <memory>
#include <optional>
#include <range/v3/algorithm/transform.hpp>
#include <range/v3/view/zip.hpp>
#include <string_view>
#include "Applications/FileIO/GocadIO/CoordinateSystem.h"
#include "BaseLib/FileTools.h"
#include "BaseLib/Logging.h"
#include "BaseLib/StringTools.h"
#include "MeshLib/Elements/Line.h"
#include "MeshLib/Elements/Tri.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h"
#include "MeshLib/Properties.h"
#include "MeshLib/Utils/nextUnusedMaterialId.h"
Include dependency graph for GocadAsciiReader.cpp:

Go to the source code of this file.

Classes

struct  FileIO::Gocad::GocadAsciiReader::PropertyBuffer

Namespaces

namespace  FileIO
namespace  FileIO::Gocad
namespace  FileIO::Gocad::GocadAsciiReader

Enumerations

enum class  FileIO::Gocad::GocadAsciiReader::NodeType { FileIO::Gocad::GocadAsciiReader::UNSPECIFIED , FileIO::Gocad::GocadAsciiReader::VRTX , FileIO::Gocad::GocadAsciiReader::PVRTX }

Functions

void FileIO::Gocad::GocadAsciiReader::checkMeshNames (std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)
bool FileIO::Gocad::GocadAsciiReader::isCommentLine (std::string const &str)
 Checks if the current line is a comment.
bool FileIO::Gocad::GocadAsciiReader::skipToEND (std::ifstream &in)
 Parses current section until END-tag is reached.
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.
DataType FileIO::Gocad::GocadAsciiReader::datasetFound (std::ifstream &in)
 Checks if a GoCAD data set begins at the current stream position.
void FileIO::Gocad::GocadAsciiReader::checkLineEndings (std::string const &file_name)
 Checks if current line is a designated keyword for a GoCAD data set.
bool FileIO::Gocad::GocadAsciiReader::parseHeader (std::ifstream &in, std::string &mesh_name)
 Parses the HEADER section (everything except the name is ignored right now)
bool FileIO::Gocad::GocadAsciiReader::parsePropertyClass (std::ifstream &in)
std::string FileIO::Gocad::GocadAsciiReader::propertyCheck (std::string const &string)
 Checks if the current line starts with one of the allowed keywords.
bool FileIO::Gocad::GocadAsciiReader::parseProperties (std::ifstream &in, std::vector< std::string > const &names, MeshLib::Properties &mesh_prop)
MeshLib::NodeFileIO::Gocad::GocadAsciiReader::createNode (std::stringstream &sstr)
bool FileIO::Gocad::GocadAsciiReader::parseAtomRegionIndicators (std::ifstream &in)
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.
template<std::size_t N>
std::optional< std::vector< std::array< std::size_t, N > > > FileIO::Gocad::GocadAsciiReader::parseNodeIdTuples (std::ifstream &in, std::string_view const keyword)
template<typename ElementType>
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)
template<typename ElementType>
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)
bool FileIO::Gocad::GocadAsciiReader::appendSectionMaterialIds (MeshLib::Properties &mesh_prop, std::size_t const count)
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)
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)
template<typename T>
MeshLib::MeshFileIO::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.
MeshLib::MeshFileIO::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!)
bool FileIO::Gocad::GocadAsciiReader::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 FileIO::Gocad::GocadAsciiReader::mat_id_name = "MaterialIDs"
const std::string FileIO::Gocad::GocadAsciiReader::eof_error = "Error: Unexpected end of file."