libMesh
Loading...
Searching...
No Matches
tetgen_io.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
32namespace libMesh
33{
34
35// Forward declarations
36class MeshBase;
37
38
47class TetGenIO : public MeshInput<MeshBase>,
48 public MeshOutput<MeshBase>
49{
50public:
51
56 explicit
58
63 explicit
64 TetGenIO (const MeshBase & mesh);
65
70 virtual void read (const std::string &) override;
71
76 virtual void write (const std::string &) override;
77
82 std::vector<std::vector<Real>> node_attributes;
83
84private:
85
86
87 //-------------------------------------------------------------
88 // read support methods
89
94 void read_nodes_and_elem (std::istream & node_stream,
95 std::istream & ele_stream);
96
104 void node_in (std::istream & node_stream);
105
112 void element_in (std::istream & ele_stream);
113
114 //-------------------------------------------------------------
115 // local data
116
120 std::map<dof_id_type,dof_id_type> _assign_nodes;
121
126
131};
132
133
134
135// ------------------------------------------------------------
136// TetGenIO inline members
137inline
143
144
145
146inline
151
152
153} // namespace libMesh
154
155
156#endif // LIBMESH_TETGEN_IO_H
This is the MeshBase class.
Definition mesh_base.h:81
This class defines an abstract interface for Mesh input.
Definition mesh_input.h:49
This class defines an abstract interface for Mesh output.
Definition mesh_output.h:54
This class implements reading and writing meshes in the TetGen format.
Definition tetgen_io.h:49
dof_id_type _num_nodes
total number of nodes.
Definition tetgen_io.h:125
dof_id_type _num_elements
total number of elements.
Definition tetgen_io.h:130
std::vector< std::vector< Real > > node_attributes
Data structure to hold node attributes read in from file.
Definition tetgen_io.h:82
virtual void write(const std::string &) override
This method implements writing a mesh to a specified ".poly" file.
Definition tetgen_io.C:270
TetGenIO(MeshBase &mesh)
Constructor.
Definition tetgen_io.h:138
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:186
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:115
std::map< dof_id_type, dof_id_type > _assign_nodes
stores new positions of nodes.
Definition tetgen_io.h:120
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:97
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file in TetGen format.
Definition tetgen_io.C:36
MeshBase & mesh
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t dof_id_type
Definition id_types.h:67