20int main(
int argc,
char* argv[])
23 "Moves the mesh nodes using the given displacement vector or if no "
24 "displacement vector is given, moves the mesh nodes such that the "
25 "centroid of the given mesh is in the origin.\n\n"
26 "OpenGeoSys-6 software, version " +
29 "Copyright (c) 2012-2026, OpenGeoSys Community "
30 "(http://www.opengeosys.org)",
35 TCLAP::ValueArg<std::string> mesh_arg(
"m",
"mesh",
"Input (.vtu) mesh file",
36 true,
"",
"INPUT_FILE");
42 TCLAP::ValueArg<double> x_arg(
"x",
"x",
"displacement in x direction",
43 false, 0.0,
"DISPLACEMENT_X");
45 TCLAP::ValueArg<double> y_arg(
"y",
"y",
"displacement in y direction",
46 false, 0.0,
"DISPLACEMENT_Y");
48 TCLAP::ValueArg<double> z_arg(
"z",
"z",
"displacement in z direction",
49 false, 0.0,
"DISPLACEMENT_Z");
52 TCLAP::ValueArg<std::string> mesh_out_arg(
"o",
"output-mesh",
53 "Output (.vtu) mesh file",
false,
55 cmd.add(mesh_out_arg);
58 cmd.add(log_level_arg);
59 cmd.parse(argc, argv);
64 std::string fname(mesh_arg.getValue());
70 ERR(
"Could not read mesh from file '{:s}'.", fname);
74 Eigen::Vector3d displacement{x_arg.getValue(), y_arg.getValue(),
76 if (fabs(x_arg.getValue()) < std::numeric_limits<double>::epsilon() &&
77 fabs(y_arg.getValue()) < std::numeric_limits<double>::epsilon() &&
78 fabs(z_arg.getValue()) < std::numeric_limits<double>::epsilon())
80 GeoLib::AABB aabb(mesh->getNodes().begin(), mesh->getNodes().end());
82 displacement = -(max + min) / 2.0;
85 INFO(
"translate model ({:f}, {:f}, {:f}).",
90 mesh->getNodes().end(), displacement);
92 std::string out_fname(mesh_out_arg.getValue());
93 if (out_fname.empty())
96 out_fname +=
"_displaced.vtu";