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

bem/lform.hh
Go to the documentation of this file.
00001 /* Linear forms for the boundary element method
00002  */
00003 
00004 #ifndef bemLform_hh
00005 #define bemLform_hh
00006 
00007 #include <memory>
00008 #include "function/linearForm.hh"
00009 #include "bemInt.hh"
00010 #include "bem/element.hh"
00011 
00012 namespace concepts {
00013 
00014   // forward declaration
00015   template <typename F>
00016   class Formula;
00017 }
00018 
00019 namespace bem {
00020 
00021   // ************************************************************ LaplaceSLP **
00022 
00026   template <class F = concepts::Real>
00027   class LaplaceSLP : public concepts::LinearForm<F> {
00029     Lpl003<F> qrA_;
00030     Lpl004<F> qrB_;
00031 
00033     concepts::Real3d x_;
00035     uint gauss_;
00036 
00037   public:
00042     inline LaplaceSLP(const concepts::Real3d& x, uint gauss = 0)
00043       : x_(x), gauss_(gauss) {}
00044 
00050     void operator()(const concepts::Element<F>& elm,
00051         concepts::ElementMatrix<F>& em);
00052     inline void operator()(const Linear3d000<F>& elm,
00053          concepts::ElementMatrix<F>& em);
00054     inline void operator()(const Constant3d000<F>& elm,
00055          concepts::ElementMatrix<F>& em);
00056     inline void operator()(const Constant3d002<F>& elm,
00057          concepts::ElementMatrix<F>& em);
00058   };
00059 
00060   template <class F>
00061   inline void LaplaceSLP<F>::operator()(const Linear3d000<F>& elm,
00062           concepts::ElementMatrix<F>& em) {
00063     F m[3];
00064     qrA_(x_, elm, gauss_, m);
00065 
00066     em.resize(3, 1); em(0, 0) = m[0]; em(1, 0) = m[1]; em(2, 0) = m[2];
00067   }
00068 
00069   template <class F>
00070   inline void LaplaceSLP<F>::operator()(const Constant3d000<F>& elm,
00071           concepts::ElementMatrix<F>& em) {
00072     F m;
00073     qrB_(x_, elm, gauss_, &m);
00074 
00075     em.resize(1, 1); em(0, 0) = m;
00076   }
00077 
00078   template <class F>
00079   inline void LaplaceSLP<F>::operator()(const Constant3d002<F>& elm,
00080           concepts::ElementMatrix<F>& em) {
00081     F m;
00082     qrB_(x_, elm, gauss_, &m);
00083 
00084     em.resize(1, 1); em(0, 0) = m;
00085   }
00086 
00087   // ******************************************************* AdaptLaplaceSLP **
00088 
00097   template <class F = concepts::Real>
00098   class AdaptLaplaceSLP : public concepts::LinearForm<F> {
00100     Lpl004<F> qrA_;
00101 
00103     concepts::Real3d x_;
00105     uint gauss_;
00106     concepts::Real deltaG_;
00107 
00108   public:
00113     inline AdaptLaplaceSLP(const concepts::Real3d& x, uint gauss = 0,
00114          concepts::Real deltaG = 1.0) :
00115       x_(x), gauss_(gauss), deltaG_(deltaG) {}
00116 
00120     void operator()(const concepts::Element<F>& elm,
00121                     concepts::ElementMatrix<F>& em);
00122     inline void operator()(const Constant3d001<F>& elm,
00123                            concepts::ElementMatrix<F>& em);
00124   };
00125 
00126   template <class F>
00127   inline void AdaptLaplaceSLP<F>::operator()(const Constant3d001<F>& elm,
00128                concepts::ElementMatrix<F>& em) {
00129     F m;
00130     uint dG = (uint)((Constant3d001<F>::maxlevel() - elm.key().l()) * deltaG_);
00131     qrA_(x_, elm, gauss_+dG, &m);
00132 
00133     em.resize(1, 1);  em(0, 0) = m;
00134   }
00135 
00136   // ************************************************************ LaplaceDLP **
00137 
00141   template <class F = concepts::Real>
00142   class LaplaceDLP : public concepts::LinearForm<F> {
00144     Lpl000<F> qrA_;
00145     Lpl001<F> qrB_;
00146 
00148     concepts::Real3d x_;
00150     uint gauss_;
00151 
00152   public:
00157     inline LaplaceDLP(const concepts::Real3d& x, uint gauss = 0)
00158       : x_(x), gauss_(gauss) {}
00159 
00165     void operator()(const concepts::Element<F>& elm,
00166         concepts::ElementMatrix<F>& em);
00167     inline void operator()(const Linear3d000<F>& elm,
00168          concepts::ElementMatrix<F>& em);
00169     inline void operator()(const Constant3d000<F>& elm,
00170          concepts::ElementMatrix<F>& em);
00171     inline void operator()(const Constant3d001<F>& elm,
00172          concepts::ElementMatrix<F>& em);
00173     inline void operator()(const Constant3d002<F>& elm,
00174          concepts::ElementMatrix<F>& em);
00175   };
00176 
00177   template <class F>
00178   inline void LaplaceDLP<F>::operator()(const Linear3d000<F>& elm,
00179           concepts::ElementMatrix<F>& em) {
00180     F m[3];
00181     qrA_(x_, elm, gauss_, m);
00182 
00183     em.resize(3, 1); em(0, 0) = m[0]; em(1, 0) = m[1]; em(2, 0) = m[2];
00184   }
00185 
00186   template <class F>
00187   inline void LaplaceDLP<F>::operator()(const Constant3d000<F>& elm,
00188           concepts::ElementMatrix<F>& em) {
00189     F m;
00190     qrB_(x_, elm, gauss_, &m);
00191 
00192     em.resize(1, 1); em(0, 0) = m;
00193   }
00194 
00195   template <class F>
00196   inline void LaplaceDLP<F>::operator()(const Constant3d001<F>& elm,
00197           concepts::ElementMatrix<F>& em) {
00198     F m;
00199     qrB_(x_, elm, gauss_, &m);
00200 
00201     em.resize(1, 1); em(0, 0) = m;
00202   }
00203 
00204   template <class F>
00205   inline void LaplaceDLP<F>::operator()(const Constant3d002<F>& elm,
00206           concepts::ElementMatrix<F>& em) {
00207     F m;
00208     qrB_(x_, elm, gauss_, &m);
00209 
00210     em.resize(1, 1); em(0, 0) = m;
00211   }
00212 
00213   // *********************************************** agloAdaptLaplaceDLP **
00214 
00222   template <class F = concepts::Real>
00223   class AdaptLaplaceDLP : public concepts::LinearForm<F> {
00225     Lpl001<F> qrA_;
00226 
00228     concepts::Real3d x_;
00230     uint gauss_;
00231     concepts::Real deltaG_;
00232 
00233   public:
00238     inline AdaptLaplaceDLP(const concepts::Real3d& x, uint gauss = 0, 
00239          concepts::Real deltaG = 1.0) :
00240       x_(x), gauss_(gauss), deltaG_(deltaG) {}
00241 
00242     
00246     void operator()(const concepts::Element<F>& elm,
00247                     concepts::ElementMatrix<F>& em);
00248     inline void operator()(const Constant3d001<F>& elm,
00249                            concepts::ElementMatrix<F>& em); 
00250   };
00251 
00252   template <class F>
00253   inline void AdaptLaplaceDLP<F>::operator()(const Constant3d001<F>& elm,
00254                concepts::ElementMatrix<F>& em) {
00255     concepts::Real m;
00256     uint dG = (uint)((Constant3d001<F>::maxlevel() - elm.key().l()) * deltaG_);
00257     qrA_(x_, elm, gauss_+dG, &m);
00258 
00259     em.resize(1, 1);  em(0, 0) = m; 
00260   }
00261 
00262   // ***************************************************************** Riesz **
00263 
00266   class Riesz : public concepts::LinearForm<concepts::Real> {
00267   public:
00272     Riesz(const concepts::Formula<Real>& formula, uint gauss = 0);
00273 
00281     void operator()(const concepts::Element<concepts::Real>& elm,
00282         concepts::ElementMatrix<concepts::Real>& em);
00283     void operator()(const Linear3d000<concepts::Real>& elm,
00284         concepts::ElementMatrix<concepts::Real>& em);
00285     void operator()(const Constant3d000<concepts::Real>& elm,
00286         concepts::ElementMatrix<concepts::Real>& em);
00287     void operator()(const Constant3d001<concepts::Real>& elm,
00288         concepts::ElementMatrix<concepts::Real>& em);
00289     void operator()(const Constant3d002<concepts::Real>& elm,
00290         concepts::ElementMatrix<concepts::Real>& em);
00291     void operator()(const Dirac3d000<concepts::Real>& elm,
00292         concepts::ElementMatrix<concepts::Real>& em);
00293 
00294     inline uint gauss() const {return gauss_;}
00295 
00296   private:
00298     std::auto_ptr<const concepts::Formula<Real> > frm_;
00299 
00301     const uint   gauss_;
00302   };
00303 
00304   // *************************************************************** Neumann **
00305 
00310   class Neumann : public concepts::LinearForm<concepts::Real> {
00311   public:
00318     Neumann(concepts::Formula<Real> const& fx, concepts::Formula<Real> const& fy,
00319       concepts::Formula<Real> const& fz, uint gauss = 0);
00320 
00329     void operator()(const concepts::Element<concepts::Real>& elm,
00330         concepts::ElementMatrix<concepts::Real>& em);
00331     void operator()(const Linear3d000<concepts::Real>& elm,
00332         concepts::ElementMatrix<concepts::Real>& em);
00333     inline uint gauss() const {return gauss_;}
00334 
00335   private:
00336     // spatial dimension
00337     uint dim_;
00338 
00340     std::auto_ptr<const concepts::Formula<Real> > frmx_, frmy_, frmz_;
00341 
00343     uint   gauss_;
00344   };
00345 
00346 } // namespace bem
00347 
00348 #endif // bemLform_hh

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