$extrastylesheet
unv_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_UNV_IO_H
00021 #define LIBMESH_UNV_IO_H
00022 
00023 
00024 // Local includes
00025 #include "libmesh/mesh_input.h"
00026 #include "libmesh/mesh_output.h"
00027 
00028 // C++ inludes
00029 #include <cstddef>
00030 #include <map>
00031 #include <string>
00032 #include <vector>
00033 
00034 namespace libMesh
00035 {
00036 
00037 // Forward declarations
00038 class MeshBase;
00039 class MeshData;
00040 
00052 class UNVIO : public MeshInput<MeshBase>,
00053               public MeshOutput<MeshBase>
00054 {
00055 
00056 public:
00057 
00062   UNVIO (MeshBase& mesh, MeshData* mesh_data = NULL);
00063 
00068   UNVIO (const MeshBase& mesh, MeshData* mesh_data = NULL);
00069 
00073   virtual ~UNVIO ();
00074 
00078   virtual void read (const std::string& );
00079 
00083   virtual void write (const std::string& );
00084 
00088   bool & verbose ();
00089 
00090 
00091 private:
00092 
00093 
00099   void read_implementation (std::istream& in_stream);
00100 
00106   void write_implementation (std::ostream& out_stream);
00107 
00108   //-------------------------------------------------------------
00109   // read support methods
00110 
00114   void nodes_in (std::istream& in_file);
00115 
00123   void elements_in (std::istream& in_file);
00124 
00129   void groups_in(std::istream& in_file);
00130 
00131   //-------------------------------------------------------------
00132   // write support methods
00133 
00140   void nodes_out (std::ostream& out_file);
00141 
00148   void elements_out (std::ostream& out_file);
00149 
00155   unsigned char max_elem_dimension_seen ();
00156 
00157   //-------------------------------------------------------------
00158   // local data
00159 
00163   bool _verbose;
00164 
00168   std::map<unsigned, unsigned> _unv_node_id_to_libmesh_node_id;
00169 
00173   static const std::string _nodes_dataset_label;
00174 
00178   static const std::string _elements_dataset_label;
00179 
00183   static const std::string _groups_dataset_label;
00184 
00189   MeshData* _mesh_data;
00190 
00194   // std::vector<unsigned> _libmesh_elem_id_to_unv_elem_id;
00195 
00199   std::map<unsigned, unsigned> _unv_elem_id_to_libmesh_elem_id;
00200 };
00201 
00202 
00203 
00204 } // namespace libMesh
00205 
00206 
00207 #endif // LIBMESH_UNV_IO_H