src/Utility/FieldBlock.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef FIELD_BLOCK_H
00012 #define FIELD_BLOCK_H
00013 
00014 // class FieldBlock
00015 // 
00016 // The FieldBlock object is used to store the data from several Field
00017 // variables in a single netcdf file. A record dimension is available to
00018 // allow storage of field histories in the same netCDF file. Fields read
00019 // and write to a netcdf file attached to the FieldBlock object.  The write
00020 // and read member functions take a single Field and require a Field
00021 // Variable ID and record number to access data from the netCDF file. The
00022 // record number is defaulted to zero for the case where there is only a
00023 // single record.
00024 //
00025 // J.V.W. Reynders - ACL/LANL July 28, 1996
00026 
00027 #define MAX_FNAME_SIZE 30
00028 
00029 
00030 // forward declarations
00031 template<class T, unsigned Dim> class LField;
00032 template<class T, unsigned Dim, class Mesh, class Centering> class Field;
00033 template<unsigned Dim, class T> class UniformCartesian;
00034 template<unsigned Dim> class FieldLayout;
00035 
00036 //----------------------------------------------------------------------
00037 template<class T, unsigned Dim, 
00038          class Mesh=UniformCartesian<Dim,double>, 
00039          class Centering=typename Mesh::DefaultCentering>
00040 class FieldBlock {
00041 
00042 public:
00043 
00044   // make a FieldBlock for writing
00045   FieldBlock(char* fname, FieldLayout<Dim>& layout, unsigned numFields);
00046 
00047   // make a FieldBlock for reading
00048   FieldBlock(char* fname, FieldLayout<Dim>& layout);
00049 
00050   ~FieldBlock(void) { }
00051 
00052   int get_NumRecords(void) { return NumRecords; };
00053   int get_NumFields(void) { return NumFields; };
00054   void write(Field<T,Dim,Mesh,Centering>&f, 
00055             unsigned varID, unsigned record = 0);
00056   void read (Field<T,Dim,Mesh,Centering>&f, 
00057              unsigned varID, unsigned record = 0);
00058 
00059 private:
00060 
00061   char FName[MAX_FNAME_SIZE];
00062   FieldLayout<Dim>& Layout;
00063   unsigned NumFields;
00064   unsigned NumRecords;
00065 
00066   // don't allow copy or assign
00067   FieldBlock(const FieldBlock&) { };
00068   FieldBlock& operator=(const FieldBlock&) { return *this; }
00069 
00070 };
00071 //----------------------------------------------------------------------
00072 
00073 #include "Utility/FieldBlock.cpp"
00074 
00075 #endif // FIELD_BLOCK_H
00076 
00077 /***************************************************************************
00078  * $RCSfile: FieldBlock.h,v $   $Author: adelmann $
00079  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:33 $
00080  * IPPL_VERSION_ID: $Id: FieldBlock.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 
00081  ***************************************************************************/

Generated on Mon Jan 16 13:23:58 2006 for IPPL by  doxygen 1.4.6