14#include <spdlog/spdlog.h>
15#include <tclap/CmdLine.h>
16#include <vtkMPIController.h>
17#include <vtkSmartPointer.h>
27int main(
int argc,
char* argv[])
30 "Reads the binary mesh format and writes the data as vtus/pvtu.\n"
31 "OpenGeoSys-6 software, version " +
34 "Copyright (c) 2012-2024, OpenGeoSys Community "
35 "(http://www.opengeosys.org)",
37 TCLAP::ValueArg<std::string> mesh_input(
38 "i",
"mesh-input-file-base",
39 "the base name of the files containing the input mesh, i.e., the file "
40 "name without the string beginning with '_partitioned' and ending with "
42 true,
"",
"base_file_name_of_input_mesh");
45 TCLAP::ValueArg<std::string> output_directory_arg(
47 "output directory name and output base file name without extensions",
48 true,
"",
"directory/base_file_name_without_extensions");
49 cmd.add(output_directory_arg);
51 TCLAP::ValueArg<std::string> log_level_arg(
53 "the verbosity of logging messages: none, error, warn, info, debug, "
62 cmd.add(log_level_arg);
64 cmd.parse(argc, argv);
67 spdlog::set_pattern(
"%^%l:%$ %v");
68 spdlog::set_error_handler(
69 [](
const std::string& msg)
71 std::cerr <<
"spdlog error: " << msg << std::endl;
72 OGS_FATAL(
"spdlog logger error occurred.");
76 MPI_Init(&argc, &argv);
86 MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
87 spdlog::set_pattern(fmt::format(
"[{}] %^%l:%$ %v", mpi_rank));
90 vtkSmartPointer<vtkMPIController> controller =
91 vtkSmartPointer<vtkMPIController>::New();
92 controller->Initialize(&argc, &argv, 1);
93 vtkMPIController::SetGlobalController(controller);
98 INFO(
"Mesh '{:s}' read: {:d} nodes, {:d} elements.",
102 INFO(
"Mesh read runtime: {:g} s.", run_timer.
elapsed());
103 INFO(
"Mesh read CPU time: {:g} s.", CPU_timer.
elapsed());
106 auto const file_name = output_directory_arg.getValue() +
".vtu";
107 DBUG(
"Writing output to '{:s}'.", file_name);
112 INFO(
"Total runtime: {:g} s.", run_timer.
elapsed());
113 INFO(
"Total CPU time: {:g} s.", CPU_timer.
elapsed());
int main(int argc, char *argv[])
Definition of the CPUTime class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition of mesh class for partitioned mesh (by node) for parallel computing within the framework o...
Definition of the RunTime class.
Implementation of the VtuInterface class.
void start()
Start the timer.
double elapsed() const
Get the elapsed time after started.
double elapsed() const
Get the elapsed time in seconds.
void start()
Start the timer.
Reads and writes VtkXMLUnstructuredGrid-files (vtu) to and from OGS data structures....
bool writeToFile(std::filesystem::path const &file_path)
const std::string getName() const
Get name of the mesh.
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::size_t getNumberOfElements() const
Get the number of elements.
void setConsoleLogLevel(std::string const &level_string)
GITINFOLIB_EXPORT const std::string ogs_version
MeshLib::Mesh * readMeshFromFile(const std::string &file_name, bool const compute_element_neighbors)
Definition of readMeshFromFile function.