OGS
checkMesh.cpp File Reference

Detailed Description

Definition in file checkMesh.cpp.

#include <tclap/CmdLine.h>
#include <array>
#include <string>
#include "BaseLib/FileTools.h"
#include "BaseLib/MemWatch.h"
#include "BaseLib/RunTime.h"
#include "BaseLib/StringTools.h"
#include "GeoLib/AABB.h"
#include "InfoLib/GitInfo.h"
#include "MeshLib/Elements/Element.h"
#include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/MeshInformation.h"
#include "MeshLib/MeshQuality/MeshValidation.h"
#include "MeshLib/Node.h"
Include dependency graph for checkMesh.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 28 of file checkMesh.cpp.

29 {
30  TCLAP::CmdLine cmd(
31  "Checks mesh properties.\n\n"
32  "OpenGeoSys-6 software, version " +
34  ".\n"
35  "Copyright (c) 2012-2021, OpenGeoSys Community "
36  "(http://www.opengeosys.org)",
38  TCLAP::UnlabeledValueArg<std::string> mesh_arg(
39  "mesh-file", "input mesh file", true, "", "string");
40  cmd.add(mesh_arg);
41  TCLAP::SwitchArg valid_arg("v", "validation", "validate the mesh");
42  cmd.add(valid_arg);
43  TCLAP::SwitchArg print_properties_arg(
44  "p", "print_properties", "print properties stored in the mesh");
45  cmd.add(print_properties_arg);
46 
47  cmd.parse(argc, argv);
48 
49  // read the mesh file
50  BaseLib::MemWatch mem_watch;
51  const unsigned long mem_without_mesh(mem_watch.getVirtMemUsage());
52  BaseLib::RunTime run_time;
53  run_time.start();
54  std::unique_ptr<MeshLib::Mesh> mesh(
55  MeshLib::IO::readMeshFromFile(mesh_arg.getValue()));
56  if (!mesh)
57  {
58  return EXIT_FAILURE;
59  }
60 
61  const unsigned long mem_with_mesh(mem_watch.getVirtMemUsage());
62  if (mem_with_mesh > 0)
63  {
64  INFO("Memory size: {} MiB",
65  (mem_with_mesh - mem_without_mesh) / (1024 * 1024));
66  (void)mem_with_mesh;
67  }
68  INFO("Time for reading: {:g} s", run_time.elapsed());
69 
70  // Geometric information
72  auto minPt(aabb.getMinPoint());
73  auto maxPt(aabb.getMaxPoint());
74  INFO("Node coordinates:");
75  INFO("\tx [{:g}, {:g}] (extent {:g})", minPt[0], maxPt[0],
76  maxPt[0] - minPt[0]);
77  INFO("\ty [{:g}, {:g}] (extent {:g})", minPt[1], maxPt[1],
78  maxPt[1] - minPt[1]);
79  INFO("\tz [{:g}, {:g}] (extent {:g})", minPt[2], maxPt[2],
80  maxPt[2] - minPt[2]);
81 
82  INFO("Edge length: [{:g}, {:g}]", mesh->getMinEdgeLength(),
83  mesh->getMaxEdgeLength());
84 
85  // Element information
86 
88 
90 
91  if (valid_arg.isSet())
92  {
93  // MeshValidation outputs error messages
94  // Remark: MeshValidation can modify the original mesh
96  }
97 }
void INFO(char const *fmt, Args const &... args)
Definition: Logging.h:32
unsigned long getVirtMemUsage()
Definition: MemWatch.cpp:59
Count the running time.
Definition: RunTime.h:29
double elapsed() const
Get the elapsed time in seconds.
Definition: RunTime.h:42
void start()
Start the timer.
Definition: RunTime.h:32
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition: AABB.h:49
static void writePropertyVectorInformation(const MeshLib::Mesh &mesh)
writes out property vector information
static GeoLib::AABB getBoundingBox(const MeshLib::Mesh &mesh)
Returns the bounding box of the mesh.
static void writeMeshValidationResults(MeshLib::Mesh &mesh)
static void writeAllNumbersOfElementTypes(const MeshLib::Mesh &mesh)
writes all numbers of element types
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name)

References BaseLib::RunTime::elapsed(), MeshLib::MeshInformation::getBoundingBox(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), BaseLib::MemWatch::getVirtMemUsage(), INFO(), GitInfoLib::GitInfo::ogs_version, MeshLib::IO::readMeshFromFile(), BaseLib::RunTime::start(), MeshLib::MeshInformation::writeAllNumbersOfElementTypes(), MeshLib::MeshInformation::writeMeshValidationResults(), and MeshLib::MeshInformation::writePropertyVectorInformation().