LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
read_mesh.cc
1
8
9#include "read_mesh.h"
10
12std::string getMeshPath(std::string mesh_name) {
13 std::string file_path = __FILE__;
14 // std file_path(__FILE__);
15 // get directory: go up two directories last index of / or backslash
16 int index = 0;
17 char separator;
18 char count = 2;
19 for (int i = file_path.length() - 1; i >= 0; --i) {
20 if (file_path[i] == '/' || file_path[i] == '\\') {
21 --count;
22 if (count == 0) {
23 index = i;
24 separator = file_path[i];
25 break;
26 }
27 }
28 }
29 std::string directory_path = file_path.substr(0, index + 1);
30 return directory_path + "test" + separator + "msh_files" + separator +
31 mesh_name;
32}
33
34GmshReader getGmshReader(std::string mesh_name, base::dim_t dim_world) {
35 return GmshReader(std::make_unique<mesh::hybrid2d::MeshFactory>(dim_world),
36 getMeshPath(mesh_name));
37}
38} // namespace lf::io::test_utils
Reads a Gmsh *.msh file into a mesh::MeshFactory and provides a link between mesh::Entity objects and...
Definition gmsh_reader.h:70
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
Definition types.h:32
std::string getMeshPath(std::string mesh_name)
Retrieve the full path to the file lib/lf/io/test/msh_files/<mesh_name>
Definition read_mesh.cc:12
GmshReader getGmshReader(std::string mesh_name, base::dim_t dim_world)
Get a GmshReader from the file lib/lf/io/test/msh_files/<mesh_name>.
Definition read_mesh.cc:34