24int main(
int argc,
char* argv[])
27 "Tool to create gmsh geometry (geo-file) out of a gml geometry.\n\n"
28 "OpenGeoSys-6 software, version " +
31 "Copyright (c) 2012-2024, OpenGeoSys Community "
32 "(http://www.opengeosys.org)",
34 TCLAP::ValueArg<std::string> geo_output_arg(
35 "o",
"output",
"output gmsh geometry file (*.geo)",
true,
"",
37 cmd.add(geo_output_arg);
38 TCLAP::MultiArg<std::string> geo_input_arg(
39 "i",
"input",
"input geometry file (*.gml)",
true,
"input file name");
40 cmd.add(geo_input_arg);
41 TCLAP::ValueArg<unsigned> max_number_of_points_in_quadtree_leaf_arg(
42 "",
"max_points_in_quadtree_leaf",
"positive number",
false, 2,
43 "max points in a quadtree leaf before the leaf is split");
44 cmd.add(max_number_of_points_in_quadtree_leaf_arg);
45 TCLAP::ValueArg<double> mesh_density_scaling_points_arg(
46 "",
"mesh_density_scaling_at_points",
"positive floating point number",
47 false, 0.2,
"desired mesh density at points");
48 cmd.add(mesh_density_scaling_points_arg);
49 TCLAP::ValueArg<double> mesh_density_scaling_stations_arg(
50 "",
"mesh_density_scaling_at_stations",
51 "positive floating point number",
false, 0.05,
52 "desired mesh density at stations");
53 cmd.add(mesh_density_scaling_stations_arg);
54 TCLAP::ValueArg<double> average_point_density_arg(
55 "a",
"average_point_density",
56 "average point density / average edge length as a positive floating "
59 "desired point density / edge length in homogeneous meshing approach");
60 cmd.add(average_point_density_arg);
61 TCLAP::SwitchArg homogeneous_flag(
62 "",
"homogeneous",
"Use Gmsh homogeneous meshing method.",
false);
63 cmd.add(homogeneous_flag);
64 TCLAP::ValueArg<std::string> merged_geometries_output(
65 "",
"write_merged_geometries",
66 "file name for the output of the internal created geometry (*.gml) "
67 "(useful for debugging the data)",
68 false,
"",
"output file name");
69 cmd.add(merged_geometries_output);
71 cmd.parse(argc, argv);
74 MPI_Init(&argc, &argv);
78 for (
auto const& geometry_name : geo_input_arg.getValue())
91 catch (std::runtime_error
const& err)
93 ERR(
"Failed to read file '{:s}'.", geometry_name);
94 ERR(
"{:s}", err.what());
100 INFO(
"Successfully read file '{:s}'.", geometry_name);
105 bool const rotate =
false;
106 bool const keep_preprocessed_geometry =
false;
110 if (homogeneous_flag.getValue())
112 double const average_mesh_density =
113 average_point_density_arg.getValue();
117 average_mesh_density, 0.0, 0, geo_names, rotate,
118 keep_preprocessed_geometry);
120 geo_output_arg.getValue());
124 unsigned const max_number_of_points_in_quadtree_leaf =
125 max_number_of_points_in_quadtree_leaf_arg.getValue();
126 double const mesh_density_scaling_points =
127 mesh_density_scaling_points_arg.getValue();
128 double const mesh_density_scaling_stations =
129 mesh_density_scaling_stations_arg.getValue();
133 mesh_density_scaling_points, mesh_density_scaling_stations,
134 max_number_of_points_in_quadtree_leaf, geo_names, rotate,
135 keep_preprocessed_geometry);
137 geo_output_arg.getValue());
140 catch (std::runtime_error& error)
142 ERR(
"{}", error.what());
143 if (merged_geometries_output.isSet())
148 merged_geometries_output.getValue());
153 "Hint: Using the command line flag "
154 "'--write_merged_geometries buggy_geometry.gml' allows "
155 "for better analysis of the problem.");
157 ERR(
"An error has occurred - programme will be terminated.");