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

bem/bformAdapt.hh
Go to the documentation of this file.
00001 /* Bilinear forms for adaptivity for the boundary element method
00002  */
00003 
00004 #ifndef bformAdapt_hh
00005 #define bformAdapt_hh
00006 
00007 #include "operator/bilinearForm.hh"
00008 #include "bemInt.hh"
00009 #include "bem/element.hh"
00010 
00011 // debugging bilinear forms
00012 #define AdaptLaplaceDL00_D 0
00013 
00014 namespace bem {
00015 
00016   // ****************************************************** AdaptLaplaceDL00 **
00017 
00023   template <class F>
00024   class AdaptLaplaceDL00 : public concepts::BilinearForm<F> {
00025   public:
00035     inline AdaptLaplaceDL00(uint stroud = 2, uint gauss = 2,
00036           concepts::Real dist = 0.0,
00037           concepts::Real eta = 0.5);
00038 #if AdaptLaplaceDL00_D
00039     virtual ~AdaptLaplaceDL00() {
00040       std::cout << "AdaptLaplaceDL00(samel=" << samel_ << ", far=" << far_;
00041       std::cout << ", recX=" << recX_ << ", recY=" << recY_;
00042       std::cout << ", rec=" << rec_ << ", farrec=" << farrec_ << ")\n";
00043     };
00044 #endif
00045 
00052     void operator()(const concepts::Element<F>& elmX,
00053                     const concepts::Element<F>& elmY,
00054                     concepts::ElementMatrix<F>& em);
00055     void operator()(const Constant3d001<F>& elmX,
00056                     const Constant3d001<F>& elmY,
00057                     concepts::ElementMatrix<F>& em);
00058 
00059     virtual AdaptLaplaceDL00* clone() const {
00060       return new AdaptLaplaceDL00(stroud_, gauss_, dist_, eta_); }
00061   private:
00063     void ball_(const Constant3d001<F>& elm, concepts::Real3d* c,
00064          concepts::Real* r) const;
00065     void ball_(const concepts::Triangle3d& cell, concepts::Real3d* c,
00066          concepts::Real* r) const;
00073     inline bool admissible_(const concepts::Real3d* cX,
00074           const concepts::Real* rX,
00075                             const concepts::Real3d* cY,
00076           const concepts::Real* rY) const;
00083     void update_(concepts::Triangle3d& cell, const Constant3d001<F>& elm,
00084                  uint deltal, F* m, bool swp) const;
00085 
00087     uint stroud_;
00089     uint gauss_;
00091     concepts::Real dist_;
00093     concepts::Real eta_;
00095     LplGal014<F> qr_;
00096 
00098     concepts::Real3d* c_;
00099     concepts::Real*   r_;
00100 
00101 #if AdaptLaplaceDL00_D
00102     // Debug information
00103     // # integration (on the same level)
00104     uint samel_;
00105     // # integration (elements far away from each other)
00106     uint far_;
00107     // # integration (elements far away in recursive call)
00108     mutable uint farrec_;
00109     // # integration (recursive with \f$l_X > l_Y\f$)
00110     uint recX_;
00111     // # integration (recursive with \f$l_Y > l_X\f$)
00112     uint recY_;
00113     // # recursive integration calls
00114     mutable uint rec_;
00115 #endif
00116   };
00117 
00118   template <class F>
00119   inline AdaptLaplaceDL00<F>::AdaptLaplaceDL00(uint stroud, uint gauss,
00120                  concepts::Real dist,
00121                  concepts::Real eta)
00122     : stroud_(stroud), gauss_(gauss), dist_(dist), eta_(eta), c_(0), r_(0) {
00123 #if AdaptLaplaceDL00_D
00124     samel_ = 0;  far_ = 0;  recX_ = 0;  recY_ = 0;  rec_ = 0;  farrec_ = 0;
00125 #endif
00126   }
00127 
00128   template <class F>
00129   inline bool
00130   AdaptLaplaceDL00<F>::admissible_(const concepts::Real3d* cX,
00131            const concepts::Real* rX,
00132            const concepts::Real3d* cY,
00133            const concepts::Real* rY) const {
00134     return concepts::Real3d(*cX - *cY).l2() * eta_ > *rX + *rY;
00135   }
00136 
00137   // ****************************************************** AdaptLaplaceDL01 **
00138 
00150   template <class F>
00151   class AdaptLaplaceDL01 : public concepts::BilinearForm<F> {
00152   public:
00166     inline AdaptLaplaceDL01(uint gaussX = 2, uint gaussY = 2,
00167           concepts::Real deltaG = 1.0,
00168           concepts::Real dist = 0.0,
00169           concepts::Real eta = 0.5);
00170 
00177     void operator()(const concepts::Element<F>& elmX,
00178                     const concepts::Element<F>& elmY,
00179                     concepts::ElementMatrix<F>& em);
00180     void operator()(const Constant3d001<F>& elmX,
00181                     const Constant3d001<F>& elmY,
00182                     concepts::ElementMatrix<F>& em);
00183 
00184     virtual AdaptLaplaceDL01* clone() const {
00185       return new AdaptLaplaceDL01(gaussX_, gaussY_, deltaG_, dist_, eta_); }
00186   private:
00188     void ball_(const Constant3d001<F>& elm, concepts::Real3d* c,
00189          concepts::Real* r) const;
00190     void ball_(const concepts::Triangle3d& cell, concepts::Real3d* c,
00191          concepts::Real* r) const;
00198     inline bool admissible_(const concepts::Real3d* cX,
00199           const concepts::Real* rX,
00200                             const concepts::Real3d* cY,
00201           const concepts::Real* rY) const;
00208     void update_(concepts::Triangle3d& cell, const Constant3d001<F>& elm,
00209                  uint deltal, F* m, bool swp) const;
00210 
00212     uint gaussX_;
00213     uint gaussY_;
00215     concepts::Real deltaG_;
00217     concepts::Real dist_;
00219     concepts::Real eta_;
00220 
00222     LplGal011<F> qr_;
00223 
00225     concepts::Real3d* c_;
00226     concepts::Real*   r_;
00227   };
00228 
00229   template <class F>
00230   inline AdaptLaplaceDL01<F>::AdaptLaplaceDL01(uint gaussX, uint gaussY,
00231                  concepts::Real deltaG,
00232                  concepts::Real dist,
00233                  concepts::Real eta)
00234     : gaussX_(gaussX), gaussY_(gaussY), deltaG_(deltaG), dist_(dist),
00235       eta_(eta), c_(0), r_(0) {
00236   }
00237 
00238   template <class F>
00239   inline bool
00240   AdaptLaplaceDL01<F>::admissible_(const concepts::Real3d* cX,
00241            const concepts::Real* rX,
00242            const concepts::Real3d* cY,
00243            const concepts::Real* rY) const {
00244     return concepts::Real3d(*cX - *cY).l2() * eta_ > *rX + *rY;
00245   }
00246 
00247   // ****************************************************** AdaptLaplaceSL01 **
00248 
00260   template <class F>
00261   class AdaptLaplaceSL01 : public concepts::BilinearForm<F> {
00262   public:
00276     inline AdaptLaplaceSL01(uint stroud = 0, uint gauss = 0,
00277           concepts::Real deltaI = 1.0,
00278           concepts::Real dist = 0.0,
00279           concepts::Real eta = 0.5);
00280 
00287     void operator()(const concepts::Element<F>& elmX,
00288                     const concepts::Element<F>& elmY,
00289                     concepts::ElementMatrix<F>& em);
00290     void operator()(const Constant3d001<F>& elmX,
00291                     const Constant3d001<F>& elmY,
00292                     concepts::ElementMatrix<F>& em);
00293 
00294     virtual AdaptLaplaceSL01* clone() const {
00295       return new AdaptLaplaceSL01(stroud_, gauss_, deltaI_, dist_, eta_); }
00296   private:
00298     void ball_(const Constant3d001<F>& elm, concepts::Real3d* c,
00299          concepts::Real* r) const;
00300     void ball_(const concepts::Triangle3d& cell, concepts::Real3d* c,
00301          concepts::Real* r) const;
00308     inline bool admissible_(const concepts::Real3d* cX,
00309           const concepts::Real* rX,
00310                             const concepts::Real3d* cY,
00311           const concepts::Real* rY) const;
00318     void update_(concepts::Triangle3d& cell, const Constant3d001<F>& elm,
00319                  uint deltal, F* m, bool swp) const;
00320 
00322     uint stroud_;
00324     uint gauss_;
00326     concepts::Real deltaI_;
00328     concepts::Real dist_;
00330     concepts::Real eta_;
00331 
00333     LplGal018<F> qr_;
00334 
00336     concepts::Real3d* c_;
00337     concepts::Real*   r_;
00338   };
00339 
00340   template <class F>
00341   inline AdaptLaplaceSL01<F>::AdaptLaplaceSL01(uint stroud, uint gauss,
00342                  concepts::Real deltaI,
00343                  concepts::Real dist,
00344                  concepts::Real eta)
00345     : stroud_(stroud), gauss_(gauss), deltaI_(deltaI), dist_(dist),
00346       eta_(eta), c_(0), r_(0) {
00347   }
00348 
00349   template <class F>
00350   inline bool
00351   AdaptLaplaceSL01<F>::admissible_(const concepts::Real3d* cX,
00352            const concepts::Real* rX,
00353            const concepts::Real3d* cY,
00354            const concepts::Real* rY) const {
00355     return concepts::Real3d(*cX - *cY).l2() * eta_ > *rX + *rY;
00356   }
00357 
00358 } // namespace bem
00359   
00360 #endif // bformAdapt_hh

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