Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ParmParseIO.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 #ifndef _PARMPARSE_IO_H_
00029 #define _PARMPARSE_IO_H_
00030 #include <iostream>
00031 #include <fstream>
00032 using std::ofstream;
00033 #include <string>
00034 
00035 #include "REAL.H" 
00036 class Box;
00037 class IntVect;
00038 class FArrayBox;
00039 class BoxLayout;
00040 class DisjointBoxLayout;
00041 template <class TTYPE> class LevelData;
00042 
00043 class ParmParse;
00044 
00045 class ParmParseIO
00046 {
00047 public:
00048   ParmParseIO ();
00049   ~ParmParseIO ();
00050 
00051   void
00052   openForRead (const std::string& a_filename);
00053 
00054   void
00055   openForWrite (const std::string& a_filename);
00056 
00057   void
00058   close ();
00059 
00060   void
00061   setGroup (const std::string& a_groupname);
00062 
00063   const std::string
00064   getGroup () const;
00065 
00066     const std::string&
00067     filename() const;
00068 
00069     const std::string&
00070     groupname() const;
00071 
00072   void set (const std::string& a_name, const Real&        a_value);
00073   void set (const std::string& a_name, const int&         a_value);
00074   void set (const std::string& a_name, const std::string& a_value);
00075   void set (const std::string& a_name, const IntVect&     a_value);
00076   void set (const std::string& a_name, const Box&         a_value);
00077 
00078   void get (const std::string& a_name, Real&        a_value) const;
00079   void get (const std::string& a_name, int&         a_value) const;
00080   void get (const std::string& a_name, std::string& a_value) const;
00081   void get (const std::string& a_name, IntVect&     a_value) const;
00082   void get (const std::string& a_name, Box&         a_value) const;
00083 
00084   bool
00085   found (const std::string& a_name) const;
00086 
00087   friend
00088   void
00089   write (ParmParseIO& a_ppio, const BoxLayout& a_layout);
00090 
00091 // return code:
00092 // 0: successful read
00093 // 1: no num_boxes
00094 // 2: no box_n (does not report n)
00095   friend
00096   int
00097   read (ParmParseIO& a_ppio, Vector<Box>& a_boxes);
00098 
00099 // return codes:
00100 // 0: successful read
00101 // 1: no num_comps
00102 // 2: bad fab read
00103 
00104 protected:
00105   ParmParse* m_parmparse_ptr;
00106   ofstream m_ostrm;
00107   std::string m_groupname;
00108   std::string m_filename;
00109 };
00110 
00111 
00112   void
00113   write (ParmParseIO& a_ppio, 
00114          const LevelData<FArrayBox>& a_data, 
00115          const std::string& a_name);
00116 
00117 int
00118 read  (ParmParseIO& a_ppio, 
00119                   LevelData<FArrayBox>& a_data, 
00120                   const std::string& a_name,
00121                   const DisjointBoxLayout& a_layout);
00122 
00123 
00124 
00125 #endif

Generated on Thu Aug 29 11:05:45 2002 for Chombo&INS by doxygen1.2.16