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

app-radu/cellwise.hh
Go to the documentation of this file.
00001 // cellwise coefficients for stochastic diffusion
00002 
00003 #ifndef cellwise_hh
00004 #define cellwise_hh
00005 
00006 #include "basics/typedefs.hh"
00007 #include "toolbox/dynArray.hh"
00008 #include "toolbox/array.hh"
00009 #include "toolbox/hashMap.hh"
00010 #include "space/postProcess.hh"
00011 
00012 using concepts::Real;
00013 
00014 namespace concepts {
00015   // forward declaration
00016   class Triangle2d;
00017   class Quad2d;
00018 
00019   template<class F>
00020   class Formula;          // declared in formula/formula.hh
00021 }
00022 
00023 // ********************************************************* EvaluateEa_of_x **
00024 
00029 class EvaluateEa_of_x : public concepts::CellPostprocess<Real> {
00030 public:
00031   EvaluateEa_of_x(__gnu_cxx::hash_map<uint, Real>& Ea,
00032       const concepts::Formula<Real>& frm) : 
00033     Ea_(Ea), frm_(frm.clone()) {}
00034   virtual void operator() (const concepts::Element<Real>& elm);
00035   virtual void operator() (const concepts::Cell& cell);
00036 protected:
00037   virtual std::ostream& info(std::ostream& os) const;
00038 private:
00039   __gnu_cxx::hash_map<uint, Real>& Ea_;
00040   std::auto_ptr<concepts::Formula<Real> > frm_;
00041 };
00042 
00043 // ****************************************************** CellA_M_alpha_of_x **
00044 
00052 class CellA_M_alpha_of_x : public concepts::CellPostprocess<Real> {
00053 public:
00064   CellA_M_alpha_of_x(concepts::DynArray<Real>& A_M_alpha_of_x,
00065          const __gnu_cxx::hash_map<uint, uint>& data_level_map,
00066          const __gnu_cxx::hash_map<uint, Real>& Ea_of_x,
00067          const concepts::Array<Real>& sqrt_lambda,
00068          const concepts::Array<concepts::DynArray<Real> >& phi,
00069          const concepts::Array<concepts::Array<Real> >& mu,
00070          const concepts::Array<uint>& alpha) :
00071     A_M_(A_M_alpha_of_x), data_level_map_(data_level_map), Ea_(Ea_of_x),
00072     sqrt_lambda_(sqrt_lambda), phi_(phi), mu_(mu), alpha_(alpha),
00073     M_(phi.size()) {
00074     conceptsAssert(phi.size() == sqrt_lambda.size(), concepts::Assertion());
00075   }
00076   virtual void operator() (const concepts::Element<Real>& elm);
00077   virtual void operator() (const concepts::Cell& cell);
00078   void operator() (const concepts::Triangle2d& cell);
00079   void operator() (const concepts::Quad2d& cell);
00080 protected:
00081   virtual std::ostream& info(std::ostream& os) const;
00082 private:
00083   concepts::DynArray<Real>& A_M_;
00084   const __gnu_cxx::hash_map<uint, uint>& data_level_map_;
00085   const __gnu_cxx::hash_map<uint, Real>& Ea_;
00086   const concepts::Array<Real>& sqrt_lambda_;
00087   const concepts::Array<concepts::DynArray<Real> >& phi_;
00088   const concepts::Array<concepts::Array<Real> >& mu_;
00089   const concepts::Array<uint>& alpha_;
00091   const uint M_;
00092 };
00093 
00094 // ****************************************************** CellA_M_of_x_MC **
00095 
00103 class CellA_M_of_x_MC : public concepts::CellPostprocess<Real> {
00104 public:
00120   CellA_M_of_x_MC(concepts::DynArray<Real>& A_M_alpha_of_x,
00121       const __gnu_cxx::hash_map<uint, uint>& data_level_map,
00122       const __gnu_cxx::hash_map<uint, Real>& Ea_of_x,
00123       const concepts::Array<Real>& sqrt_lambda,
00124       const concepts::Array<concepts::DynArray<Real> >& phi);
00125   virtual void operator() (const concepts::Element<Real>& elm);
00126   virtual void operator() (const concepts::Cell& cell);
00127 protected:
00128   virtual std::ostream& info(std::ostream& os) const;
00129 private:
00130   concepts::DynArray<Real>& A_M_;
00131   const __gnu_cxx::hash_map<uint, uint>& data_level_map_;
00132   const __gnu_cxx::hash_map<uint, Real>& Ea_;
00133   const concepts::Array<Real>& sqrt_lambda_;
00134   const concepts::Array<concepts::DynArray<Real> >& phi_;
00136   const uint M_;
00138   concepts::Array<Real> random_;
00139 };
00140 
00141 #endif // cellwise_hh

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