Go to the documentation of this file.00001
00002
00003
00004 #ifndef bemElement_hh
00005 #define bemElement_hh
00006
00007 #include "basics/vectorsMatricesForward.hh"
00008 #include "geometry/cell2D.hh"
00009 #include "space/tmatrix.hh"
00010 #include "space/element.hh"
00011
00012 namespace concepts {
00013
00014 template<typename F> class ElementGraphics;
00015 }
00016
00017 namespace bem {
00018
00019
00020
00021 #if 1
00022
00026 template <class F = concepts::Real>
00027 class Dirac3d000 : public concepts::ElementWithCell<F> {
00028 public:
00036 Dirac3d000(const concepts::Triangle3d& cell, uint idx[],
00037 uint vtx[], uint n);
00038
00040 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00044 inline const concepts::Vertex& support(uint i) const;
00048 inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
00049 virtual const concepts::Triangle3d& cell() const { return cell_; }
00050 protected:
00051 virtual std::ostream& info(std::ostream& os) const;
00052
00053 private:
00055 const concepts::Triangle3d& cell_;
00057 concepts::uchar ctrl_;
00059 concepts::TIndex<F> T_;
00061 concepts::Real3d v_[3];
00062 };
00063
00064
00065 template <class F>
00066 inline const concepts::Vertex& Dirac3d000<F>::support(uint i) const {
00067 uint j = ctrl_ >> (i << 1);
00068 return *cell_.connector().vertex(j & 3);
00069 }
00070
00071 #else
00072
00077 template <class F = concepts::Real>
00078 class Dirac3d000 : public conceptsElement<F> {
00079 public:
00087 inline Dirac3d000(const concepts::Triangle3d& cell, uint idx[],
00088 uint vtx[], uint n);
00089
00091 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00095 inline const concepts::Vertex& support(uint i) const;
00099 concepts::Real3d vertex(uint i) const;
00100
00101 protected:
00102 virtual std::ostream& info(std::ostream& os) const;
00103
00104 private:
00106 const concepts::Triangle3d& cell_;
00108 concepts::uchar ctrl_;
00110 concepts::TIndex<F> T_;
00111 };
00112
00113 template <class F>
00114 inline Dirac3d000<F>::Dirac3d000(const concepts::Triangle3d& cell,
00115 uint idx[], uint vtx[], uint n)
00116 : cell_(cell), T_(n, n, idx) {
00117
00118 ctrl_ = 0;
00119 for(uint i = n; i--;) {ctrl_ <<= 2; ctrl_ |= vtx[i] & 3;}
00120 }
00121
00122 template <class F>
00123 inline const concepts::Vertex& Dirac3d000<F>::support(uint i) const {
00124 uint j = ctrl_ >> (i << 1);
00125 return *cell_.connector().vertex(j & 3);
00126 }
00127
00128 #endif
00129
00130
00131
00132 #if 1
00133
00138 template <class F = concepts::Real>
00139 class Linear3d000 : public concepts::ElementWithCell<F> {
00140 public:
00145 Linear3d000(const concepts::Triangle3d& cell, uint idx[]);
00146
00148 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00150 inline const concepts::Unit3d& n() const {return n_;}
00152 inline const concepts::Triangle& support() const;
00156 inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
00157
00158 virtual const concepts::Triangle3d& cell() const {return cell_;}
00159
00160 virtual const concepts::ElementGraphics<F>* graphics() const;
00161
00162 protected:
00163 std::ostream& info(std::ostream& os) const;
00164
00165 private:
00166 const concepts::Triangle3d& cell_;
00168 concepts::TIndex<F> T_;
00170 concepts::Real3d v_[3];
00172 concepts::Unit3d n_;
00173
00174 static std::auto_ptr<concepts::ElementGraphics<F> > graphics_;
00175 };
00176
00177 template <class F>
00178 inline const concepts::Triangle& Linear3d000<F>::support() const {
00179 return cell_.connector();
00180 }
00181
00182 #else
00183
00188 template <class F = concepts::Real>
00189 class Linear3d000 : public concepts::ElementWithCell<F> {
00190 public:
00195 Linear3d000(const concepts::Triangle3d& cell, uint idx[]);
00196
00198 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00200 inline const concepts::Unit3d& n() const {return n_;}
00202 inline const concepts::Triangle& support() const;
00206 concepts::Real3d vertex(uint i) const;
00207
00208 virtual const concepts::Triangle3d& cell() const {return cell_;}
00209
00210 protected:
00211 std::ostream& info(std::ostream& os) const;
00212
00213 private:
00214 const concepts::Triangle3d& cell_;
00216 concepts::TIndex<F> T_;
00218 concepts::Unit3d n_;
00219 };
00220
00221 template <class F>
00222 inline const concepts::Triangle& Linear3d000<F>::support() const {
00223 return cell_.connector();
00224 }
00225
00226 #endif
00227
00228
00229
00230 #if 1
00231
00236 template <class F = concepts::Real>
00237 class Constant3d000 : public concepts::ElementWithCell<F> {
00238 public:
00243 Constant3d000(const concepts::Triangle3d& cell, uint idx);
00244
00246 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00248 inline const concepts::Unit3d& n() const {return n_;}
00250 inline const concepts::Triangle& support() const;
00254 inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
00255
00256 virtual const concepts::Triangle3d& cell() const {return cell_;}
00257
00258 virtual const concepts::ElementGraphics<F>* graphics() const;
00259
00260 protected:
00261 std::ostream& info(std::ostream& os) const;
00262
00263 private:
00264 const concepts::Triangle3d& cell_;
00266 concepts::TIndex<F> T_;
00268 concepts::Unit3d n_;
00270 concepts::Real3d v_[3];
00271
00272 static std::auto_ptr<concepts::ElementGraphics<F> > graphics_;
00273 };
00274
00275 template <class F>
00276 inline const concepts::Triangle& Constant3d000<F>::support() const {
00277 return cell_.connector();
00278 }
00279
00280 #else
00281
00286 template <class F = concepts::Real>
00287 class Constant3d000 : public concepts::ElementWithCell<F> {
00288 public:
00293 Constant3d000(const concepts::Triangle3d& cell, uint idx);
00294
00296 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00298 inline const concepts::Unit3d& n() const {return n_;}
00300 inline const concepts::Triangle& support() const;
00304 concepts::Real3d vertex(uint i) const;
00305
00306 virtual const concepts::Triangle3d& cell() const {return cell_;}
00307
00308 protected:
00309 std::ostream& info(std::ostream& os) const;
00310
00311 private:
00312 const concepts::Triangle3d& cell_;
00314 concepts::TIndex<F> T_;
00316 concepts::Unit3d n_;
00317 };
00318
00319 template <class F>
00320 inline const concepts::Triangle& Constant3d000<F>::support() const {
00321 return cell_.connector();
00322 }
00323
00324 #endif
00325
00326
00327
00332 template<class F = concepts::Real>
00333 class Constant3d001 : public concepts::ElementWithCell<F> {
00334 public:
00336 class Key {
00337 public:
00338 inline Key(uint l, uint j) : l_(l), j_(j) {}
00339 inline Key(const Key& key) : l_(key.l()), j_(key.j()) {}
00340
00341 inline int operator==(const Key& key) const {
00342 return l_ == key.l() && j_ == key.j();
00343 }
00344 inline uint l() const {return l_;}
00345 inline uint j() const {return j_;}
00346
00347 private:
00349 uint l_;
00351 uint j_;
00352 };
00353
00359 Constant3d001(concepts::Triangle3d& cell,
00360 const Constant3d001<F>::Key& key, uint idx);
00361
00363 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00365 inline const concepts::Unit3d& n() const {return n_;}
00367 inline const concepts::Triangle& support() const;
00371 inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
00372
00373 virtual concepts::Triangle3d& cell() const {return *cell_;}
00375 inline const Key& key() const {return key_;};
00376
00381 static inline uint maxlevel() {return maxlvl_;}
00382 static inline uint minlevel() {return minlvl_;}
00383 static inline void setmaxlevel(uint maxlvl) {maxlvl_ = maxlvl;}
00384 static inline void setminlevel(uint minlvl) {minlvl_ = minlvl;}
00385
00386 virtual const concepts::ElementGraphics<F>* graphics() const;
00387
00388 protected:
00389 std::ostream& info(std::ostream& os) const;
00390
00391 private:
00393 concepts::Triangle3d* cell_;
00395 concepts::TIndex<F> T_;
00397 concepts::Unit3d n_;
00399 concepts::Real3d v_[3];
00401 Key key_;
00402
00404 static uint maxlvl_;
00406 static uint minlvl_;
00407
00408 static std::auto_ptr<concepts::ElementGraphics<F> > graphics_;
00409 };
00410
00411 template<class F>
00412 inline const concepts::Triangle& Constant3d001<F>::support() const {
00413 return cell_->connector();
00414 }
00415
00416
00417
00418 #if 1
00419
00424 template <class F = concepts::Real>
00425 class Constant3d002 : public concepts::ElementWithCell<F> {
00426 public:
00431 Constant3d002(const concepts::Triangle3d& cell, uint idx);
00432 virtual ~Constant3d002();
00433
00435 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00437 inline const concepts::Unit3d& n() const {return n_;}
00439 inline const concepts::Triangle& support() const;
00443 inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
00444
00445 virtual const concepts::Triangle3d& cell() const {return cell_;}
00446
00447 virtual const concepts::ElementGraphics<F>* graphics() const;
00448
00449 protected:
00450 std::ostream& info(std::ostream& os) const;
00451
00452 private:
00453 const concepts::Triangle3d& cell_;
00455 concepts::TIndex<F> T_;
00457 concepts::Unit3d n_;
00459 concepts::Real3d v_[3];
00460
00461 static std::auto_ptr<concepts::ElementGraphics<F> > graphics_;
00462 };
00463
00464 template <class F>
00465 inline const concepts::Triangle& Constant3d002<F>::support() const {
00466 return cell_.connector();
00467 }
00468
00469 #else
00470
00475 template <class F = concepts::Real>
00476 class Constant3d002 : public concepts::ElementWithCell<F> {
00477 public:
00482 Constant3d002(const concepts::Triangle3d& cell, uint idx);
00483
00485 inline const concepts::TMatrixBase<F>& T() const {return T_;}
00487 inline const concepts::Unit3d& n() const {return n_;}
00489 inline const concepts::Triangle& support() const;
00493 concepts::Real3d vertex(uint i) const;
00494
00495 virtual const concepts::Triangle3d& cell() const {return cell_;}
00496
00497 protected:
00498 std::ostream& info(std::ostream& os) const;
00499
00500 private:
00501 const concepts::Triangle3d& cell_;
00503 concepts::TIndex<F> T_;
00505 concepts::Unit3d n_;
00506 };
00507
00508 template <class F>
00509 inline const concepts::Triangle& Constant3d002<F>::support() const {
00510 return cell_.connector();
00511 }
00512
00513 #endif
00514
00515 }
00516
00517 #endif // bemElement_hh