12#include <tclap/CmdLine.h>
29int main(
int argc,
char* argv[])
32 "Moves the mesh nodes using the given displacement vector or if no "
33 "displacement vector is given, moves the mesh nodes such that the "
34 "centroid of the given mesh is in the origin.\n\n"
35 "OpenGeoSys-6 software, version " +
38 "Copyright (c) 2012-2024, OpenGeoSys Community "
39 "(http://www.opengeosys.org)",
44 TCLAP::ValueArg<std::string> mesh_arg(
"m",
"mesh",
"input mesh file",
true,
51 TCLAP::ValueArg<double> x_arg(
"x",
"x",
"displacement in x direction",
52 false, 0.0,
"floating point number");
54 TCLAP::ValueArg<double> y_arg(
"y",
"y",
"displacement in y direction",
55 false, 0.0,
"floating point number");
57 TCLAP::ValueArg<double> z_arg(
"z",
"z",
"displacement in z direction",
58 false, 0.0,
"floating point number");
61 TCLAP::ValueArg<std::string> mesh_out_arg(
62 "o",
"output-mesh",
"output mesh file",
false,
"",
"string");
63 cmd.add(mesh_out_arg);
65 cmd.parse(argc, argv);
68 MPI_Init(&argc, &argv);
70 std::string fname(mesh_arg.getValue());
76 ERR(
"Could not read mesh from file '{:s}'.", fname);
83 Eigen::Vector3d displacement{x_arg.getValue(), y_arg.getValue(),
85 if (fabs(x_arg.getValue()) < std::numeric_limits<double>::epsilon() &&
86 fabs(y_arg.getValue()) < std::numeric_limits<double>::epsilon() &&
87 fabs(z_arg.getValue()) < std::numeric_limits<double>::epsilon())
89 GeoLib::AABB aabb(mesh->getNodes().begin(), mesh->getNodes().end());
91 displacement = -(max + min) / 2.0;
94 INFO(
"translate model ({:f}, {:f}, {:f}).",
99 mesh->getNodes().end(), displacement);
101 std::string out_fname(mesh_out_arg.getValue());
102 if (out_fname.empty())
105 out_fname +=
"_displaced.vtu";
Definition of the AABB class.
Definition of the Element class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
int main(int argc, char *argv[])
Definition of the Node class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
MinMaxPoints getMinMaxPoints() const
Functionality to move mesh nodes using a given displacement vec.
std::string dropFileExtension(std::string const &filename)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name, bool const compute_element_neighbors)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, std::set< std::string > variable_output_names)
Definition of readMeshFromFile function.