libMesh
tetgen_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_TETGEN_IO_H
21 #define LIBMESH_TETGEN_IO_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/mesh_input.h"
26 #include "libmesh/mesh_output.h"
27 
28 // C++ includes
29 #include <cstddef>
30 #include <map>
31 
32 namespace libMesh
33 {
34 
35 // Forward declarations
36 class MeshBase;
37 
38 
47 class TetGenIO : public MeshInput<MeshBase>,
48  public MeshOutput<MeshBase>
49 {
50 public:
51 
56  explicit
58 
63  explicit
64  TetGenIO (const MeshBase & mesh);
65 
70  virtual void read (const std::string &) libmesh_override;
71 
76  virtual void write (const std::string &) libmesh_override;
77 
82  std::vector<std::vector<Real>> node_attributes;
83 
95  std::vector<std::vector<Real>> element_attributes;
96 
97 private:
98 
99 
100  //-------------------------------------------------------------
101  // read support methods
102 
107  void read_nodes_and_elem (std::istream & node_stream,
108  std::istream & ele_stream);
109 
117  void node_in (std::istream & node_stream);
118 
125  void element_in (std::istream & ele_stream);
126 
127  //-------------------------------------------------------------
128  // local data
129 
133  std::map<dof_id_type,dof_id_type> _assign_nodes;
134 
139 
144 };
145 
146 
147 
148 // ------------------------------------------------------------
149 // TetGenIO inline members
150 inline
152  MeshInput<MeshBase> (mesh),
153  MeshOutput<MeshBase>(mesh)
154 {
155 }
156 
157 
158 
159 inline
161  MeshOutput<MeshBase>(mesh)
162 {
163 }
164 
165 
166 } // namespace libMesh
167 
168 
169 #endif // LIBMESH_TETGEN_IO_H
dof_id_type _num_elements
total number of elements.
Definition: tetgen_io.h:143
std::map< dof_id_type, dof_id_type > _assign_nodes
stores new positions of nodes.
Definition: tetgen_io.h:133
virtual void write(const std::string &) libmesh_override
This method implements writing a mesh to a specified ".poly" file.
Definition: tetgen_io.C:259
This class defines an abstract interface for Mesh output.
Definition: mesh_output.h:53
This class implements reading and writing meshes in the TetGen format.
Definition: tetgen_io.h:47
The libMesh namespace provides an interface to certain functionality in the library.
TetGenIO(MeshBase &mesh)
Constructor.
Definition: tetgen_io.h:151
This is the MeshBase class.
Definition: mesh_base.h:68
This class defines an abstract interface for Mesh input.
Definition: mesh_base.h:50
dof_id_type _num_nodes
total number of nodes.
Definition: tetgen_io.h:138
void read_nodes_and_elem(std::istream &node_stream, std::istream &ele_stream)
Reads a mesh (nodes & elements) from the file provided through node_stream and ele_stream.
Definition: tetgen_io.C:94
void node_in(std::istream &node_stream)
Method reads nodes from node_stream and stores them in vector<Node *> nodes in the order they come in...
Definition: tetgen_io.C:112
void element_in(std::istream &ele_stream)
Method reads elements and stores them in vector<Elem *> elements in the same order as they come in...
Definition: tetgen_io.C:170
std::vector< std::vector< Real > > node_attributes
Data structure to hold node attributes read in from file.
Definition: tetgen_io.h:82
virtual void read(const std::string &) libmesh_override
This method implements reading a mesh from a specified file in TetGen format.
Definition: tetgen_io.C:33
std::vector< std::vector< Real > > element_attributes
Data structure to hold element attributes read in from file.
Definition: tetgen_io.h:95
uint8_t dof_id_type
Definition: id_types.h:64