Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

cluster/operator01.hh
Go to the documentation of this file.
00001 /* Cluster approximation of the stiffness matrix 01
00002  */
00003 
00004 #ifndef clusterOperator01_hh
00005 #define clusterOperator01_hh
00006 
00007 #include "basics/exceptions.hh"
00008 #include "toolbox/dynArray.hh"
00009 #include "operator/bilinearForm.hh"
00010 #include "operator/compositions.hh"
00011 #include "cluster/f.hh"
00012 
00013 namespace cluster {
00014 
00015   // ***************************************************** CacheSizeExceeded **
00016 
00022   class CacheSizeExceeded : public concepts::ExceptionBase {};
00023 
00024   // ************************************************************ Operator01 **
00025 
00030   template<class NodeX, class NodeY>
00031   class Operator01 : public concepts::Operator<typename TreeTraits<NodeX>::F> {
00032   public:
00034     typedef TreeTraits<NodeX>   TraitsX;
00035     typedef TreeTraits<NodeY>   TraitsY;
00036     typedef typename TraitsX::F FX;
00037     typedef typename TraitsY::F FY;
00040     class NfldMatrix {
00042       NfldMatrix* lnk_;
00044       uint  dX_;
00046       uint* idxX_;
00048       uint  dY_;
00050       uint* idxY_;
00052       FX* val_;
00053     public:
00066       NfldMatrix(concepts::BilinearForm<FX>& bf, NfldMatrix* lnk,
00067      concepts::DynArray<uint>& idxX, uint nidxX,
00068      concepts::DynArray<const concepts::Element<FX>*>& elmX,
00069      uint nelmX, concepts::DynArray<uint>& idxY, uint nidxY,
00070      concepts::DynArray<const concepts::Element<FY>*>& elmY,
00071      uint nelmY);
00072       inline ~NfldMatrix() {delete[] val_; delete[] idxY_; delete[] idxX_;}
00073 
00075       void operator()(const concepts::Vector<FY>& fncY,
00076           concepts::Vector<FX>& fncX);
00078       inline NfldMatrix* link() const {return lnk_;}
00080       inline float memory() const;
00081     };
00088     Operator01(concepts::BilinearForm<FX>& bf, ClstF<NodeX,NodeY>& F,
00089                ClstX<NodeX>& X, ClstY<NodeY>& Y);
00090     virtual ~Operator01();
00091 
00093     void operator()(const concepts::Function<FY>& fncY,
00094         concepts::Function<FX>& fncX);
00095     void operator()(const concepts::Vector<FY>& fncY,
00096         concepts::Vector<FX>& fncX);
00100     float memory() const;
00101     inline const concepts::Space<FX>& spaceX() const {return X_.space();}
00102     inline const concepts::Space<FY>& spaceY() const {return Y_.space();}
00103   protected:
00104     std::ostream& info(std::ostream& os) const;
00105   private:
00107     concepts::BilinearForm<FX>& bf_;
00109     ClstF<NodeX, NodeY>& F_;
00111     ClstX<NodeX>& X_;
00113     ClstY<NodeY>& Y_;
00115     NfldMatrix* N_;
00117     uint nnfldval_;
00118 
00126     template<class Trts, class Nd>
00127     void constructor_(const Nd* clst, concepts::DynArray<uint>& idx,
00128           uint* nidx, concepts::DynArray<const concepts::Element
00129           <typename Trts::F>*>& elm, uint* nelm);
00130   };
00131 
00132   template<class NodeX, class NodeY>
00133   inline float Operator01<NodeX,NodeY>::NfldMatrix::memory() const {
00134     return sizeof(NfldMatrix)
00135       + (float)dX_ * sizeof(idxX_[0])
00136       + (float)dY_ * sizeof(idxY_[0])
00137       + (float)(dX_ * dY_) * sizeof(val_[0]);
00138   }
00139 
00140 } // namespace cluster
00141 
00142 #endif // clusterOperator01_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)