55 int const number_of_subdivisions,
56 std::string&& polyline_name,
57 std::string& geometry_name,
61 point0, point1, number_of_subdivisions);
62 std::vector<GeoLib::Point*> points(intermediate_points.begin(),
63 intermediate_points.end());
64 geometry.
addPointVec(std::move(points), geometry_name,
68 std::vector<std::size_t> polyline_point_ids(point_vec.getVector().size());
69 std::iota(begin(polyline_point_ids), end(polyline_point_ids), 0);
73 std::move(polyline_name));
80 std::array<GeoLib::Point, 4>
const& points,
81 std::array<int, 4>
const& number_of_subdivisions_per_edge)
83 std::vector<GeoLib::Point*> quad_points;
85 auto addPointsOnLine = [&quad_points](
auto const& begin,
auto const& end,
86 auto const number_of_subdivisions)
89 begin, end, number_of_subdivisions);
90 quad_points.insert(quad_points.end(), intermediate_points.begin(),
91 --intermediate_points.end());
92 delete intermediate_points.back();
96 addPointsOnLine(points[0], points[1], number_of_subdivisions_per_edge[0]);
97 addPointsOnLine(points[1], points[2], number_of_subdivisions_per_edge[1]);
98 addPointsOnLine(points[2], points[3], number_of_subdivisions_per_edge[2]);
99 addPointsOnLine(points[3], points[0], number_of_subdivisions_per_edge[3]);
106 int const number_of_subdivisions_first_x,
107 int const number_of_subdivisions_second_x,
108 int const number_of_subdivisions_first_y,
109 int const number_of_subdivisions_second_y,
110 int const number_of_subdivisions_first_z,
111 int const number_of_subdivisions_second_z,
112 std::string&& quad_name, std::string& geometry_name,
115 std::array<GeoLib::Point, 4> edge_points;
116 edge_points[0] = point0;
117 edge_points[2] = point1;
118 std::array<int, 4> number_of_subdivisions;
119 if (point0[0] != point1[0] && point0[1] != point1[1] &&
120 point0[2] == point1[2])
127 number_of_subdivisions = {
128 number_of_subdivisions_first_x, number_of_subdivisions_first_y,
129 number_of_subdivisions_second_x, number_of_subdivisions_second_y};
131 else if (point0[0] != point1[0] && point0[1] == point1[1] &&
132 point0[2] != point1[2])
139 number_of_subdivisions = {
140 number_of_subdivisions_first_x, number_of_subdivisions_first_z,
141 number_of_subdivisions_second_x, number_of_subdivisions_second_z};
143 else if (point0[0] == point1[0] && point0[1] != point1[1] &&
144 point0[2] != point1[2])
151 number_of_subdivisions = {
152 number_of_subdivisions_first_y, number_of_subdivisions_first_z,
153 number_of_subdivisions_second_y, number_of_subdivisions_second_z};
157 ERR(
"Input coordinates don't describe an axis aligned polyline or "
167 std::vector<std::size_t> polyline_point_ids(point_vec.getVector().size() +
169 std::iota(begin(polyline_point_ids), end(polyline_point_ids), 0);
170 polyline_point_ids.back() = polyline_point_ids.front();
174 std::move(quad_name));
177 std::move(name_map));
181int main(
int argc,
char* argv[])
184 "Generate point, axis parallel polyline or axis parallel quad "
186 "OpenGeoSys-6 software, version " +
189 "Copyright (c) 2012-2024, OpenGeoSys Community "
190 "(http://www.opengeosys.org)",
192 TCLAP::ValueArg<double> z0(
"",
"z0",
"z coordinate of the first point",
195 TCLAP::ValueArg<double> y0(
"",
"y0",
"y coordinate of the first point",
198 TCLAP::ValueArg<double> x0(
"",
"x0",
"x coordinate of the first point",
201 TCLAP::ValueArg<double> z1(
"",
"z1",
"z coordinate of the first point",
204 TCLAP::ValueArg<double> y1(
"",
"y1",
"y coordinate of the first point",
207 TCLAP::ValueArg<double> x1(
"",
"x1",
"x coordinate of the first point",
210 TCLAP::ValueArg<int> nx(
"",
"nx",
"number of subdivisions in x direction",
211 false, 0,
"number of subdivisions in x direction");
213 TCLAP::ValueArg<int> nx1(
"",
"nx1",
"number of subdivisions in x direction",
215 "number of subdivisions in x direction");
217 TCLAP::ValueArg<int> ny(
"",
"ny",
"number of subdivisions in y direction",
218 false, 0,
"number of subdivisions in y direction");
220 TCLAP::ValueArg<int> ny1(
"",
"ny1",
"number of subdivisions in y direction",
222 "number of subdivisions in y direction");
224 TCLAP::ValueArg<int> nz(
"",
"nz",
"number of subdivisions in z direction",
225 false, 0,
"number of subdivisions in z direction");
227 TCLAP::ValueArg<int> nz1(
"",
"nz1",
"number of subdivisions in z direction",
229 "number of subdivisions in z direction");
231 TCLAP::ValueArg<std::string> geometry_name(
232 "",
"geometry_name",
"name of the generated geometry",
false,
233 "conceptual model",
"name of the geometry");
234 cmd.add(geometry_name);
235 TCLAP::ValueArg<std::string> polyline_name(
236 "",
"polyline_name",
"name of the generated polyline",
false,
237 "polyline",
"name of the generated polyline");
238 cmd.add(polyline_name);
239 TCLAP::ValueArg<std::string> geo_output_arg(
240 "o",
"output",
"output geometry file (*.gml)",
true,
"",
"output file");
241 cmd.add(geo_output_arg);
242 cmd.parse(argc, argv);
245 MPI_Init(&argc, &argv);
248 auto const p0 =
GeoLib::Point{x0.getValue(), y0.getValue(), z0.getValue()};
249 auto const p1 =
GeoLib::Point{x1.getValue(), y1.getValue(), z1.getValue()};
252 auto constexpr eps = std::numeric_limits<double>::epsilon();
253 if (p1[0] - p0[0] < eps && p1[1] - p0[1] < eps && p1[2] - p0[2] < eps)
256 geometry_name.getValue(), geometry);
258 else if ((p1[0] - p0[0] >= eps && p1[1] - p0[1] < eps &&
259 p1[2] - p0[2] < eps) ||
260 (p1[0] - p0[0] < eps && p1[1] - p0[1] >= eps &&
261 p1[2] - p0[2] < eps) ||
262 (p1[0] - p0[0] < eps && p1[1] - p0[1] < eps &&
263 p1[2] - p0[2] >= eps))
266 std::move(polyline_name.getValue()),
267 geometry_name.getValue(), geometry);
271 auto eval = [](
int v,
int v1)
283 p0, p1, nx.getValue(), eval(nx.getValue(), nx1.getValue()),
284 ny.getValue(), eval(ny.getValue(), ny1.getValue()),
285 nz.getValue(), eval(nz.getValue(), nz1.getValue()),
286 std::move(polyline_name.getValue()), geometry_name.getValue(),
287 geometry) == EXIT_FAILURE)
299 geo_output_arg.getValue());
int generateQuadGeometry(GeoLib::Point const &point0, GeoLib::Point const &point1, int const number_of_subdivisions_first_x, int const number_of_subdivisions_second_x, int const number_of_subdivisions_first_y, int const number_of_subdivisions_second_y, int const number_of_subdivisions_first_z, int const number_of_subdivisions_second_z, std::string &&quad_name, std::string &geometry_name, GeoLib::GEOObjects &geometry)