Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

gtmatbuffer.hpp

Go to the documentation of this file.
00001 //************************************************************************************//
00002 // Module       : gtmatbuffer.hpp
00003 // Date         : 6/5/03 (DLR)
00004 // Copyright    : 2003-2006 Copyright University Corporation for Atmospheric
00005 //                Research
00006 // Description  : Encapsulates the methods and data associated with
00007 //                a template matrix-buffer object, whose data is composed of
00008 //                variable length buffers.
00009 // Derived From : none.
00010 // Modifications:
00011 //************************************************************************************//
00012 #if !defined(GTMATBUFFER_HPP)
00013 #define GTMATBUFFER_HPP
00014 #include <iostream.h>
00015 #include <stdlib.h>
00016 #include <memory.h>
00017 #include <iomanip.h>
00018 #include <iostream.h>
00019 #include "gtypes.h"
00020 #include "gtbuffer.hpp"
00021 
00022 
00023 template<class T> class GTMatBuffer
00024 {
00025 public:
00026                           GTMatBuffer();
00027                           GTMatBuffer(const GINT , const GINT );
00028                           GTMatBuffer(T *array, GINT  n1, GINT  n2);
00029                           GTMatBuffer(const GTMatBuffer<T> &);
00030 
00031                          ~GTMatBuffer();
00032 
00033 inline virtual  T         &operator()(const GINT  i, const GINT  j ){
00034 #if defined(GARRAY_BOUNDS)
00035 
00036                           if ( i >= dim(1) || i < 0 || j >= dim(2) || j < 0  ) {
00037                             cout << "GTMatBuffer<T>::&(): access error"<< endl;
00038                             exit(1);
00039                             }
00040 #endif
00041                           GBuffer<T> *v;
00042                           v = data[i];
00043                           return (*v)(j);}  //*(v->Data() + j - v->GetIndex().beg());}
00044 
00045 
00046 inline  virtual  T        operator()(const GINT  i , const GINT  j ) const {
00047 #if defined(GARRAY_BOUNDS)
00048                           if ( i >= dim(1) || i < 0 || j >= dim(2) || j < 0  ) {
00049                             cout << "GTMatBuffer<T>::&(): access error"<< endl;
00050                             exit(1);
00051                             }
00052 #endif
00053                           GBuffer<T> *v;
00054                           v = data[i];
00055                           return (*v)(j);}   //*(v->Data() + j - v->GetIndex().beg());}
00056                    
00057 virtual  GTMatBuffer<T>   operator=(const GTMatBuffer<T> &);
00058 virtual  void             operator=(T m);
00059 virtual  GINT             tsize(GINT  idir);  // _total_ size = n_idir + n_idir_pad_
00060 virtual  GINT             dim(GINT  idir) const;
00061 
00062 virtual  GBuffer<T>      **Data() const;
00063 virtual  GBOOL            Resize(GINT  Nx, GINT  Ny);
00064   
00065          friend ostream&  operator<<(ostream &, GTMatBuffer<T> );
00066 
00067 private:
00068 
00069 // Private methods:
00070 void              DeleteDynamic();
00071 
00072 
00073 // Private data:
00074 GINT              n1;
00075 GINT              n2;
00076 G_DATATYPE        dtype;
00077 
00078 GBuffer<T>       **data;
00079 
00080 
00081 };
00082 # if defined(_LINUX) || defined(_AIX)
00083 template class GTMatBuffer<GINT >;
00084 #  endif
00085 #endif

Generated on Wed Dec 21 16:00:48 2005 for Geophysics & Astrophysics Spectral Element Adaptive Refinement (GASpAR) 2D Code by  doxygen 1.4.4