OGS
createQuadraticMesh.cpp
Go to the documentation of this file.
1
10#include <tclap/CmdLine.h>
11
12#include <memory>
13#include <string>
14
15#include "BaseLib/Logging.h"
16#include "BaseLib/MPI.h"
18#include "InfoLib/GitInfo.h"
21#include "MeshLib/Mesh.h"
23
24int main(int argc, char* argv[])
25{
26 TCLAP::CmdLine cmd(
27 "Create quadratic order mesh.\n\n"
28 "OpenGeoSys-6 software, version " +
30 ".\n"
31 "Copyright (c) 2012-2025, OpenGeoSys Community "
32 "(http://www.opengeosys.org)",
34
35 TCLAP::ValueArg<std::string> input_arg("i", "input-mesh-file",
36 "Input (.vtu | .msh) mesh file",
37 true, "", "INPUT_FILE");
38 cmd.add(input_arg);
39 TCLAP::ValueArg<std::string> output_arg("o", "output-mesh-file",
40 "Output (.vtu | .msh) mesh file",
41 true, "", "OUTPUT_FILE");
42 cmd.add(output_arg);
43 TCLAP::SwitchArg add_centre_node_arg("c", "add-centre-node",
44 "add centre node", false);
45 cmd.add(add_centre_node_arg);
46
47 auto log_level_arg = BaseLib::makeLogLevelArg();
48 cmd.add(log_level_arg);
49 cmd.parse(argc, argv);
50
51 BaseLib::MPI::Setup mpi_setup(argc, argv);
52 BaseLib::initOGSLogger(log_level_arg.getValue());
53
54 std::unique_ptr<MeshLib::Mesh> mesh(
55 MeshLib::IO::readMeshFromFile(input_arg.getValue()));
56 if (!mesh)
57 {
58 return EXIT_FAILURE;
59 }
60
61 INFO("Create a quadratic order mesh");
63 *mesh, add_centre_node_arg.getValue()));
64
65 INFO("Save the new mesh into a file");
66 MeshLib::IO::writeMeshToFile(*new_mesh, output_arg.getValue());
67
68 return EXIT_SUCCESS;
69}
Git information.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:36
Definition of the Mesh class.
int main(int argc, char *argv[])
TCLAP::ValueArg< std::string > makeLogLevelArg()
void initOGSLogger(std::string const &log_level)
Definition Logging.cpp:64
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name, bool const compute_element_neighbors)
int writeMeshToFile(const MeshLib::Mesh &mesh, std::filesystem::path const &file_path, std::set< std::string > variable_output_names)
std::unique_ptr< MeshLib::Mesh > createQuadraticOrderMesh(MeshLib::Mesh const &linear_mesh, bool const add_centre_node)
Definition of readMeshFromFile function.