30{
31 TCLAP::CmdLine cmd(
32 "Maps geometric objects to the surface of a given mesh. "
33 "The documentation is available at "
34 "https://docs.opengeosys.org/docs/tools/model-preparation/"
35 "map-geometric-object-to-the-surface-of-a-mesh.\n\n"
36 "OpenGeoSys-6 software, version " +
38 ".\n"
39 "Copyright (c) 2012-2024, OpenGeoSys Community "
40 "(http://www.opengeosys.org)",
42 TCLAP::ValueArg<std::string> mesh_in(
43 "m", "mesh-file", "the name of the file containing the mesh", true, "",
44 "file name");
45 cmd.add(mesh_in);
46 TCLAP::ValueArg<std::string> input_geometry_fname(
47 "i", "input-geometry",
48 "the name of the file containing the input geometry", true, "",
49 "file name");
50 cmd.add(input_geometry_fname);
51 TCLAP::SwitchArg additional_insert_mapping(
52 "a", "additional-insert-mapping",
53 "Advanced mapping algorithm will be applied, i.e. a new geometry will "
54 "be created and possibly new points will be inserted.");
55 cmd.add(additional_insert_mapping);
56 TCLAP::ValueArg<std::string> output_geometry_fname(
57 "o", "output-geometry",
58 "the name of the file containing the input geometry", true, "",
59 "file name");
60 cmd.add(output_geometry_fname);
61 cmd.parse(argc, argv);
62
63#ifdef USE_PETSC
64 MPI_Init(&argc, &argv);
65#endif
66
67
69 {
71 if (xml_io.readFile(input_geometry_fname.getValue()))
72 {
73 INFO(
"Read geometry from file '{:s}'.",
74 input_geometry_fname.getValue());
75 }
76 else
77 {
78#ifdef USE_PETSC
79 MPI_Finalize();
80#endif
81 return EXIT_FAILURE;
82 }
83 }
84
86
88
89
91 mesh_in.getValue(), true ));
92
93 if (additional_insert_mapping.getValue())
94 {
95 geo_mapper.advancedMapOnMesh(*mesh);
96 }
97 else
98 {
99 geo_mapper.mapOnMesh(mesh.get());
100 }
101
102 {
104 xml_io.export_name = geo_name;
106 output_geometry_fname.getValue());
107 }
108#ifdef USE_PETSC
109 MPI_Finalize();
110#endif
111 return EXIT_SUCCESS;
112}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Container class for geometric objects.
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
int writeStringToFile(std::string_view content, std::filesystem::path const &file_path)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name, bool const compute_element_neighbors)