OGS
|
Definition in file TecPlotTools.cpp.
#include <tclap/CmdLine.h>
#include <mpi.h>
#include <iostream>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#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 342 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 157 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 141 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 96 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 63 of file TecPlotTools.cpp.
References getValue().
Referenced by StationTreeModel::addStationList(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleBlockMatrices(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleComponentTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleKCmCn(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianComponentTransportEquation(), anonymous_namespace{PythonBoundaryCondition.cpp}::checkConsistency(), FileIO::Gocad::GocadAsciiReader::checkMeshNames(), convertFile(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtMolarFlux(), GeoLib::GEOObjects::getPolylineVec(), GeoLib::GEOObjects::getPolylineVecObj(), ProcessLib::OutputXDMFHDF5Format::outputMeshXdmf(), splitFile(), GeoLib::IO::XmlStnInterface::write(), 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 31 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 116 of file TecPlotTools.cpp.
References BaseLib::trim(), and trimVariable().
Referenced by convertFile().
std::string_view getZonetype | ( | std::string const & | line | ) |
Definition at line 68 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 459 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 171 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 265 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 279 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 107 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 207 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 185 of file TecPlotTools.cpp.
References INFO().
Referenced by splitFile().