Skip to content
main.cpp 605 B
Newer Older
#include <cstdlib>
#include <iostream>
#include <string>

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

int main(int argc, char* argv[]) {
	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] };
		mesh.write(output_filename);
	}
	return EXIT_SUCCESS;