Commit e0736748 authored by Thomas Steinreiter's avatar Thomas Steinreiter
Browse files

added working mesh bridge.e, refactoring

parent ed6a8b5a
......@@ -8,6 +8,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/common.cmake)
#TODO: this is ugly, use cached variables
set(LIBMESH_INCLUDE_PATH $ENV{HOME}/libmesh/libmesh_install/include)
set(LIBMESH_LIBRARY_PATH $ENV{HOME}/libmesh/libmesh_install/lib)
set(LOCAL_INCLUDE_PATH /usr/local/include)
set(LOCAL_LIBRARY_PATH /usr/local/lib)
set(LIBMESH_LIBRARIES mesh_opt)
# ==================================================================================================
......
#include <cstdlib>
#include <iostream>
#include <string>
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
using namespace libMesh;
int main(int argc, char* argv[]) {
LibMeshInit init(argc, 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] };
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]);
}
mesh.write(output_filename);
}
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}
# Example meshes are from http://mooseframework.org/ and therefore licenced under
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
......
This diff is collapsed.
libMesh-0.7.0+
1 # number of elements
27 # number of nodes
. # boundary condition specification file
n/a # subdomain id specification file
n/a # processor id specification file
n/a # p-level specification file
1 # n_elem at level 0, [ type (n0 ... nN-1) ]
12 0 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
-1.00000000000000000e+00 -1.00000000000000000e+00 -1.00000000000000000e+00
1.00000000000000000e+00 -1.00000000000000000e+00 -1.00000000000000000e+00
1.00000000000000000e+00 1.00000000000000000e+00 -1.00000000000000000e+00
-1.00000000000000000e+00 1.00000000000000000e+00 -1.00000000000000000e+00
-1.00000000000000000e+00 -1.00000000000000000e+00 1.00000000000000000e+00
1.00000000000000000e+00 -1.00000000000000000e+00 1.00000000000000000e+00
1.00000000000000000e+00 1.00000000000000000e+00 1.00000000000000000e+00
-1.00000000000000000e+00 1.00000000000000000e+00 1.00000000000000000e+00
0.00000000000000000e+00 -1.00000000000000000e+00 -1.00000000000000000e+00
1.00000000000000000e+00 0.00000000000000000e+00 -1.00000000000000000e+00
0.00000000000000000e+00 1.00000000000000000e+00 -1.00000000000000000e+00
-1.00000000000000000e+00 0.00000000000000000e+00 -1.00000000000000000e+00
-1.00000000000000000e+00 -1.00000000000000000e+00 0.00000000000000000e+00
1.00000000000000000e+00 -1.00000000000000000e+00 0.00000000000000000e+00
1.00000000000000000e+00 1.00000000000000000e+00 0.00000000000000000e+00
-1.00000000000000000e+00 1.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 -1.00000000000000000e+00 1.00000000000000000e+00
1.00000000000000000e+00 0.00000000000000000e+00 1.00000000000000000e+00
0.00000000000000000e+00 1.00000000000000000e+00 1.00000000000000000e+00
-1.00000000000000000e+00 0.00000000000000000e+00 1.00000000000000000e+00
0.00000000000000000e+00 0.00000000000000000e+00 -1.00000000000000000e+00
0.00000000000000000e+00 -1.00000000000000000e+00 0.00000000000000000e+00
1.00000000000000000e+00 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 1.00000000000000000e+00 0.00000000000000000e+00
-1.00000000000000000e+00 0.00000000000000000e+00 0.00000000000000000e+00
0.00000000000000000e+00 0.00000000000000000e+00 1.00000000000000000e+00
0.00000000000000000e+00 0.00000000000000000e+00 0.00000000000000000e+00
6 # number of boundary conditions
0 0 0
0 1 1
0 2 2
0 3 3
0 4 4
0 5 5
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment