element.hh

Go to the documentation of this file.
1 
6 #ifndef bemElement_hh
7 #define bemElement_hh
8 
10 #include "geometry/cell2D.hh"
11 #include "space/tmatrix.hh"
12 #include "space/element.hh"
13 
14 namespace concepts {
15  // forward declatation
16  template<typename F> class ElementGraphics;
17 }
18 
19 namespace bem {
20 
21  // ************************************************************ Dirac3d000 **
22 
23 #if 1
24 
28  template <class F = concepts::Real>
30  public:
38  Dirac3d000(const concepts::Triangle3d& cell, uint idx[],
39  uint vtx[], uint n);
40 
42  inline const concepts::TMatrixBase<F>& T() const {return T_;}
46  inline const concepts::Vertex& support(uint i) const;
50  inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
51  virtual const concepts::Triangle3d& cell() const { return cell_; }
52  protected:
53  virtual std::ostream& info(std::ostream& os) const;
54 
55  private:
64  };
65 
66 
67  template <class F>
68  inline const concepts::Vertex& Dirac3d000<F>::support(uint i) const {
69  uint j = ctrl_ >> (i << 1);
70  return *cell_.connector().vertex(j & 3);
71  }
72 
73 #else
74 
79  template <class F = concepts::Real>
80  class Dirac3d000 : public conceptsElement<F> {
81  public:
89  inline Dirac3d000(const concepts::Triangle3d& cell, uint idx[],
90  uint vtx[], uint n);
91 
93  inline const concepts::TMatrixBase<F>& T() const {return T_;}
97  inline const concepts::Vertex& support(uint i) const;
101  concepts::Real3d vertex(uint i) const;
102 
103  protected:
104  virtual std::ostream& info(std::ostream& os) const;
105 
106  private:
113  };
114 
115  template <class F>
117  uint idx[], uint vtx[], uint n)
118  : cell_(cell), T_(n, n, idx) {
119 
120  ctrl_ = 0;
121  for(uint i = n; i--;) {ctrl_ <<= 2; ctrl_ |= vtx[i] & 3;}
122  }
123 
124  template <class F>
125  inline const concepts::Vertex& Dirac3d000<F>::support(uint i) const {
126  uint j = ctrl_ >> (i << 1);
127  return *cell_.connector().vertex(j & 3);
128  }
129 
130 #endif
131 
132  // *********************************************************** Linear3d000 **
133 
134 #if 1
135 
140  template <class F = concepts::Real>
142  public:
147  Linear3d000(const concepts::Triangle3d& cell, uint idx[]);
148 
150  inline const concepts::TMatrixBase<F>& T() const {return T_;}
152  inline const concepts::Unit3d& n() const {return n_;}
154  inline const concepts::Triangle& support() const;
158  inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
159 
160  virtual const concepts::Triangle3d& cell() const {return cell_;}
161 
162  virtual const concepts::ElementGraphics<F>* graphics() const;
163 
164  protected:
165  std::ostream& info(std::ostream& os) const;
166 
167  private:
175 
176  static std::unique_ptr<concepts::ElementGraphics<F> > graphics_;
177  };
178 
179  template <class F>
181  return cell_.connector();
182  }
183 
184 #else
185 
190  template <class F = concepts::Real>
191  class Linear3d000 : public concepts::ElementWithCell<F> {
192  public:
197  Linear3d000(const concepts::Triangle3d& cell, uint idx[]);
198 
200  inline const concepts::TMatrixBase<F>& T() const {return T_;}
202  inline const concepts::Unit3d& n() const {return n_;}
204  inline const concepts::Triangle& support() const;
208  concepts::Real3d vertex(uint i) const;
209 
210  virtual const concepts::Triangle3d& cell() const {return cell_;}
211 
212  protected:
213  std::ostream& info(std::ostream& os) const;
214 
215  private:
221  };
222 
223  template <class F>
224  inline const concepts::Triangle& Linear3d000<F>::support() const {
225  return cell_.connector();
226  }
227 
228 #endif
229 
230  // ********************************************************* Constant3d000 **
231 
232 #if 1
233 
238  template <class F = concepts::Real>
240  public:
246 
248  inline const concepts::TMatrixBase<F>& T() const {return T_;}
250  inline const concepts::Unit3d& n() const {return n_;}
252  inline const concepts::Triangle& support() const;
256  inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
257 
258  virtual const concepts::Triangle3d& cell() const {return cell_;}
259 
260  virtual const concepts::ElementGraphics<F>* graphics() const;
261 
262  protected:
263  std::ostream& info(std::ostream& os) const;
264 
265  private:
273 
274  static std::unique_ptr<concepts::ElementGraphics<F> > graphics_;
275  };
276 
277  template <class F>
279  return cell_.connector();
280  }
281 
282 #else
283 
288  template <class F = concepts::Real>
289  class Constant3d000 : public concepts::ElementWithCell<F> {
290  public:
295  Constant3d000(const concepts::Triangle3d& cell, uint idx);
296 
298  inline const concepts::TMatrixBase<F>& T() const {return T_;}
300  inline const concepts::Unit3d& n() const {return n_;}
302  inline const concepts::Triangle& support() const;
306  concepts::Real3d vertex(uint i) const;
307 
308  virtual const concepts::Triangle3d& cell() const {return cell_;}
309 
310  protected:
311  std::ostream& info(std::ostream& os) const;
312 
313  private:
319  };
320 
321  template <class F>
322  inline const concepts::Triangle& Constant3d000<F>::support() const {
323  return cell_.connector();
324  }
325 
326 #endif
327 
328  // ********************************************************* Constant3d001 **
329 
334  template<class F = concepts::Real>
336  public:
338  class Key {
339  public:
340  inline Key(uint l, uint j) : l_(l), j_(j) {}
341  inline Key(const Key& key) : l_(key.l()), j_(key.j()) {}
342 
343  inline int operator==(const Key& key) const {
344  return l_ == key.l() && j_ == key.j();
345  }
346  inline uint l() const {return l_;}
347  inline uint j() const {return j_;}
348 
349  private:
351  uint l_;
353  uint j_;
354  };
355 
362  const Constant3d001<F>::Key& key, uint idx);
363 
365  inline const concepts::TMatrixBase<F>& T() const {return T_;}
367  inline const concepts::Unit3d& n() const {return n_;}
369  inline const concepts::Triangle& support() const;
373  inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
374 
375  virtual concepts::Triangle3d& cell() const {return *cell_;}
377  inline const Key& key() const {return key_;};
378 
383  static inline uint maxlevel() {return maxlvl_;}
384  static inline uint minlevel() {return minlvl_;}
385  static inline void setmaxlevel(uint maxlvl) {maxlvl_ = maxlvl;}
386  static inline void setminlevel(uint minlvl) {minlvl_ = minlvl;}
387 
388  virtual const concepts::ElementGraphics<F>* graphics() const;
389 
390  protected:
391  std::ostream& info(std::ostream& os) const;
392 
393  private:
404 
406  static uint maxlvl_;
408  static uint minlvl_;
409 
410  static std::unique_ptr<concepts::ElementGraphics<F> > graphics_;
411  };
412 
413  template<class F>
415  return cell_->connector();
416  }
417 
418  // ********************************************************* Constant3d002 **
419 
420 #if 1
421 
426  template <class F = concepts::Real>
428  public:
434  virtual ~Constant3d002();
435 
437  inline const concepts::TMatrixBase<F>& T() const {return T_;}
439  inline const concepts::Unit3d& n() const {return n_;}
441  inline const concepts::Triangle& support() const;
445  inline const concepts::Real3d& vertex(uint i) const {return v_[i];}
446 
447  virtual const concepts::Triangle3d& cell() const {return cell_;}
448 
449  virtual const concepts::ElementGraphics<F>* graphics() const;
450 
451  protected:
452  std::ostream& info(std::ostream& os) const;
453 
454  private:
462 
463  static std::unique_ptr<concepts::ElementGraphics<F> > graphics_;
464  };
465 
466  template <class F>
468  return cell_.connector();
469  }
470 
471 #else
472 
477  template <class F = concepts::Real>
478  class Constant3d002 : public concepts::ElementWithCell<F> {
479  public:
484  Constant3d002(const concepts::Triangle3d& cell, uint idx);
485 
487  inline const concepts::TMatrixBase<F>& T() const {return T_;}
489  inline const concepts::Unit3d& n() const {return n_;}
491  inline const concepts::Triangle& support() const;
495  concepts::Real3d vertex(uint i) const;
496 
497  virtual const concepts::Triangle3d& cell() const {return cell_;}
498 
499  protected:
500  std::ostream& info(std::ostream& os) const;
501 
502  private:
508  };
509 
510  template <class F>
511  inline const concepts::Triangle& Constant3d002<F>::support() const {
512  return cell_.connector();
513  }
514 
515 #endif
516 
517 } // namespace bem
518 
519 #endif // bemElement_hh
Handles graphics output (to a file) of a specific element.
Definition: element.hh:16
const concepts::Triangle3d & cell_
Definition: element.hh:168
const concepts::TMatrixBase< F > & T() const
Returns the T matix of the element.
Definition: element.hh:437
Constant3d000(const concepts::Triangle3d &cell, uint idx)
Constructor.
const concepts::Vertex & support(uint i) const
Returns support of Dirac.
Definition: element.hh:68
std::ostream & info(std::ostream &os) const
Key with some level dependent information.
Definition: element.hh:338
concepts::TIndex< F > T_
T matrix.
Definition: element.hh:170
Linear triangular element.
Definition: element.hh:141
Constant triangular element.
Definition: element.hh:239
const concepts::Real3d & vertex(uint i) const
Returns a vertex of triangle.
Definition: element.hh:373
virtual const concepts::Triangle3d & cell() const
Definition: element.hh:258
virtual std::ostream & info(std::ostream &os) const
const concepts::TMatrixBase< F > & T() const
Returns the T matix of the element.
Definition: element.hh:365
Key key_
Key of the element.
Definition: element.hh:403
std::ostream & info(std::ostream &os) const
const concepts::Real3d & vertex(uint i) const
Returns vertex of triangle.
Definition: element.hh:50
concepts::TIndex< F > T_
T matrix.
Definition: element.hh:268
unsigned char uchar
Abbreviation for unsigned char.
Definition: typedefs.hh:45
const concepts::Triangle3d & cell_
Definition: element.hh:455
concepts::Real3d v_[3]
Vertices of the triangle.
Definition: element.hh:272
const concepts::TMatrixBase< F > & T() const
Returns the T matix of the element.
Definition: element.hh:248
concepts::Unit3d n_
Normal of the element.
Definition: element.hh:459
const concepts::Real3d & vertex(uint i) const
Returns a vertex of triangle.
Definition: element.hh:445
Key(uint l, uint j)
Definition: element.hh:340
static std::unique_ptr< concepts::ElementGraphics< F > > graphics_
Definition: element.hh:176
concepts::Real3d v_[3]
Vertices of the triangle.
Definition: element.hh:461
Element with cell.
static void setminlevel(uint minlvl)
Definition: element.hh:386
Linear3d000(const concepts::Triangle3d &cell, uint idx[])
Constructor.
concepts::Unit3d n_
Normal of the element.
Definition: element.hh:399
concepts::Unit3d n_
Normal of the element.
Definition: element.hh:270
static uint minlvl_
Minimal level of an element in the space.
Definition: element.hh:408
const concepts::Unit3d & n() const
Returns the normal of the element.
Definition: element.hh:152
static uint minlevel()
Definition: element.hh:384
const concepts::Real3d & vertex(uint i) const
Returns a vertex of triangle.
Definition: element.hh:256
static uint maxlvl_
Maximal level of an element in the space.
Definition: element.hh:406
std::ostream & info(std::ostream &os) const
virtual const concepts::ElementGraphics< F > * graphics() const
Constant space element with a level dependent key.
Definition: element.hh:335
const concepts::Triangle & support() const
Returns the support.
Definition: element.hh:467
concepts::TIndex< F > T_
T matrix.
Definition: element.hh:397
const concepts::Unit3d & n() const
Returns the normal of the element.
Definition: element.hh:250
A vertex in the topology.
Definition: topology.hh:40
virtual ~Constant3d002()
static std::unique_ptr< concepts::ElementGraphics< F > > graphics_
Definition: element.hh:463
A vector of dimension dim and length 1.
concepts::uchar ctrl_
Control which vertex belong to which DoF.
Definition: element.hh:59
virtual const concepts::Triangle3d & cell() const
Definition: element.hh:51
static std::unique_ptr< concepts::ElementGraphics< F > > graphics_
Definition: element.hh:274
const concepts::TMatrixBase< F > & T() const
Returns T matrix of the element.
Definition: element.hh:42
concepts::TIndex< F > T_
T matrix.
Definition: element.hh:457
virtual const concepts::Triangle3d & cell() const
Definition: element.hh:160
concepts::TIndex< F > T_
T matrix.
Definition: element.hh:61
const concepts::Triangle & support() const
Returns the support.
Definition: element.hh:414
Used for the basic classes of the boundary element method.
Definition: bform.hh:13
virtual const concepts::ElementGraphics< F > * graphics() const
An abstract class for a T matrix.
Definition: element.hh:37
Constant triangular element with normed basis function.
Definition: element.hh:427
const concepts::Real3d & vertex(uint i) const
Returns a vertex of triangle.
Definition: element.hh:158
const concepts::Unit3d & n() const
Returns the normal of the element.
Definition: element.hh:439
concepts::Unit3d n_
Normal of the element.
Definition: element.hh:174
const concepts::Triangle3d & cell_
Cell of the Dirac's.
Definition: element.hh:57
concepts::Real3d v_[3]
Vertices of the triangle.
Definition: element.hh:63
concepts::Triangle3d * cell_
Cell of the element.
Definition: element.hh:395
static void setmaxlevel(uint maxlvl)
Definition: element.hh:385
const concepts::Unit3d & n() const
Returns the normal of the element.
Definition: element.hh:367
Dirac element on triangles (used for collocation method).
Definition: element.hh:29
const concepts::Triangle & support() const
Returns the support.
Definition: element.hh:278
const concepts::Triangle & support() const
Returns the support.
Definition: element.hh:180
concepts::Real3d v_[3]
Vertices of the triangle.
Definition: element.hh:401
std::ostream & info(std::ostream &os) const
A 3D cell: triangle.
Definition: cell2D.hh:719
static uint maxlevel()
Maximal and minimal level of an element in the space.
Definition: element.hh:383
Constant3d002(const concepts::Triangle3d &cell, uint idx)
Constructor.
virtual const concepts::Triangle3d & cell() const
Definition: element.hh:447
concepts::Real3d v_[3]
Vertices of the triangle.
Definition: element.hh:172
virtual concepts::Triangle3d & cell() const
Definition: element.hh:375
Dirac3d000(const concepts::Triangle3d &cell, uint idx[], uint vtx[], uint n)
Constructor.
Key(const Key &key)
Definition: element.hh:341
virtual const concepts::ElementGraphics< F > * graphics() const
A triangle in the topology.
Definition: topology.hh:193
Constant3d001(concepts::Triangle3d &cell, const Constant3d001< F >::Key &key, uint idx)
Constructor.
int operator==(const Key &key) const
Definition: element.hh:343
const Key & key() const
Returns the key of the element.
Definition: element.hh:377
static std::unique_ptr< concepts::ElementGraphics< F > > graphics_
Definition: element.hh:410
const concepts::TMatrixBase< F > & T() const
Returns the T matix of the element.
Definition: element.hh:150
T matrix for linear and regular elements.
Definition: tmatrix.hh:428
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
virtual const concepts::ElementGraphics< F > * graphics() const
const concepts::Triangle3d & cell_
Definition: element.hh:266
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich