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

app-bholger/gfem/gfemLaplace.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "gfemQuad.h"
00004 #include "gfemQuadFast.h"
00005 #include "operator/bilinearForm.hh"
00006 #include "hp2D/bf_laplace.hh"
00007 
00008 namespace concepts {
00009 namespace gfem {
00010 
00011 class GfemLaplace : 
00012   //public concepts::BilinearForm<Cmplx,Real> 
00013   public hp2D::Laplace<Cmplx> 
00014 {
00015 public:
00016     typedef RCP<const ElementFormula<Cmplx> >  ElementFormulaRCP;
00017 
00021     GfemLaplace(ElementFormulaRCP formula,
00022         bool ignoreNonGfem = false) 
00023       : hp2D::Laplace<Cmplx>(formula)
00024       , formula(formula)
00025       , ignoreNonGfem(ignoreNonGfem)
00026     { }
00027 
00028 
00029     virtual GfemLaplace* clone() const { 
00030       return new GfemLaplace(*this);
00031     }
00032 
00033     GfemLaplace(const GfemLaplace& other)
00034       : hp2D::Laplace<Cmplx>(other.formula)
00035       , formula(other.formula)
00036       , ignoreNonGfem(ignoreNonGfem)
00037     { }
00038 
00039     virtual void operator()(
00040           const concepts::Element<Real>& elmX,
00041           const concepts::Element<Real>& elmY, 
00042           concepts::ElementMatrix<Cmplx>& em); 
00043 
00044     void operator()(
00045         const GfemQuad& elmX, 
00046         const GfemQuad& elmY, 
00047         concepts::ElementMatrix<Cmplx>& em);
00048 
00049     void operator()(
00050         const GfemQuadFast& elmX, 
00051         const GfemQuadFast& elmY, 
00052         concepts::ElementMatrix<Cmplx>& em);
00053 
00054     void computeEM_reference(
00055           const GfemQuadFast& elmX, 
00056           const GfemQuadFast& elmY, 
00057           concepts::ElementMatrix<Cmplx>& em);
00058 
00059 
00060     virtual ~GfemLaplace() {}
00061 
00062 protected:
00063     virtual std::ostream& info(std::ostream& os) const;
00064 
00065 private:
00066     ElementFormulaRCP formula; 
00067 
00068 protected:
00069     void allocHelpers(const GfemQuadFast& elm1);
00070     void fillHelpers(const GfemQuadFast& elm1);
00071 
00072     Cmplx& getH4(int ikappa1, int ikappa2, int imic1, int imic2) {
00073       assert(ikappa1 <  nKappa[0]);
00074       assert(ikappa2 <  nKappa[1]);
00075       assert(imic1 <  nMic);
00076       assert(imic2 <  nMic);
00077       return H4[ikappa1 + (ikappa2 + (imic1 + imic2 * nMic) * nKappa[1] ) * nKappa[0]];
00078     }
00079 
00080     Cmplx& getH2(int ikappa1, int imac2, int jmac2, int imic1, int imic2) {
00081       assert(ikappa1 <  nKappa[0]);
00082       assert(imac2 <  nMacro[1]);
00083       assert(jmac2 <  nMacro[1]);
00084       assert(imic1 <  nMic);
00085       assert(imic2 <  nMic);
00086       return H2[ikappa1 + (imac2 + (jmac2 + (imic1 + imic2 * nMic) 
00087                         * nMacro[1]) * nMacro[1] ) * nKappa[0]];
00088     }
00089 
00090     Cmplx& getH1(int nu1, int jmac1, int imac2, int jmac2, int imic1, int imic2) {
00091       assert(nu1 <  nMacro[0]);
00092       assert(jmac1 <  nMacro[0]);
00093       assert(imac2 <  nMacro[1]);
00094       assert(jmac2 <  nMacro[1]);
00095       assert(imic1 <  nMic);
00096       assert(imic2 <  nMic);
00097       return H1[nu1 + (jmac1 + (imac2 + (jmac2 + (imic1 + imic2 * nMic) 
00098                         * nMacro[1]) * nMacro[1] ) * nMacro[1]) * nMacro[1] ];
00099     }
00100 
00101 protected:
00102     int nMic;
00103     int pMacro[2];
00104     int nMacro[2]; // = pMacro + 1
00105     int nKappa[2]; // = 2*pMacro + 1
00106 
00107     Cmplx* H4;
00108     Cmplx* H2;
00109     Cmplx* H1;
00110 
00111     static const int SELX = 0;
00112     static const int SELY = 1;
00113     static const int SELMAC = KarniadakisCoeffs::SELMAC;
00114     static const int SELMIC = 1 - KarniadakisCoeffs::SELMAC;
00115     
00116     int i_diff1; // differential selector func 1
00117     int i_diff2; // differential selector func 2
00118     int i_comp; // component selector
00119 
00120     KarniadakisCoeffs* kcoeffsX_;
00121     KarniadakisCoeffs* kcoeffsY_;
00122     bool ignoreNonGfem;
00123 };
00124 
00125 } // namespace
00126 } // namespace

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