formulaFromWeight.hh

Go to the documentation of this file.
1 
6 #ifndef formulaFromWeight2D_hh
7 #define formulaFromWeight2D_hh
8 
9 #include <typeinfo>
11 #include "space/element.hh"
12 #include "shortestDist.hh"
13 #include "quad.hh"
14 #include "basics/exceptions.hh"
15 
16 // debugging
17 #include "basics/debug.hh"
18 
19 #define FormulaFromWeightConstr_D 0
20 #define FormulaFromWeightAppl_D 0
21 
22 
23 namespace hp2D {
24 
25  // ***************************************************** FormulaFromWeight **
26 
31  template<typename Weight = TrivialWeight>
33  public:
37  FormulaFromWeight(const SingularSet& singularities);
38 
39  virtual Real operator()(const concepts::Element<Real>& elm, const Real p,
40  const Real t = 0.0) const;
41  virtual Real operator()(const concepts::Element<Real>& elm,
42  const concepts::Real2d& p,
43  const Real t = 0.0) const;
44  virtual Real operator()(const concepts::Element<Real>& elm,
45  const concepts::Real3d& p,
46  const Real t = 0.0) const;
47  virtual FormulaFromWeight<Weight>* clone() const {
48  return new FormulaFromWeight(singularities_); }
49  private:
50  Weight weight_;
52  };
53 
54  template<typename Weight>
56  (const SingularSet& singularities) :
57  weight_(), singularities_(singularities) {
58  DEBUGL(FormulaFromWeightConstr_D, "weight is " << typeid(weight_).name());
59  DEBUGL(FormulaFromWeightConstr_D, "singularities: " << singularities_);
60  }
61 
62  template<typename Weight>
64  (const concepts::Element<Real>& elm, const Real p, const Real t) const {
65  const Quad<Real>* quad = dynamic_cast<const Quad<Real>*>(&elm);
67  return weight_(singularities_, concepts::Real2d(p, 0), quad);
68  }
69 
70  template<typename Weight>
72  (const concepts::Element<Real>& elm, const concepts::Real2d& p,
73  const Real t) const {
74  const Quad<Real>* quad = dynamic_cast<const Quad<Real>*>(&elm);
76  DEBUGL(FormulaFromWeightAppl_D, "p = " << p << ", singularities = "
77  << singularities_);
78  return weight_(singularities_, p, quad);
79  }
80 
81  template<typename Weight>
83  (const concepts::Element<Real>& elm, const concepts::Real3d& p,
84  const Real t) const {
85  const Quad<Real>* quad = dynamic_cast<const Quad<Real>*>(&elm);
87  return weight_(singularities_, concepts::Real2d(p[0], p[1]), quad);
88  }
89 
90 } // namespace hp2D
91 
92 #endif // formulaFromWeight2D_hh
FormulaFromWeight(const SingularSet &singularities)
Constructor.
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Definition: exceptions.hh:394
2D hp-FEM for H1-conforming elements.
#define DEBUGL(doit, msg)
Class for handling a set of singular vertices.
Definition: singularSet.hh:63
Makes it possible to plot a given Weight.
const SingularSet & singularities_
virtual FormulaFromWeight< Weight > * clone() const
Virtual constructor.
Exception class for assertions.
Definition: exceptions.hh:258
Interface for a formula defined element by element.
virtual Real operator()(const concepts::Element< Real > &elm, const Real p, const Real t=0.0) const
#define FormulaFromWeightConstr_D
#define FormulaFromWeightAppl_D
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich