NLMech  0.1.0
mshReader.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef RW_MSHREADER_H
10 #define RW_MSHREADER_H
11 
12 #include "util/point.h" // definition of Point3
13 #include <fstream>
14 #include <string>
15 #include <vector>
16 
17 namespace rw {
18 
19 namespace reader {
20 
25 class MshReader {
26 
27 public:
32  explicit MshReader(const std::string &filename);
33 
46  void readMesh(size_t dim, std::vector<util::Point3> *nodes,
47  size_t &element_type, size_t &num_elem,
48  std::vector<size_t> *enc, std::vector<std::vector<size_t>> *nec,
49  std::vector<double> *volumes, bool is_fd = false);
50 
56  void readNodes(std::vector<util::Point3> *nodes);
57 
64  bool readPointData(const std::string &name, std::vector<util::Point3> *data);
65 
72  bool readPointData(const std::string &name, std::vector<double> *data);
73 
75  void close();
76 
77 private:
79  std::string d_filename;
80 
82  std::ifstream d_file;
83 };
84 
85 } // namespace reader
86 
87 } // namespace rw
88 
89 #endif // RW_MSHREADER_H
A class to read Gmsh (msh) mesh files.
Definition: mshReader.h:25
std::string d_filename
filename
Definition: mshReader.h:79
void readNodes(std::vector< util::Point3 > *nodes)
Reads nodal position.
Definition: mshReader.cpp:116
void readMesh(size_t dim, std::vector< util::Point3 > *nodes, size_t &element_type, size_t &num_elem, std::vector< size_t > *enc, std::vector< std::vector< size_t >> *nec, std::vector< double > *volumes, bool is_fd=false)
Reads mesh data into node file and element file.
Definition: mshReader.cpp:20
bool readPointData(const std::string &name, std::vector< util::Point3 > *data)
reads point data from .vtu file
Definition: mshReader.cpp:151
void close()
Close the file.
Definition: mshReader.cpp:295
MshReader(const std::string &filename)
Constructor.
Definition: mshReader.cpp:17
std::ifstream d_file
vtk/vtu file
Definition: mshReader.h:82
Data mamanger to share the global simulation data between the classes.
Definition: DataManager.h:55
Collection of methods and database related to reading and writing.
Definition: QuasiStaticModel.h:60