OGS
|
Definition in file TecPlotTools.cpp.
#include <tclap/CmdLine.h>
#include <iostream>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "BaseLib/MPI.h"
#include "BaseLib/StringTools.h"
#include "GeoLib/Point.h"
#include "InfoLib/GitInfo.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h"
#include "MeshLib/Mesh.h"
#include "MeshToolsLib/MeshGenerators/RasterToMesh.h"
Go to the source code of this file.
Functions | |
std::string | getValue (std::string const &line, std::string const &val_name, bool is_string) |
std::string | getName (std::string const &line) |
Returns the name/title from the "Zone"-description. | |
std::string_view | getZonetype (std::string const &line) |
std::pair< std::size_t, std::size_t > | getDimensions (std::string const &line) |
Returns raster dimensions from the "Zone"-description. | |
std::string | trimVariable (std::string &var) |
Trims a substring containing a variable-name. | |
std::vector< std::string > | getVariables (std::string const &line) |
Returns an vector of variable names from the "Variables"-description. | |
bool | dataCountError (std::string const &name, std::size_t const ¤t, std::size_t const &total) |
Tests if the number of read values equals the number of expected values. | |
bool | dataCountError (std::ofstream &out, std::string const &name, std::size_t const ¤t, std::size_t const &total) |
void | resetDataStructures (std::size_t const &n_scalars, std::vector< std::vector< double > > &scalars, std::size_t &val_count) |
Resets all data structures after a new "Variables"-description is found. | |
void | writeTecPlotSection (std::ofstream &out, std::string const &file_name, std::size_t &write_count, std::size_t &val_count, std::size_t &val_total) |
Writes one section/zone into a separate TecPlot file. | |
int | writeDataToMesh (std::string const &file_name, std::size_t &write_count, std::vector< std::string > const &vec_names, std::vector< std::vector< double > > const &scalars, std::pair< std::size_t, std::size_t > const &dims) |
Writes one section/zone into a separate OGS-mesh. | |
void | skipGeometrySection (std::ifstream &in, std::string &line) |
If a geometry-section is encountered, it is currently ignored. | |
int | splitFile (std::ifstream &in, std::string const &file_name) |
Splits a TecPlot file containing multiple sections/zones into separate files. | |
int | convertFile (std::ifstream &in, std::string const &file_name) |
int | main (int argc, char *argv[]) |
int convertFile | ( | std::ifstream & | in, |
std::string const & | file_name ) |
Converts a TecPlot file into one or more OGS-meshes (one mesh per section/zone)
Definition at line 339 of file TecPlotTools.cpp.
References dataCountError(), ERR(), getDimensions(), getName(), getVariables(), getZonetype(), INFO(), resetDataStructures(), skipGeometrySection(), and writeDataToMesh().
Referenced by main().
bool dataCountError | ( | std::ofstream & | out, |
std::string const & | name, | ||
std::size_t const & | current, | ||
std::size_t const & | total ) |
Tests if the number of read values equals the number of expected values and closes the stream
Definition at line 154 of file TecPlotTools.cpp.
References dataCountError().
bool dataCountError | ( | std::string const & | name, |
std::size_t const & | current, | ||
std::size_t const & | total ) |
Tests if the number of read values equals the number of expected values.
Definition at line 138 of file TecPlotTools.cpp.
References ERR().
Referenced by convertFile(), dataCountError(), and splitFile().
std::pair< std::size_t, std::size_t > getDimensions | ( | std::string const & | line | ) |
Returns raster dimensions from the "Zone"-description.
Definition at line 93 of file TecPlotTools.cpp.
References getValue().
Referenced by convertFile(), and splitFile().
std::string getName | ( | std::string const & | line | ) |
Returns the name/title from the "Zone"-description.
Definition at line 60 of file TecPlotTools.cpp.
References getValue().
Referenced by StationTreeModel::addStationList(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleBlockMatrices(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleKCmCn(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianComponentTransportEquation(), anonymous_namespace{PythonBoundaryCondition.cpp}::checkConsistency(), FileIO::Gocad::GocadAsciiReader::checkMeshNames(), convertFile(), GeoLib::GEOObjects::getPolylineVec(), GeoLib::GEOObjects::getPolylineVecObj(), ProcessLib::OutputXDMFHDF5Format::outputMeshXdmf(), splitFile(), GeoLib::IO::XmlStnInterface::write(), FileIO::Legacy::writeAllDataToGLIFileV4(), FileIO::GMSH::GMSHPolygonTree::writeStations(), and StationTreeView::writeStratigraphiesAsImages().
std::string getValue | ( | std::string const & | line, |
std::string const & | val_name, | ||
bool | is_string ) |
Returns the value for the given parameter name (i.e. for "x = 3" it returns "3")
Definition at line 28 of file TecPlotTools.cpp.
References ERR(), and BaseLib::trim().
Referenced by getDimensions(), getName(), MaterialLib::Fluid::FluidPropertiesWithDensityDependentModels::getValue(), and main().
std::vector< std::string > getVariables | ( | std::string const & | line | ) |
Returns an vector of variable names from the "Variables"-description.
Definition at line 113 of file TecPlotTools.cpp.
References BaseLib::trim(), and trimVariable().
Referenced by convertFile().
std::string_view getZonetype | ( | std::string const & | line | ) |
Definition at line 65 of file TecPlotTools.cpp.
References ERR(), and OGS_FATAL.
Referenced by convertFile().
int main | ( | int | argc, |
char * | argv[] ) |
Small collection of scripts to handle TecPlot files.
Return codes: 0 : no errors -1 : missing arguments -2 : file I/O error -3 : index error -4 : error interpreting data -5 : error creating data structures
Definition at line 456 of file TecPlotTools.cpp.
References convertFile(), ERR(), INFO(), GitInfoLib::GitInfo::ogs_version, and splitFile().
void resetDataStructures | ( | std::size_t const & | n_scalars, |
std::vector< std::vector< double > > & | scalars, | ||
std::size_t & | val_count ) |
Resets all data structures after a new "Variables"-description is found.
Definition at line 168 of file TecPlotTools.cpp.
Referenced by convertFile().
void skipGeometrySection | ( | std::ifstream & | in, |
std::string & | line ) |
If a geometry-section is encountered, it is currently ignored.
Definition at line 262 of file TecPlotTools.cpp.
Referenced by convertFile().
int splitFile | ( | std::ifstream & | in, |
std::string const & | file_name ) |
Splits a TecPlot file containing multiple sections/zones into separate files.
Definition at line 276 of file TecPlotTools.cpp.
References dataCountError(), getDimensions(), getName(), INFO(), and writeTecPlotSection().
Referenced by main().
std::string trimVariable | ( | std::string & | var | ) |
Trims a substring containing a variable-name.
Definition at line 104 of file TecPlotTools.cpp.
Referenced by getVariables().
int writeDataToMesh | ( | std::string const & | file_name, |
std::size_t & | write_count, | ||
std::vector< std::string > const & | vec_names, | ||
std::vector< std::vector< double > > const & | scalars, | ||
std::pair< std::size_t, std::size_t > const & | dims ) |
Writes one section/zone into a separate OGS-mesh.
Definition at line 204 of file TecPlotTools.cpp.
References MeshLib::Cell, MeshToolsLib::RasterToMesh::convert(), MeshLib::Properties::createNewPropertyVector(), MeshLib::DATAVECTOR, ERR(), INFO(), MeshLib::QUAD, and MeshLib::IO::VtuInterface::writeToFile().
Referenced by convertFile().
void writeTecPlotSection | ( | std::ofstream & | out, |
std::string const & | file_name, | ||
std::size_t & | write_count, | ||
std::size_t & | val_count, | ||
std::size_t & | val_total ) |
Writes one section/zone into a separate TecPlot file.
Definition at line 182 of file TecPlotTools.cpp.
References INFO().
Referenced by splitFile().