Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ElementGatherSeq.hh

00001 #ifndef SEQELEMENTGATHER
00002 #define SEQELEMENTGATHER
00003 
00004 #include "ElementGather.hh"
00005 #include "SimpleIntData.hh"
00006 
00007 class IndexSetCollector;
00008 
00012 struct Range {
00013   int start, extent;
00014   Range( int s, int e ) : start(s), extent(e) {}
00015 };
00016 
00021 class ElementGatherSeq : public ElementGather {
00022 public:
00023   ElementGatherSeq( int nx, int ny, int capacity = 0 );
00024   ElementGatherSeq( int domain, IndexSetCollector & w );
00025   ElementGatherSeq( int nx, const Range & r );
00027   static ElementGatherSeq * Identity( int nx );
00028 
00029   virtual IotrMask * asMask();
00030   virtual ~ElementGatherSeq();
00031   bool operator==( const ElementGatherSeq & e ) const;
00032   bool operator!=( const ElementGatherSeq & e ) const
00033   {
00034     return !(*this == e );
00035   }
00036 
00037   virtual void copyFrom( const ElementGatherSeq& elt );
00038   virtual void copyInto( ElementGatherSeq& elt ) const;
00039 
00040   virtual ElementGather * copy() const;
00042   virtual void gather( double alpha, const IotrVector & x,
00043                        double beta,  IotrVector & y ) const;
00044 
00045   virtual void gatherScaled( double alpha, const IotrVector & diag,
00046                              const IotrVector & x,
00047                              double beta,
00048                              IotrVector & y ) const;
00049   virtual void gatherThenScale( double alpha, const IotrVector & x, 
00050                                 double beta,  IotrVector & y,
00051                                 const IotrVector & d ) const;
00052   virtual ElementGather * composeWith( const ElementGather & b ) const;
00053 
00054   virtual void unionWith2( const ElementGather & b, const ElementGather & c,
00055                            ElementGather *& u,
00056                            ElementGather *& AinU, ElementGather *&BinU,
00057                            ElementGather *& CinU ) const;
00058 
00059 
00060   virtual IotrVector * rangeVector() const;
00061   virtual IotrVector * rangeVector( const IotrVector & v ) const;
00062   virtual IotrVector * domainVector() const;
00063   
00064   //  specializes ElementGather::scatter()
00065   virtual void scatter( double alpha, const IotrVector & x, 
00066                         double beta,  IotrVector & y ) const;
00067   virtual void scatterInverse( double alpha, const IotrVector & x, 
00068                                double beta,  IotrVector & y ) const;
00069   virtual void scatterScaled(  double alpha, const IotrVector & diag,
00070                                const IotrVector & x,
00071                                double beta,  IotrVector & y ) const;
00072   virtual void scatterScaledInverse(  double alpha,
00073                                       const IotrVector & diag, 
00074                                       const IotrVector & x, double beta,  
00075                                       IotrVector & y ) const;
00076   virtual bool isIdentity() const;
00077   // specialize ElementGather::scale()
00078   //virtual void scale( double alpha, IotrVector & x);
00079 
00080   const int * indices() const { return mIndexArray->array(); }
00081   // Kill the non-const version soon!
00082   //protected:
00083   int * indices() { return mIndexArray->array(); }
00084 public:
00085   int nindices() const { return mIndexArray->size(); }
00086 
00087   virtual ElementTransfer * transferTo( ElementGather * e );
00088   virtual void unionWith( const ElementGather & b,
00089                           ElementGather *& abunion,
00090                           ElementGather *& union2a, 
00091                           ElementGather *& union2b ) const;
00092 
00093   virtual void copyFromIndices( const int ind[], int & err );
00094 
00095   virtual void inspect( const char * name = 0,
00096                         const char * filename = 0 ) const;
00097   virtual void inspectAsMatlab( const char * name = 0,
00098                                 const char * filename = 0 ) const;
00099   virtual int isValid() const;
00100 protected:
00102   SimpleIntDataHandle mIndexArray;
00104 };
00105 
00106 
00107 typedef Handle<ElementGatherSeq> ElementGatherSeqHandle;
00108 
00113 class ElementTransferSeq : public ElementTransfer {
00114 protected:
00115   ElementGatherSeqHandle mFrom, mTo;
00116 public:
00117   ElementTransferSeq( ElementGatherSeq * from, ElementGatherSeq * to );
00118   virtual void transferForward( double alpha, IotrVector & x, 
00119                                 double beta,  IotrVector & y );
00120                                 
00121   virtual void transferBackward( double alpha, IotrVector & x, 
00122                                  double beta,  IotrVector & y );
00123                                  
00124   virtual void inspect( const char * name = 0,
00125                         const char * filename = 0 );
00126 
00127   virtual void inspectAsMatlab( const char * name = 0,
00128                                 const char * filename = 0 );
00129 };
00130 
00131 typedef Handle< ElementTransferSeq> ElementTransferSeqHandle;
00132 #endif

Generated on Wed Aug 27 10:03:41 2003 for iotr by doxygen1.2.18