function.hh

Go to the documentation of this file.
1 
7 #ifndef VECTORIAL_FUNCTION_HH
8 #define VECTORIAL_FUNCTION_HH
9 
10 #include <memory>
11 #include "space/function.hh"
12 #include "vectorial/vectorial.hh"
13 
14 namespace vectorial {
15 
16  using concepts::Real;
17  using concepts::Real2d;
18  using concepts::Real3d;
19 
20 
21  // ******************************************************* ElementFunction **
22 
30  template<class F, class G = typename concepts::Realtype<F>::type>
32  public Vectorial<const concepts::ElementFunction<F,G> > {
33  public:
34  ElementFunction(const uint vdim, uint arrayWidth = 0)
35  : Vectorial<const concepts::ElementFunction<F,G> >(vdim, arrayWidth) {}
36 
37  virtual ~ElementFunction();
39  virtual uint n() const;
41  virtual void operator() (const concepts::Element<G>& elm,
42  const concepts::Array<F>& coeff,
43  concepts::Array<F>& val, const uint *i) const;
47  virtual void operator() (const concepts::Element<G>& elm, const uint* j,
48  concepts::Array<F>& val, const uint* i) const;
50 
53  virtual void operator() (const concepts::Element<G>& elm,
54  const concepts::Array<F>& coeff,
55  concepts::Array<F>& val, const Real p,
56  const Real t = 0.0) const;
57  virtual void operator() (const concepts::Element<G>& elm,
58  const concepts::Array<F>& coeff,
59  concepts::Array<F>& val, const concepts::Real2d& p,
60  const Real t = 0.0) const;
61  virtual void operator() (const concepts::Element<G>& elm,
62  const concepts::Array<F>& coeff,
63  concepts::Array<F>& val, const concepts::Real3d& p,
64  const Real t = 0.0) const;
66 
67  virtual ElementFunction<F,G>* clone() const;
68 
75  virtual void put(const concepts::ElementFunction<F,G>& vdata,
76  const uint a = 0, const uint b = 0);
77  protected:
78  virtual std::ostream& info(std::ostream& os) const;
79  };
80 
81 
82  // ********************************************** ElementFunctionComponent **
83 
90  template<class F, class G = Real>
92  {
93  public:
95  const uint component);
96 
98 
100  {
101  return new ElementFunctionComponent(fun_->clone(), n_);
102  }
103 
104  virtual uint n() const {
105  return n_;
106  }
107 
108  virtual void operator()(const concepts::Element<G>& elm,
109  const concepts::Array<F>& coeff,
110  concepts::Array<F>& val,
111  const uint *i) const;
112 
113  virtual void operator()(const concepts::Element<G>& elm, const uint* j,
114  concepts::Array<F>& val, const uint* i) const;
115 
116  virtual void operator()(const concepts::Element<G>& elm,
117  const concepts::Array<F>& coeff,
118  concepts::Array<F>& val,
119  const Real p, const Real t = 0.0) const;
120 
121  virtual void operator()(const concepts::Element<G>& elm,
122  const concepts::Array<F>& coeff,
123  concepts::Array<F>& val,
124  const Real2d& p, const Real t = 0.0) const;
125 
126  virtual void operator()(const concepts::Element<G>& elm,
127  const concepts::Array<F>& coeff,
128  concepts::Array<F>& val,
129  const Real3d& p, const Real t = 0.0) const;
130 
131  protected:
132  virtual std::ostream& info(std::ostream &os) const
133  {
134  return os << fun_;
135  }
136  private:
138  uint n_;
140  std::unique_ptr<ElementFunction<F,G> > fun_;
141 
144  : n_(n), fun_(fun)
145  {}
146  };
147 
148  // ************************************************** ElementFunctionAllComponents **
149 
155  template<class F, class G = Real>
157  {
158  public:
160 
162 
164  {
165  return new ElementFunctionAllComponents(fun_->clone(), n_);
166  }
167 
168  virtual uint n() const {
169  return n_;
170  }
171 
172  virtual void operator()(const concepts::Element<G>& elm,
173  const concepts::Array<F>& coeff,
174  concepts::Array<F>& val,
175  const uint *i) const;
176 
177  virtual void operator()(const concepts::Element<G>& elm, const uint* j,
178  concepts::Array<F>& val, const uint* i) const;
179 
180  virtual void operator()(const concepts::Element<G>& elm,
181  const concepts::Array<F>& coeff,
182  concepts::Array<F>& val,
183  const Real p, const Real t = 0.0) const;
184 
185  virtual void operator()(const concepts::Element<G>& elm,
186  const concepts::Array<F>& coeff,
187  concepts::Array<F>& val,
188  const Real2d& p, const Real t = 0.0) const;
189 
190  virtual void operator()(const concepts::Element<G>& elm,
191  const concepts::Array<F>& coeff,
192  concepts::Array<F>& val,
193  const Real3d& p, const Real t = 0.0) const;
194 
195  protected:
196  virtual std::ostream& info(std::ostream &os) const
197  {
198  return os << fun_;
199  }
200  private:
202  uint n_;
204  std::unique_ptr<ElementFunction<F,G> > fun_;
205 
208  : n_(n), fun_(fun)
209  {}
210  };
211 
212  // ****************************************************** SymmetrizeTensor **
213 
222  template<uint dim, class F, class G = Real>
224  {
225  public:
231 
232  virtual ~SymmetrizeTensor(){}
233 
235  {
236  return new SymmetrizeTensor( *fun_ );
237  }
238 
239  virtual uint n() const {
240  return dim*dim;
241  }
242 
243  virtual void operator()(const concepts::Element<G>& elm,
244  const concepts::Array<F>& coeff,
245  concepts::Array<F>& val,
246  const uint *i) const;
247 
248  virtual void operator()(const concepts::Element<G>& elm, const uint* j,
249  concepts::Array<F>& val, const uint* i) const;
250 
251  virtual void operator()(const concepts::Element<G>& elm,
252  const concepts::Array<F>& coeff,
253  concepts::Array<F>& val,
254  const Real p, const Real t = 0.0) const;
255 
256  virtual void operator()(const concepts::Element<G>& elm,
257  const concepts::Array<F>& coeff,
258  concepts::Array<F>& val,
259  const Real2d& p, const Real t = 0.0) const;
260 
261  virtual void operator()(const concepts::Element<G>& elm,
262  const concepts::Array<F>& coeff,
263  concepts::Array<F>& val,
264  const Real3d& p, const Real t = 0.0) const;
265 
266  protected:
267  virtual std::ostream& info(std::ostream &os) const
268  {
269  return os << concepts::typeOf(*this)<<"(" << *fun_ << ")";
270  }
271 
272  private:
273  std::unique_ptr<const concepts::ElementFunction<F,G> > fun_;
274 
275  };
276 
277 
278 } // namespace vectorial
279 
280 
281 #endif // VECTORIAL_FUNCTION_HH
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const uint *i) const
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real3d &p, const Real t=0.0) const
An abstract class for a function in a FE space.
virtual void put(const concepts::ElementFunction< F, G > &vdata, const uint a=0, const uint b=0)
Add a component, it will not deleted here.
uint n_
Number of components.
Definition: function.hh:202
Vector valued problems.
Definition: spaceTraits.hh:24
Vectorial element function with the same scalar element function on each component.
Definition: function.hh:157
virtual std::ostream & info(std::ostream &os) const
Definition: function.hh:132
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const uint *i) const
Evaluates the function on precalculated quadrature points.
std::unique_ptr< ElementFunction< F, G > > fun_
Vectorial element function with one component.
Definition: function.hh:140
virtual std::ostream & info(std::ostream &os) const
Definition: function.hh:196
virtual std::ostream & info(std::ostream &os) const
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real3d &p, const Real t=0.0) const
Point< Real, 2 > Real2d
virtual void operator()(const concepts::Element< G > &elm, const uint *j, concepts::Array< F > &val, const uint *i) const
Point< Real, 3 > Real3d
ElementFunctionComponent(ElementFunction< F, G > *fun, uint n)
Private constructor.
Definition: function.hh:143
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real3d &p, const Real t=0.0) const
uint n_
Number of components.
Definition: function.hh:138
SymmetrizeTensor(const concepts::ElementFunction< F, G > &fun)
Constructor.
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real2d &p, const Real t=0.0) const
Element function for the symmetrized gradient of a vector valued function.
Definition: function.hh:224
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real p, const Real t=0.0) const
virtual std::ostream & info(std::ostream &os) const
Definition: function.hh:267
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const uint *i) const
ElementFunctionAllComponents(ElementFunction< F, G > *fun, uint n)
Private constructor.
Definition: function.hh:207
An array of objects.
Definition: bilinearForm.hh:23
Base class for most classes which do vector valued problems.
Definition: vectorial.hh:59
Element function for selecting one scalar component of the vectorial solution.
Definition: function.hh:92
Vector valued element function.
Definition: function.hh:32
ElementFunction(const uint vdim, uint arrayWidth=0)
Definition: function.hh:34
virtual void operator()(const concepts::Element< G > &elm, const uint *j, concepts::Array< F > &val, const uint *i) const
virtual ElementFunctionComponent< F, G > * clone() const
Definition: function.hh:99
virtual uint n() const
Definition: function.hh:239
std::unique_ptr< const concepts::ElementFunction< F, G > > fun_
Definition: function.hh:273
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const uint *i) const
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real2d &p, const Real t=0.0) const
ElementFunctionComponent(uint vdim, const concepts::ElementFunction< F, G > &fun, const uint component)
std::unique_ptr< ElementFunction< F, G > > fun_
Vectorial element function.
Definition: function.hh:204
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real p, const Real t=0.0) const
virtual void operator()(const concepts::Element< G > &elm, const uint *j, concepts::Array< F > &val, const uint *i) const
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real2d &p, const Real t=0.0) const
ElementFunctionAllComponents(uint vdim, const concepts::ElementFunction< F, G > &fun)
virtual void operator()(const concepts::Element< G > &elm, const concepts::Array< F > &coeff, concepts::Array< F > &val, const Real p, const Real t=0.0) const
std::string typeOf(const T &t)
Return the typeid name of a class object.
Definition: output.hh:43
virtual ElementFunction< F, G > * clone() const
virtual SymmetrizeTensor< dim, F, G > * clone() const
Definition: function.hh:234
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual ElementFunctionAllComponents< F, G > * clone() const
Definition: function.hh:163
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
virtual uint n() const
Number of components.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich