OGS
createQuadraticMesh.cpp
Go to the documentation of this file.
1
10#include <tclap/CmdLine.h>
11
12#ifdef USE_PETSC
13#include <mpi.h>
14#endif
15
16#include <memory>
17#include <string>
18
19#include "InfoLib/GitInfo.h"
22#include "MeshLib/Mesh.h"
24
25int main(int argc, char* argv[])
26{
27 TCLAP::CmdLine cmd(
28 "Create quadratic order mesh.\n\n"
29 "OpenGeoSys-6 software, version " +
31 ".\n"
32 "Copyright (c) 2012-2024, OpenGeoSys Community "
33 "(http://www.opengeosys.org)",
35
36 TCLAP::ValueArg<std::string> input_arg(
37 "i", "input-mesh-file", "input mesh file", true, "", "string");
38 cmd.add(input_arg);
39 TCLAP::ValueArg<std::string> output_arg(
40 "o", "output-mesh-file", "output mesh file", true, "", "string");
41 cmd.add(output_arg);
42 TCLAP::SwitchArg add_centre_node_arg("c", "add-centre-node",
43 "add centre node", false);
44 cmd.add(add_centre_node_arg);
45 cmd.parse(argc, argv);
46
47#ifdef USE_PETSC
48 MPI_Init(&argc, &argv);
49#endif
50
51 std::unique_ptr<MeshLib::Mesh> mesh(
52 MeshLib::IO::readMeshFromFile(input_arg.getValue()));
53 if (!mesh)
54 {
55#ifdef USE_PETSC
56 MPI_Finalize();
57#endif
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#ifdef USE_PETSC
69 MPI_Finalize();
70#endif
71 return EXIT_SUCCESS;
72}
Git information.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Definition of the Mesh class.
int main(int argc, char *argv[])
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.