$extrastylesheet
ucd_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_UCD_IO_H
00021 #define LIBMESH_UCD_IO_H
00022 
00023 // C++ includes
00024 
00025 // Local includes
00026 #include "libmesh/libmesh_common.h"
00027 #include "libmesh/mesh_input.h"
00028 #include "libmesh/mesh_output.h"
00029 #include "libmesh/boundary_info.h"
00030 
00031 namespace libMesh
00032 {
00033 
00034 // Forward declarations
00035 class MeshBase;
00036 
00037 
00038 
00045 // ------------------------------------------------------------
00046 // UCDIO class definition
00047 class UCDIO : public MeshInput<MeshBase>,
00048               public MeshOutput<MeshBase>
00049 {
00050 public:
00051 
00056   explicit
00057   UCDIO (MeshBase&);
00058 
00063   explicit
00064   UCDIO (const MeshBase&);
00065 
00070   virtual void read (const std::string& );
00071 
00076   virtual void write (const std::string& );
00077 
00082   virtual void write_nodal_data(const std::string& fname,
00083                                 const std::vector<Number>&soln,
00084                                 const std::vector<std::string>& names);
00085 
00086 
00087 private:
00088 
00094   void read_implementation (std::istream& in_stream);
00095 
00101   void write_implementation (std::ostream& out_stream);
00102 
00106   void write_header(std::ostream& out, const MeshBase& mesh,
00107                     dof_id_type n_elems, unsigned int n_vars );
00108 
00112   void write_nodes(std::ostream& out, const MeshBase& mesh);
00113 
00117   void write_interior_elems(std::ostream& out, const MeshBase& mesh);
00118 
00122   void write_soln(std::ostream& out, const MeshBase& mesh,
00123                   const std::vector<std::string>& names,
00124                   const std::vector<Number>&soln);
00125 
00126 };
00127 
00128 
00129 
00130 // ------------------------------------------------------------
00131 // UCDIO inline members
00132 inline
00133 UCDIO::UCDIO (MeshBase& mesh) :
00134   MeshInput<MeshBase> (mesh),
00135   MeshOutput<MeshBase>(mesh)
00136 {
00137 }
00138 
00139 
00140 
00141 inline
00142 UCDIO::UCDIO (const MeshBase& mesh) :
00143   MeshOutput<MeshBase> (mesh)
00144 {
00145 }
00146 
00147 
00148 } // namespace libMesh
00149 
00150 
00151 #endif // LIBMESH_UCD_IO_H