unv_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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_UNV_IO_H
21 #define LIBMESH_UNV_IO_H
22 
23 
24 // Local includes
25 #include "libmesh/mesh_input.h"
26 #include "libmesh/mesh_output.h"
27 
28 // C++ includes
29 #include <cstddef>
30 #include <map>
31 #include <string>
32 #include <vector>
33 
34 namespace libMesh
35 {
36 
37 // Forward declarations
38 class MeshBase;
39 
52 class UNVIO : public MeshInput<MeshBase>,
53  public MeshOutput<MeshBase>
54 {
55 
56 public:
57 
62  UNVIO (MeshBase & mesh);
63 
68  UNVIO (const MeshBase & mesh);
69 
73  virtual ~UNVIO ();
74 
78  virtual void read (const std::string &) override;
79 
83  virtual void write (const std::string &) override;
84 
88  bool & verbose ();
89 
94  void read_dataset(std::string file_name);
95 
104  const std::vector<Number> * get_data (Node * node) const;
105 
106 private:
107 
108 
114  void read_implementation (std::istream & in_stream);
115 
121  void write_implementation (std::ostream & out_stream);
122 
123  //-------------------------------------------------------------
124  // read support methods
125 
129  void nodes_in (std::istream & in_file);
130 
137  void elements_in (std::istream & in_file);
138 
143  void groups_in(std::istream & in_file);
144 
145  //-------------------------------------------------------------
146  // write support methods
147 
152  void nodes_out (std::ostream & out_file);
153 
158  void elements_out (std::ostream & out_file);
159 
165  unsigned char max_elem_dimension_seen ();
166 
174  bool need_D_to_e (std::string & number);
175 
176  //-------------------------------------------------------------
177  // local data
178 
182  bool _verbose;
183 
188  std::map<dof_id_type, Node *> _unv_node_id_to_libmesh_node_ptr;
189 
193  static const std::string _nodes_dataset_label;
194 
198  static const std::string _elements_dataset_label;
199 
203  static const std::string _groups_dataset_label;
204 
208  std::map<unsigned, unsigned> _unv_elem_id_to_libmesh_elem_id;
209 
214  std::map<Node *, std::vector<Number>> _node_data;
215 };
216 
217 
218 
219 } // namespace libMesh
220 
221 
222 #endif // LIBMESH_UNV_IO_H
void write_implementation(std::ostream &out_stream)
Definition: unv_io.C:289
bool _verbose
Definition: unv_io.h:182
UNVIO(MeshBase &mesh)
Definition: unv_io.C:66
A geometric point in (x,y,z) space associated with a DOF.
Definition: node.h:52
bool & verbose()
Definition: unv_io.C:89
std::map< dof_id_type, Node * > _unv_node_id_to_libmesh_node_ptr
Definition: unv_io.h:188
static const std::string _elements_dataset_label
Definition: unv_io.h:198
void nodes_in(std::istream &in_file)
Definition: unv_io.C:302
void read_implementation(std::istream &in_stream)
Definition: unv_io.C:122
void read_dataset(std::string file_name)
Definition: unv_io.C:1153
std::map< Node *, std::vector< Number > > _node_data
Definition: unv_io.h:214
unsigned char max_elem_dimension_seen()
Definition: unv_io.C:375
void nodes_out(std::ostream &out_file)
Definition: unv_io.C:862
static const std::string _groups_dataset_label
Definition: unv_io.h:203
void elements_out(std::ostream &out_file)
Definition: unv_io.C:924
Base class for Mesh.
Definition: mesh_base.h:77
virtual void write(const std::string &) override
Definition: unv_io.C:260
std::map< unsigned, unsigned > _unv_elem_id_to_libmesh_elem_id
Definition: unv_io.h:208
bool need_D_to_e(std::string &number)
Definition: unv_io.C:391
const std::vector< Number > * get_data(Node *node) const
Definition: unv_io.C:1314
virtual ~UNVIO()
Definition: unv_io.C:83
static const std::string _nodes_dataset_label
Definition: unv_io.h:193
virtual void read(const std::string &) override
Definition: unv_io.C:96
void elements_in(std::istream &in_file)
Definition: unv_io.C:574
void groups_in(std::istream &in_file)
Definition: unv_io.C:408