exodusII_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_EXODUSII_IO_H
21 #define LIBMESH_EXODUSII_IO_H
22 
23 
24 // Local includes
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/mesh_input.h"
27 #include "libmesh/mesh_output.h"
29 
30 // C++ includes
31 
32 namespace libMesh
33 {
34 
35 // Forward declarations
36 class EquationSystems;
37 class ExodusII_IO_Helper;
38 class MeshBase;
39 class System;
40 
52 class ExodusII_IO : public MeshInput<MeshBase>,
53  public MeshOutput<MeshBase>,
54  public ParallelObject
55 {
56 public:
57 
62  explicit
64  bool single_precision=false);
65 
69  virtual ~ExodusII_IO ();
70 
78  virtual void read (const std::string & name) override;
79 
83  virtual void write (const std::string & fname) override;
84 
88  void verbose (bool set_verbosity);
89 
93  const std::vector<Real> & get_time_steps();
94 
104  int get_num_time_steps();
105 
111 #ifdef LIBMESH_ENABLE_DEPRECATED
112  void copy_nodal_solution(System & system,
113  std::string var_name,
114  unsigned int timestep=1);
115 #endif
116 
121  void copy_nodal_solution(System & system,
122  std::string system_var_name,
123  std::string exodus_var_name,
124  unsigned int timestep=1);
125 
130  void copy_elemental_solution(System & system,
131  std::string system_var_name,
132  std::string exodus_var_name,
133  unsigned int timestep=1);
134 
146  void read_elemental_variable(std::string elemental_var_name,
147  unsigned int timestep,
148  std::map<unsigned int, Real> & unique_id_to_value_map);
149 
157  void read_global_variable(std::vector<std::string> global_var_names,
158  unsigned int timestep,
159  std::vector<Real> & global_values);
160 
164  void write_discontinuous_exodusII (const std::string & name,
165  const EquationSystems & es,
166  const std::set<std::string> * system_names=nullptr);
167 
176  void write_timestep_discontinuous (const std::string &fname,
177  const EquationSystems &es,
178  const int timestep,
179  const Real time,
180  const std::set<std::string> * system_names=nullptr);
181 
185  void write_element_data (const EquationSystems & es);
186 
193 
197  virtual void write_nodal_data (const std::string &,
198  const std::vector<Number> &,
199  const std::vector<std::string> &) override;
200 
204  void write_nodal_data_discontinuous (const std::string &,
205  const std::vector<Number> &,
206  const std::vector<std::string> &) override;
207 
211  void write_global_data (const std::vector<Number> &,
212  const std::vector<std::string> &);
213 
217  void write_information_records (const std::vector<std::string> &);
218 
227  void write_timestep (const std::string & fname,
228  const EquationSystems & es,
229  const int timestep,
230  const Real time,
231  const std::set<std::string> * system_names=nullptr);
232 
241  void set_output_variables(const std::vector<std::string> & output_variables,
242  bool allow_empty = true);
243 
256 
266  void write_as_dimension(unsigned dim);
267 
283 
289  void append(bool val);
290 
294  const std::vector<std::string> & get_elem_var_names();
295 
299  const std::vector<std::string> & get_nodal_var_names();
300 
301 #ifdef LIBMESH_HAVE_EXODUS_API
302 
306 #endif
307 
312  void write_nodal_data_common(std::string fname,
313  const std::vector<std::string> & names,
314  bool continuous=true);
315 
316 private:
322 #ifdef LIBMESH_HAVE_EXODUS_API
323  std::unique_ptr<ExodusII_IO_Helper> exio_helper;
324 
330 
334  bool _verbose;
335 
340  bool _append;
341 #endif
342 
347  std::vector<std::string> _output_variables;
348 
355 
356 };
357 
358 
359 } // namespace libMesh
360 
361 
362 #endif // LIBMESH_EXODUSII_IO_H
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
void use_mesh_dimension_instead_of_spatial_dimension(bool val)
Definition: exodusII_io.C:428
Manages multiples systems of equations.
void write_as_dimension(unsigned dim)
Definition: exodusII_io.C:435
ExodusII_IO_Helper & get_exio_helper()
Definition: exodusII_io.C:1038
Handles reading and writing of Exodus binary files.
Definition: exodusII_io.h:52
void copy_nodal_solution(System &system, std::string var_name, unsigned int timestep=1)
Definition: exodusII_io.C:78
ExodusII_IO(MeshBase &mesh, bool single_precision=false)
Definition: exodusII_io.C:45
void append(bool val)
Definition: exodusII_io.C:450
Base class for Mesh.
Definition: mesh_base.h:77
void write_timestep_discontinuous(const std::string &fname, const EquationSystems &es, const int timestep, const Real time, const std::set< std::string > *system_names=nullptr)
Definition: exodusII_io.C:104
void set_output_variables(const std::vector< std::string > &output_variables, bool allow_empty=true)
Definition: exodusII_io.C:68
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:92
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
Definition: exodusII_io.C:513
const std::vector< Real > & get_time_steps()
Definition: exodusII_io.C:457
std::vector< std::string > _output_variables
Definition: exodusII_io.h:347
void write_information_records(const std::vector< std::string > &)
Definition: exodusII_io.C:796
void read_elemental_variable(std::string elemental_var_name, unsigned int timestep, std::map< unsigned int, Real > &unique_id_to_value_map)
Definition: exodusII_io.C:555
void verbose(bool set_verbosity)
Definition: exodusII_io.C:418
void write_nodal_data_common(std::string fname, const std::vector< std::string > &names, bool continuous=true)
Definition: exodusII_io.C:970
An object whose state is distributed along a set of processors.
virtual void read(const std::string &name) override
Definition: exodusII_io.C:140
void read_global_variable(std::vector< std::string > global_var_names, unsigned int timestep, std::vector< Real > &global_values)
Definition: exodusII_io.C:570
void write_global_data(const std::vector< Number > &, const std::vector< std::string > &)
Definition: exodusII_io.C:809
void write_nodal_data_discontinuous(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Definition: exodusII_io.C:912
std::unique_ptr< ExodusII_IO_Helper > exio_helper
Definition: exodusII_io.h:323
void write_discontinuous_exodusII(const std::string &name, const EquationSystems &es, const std::set< std::string > *system_names=nullptr)
Definition: exodusII_io.C:89
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void write(const std::string &fname) override
Definition: exodusII_io.C:879
void write_timestep(const std::string &fname, const EquationSystems &es, const int timestep, const Real time, const std::set< std::string > *system_names=nullptr)
Definition: exodusII_io.C:862
virtual ~ExodusII_IO()
Definition: exodusII_io.C:133
const std::vector< std::string > & get_elem_var_names()
Definition: exodusII_io.C:1032
void write_element_data(const EquationSystems &es)
Definition: exodusII_io.C:599
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &) override
Definition: exodusII_io.C:700
const std::vector< std::string > & get_nodal_var_names()
Definition: exodusII_io.C:1026
A geometric point in (x,y,z) space.
Definition: point.h:38
void set_coordinate_offset(Point p)
Definition: exodusII_io.C:442