MFEM  v3.4
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
coefficient.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_COEFFICIENT
13 #define MFEM_COEFFICIENT
14 
15 #include "../config/config.hpp"
16 #include "../linalg/linalg.hpp"
17 #include "intrules.hpp"
18 #include "eltrans.hpp"
19 
20 namespace mfem
21 {
22 
23 class Mesh;
24 
25 #ifdef MFEM_USE_MPI
26 class ParMesh;
27 #endif
28 
29 
30 /// Base class Coefficient that may optionally depend on time.
32 {
33 protected:
34  double time;
35 
36 public:
37  Coefficient() { time = 0.; }
38 
39  void SetTime(double t) { time = t; }
40  double GetTime() { return time; }
41 
42  virtual double Eval(ElementTransformation &T,
43  const IntegrationPoint &ip) = 0;
44 
46  const IntegrationPoint &ip, double t)
47  {
48  SetTime(t);
49  return Eval(T, ip);
50  }
51 
52  virtual ~Coefficient() { }
53 };
54 
55 
56 /// Subclass constant coefficient.
58 {
59 public:
60  double constant;
61 
62  /// c is value of constant function
63  explicit ConstantCoefficient(double c = 1.0) { constant=c; }
64 
65  /// Evaluate the coefficient
66  virtual double Eval(ElementTransformation &T,
67  const IntegrationPoint &ip)
68  { return (constant); }
69 };
70 
71 /// class for piecewise constant coefficient
73 {
74 private:
75  Vector constants;
76 
77 public:
78 
79  /// Constructs a piecewise constant coefficient in NumOfSubD subdomains
80  explicit PWConstCoefficient(int NumOfSubD = 0) : constants(NumOfSubD)
81  { constants = 0.0; }
82 
83  /** c should be a vector defined by attributes, so for region with
84  attribute i c[i] is the coefficient in that region */
86  { constants.SetSize(c.Size()); constants=c; }
87 
88  /// Update constants
89  void UpdateConstants(Vector &c) {constants.SetSize(c.Size()); constants=c;}
90 
91  /// Member function to access or modify the value of the i-th constant
92  double &operator()(int i) { return constants(i-1); }
93 
94  /// Set domain constants equal to the same constant c
95  void operator=(double c) { constants = c; }
96 
97  /// Returns the number of constants
98  int GetNConst() { return constants.Size(); }
99 
100  /// Evaluate the coefficient function
101  virtual double Eval(ElementTransformation &T,
102  const IntegrationPoint &ip);
103 };
104 
105 /// class for C-function coefficient
107 {
108 protected:
109  double (*Function)(const Vector &);
110  double (*TDFunction)(const Vector &, double);
111 
112 public:
113  /// Define a time-independent coefficient from a C-function
114  FunctionCoefficient(double (*f)(const Vector &))
115  {
116  Function = f;
117  TDFunction = NULL;
118  }
119 
120  /// Define a time-dependent coefficient from a C-function
121  FunctionCoefficient(double (*tdf)(const Vector &, double))
122  {
123  Function = NULL;
124  TDFunction = tdf;
125  }
126 
127  /// (DEPRECATED) Define a time-independent coefficient from a C-function
128  /** @deprecated Use the method where the C-function, @a f, uses a const
129  Vector argument instead of Vector. */
130  FunctionCoefficient(double (*f)(Vector &))
131  {
132  Function = reinterpret_cast<double(*)(const Vector&)>(f);
133  TDFunction = NULL;
134  }
135 
136  /// (DEPRECATED) Define a time-dependent coefficient from a C-function
137  /** @deprecated Use the method where the C-function, @a tdf, uses a const
138  Vector argument instead of Vector. */
139  FunctionCoefficient(double (*tdf)(Vector &, double))
140  {
141  Function = NULL;
142  TDFunction = reinterpret_cast<double(*)(const Vector&,double)>(tdf);
143  }
144 
145  /// Evaluate coefficient
146  virtual double Eval(ElementTransformation &T,
147  const IntegrationPoint &ip);
148 };
149 
150 class GridFunction;
151 
152 /// Coefficient defined by a GridFunction. This coefficient is mesh dependent.
154 {
155 private:
156  GridFunction *GridF;
157  int Component;
158 
159 public:
160  /** Construct GridFunctionCoefficient from a given GridFunction, and
161  optionally specify a component to use if it is a vector GridFunction. */
163  { GridF = gf; Component = comp; }
164 
165  void SetGridFunction(GridFunction *gf) { GridF = gf; }
166  GridFunction * GetGridFunction() const { return GridF; }
167 
168  virtual double Eval(ElementTransformation &T,
169  const IntegrationPoint &ip);
170 };
171 
173 {
174 private:
175  Coefficient * Q1;
176  Coefficient * Q2;
177  double (*Transform1)(double);
178  double (*Transform2)(double,double);
179 
180 public:
181  TransformedCoefficient (Coefficient * q,double (*F)(double))
182  : Q1(q), Transform1(F) { Q2 = 0; Transform2 = 0; }
184  double (*F)(double,double))
185  : Q1(q1), Q2(q2), Transform2(F) { Transform1 = 0; }
186 
187  virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip);
188 };
189 
190 /// Delta function coefficient
192 {
193 protected:
194  double center[3], scale, tol;
196  int sdim;
197  double (*tdf)(double);
198 
199 public:
201  {
202  center[0] = center[1] = center[2] = 0.; scale = 1.; tol = 1e-12;
203  weight = NULL; sdim = 0; tdf = NULL;
204  }
205  DeltaCoefficient(double x, double s)
206  {
207  center[0] = x; center[1] = 0.; center[2] = 0.; scale = s; tol = 1e-12;
208  weight = NULL; sdim = 1; tdf = NULL;
209  }
210  DeltaCoefficient(double x, double y, double s)
211  {
212  center[0] = x; center[1] = y; center[2] = 0.; scale = s; tol = 1e-12;
213  weight = NULL; sdim = 2; tdf = NULL;
214  }
215  DeltaCoefficient(double x, double y, double z, double s)
216  {
217  center[0] = x; center[1] = y; center[2] = z; scale = s; tol = 1e-12;
218  weight = NULL; sdim = 3; tdf = NULL;
219  }
220  void SetDeltaCenter(const Vector& center);
221  void SetScale(double _s) { scale = _s; }
222  /// Set a time-dependent function that multiplies the Scale().
223  void SetFunction(double (*f)(double)) { tdf = f; }
224  /** @brief Set the tolerance used during projection onto GridFunction to
225  identifying the Mesh vertex where the Center() of the delta function
226  lies. */
227  void SetTol(double _tol) { tol = _tol; }
228  /// Set a weight Coefficient that multiplies the DeltaCoefficient.
229  /** The weight Coefficient multiplies the value returned by EvalDelta() but
230  not the value returned by Scale().
231  The weight Coefficient is also used as the L2-weight function when
232  projecting the DeltaCoefficient onto a GridFunction, so that the weighted
233  integral of the projection is exactly equal to the Scale(). */
234  void SetWeight(Coefficient *w) { weight = w; }
235  const double *Center() { return center; }
236  /** @brief Return the scale set by SetScale() multiplied by the
237  time-dependent function specified by SetFunction(), if set. */
238  double Scale() { return tdf ? (*tdf)(GetTime())*scale : scale; }
239  /// See SetTol() for description of the tolerance parameter.
240  double Tol() { return tol; }
241  /// See SetWeight() for description of the weight Coefficient.
242  Coefficient *Weight() { return weight; }
244  /// Return the Scale() multiplied by the weight Coefficient, if any.
245  double EvalDelta(ElementTransformation &T, const IntegrationPoint &ip);
246  /** @brief A DeltaFunction cannot be evaluated. Calling this method will
247  cause an MFEM error, terminating the application. */
248  virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
249  { mfem_error("DeltaCoefficient::Eval"); return 0.; }
250  virtual ~DeltaCoefficient() { delete weight; }
251 };
252 
253 /// Coefficient defined on a subset of domain or boundary attributes
255 {
256 private:
257  Coefficient *c;
258  Array<int> active_attr;
259 
260 public:
262  { c = &_c; attr.Copy(active_attr); }
263 
264  virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
265  { return active_attr[T.Attribute-1] ? c->Eval(T, ip, GetTime()) : 0.0; }
266 };
267 
269 {
270 protected:
271  int vdim;
272  double time;
273 
274 public:
275  VectorCoefficient(int vd) { vdim = vd; time = 0.; }
276 
277  void SetTime(double t) { time = t; }
278  double GetTime() { return time; }
279 
280  /// Returns dimension of the vector.
281  int GetVDim() { return vdim; }
282 
283  virtual void Eval(Vector &V, ElementTransformation &T,
284  const IntegrationPoint &ip) = 0;
285 
286  // General implementation using the Eval method for one IntegrationPoint.
287  // Can be overloaded for more efficient implementation.
288  virtual void Eval(DenseMatrix &M, ElementTransformation &T,
289  const IntegrationRule &ir);
290 
291  virtual ~VectorCoefficient() { }
292 };
293 
295 {
296 private:
297  Vector vec;
298 public:
300  : VectorCoefficient(v.Size()), vec(v) { }
302  virtual void Eval(Vector &V, ElementTransformation &T,
303  const IntegrationPoint &ip) { V = vec; }
304 };
305 
307 {
308 private:
309  void (*Function)(const Vector &, Vector &);
310  void (*TDFunction)(const Vector &, double, Vector &);
311  Coefficient *Q;
312 
313 public:
314  /// Construct a time-independent vector coefficient from a C-function
315  VectorFunctionCoefficient(int dim, void (*F)(const Vector &, Vector &),
316  Coefficient *q = NULL)
317  : VectorCoefficient(dim), Q(q)
318  {
319  Function = F;
320  TDFunction = NULL;
321  }
322 
323  /// Construct a time-dependent vector coefficient from a C-function
325  void (*TDF)(const Vector &, double, Vector &),
326  Coefficient *q = NULL)
327  : VectorCoefficient(dim), Q(q)
328  {
329  Function = NULL;
330  TDFunction = TDF;
331  }
332 
334  virtual void Eval(Vector &V, ElementTransformation &T,
335  const IntegrationPoint &ip);
336 
338 };
339 
340 /// Vector coefficient defined by an array of scalar coefficients.
342 {
343 private:
344  Array<Coefficient*> Coeff;
345 
346 public:
347  /// Construct vector of dim coefficients.
348  explicit VectorArrayCoefficient(int dim);
349 
350  /// Returns i'th coefficient.
351  Coefficient* GetCoeff(int i) { return Coeff[i]; }
352 
353  Coefficient **GetCoeffs() { return Coeff; }
354 
355  /// Sets coefficient in the vector.
356  void Set(int i, Coefficient *c) { delete Coeff[i]; Coeff[i] = c; }
357 
358  /// Evaluates i'th component of the vector.
359  double Eval(int i, ElementTransformation &T, const IntegrationPoint &ip)
360  { return Coeff[i] ? Coeff[i]->Eval(T, ip, GetTime()) : 0.0; }
361 
363  virtual void Eval(Vector &V, ElementTransformation &T,
364  const IntegrationPoint &ip);
365 
366  /// Destroys vector coefficient.
367  virtual ~VectorArrayCoefficient();
368 };
369 
370 /// Vector coefficient defined by a vector GridFunction
372 {
373 protected:
375 
376 public:
378 
380  GridFunction * GetGridFunction() const { return GridFunc; }
381 
382  virtual void Eval(Vector &V, ElementTransformation &T,
383  const IntegrationPoint &ip);
384 
385  virtual void Eval(DenseMatrix &M, ElementTransformation &T,
386  const IntegrationRule &ir);
387 
389 };
390 
391 /// VectorDeltaCoefficient: DeltaCoefficient with a direction
393 {
394 protected:
397 
398 public:
400  : VectorCoefficient(_vdim), dir(_vdim), d() { }
402  : VectorCoefficient(_dir.Size()), dir(_dir), d() { }
403  VectorDeltaCoefficient(const Vector& _dir, double x, double s)
404  : VectorCoefficient(_dir.Size()), dir(_dir), d(x,s) { }
405  VectorDeltaCoefficient(const Vector& _dir, double x, double y, double s)
406  : VectorCoefficient(_dir.Size()), dir(_dir), d(x,y,s) { }
407  VectorDeltaCoefficient(const Vector& _dir, double x, double y, double z,
408  double s)
409  : VectorCoefficient(_dir.Size()), dir(_dir), d(x,y,z,s) { }
410 
411  /// Replace the associated DeltaCoeficient with a new DeltaCoeficient.
412  /** The new DeltaCoeficient cannot have a specified weight Coefficient, i.e.
413  DeltaCoeficient::Weight() should return NULL. */
414  void SetDeltaCoefficient(const DeltaCoefficient& _d) { d = _d; }
415  /// Return the associated scalar DeltaCoefficient.
417  void SetDirection(const Vector& _d);
418 
419  void GetDeltaCenter(Vector& center) { d.GetDeltaCenter(center); }
420  /** @brief Return the specified direction vector multiplied by the value
421  returned by DeltaCoefficient::EvalDelta() of the associated scalar
422  DeltaCoefficient. */
424  const IntegrationPoint &ip);
426  /** @brief A VectorDeltaFunction cannot be evaluated. Calling this method
427  will cause an MFEM error, terminating the application. */
428  virtual void Eval(Vector &V, ElementTransformation &T,
429  const IntegrationPoint &ip)
430  { mfem_error("VectorDeltaCoefficient::Eval"); }
432 };
433 
434 /// VectorCoefficient defined on a subset of domain or boundary attributes
436 {
437 private:
439  Array<int> active_attr;
440 
441 public:
443  : VectorCoefficient(vc.GetVDim())
444  { c = &vc; attr.Copy(active_attr); }
445 
446  virtual void Eval(Vector &V, ElementTransformation &T,
447  const IntegrationPoint &ip);
448 
449  virtual void Eval(DenseMatrix &M, ElementTransformation &T,
450  const IntegrationRule &ir);
451 };
452 
453 
455 {
456 protected:
457  int height, width;
458  double time;
459 
460 public:
461  explicit MatrixCoefficient(int dim) { height = width = dim; time = 0.; }
462 
463  MatrixCoefficient(int h, int w) : height(h), width(w), time(0.) { }
464 
465  void SetTime(double t) { time = t; }
466  double GetTime() { return time; }
467 
468  int GetHeight() const { return height; }
469  int GetWidth() const { return width; }
470  // For backward compatibility
471  int GetVDim() const { return width; }
472 
473  virtual void Eval(DenseMatrix &K, ElementTransformation &T,
474  const IntegrationPoint &ip) = 0;
475 
476  virtual ~MatrixCoefficient() { }
477 };
478 
480 {
481 private:
482  DenseMatrix mat;
483 public:
485  : MatrixCoefficient(m.Height(), m.Width()), mat(m) { }
488  const IntegrationPoint &ip) { M = mat; }
489 };
490 
492 {
493 private:
494  void (*Function)(const Vector &, DenseMatrix &);
495  void (*TDFunction)(const Vector &, double, DenseMatrix &);
496  Coefficient *Q;
497  DenseMatrix mat;
498 
499 public:
500  /// Construct a time-independent square matrix coefficient from a C-function
501  MatrixFunctionCoefficient(int dim, void (*F)(const Vector &, DenseMatrix &),
502  Coefficient *q = NULL)
503  : MatrixCoefficient(dim), Q(q)
504  {
505  Function = F;
506  TDFunction = NULL;
507  mat.SetSize(0);
508  }
509 
510  /// Construct a constant matrix coefficient times a scalar Coefficient
512  : MatrixCoefficient(m.Height(), m.Width()), Q(&q)
513  {
514  Function = NULL;
515  TDFunction = NULL;
516  mat = m;
517  }
518 
519  /// Construct a time-dependent square matrix coefficient from a C-function
521  void (*TDF)(const Vector &, double, DenseMatrix &),
522  Coefficient *q = NULL)
523  : MatrixCoefficient(dim), Q(q)
524  {
525  Function = NULL;
526  TDFunction = TDF;
527  mat.SetSize(0);
528  }
529 
530  virtual void Eval(DenseMatrix &K, ElementTransformation &T,
531  const IntegrationPoint &ip);
532 
534 };
535 
537 {
538 private:
539  Array<Coefficient *> Coeff;
540 
541 public:
542 
543  explicit MatrixArrayCoefficient (int dim);
544 
545  Coefficient* GetCoeff (int i, int j) { return Coeff[i*width+j]; }
546 
547  void Set(int i, int j, Coefficient * c) { delete Coeff[i*width+j]; Coeff[i*width+j] = c; }
548 
549  double Eval(int i, int j, ElementTransformation &T, const IntegrationPoint &ip)
550  { return Coeff[i*width+j] ? Coeff[i*width+j] -> Eval(T, ip, GetTime()) : 0.0; }
551 
552  virtual void Eval(DenseMatrix &K, ElementTransformation &T,
553  const IntegrationPoint &ip);
554 
555  virtual ~MatrixArrayCoefficient();
556 };
557 
558 /// MatrixCoefficient defined on a subset of domain or boundary attributes
560 {
561 private:
563  Array<int> active_attr;
564 
565 public:
567  : MatrixCoefficient(mc.GetHeight(), mc.GetWidth())
568  { c = &mc; attr.Copy(active_attr); }
569 
570  virtual void Eval(DenseMatrix &K, ElementTransformation &T,
571  const IntegrationPoint &ip);
572 };
573 
574 /** Compute the Lp norm of a function f.
575  \f$ \| f \|_{Lp} = ( \int_\Omega | f |^p d\Omega)^{1/p} \f$ */
576 double ComputeLpNorm(double p, Coefficient &coeff, Mesh &mesh,
577  const IntegrationRule *irs[]);
578 
579 /** Compute the Lp norm of a vector function f = {f_i}_i=1...N.
580  \f$ \| f \|_{Lp} = ( \sum_i \| f_i \|_{Lp}^p )^{1/p} \f$ */
581 double ComputeLpNorm(double p, VectorCoefficient &coeff, Mesh &mesh,
582  const IntegrationRule *irs[]);
583 
584 #ifdef MFEM_USE_MPI
585 /** Compute the global Lp norm of a function f.
586  \f$ \| f \|_{Lp} = ( \int_\Omega | f |^p d\Omega)^{1/p} \f$ */
587 double ComputeGlobalLpNorm(double p, Coefficient &coeff, ParMesh &pmesh,
588  const IntegrationRule *irs[]);
589 
590 /** Compute the global Lp norm of a vector function f = {f_i}_i=1...N.
591  \f$ \| f \|_{Lp} = ( \sum_i \| f_i \|_{Lp}^p )^{1/p} \f$ */
592 double ComputeGlobalLpNorm(double p, VectorCoefficient &coeff, ParMesh &pmesh,
593  const IntegrationRule *irs[]);
594 #endif
595 
596 }
597 
598 #endif
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double Eval(ElementTransformation &T, const IntegrationPoint &ip, double t)
Definition: coefficient.hpp:45
void GetDeltaCenter(Vector &center)
void SetTol(double _tol)
Set the tolerance used during projection onto GridFunction to identifying the Mesh vertex where the C...
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:83
Vector coefficient defined by an array of scalar coefficients.
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:27
GridFunction * GetGridFunction() const
void SetWeight(Coefficient *w)
Set a weight Coefficient that multiplies the DeltaCoefficient.
Subclass constant coefficient.
Definition: coefficient.hpp:57
VectorGridFunctionCoefficient(GridFunction *gf)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
double(* tdf)(double)
FunctionCoefficient(double(*tdf)(const Vector &, double))
Define a time-dependent coefficient from a C-function.
void SetSize(int s)
Resize the vector to size s.
Definition: vector.hpp:328
double Eval(int i, ElementTransformation &T, const IntegrationPoint &ip)
Evaluates i&#39;th component of the vector.
void SetDeltaCenter(const Vector &center)
Definition: coefficient.cpp:69
double Scale()
Return the scale set by SetScale() multiplied by the time-dependent function specified by SetFunction...
FunctionCoefficient(double(*f)(Vector &))
(DEPRECATED) Define a time-independent coefficient from a C-function
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)=0
void Copy(Array &copy) const
Create a copy of the current array.
Definition: array.hpp:190
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
double & operator()(int i)
Member function to access or modify the value of the i-th constant.
Definition: coefficient.hpp:92
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
Delta function coefficient.
int Size() const
Returns the size of the vector.
Definition: vector.hpp:120
void SetFunction(double(*f)(double))
Set a time-dependent function that multiplies the Scale().
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double Tol()
See SetTol() for description of the tolerance parameter.
GridFunction * GetGridFunction() const
void Set(int i, int j, Coefficient *c)
VectorFunctionCoefficient(int dim, void(*TDF)(const Vector &, double, Vector &), Coefficient *q=NULL)
Construct a time-dependent vector coefficient from a C-function.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Definition: coefficient.cpp:55
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
A DeltaFunction cannot be evaluated. Calling this method will cause an MFEM error, terminating the application.
void SetTime(double t)
VectorDeltaCoefficient(const Vector &_dir, double x, double y, double s)
DeltaCoefficient(double x, double y, double z, double s)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate coefficient.
Definition: coefficient.cpp:31
DeltaCoefficient & GetDeltaCoefficient()
Return the associated scalar DeltaCoefficient.
DeltaCoefficient(double x, double s)
double(* Function)(const Vector &)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
A VectorDeltaFunction cannot be evaluated. Calling this method will cause an MFEM error...
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
Coefficient * GetCoeff(int i, int j)
double Eval(int i, int j, ElementTransformation &T, const IntegrationPoint &ip)
VectorCoefficient defined on a subset of domain or boundary attributes.
MatrixFunctionCoefficient(int dim, void(*F)(const Vector &, DenseMatrix &), Coefficient *q=NULL)
Construct a time-independent square matrix coefficient from a C-function.
int dim
Definition: ex3.cpp:47
double ComputeLpNorm(double p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
VectorConstantCoefficient(const Vector &v)
ConstantCoefficient(double c=1.0)
c is value of constant function
Definition: coefficient.hpp:63
const double * Center()
Coefficient defined on a subset of domain or boundary attributes.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
Definition: error.cpp:146
Coefficient * Weight()
See SetWeight() for description of the weight Coefficient.
VectorDeltaCoefficient(const Vector &_dir)
MatrixRestrictedCoefficient(MatrixCoefficient &mc, Array< int > &attr)
void SetDirection(const Vector &_d)
VectorDeltaCoefficient(const Vector &_dir, double x, double y, double z, double s)
MatrixFunctionCoefficient(int dim, void(*TDF)(const Vector &, double, DenseMatrix &), Coefficient *q=NULL)
Construct a time-dependent square matrix coefficient from a C-function.
void SetDeltaCoefficient(const DeltaCoefficient &_d)
Replace the associated DeltaCoeficient with a new DeltaCoeficient.
virtual ~VectorArrayCoefficient()
Destroys vector coefficient.
virtual void Eval(DenseMatrix &M, ElementTransformation &T, const IntegrationPoint &ip)
int GetVDim()
Returns dimension of the vector.
void SetTime(double t)
Definition: coefficient.hpp:39
void operator=(double c)
Set domain constants equal to the same constant c.
Definition: coefficient.hpp:95
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient.
Definition: coefficient.hpp:66
void GetDeltaCenter(Vector &center)
Definition: coefficient.cpp:77
MatrixFunctionCoefficient(const DenseMatrix &m, Coefficient &q)
Construct a constant matrix coefficient times a scalar Coefficient.
Base class Coefficient that may optionally depend on time.
Definition: coefficient.hpp:31
virtual ~Coefficient()
Definition: coefficient.hpp:52
FunctionCoefficient(double(*f)(const Vector &))
Define a time-independent coefficient from a C-function.
void UpdateConstants(Vector &c)
Update constants.
Definition: coefficient.hpp:89
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient function.
Definition: coefficient.cpp:24
Coefficient * GetCoeff(int i)
Returns i&#39;th coefficient.
void SetTime(double t)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
void EvalDelta(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Return the specified direction vector multiplied by the value returned by DeltaCoefficient::EvalDelta...
double ComputeGlobalLpNorm(double p, Coefficient &coeff, ParMesh &pmesh, const IntegrationRule *irs[])
void SetGridFunction(GridFunction *gf)
PWConstCoefficient(int NumOfSubD=0)
Constructs a piecewise constant coefficient in NumOfSubD subdomains.
Definition: coefficient.hpp:80
double EvalDelta(ElementTransformation &T, const IntegrationPoint &ip)
Return the Scale() multiplied by the weight Coefficient, if any.
Definition: coefficient.cpp:83
MatrixCoefficient defined on a subset of domain or boundary attributes.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Definition: coefficient.cpp:49
void SetGridFunction(GridFunction *gf)
VectorDeltaCoefficient: DeltaCoefficient with a direction.
class for piecewise constant coefficient
Definition: coefficient.hpp:72
void SetScale(double _s)
Class for integration point with weight.
Definition: intrules.hpp:25
FunctionCoefficient(double(*tdf)(Vector &, double))
(DEPRECATED) Define a time-dependent coefficient from a C-function
TransformedCoefficient(Coefficient *q, double(*F)(double))
int GetNConst()
Returns the number of constants.
Definition: coefficient.hpp:98
VectorDeltaCoefficient(const Vector &_dir, double x, double s)
DeltaCoefficient(double x, double y, double s)
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
VectorArrayCoefficient(int dim)
Construct vector of dim coefficients.
VectorFunctionCoefficient(int dim, void(*F)(const Vector &, Vector &), Coefficient *q=NULL)
Construct a time-independent vector coefficient from a C-function.
class for C-function coefficient
Vector data type.
Definition: vector.hpp:48
TransformedCoefficient(Coefficient *q1, Coefficient *q2, double(*F)(double, double))
Vector coefficient defined by a vector GridFunction.
VectorRestrictedCoefficient(VectorCoefficient &vc, Array< int > &attr)
MatrixConstantCoefficient(const DenseMatrix &m)
virtual void Eval(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip)
GridFunctionCoefficient(GridFunction *gf, int comp=1)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Definition: densemat.hpp:86
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
double(* TDFunction)(const Vector &, double)
MatrixCoefficient(int h, int w)
void Set(int i, Coefficient *c)
Sets coefficient in the vector.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
RestrictedCoefficient(Coefficient &_c, Array< int > &attr)