main.cpp 664 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <cstdlib>
#include <iostream>

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

using namespace libMesh;

int main(int argc, char* argv[]) {
  LibMeshInit init(argc, argv);

  if (argc < 4) {
    libmesh_error_msg("Usage: " << argv[0] << " -d 2 in.mesh [-o out.mesh]");
  }
  const unsigned int dim = std::atoi(argv[2]);
  Mesh mesh(init.comm());
  std::string input_filename = argv[3];
  mesh.read(argv[3]);
  mesh.print_info();
  if (argc >= 6 && std::string("-o") == argv[4]) {
    // We may need XDR support compiled in to read binary .xdr files
    std::string output_filename = argv[5];
    mesh.write(argv[5]);
  }

  return EXIT_SUCCESS;
}