columnstencil.h

Go to the documentation of this file.
00001 #ifndef  __ColumnStencil_h
00002 #define  __ColumnStencil_h
00003 
00004 #include  "stencilinterface.h"
00005 #include  "sparsestructureinterface.h"
00006 #include  "gascoigne.h"
00007 
00008 
00009 namespace Gascoigne
00010 {
00011 
00016 
00020 
00021 class ColumnStencil : public virtual StencilInterface
00022 {
00023 protected:
00024 
00025   IntVector   scol, sstart;
00026   
00027 public:
00028 
00029 //
00031 //
00032 
00033   ColumnStencil() : StencilInterface() {}
00034   ~ColumnStencil() {}
00035 
00036   const IntVector&  col()    const { return scol; }
00037         IntVector&  col()          { return scol; }
00038   const IntVector&  start()  const { return sstart; }
00039         IntVector&  start()        { return sstart; }
00040 
00041   int  n()            const { return sstart.size()-1;}
00042   int  nentries()     const { return scol.size();}
00043   int  rowsize(int i) const { assert((i>=0)&&(i+1<sstart.size())); return sstart[i+1]-sstart[i];}
00044 
00045         int&  col(int pos)           { assert((pos>=0)&&(pos<scol.size())); return scol[pos]; } 
00046   const int&  col(int pos)     const { assert((pos>=0)&&(pos<scol.size())); return scol[pos]; } 
00047         int&  start(int i)           { assert((i>=0)&&(i<sstart.size()));   return sstart[i]; } 
00048   const int&  start(int i)     const { assert((i>=0)&&(i<sstart.size()));   return sstart[i]; } 
00049         int&  stop(int i)            { assert((i>=0)&&(i+1<sstart.size())); return sstart[i+1]; } 
00050   const int&  stop(int i)      const { assert((i>=0)&&(i+1<sstart.size())); return sstart[i+1]; } 
00051 
00052   void memory(const SparseStructureInterface*);
00053   void memory(int n, int nt);
00054   
00055   virtual int Find(int i, int j) const
00056     {
00057       for(int pos=start(i); pos<stop(i); pos++)
00058         {
00059           if (col(pos)==j) return pos;
00060         }
00061       std::cerr << "UnstructuredStencil::Find()";
00062       std::cerr << "no such coupling: "<< i <<" "<<j<<std::endl;
00063       abort();
00064       return -1;
00065     }
00066 
00067   std::ostream& Write(std::ostream& os) const;
00068 };
00069 }
00070 
00071 #endif

Generated on Thu Sep 14 10:34:36 2006 for Gascoigne by  doxygen 1.4.7