15 #include <tclap/CmdLine.h>
21 int main(
int argc,
char* argv[])
24 "Moves the points of a geometry by a given displacement vector\n\n"
25 "OpenGeoSys-6 software, version " +
28 "Copyright (c) 2012-2021, OpenGeoSys Community "
29 "(http://www.opengeosys.org)",
31 TCLAP::ValueArg<double> z_arg(
"z",
"z",
"displacement in z direction",
32 false, 0.0,
"z-displacement");
34 TCLAP::ValueArg<double> y_arg(
"y",
"y",
"displacement in y direction",
35 false, 0.0,
"y-displacement");
37 TCLAP::ValueArg<double> x_arg(
"x",
"x",
"displacement in x direction",
38 false, 0.0,
"x-displacement");
40 TCLAP::ValueArg<std::string> geo_output_arg(
41 "o",
"output",
"output geometry file (*.gml)",
true,
"",
"output file");
42 cmd.add(geo_output_arg);
43 TCLAP::ValueArg<std::string> geo_input_arg(
44 "i",
"input",
"input geometry file (*.gml)",
true,
"",
"input file");
45 cmd.add(geo_input_arg);
46 cmd.parse(argc, argv);
52 if (!xml.
readFile(geo_input_arg.getValue()))
57 catch (std::runtime_error
const& err)
59 ERR(
"Failed to read file `{:s}'.", geo_input_arg.getValue());
60 ERR(
"{:s}", err.what());
64 Eigen::Vector3d displacement = Eigen::Vector3d::Zero();
67 displacement[0] = x_arg.getValue();
71 displacement[1] = y_arg.getValue();
75 displacement[2] = z_arg.getValue();
80 std::vector<GeoLib::Point*>
const* point_vec =
82 std::size_t
const n_points = point_vec->size();
83 for (std::size_t i = 0; i < n_points; ++i)
85 for (std::size_t
c = 0;
c < 3; ++
c)
87 (*(*point_vec)[i])[
c] += displacement[
c];
93 geo_output_arg.getValue());
Definition of the BoostXmlGmlInterface class.
Definition of the GEOObjects class.
void ERR(char const *fmt, Args const &... args)
int main(int argc, char *argv[])
std::string writeToString()
Writes the object to a string.
Container class for geometric objects.
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
const std::vector< Point * > * getPointVec(const std::string &name) const
bool readFile(const std::string &fname) override
Reads an xml-file containing OGS geometry.
int writeStringToFile(std::string content, std::filesystem::path const &file_path)
GITINFOLIB_EXPORT const std::string ogs_version