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

app-radu/lhsrhs.hh
Go to the documentation of this file.
00001 // LHS and RHS for stochastic diffusion
00002 
00003 #ifndef LHSRHS_HH
00004 #define LHSRHS_HH
00005 
00006 #include <memory>
00007 #include "basics/typedefs.hh"
00008 #include "toolbox/dynArray.hh"
00009 #include "function/linearForm.hh"
00010 #include "operator/bilinearForm.hh"
00011 #include "linearFEM/element2D.hh"
00012 #include "triangleP2.hh"
00013 
00014 using concepts::Real;
00015 
00016 namespace concepts {
00017  
00018   // forward declaration
00019   template<class F>
00020   class Formula;          // declared in formula/formula.hh
00021 }
00022 
00023 // ********************************************************************* LHS **
00024 
00033 class Laplace : public concepts::BilinearForm<Real> {
00034 public:
00038   Laplace(const concepts::DynArray<Real>& A_M) : A_M_(&A_M), frm_(0) {}
00040   Laplace(const concepts::Formula<Real>& frm) : A_M_(0), frm_(frm.clone()) {}
00041   virtual void operator()(const concepts::Element<Real>& elmX,
00042         const concepts::Element<Real>& elmY,
00043         concepts::ElementMatrix<Real>& em);
00050   void operator()(const linearFEM::Triangle& elmX,
00051       const linearFEM::Triangle& elmY,
00052       concepts::ElementMatrix<Real>& em);
00058   void operator()(const TriangleP2& elmX, const TriangleP2& elmY,
00059       concepts::ElementMatrix<Real>& em);
00061   static const Real weights_[4];
00063   static const concepts::Real2d coord_[4];
00064 
00065   virtual Laplace* clone() const;
00066 private:
00067   const concepts::DynArray<Real>* A_M_;
00069   std::auto_ptr<const concepts::Formula<Real> > frm_;
00070 };
00071 
00079 class Identity : public concepts::BilinearForm<Real> {
00080   virtual void operator()(const concepts::Element<Real>& elmX,
00081         const concepts::Element<Real>& elmY,
00082         concepts::ElementMatrix<Real>& em);
00087   void operator()(const linearFEM::Triangle& elmX,
00088       const linearFEM::Triangle& elmY,
00089       concepts::ElementMatrix<Real>& em);
00094   void operator()(const TriangleP2& elmX, const TriangleP2& elmY,
00095       concepts::ElementMatrix<Real>& em);
00096   virtual Identity* clone() const { return new Identity(); }
00097 };
00098 
00099 // ********************************************************************* RHS **
00100 
00106 class RHS : public concepts::LinearForm<Real> {
00107 public:
00111   RHS(const Real intPalpha) : intPalpha_(intPalpha) {}
00112   virtual void operator()(const concepts::Element<Real>& elm,
00113         concepts::ElementMatrix<Real>& em);
00114   void operator()(const linearFEM::Triangle& elm,
00115       concepts::ElementMatrix<Real>& em);
00116   void operator()(const TriangleP2& elm, concepts::ElementMatrix<Real>& em);
00117 private:
00118   const Real intPalpha_;
00119 };
00120 
00121 // ************************************************************* FlexibleRHS **
00122 
00132 class FlexibleRHS : public concepts::LinearForm<Real> {
00133 public:
00138   FlexibleRHS(const Real intPalpha, const concepts::Formula<Real>& frm) :
00139     intPalpha_(intPalpha), frm_(frm.clone()) {}
00140   virtual void operator()(const concepts::Element<Real>& elm,
00141         concepts::ElementMatrix<Real>& em);
00142   void operator()(const linearFEM::Triangle& elm,
00143       concepts::ElementMatrix<Real>& em);
00144   void operator()(const TriangleP2& elm, concepts::ElementMatrix<Real>& em);
00145 private:
00146   const Real intPalpha_;
00148   std::auto_ptr<const concepts::Formula<Real> > frm_;
00149 };
00150 
00151 #endif // LHSRHS_HH

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