Hermes2D  3.0
weakforms_hcurl.h
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef __H2D_HCURL_WEAK_FORMS_H
17 #define __H2D_HCURL_WEAK_FORMS_H
18 
19 #include "../weakform/weakform.h"
20 #include "../spline.h"
21 
22 namespace Hermes
23 {
24  namespace Hermes2D
25  {
26  namespace WeakFormsHcurl
27  {
28  /* Default volumetric matrix form \int_{area} const_coeff * function_coeff(x, y) * E \cdot F d\bfx
29  const_coeff... constant number
30  function_coeff... (generally nonconstant) function of x, y
31  */
32 
33  template<typename Scalar>
34  class HERMES_API DefaultMatrixFormVol : public MatrixFormVol < Scalar >
35  {
36  public:
37  DefaultMatrixFormVol<Scalar>(int i, int j, std::string area = HERMES_ANY,
38  Scalar const_coeff = 1.0, Hermes2DFunction<Scalar>* f_coeff = nullptr,
39  SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR);
40 
41  DefaultMatrixFormVol<Scalar>(int i, int j, std::vector<std::string> areas,
42  Scalar const_coeff = 1.0, Hermes2DFunction<Scalar>* f_coeff = nullptr,
43  SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR);
44 
46 
47  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *u,
48  Func<double> *v, GeomVol<double> *e, Func<Scalar> **ext) const;
49 
50  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *u, Func<Hermes::Ord> *v,
51  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
52 
53  virtual MatrixFormVol<Scalar>* clone() const;
54 
55  private:
56  Scalar const_coeff;
57  Hermes2DFunction<Scalar>* function_coeff;
58  GeomType gt;
59  };
60 
61  /* FIXME
62  Default volumetric matrix form \int_{area} const_coeff \curl E \curl F d\bfx
63  coeff... constant number
64  */
65 
66  template<typename Scalar>
67  class HERMES_API DefaultJacobianCurlCurl : public MatrixFormVol < Scalar >
68  {
69  public:
70  DefaultJacobianCurlCurl(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
71  CubicSpline* c_spline = nullptr,
72  SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR);
73 
74  DefaultJacobianCurlCurl(int i, int j, std::vector<std::string> areas, Scalar const_coeff = 1.0,
75  CubicSpline* c_spline = nullptr,
76  SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR);
77 
79 
80  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *u,
81  Func<double> *v, GeomVol<double> *e, Func<Scalar> **ext) const;
82 
83  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *u, Func<Hermes::Ord> *v,
84  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
85 
86  virtual MatrixFormVol<Scalar>* clone() const;
87 
88  private:
89  int idx_j;
90  Scalar const_coeff;
91  CubicSpline* spline_coeff;
92  GeomType gt;
93  };
94 
95  /* FIXME
96  Default volumetric vector form \int_{area} (coeff0, coeff1) \cdot E d\bfx
97  coeff0, coeff1... constant numbers
98  */
99 
100  template<typename Scalar>
101  class HERMES_API DefaultVectorFormVol : public VectorFormVol < Scalar >
102  {
103  public:
104  DefaultVectorFormVol<Scalar>(int i, std::string area = HERMES_ANY,
105  Scalar const_coeff0 = 1.0, Scalar const_coeff1 = 1.0,
106  Hermes2DFunction<Scalar>* f_coeff0 = nullptr,
107  Hermes2DFunction<Scalar>* f_coeff1 = nullptr,
108  GeomType gt = HERMES_PLANAR);
109 
110  DefaultVectorFormVol<Scalar>(int i, std::vector<std::string> areas,
111  Scalar const_coeff0 = 1.0, Scalar const_coeff1 = 1.0,
112  Hermes2DFunction<Scalar>* f_coeff0 = nullptr,
113  Hermes2DFunction<Scalar>* f_coeff1 = nullptr,
114  GeomType gt = HERMES_PLANAR);
115 
117 
118  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
119  GeomVol<double> *e, Func<Scalar> **ext) const;
120 
121  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *v,
122  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
123 
124  virtual VectorFormVol<Scalar>* clone() const;
125 
126  private:
127  Scalar const_coeff0, const_coeff1;
128  Hermes2DFunction<Scalar>* function_coeff0, *function_coeff1;
129  GeomType gt;
130  };
131 
132  /* Default volumetric vector form \int_{area} const_coeff * function_coeff(x, y) * u_ext[0] * v d\bfx
133  const_coeff... constant number
134  function_coeff... (generally nonconstant) function of x, y
135  */
136 
137  template<typename Scalar>
138  class HERMES_API DefaultResidualVol : public VectorFormVol < Scalar >
139  {
140  public:
141  DefaultResidualVol(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
142  Hermes2DFunction<Scalar>* f_coeff = nullptr,
143  GeomType gt = HERMES_PLANAR);
144 
145  DefaultResidualVol(int i, std::vector<std::string> areas, Scalar const_coeff = 1.0,
146  Hermes2DFunction<Scalar>* f_coeff = nullptr,
147  GeomType gt = HERMES_PLANAR);
148 
150 
151  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
152  GeomVol<double> *e, Func<Scalar> **ext) const;
153 
154  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *v,
155  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
156 
157  virtual VectorFormVol<Scalar>* clone() const;
158 
159  private:
160  int idx_i;
161  Scalar const_coeff;
162  Hermes2DFunction<Scalar>* function_coeff;
163  GeomType gt;
164  };
165 
166  /* FIXME
167  Default volumetric vector form \int_{area} const_coeff * spline_coeff(u_ext[0]) *
168  \nabla u_ext[0] \cdot \nabla v d\bfx
169  const_coeff... constant number
170  spline_coeff... non-constant parameter given by a cubic spline
171  */
172 
173  template<typename Scalar>
174  class HERMES_API DefaultResidualCurlCurl : public VectorFormVol < Scalar >
175  {
176  public:
177  DefaultResidualCurlCurl(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
178  CubicSpline* c_spline = nullptr,
179  GeomType gt = HERMES_PLANAR);
180 
181  DefaultResidualCurlCurl(int i, std::vector<std::string> areas, Scalar const_coeff = 1.0,
182  CubicSpline* c_spline = nullptr,
183  GeomType gt = HERMES_PLANAR);
184 
186 
187  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
188  GeomVol<double> *e, Func<Scalar> **ext) const;
189 
190  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *v,
191  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
192 
193  virtual VectorFormVol<Scalar>* clone() const;
194 
195  private:
196  int idx_i;
197  Scalar const_coeff;
198  CubicSpline* spline_coeff;
199  GeomType gt;
200  };
201 
202  /* FIXME
203  Default surface matrix form \int_{area} coeff e tau f tau dS
204  coeff... constant number
205  */
206 
207  template<typename Scalar>
208  class HERMES_API DefaultMatrixFormSurf : public MatrixFormSurf < Scalar >
209  {
210  public:
211  DefaultMatrixFormSurf<Scalar>(int i, int j, std::string area = HERMES_ANY,
212  Scalar const_coeff = 1.0, Hermes2DFunction<Scalar>* f_coeff = nullptr,
213  GeomType gt = HERMES_PLANAR);
214 
215  DefaultMatrixFormSurf<Scalar>(int i, int j, std::vector<std::string> areas,
216  Scalar const_coeff = 1.0, Hermes2DFunction<Scalar>* f_coeff = nullptr,
217  GeomType gt = HERMES_PLANAR);
218 
220 
221  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *u, Func<double> *v,
222  GeomSurf<double> *e, Func<Scalar> **ext) const;
223 
224  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *u,
226 
227  virtual MatrixFormSurf<Scalar>* clone() const;
228 
229  private:
230  Scalar const_coeff;
231  Hermes2DFunction<Scalar>* function_coeff;
232  GeomType gt;
233  };
234 
235  /* FIXME
236  Default surface vector form \int_{area} const_coeff * function_coeff(x, y) * v dS
237  const_coeff... constant number
238  function_coeff... (generally nonconstant) function of x, y
239  */
240 
241  template<typename Scalar>
242  class HERMES_API DefaultVectorFormSurf : public VectorFormSurf < Scalar >
243  {
244  public:
245  DefaultVectorFormSurf<Scalar>(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
246  Hermes2DFunction<Scalar>* f_coeff = nullptr,
247  GeomType gt = HERMES_PLANAR);
248 
249  DefaultVectorFormSurf<Scalar>(int i, std::vector<std::string> areas, Scalar const_coeff = 1.0,
250  Hermes2DFunction<Scalar>* f_coeff = nullptr,
251  GeomType gt = HERMES_PLANAR);
252 
254 
255  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
256  GeomSurf<double> *e, Func<Scalar> **ext) const;
257 
258  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *v,
259  GeomSurf<Hermes::Ord> *e, Func<Ord> **ext) const;
260 
261  virtual VectorFormSurf<Scalar>* clone() const;
262 
263  private:
264  Scalar const_coeff;
265  Hermes2DFunction<Scalar>* function_coeff;
266  GeomType gt;
267  };
268 
269  /* FIXME
270  Default surface residual form \int_{area} coeff u_ext[0] tau f tau dS
271  coeff... constant number
272  */
273 
274  template<typename Scalar>
275  class HERMES_API DefaultResidualSurf : public VectorFormSurf < Scalar >
276  {
277  public:
278  DefaultResidualSurf(int i, std::string area = HERMES_ANY,
279  Scalar const_coeff = 1.0, Hermes2DFunction<Scalar>* f_coeff = nullptr,
280  GeomType gt = HERMES_PLANAR);
281 
282  DefaultResidualSurf(int i, std::vector<std::string> areas,
283  Scalar const_coeff = 1.0, Hermes2DFunction<Scalar>* f_coeff = nullptr,
284  GeomType gt = HERMES_PLANAR);
285 
287 
288  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
289  GeomSurf<double> *e, Func<Scalar> **ext) const;
290 
291  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[],
293 
294  virtual VectorFormSurf<Scalar>* clone() const;
295 
296  private:
297  Scalar const_coeff;
298  Hermes2DFunction<Scalar>* function_coeff;
299  GeomType gt;
300  };
301  }
302  }
303 }
304 #endif
Geometry - volumetric - for order calculation.
Definition: forms.h:90
Definition: adapt.h:24
Abstract, base class for vector Surface form - i.e. VectorForm, where the integration is with respect...
Definition: weakform.h:48
Abstract, base class for matrix Surface form - i.e. MatrixForm, where the integration is with respect...
Definition: weakform.h:47
SymFlag
Bilinear form symmetry flag, see WeakForm::add_matrix_form.
Definition: global.h:156
Calculated function values (from the class Function) on an element for assembling.
Definition: forms.h:214
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Geometry - surface - for order calculation.
Definition: forms.h:111
Abstract, base class for matrix Volumetric form - i.e. MatrixForm, where the integration is with resp...
Definition: weakform.h:45
GeomType
Geometrical type of weak forms.
Definition: global.h:148
Abstract, base class for vector Volumetric form - i.e. VectorForm, where the integration is with resp...
Definition: weakform.h:46