MFEM  v4.2.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bilininteg.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_BILININTEG
13 #define MFEM_BILININTEG
14 
15 #include "../config/config.hpp"
16 #include "nonlininteg.hpp"
17 #include "fespace.hpp"
18 #include "libceed/ceed.hpp"
19 
20 namespace mfem
21 {
22 
23 // Local maximum size of dofs and quads in 1D
24 constexpr int HCURL_MAX_D1D = 5;
25 constexpr int HCURL_MAX_Q1D = 6;
26 
27 constexpr int HDIV_MAX_D1D = 5;
28 constexpr int HDIV_MAX_Q1D = 6;
29 
30 /// Abstract base class BilinearFormIntegrator
32 {
33 protected:
35  : NonlinearFormIntegrator(ir) { }
36 
37 public:
38  // TODO: add support for other assembly levels (in addition to PA) and their
39  // actions.
40 
41  // TODO: for mixed meshes the quadrature rules to be used by methods like
42  // AssemblePA() can be given as a QuadratureSpace, e.g. using a new method:
43  // SetQuadratureSpace().
44 
45  // TODO: the methods for the various assembly levels make sense even in the
46  // base class NonlinearFormIntegrator, except that not all assembly levels
47  // make sense for the action of the nonlinear operator (but they all make
48  // sense for its Jacobian).
49 
51 
52  /// Method defining partial assembly.
53  /** The result of the partial assembly is stored internally so that it can be
54  used later in the methods AddMultPA() and AddMultTransposePA(). */
55  virtual void AssemblePA(const FiniteElementSpace &fes);
56  /** Used with BilinearFormIntegrators that have different spaces. */
57  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
58  const FiniteElementSpace &test_fes);
59 
60  virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
61 
62  virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
63 
64  /// Assemble diagonal and add it to Vector @a diag.
65  virtual void AssembleDiagonalPA(Vector &diag);
66 
67  /// Assemble diagonal of ADA^T (A is this integrator) and add it to @a diag.
68  virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
69 
70  /// Method for partially assembled action.
71  /** Perform the action of integrator on the input @a x and add the result to
72  the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
73  the element-wise discontinuous version of the FE space.
74 
75  This method can be called only after the method AssemblePA() has been
76  called. */
77  virtual void AddMultPA(const Vector &x, Vector &y) const;
78 
79  /// Method for partially assembled transposed action.
80  /** Perform the transpose action of integrator on the input @a x and add the
81  result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
82  represent the element-wise discontinuous version of the FE space.
83 
84  This method can be called only after the method AssemblePA() has been
85  called. */
86  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
87 
88  /// Method defining element assembly.
89  /** The result of the element assembly is added to the @a emat Vector if
90  @a add is true. Otherwise, if @a add is false, we set @a emat. */
91  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
92  const bool add = true);
93  /** Used with BilinearFormIntegrators that have different spaces. */
94  // virtual void AssembleEA(const FiniteElementSpace &trial_fes,
95  // const FiniteElementSpace &test_fes,
96  // Vector &emat);
97 
98  /// Method defining matrix-free assembly.
99  /** The result of fully matrix-free assembly is stored internally so that it
100  can be used later in the methods AddMultMF() and AddMultTransposeMF(). */
101  virtual void AssembleMF(const FiniteElementSpace &fes);
102 
103  /** Perform the action of integrator on the input @a x and add the result to
104  the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
105  the element-wise discontinuous version of the FE space.
106 
107  This method can be called only after the method AssembleMF() has been
108  called. */
109  virtual void AddMultMF(const Vector &x, Vector &y) const;
110 
111  /** Perform the transpose action of integrator on the input @a x and add the
112  result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
113  represent the element-wise discontinuous version of the FE space.
114 
115  This method can be called only after the method AssemblePA() has been
116  called. */
117  virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
118 
119  /// Assemble diagonal and add it to Vector @a diag.
120  virtual void AssembleDiagonalMF(Vector &diag);
121 
122  virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
123  Vector &ea_data_int,
124  Vector &ea_data_ext,
125  const bool add = true);
126 
127  virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
128  Vector &ea_data_bdr,
129  const bool add = true);
130 
131  /// Given a particular Finite Element computes the element matrix elmat.
132  virtual void AssembleElementMatrix(const FiniteElement &el,
134  DenseMatrix &elmat);
135 
136  /** Compute the local matrix representation of a bilinear form
137  a(u,v) defined on different trial (given by u) and test
138  (given by v) spaces. The rows in the local matrix correspond
139  to the test dofs and the columns -- to the trial dofs. */
140  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
141  const FiniteElement &test_fe,
143  DenseMatrix &elmat);
144 
145  virtual void AssembleFaceMatrix(const FiniteElement &el1,
146  const FiniteElement &el2,
148  DenseMatrix &elmat);
149 
150  /** Abstract method used for assembling TraceFaceIntegrators in a
151  MixedBilinearForm. */
152  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
153  const FiniteElement &test_fe1,
154  const FiniteElement &test_fe2,
156  DenseMatrix &elmat);
157 
158  /// @brief Perform the local action of the BilinearFormIntegrator.
159  /// Note that the default implementation in the base class is general but not
160  /// efficient.
161  virtual void AssembleElementVector(const FiniteElement &el,
163  const Vector &elfun, Vector &elvect);
164 
165  /// @brief Perform the local action of the BilinearFormIntegrator resulting
166  /// from a face integral term.
167  /// Note that the default implementation in the base class is general but not
168  /// efficient.
169  virtual void AssembleFaceVector(const FiniteElement &el1,
170  const FiniteElement &el2,
172  const Vector &elfun, Vector &elvect);
173 
174  virtual void AssembleElementGrad(const FiniteElement &el,
176  const Vector &elfun, DenseMatrix &elmat)
177  { AssembleElementMatrix(el, Tr, elmat); }
178 
179  virtual void AssembleFaceGrad(const FiniteElement &el1,
180  const FiniteElement &el2,
182  const Vector &elfun, DenseMatrix &elmat)
183  { AssembleFaceMatrix(el1, el2, Tr, elmat); }
184 
185  /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
186 
187  The purpose of the method is to compute a local "flux" finite element
188  function given a local finite element solution. The "flux" function has
189  to be computed in terms of its coefficients (represented by the Vector
190  @a flux) which multiply the basis functions defined by the FiniteElement
191  @a fluxelem. Typically, the "flux" function will have more than one
192  component and consequently @a flux should be store the coefficients of
193  all components: first all coefficient for component 0, then all
194  coefficients for component 1, etc. What the "flux" function represents
195  depends on the specific integrator. For example, in the case of
196  DiffusionIntegrator, the flux is the gradient of the solution multiplied
197  by the diffusion coefficient.
198 
199  @param[in] el FiniteElement of the solution.
200  @param[in] Trans The ElementTransformation describing the physical
201  position of the mesh element.
202  @param[in] u Solution coefficients representing the expansion of the
203  solution function in the basis of @a el.
204  @param[in] fluxelem FiniteElement of the "flux".
205  @param[out] flux "Flux" coefficients representing the expansion of the
206  "flux" function in the basis of @a fluxelem. The size
207  of @a flux as a Vector has to be set by this method,
208  e.g. using Vector::SetSize().
209  @param[in] with_coef If zero (the default value is 1) the implementation
210  of the method may choose not to scale the "flux"
211  function by any coefficients describing the
212  integrator.
213  */
214  virtual void ComputeElementFlux(const FiniteElement &el,
216  Vector &u,
217  const FiniteElement &fluxelem,
218  Vector &flux, bool with_coef = true) { }
219 
220  /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
221 
222  The purpose of this method is to compute a local number that measures the
223  energy of a given "flux" function (see ComputeElementFlux() for a
224  description of the "flux" function). Typically, the energy of a "flux"
225  function should be equal to a_local(u,u), if the "flux" is defined from
226  a solution u; here a_local(.,.) denotes the element-local bilinear
227  form represented by the integrator.
228 
229  @param[in] fluxelem FiniteElement of the "flux".
230  @param[in] Trans The ElementTransformation describing the physical
231  position of the mesh element.
232  @param[in] flux "Flux" coefficients representing the expansion of the
233  "flux" function in the basis of @a fluxelem.
234  @param[out] d_energy If not NULL, the given Vector should be set to
235  represent directional energy split that can be used
236  for anisotropic error estimation.
237  @returns The computed energy.
238  */
239  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
241  Vector &flux, Vector *d_energy = NULL)
242  { return 0.0; }
243 
245 };
246 
247 /** Wraps a given @a BilinearFormIntegrator and transposes the resulting element
248  matrices. See for example ex9, ex9p. */
250 {
251 private:
252  int own_bfi;
254 
255  DenseMatrix bfi_elmat;
256 
257 public:
258  TransposeIntegrator (BilinearFormIntegrator *_bfi, int _own_bfi = 1)
259  { bfi = _bfi; own_bfi = _own_bfi; }
260 
261  virtual void AssembleElementMatrix(const FiniteElement &el,
263  DenseMatrix &elmat);
264 
265  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
266  const FiniteElement &test_fe,
268  DenseMatrix &elmat);
269 
271  virtual void AssembleFaceMatrix(const FiniteElement &el1,
272  const FiniteElement &el2,
274  DenseMatrix &elmat);
275 
277 
278  virtual void AssemblePA(const FiniteElementSpace& fes)
279  {
280  bfi->AssemblePA(fes);
281  }
282 
284  {
285  bfi->AssemblePAInteriorFaces(fes);
286  }
287 
289  {
290  bfi->AssemblePABoundaryFaces(fes);
291  }
292 
293  virtual void AddMultTransposePA(const Vector &x, Vector &y) const
294  {
295  bfi->AddMultPA(x, y);
296  }
297 
298  virtual void AddMultPA(const Vector& x, Vector& y) const
299  {
300  bfi->AddMultTransposePA(x, y);
301  }
302 
303  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
304  const bool add);
305 
306  virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
307  Vector &ea_data_int,
308  Vector &ea_data_ext,
309  const bool add);
310 
311  virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
312  Vector &ea_data_bdr,
313  const bool add);
314 
315  virtual ~TransposeIntegrator() { if (own_bfi) { delete bfi; } }
316 };
317 
319 {
320 private:
321  int own_bfi;
323 
324 public:
325  LumpedIntegrator (BilinearFormIntegrator *_bfi, int _own_bfi = 1)
326  { bfi = _bfi; own_bfi = _own_bfi; }
327 
328  virtual void AssembleElementMatrix(const FiniteElement &el,
330  DenseMatrix &elmat);
331 
332  virtual ~LumpedIntegrator() { if (own_bfi) { delete bfi; } }
333 };
334 
335 /// Integrator that inverts the matrix assembled by another integrator.
337 {
338 private:
339  int own_integrator;
340  BilinearFormIntegrator *integrator;
341 
342 public:
343  InverseIntegrator(BilinearFormIntegrator *integ, int own_integ = 1)
344  { integrator = integ; own_integrator = own_integ; }
345 
346  virtual void AssembleElementMatrix(const FiniteElement &el,
348  DenseMatrix &elmat);
349 
350  virtual ~InverseIntegrator() { if (own_integrator) { delete integrator; } }
351 };
352 
353 /// Integrator defining a sum of multiple Integrators.
355 {
356 private:
357  int own_integrators;
358  DenseMatrix elem_mat;
359  Array<BilinearFormIntegrator*> integrators;
360 
361 public:
362  SumIntegrator(int own_integs = 1) { own_integrators = own_integs; }
363 
365  { integrators.Append(integ); }
366 
367  virtual void AssembleElementMatrix(const FiniteElement &el,
369  DenseMatrix &elmat);
370 
371  virtual ~SumIntegrator();
372 };
373 
374 /** An abstract class for integrating the product of two scalar basis functions
375  with an optional scalar coefficient. */
377 {
378 public:
379 
380  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
381  const FiniteElement &test_fe,
383  DenseMatrix &elmat);
384 
385  /// Support for use in BilinearForm. Can be used only when appropriate.
386  virtual void AssembleElementMatrix(const FiniteElement &fe,
387  ElementTransformation &Trans,
388  DenseMatrix &elmat)
389  { AssembleElementMatrix2(fe, fe, Trans, elmat); }
390 
391 protected:
392  /// This parameter can be set by derived methods to enable single shape
393  /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
394  /// result if given the same FiniteElement. The default is false.
396 
399 
400  inline virtual bool VerifyFiniteElementTypes(
401  const FiniteElement & trial_fe,
402  const FiniteElement & test_fe) const
403  {
404  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
406  }
407 
408  inline virtual const char * FiniteElementTypeFailureMessage() const
409  {
410  return "MixedScalarIntegrator: "
411  "Trial and test spaces must both be scalar fields.";
412  }
413 
414  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
415  const FiniteElement & test_fe,
416  ElementTransformation &Trans)
417  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
418 
419 
420  inline virtual void CalcTestShape(const FiniteElement & test_fe,
421  ElementTransformation &Trans,
422  Vector & shape)
423  { test_fe.CalcPhysShape(Trans, shape); }
424 
425  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
426  ElementTransformation &Trans,
427  Vector & shape)
428  { trial_fe.CalcPhysShape(Trans, shape); }
429 
431 
432 private:
433 
434 #ifndef MFEM_THREAD_SAFE
435  Vector test_shape;
436  Vector trial_shape;
437 #endif
438 
439 };
440 
441 /** An abstract class for integrating the inner product of two vector basis
442  functions with an optional scalar, vector, or matrix coefficient. */
444 {
445 public:
446 
447  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
448  const FiniteElement &test_fe,
450  DenseMatrix &elmat);
451 
452  /// Support for use in BilinearForm. Can be used only when appropriate.
453  virtual void AssembleElementMatrix(const FiniteElement &fe,
454  ElementTransformation &Trans,
455  DenseMatrix &elmat)
456  { AssembleElementMatrix2(fe, fe, Trans, elmat); }
457 
458 protected:
459  /// This parameter can be set by derived methods to enable single shape
460  /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
461  /// result if given the same FiniteElement. The default is false.
463 
465  : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(NULL) {}
467  : same_calc_shape(false), Q(&q), VQ(NULL), DQ(NULL), MQ(NULL) {}
469  : same_calc_shape(false), Q(NULL), VQ(diag?NULL:&dq), DQ(diag?&dq:NULL),
470  MQ(NULL) {}
472  : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(&mq) {}
473 
474  inline virtual bool VerifyFiniteElementTypes(
475  const FiniteElement & trial_fe,
476  const FiniteElement & test_fe) const
477  {
478  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
480  }
481 
482  inline virtual const char * FiniteElementTypeFailureMessage() const
483  {
484  return "MixedVectorIntegrator: "
485  "Trial and test spaces must both be vector fields";
486  }
487 
488  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
489  const FiniteElement & test_fe,
490  ElementTransformation &Trans)
491  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
492 
493 
494  inline virtual void CalcTestShape(const FiniteElement & test_fe,
495  ElementTransformation &Trans,
496  DenseMatrix & shape)
497  { test_fe.CalcVShape(Trans, shape); }
498 
499  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
500  ElementTransformation &Trans,
501  DenseMatrix & shape)
502  { trial_fe.CalcVShape(Trans, shape); }
503 
508 
509 private:
510 
511 #ifndef MFEM_THREAD_SAFE
512  Vector V;
513  Vector D;
514  DenseMatrix M;
515  DenseMatrix test_shape;
516  DenseMatrix trial_shape;
517  DenseMatrix test_shape_tmp;
518 #endif
519 
520 };
521 
522 /** An abstract class for integrating the product of a scalar basis function and
523  the inner product of a vector basis function with a vector coefficient. In
524  2D the inner product can be replaced with a cross product. */
526 {
527 public:
528 
529  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
530  const FiniteElement &test_fe,
532  DenseMatrix &elmat);
533 
534  /// Support for use in BilinearForm. Can be used only when appropriate.
535  /** Appropriate use cases are classes derived from
536  MixedScalarVectorIntegrator where the trial and test spaces can be the
537  same. Examples of such classes are: MixedVectorDivergenceIntegrator,
538  MixedScalarWeakDivergenceIntegrator, etc. */
539  virtual void AssembleElementMatrix(const FiniteElement &fe,
540  ElementTransformation &Trans,
541  DenseMatrix &elmat)
542  { AssembleElementMatrix2(fe, fe, Trans, elmat); }
543 
544 protected:
545 
546  MixedScalarVectorIntegrator(VectorCoefficient &vq, bool _transpose = false,
547  bool _cross_2d = false)
548  : VQ(&vq), transpose(_transpose), cross_2d(_cross_2d) {}
549 
550  inline virtual bool VerifyFiniteElementTypes(
551  const FiniteElement & trial_fe,
552  const FiniteElement & test_fe) const
553  {
554  return ((transpose &&
556  test_fe.GetRangeType() == mfem::FiniteElement::SCALAR ) ||
557  (!transpose &&
560  );
561  }
562 
563  inline virtual const char * FiniteElementTypeFailureMessage() const
564  {
565  if ( transpose )
566  {
567  return "MixedScalarVectorIntegrator: "
568  "Trial space must be a vector field "
569  "and the test space must be a scalar field";
570  }
571  else
572  {
573  return "MixedScalarVectorIntegrator: "
574  "Trial space must be a scalar field "
575  "and the test space must be a vector field";
576  }
577  }
578 
579  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
580  const FiniteElement & test_fe,
581  ElementTransformation &Trans)
582  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
583 
584 
585  inline virtual void CalcVShape(const FiniteElement & vector_fe,
586  ElementTransformation &Trans,
587  DenseMatrix & shape)
588  { vector_fe.CalcVShape(Trans, shape); }
589 
590  inline virtual void CalcShape(const FiniteElement & scalar_fe,
591  ElementTransformation &Trans,
592  Vector & shape)
593  { scalar_fe.CalcPhysShape(Trans, shape); }
594 
596  bool transpose;
597  bool cross_2d; // In 2D use a cross product rather than a dot product
598 
599 private:
600 
601 #ifndef MFEM_THREAD_SAFE
602  Vector V;
603  DenseMatrix vshape;
604  Vector shape;
605  Vector vshape_tmp;
606 #endif
607 
608 };
609 
610 /** Class for integrating the bilinear form a(u,v) := (Q u, v) in either 1D, 2D,
611  or 3D and where Q is an optional scalar coefficient, u and v are each in H1
612  or L2. */
614 {
615 public:
618  : MixedScalarIntegrator(q) { same_calc_shape = true; }
619 };
620 
621 /** Class for integrating the bilinear form a(u,v) := (Q u, v) in either 2D, or
622  3D and where Q is a vector coefficient, u is in H1 or L2 and v is in H(Curl)
623  or H(Div). */
625 {
626 public:
629 };
630 
631 /** Class for integrating the bilinear form a(u,v) := (Q D u, v) in 1D where Q
632  is an optional scalar coefficient, u is in H1, and v is in L2. */
634 {
635 public:
638  : MixedScalarIntegrator(q) {}
639 
640 protected:
641  inline virtual bool VerifyFiniteElementTypes(
642  const FiniteElement & trial_fe,
643  const FiniteElement & test_fe) const
644  {
645  return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
646  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
648  }
649 
650  inline virtual const char * FiniteElementTypeFailureMessage() const
651  {
652  return "MixedScalarDerivativeIntegrator: "
653  "Trial and test spaces must both be scalar fields in 1D "
654  "and the trial space must implement CaldDShape.";
655  }
656 
657  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
659  Vector & shape)
660  {
661  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
662  trial_fe.CalcPhysDShape(Trans, dshape);
663  }
664 };
665 
666 /** Class for integrating the bilinear form a(u,v) := -(Q u, D v) in 1D where Q
667  is an optional scalar coefficient, u is in L2, and v is in H1. */
669 {
670 public:
673  : MixedScalarIntegrator(q) {}
674 
675 protected:
676  inline virtual bool VerifyFiniteElementTypes(
677  const FiniteElement & trial_fe,
678  const FiniteElement & test_fe) const
679  {
680  return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
683  }
684 
685  inline virtual const char * FiniteElementTypeFailureMessage() const
686  {
687  return "MixedScalarWeakDerivativeIntegrator: "
688  "Trial and test spaces must both be scalar fields in 1D "
689  "and the test space must implement CalcDShape with "
690  "map type \"VALUE\".";
691  }
692 
693  inline virtual void CalcTestShape(const FiniteElement & test_fe,
695  Vector & shape)
696  {
697  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
698  test_fe.CalcPhysDShape(Trans, dshape);
699  shape *= -1.0;
700  }
701 };
702 
703 /** Class for integrating the bilinear form a(u,v) := (Q div u, v) in either 2D
704  or 3D where Q is an optional scalar coefficient, u is in H(Div), and v is a
705  scalar field. */
707 {
708 public:
711  : MixedScalarIntegrator(q) {}
712 
713 protected:
714  inline virtual bool VerifyFiniteElementTypes(
715  const FiniteElement & trial_fe,
716  const FiniteElement & test_fe) const
717  {
718  return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
720  }
721 
722  inline virtual const char * FiniteElementTypeFailureMessage() const
723  {
724  return "MixedScalarDivergenceIntegrator: "
725  "Trial must be H(Div) and the test space must be a "
726  "scalar field";
727  }
728 
729  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
730  const FiniteElement & test_fe,
732  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
733 
734  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
736  Vector & shape)
737  { trial_fe.CalcPhysDivShape(Trans, shape); }
738 };
739 
740 /** Class for integrating the bilinear form a(u,v) := (V div u, v) in either 2D
741  or 3D where V is a vector coefficient, u is in H(Div), and v is a vector
742  field. */
744 {
745 public:
748 
749 protected:
750  inline virtual bool VerifyFiniteElementTypes(
751  const FiniteElement & trial_fe,
752  const FiniteElement & test_fe) const
753  {
754  return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
756  }
757 
758  inline virtual const char * FiniteElementTypeFailureMessage() const
759  {
760  return "MixedVectorDivergenceIntegrator: "
761  "Trial must be H(Div) and the test space must be a "
762  "vector field";
763  }
764 
765  // Subtract one due to the divergence and add one for the coefficient
766  // which is assumed to be at least linear.
767  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
768  const FiniteElement & test_fe,
770  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
771 
772  inline virtual void CalcShape(const FiniteElement & scalar_fe,
774  Vector & shape)
775  { scalar_fe.CalcPhysDivShape(Trans, shape); }
776 };
777 
778 /** Class for integrating the bilinear form a(u,v) := -(Q u, div v) in either 2D
779  or 3D where Q is an optional scalar coefficient, u is in L2 or H1, and v is
780  in H(Div). */
782 {
783 public:
786  : MixedScalarIntegrator(q) {}
787 
788 protected:
789  inline virtual bool VerifyFiniteElementTypes(
790  const FiniteElement & trial_fe,
791  const FiniteElement & test_fe) const
792  {
793  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
794  test_fe.GetDerivType() == mfem::FiniteElement::DIV );
795  }
796 
797  inline virtual const char * FiniteElementTypeFailureMessage() const
798  {
799  return "MixedScalarWeakGradientIntegrator: "
800  "Trial space must be a scalar field "
801  "and the test space must be H(Div)";
802  }
803 
804  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
805  const FiniteElement & test_fe,
807  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
808 
809  virtual void CalcTestShape(const FiniteElement & test_fe,
811  Vector & shape)
812  {
813  test_fe.CalcPhysDivShape(Trans, shape);
814  shape *= -1.0;
815  }
816 };
817 
818 /** Class for integrating the bilinear form a(u,v) := (Q curl u, v) in 2D where
819  Q is an optional scalar coefficient, u is in H(Curl), and v is in L2 or
820  H1. */
822 {
823 public:
826  : MixedScalarIntegrator(q) {}
827 
828 protected:
829  inline virtual bool VerifyFiniteElementTypes(
830  const FiniteElement & trial_fe,
831  const FiniteElement & test_fe) const
832  {
833  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
834  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
836  }
837 
838  inline virtual const char * FiniteElementTypeFailureMessage() const
839  {
840  return "MixedScalarCurlIntegrator: "
841  "Trial must be H(Curl) and the test space must be a "
842  "scalar field";
843  }
844 
845  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
846  const FiniteElement & test_fe,
848  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
849 
850  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
852  Vector & shape)
853  {
854  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
855  trial_fe.CalcPhysCurlShape(Trans, dshape);
856  }
857 };
858 
859 /** Class for integrating the bilinear form a(u,v) := (Q u, curl v) in 2D where
860  Q is an optional scalar coefficient, u is in L2 or H1, and v is in
861  H(Curl). */
863 {
864 public:
867  : MixedScalarIntegrator(q) {}
868 
869 protected:
870  inline virtual bool VerifyFiniteElementTypes(
871  const FiniteElement & trial_fe,
872  const FiniteElement & test_fe) const
873  {
874  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
877  }
878 
879  inline virtual const char * FiniteElementTypeFailureMessage() const
880  {
881  return "MixedScalarWeakCurlIntegrator: "
882  "Trial space must be a scalar field "
883  "and the test space must be H(Curl)";
884  }
885 
886  inline virtual void CalcTestShape(const FiniteElement & test_fe,
888  Vector & shape)
889  {
890  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
891  test_fe.CalcPhysCurlShape(Trans, dshape);
892  }
893 };
894 
895 /** Class for integrating the bilinear form a(u,v) := (Q u, v) in either 2D or
896  3D and where Q is an optional coefficient (of type scalar, matrix, or
897  diagonal matrix) u and v are each in H(Curl) or H(Div). */
899 {
900 public:
903  : MixedVectorIntegrator(q) { same_calc_shape = true; }
905  : MixedVectorIntegrator(dq, true) { same_calc_shape = true; }
907  : MixedVectorIntegrator(mq) { same_calc_shape = true; }
908 };
909 
910 /** Class for integrating the bilinear form a(u,v) := (V x u, v) in 3D and where
911  V is a vector coefficient u and v are each in H(Curl) or H(Div). */
913 {
914 public:
916  : MixedVectorIntegrator(vq, false) { same_calc_shape = true; }
917 };
918 
919 /** Class for integrating the bilinear form a(u,v) := (V . u, v) in 2D or 3D and
920  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in H1 or
921  L2. */
923 {
924 public:
926  : MixedScalarVectorIntegrator(vq, true) {}
927 
928  inline virtual bool VerifyFiniteElementTypes(
929  const FiniteElement & trial_fe,
930  const FiniteElement & test_fe) const
931  {
932  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
934  }
935 
936  inline virtual const char * FiniteElementTypeFailureMessage() const
937  {
938  return "MixedDotProductIntegrator: "
939  "Trial space must be a vector field "
940  "and the test space must be a scalar field";
941  }
942 };
943 
944 /** Class for integrating the bilinear form a(u,v) := (-V . u, Div v) in 2D or
945  3D and where V is a vector coefficient u is in H(Curl) or H(Div) and v is in
946  RT. */
948 {
949 public:
951  : MixedScalarVectorIntegrator(vq, true) {}
952 
953  inline virtual bool VerifyFiniteElementTypes(
954  const FiniteElement & trial_fe,
955  const FiniteElement & test_fe) const
956  {
957  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
959  test_fe.GetDerivType() == mfem::FiniteElement::DIV );
960  }
961 
962  inline virtual const char * FiniteElementTypeFailureMessage() const
963  {
964  return "MixedWeakGradDotIntegrator: "
965  "Trial space must be a vector field "
966  "and the test space must be a vector field with a divergence";
967  }
968 
969  // Subtract one due to the gradient and add one for the coefficient
970  // which is assumed to be at least linear.
971  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
972  const FiniteElement & test_fe,
974  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
975 
976  inline virtual void CalcShape(const FiniteElement & scalar_fe,
978  Vector & shape)
979  { scalar_fe.CalcPhysDivShape(Trans, shape); shape *= -1.0; }
980 };
981 
982 /** Class for integrating the bilinear form a(u,v) := (V x u, Grad v) in 3D and
983  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in H1. */
985 {
986 public:
988  : MixedVectorIntegrator(vq, false) {}
989 
990  inline virtual bool VerifyFiniteElementTypes(
991  const FiniteElement & trial_fe,
992  const FiniteElement & test_fe) const
993  {
994  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
998  }
999 
1000  inline virtual const char * FiniteElementTypeFailureMessage() const
1001  {
1002  return "MixedWeakDivCrossIntegrator: "
1003  "Trial space must be a vector field in 3D "
1004  "and the test space must be a scalar field with a gradient";
1005  }
1006 
1007  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1009  DenseMatrix & shape)
1010  { test_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1011 };
1012 
1013 /** Class for integrating the bilinear form a(u,v) := (Q Grad u, Grad v) in 3D
1014  or in 2D and where Q is a scalar or matrix coefficient u and v are both in
1015  H1. */
1017 {
1018 public:
1021  : MixedVectorIntegrator(q) { same_calc_shape = true; }
1023  : MixedVectorIntegrator(dq, true) { same_calc_shape = true; }
1025  : MixedVectorIntegrator(mq) { same_calc_shape = true; }
1026 
1027  inline virtual bool VerifyFiniteElementTypes(
1028  const FiniteElement & trial_fe,
1029  const FiniteElement & test_fe) const
1030  {
1031  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1032  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1034  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1035  }
1036 
1037  inline virtual const char * FiniteElementTypeFailureMessage() const
1038  {
1039  return "MixedGradGradIntegrator: "
1040  "Trial and test spaces must both be scalar fields "
1041  "with a gradient operator.";
1042  }
1043 
1044  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1045  const FiniteElement & test_fe,
1047  {
1048  // Same as DiffusionIntegrator
1049  return test_fe.Space() == FunctionSpace::Pk ?
1050  trial_fe.GetOrder() + test_fe.GetOrder() - 2 :
1051  trial_fe.GetOrder() + test_fe.GetOrder() + test_fe.GetDim() - 1;
1052  }
1053 
1054  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1056  DenseMatrix & shape)
1057  { trial_fe.CalcPhysDShape(Trans, shape); }
1058 
1059  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1061  DenseMatrix & shape)
1062  { test_fe.CalcPhysDShape(Trans, shape); }
1063 };
1064 
1065 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, Grad v) in 3D
1066  or in 2D and where V is a vector coefficient u and v are both in H1. */
1068 {
1069 public:
1071  : MixedVectorIntegrator(vq, false) { same_calc_shape = true; }
1072 
1073  inline virtual bool VerifyFiniteElementTypes(
1074  const FiniteElement & trial_fe,
1075  const FiniteElement & test_fe) const
1076  {
1077  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1078  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1080  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1081  }
1082 
1083  inline virtual const char * FiniteElementTypeFailureMessage() const
1084  {
1085  return "MixedCrossGradGradIntegrator: "
1086  "Trial and test spaces must both be scalar fields "
1087  "with a gradient operator.";
1088  }
1089 
1090  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1092  DenseMatrix & shape)
1093  { trial_fe.CalcPhysDShape(Trans, shape); }
1094 
1095  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1097  DenseMatrix & shape)
1098  { test_fe.CalcPhysDShape(Trans, shape); }
1099 };
1100 
1101 /** Class for integrating the bilinear form a(u,v) := (Q Curl u, Curl v) in 3D
1102  and where Q is a scalar or matrix coefficient u and v are both in
1103  H(Curl). */
1105 {
1106 public:
1109  : MixedVectorIntegrator(q) { same_calc_shape = true; }
1111  : MixedVectorIntegrator(dq, true) { same_calc_shape = true; }
1113  : MixedVectorIntegrator(mq) { same_calc_shape = true; }
1114 
1115  inline virtual bool VerifyFiniteElementTypes(
1116  const FiniteElement & trial_fe,
1117  const FiniteElement & test_fe) const
1118  {
1119  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1120  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1121  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1123  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1124  }
1125 
1126  inline virtual const char * FiniteElementTypeFailureMessage() const
1127  {
1128  return "MixedCurlCurlIntegrator"
1129  "Trial and test spaces must both be vector fields in 3D "
1130  "with a curl.";
1131  }
1132 
1133  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1135  DenseMatrix & shape)
1136  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1137 
1138  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1140  DenseMatrix & shape)
1141  { test_fe.CalcPhysCurlShape(Trans, shape); }
1142 };
1143 
1144 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, Curl v) in 3D
1145  and where V is a vector coefficient u and v are both in H(Curl). */
1147 {
1148 public:
1150  : MixedVectorIntegrator(vq, false) { same_calc_shape = true; }
1151 
1152  inline virtual bool VerifyFiniteElementTypes(
1153  const FiniteElement & trial_fe,
1154  const FiniteElement & test_fe) const
1155  {
1156  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1157  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1158  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1160  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1161  }
1162 
1163  inline virtual const char * FiniteElementTypeFailureMessage() const
1164  {
1165  return "MixedCrossCurlCurlIntegrator: "
1166  "Trial and test spaces must both be vector fields in 3D "
1167  "with a curl.";
1168  }
1169 
1170  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1172  DenseMatrix & shape)
1173  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1174 
1175  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1177  DenseMatrix & shape)
1178  { test_fe.CalcPhysCurlShape(Trans, shape); }
1179 };
1180 
1181 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, Grad v) in 3D
1182  and where V is a vector coefficient u is in H(Curl) and v is in H1. */
1184 {
1185 public:
1187  : MixedVectorIntegrator(vq, false) {}
1188 
1189  inline virtual bool VerifyFiniteElementTypes(
1190  const FiniteElement & trial_fe,
1191  const FiniteElement & test_fe) const
1192  {
1193  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1194  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1195  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1197  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1198  }
1199 
1200  inline virtual const char * FiniteElementTypeFailureMessage() const
1201  {
1202  return "MixedCrossCurlGradIntegrator"
1203  "Trial space must be a vector field in 3D with a curl"
1204  "and the test space must be a scalar field with a gradient";
1205  }
1206 
1207  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1209  DenseMatrix & shape)
1210  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1211 
1212  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1214  DenseMatrix & shape)
1215  { test_fe.CalcPhysDShape(Trans, shape); }
1216 };
1217 
1218 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, Curl v) in 3D
1219  and where V is a scalar coefficient u is in H1 and v is in H(Curl). */
1221 {
1222 public:
1224  : MixedVectorIntegrator(vq, false) {}
1225 
1226  inline virtual bool VerifyFiniteElementTypes(
1227  const FiniteElement & trial_fe,
1228  const FiniteElement & test_fe) const
1229  {
1230  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1231  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1232  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1234  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1235  }
1236 
1237  inline virtual const char * FiniteElementTypeFailureMessage() const
1238  {
1239  return "MixedCrossGradCurlIntegrator"
1240  "Trial space must be a scalar field in 3D with a gradient"
1241  "and the test space must be a vector field with a curl";
1242  }
1243 
1244  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1246  DenseMatrix & shape)
1247  { trial_fe.CalcPhysDShape(Trans, shape); }
1248 
1249  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1251  DenseMatrix & shape)
1252  { test_fe.CalcPhysCurlShape(Trans, shape); }
1253 };
1254 
1255 /** Class for integrating the bilinear form a(u,v) := (V x u, Curl v) in 3D and
1256  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in
1257  H(Curl). */
1259 {
1260 public:
1262  : MixedVectorIntegrator(vq, false) {}
1263 
1264  inline virtual bool VerifyFiniteElementTypes(
1265  const FiniteElement & trial_fe,
1266  const FiniteElement & test_fe) const
1267  {
1268  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1269  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1271  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1272  }
1273 
1274  inline virtual const char * FiniteElementTypeFailureMessage() const
1275  {
1276  return "MixedWeakCurlCrossIntegrator: "
1277  "Trial space must be a vector field in 3D "
1278  "and the test space must be a vector field with a curl";
1279  }
1280 
1281  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1283  DenseMatrix & shape)
1284  { test_fe.CalcPhysCurlShape(Trans, shape); }
1285 };
1286 
1287 /** Class for integrating the bilinear form a(u,v) := (V x u, Curl v) in 2D and
1288  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in
1289  H(Curl). */
1291 {
1292 public:
1294  : MixedScalarVectorIntegrator(vq, true, true) {}
1295 
1296  inline virtual bool VerifyFiniteElementTypes(
1297  const FiniteElement & trial_fe,
1298  const FiniteElement & test_fe) const
1299  {
1300  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1301  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1303  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1304  }
1305 
1306  inline virtual const char * FiniteElementTypeFailureMessage() const
1307  {
1308  return "MixedScalarWeakCurlCrossIntegrator: "
1309  "Trial space must be a vector field in 2D "
1310  "and the test space must be a vector field with a curl";
1311  }
1312 
1313  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1315  Vector & shape)
1316  {
1317  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1318  scalar_fe.CalcPhysCurlShape(Trans, dshape);
1319  }
1320 };
1321 
1322 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, v) in 3D or
1323  in 2D and where V is a vector coefficient u is in H1 and v is in H(Curl) or
1324  H(Div). */
1326 {
1327 public:
1329  : MixedVectorIntegrator(vq, false) {}
1330 
1331  inline virtual bool VerifyFiniteElementTypes(
1332  const FiniteElement & trial_fe,
1333  const FiniteElement & test_fe) const
1334  {
1335  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1336  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1337  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1339  }
1340 
1341  inline virtual const char * FiniteElementTypeFailureMessage() const
1342  {
1343  return "MixedCrossGradIntegrator: "
1344  "Trial space must be a scalar field with a gradient operator"
1345  " and the test space must be a vector field both in 3D.";
1346  }
1347 
1348  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1350  DenseMatrix & shape)
1351  { trial_fe.CalcPhysDShape(Trans, shape); }
1352 
1353  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1355  DenseMatrix & shape)
1356  { test_fe.CalcVShape(Trans, shape); }
1357 };
1358 
1359 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, v) in 3D and
1360  where V is a vector coefficient u is in H(Curl) and v is in H(Curl) or
1361  H(Div). */
1363 {
1364 public:
1366  : MixedVectorIntegrator(vq, false) {}
1367 
1368  inline virtual bool VerifyFiniteElementTypes(
1369  const FiniteElement & trial_fe,
1370  const FiniteElement & test_fe) const
1371  {
1372  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1373  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1374  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1376  }
1377 
1378  inline virtual const char * FiniteElementTypeFailureMessage() const
1379  {
1380  return "MixedCrossCurlIntegrator: "
1381  "Trial space must be a vector field in 3D with a curl "
1382  "and the test space must be a vector field";
1383  }
1384 
1385  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1387  DenseMatrix & shape)
1388  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1389 };
1390 
1391 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, v) in 2D and
1392  where V is a vector coefficient u is in H(Curl) and v is in H(Curl) or
1393  H(Div). */
1395 {
1396 public:
1398  : MixedScalarVectorIntegrator(vq, false, true) {}
1399 
1400  inline virtual bool VerifyFiniteElementTypes(
1401  const FiniteElement & trial_fe,
1402  const FiniteElement & test_fe) const
1403  {
1404  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1405  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1406  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1408  }
1409 
1410  inline virtual const char * FiniteElementTypeFailureMessage() const
1411  {
1412  return "MixedCrossCurlIntegrator: "
1413  "Trial space must be a vector field in 2D with a curl "
1414  "and the test space must be a vector field";
1415  }
1416 
1417  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1419  Vector & shape)
1420  {
1421  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1422  scalar_fe.CalcPhysCurlShape(Trans, dshape); shape *= -1.0;
1423  }
1424 };
1425 
1426 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, v) in 2D and
1427  where V is a vector coefficient u is in H1 and v is in H1 or L2. */
1429 {
1430 public:
1432  : MixedScalarVectorIntegrator(vq, true, true) {}
1433 
1434  inline virtual bool VerifyFiniteElementTypes(
1435  const FiniteElement & trial_fe,
1436  const FiniteElement & test_fe) const
1437  {
1438  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1439  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1440  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1442  }
1443 
1444  inline virtual const char * FiniteElementTypeFailureMessage() const
1445  {
1446  return "MixedScalarCrossGradIntegrator: "
1447  "Trial space must be a scalar field in 2D with a gradient "
1448  "and the test space must be a scalar field";
1449  }
1450 
1451  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1453  DenseMatrix & shape)
1454  { vector_fe.CalcPhysDShape(Trans, shape); }
1455 };
1456 
1457 /** Class for integrating the bilinear form a(u,v) := (V x u, v) in 2D and where
1458  V is a vector coefficient u is in ND or RT and v is in H1 or L2. */
1460 {
1461 public:
1463  : MixedScalarVectorIntegrator(vq, true, true) {}
1464 
1465  inline virtual bool VerifyFiniteElementTypes(
1466  const FiniteElement & trial_fe,
1467  const FiniteElement & test_fe) const
1468  {
1469  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1470  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1472  }
1473 
1474  inline virtual const char * FiniteElementTypeFailureMessage() const
1475  {
1476  return "MixedScalarCrossProductIntegrator: "
1477  "Trial space must be a vector field in 2D "
1478  "and the test space must be a scalar field";
1479  }
1480 };
1481 
1482 /** Class for integrating the bilinear form a(u,v) := (V x z u, v) in 2D and
1483  where V is a vector coefficient u is in H1 or L2 and v is in ND or RT. */
1485 {
1486 public:
1488  : MixedScalarVectorIntegrator(vq, false, true) {}
1489 
1490  inline virtual bool VerifyFiniteElementTypes(
1491  const FiniteElement & trial_fe,
1492  const FiniteElement & test_fe) const
1493  {
1494  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1495  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1497  }
1498 
1499  inline virtual const char * FiniteElementTypeFailureMessage() const
1500  {
1501  return "MixedScalarWeakCrossProductIntegrator: "
1502  "Trial space must be a scalar field in 2D "
1503  "and the test space must be a vector field";
1504  }
1505 
1506  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1508  Vector & shape)
1509  { scalar_fe.CalcPhysShape(Trans, shape); shape *= -1.0; }
1510 };
1511 
1512 /** Class for integrating the bilinear form a(u,v) := (V . Grad u, v) in 2D or
1513  3D and where V is a vector coefficient, u is in H1 and v is in H1 or L2. */
1515 {
1516 public:
1518  : MixedScalarVectorIntegrator(vq, true) {}
1519 
1520  inline virtual bool VerifyFiniteElementTypes(
1521  const FiniteElement & trial_fe,
1522  const FiniteElement & test_fe) const
1523  {
1524  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1525  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1527  }
1528 
1529  inline virtual const char * FiniteElementTypeFailureMessage() const
1530  {
1531  return "MixedDirectionalDerivativeIntegrator: "
1532  "Trial space must be a scalar field with a gradient "
1533  "and the test space must be a scalar field";
1534  }
1535 
1536  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1538  DenseMatrix & shape)
1539  { vector_fe.CalcPhysDShape(Trans, shape); }
1540 };
1541 
1542 /** Class for integrating the bilinear form a(u,v) := (-V . Grad u, Div v) in 2D
1543  or 3D and where V is a vector coefficient, u is in H1 and v is in RT. */
1545 {
1546 public:
1548  : MixedScalarVectorIntegrator(vq, true) {}
1549 
1550  inline virtual bool VerifyFiniteElementTypes(
1551  const FiniteElement & trial_fe,
1552  const FiniteElement & test_fe) const
1553  {
1554  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1555  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1557  test_fe.GetDerivType() == mfem::FiniteElement::DIV );
1558  }
1559 
1560  inline virtual const char * FiniteElementTypeFailureMessage() const
1561  {
1562  return "MixedGradDivIntegrator: "
1563  "Trial space must be a scalar field with a gradient"
1564  "and the test space must be a vector field with a divergence";
1565  }
1566 
1567  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1569  DenseMatrix & shape)
1570  { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1571 
1572  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1574  Vector & shape)
1575  { scalar_fe.CalcPhysDivShape(Trans, shape); }
1576 };
1577 
1578 /** Class for integrating the bilinear form a(u,v) := (-V Div u, Grad v) in 2D
1579  or 3D and where V is a vector coefficient, u is in RT and v is in H1. */
1581 {
1582 public:
1584  : MixedScalarVectorIntegrator(vq, false) {}
1585 
1586  inline virtual bool VerifyFiniteElementTypes(
1587  const FiniteElement & trial_fe,
1588  const FiniteElement & test_fe) const
1589  {
1590  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1591  trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
1594  );
1595  }
1596 
1597  inline virtual const char * FiniteElementTypeFailureMessage() const
1598  {
1599  return "MixedDivGradIntegrator: "
1600  "Trial space must be a vector field with a divergence"
1601  "and the test space must be a scalar field with a gradient";
1602  }
1603 
1604  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1606  DenseMatrix & shape)
1607  { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1608 
1609  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1611  Vector & shape)
1612  { scalar_fe.CalcPhysDivShape(Trans, shape); }
1613 };
1614 
1615 /** Class for integrating the bilinear form a(u,v) := (-V u, Grad v) in 2D or 3D
1616  and where V is a vector coefficient, u is in H1 or L2 and v is in H1. */
1618 {
1619 public:
1621  : MixedScalarVectorIntegrator(vq, false) {}
1622 
1623  inline virtual bool VerifyFiniteElementTypes(
1624  const FiniteElement & trial_fe,
1625  const FiniteElement & test_fe) const
1626  {
1627  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1629  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1630  }
1631 
1632  inline virtual const char * FiniteElementTypeFailureMessage() const
1633  {
1634  return "MixedScalarWeakDivergenceIntegrator: "
1635  "Trial space must be a scalar field "
1636  "and the test space must be a scalar field with a gradient";
1637  }
1638 
1639  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1641  DenseMatrix & shape)
1642  { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1643 };
1644 
1645 /** Class for integrating the bilinear form a(u,v) := (Q grad u, v) in either 2D
1646  or 3D and where Q is an optional coefficient (of type scalar, matrix, or
1647  diagonal matrix) u is in H1 and v is in H(Curl) or H(Div). */
1649 {
1650 public:
1653  : MixedVectorIntegrator(q) {}
1655  : MixedVectorIntegrator(dq, true) {}
1657  : MixedVectorIntegrator(mq) {}
1658 
1659 protected:
1660  inline virtual bool VerifyFiniteElementTypes(
1661  const FiniteElement & trial_fe,
1662  const FiniteElement & test_fe) const
1663  {
1664  return (trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1666  }
1667 
1668  inline virtual const char * FiniteElementTypeFailureMessage() const
1669  {
1670  return "MixedVectorGradientIntegrator: "
1671  "Trial spaces must be H1 and the test space must be a "
1672  "vector field in 2D or 3D";
1673  }
1674 
1675  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1677  DenseMatrix & shape)
1678  {
1679  trial_fe.CalcPhysDShape(Trans, shape);
1680  }
1681 
1683  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1684  const FiniteElementSpace &test_fes);
1685 
1686  virtual void AddMultPA(const Vector&, Vector&) const;
1687 
1688 private:
1689  DenseMatrix Jinv;
1690 
1691  // PA extension
1692  Vector pa_data;
1693  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1694  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1695  const GeometricFactors *geom; ///< Not owned
1696  int dim, ne, dofs1D, quad1D;
1697 };
1698 
1699 /** Class for integrating the bilinear form a(u,v) := (Q curl u, v) in 3D and
1700  where Q is an optional coefficient (of type scalar, matrix, or diagonal
1701  matrix) u is in H(Curl) and v is in H(Div) or H(Curl). */
1703 {
1704 public:
1707  : MixedVectorIntegrator(q) {}
1709  : MixedVectorIntegrator(dq, true) {}
1711  : MixedVectorIntegrator(mq) {}
1712 
1713 protected:
1714  inline virtual bool VerifyFiniteElementTypes(
1715  const FiniteElement & trial_fe,
1716  const FiniteElement & test_fe) const
1717  {
1718  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1719  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1721  }
1722 
1723  inline virtual const char * FiniteElementTypeFailureMessage() const
1724  {
1725  return "MixedVectorCurlIntegrator: "
1726  "Trial space must be H(Curl) and the test space must be a "
1727  "vector field in 3D";
1728  }
1729 
1730  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1732  DenseMatrix & shape)
1733  {
1734  trial_fe.CalcPhysCurlShape(Trans, shape);
1735  }
1736 
1738  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1739  const FiniteElementSpace &test_fes);
1740 
1741  virtual void AddMultPA(const Vector&, Vector&) const;
1742 
1743 private:
1744  // PA extension
1745  Vector pa_data;
1746  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1747  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1748  const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
1749  const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
1750  const GeometricFactors *geom; ///< Not owned
1751  int dim, ne, dofs1D, dofs1Dtest,quad1D, testType, trialType, coeffDim;
1752 };
1753 
1754 /** Class for integrating the bilinear form a(u,v) := (Q u, curl v) in 3D and
1755  where Q is an optional coefficient (of type scalar, matrix, or diagonal
1756  matrix) u is in H(Div) or H(Curl) and v is in H(Curl). */
1758 {
1759 public:
1762  : MixedVectorIntegrator(q) {}
1764  : MixedVectorIntegrator(dq, true) {}
1766  : MixedVectorIntegrator(mq) {}
1767 
1768 protected:
1769  inline virtual bool VerifyFiniteElementTypes(
1770  const FiniteElement & trial_fe,
1771  const FiniteElement & test_fe) const
1772  {
1773  return (trial_fe.GetDim() == 3 && test_fe.GetDim() == 3 &&
1774  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1775  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1776  }
1777 
1778  inline virtual const char * FiniteElementTypeFailureMessage() const
1779  {
1780  return "MixedVectorWeakCurlIntegrator: "
1781  "Trial space must be vector field in 3D and the "
1782  "test space must be H(Curl)";
1783  }
1784 
1785  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1787  DenseMatrix & shape)
1788  {
1789  test_fe.CalcPhysCurlShape(Trans, shape);
1790  }
1791 
1793  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1794  const FiniteElementSpace &test_fes);
1795 
1796  virtual void AddMultPA(const Vector&, Vector&) const;
1797 
1798 private:
1799  // PA extension
1800  Vector pa_data;
1801  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1802  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1803  const GeometricFactors *geom; ///< Not owned
1804  int dim, ne, dofs1D, quad1D, testType, trialType, coeffDim;
1805 };
1806 
1807 /** Class for integrating the bilinear form a(u,v) := - (Q u, grad v) in either
1808  2D or 3D and where Q is an optional coefficient (of type scalar, matrix, or
1809  diagonal matrix) u is in H(Div) or H(Curl) and v is in H1. */
1811 {
1812 public:
1815  : MixedVectorIntegrator(q) {}
1817  : MixedVectorIntegrator(dq, true) {}
1819  : MixedVectorIntegrator(mq) {}
1820 
1821 protected:
1822  inline virtual bool VerifyFiniteElementTypes(
1823  const FiniteElement & trial_fe,
1824  const FiniteElement & test_fe) const
1825  {
1826  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1827  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1828  }
1829 
1830  inline virtual const char * FiniteElementTypeFailureMessage() const
1831  {
1832  return "MixedVectorWeakDivergenceIntegrator: "
1833  "Trial space must be vector field and the "
1834  "test space must be H1";
1835  }
1836 
1837  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1839  DenseMatrix & shape)
1840  {
1841  test_fe.CalcPhysDShape(Trans, shape);
1842  shape *= -1.0;
1843  }
1844 };
1845 
1846 /** Class for integrating the bilinear form a(u,v) := (Q grad u, v) where Q is a
1847  scalar coefficient, and v is a vector with components v_i in the same space
1848  as u. */
1850 {
1851 protected:
1853 
1854 private:
1855  Vector shape;
1856  DenseMatrix dshape;
1857  DenseMatrix gshape;
1858  DenseMatrix Jadj;
1859  DenseMatrix elmat_comp;
1860  // PA extension
1861  Vector pa_data;
1862  const DofToQuad *trial_maps, *test_maps; ///< Not owned
1863  const GeometricFactors *geom; ///< Not owned
1864  int dim, ne, nq;
1865  int trial_dofs1D, test_dofs1D, quad1D;
1866 
1867 public:
1869  Q{NULL}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
1870  { }
1872  Q{_q}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
1873  { }
1875  Q{&q}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
1876  { }
1877 
1878  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
1879  const FiniteElement &test_fe,
1880  ElementTransformation &Trans,
1881  DenseMatrix &elmat);
1882 
1884  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1885  const FiniteElementSpace &test_fes);
1886 
1887  virtual void AddMultPA(const Vector &x, Vector &y) const;
1888  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
1889 
1890  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
1891  const FiniteElement &test_fe,
1892  ElementTransformation &Trans);
1893 };
1894 
1895 /** Class for integrating the bilinear form a(u,v) := (Q grad u, grad v) where Q
1896  can be a scalar or a matrix coefficient. */
1898 {
1899 protected:
1903 
1904 private:
1905  Vector vec, pointflux, shape;
1906 #ifndef MFEM_THREAD_SAFE
1907  DenseMatrix dshape, dshapedxt, invdfdx, mq;
1908  DenseMatrix te_dshape, te_dshapedxt;
1909  Vector D;
1910 #endif
1911 
1912  // PA extension
1913  const FiniteElementSpace *fespace;
1914  const DofToQuad *maps; ///< Not owned
1915  const GeometricFactors *geom; ///< Not owned
1916  int dim, ne, dofs1D, quad1D;
1917  Vector pa_data;
1918  bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
1919  // CEED extension
1920  CeedData* ceedDataPtr;
1921 
1922 public:
1923  /// Construct a diffusion integrator with coefficient Q = 1
1925  : Q(NULL), VQ(NULL), MQ(NULL), maps(NULL), geom(NULL), ceedDataPtr(NULL) { }
1926 
1927  /// Construct a diffusion integrator with a scalar coefficient q
1929  : Q(&q), VQ(NULL), MQ(NULL), maps(NULL), geom(NULL), ceedDataPtr(NULL) { }
1930 
1931  /// Construct a diffusion integrator with a vector coefficient q
1933  : Q(NULL), VQ(&q), MQ(NULL), maps(NULL), geom(NULL), ceedDataPtr(NULL) { }
1934 
1935  /// Construct a diffusion integrator with a matrix coefficient q
1937  : Q(NULL), VQ(NULL), MQ(&q), maps(NULL), geom(NULL), ceedDataPtr(NULL) { }
1938 
1940  {
1941  delete ceedDataPtr;
1942  }
1943 
1944  /** Given a particular Finite Element computes the element stiffness matrix
1945  elmat. */
1946  virtual void AssembleElementMatrix(const FiniteElement &el,
1948  DenseMatrix &elmat);
1949  /** Given a trial and test Finite Element computes the element stiffness
1950  matrix elmat. */
1951  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
1952  const FiniteElement &test_fe,
1954  DenseMatrix &elmat);
1955 
1956  /// Perform the local action of the BilinearFormIntegrator
1957  virtual void AssembleElementVector(const FiniteElement &el,
1959  const Vector &elfun, Vector &elvect);
1960 
1961  virtual void ComputeElementFlux(const FiniteElement &el,
1963  Vector &u, const FiniteElement &fluxelem,
1964  Vector &flux, bool with_coef = true);
1965 
1966  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
1968  Vector &flux, Vector *d_energy = NULL);
1969 
1971 
1972  virtual void AssembleMF(const FiniteElementSpace &fes);
1973 
1974  virtual void AssemblePA(const FiniteElementSpace &fes);
1975 
1976  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
1977  const bool add);
1978 
1979  virtual void AssembleDiagonalPA(Vector &diag);
1980 
1981  virtual void AssembleDiagonalMF(Vector &diag);
1982 
1983  virtual void AddMultMF(const Vector&, Vector&) const;
1984 
1985  virtual void AddMultPA(const Vector&, Vector&) const;
1986 
1987  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
1988  const FiniteElement &test_fe);
1989 };
1990 
1991 /** Class for local mass matrix assembling a(u,v) := (Q u, v) */
1993 {
1994 protected:
1995 #ifndef MFEM_THREAD_SAFE
1997 #endif
1999  // PA extension
2002  const DofToQuad *maps; ///< Not owned
2003  const GeometricFactors *geom; ///< Not owned
2004  int dim, ne, nq, dofs1D, quad1D;
2005 
2006  // CEED extension
2007  CeedData* ceedDataPtr;
2008 
2009 public:
2011  : BilinearFormIntegrator(ir), Q(NULL), maps(NULL), geom(NULL),
2012  ceedDataPtr(NULL) { }
2013 
2014  /// Construct a mass integrator with coefficient q
2016  : BilinearFormIntegrator(ir), Q(&q), maps(NULL), geom(NULL),
2017  ceedDataPtr(NULL) { }
2018 
2020  {
2021  delete ceedDataPtr;
2022  }
2023  /** Given a particular Finite Element computes the element mass matrix
2024  elmat. */
2025  virtual void AssembleElementMatrix(const FiniteElement &el,
2027  DenseMatrix &elmat);
2028  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2029  const FiniteElement &test_fe,
2031  DenseMatrix &elmat);
2032 
2034 
2035  virtual void AssembleMF(const FiniteElementSpace &fes);
2036 
2037  virtual void AssemblePA(const FiniteElementSpace &fes);
2038 
2039  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2040  const bool add);
2041 
2042  virtual void AssembleDiagonalPA(Vector &diag);
2043 
2044  virtual void AssembleDiagonalMF(Vector &diag);
2045 
2046  virtual void AddMultMF(const Vector&, Vector&) const;
2047 
2048  virtual void AddMultPA(const Vector&, Vector&) const;
2049 
2050  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2051  const FiniteElement &test_fe,
2053 
2054  void SetupPA(const FiniteElementSpace &fes);
2055 };
2056 
2057 /** Mass integrator (u, v) restricted to the boundary of a domain */
2059 {
2060 public:
2062 
2064 
2065  virtual void AssembleFaceMatrix(const FiniteElement &el1,
2066  const FiniteElement &el2,
2068  DenseMatrix &elmat);
2069 };
2070 
2071 /// alpha (q . grad u, v)
2073 {
2074 protected:
2076  double alpha;
2077  // PA extension
2079  const DofToQuad *maps; ///< Not owned
2080  const GeometricFactors *geom; ///< Not owned
2081  int dim, ne, nq, dofs1D, quad1D;
2082 
2083 private:
2084 #ifndef MFEM_THREAD_SAFE
2085  DenseMatrix dshape, adjJ, Q_ir;
2086  Vector shape, vec2, BdFidxT;
2087 #endif
2088 
2089 public:
2091  : Q(&q) { alpha = a; }
2092  virtual void AssembleElementMatrix(const FiniteElement &,
2094  DenseMatrix &);
2095 
2097 
2098  virtual void AssemblePA(const FiniteElementSpace&);
2099 
2100  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2101  const bool add);
2102 
2103  virtual void AddMultPA(const Vector&, Vector&) const;
2104 
2105  static const IntegrationRule &GetRule(const FiniteElement &el,
2107 
2108  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2109  const FiniteElement &test_fe,
2111 };
2112 
2113 /// alpha (q . grad u, v) using the "group" FE discretization
2115 {
2116 protected:
2118  double alpha;
2119 
2120 private:
2121  DenseMatrix dshape, adjJ, Q_nodal, grad;
2122  Vector shape;
2123 
2124 public:
2126  : Q(&q) { alpha = a; }
2127  virtual void AssembleElementMatrix(const FiniteElement &,
2129  DenseMatrix &);
2130 };
2131 
2132 /** Class for integrating the bilinear form a(u,v) := (Q u, v),
2133  where u=(u1,...,un) and v=(v1,...,vn); ui and vi are defined
2134  by scalar FE through standard transformation. */
2136 {
2137 private:
2138  int vdim;
2139  Vector shape, te_shape, vec;
2140  DenseMatrix partelmat;
2141  DenseMatrix mcoeff;
2142  int Q_order;
2143 
2144 protected:
2148  // PA extension
2150  const DofToQuad *maps; ///< Not owned
2151  const GeometricFactors *geom; ///< Not owned
2152  int dim, ne, nq, dofs1D, quad1D;
2153 
2154  // CEED extension
2155  CeedData* ceedDataPtr;
2156 
2157 public:
2158  /// Construct an integrator with coefficient 1.0
2160  : vdim(-1), Q_order(0), Q(NULL), VQ(NULL), MQ(NULL), ceedDataPtr(NULL) { }
2161  /** Construct an integrator with scalar coefficient q. If possible, save
2162  memory by using a scalar integrator since the resulting matrix is block
2163  diagonal with the same diagonal block repeated. */
2165  : vdim(-1), Q_order(qo), Q(&q), VQ(NULL), MQ(NULL), ceedDataPtr(NULL) { }
2167  : BilinearFormIntegrator(ir), vdim(-1), Q_order(0), Q(&q), VQ(NULL),
2168  MQ(NULL), ceedDataPtr(NULL) { }
2169  /// Construct an integrator with diagonal coefficient q
2171  : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(&q), MQ(NULL),
2172  ceedDataPtr(NULL) { }
2173  /// Construct an integrator with matrix coefficient q
2175  : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(NULL), MQ(&q),
2176  ceedDataPtr(NULL) { }
2177 
2179  {
2180  delete ceedDataPtr;
2181  }
2182 
2183  int GetVDim() const { return vdim; }
2184  void SetVDim(int vdim) { this->vdim = vdim; }
2185 
2186  virtual void AssembleElementMatrix(const FiniteElement &el,
2188  DenseMatrix &elmat);
2189  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2190  const FiniteElement &test_fe,
2192  DenseMatrix &elmat);
2194  virtual void AssemblePA(const FiniteElementSpace &fes);
2195  virtual void AssembleMF(const FiniteElementSpace &fes);
2196  virtual void AssembleDiagonalPA(Vector &diag);
2197  virtual void AssembleDiagonalMF(Vector &diag);
2198  virtual void AddMultPA(const Vector &x, Vector &y) const;
2199  virtual void AddMultMF(const Vector &x, Vector &y) const;
2200 };
2201 
2202 
2203 /** Class for integrating (div u, p) where u is a vector field given by
2204  VectorFiniteElement through Piola transformation (for RT elements); p is
2205  scalar function given by FiniteElement through standard transformation.
2206  Here, u is the trial function and p is the test function.
2207 
2208  Note: the element matrix returned by AssembleElementMatrix2 does NOT depend
2209  on the ElementTransformation Trans. */
2211 {
2212 protected:
2214 
2216  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2217  const FiniteElementSpace &test_fes);
2218 
2219  virtual void AddMultPA(const Vector&, Vector&) const;
2220  virtual void AddMultTransposePA(const Vector&, Vector&) const;
2221 
2222 private:
2223 #ifndef MFEM_THREAD_SAFE
2224  Vector divshape, shape;
2225 #endif
2226 
2227  // PA extension
2228  Vector pa_data;
2229  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2230  const DofToQuad *L2mapsO; ///< Not owned. DOF-to-quad map, open.
2231  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2232  int dim, ne, dofs1D, L2dofs1D, quad1D;
2233 
2234 public:
2237  virtual void AssembleElementMatrix(const FiniteElement &el,
2239  DenseMatrix &elmat) { }
2240  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2241  const FiniteElement &test_fe,
2243  DenseMatrix &elmat);
2244 
2245  virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
2246 };
2247 
2248 
2249 /** Integrator for `(-Q u, grad v)` for Nedelec (`u`) and H1 (`v`) elements.
2250  This is equivalent to a weak divergence of the Nedelec basis functions. */
2252 {
2253 protected:
2255 
2256 private:
2257 #ifndef MFEM_THREAD_SAFE
2258  DenseMatrix dshape;
2259  DenseMatrix dshapedxt;
2260  DenseMatrix vshape;
2261  DenseMatrix invdfdx;
2262 #endif
2263 
2264 public:
2267  virtual void AssembleElementMatrix(const FiniteElement &el,
2269  DenseMatrix &elmat) { }
2270  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2271  const FiniteElement &test_fe,
2273  DenseMatrix &elmat);
2274 };
2275 
2276 /** Integrator for (curl u, v) for Nedelec and RT elements. If the trial and
2277  test spaces are switched, assembles the form (u, curl v). */
2279 {
2280 protected:
2282 
2283 private:
2284 #ifndef MFEM_THREAD_SAFE
2285  DenseMatrix curlshapeTrial;
2286  DenseMatrix vshapeTest;
2287  DenseMatrix curlshapeTrial_dFT;
2288 #endif
2289 
2290 public:
2293  virtual void AssembleElementMatrix(const FiniteElement &el,
2295  DenseMatrix &elmat) { }
2296  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2297  const FiniteElement &test_fe,
2299  DenseMatrix &elmat);
2300 };
2301 
2302 /// Class for integrating (Q D_i(u), v); u and v are scalars
2304 {
2305 protected:
2307 
2308 private:
2309  int xi;
2310  DenseMatrix dshape, dshapedxt, invdfdx;
2311  Vector shape, dshapedxi;
2312 
2313 public:
2314  DerivativeIntegrator(Coefficient &q, int i) : Q(&q), xi(i) { }
2315  virtual void AssembleElementMatrix(const FiniteElement &el,
2317  DenseMatrix &elmat)
2318  { AssembleElementMatrix2(el,el,Trans,elmat); }
2319  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2320  const FiniteElement &test_fe,
2322  DenseMatrix &elmat);
2323 };
2324 
2325 /// Integrator for (curl u, curl v) for Nedelec elements
2327 {
2328 private:
2329  Vector vec, pointflux;
2330 #ifndef MFEM_THREAD_SAFE
2331  Vector D;
2332  DenseMatrix curlshape, curlshape_dFt, M;
2333  DenseMatrix vshape, projcurl;
2334 #endif
2335 
2336 protected:
2340 
2341  // PA extension
2343  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2344  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2345  const GeometricFactors *geom; ///< Not owned
2346  int dim, ne, nq, dofs1D, quad1D;
2347  bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2348 
2349 public:
2350  CurlCurlIntegrator() { Q = NULL; DQ = NULL; MQ = NULL; }
2351  /// Construct a bilinear form integrator for Nedelec elements
2353  BilinearFormIntegrator(ir), Q(&q) { DQ = NULL; MQ = NULL; }
2355  BilinearFormIntegrator(ir), DQ(&dq) { Q = NULL; MQ = NULL; }
2357  BilinearFormIntegrator(ir), MQ(&mq) { Q = NULL; DQ = NULL; }
2358 
2359  /* Given a particular Finite Element, compute the
2360  element curl-curl matrix elmat */
2361  virtual void AssembleElementMatrix(const FiniteElement &el,
2363  DenseMatrix &elmat);
2364 
2365  virtual void ComputeElementFlux(const FiniteElement &el,
2367  Vector &u, const FiniteElement &fluxelem,
2368  Vector &flux, bool with_coef);
2369 
2370  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
2372  Vector &flux, Vector *d_energy = NULL);
2373 
2375  virtual void AssemblePA(const FiniteElementSpace &fes);
2376  virtual void AddMultPA(const Vector &x, Vector &y) const;
2377  virtual void AssembleDiagonalPA(Vector& diag);
2378 };
2379 
2380 /** Integrator for (curl u, curl v) for FE spaces defined by 'dim' copies of a
2381  scalar FE space. */
2383 {
2384 private:
2385 #ifndef MFEM_THREAD_SAFE
2386  DenseMatrix dshape_hat, dshape, curlshape, Jadj, grad_hat, grad;
2387 #endif
2388 
2389 protected:
2391 
2392 public:
2394 
2396 
2397  /// Assemble an element matrix
2398  virtual void AssembleElementMatrix(const FiniteElement &el,
2400  DenseMatrix &elmat);
2401  /// Compute element energy: (1/2) (curl u, curl u)_E
2402  virtual double GetElementEnergy(const FiniteElement &el,
2404  const Vector &elfun);
2405 };
2406 
2407 /** Integrator for (Q u, v), where Q is an optional coefficient (of type scalar,
2408  vector (diagonal matrix), or matrix), trial function u is in H(Curl) or
2409  H(Div), and test function v is in H(Curl), H(Div), or v=(v1,...,vn), where
2410  vi are in H1. */
2412 {
2413 private:
2415  { Q = q; VQ = vq; MQ = mq; }
2416 
2417 #ifndef MFEM_THREAD_SAFE
2418  Vector shape;
2419  Vector D;
2420  DenseMatrix K;
2421  DenseMatrix partelmat;
2422  DenseMatrix test_vshape;
2423  DenseMatrix trial_vshape;
2424 #endif
2425 
2426 protected:
2430 
2431  // PA extension
2433  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2434  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2435  const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2436  const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2437  const GeometricFactors *geom; ///< Not owned
2439  bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2440 
2441 public:
2442  VectorFEMassIntegrator() { Init(NULL, NULL, NULL); }
2443  VectorFEMassIntegrator(Coefficient *_q) { Init(_q, NULL, NULL); }
2444  VectorFEMassIntegrator(Coefficient &q) { Init(&q, NULL, NULL); }
2445  VectorFEMassIntegrator(VectorCoefficient *_vq) { Init(NULL, _vq, NULL); }
2446  VectorFEMassIntegrator(VectorCoefficient &vq) { Init(NULL, &vq, NULL); }
2447  VectorFEMassIntegrator(MatrixCoefficient *_mq) { Init(NULL, NULL, _mq); }
2448  VectorFEMassIntegrator(MatrixCoefficient &mq) { Init(NULL, NULL, &mq); }
2449 
2450  virtual void AssembleElementMatrix(const FiniteElement &el,
2452  DenseMatrix &elmat);
2453  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2454  const FiniteElement &test_fe,
2456  DenseMatrix &elmat);
2457 
2459  virtual void AssemblePA(const FiniteElementSpace &fes);
2460  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2461  const FiniteElementSpace &test_fes);
2462  virtual void AddMultPA(const Vector &x, Vector &y) const;
2463  virtual void AssembleDiagonalPA(Vector& diag);
2464 };
2465 
2466 /** Integrator for (Q div u, p) where u=(v1,...,vn) and all vi are in the same
2467  scalar FE space; p is also in a (different) scalar FE space. */
2469 {
2470 protected:
2472 
2473 private:
2474  Vector shape;
2475  Vector divshape;
2476  DenseMatrix dshape;
2477  DenseMatrix gshape;
2478  DenseMatrix Jadj;
2479  // PA extension
2480  Vector pa_data;
2481  const DofToQuad *trial_maps, *test_maps; ///< Not owned
2482  const GeometricFactors *geom; ///< Not owned
2483  int dim, ne, nq;
2484  int trial_dofs1D, test_dofs1D, quad1D;
2485 
2486 public:
2488  Q(NULL), trial_maps(NULL), test_maps(NULL), geom(NULL)
2489  { }
2491  Q(_q), trial_maps(NULL), test_maps(NULL), geom(NULL)
2492  { }
2494  Q(&q), trial_maps(NULL), test_maps(NULL), geom(NULL)
2495  { }
2496 
2497  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2498  const FiniteElement &test_fe,
2500  DenseMatrix &elmat);
2501 
2503  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2504  const FiniteElementSpace &test_fes);
2505 
2506  virtual void AddMultPA(const Vector &x, Vector &y) const;
2507  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2508 
2509  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2510  const FiniteElement &test_fe,
2512 };
2513 
2514 /// (Q div u, div v) for RT elements
2516 {
2517 protected:
2519 
2521  virtual void AssemblePA(const FiniteElementSpace &fes);
2522  virtual void AddMultPA(const Vector &x, Vector &y) const;
2523  virtual void AssembleDiagonalPA(Vector& diag);
2524 
2525 private:
2526 #ifndef MFEM_THREAD_SAFE
2527  Vector divshape;
2528 #endif
2529 
2530  // PA extension
2531  Vector pa_data;
2532  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2533  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2534  const GeometricFactors *geom; ///< Not owned
2535  int dim, ne, dofs1D, quad1D;
2536 
2537 public:
2538  DivDivIntegrator() { Q = NULL; }
2540 
2541  virtual void AssembleElementMatrix(const FiniteElement &el,
2543  DenseMatrix &elmat);
2544 };
2545 
2546 /** Integrator for
2547  (Q grad u, grad v) = sum_i (Q grad u_i, grad v_i) e_i e_i^T
2548  for FE spaces defined by 'dim' copies of a scalar FE space. Where e_i
2549  is the unit vector in the i-th direction. The resulting local element
2550  matrix is a block-diagonal matrix consisting of 'dim' copies of a scalar
2551  diffusion matrix in each diagonal block. */
2553 {
2554 protected:
2556 
2557  // PA extension
2558  const DofToQuad *maps; ///< Not owned
2559  const GeometricFactors *geom; ///< Not owned
2562 
2563  // CEED extension
2564  CeedData* ceedDataPtr;
2565 
2566 private:
2567  DenseMatrix dshape, dshapedxt, pelmat;
2568  DenseMatrix Jinv, gshape;
2569 
2570 public:
2572  : Q(NULL), ceedDataPtr(NULL) { }
2574  : Q(&q), ceedDataPtr(NULL) { }
2575 
2577  {
2578  delete ceedDataPtr;
2579  }
2580 
2581  virtual void AssembleElementMatrix(const FiniteElement &el,
2583  DenseMatrix &elmat);
2584  virtual void AssembleElementVector(const FiniteElement &el,
2586  const Vector &elfun, Vector &elvect);
2588  virtual void AssemblePA(const FiniteElementSpace &fes);
2589  virtual void AssembleMF(const FiniteElementSpace &fes);
2590  virtual void AssembleDiagonalPA(Vector &diag);
2591  virtual void AssembleDiagonalMF(Vector &diag);
2592  virtual void AddMultPA(const Vector &x, Vector &y) const;
2593  virtual void AddMultMF(const Vector &x, Vector &y) const;
2594 };
2595 
2596 /** Integrator for the linear elasticity form:
2597  a(u,v) = (lambda div(u), div(v)) + (2 mu e(u), e(v)),
2598  where e(v) = (1/2) (grad(v) + grad(v)^T).
2599  This is a 'Vector' integrator, i.e. defined for FE spaces
2600  using multiple copies of a scalar FE space. */
2602 {
2603 protected:
2604  double q_lambda, q_mu;
2606 
2607 private:
2608 #ifndef MFEM_THREAD_SAFE
2609  Vector shape;
2610  DenseMatrix dshape, gshape, pelmat;
2611  Vector divshape;
2612 #endif
2613 
2614 public:
2616  { lambda = &l; mu = &m; }
2617  /** With this constructor lambda = q_l * m and mu = q_m * m;
2618  if dim * q_l + 2 * q_m = 0 then trace(sigma) = 0. */
2619  ElasticityIntegrator(Coefficient &m, double q_l, double q_m)
2620  { lambda = NULL; mu = &m; q_lambda = q_l; q_mu = q_m; }
2621 
2622  virtual void AssembleElementMatrix(const FiniteElement &,
2624  DenseMatrix &);
2625 
2626  /** Compute the stress corresponding to the local displacement @a u and
2627  interpolate it at the nodes of the given @a fluxelem. Only the symmetric
2628  part of the stress is stored, so that the size of @a flux is equal to
2629  the number of DOFs in @a fluxelem times dim*(dim+1)/2. In 2D, the order
2630  of the stress components is: s_xx, s_yy, s_xy. In 3D, it is: s_xx, s_yy,
2631  s_zz, s_xy, s_xz, s_yz. In other words, @a flux is the local vector for
2632  a FE space with dim*(dim+1)/2 vector components, based on the finite
2633  element @a fluxelem. */
2634  virtual void ComputeElementFlux(const FiniteElement &el,
2636  Vector &u,
2637  const FiniteElement &fluxelem,
2638  Vector &flux, bool with_coef = true);
2639 
2640  /** Compute the element energy (integral of the strain energy density)
2641  corresponding to the stress represented by @a flux which is a vector of
2642  coefficients multiplying the basis functions defined by @a fluxelem. In
2643  other words, @a flux is the local vector for a FE space with
2644  dim*(dim+1)/2 vector components, based on the finite element @a fluxelem.
2645  The number of components, dim*(dim+1)/2 is such that it represents the
2646  symmetric part of the (symmetric) stress tensor. The order of the
2647  components is: s_xx, s_yy, s_xy in 2D, and s_xx, s_yy, s_zz, s_xy, s_xz,
2648  s_yz in 3D. */
2649  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
2651  Vector &flux, Vector *d_energy = NULL);
2652 };
2653 
2654 /** Integrator for the DG form:
2655  alpha < rho_u (u.n) {v},[w] > + beta < rho_u |u.n| [v],[w] >,
2656  where v and w are the trial and test variables, respectively, and rho/u are
2657  given scalar/vector coefficients. The vector coefficient, u, is assumed to
2658  be continuous across the faces and when given the scalar coefficient, rho,
2659  is assumed to be discontinuous. The integrator uses the upwind value of rho,
2660  rho_u, which is value from the side into which the vector coefficient, u,
2661  points. */
2663 {
2664 protected:
2667  double alpha, beta;
2668  // PA extension
2670  const DofToQuad *maps; ///< Not owned
2671  const FaceGeometricFactors *geom; ///< Not owned
2672  int dim, nf, nq, dofs1D, quad1D;
2673 
2674 private:
2675  Vector shape1, shape2;
2676 
2677 public:
2678  /// Construct integrator with rho = 1.
2680  { rho = NULL; u = &_u; alpha = a; beta = b; }
2681 
2683  double a, double b)
2684  { rho = &_rho; u = &_u; alpha = a; beta = b; }
2685 
2687  virtual void AssembleFaceMatrix(const FiniteElement &el1,
2688  const FiniteElement &el2,
2690  DenseMatrix &elmat);
2691 
2693 
2694  virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
2695 
2696  virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
2697 
2698  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2699 
2700  virtual void AddMultPA(const Vector&, Vector&) const;
2701 
2702  virtual void AssembleEAInteriorFaces(const FiniteElementSpace& fes,
2703  Vector &ea_data_int,
2704  Vector &ea_data_ext,
2705  const bool add);
2706 
2707  virtual void AssembleEABoundaryFaces(const FiniteElementSpace& fes,
2708  Vector &ea_data_bdr,
2709  const bool add);
2710 
2711  static const IntegrationRule &GetRule(Geometry::Type geom, int order,
2713 
2714 private:
2715  void SetupPA(const FiniteElementSpace &fes, FaceType type);
2716 };
2717 
2718 /** Integrator for the DG form:
2719 
2720  - < {(Q grad(u)).n}, [v] > + sigma < [u], {(Q grad(v)).n} >
2721  + kappa < {h^{-1} Q} [u], [v] >,
2722 
2723  where Q is a scalar or matrix diffusion coefficient and u, v are the trial
2724  and test spaces, respectively. The parameters sigma and kappa determine the
2725  DG method to be used (when this integrator is added to the "broken"
2726  DiffusionIntegrator):
2727  * sigma = -1, kappa >= kappa0: symm. interior penalty (IP or SIPG) method,
2728  * sigma = +1, kappa > 0: non-symmetric interior penalty (NIPG) method,
2729  * sigma = +1, kappa = 0: the method of Baumann and Oden. */
2731 {
2732 protected:
2735  double sigma, kappa;
2736 
2737  // these are not thread-safe!
2740 
2741 public:
2742  DGDiffusionIntegrator(const double s, const double k)
2743  : Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
2744  DGDiffusionIntegrator(Coefficient &q, const double s, const double k)
2745  : Q(&q), MQ(NULL), sigma(s), kappa(k) { }
2746  DGDiffusionIntegrator(MatrixCoefficient &q, const double s, const double k)
2747  : Q(NULL), MQ(&q), sigma(s), kappa(k) { }
2749  virtual void AssembleFaceMatrix(const FiniteElement &el1,
2750  const FiniteElement &el2,
2752  DenseMatrix &elmat);
2753 };
2754 
2755 /** Integrator for the DG elasticity form, for the formulations see:
2756  - PhD Thesis of Jonas De Basabe, High-Order Finite %Element Methods for
2757  Seismic Wave Propagation, UT Austin, 2009, p. 23, and references therein
2758  - Peter Hansbo and Mats G. Larson, Discontinuous Galerkin and the
2759  Crouzeix-Raviart %Element: Application to Elasticity, PREPRINT 2000-09,
2760  p.3
2761 
2762  \f[
2763  - \left< \{ \tau(u) \}, [v] \right> + \alpha \left< \{ \tau(v) \}, [u]
2764  \right> + \kappa \left< h^{-1} \{ \lambda + 2 \mu \} [u], [v] \right>
2765  \f]
2766 
2767  where \f$ \left<u, v\right> = \int_{F} u \cdot v \f$, and \f$ F \f$ is a
2768  face which is either a boundary face \f$ F_b \f$ of an element \f$ K \f$ or
2769  an interior face \f$ F_i \f$ separating elements \f$ K_1 \f$ and \f$ K_2 \f$.
2770 
2771  In the bilinear form above \f$ \tau(u) \f$ is traction, and it's also
2772  \f$ \tau(u) = \sigma(u) \cdot \vec{n} \f$, where \f$ \sigma(u) \f$ is
2773  stress, and \f$ \vec{n} \f$ is the unit normal vector w.r.t. to \f$ F \f$.
2774 
2775  In other words, we have
2776  \f[
2777  - \left< \{ \sigma(u) \cdot \vec{n} \}, [v] \right> + \alpha \left< \{
2778  \sigma(v) \cdot \vec{n} \}, [u] \right> + \kappa \left< h^{-1} \{
2779  \lambda + 2 \mu \} [u], [v] \right>
2780  \f]
2781 
2782  For isotropic media
2783  \f[
2784  \begin{split}
2785  \sigma(u) &= \lambda \nabla \cdot u I + 2 \mu \varepsilon(u) \\
2786  &= \lambda \nabla \cdot u I + 2 \mu \frac{1}{2} (\nabla u + \nabla
2787  u^T) \\
2788  &= \lambda \nabla \cdot u I + \mu (\nabla u + \nabla u^T)
2789  \end{split}
2790  \f]
2791 
2792  where \f$ I \f$ is identity matrix, \f$ \lambda \f$ and \f$ \mu \f$ are Lame
2793  coefficients (see ElasticityIntegrator), \f$ u, v \f$ are the trial and test
2794  functions, respectively.
2795 
2796  The parameters \f$ \alpha \f$ and \f$ \kappa \f$ determine the DG method to
2797  use (when this integrator is added to the "broken" ElasticityIntegrator):
2798 
2799  - IIPG, \f$\alpha = 0\f$,
2800  C. Dawson, S. Sun, M. Wheeler, Compatible algorithms for coupled flow and
2801  transport, Comp. Meth. Appl. Mech. Eng., 193(23-26), 2565-2580, 2004.
2802 
2803  - SIPG, \f$\alpha = -1\f$,
2804  M. Grote, A. Schneebeli, D. Schotzau, Discontinuous Galerkin Finite
2805  %Element Method for the Wave Equation, SINUM, 44(6), 2408-2431, 2006.
2806 
2807  - NIPG, \f$\alpha = 1\f$,
2808  B. Riviere, M. Wheeler, V. Girault, A Priori Error Estimates for Finite
2809  %Element Methods Based on Discontinuous Approximation Spaces for Elliptic
2810  Problems, SINUM, 39(3), 902-931, 2001.
2811 
2812  This is a '%Vector' integrator, i.e. defined for FE spaces using multiple
2813  copies of a scalar FE space.
2814  */
2816 {
2817 public:
2818  DGElasticityIntegrator(double alpha_, double kappa_)
2819  : lambda(NULL), mu(NULL), alpha(alpha_), kappa(kappa_) { }
2820 
2822  double alpha_, double kappa_)
2823  : lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
2824 
2826  virtual void AssembleFaceMatrix(const FiniteElement &el1,
2827  const FiniteElement &el2,
2829  DenseMatrix &elmat);
2830 
2831 protected:
2833  double alpha, kappa;
2834 
2835 #ifndef MFEM_THREAD_SAFE
2836  // values of all scalar basis functions for one component of u (which is a
2837  // vector) at the integration point in the reference space
2839  // values of derivatives of all scalar basis functions for one component
2840  // of u (which is a vector) at the integration point in the reference space
2842  // Adjugate of the Jacobian of the transformation: adjJ = det(J) J^{-1}
2844  // gradient of shape functions in the real (physical, not reference)
2845  // coordinates, scaled by det(J):
2846  // dshape_ps(jdof,jm) = sum_{t} adjJ(t,jm)*dshape(jdof,t)
2848  Vector nor; // nor = |weight(J_face)| n
2849  Vector nL1, nL2; // nL1 = (lambda1 * ip.weight / detJ1) nor
2850  Vector nM1, nM2; // nM1 = (mu1 * ip.weight / detJ1) nor
2851  Vector dshape1_dnM, dshape2_dnM; // dshape1_dnM = dshape1_ps . nM1
2852  // 'jmat' corresponds to the term: kappa <h^{-1} {lambda + 2 mu} [u], [v]>
2854 #endif
2855 
2856  static void AssembleBlock(
2857  const int dim, const int row_ndofs, const int col_ndofs,
2858  const int row_offset, const int col_offset,
2859  const double jmatcoef, const Vector &col_nL, const Vector &col_nM,
2860  const Vector &row_shape, const Vector &col_shape,
2861  const Vector &col_dshape_dnM, const DenseMatrix &col_dshape,
2862  DenseMatrix &elmat, DenseMatrix &jmat);
2863 };
2864 
2865 /** Integrator for the DPG form: < v, [w] > over all faces (the interface) where
2866  the trial variable v is defined on the interface and the test variable w is
2867  defined inside the elements, generally in a DG space. */
2869 {
2870 private:
2871  Vector face_shape, shape1, shape2;
2872 
2873 public:
2876  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
2877  const FiniteElement &test_fe1,
2878  const FiniteElement &test_fe2,
2880  DenseMatrix &elmat);
2881 };
2882 
2883 /** Integrator for the form: < v, [w.n] > over all faces (the interface) where
2884  the trial variable v is defined on the interface and the test variable w is
2885  in an H(div)-conforming space. */
2887 {
2888 private:
2889  Vector face_shape, normal, shape1_n, shape2_n;
2890  DenseMatrix shape1, shape2;
2891 
2892 public:
2895  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
2896  const FiniteElement &test_fe1,
2897  const FiniteElement &test_fe2,
2899  DenseMatrix &elmat);
2900 };
2901 
2902 /** Abstract class to serve as a base for local interpolators to be used in the
2903  DiscreteLinearOperator class. */
2905 
2906 
2907 /** Class for constructing the gradient as a DiscreteLinearOperator from an
2908  H1-conforming space to an H(curl)-conforming space. The range space can be
2909  vector L2 space as well. */
2911 {
2912 public:
2913  virtual void AssembleElementMatrix2(const FiniteElement &h1_fe,
2914  const FiniteElement &nd_fe,
2916  DenseMatrix &elmat)
2917  { nd_fe.ProjectGrad(h1_fe, Trans, elmat); }
2918 };
2919 
2920 
2921 /** Class for constructing the identity map as a DiscreteLinearOperator. This
2922  is the discrete embedding matrix when the domain space is a subspace of
2923  the range space. Otherwise, a dof projection matrix is constructed. */
2925 {
2926 public:
2927  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
2928  const FiniteElement &ran_fe,
2930  DenseMatrix &elmat)
2931  { ran_fe.Project(dom_fe, Trans, elmat); }
2932 };
2933 
2934 
2935 /** Class for constructing the (local) discrete curl matrix which can be used
2936  as an integrator in a DiscreteLinearOperator object to assemble the global
2937  discrete curl matrix. */
2939 {
2940 public:
2941  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
2942  const FiniteElement &ran_fe,
2944  DenseMatrix &elmat)
2945  { ran_fe.ProjectCurl(dom_fe, Trans, elmat); }
2946 };
2947 
2948 
2949 /** Class for constructing the (local) discrete divergence matrix which can
2950  be used as an integrator in a DiscreteLinearOperator object to assemble
2951  the global discrete divergence matrix.
2952 
2953  Note: Since the dofs in the L2_FECollection are nodal values, the local
2954  discrete divergence matrix (with an RT-type domain space) will depend on
2955  the transformation. On the other hand, the local matrix returned by
2956  VectorFEDivergenceIntegrator is independent of the transformation. */
2958 {
2959 public:
2960  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
2961  const FiniteElement &ran_fe,
2963  DenseMatrix &elmat)
2964  { ran_fe.ProjectDiv(dom_fe, Trans, elmat); }
2965 };
2966 
2967 
2968 /** A trace face interpolator class for interpolating the normal component of
2969  the domain space, e.g. vector H1, into the range space, e.g. the trace of
2970  RT which uses FiniteElement::INTEGRAL map type. */
2972 {
2973 public:
2974  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
2975  const FiniteElement &ran_fe,
2977  DenseMatrix &elmat);
2978 };
2979 
2980 /** Interpolator of a scalar coefficient multiplied by a scalar field onto
2981  another scalar field. Note that this can produce inaccurate fields unless
2982  the target is sufficiently high order. */
2984 {
2985 public:
2987 
2988  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
2989  const FiniteElement &ran_fe,
2991  DenseMatrix &elmat);
2992 
2993 protected:
2995 };
2996 
2997 /** Interpolator of a scalar coefficient multiplied by a vector field onto
2998  another vector field. Note that this can produce inaccurate fields unless
2999  the target is sufficiently high order. */
3001 {
3002 public:
3004  : Q(&sc) { }
3005 
3006  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3007  const FiniteElement &ran_fe,
3009  DenseMatrix &elmat);
3010 protected:
3012 };
3013 
3014 /** Interpolator of a vector coefficient multiplied by a scalar field onto
3015  another vector field. Note that this can produce inaccurate fields unless
3016  the target is sufficiently high order. */
3018 {
3019 public:
3021  : VQ(&vc) { }
3022 
3023  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3024  const FiniteElement &ran_fe,
3026  DenseMatrix &elmat);
3027 protected:
3029 };
3030 
3031 /** Interpolator of the cross product between a vector coefficient and an
3032  H(curl)-conforming field onto an H(div)-conforming field. The range space
3033  can also be vector L2. */
3035 {
3036 public:
3038  : VQ(&vc) { }
3039 
3040  virtual void AssembleElementMatrix2(const FiniteElement &nd_fe,
3041  const FiniteElement &rt_fe,
3043  DenseMatrix &elmat);
3044 protected:
3046 };
3047 
3048 /** Interpolator of the inner product between a vector coefficient and an
3049  H(div)-conforming field onto an L2-conforming field. The range space can
3050  also be H1. */
3052 {
3053 public:
3055 
3056  virtual void AssembleElementMatrix2(const FiniteElement &rt_fe,
3057  const FiniteElement &l2_fe,
3059  DenseMatrix &elmat);
3060 protected:
3062 };
3063 
3064 
3065 
3066 // PA Diffusion Assemble 2D kernel
3067 template<const int T_SDIM>
3068 void PADiffusionSetup2D(const int Q1D,
3069  const int coeffDim,
3070  const int NE,
3071  const Array<double> &w,
3072  const Vector &j,
3073  const Vector &c,
3074  Vector &d);
3075 
3076 }
3077 #endif
Abstract class for all finite elements.
Definition: fe.hpp:235
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:676
virtual void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
Definition: bilininteg.hpp:386
virtual void AddMultMF(const Vector &x, Vector &y) const
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
Definition: bilininteg.hpp:453
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
VectorFEMassIntegrator(Coefficient &q)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
Definition: bilininteg.cpp:179
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
int GetDim() const
Returns the reference space dimension for the finite element.
Definition: fe.hpp:309
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:838
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add=true)
Definition: bilininteg.cpp:72
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:809
MixedCrossCurlGradIntegrator(VectorCoefficient &vq)
DGTraceIntegrator(VectorCoefficient &_u, double a, double b)
Construct integrator with rho = 1.
bool symmetric
False if using a nonsymmetric matrix coefficient.
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
MixedGradDivIntegrator(VectorCoefficient &vq)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
DGDiffusionIntegrator(Coefficient &q, const double s, const double k)
Integrator defining a sum of multiple Integrators.
Definition: bilininteg.hpp:354
SumIntegrator(int own_integs=1)
Definition: bilininteg.hpp:362
static const IntegrationRule & GetRule(Geometry::Type geom, int order, FaceElementTransformations &T)
void SetupPA(const FiniteElementSpace &fes)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition: fe.cpp:40
virtual const char * FiniteElementTypeFailureMessage() const
MatrixCoefficient * MQ
virtual const char * FiniteElementTypeFailureMessage() const
DiffusionIntegrator(Coefficient &q)
Construct a diffusion integrator with a scalar coefficient q.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:474
virtual int OrderW() const =0
Return the order of the determinant of the Jacobian (weight) of the transformation.
MixedScalarCrossProductIntegrator(VectorCoefficient &vq)
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
MatrixCoefficient * MQ
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:183
Base class for vector Coefficients that optionally depend on time and space.
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
VectorCoefficient * u
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:579
VectorCoefficient * VQ
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition: fe.cpp:130
MixedVectorWeakDivergenceIntegrator(VectorCoefficient &dq)
VectorCoefficient * VQ
virtual double ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
void CalcPhysDivShape(ElementTransformation &Trans, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in physical space at the po...
Definition: fe.cpp:61
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
Definition: bilininteg.hpp:283
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:976
ElasticityIntegrator(Coefficient &l, Coefficient &m)
VectorFEMassIntegrator(VectorCoefficient *_vq)
VectorCoefficient * DQ
VectorCoefficient * VQ
Definition: bilininteg.hpp:505
VectorDiffusionIntegrator(Coefficient &q)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
constexpr int HDIV_MAX_D1D
Definition: bilininteg.hpp:27
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:420
const GeometricFactors * geom
Not owned.
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:657
Integrator for (curl u, curl v) for Nedelec elements.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorCurlCurlIntegrator(Coefficient &q)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:693
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
void PADiffusionSetup2D(const int Q1D, const int coeffDim, const int NE, const Array< double > &w, const Vector &j, const Vector &c, Vector &d)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
MixedScalarMassIntegrator(Coefficient &q)
Definition: bilininteg.hpp:617
VectorMassIntegrator(Coefficient &q, const IntegrationRule *ir)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
alpha (q . grad u, v) using the &quot;group&quot; FE discretization
const GeometricFactors * geom
Not owned.
A specialized ElementTransformation class representing a face and its two neighboring elements...
Definition: eltrans.hpp:467
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition: fe.hpp:319
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:789
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
DivDivIntegrator(Coefficient &q)
int Size() const
Returns the size of the vector.
Definition: vector.hpp:160
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:971
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorWeakCurlIntegrator(MatrixCoefficient &mq)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:196
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
Definition: bilininteg.cpp:205
const DofToQuad * maps
Not owned.
BilinearFormIntegrator(const IntegrationRule *ir=NULL)
Definition: bilininteg.hpp:34
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Definition: bilininteg.hpp:278
int Space() const
Returns the type of FunctionSpace on the element.
Definition: fe.hpp:329
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:479
void AddIntegrator(BilinearFormIntegrator *integ)
Definition: bilininteg.hpp:364
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
virtual const char * FiniteElementTypeFailureMessage() const
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Definition: mesh.hpp:1394
MixedVectorCurlIntegrator(VectorCoefficient &dq)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:425
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef)
Virtual method required for Zienkiewicz-Zhu type error estimators.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual double ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
Definition: bilininteg.hpp:239
MixedCrossProductIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:915
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
Definition: bilininteg.cpp:93
MixedScalarVectorIntegrator(VectorCoefficient &vq, bool _transpose=false, bool _cross_2d=false)
Definition: bilininteg.hpp:546
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:167
double * GetData() const
Return a pointer to the beginning of the Vector data.
Definition: vector.hpp:169
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorGradientIntegrator(Coefficient &q)
(Q div u, div v) for RT elements
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:953
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:563
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
MixedScalarCrossGradIntegrator(VectorCoefficient &vq)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
void add(const Vector &v1, const Vector &v2, Vector &v)
Definition: vector.cpp:261
const DofToQuad * maps
Not owned.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:975
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
Definition: fe.cpp:75
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:243
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
const GeometricFactors * geom
Not owned.
MixedCurlCurlIntegrator(MatrixCoefficient &mq)
MatrixCoefficient * MQ
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
VectorFEMassIntegrator(VectorCoefficient &vq)
VectorMassIntegrator()
Construct an integrator with coefficient 1.0.
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add=true)
Method defining element assembly.
Definition: bilininteg.cpp:54
VectorMassIntegrator(VectorCoefficient &q, int qo=0)
Construct an integrator with diagonal coefficient q.
Structure for storing face geometric factors: coordinates, Jacobians, determinants of the Jacobians...
Definition: mesh.hpp:1438
VectorCrossProductInterpolator(VectorCoefficient &vc)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:400
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:590
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Definition: bilininteg.cpp:23
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:411
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:187
MixedGradGradIntegrator(VectorCoefficient &dq)
Integrator that inverts the matrix assembled by another integrator.
Definition: bilininteg.hpp:336
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe.cpp:175
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
VectorCoefficient * DQ
Definition: bilininteg.hpp:506
MatrixCoefficient * MQ
ElasticityIntegrator(Coefficient &m, double q_l, double q_m)
Polynomials of order k.
Definition: fe.hpp:218
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag)
Assemble diagonal of ADA^T (A is this integrator) and add it to diag.
Definition: bilininteg.cpp:81
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:891
VectorInnerProductInterpolator(VectorCoefficient &vc)
MixedWeakDivCrossIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:987
virtual const char * FiniteElementTypeFailureMessage() const
FaceType
Definition: mesh.hpp:45
virtual void AddMultMF(const Vector &, Vector &) const
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
VectorDivergenceIntegrator(Coefficient &q)
CurlCurlIntegrator(VectorCoefficient &dq, const IntegrationRule *ir=NULL)
MixedCrossCurlCurlIntegrator(VectorCoefficient &vq)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
Definition: bilininteg.cpp:212
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
MatrixCoefficient * MQ
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedVectorWeakCurlIntegrator(VectorCoefficient &dq)
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
MixedScalarWeakCurlIntegrator(Coefficient &q)
Definition: bilininteg.hpp:866
MixedCurlCurlIntegrator(Coefficient &q)
DiffusionIntegrator(VectorCoefficient &q)
Construct a diffusion integrator with a vector coefficient q.
GradientIntegrator(Coefficient &q)
double b
Definition: lissajous.cpp:42
virtual double ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:714
virtual void AddMultTransposeMF(const Vector &x, Vector &y) const
Definition: bilininteg.cpp:111
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
Definition: bilininteg.cpp:219
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual const char * FiniteElementTypeFailureMessage() const
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
Definition: bilininteg.hpp:174
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.cpp:960
VectorFEDivergenceIntegrator(Coefficient &q)
constexpr int HCURL_MAX_D1D
Definition: bilininteg.hpp:24
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Definition: nonlininteg.cpp:18
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:990
virtual void AddMultMF(const Vector &x, Vector &y) const
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
VectorFECurlIntegrator(Coefficient &q)
virtual void AssembleElementMatrix2(const FiniteElement &h1_fe, const FiniteElement &nd_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:482
DiffusionIntegrator()
Construct a diffusion integrator with coefficient Q = 1.
MixedVectorMassIntegrator(MatrixCoefficient &mq)
Definition: bilininteg.hpp:906
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
MixedScalarDivergenceIntegrator(Coefficient &q)
Definition: bilininteg.hpp:710
MixedVectorIntegrator(MatrixCoefficient &mq)
Definition: bilininteg.hpp:471
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
Definition: bilininteg.hpp:494
MixedVectorMassIntegrator(Coefficient &q)
Definition: bilininteg.hpp:902
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
Definition: fe.cpp:201
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedDirectionalDerivativeIntegrator(VectorCoefficient &vq)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
MixedCrossGradIntegrator(VectorCoefficient &vq)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:767
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
ScalarProductInterpolator(Coefficient &sc)
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
Definition: bilininteg.cpp:99
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:870
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorCurlIntegrator(MatrixCoefficient &mq)
MixedCurlCurlIntegrator(VectorCoefficient &dq)
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
Definition: bilininteg.cpp:36
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:886
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:722
BoundaryMassIntegrator(Coefficient &q)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &)
Given a particular Finite Element computes the element matrix elmat.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
Definition: bilininteg.cpp:156
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
Definition: bilininteg.cpp:87
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator.
Definition: bilininteg.cpp:671
MixedWeakGradDotIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:950
ScalarVectorProductInterpolator(Coefficient &sc)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:936
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:772
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
Definition: bilininteg.hpp:298
Abstract base class BilinearFormIntegrator.
Definition: bilininteg.hpp:31
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
Definition: bilininteg.hpp:499
const GeometricFactors * geom
Not owned.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorDivergenceIntegrator(Coefficient *_q)
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
MixedVectorIntegrator(Coefficient &q)
Definition: bilininteg.hpp:466
DiffusionIntegrator(MatrixCoefficient &q)
Construct a diffusion integrator with a matrix coefficient q.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:879
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedGradGradIntegrator(MatrixCoefficient &mq)
virtual void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &)
Given a particular Finite Element computes the element matrix elmat.
VectorFEMassIntegrator(MatrixCoefficient &mq)
MixedVectorMassIntegrator(VectorCoefficient &dq)
Definition: bilininteg.hpp:904
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
MixedScalarWeakCurlCrossIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:829
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Definition: coefficient.hpp:39
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
Definition: bilininteg.cpp:123
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:750
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add)
virtual void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
Definition: bilininteg.hpp:539
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
static const IntegrationRule & GetRule(const FiniteElement &el, ElementTransformation &Trans)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
Definition: bilininteg.hpp:288
void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in physical space at the point ...
Definition: fe.cpp:191
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
Base class for Matrix Coefficients that optionally depend on time and space.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
MixedScalarWeakDivergenceIntegrator(VectorCoefficient &vq)
const FaceGeometricFactors * geom
Not owned.
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add)
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:604
DGDiffusionIntegrator(const double s, const double k)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
LumpedIntegrator(BilinearFormIntegrator *_bfi, int _own_bfi=1)
Definition: bilininteg.hpp:325
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe)
Definition: bilininteg.cpp:868
MixedCrossGradCurlIntegrator(VectorCoefficient &vq)
MixedVectorDivergenceIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:746
Structure representing the matrices/tensors needed to evaluate (in reference space) the values...
Definition: fe.hpp:131
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
Definition: bilininteg.cpp:48
A class to initialize the size of a Tensor.
Definition: dtensor.hpp:54
MassIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
Construct a mass integrator with coefficient q.
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
const FiniteElementSpace * fespace
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:408
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
MixedCrossGradGradIntegrator(VectorCoefficient &vq)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:729
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedVectorIntegrator(VectorCoefficient &dq, bool diag=true)
Definition: bilininteg.hpp:468
MixedScalarCrossCurlIntegrator(VectorCoefficient &vq)
MatrixCoefficient * MQ
Definition: bilininteg.hpp:507
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Assemble an element matrix.
double a
Definition: lissajous.cpp:41
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:139
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:797
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:962
virtual const char * FiniteElementTypeFailureMessage() const
VectorMassIntegrator(Coefficient &q, int qo=0)
VectorFEMassIntegrator(Coefficient *_q)
DGElasticityIntegrator(double alpha_, double kappa_)
MixedScalarDerivativeIntegrator(Coefficient &q)
Definition: bilininteg.hpp:637
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorFEMassIntegrator(MatrixCoefficient *_mq)
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true)
Virtual method required for Zienkiewicz-Zhu type error estimators.
Definition: bilininteg.cpp:744
MixedDotProductIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:925
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:804
MixedVectorCurlIntegrator(Coefficient &q)
virtual void AddMultMF(const Vector &, Vector &) const
VectorCoefficient * VQ
const GeometricFactors * geom
Not owned.
This class is used to express the local action of a general nonlinear finite element operator...
Definition: nonlininteg.hpp:26
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
MixedWeakCurlCrossIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:685
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Implements CalcDivShape methods.
Definition: fe.hpp:294
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:923
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
int dim
Definition: ex24.cpp:53
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
const DofToQuad * maps
Not owned.
virtual void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &rt_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AddMultMF(const Vector &x, Vector &y) const
Definition: bilininteg.cpp:105
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:302
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
VectorMassIntegrator(MatrixCoefficient &q, int qo=0)
Construct an integrator with matrix coefficient q.
GradientIntegrator(Coefficient *_q)
MixedScalarWeakCrossProductIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &)
Given a particular Finite Element computes the element matrix elmat.
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:488
GroupConvectionIntegrator(VectorCoefficient &q, double a=1.0)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
Definition: bilininteg.hpp:585
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorGradientIntegrator(VectorCoefficient &dq)
static void AssembleBlock(const int dim, const int row_ndofs, const int col_ndofs, const int row_offset, const int col_offset, const double jmatcoef, const Vector &col_nL, const Vector &col_nM, const Vector &row_shape, const Vector &col_shape, const Vector &col_dshape_dnM, const DenseMatrix &col_dshape, DenseMatrix &elmat, DenseMatrix &jmat)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual ~SumIntegrator()
Definition: bilininteg.cpp:232
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
MixedVectorWeakDivergenceIntegrator(MatrixCoefficient &mq)
const DofToQuad * mapsOtest
Not owned. DOF-to-quad map, open.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssembleElementMatrix2(const FiniteElement &rt_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:650
constexpr int HDIV_MAX_Q1D
Definition: bilininteg.hpp:28
virtual const char * FiniteElementTypeFailureMessage() const
virtual const char * FiniteElementTypeFailureMessage() const
DGDiffusionIntegrator(MatrixCoefficient &q, const double s, const double k)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
const DofToQuad * maps
Not owned.
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:850
bool symmetric
False if using a nonsymmetric matrix coefficient.
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add=true)
Definition: bilininteg.cpp:62
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual double GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun)
Compute element energy: (1/2) (curl u, curl u)_E.
virtual void AssembleFaceGrad(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local action of the gradient of the NonlinearFormIntegrator resulting from a face integr...
Definition: bilininteg.hpp:179
MixedCrossCurlIntegrator(VectorCoefficient &vq)
Vector data type.
Definition: vector.hpp:51
int GetDerivType() const
Returns the FiniteElement::DerivType of the element describing the spatial derivative method implemen...
Definition: fe.hpp:347
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:758
MixedVectorProductIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:627
VectorScalarProductInterpolator(VectorCoefficient &vc)
virtual const char * FiniteElementTypeFailureMessage() const
const DofToQuad * mapsCtest
Not owned. DOF-to-quad map, closed.
ConvectionIntegrator(VectorCoefficient &q, double a=1.0)
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
MixedScalarCurlIntegrator(Coefficient &q)
Definition: bilininteg.hpp:825
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:131
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true)
Virtual method required for Zienkiewicz-Zhu type error estimators.
Definition: bilininteg.hpp:214
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
Definition: bilininteg.cpp:117
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
DerivativeIntegrator(Coefficient &q, int i)
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.cpp:535
Implements CalcDShape methods.
Definition: fe.hpp:293
DGTraceIntegrator(Coefficient &_rho, VectorCoefficient &_u, double a, double b)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:928
virtual const char * FiniteElementTypeFailureMessage() const
MixedGradGradIntegrator(Coefficient &q)
MixedVectorGradientIntegrator(MatrixCoefficient &mq)
CurlCurlIntegrator(MatrixCoefficient &mq, const IntegrationRule *ir=NULL)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat)
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
Definition: fe.hpp:332
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
CurlCurlIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
Construct a bilinear form integrator for Nedelec elements.
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:734
constexpr int HCURL_MAX_Q1D
Definition: bilininteg.hpp:25
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
Definition: bilininteg.hpp:293
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:546
virtual const char * FiniteElementTypeFailureMessage() const
virtual const char * FiniteElementTypeFailureMessage() const
MassIntegrator(const IntegrationRule *ir=NULL)
const GeometricFactors * geom
Not owned.
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:414
virtual double ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
Definition: bilininteg.cpp:802
MixedVectorWeakCurlIntegrator(Coefficient &q)
virtual void AssembleFaceVector(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator resulting from a face integral term...
Definition: bilininteg.cpp:167
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
TransposeIntegrator(BilinearFormIntegrator *_bfi, int _own_bfi=1)
Definition: bilininteg.hpp:258
MixedDivGradIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:641
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:845
MixedScalarIntegrator(Coefficient &q)
Definition: bilininteg.hpp:398
DGElasticityIntegrator(Coefficient &lambda_, Coefficient &mu_, double alpha_, double kappa_)
Class for integrating (Q D_i(u), v); u and v are scalars.
InverseIntegrator(BilinearFormIntegrator *integ, int own_integ=1)
Definition: bilininteg.hpp:343
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
Definition: bilininteg.cpp:42
virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag)
Assemble diagonal of ADA^T (A is this integrator) and add it to diag.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:550
Implements CalcCurlShape methods.
Definition: fe.hpp:295
const DofToQuad * maps
Not owned.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
VectorCoefficient * Q
alpha (q . grad u, v)