27int main(
int argc,
char* argv[])
30 "Tool merges one mesh to a bulk mesh.\n\n"
31 "OpenGeoSys-6 software, version " +
34 "Copyright (c) 2012-2026, OpenGeoSys Community "
35 "(http://www.opengeosys.org)",
37 TCLAP::ValueArg<std::string> bulk_mesh_in(
38 "b",
"bulk-mesh-input-file",
39 "Input (.vtk | .msh). The name of the file containing the input bulk "
41 true,
"",
"INPUT_FILE");
42 cmd.add(bulk_mesh_in);
43 TCLAP::ValueArg<std::string> mesh_in(
44 "i",
"mesh-input-file",
45 "Input (.vtk | .msh). The name of the file containing the input mesh "
47 true,
"",
"INPUT_FILE");
49 TCLAP::ValueArg<std::string> mesh_out(
50 "o",
"mesh-output-file",
51 "Output (.vtk | .msh). The name of the file the merged mesh should be "
53 true,
"",
"OUTPUT_FILE");
56 TCLAP::ValueArg<double> p(
"",
"pressure",
57 "initial pressure value in the mesh to be merged",
58 false, 0.0,
"PRESSURE");
61 TCLAP::ValueArg<double> pg(
63 "initial gas pressure value in the mesh to be merged",
false, 0.0,
67 TCLAP::ValueArg<double> pc(
68 "",
"capillary_pressure",
69 "initial capillary pressure value in the mesh to be merged",
false, 0.0,
70 "CAPILLARY_PRESSURE");
73 TCLAP::ValueArg<double> T(
74 "",
"temperature",
"initial temperature value in the mesh to be merged",
75 false, 290.0,
"TEMPERATURE");
78 TCLAP::ValueArg<double> sxx(
79 "",
"sigma_xx",
"initial stress xx value in the mesh to be merged",
80 false, 0.0,
"SIGMA_XX");
82 TCLAP::ValueArg<double> syy(
83 "",
"sigma_yy",
"initial stress yy value in the mesh to be merged",
84 false, 0.0,
"SIGMA_YY");
86 TCLAP::ValueArg<double> szz(
87 "",
"sigma_zz",
"initial stress zz value in the mesh to be merged",
88 false, 0.0,
"SIGMA_ZZ");
91 TCLAP::ValueArg<int> mat_id(
92 "",
"material_id",
"Material ID of the mesh to be merged, (min = 0)",
93 false, 0.0,
"MATERIAL_ID");
96 cmd.add(log_level_arg);
98 cmd.parse(argc, argv);
106 std::unordered_map<std::string, double> initial_value_dict;
107 initial_value_dict.insert({
"p", p.getValue()});
108 initial_value_dict.insert({
"pg", pg.getValue()});
109 initial_value_dict.insert({
"pc", pc.getValue()});
110 initial_value_dict.insert({
"T", T.getValue()});
111 initial_value_dict.insert({
"sxx", sxx.getValue()});
112 initial_value_dict.insert({
"syy", syy.getValue()});
113 initial_value_dict.insert({
"szz", szz.getValue()});
114 initial_value_dict.insert({
"mat_id", mat_id.getValue()});
116 auto read_mesh = [](std::string
const& mesh_file_name)
119 mesh_file_name,
true ));
123 OGS_FATAL(
"Could not read the mesh {:s}", mesh_file_name);
126 INFO(
"Read {:s}: {:d} nodes, {:d} elements.", mesh_file_name,
127 mesh->getNumberOfNodes(), mesh->getNumberOfElements());
131 auto bulk_mesh = read_mesh(bulk_mesh_in.getValue());
132 auto const mesh_to_be_merged = read_mesh(mesh_in.getValue());
135 *bulk_mesh, *mesh_to_be_merged, initial_value_dict);
140 ERR(
"Could not write mesh to '{:s}'.", mesh_out.getValue());
150 mesh_to_be_merged->shallowClean();
151 bulk_mesh->shallowClean();
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, std::set< std::string > output_variable_names, bool const use_compression, int const data_mode)