OGS
|
Definition in file VerticalSliceFromLayers.cpp.
#include <algorithm>
#include <cmath>
#include <memory>
#include <string>
#include <vector>
#include <tclap/CmdLine.h>
#include <QCoreApplication>
#include "Applications/FileIO/Gmsh/GMSHInterface.h"
#include "Applications/FileIO/Gmsh/GmshReader.h"
#include "BaseLib/FileTools.h"
#include "BaseLib/IO/readStringListFromFile.h"
#include "GeoLib/AABB.h"
#include "GeoLib/AnalyticalGeometry.h"
#include "GeoLib/GEOObjects.h"
#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
#include "GeoLib/Point.h"
#include "GeoLib/Polygon.h"
#include "GeoLib/Polyline.h"
#include "InfoLib/GitInfo.h"
#include "MathLib/MathTools.h"
#include "MathLib/Point3d.h"
#include "MeshGeoToolsLib/GeoMapper.h"
#include "MeshLib/Elements/Element.h"
#include "MeshLib/IO/VtkIO/VtuInterface.h"
#include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/MeshEditing/MeshRevision.h"
#include "MeshLib/MeshEditing/RemoveMeshComponents.h"
#include "MeshLib/MeshSearch/ElementSearch.h"
#include "MeshLib/MeshSurfaceExtraction.h"
#include "MeshLib/Node.h"
Go to the source code of this file.
Functions | |
std::unique_ptr< std::vector< GeoLib::Point * > > | createPoints (MathLib::Point3d const &start, MathLib::Point3d const &end, std::size_t const n_intervals) |
creates a vector of sampling points based on the specified resolution More... | |
GeoLib::Polyline * | createPolyline (std::vector< GeoLib::Point * > const &points) |
creates a polyline to be mapped on a mesh layer More... | |
std::vector< std::string > | createGeometries (GeoLib::GEOObjects &geo, std::vector< std::string > const &layer_names, MathLib::Point3d const &pnt_start, MathLib::Point3d const &pnt_end, double const resolution) |
creates a mapped line for each of the mesh layers More... | |
void | mergeGeometries (GeoLib::GEOObjects &geo, std::vector< std::string > const &geo_names, std::string &merged_geo_name) |
std::pair< Eigen::Matrix3d, double > | rotateGeometryToXY (std::vector< GeoLib::Point * > &points) |
rotates the merged geometry into the XY-plane More... | |
void | consolidateGeometry (GeoLib::GEOObjects &geo, std::string const &output_name, std::string &merged_geo_name, bool const keep_gml_file) |
MeshLib::Mesh * | generateMesh (GeoLib::GEOObjects &geo, std::string const &geo_name, std::string const &output_name, double res) |
converts geometry into GMSH format and creates mesh More... | |
void | rotateMesh (MeshLib::Mesh &mesh, Eigen::Matrix3d const &rot_mat, double const z_shift) |
inverse rotation of the mesh, back into original position More... | |
MeshLib::Mesh * | removeLineElements (MeshLib::Mesh const &mesh) |
removes line elements from mesh such that only triangles remain More... | |
void | writeBoundary (MeshLib::Mesh const &mesh, std::vector< std::size_t > const &idx_array, std::string const &file_name) |
void | extractBoundaries (MeshLib::Mesh const &mesh, std::string const &output_name, MathLib::Point3d const &pnt_start) |
int | main (int argc, char *argv[]) |
void consolidateGeometry | ( | GeoLib::GEOObjects & | geo, |
std::string const & | output_name, | ||
std::string & | merged_geo_name, | ||
bool const | keep_gml_file | ||
) |
This encapsulates a workaround: For unknown reasons, the GML->GEO converter will not work correctly when inputting the merged geometry directly. However, if the geometry is saved to a file and immedeately loaded again, everything works fine.
Definition at line 197 of file VerticalSliceFromLayers.cpp.
References BaseLib::IO::XMLInterface::export_name, GeoLib::IO::XmlGmlInterface::readFile(), BaseLib::removeFile(), GeoLib::GEOObjects::removePointVec(), GeoLib::GEOObjects::removePolylineVec(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().
Referenced by main().
std::vector<std::string> createGeometries | ( | GeoLib::GEOObjects & | geo, |
std::vector< std::string > const & | layer_names, | ||
MathLib::Point3d const & | pnt_start, | ||
MathLib::Point3d const & | pnt_end, | ||
double const | resolution | ||
) |
creates a mapped line for each of the mesh layers
Definition at line 82 of file VerticalSliceFromLayers.cpp.
References GeoLib::GEOObjects::addPointVec(), GeoLib::GEOObjects::addPolylineVec(), createPoints(), createPolyline(), ERR(), GeoLib::GEOObjects::getPointVec(), MeshGeoToolsLib::GeoMapper::mapOnMesh(), and MeshLib::IO::readMeshFromFile().
Referenced by main().
std::unique_ptr<std::vector<GeoLib::Point*> > createPoints | ( | MathLib::Point3d const & | start, |
MathLib::Point3d const & | end, | ||
std::size_t const | n_intervals | ||
) |
creates a vector of sampling points based on the specified resolution
Definition at line 47 of file VerticalSliceFromLayers.cpp.
References MathLib::sqrDist().
Referenced by createGeometries().
GeoLib::Polyline* createPolyline | ( | std::vector< GeoLib::Point * > const & | points | ) |
creates a polyline to be mapped on a mesh layer
Definition at line 70 of file VerticalSliceFromLayers.cpp.
References GeoLib::Polyline::addPoint().
Referenced by createGeometries().
void extractBoundaries | ( | MeshLib::Mesh const & | mesh, |
std::string const & | output_name, | ||
MathLib::Point3d const & | pnt_start | ||
) |
Definition at line 293 of file VerticalSliceFromLayers.cpp.
References MeshLib::BoundaryExtraction::getBoundaryElementsAsMesh(), MeshLib::Mesh::getMinEdgeLength(), and writeBoundary().
Referenced by main().
MeshLib::Mesh* generateMesh | ( | GeoLib::GEOObjects & | geo, |
std::string const & | geo_name, | ||
std::string const & | output_name, | ||
double | res | ||
) |
converts geometry into GMSH format and creates mesh
Definition at line 220 of file VerticalSliceFromLayers.cpp.
References ERR(), FileIO::GMSH::FixedMeshDensity, FileIO::GMSH::readGMSHMesh(), FileIO::GMSH::GMSHInterface::writePhysicalGroups(), BaseLib::IO::writeStringToFile(), and BaseLib::IO::Writer::writeToString().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 350 of file VerticalSliceFromLayers.cpp.
References consolidateGeometry(), createGeometries(), ERR(), extractBoundaries(), generateMesh(), GeoLib::GEOObjects::getPointVec(), mergeGeometries(), GitInfoLib::GitInfo::ogs_version, BaseLib::IO::readStringListFromFile(), BaseLib::removeFile(), removeLineElements(), rotateGeometryToXY(), rotateMesh(), MeshLib::MeshRevision::simplifyMesh(), MathLib::sqrDist(), and MeshLib::IO::VtuInterface::writeToFile().
void mergeGeometries | ( | GeoLib::GEOObjects & | geo, |
std::vector< std::string > const & | geo_names, | ||
std::string & | merged_geo_name | ||
) |
Merges all layer geometries into one. Each layer is specified by one polygon. This will ensure that GMSH deals with the subsequent assignment of material groups automatically.
Definition at line 125 of file VerticalSliceFromLayers.cpp.
References GeoLib::Polyline::addPoint(), GeoLib::GEOObjects::addPointVec(), GeoLib::GEOObjects::addPolylineVec(), GeoLib::Polyline::getPointID(), and GeoLib::GEOObjects::getPointVec().
Referenced by main().
MeshLib::Mesh* removeLineElements | ( | MeshLib::Mesh const & | mesh | ) |
removes line elements from mesh such that only triangles remain
Definition at line 259 of file VerticalSliceFromLayers.cpp.
References MeshLib::Mesh::getElements().
Referenced by main().
std::pair<Eigen::Matrix3d, double> rotateGeometryToXY | ( | std::vector< GeoLib::Point * > & | points | ) |
rotates the merged geometry into the XY-plane
Definition at line 174 of file VerticalSliceFromLayers.cpp.
References GeoLib::computeRotationMatrixToXY(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), GeoLib::getNewellPlane(), MathLib::p, and GeoLib::rotatePoints().
Referenced by main().
void rotateMesh | ( | MeshLib::Mesh & | mesh, |
Eigen::Matrix3d const & | rot_mat, | ||
double const | z_shift | ||
) |
inverse rotation of the mesh, back into original position
Definition at line 249 of file VerticalSliceFromLayers.cpp.
References MeshLib::Mesh::getNodes(), and GeoLib::rotatePoints().
Referenced by main().
void writeBoundary | ( | MeshLib::Mesh const & | mesh, |
std::vector< std::size_t > const & | idx_array, | ||
std::string const & | file_name | ||
) |
Definition at line 278 of file VerticalSliceFromLayers.cpp.
References ERR(), MeshLib::removeElements(), and MeshLib::IO::VtuInterface::writeToFile().
Referenced by extractBoundaries().