$extrastylesheet
checkpoint_io.h
Go to the documentation of this file.
00001 // The libMesh Finite Element Library.
00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
00003 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 of the License, or (at your option) any later version.
00008 
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Lesser General Public License for more details.
00013 
00014 // You should have received a copy of the GNU Lesser General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 
00020 #ifndef LIBMESH_CHECKPOINT_IO_H
00021 #define LIBMESH_CHECKPOINT_IO_H
00022 
00023 
00024 // Local includes
00025 #include "libmesh/libmesh.h"
00026 #include "libmesh/mesh_input.h"
00027 #include "libmesh/mesh_output.h"
00028 #include "libmesh/parallel_object.h"
00029 
00030 // C++ includes
00031 #include <string>
00032 #include <vector>
00033 
00034 namespace libMesh
00035 {
00036 // Forward declarations
00037 class MeshBase;
00038 class MeshData;
00039 class Xdr;
00040 class Elem;
00041 
00042 
00048 // ------------------------------------------------------------
00049 // CheckpointIO class definition
00050 class CheckpointIO : public MeshInput<MeshBase>,
00051                      public MeshOutput<MeshBase>,
00052                      public ParallelObject
00053 {
00054 public:
00055   // The size used for encoding all id types in this file
00056   typedef largest_id_type xdr_id_type;
00057 
00058   // The size type used to read header sizes (meta data information)
00059   typedef uint32_t header_id_type;
00060 
00068   explicit
00069   CheckpointIO (MeshBase&,       const bool=false);
00070 
00078   explicit
00079   CheckpointIO (const MeshBase&, const bool=false);
00080 
00084   virtual ~CheckpointIO ();
00085 
00089   virtual void read (const std::string&);
00090 
00094   virtual void write (const std::string&);
00095 
00099   bool   binary() const { return _binary; }
00100   bool & binary()       { return _binary; }
00101 
00102 
00106   const std::string & version () const { return _version; }
00107   std::string &       version ()       { return _version; }
00108 
00109 private:
00110   //---------------------------------------------------------------------------
00111   // Write Implementation
00115   void write_subdomain_names(Xdr &io) const;
00116 
00120   void write_connectivity (Xdr &io) const;
00121 
00125   void write_nodes (Xdr &io) const;
00126 
00130   void write_bcs (Xdr &io) const;
00131 
00135   void write_nodesets (Xdr &io) const;
00136 
00140   void write_bc_names (Xdr &io, const BoundaryInfo & info, bool is_sideset) const;
00141 
00142 
00143   //---------------------------------------------------------------------------
00144   // Read Implementation
00148   void read_subdomain_names(Xdr &io);
00149 
00153   void read_connectivity (Xdr &io);
00154 
00158   void read_nodes (Xdr &io);
00159 
00163   void read_bcs (Xdr &io);
00164 
00168   void read_nodesets (Xdr &io);
00169 
00173   void read_bc_names(Xdr &io, BoundaryInfo & info, bool is_sideset);
00174 
00181   unsigned int n_active_levels_on_processor(const MeshBase &mesh) const;
00182 
00183   bool _binary;
00184   std::string _version;
00185 };
00186 
00187 
00188 } // namespace libMesh
00189 
00190 #endif // LIBMESH_CHECKPOINT_IO_H