main.cpp 605 Bytes
Newer Older
1
2
#include <cstdlib>
#include <iostream>
3
#include <string>
4
5
6
7
8

#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"

int main(int argc, char* argv[]) {
9
10
11
12
13
14
15
16
17
18
19
20
21
22
	libMesh::LibMeshInit init(argc, argv);

	if (argc < 2) {
		libmesh_error_msg("Usage: " << argv[0] << "in.mesh [-o out.mesh]");
	}
	const auto& input_mesh = std::string { argv[1] };

	libMesh::Mesh mesh(init.comm());
	mesh.read(input_mesh);
	mesh.print_info();

	using namespace std::string_literals;
	if (argc >= 4 && "-o"s == argv[2]) {
		const auto& output_filename = std::string { argv[3] };
23

24
25
		mesh.write(output_filename);
	}
26

27
	return EXIT_SUCCESS;
28
}