checkpoint_io.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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_CHECKPOINT_IO_H
21 #define LIBMESH_CHECKPOINT_IO_H
22 
23 
24 // Local includes
25 #include "libmesh/libmesh.h"
26 #include "libmesh/mesh_input.h"
27 #include "libmesh/mesh_output.h"
29 
30 // C++ includes
31 #include <string>
32 #include <vector>
33 
34 namespace libMesh
35 {
36 // Forward declarations
37 class MeshBase;
38 class MeshData;
39 class Xdr;
40 class Elem;
41 
42 
48 // ------------------------------------------------------------
49 // CheckpointIO class definition
50 class CheckpointIO : public MeshInput<MeshBase>,
51  public MeshOutput<MeshBase>,
52  public ParallelObject
53 {
54  public:
55  // The size used for encoding all id types in this file
57 
58  // The size type used to read header sizes (meta data information)
59  typedef uint32_t header_id_type;
60 
68  explicit
69  CheckpointIO (MeshBase&, const bool=false);
70 
78  explicit
79  CheckpointIO (const MeshBase&, const bool=false);
80 
84  virtual ~CheckpointIO ();
85 
89  virtual void read (const std::string&);
90 
94  virtual void write (const std::string&);
95 
99  bool binary() const { return _binary; }
100  bool & binary() { return _binary; }
101 
102 
106  const std::string & version () const { return _version; }
107  std::string & version () { return _version; }
108 
109  private:
110  //---------------------------------------------------------------------------
111  // Write Implementation
115  void write_subdomain_names(Xdr &io) const;
116 
120  void write_connectivity (Xdr &io) const;
121 
125  void write_nodes (Xdr &io) const;
126 
130  void write_bcs (Xdr &io) const;
131 
135  void write_nodesets (Xdr &io) const;
136 
140  void write_bc_names (Xdr &io, const BoundaryInfo & info, bool is_sideset) const;
141 
142 
143  //---------------------------------------------------------------------------
144  // Read Implementation
148  void read_subdomain_names(Xdr &io);
149 
153  void read_connectivity (Xdr &io);
154 
158  void read_nodes (Xdr &io);
159 
163  void read_bcs (Xdr &io);
164 
168  void read_nodesets (Xdr &io);
169 
173  void read_bc_names(Xdr &io, BoundaryInfo & info, bool is_sideset);
174 
181  unsigned int n_active_levels_on_processor(const MeshBase &mesh) const;
182 
183  bool _binary;
184  std::string _version;
185 };
186 
187 
188 } // namespace libMesh
189 
190 #endif // LIBMESH_CHECKPOINT_IO_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo