MFEM  v4.4.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-2022, 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 
19 namespace mfem
20 {
21 
22 // Local maximum size of dofs and quads in 1D
23 constexpr int HCURL_MAX_D1D = 5;
24 #ifdef MFEM_USE_HIP
25 constexpr int HCURL_MAX_Q1D = 5;
26 #else
27 constexpr int HCURL_MAX_Q1D = 6;
28 #endif
29 
30 constexpr int HDIV_MAX_D1D = 5;
31 constexpr int HDIV_MAX_Q1D = 6;
32 
33 /// Abstract base class BilinearFormIntegrator
35 {
36 protected:
38  : NonlinearFormIntegrator(ir) { }
39 
40 public:
41  // TODO: add support for other assembly levels (in addition to PA) and their
42  // actions.
43 
44  // TODO: for mixed meshes the quadrature rules to be used by methods like
45  // AssemblePA() can be given as a QuadratureSpace, e.g. using a new method:
46  // SetQuadratureSpace().
47 
48  // TODO: the methods for the various assembly levels make sense even in the
49  // base class NonlinearFormIntegrator, except that not all assembly levels
50  // make sense for the action of the nonlinear operator (but they all make
51  // sense for its Jacobian).
52 
54 
55  /// Method defining partial assembly.
56  /** The result of the partial assembly is stored internally so that it can be
57  used later in the methods AddMultPA() and AddMultTransposePA(). */
58  virtual void AssemblePA(const FiniteElementSpace &fes);
59  /** Used with BilinearFormIntegrators that have different spaces. */
60  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
61  const FiniteElementSpace &test_fes);
62 
63  virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
64 
65  virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
66 
67  /// Assemble diagonal and add it to Vector @a diag.
68  virtual void AssembleDiagonalPA(Vector &diag);
69 
70  /// Assemble diagonal of ADA^T (A is this integrator) and add it to @a diag.
71  virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
72 
73  /// Method for partially assembled action.
74  /** Perform the action of integrator on the input @a x and add the result to
75  the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
76  the element-wise discontinuous version of the FE space.
77 
78  This method can be called only after the method AssemblePA() has been
79  called. */
80  virtual void AddMultPA(const Vector &x, Vector &y) const;
81 
82  /// Method for partially assembled transposed action.
83  /** Perform the transpose action of integrator on the input @a x and add the
84  result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
85  represent the element-wise discontinuous version of the FE space.
86 
87  This method can be called only after the method AssemblePA() has been
88  called. */
89  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
90 
91  /// Method defining element assembly.
92  /** The result of the element assembly is added to the @a emat Vector if
93  @a add is true. Otherwise, if @a add is false, we set @a emat. */
94  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
95  const bool add = true);
96  /** Used with BilinearFormIntegrators that have different spaces. */
97  // virtual void AssembleEA(const FiniteElementSpace &trial_fes,
98  // const FiniteElementSpace &test_fes,
99  // Vector &emat);
100 
101  /// Method defining matrix-free assembly.
102  /** The result of fully matrix-free assembly is stored internally so that it
103  can be used later in the methods AddMultMF() and AddMultTransposeMF(). */
104  virtual void AssembleMF(const FiniteElementSpace &fes);
105 
106  /** Perform the action of integrator on the input @a x and add the result to
107  the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
108  the element-wise discontinuous version of the FE space.
109 
110  This method can be called only after the method AssembleMF() has been
111  called. */
112  virtual void AddMultMF(const Vector &x, Vector &y) const;
113 
114  /** Perform the transpose action of integrator on the input @a x and add the
115  result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
116  represent the element-wise discontinuous version of the FE space.
117 
118  This method can be called only after the method AssemblePA() has been
119  called. */
120  virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
121 
122  /// Assemble diagonal and add it to Vector @a diag.
123  virtual void AssembleDiagonalMF(Vector &diag);
124 
125  virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
126  Vector &ea_data_int,
127  Vector &ea_data_ext,
128  const bool add = true);
129 
130  virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
131  Vector &ea_data_bdr,
132  const bool add = true);
133 
134  /// Given a particular Finite Element computes the element matrix elmat.
135  virtual void AssembleElementMatrix(const FiniteElement &el,
137  DenseMatrix &elmat);
138 
139  /** Compute the local matrix representation of a bilinear form
140  a(u,v) defined on different trial (given by u) and test
141  (given by v) spaces. The rows in the local matrix correspond
142  to the test dofs and the columns -- to the trial dofs. */
143  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
144  const FiniteElement &test_fe,
146  DenseMatrix &elmat);
147 
148  virtual void AssembleFaceMatrix(const FiniteElement &el1,
149  const FiniteElement &el2,
151  DenseMatrix &elmat);
152 
153  /** Abstract method used for assembling TraceFaceIntegrators in a
154  MixedBilinearForm. */
155  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
156  const FiniteElement &test_fe1,
157  const FiniteElement &test_fe2,
159  DenseMatrix &elmat);
160 
161  /// @brief Perform the local action of the BilinearFormIntegrator.
162  /// Note that the default implementation in the base class is general but not
163  /// efficient.
164  virtual void AssembleElementVector(const FiniteElement &el,
166  const Vector &elfun, Vector &elvect);
167 
168  /// @brief Perform the local action of the BilinearFormIntegrator resulting
169  /// from a face integral term.
170  /// Note that the default implementation in the base class is general but not
171  /// efficient.
172  virtual void AssembleFaceVector(const FiniteElement &el1,
173  const FiniteElement &el2,
175  const Vector &elfun, Vector &elvect);
176 
177  virtual void AssembleElementGrad(const FiniteElement &el,
179  const Vector &elfun, DenseMatrix &elmat)
180  { AssembleElementMatrix(el, Tr, elmat); }
181 
182  virtual void AssembleFaceGrad(const FiniteElement &el1,
183  const FiniteElement &el2,
185  const Vector &elfun, DenseMatrix &elmat)
186  { AssembleFaceMatrix(el1, el2, Tr, elmat); }
187 
188  /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
189 
190  The purpose of the method is to compute a local "flux" finite element
191  function given a local finite element solution. The "flux" function has
192  to be computed in terms of its coefficients (represented by the Vector
193  @a flux) which multiply the basis functions defined by the FiniteElement
194  @a fluxelem. Typically, the "flux" function will have more than one
195  component and consequently @a flux should be store the coefficients of
196  all components: first all coefficient for component 0, then all
197  coefficients for component 1, etc. What the "flux" function represents
198  depends on the specific integrator. For example, in the case of
199  DiffusionIntegrator, the flux is the gradient of the solution multiplied
200  by the diffusion coefficient.
201 
202  @param[in] el FiniteElement of the solution.
203  @param[in] Trans The ElementTransformation describing the physical
204  position of the mesh element.
205  @param[in] u Solution coefficients representing the expansion of the
206  solution function in the basis of @a el.
207  @param[in] fluxelem FiniteElement of the "flux".
208  @param[out] flux "Flux" coefficients representing the expansion of the
209  "flux" function in the basis of @a fluxelem. The size
210  of @a flux as a Vector has to be set by this method,
211  e.g. using Vector::SetSize().
212  @param[in] with_coef If zero (the default value is 1) the implementation
213  of the method may choose not to scale the "flux"
214  function by any coefficients describing the
215  integrator.
216  */
217  virtual void ComputeElementFlux(const FiniteElement &el,
219  Vector &u,
220  const FiniteElement &fluxelem,
221  Vector &flux, bool with_coef = true) { }
222 
223  /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
224 
225  The purpose of this method is to compute a local number that measures the
226  energy of a given "flux" function (see ComputeElementFlux() for a
227  description of the "flux" function). Typically, the energy of a "flux"
228  function should be equal to a_local(u,u), if the "flux" is defined from
229  a solution u; here a_local(.,.) denotes the element-local bilinear
230  form represented by the integrator.
231 
232  @param[in] fluxelem FiniteElement of the "flux".
233  @param[in] Trans The ElementTransformation describing the physical
234  position of the mesh element.
235  @param[in] flux "Flux" coefficients representing the expansion of the
236  "flux" function in the basis of @a fluxelem.
237  @param[out] d_energy If not NULL, the given Vector should be set to
238  represent directional energy split that can be used
239  for anisotropic error estimation.
240  @returns The computed energy.
241  */
242  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
244  Vector &flux, Vector *d_energy = NULL)
245  { return 0.0; }
246 
248 };
249 
250 /** Wraps a given @a BilinearFormIntegrator and transposes the resulting element
251  matrices. See for example ex9, ex9p. */
253 {
254 private:
255  int own_bfi;
257 
258  DenseMatrix bfi_elmat;
259 
260 public:
261  TransposeIntegrator (BilinearFormIntegrator *bfi_, int own_bfi_ = 1)
262  { bfi = bfi_; own_bfi = own_bfi_; }
263 
264  virtual void SetIntRule(const IntegrationRule *ir);
265 
266  virtual void AssembleElementMatrix(const FiniteElement &el,
268  DenseMatrix &elmat);
269 
270  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
271  const FiniteElement &test_fe,
273  DenseMatrix &elmat);
274 
276  virtual void AssembleFaceMatrix(const FiniteElement &el1,
277  const FiniteElement &el2,
279  DenseMatrix &elmat);
280 
282 
283  virtual void AssemblePA(const FiniteElementSpace& fes)
284  {
285  bfi->AssemblePA(fes);
286  }
287 
289  {
290  bfi->AssemblePAInteriorFaces(fes);
291  }
292 
294  {
295  bfi->AssemblePABoundaryFaces(fes);
296  }
297 
298  virtual void AddMultTransposePA(const Vector &x, Vector &y) const
299  {
300  bfi->AddMultPA(x, y);
301  }
302 
303  virtual void AddMultPA(const Vector& x, Vector& y) const
304  {
305  bfi->AddMultTransposePA(x, y);
306  }
307 
308  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
309  const bool add);
310 
311  virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
312  Vector &ea_data_int,
313  Vector &ea_data_ext,
314  const bool add);
315 
316  virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
317  Vector &ea_data_bdr,
318  const bool add);
319 
320  virtual ~TransposeIntegrator() { if (own_bfi) { delete bfi; } }
321 };
322 
324 {
325 private:
326  int own_bfi;
328 
329 public:
330  LumpedIntegrator (BilinearFormIntegrator *bfi_, int own_bfi_ = 1)
331  { bfi = bfi_; own_bfi = own_bfi_; }
332 
333  virtual void SetIntRule(const IntegrationRule *ir);
334 
335  virtual void AssembleElementMatrix(const FiniteElement &el,
337  DenseMatrix &elmat);
338 
339  virtual ~LumpedIntegrator() { if (own_bfi) { delete bfi; } }
340 };
341 
342 /// Integrator that inverts the matrix assembled by another integrator.
344 {
345 private:
346  int own_integrator;
347  BilinearFormIntegrator *integrator;
348 
349 public:
350  InverseIntegrator(BilinearFormIntegrator *integ, int own_integ = 1)
351  { integrator = integ; own_integrator = own_integ; }
352 
353  virtual void SetIntRule(const IntegrationRule *ir);
354 
355  virtual void AssembleElementMatrix(const FiniteElement &el,
357  DenseMatrix &elmat);
358 
359  virtual ~InverseIntegrator() { if (own_integrator) { delete integrator; } }
360 };
361 
362 /// Integrator defining a sum of multiple Integrators.
364 {
365 private:
366  int own_integrators;
367  mutable DenseMatrix elem_mat;
368  Array<BilinearFormIntegrator*> integrators;
369 
370 public:
371  SumIntegrator(int own_integs = 1) { own_integrators = own_integs; }
372 
373  virtual void SetIntRule(const IntegrationRule *ir);
374 
376  { integrators.Append(integ); }
377 
378  virtual void AssembleElementMatrix(const FiniteElement &el,
380  DenseMatrix &elmat);
381  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
382  const FiniteElement &test_fe,
384  DenseMatrix &elmat);
385 
387  virtual void AssembleFaceMatrix(const FiniteElement &el1,
388  const FiniteElement &el2,
390  DenseMatrix &elmat);
391 
392  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
393  const FiniteElement &test_fe1,
394  const FiniteElement &test_fe2,
396  DenseMatrix &elmat);
397 
399  virtual void AssemblePA(const FiniteElementSpace& fes);
400 
401  virtual void AssembleDiagonalPA(Vector &diag);
402 
403  virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
404 
405  virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
406 
407  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
408 
409  virtual void AddMultPA(const Vector& x, Vector& y) const;
410 
411  virtual void AssembleMF(const FiniteElementSpace &fes);
412 
413  virtual void AddMultMF(const Vector &x, Vector &y) const;
414 
415  virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
416 
417  virtual void AssembleDiagonalMF(Vector &diag);
418 
419  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
420  const bool add);
421 
422  virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
423  Vector &ea_data_int,
424  Vector &ea_data_ext,
425  const bool add);
426 
427  virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
428  Vector &ea_data_bdr,
429  const bool add);
430 
431  virtual ~SumIntegrator();
432 };
433 
434 /** An abstract class for integrating the product of two scalar basis functions
435  with an optional scalar coefficient. */
437 {
438 public:
439 
440  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
441  const FiniteElement &test_fe,
443  DenseMatrix &elmat);
444 
445  /// Support for use in BilinearForm. Can be used only when appropriate.
446  virtual void AssembleElementMatrix(const FiniteElement &fe,
447  ElementTransformation &Trans,
448  DenseMatrix &elmat)
449  { AssembleElementMatrix2(fe, fe, Trans, elmat); }
450 
451 protected:
452  /// This parameter can be set by derived methods to enable single shape
453  /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
454  /// result if given the same FiniteElement. The default is false.
456 
459 
460  inline virtual bool VerifyFiniteElementTypes(
461  const FiniteElement & trial_fe,
462  const FiniteElement & test_fe) const
463  {
464  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
466  }
467 
468  inline virtual const char * FiniteElementTypeFailureMessage() const
469  {
470  return "MixedScalarIntegrator: "
471  "Trial and test spaces must both be scalar fields.";
472  }
473 
474  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
475  const FiniteElement & test_fe,
476  ElementTransformation &Trans)
477  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
478 
479 
480  inline virtual void CalcTestShape(const FiniteElement & test_fe,
481  ElementTransformation &Trans,
482  Vector & shape)
483  { test_fe.CalcPhysShape(Trans, shape); }
484 
485  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
486  ElementTransformation &Trans,
487  Vector & shape)
488  { trial_fe.CalcPhysShape(Trans, shape); }
489 
491 
492 private:
493 
494 #ifndef MFEM_THREAD_SAFE
495  Vector test_shape;
496  Vector trial_shape;
497 #endif
498 
499 };
500 
501 /** An abstract class for integrating the inner product of two vector basis
502  functions with an optional scalar, vector, or matrix coefficient. */
504 {
505 public:
506 
507  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
508  const FiniteElement &test_fe,
510  DenseMatrix &elmat);
511 
512  /// Support for use in BilinearForm. Can be used only when appropriate.
513  virtual void AssembleElementMatrix(const FiniteElement &fe,
514  ElementTransformation &Trans,
515  DenseMatrix &elmat)
516  { AssembleElementMatrix2(fe, fe, Trans, elmat); }
517 
518 protected:
519  /// This parameter can be set by derived methods to enable single shape
520  /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
521  /// result if given the same FiniteElement. The default is false.
523 
525  : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(NULL) {}
527  : same_calc_shape(false), Q(&q), VQ(NULL), DQ(NULL), MQ(NULL) {}
529  : same_calc_shape(false), Q(NULL), VQ(diag?NULL:&vq), DQ(diag?&vq:NULL),
530  MQ(NULL) {}
532  : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(&mq) {}
533 
534  inline virtual bool VerifyFiniteElementTypes(
535  const FiniteElement & trial_fe,
536  const FiniteElement & test_fe) const
537  {
538  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
540  }
541 
542  inline virtual const char * FiniteElementTypeFailureMessage() const
543  {
544  return "MixedVectorIntegrator: "
545  "Trial and test spaces must both be vector fields";
546  }
547 
548  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
549  const FiniteElement & test_fe,
550  ElementTransformation &Trans)
551  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
552 
553 
554  inline virtual int GetTestVDim(const FiniteElement & test_fe)
555  { return std::max(space_dim, test_fe.GetVDim()); }
556 
557  inline virtual void CalcTestShape(const FiniteElement & test_fe,
558  ElementTransformation &Trans,
559  DenseMatrix & shape)
560  { test_fe.CalcVShape(Trans, shape); }
561 
562  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
563  { return std::max(space_dim, trial_fe.GetVDim()); }
564 
565  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
566  ElementTransformation &Trans,
567  DenseMatrix & shape)
568  { trial_fe.CalcVShape(Trans, shape); }
569 
575 
576 private:
577 
578 #ifndef MFEM_THREAD_SAFE
579  Vector V;
580  Vector D;
581  DenseMatrix M;
582  DenseMatrix test_shape;
583  DenseMatrix trial_shape;
584  DenseMatrix shape_tmp;
585 #endif
586 
587 };
588 
589 /** An abstract class for integrating the product of a scalar basis function and
590  the inner product of a vector basis function with a vector coefficient. In
591  2D the inner product can be replaced with a cross product. */
593 {
594 public:
595 
596  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
597  const FiniteElement &test_fe,
599  DenseMatrix &elmat);
600 
601  /// Support for use in BilinearForm. Can be used only when appropriate.
602  /** Appropriate use cases are classes derived from
603  MixedScalarVectorIntegrator where the trial and test spaces can be the
604  same. Examples of such classes are: MixedVectorDivergenceIntegrator,
605  MixedScalarWeakDivergenceIntegrator, etc. */
606  virtual void AssembleElementMatrix(const FiniteElement &fe,
607  ElementTransformation &Trans,
608  DenseMatrix &elmat)
609  { AssembleElementMatrix2(fe, fe, Trans, elmat); }
610 
611 protected:
612 
613  MixedScalarVectorIntegrator(VectorCoefficient &vq, bool transpose_ = false,
614  bool cross_2d_ = false)
615  : VQ(&vq), transpose(transpose_), cross_2d(cross_2d_) {}
616 
617  inline virtual bool VerifyFiniteElementTypes(
618  const FiniteElement & trial_fe,
619  const FiniteElement & test_fe) const
620  {
621  return ((transpose &&
623  test_fe.GetRangeType() == mfem::FiniteElement::SCALAR ) ||
624  (!transpose &&
627  );
628  }
629 
630  inline virtual const char * FiniteElementTypeFailureMessage() const
631  {
632  if ( transpose )
633  {
634  return "MixedScalarVectorIntegrator: "
635  "Trial space must be a vector field "
636  "and the test space must be a scalar field";
637  }
638  else
639  {
640  return "MixedScalarVectorIntegrator: "
641  "Trial space must be a scalar field "
642  "and the test space must be a vector field";
643  }
644  }
645 
646  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
647  const FiniteElement & test_fe,
648  ElementTransformation &Trans)
649  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
650 
651 
652  inline virtual int GetVDim(const FiniteElement & vector_fe)
653  { return std::max(space_dim, vector_fe.GetVDim()); }
654 
655  inline virtual void CalcVShape(const FiniteElement & vector_fe,
656  ElementTransformation &Trans,
657  DenseMatrix & shape_)
658  { vector_fe.CalcVShape(Trans, shape_); }
659 
660  inline virtual void CalcShape(const FiniteElement & scalar_fe,
661  ElementTransformation &Trans,
662  Vector & shape_)
663  { scalar_fe.CalcPhysShape(Trans, shape_); }
664 
667  bool transpose;
668  bool cross_2d; // In 2D use a cross product rather than a dot product
669 
670 private:
671 
672 #ifndef MFEM_THREAD_SAFE
673  Vector V;
674  DenseMatrix vshape;
675  Vector shape;
676  Vector vshape_tmp;
677 #endif
678 
679 };
680 
681 /** Class for integrating the bilinear form a(u,v) := (Q u, v) in either 1D, 2D,
682  or 3D and where Q is an optional scalar coefficient, u and v are each in H1
683  or L2. */
685 {
686 public:
689  : MixedScalarIntegrator(q) { same_calc_shape = true; }
690 };
691 
692 /** Class for integrating the bilinear form a(u,v) := (Q u, v) in either 2D, or
693  3D and where Q is a vector coefficient, u is in H1 or L2 and v is in H(Curl)
694  or H(Div). */
696 {
697 public:
700 };
701 
702 /** Class for integrating the bilinear form a(u,v) := (Q D u, v) in 1D where Q
703  is an optional scalar coefficient, u is in H1, and v is in L2. */
705 {
706 public:
709  : MixedScalarIntegrator(q) {}
710 
711 protected:
712  inline virtual bool VerifyFiniteElementTypes(
713  const FiniteElement & trial_fe,
714  const FiniteElement & test_fe) const
715  {
716  return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
717  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
719  }
720 
721  inline virtual const char * FiniteElementTypeFailureMessage() const
722  {
723  return "MixedScalarDerivativeIntegrator: "
724  "Trial and test spaces must both be scalar fields in 1D "
725  "and the trial space must implement CalcDShape.";
726  }
727 
728  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
730  Vector & shape)
731  {
732  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
733  trial_fe.CalcPhysDShape(Trans, dshape);
734  }
735 };
736 
737 /** Class for integrating the bilinear form a(u,v) := -(Q u, D v) in 1D where Q
738  is an optional scalar coefficient, u is in L2, and v is in H1. */
740 {
741 public:
744  : MixedScalarIntegrator(q) {}
745 
746 protected:
747  inline virtual bool VerifyFiniteElementTypes(
748  const FiniteElement & trial_fe,
749  const FiniteElement & test_fe) const
750  {
751  return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
754  }
755 
756  inline virtual const char * FiniteElementTypeFailureMessage() const
757  {
758  return "MixedScalarWeakDerivativeIntegrator: "
759  "Trial and test spaces must both be scalar fields in 1D "
760  "and the test space must implement CalcDShape with "
761  "map type \"VALUE\".";
762  }
763 
764  inline virtual void CalcTestShape(const FiniteElement & test_fe,
766  Vector & shape)
767  {
768  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
769  test_fe.CalcPhysDShape(Trans, dshape);
770  shape *= -1.0;
771  }
772 };
773 
774 /** Class for integrating the bilinear form a(u,v) := (Q div u, v) in either 2D
775  or 3D where Q is an optional scalar coefficient, u is in H(Div), and v is a
776  scalar field. */
778 {
779 public:
782  : MixedScalarIntegrator(q) {}
783 
784 protected:
785  inline virtual bool VerifyFiniteElementTypes(
786  const FiniteElement & trial_fe,
787  const FiniteElement & test_fe) const
788  {
789  return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
791  }
792 
793  inline virtual const char * FiniteElementTypeFailureMessage() const
794  {
795  return "MixedScalarDivergenceIntegrator: "
796  "Trial must be H(Div) and the test space must be a "
797  "scalar field";
798  }
799 
800  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
801  const FiniteElement & test_fe,
803  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
804 
805  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
807  Vector & shape)
808  { trial_fe.CalcPhysDivShape(Trans, shape); }
809 };
810 
811 /** Class for integrating the bilinear form a(u,v) := (V div u, v) in either 2D
812  or 3D where V is a vector coefficient, u is in H(Div), and v is a vector
813  field. */
815 {
816 public:
819 
820 protected:
821  inline virtual bool VerifyFiniteElementTypes(
822  const FiniteElement & trial_fe,
823  const FiniteElement & test_fe) const
824  {
825  return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
827  }
828 
829  inline virtual const char * FiniteElementTypeFailureMessage() const
830  {
831  return "MixedVectorDivergenceIntegrator: "
832  "Trial must be H(Div) and the test space must be a "
833  "vector field";
834  }
835 
836  // Subtract one due to the divergence and add one for the coefficient
837  // which is assumed to be at least linear.
838  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
839  const FiniteElement & test_fe,
841  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
842 
843  inline virtual void CalcShape(const FiniteElement & scalar_fe,
845  Vector & shape)
846  { scalar_fe.CalcPhysDivShape(Trans, shape); }
847 };
848 
849 /** Class for integrating the bilinear form a(u,v) := -(Q u, div v) in either 2D
850  or 3D where Q is an optional scalar coefficient, u is in L2 or H1, and v is
851  in H(Div). */
853 {
854 public:
857  : MixedScalarIntegrator(q) {}
858 
859 protected:
860  inline virtual bool VerifyFiniteElementTypes(
861  const FiniteElement & trial_fe,
862  const FiniteElement & test_fe) const
863  {
864  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
865  test_fe.GetDerivType() == mfem::FiniteElement::DIV );
866  }
867 
868  inline virtual const char * FiniteElementTypeFailureMessage() const
869  {
870  return "MixedScalarWeakGradientIntegrator: "
871  "Trial space must be a scalar field "
872  "and the test space must be H(Div)";
873  }
874 
875  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
876  const FiniteElement & test_fe,
878  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
879 
880  virtual void CalcTestShape(const FiniteElement & test_fe,
882  Vector & shape)
883  {
884  test_fe.CalcPhysDivShape(Trans, shape);
885  shape *= -1.0;
886  }
887 };
888 
889 /** Class for integrating the bilinear form a(u,v) := (Q curl u, v) in 2D where
890  Q is an optional scalar coefficient, u is in H(Curl), and v is in L2 or
891  H1. */
893 {
894 public:
897  : MixedScalarIntegrator(q) {}
898 
899 protected:
900  inline virtual bool VerifyFiniteElementTypes(
901  const FiniteElement & trial_fe,
902  const FiniteElement & test_fe) const
903  {
904  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
905  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
907  }
908 
909  inline virtual const char * FiniteElementTypeFailureMessage() const
910  {
911  return "MixedScalarCurlIntegrator: "
912  "Trial must be H(Curl) and the test space must be a "
913  "scalar field";
914  }
915 
916  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
917  const FiniteElement & test_fe,
919  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
920 
921  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
923  Vector & shape)
924  {
925  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
926  trial_fe.CalcPhysCurlShape(Trans, dshape);
927  }
928 
930  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
931  const FiniteElementSpace &test_fes);
932 
933  virtual void AddMultPA(const Vector&, Vector&) const;
934  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
935 
936  // PA extension
938  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
939  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
941 };
942 
943 /** Class for integrating the bilinear form a(u,v) := (Q u, curl v) in 2D where
944  Q is an optional scalar coefficient, u is in L2 or H1, and v is in
945  H(Curl). Partial assembly (PA) is supported but could be further optimized
946  by using more efficient threading and shared memory.
947 */
949 {
950 public:
953  : MixedScalarIntegrator(q) {}
954 
955 protected:
956  inline virtual bool VerifyFiniteElementTypes(
957  const FiniteElement & trial_fe,
958  const FiniteElement & test_fe) const
959  {
960  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
963  }
964 
965  inline virtual const char * FiniteElementTypeFailureMessage() const
966  {
967  return "MixedScalarWeakCurlIntegrator: "
968  "Trial space must be a scalar field "
969  "and the test space must be H(Curl)";
970  }
971 
972  inline virtual void CalcTestShape(const FiniteElement & test_fe,
974  Vector & shape)
975  {
976  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
977  test_fe.CalcPhysCurlShape(Trans, dshape);
978  }
979 };
980 
981 /** Class for integrating the bilinear form a(u,v) := (Q u, v) in either 2D or
982  3D and where Q is an optional coefficient (of type scalar, matrix, or
983  diagonal matrix) u and v are each in H(Curl) or H(Div). */
985 {
986 public:
989  : MixedVectorIntegrator(q) { same_calc_shape = true; }
991  : MixedVectorIntegrator(dq, true) { same_calc_shape = true; }
993  : MixedVectorIntegrator(mq) { same_calc_shape = true; }
994 };
995 
996 /** Class for integrating the bilinear form a(u,v) := (V x u, v) in 3D and where
997  V is a vector coefficient u and v are each in H(Curl) or H(Div). */
999 {
1000 public:
1002  : MixedVectorIntegrator(vq, false) { same_calc_shape = true; }
1003 };
1004 
1005 /** Class for integrating the bilinear form a(u,v) := (V . u, v) in 2D or 3D and
1006  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in H1 or
1007  L2. */
1009 {
1010 public:
1012  : MixedScalarVectorIntegrator(vq, true) {}
1013 
1014  inline virtual bool VerifyFiniteElementTypes(
1015  const FiniteElement & trial_fe,
1016  const FiniteElement & test_fe) const
1017  {
1018  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1020  }
1021 
1022  inline virtual const char * FiniteElementTypeFailureMessage() const
1023  {
1024  return "MixedDotProductIntegrator: "
1025  "Trial space must be a vector field "
1026  "and the test space must be a scalar field";
1027  }
1028 };
1029 
1030 /** Class for integrating the bilinear form a(u,v) := (-V . u, Div v) in 2D or
1031  3D and where V is a vector coefficient u is in H(Curl) or H(Div) and v is in
1032  RT. */
1034 {
1035 public:
1037  : MixedScalarVectorIntegrator(vq, true) {}
1038 
1039  inline virtual bool VerifyFiniteElementTypes(
1040  const FiniteElement & trial_fe,
1041  const FiniteElement & test_fe) const
1042  {
1043  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1045  test_fe.GetDerivType() == mfem::FiniteElement::DIV );
1046  }
1047 
1048  inline virtual const char * FiniteElementTypeFailureMessage() const
1049  {
1050  return "MixedWeakGradDotIntegrator: "
1051  "Trial space must be a vector field "
1052  "and the test space must be a vector field with a divergence";
1053  }
1054 
1055  // Subtract one due to the gradient and add one for the coefficient
1056  // which is assumed to be at least linear.
1057  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1058  const FiniteElement & test_fe,
1060  { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
1061 
1062  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1064  Vector & shape)
1065  { scalar_fe.CalcPhysDivShape(Trans, shape); shape *= -1.0; }
1066 };
1067 
1068 /** Class for integrating the bilinear form a(u,v) := (V x u, Grad v) in 3D and
1069  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in H1. */
1071 {
1072 public:
1074  : MixedVectorIntegrator(vq, false) {}
1075 
1076  inline virtual bool VerifyFiniteElementTypes(
1077  const FiniteElement & trial_fe,
1078  const FiniteElement & test_fe) const
1079  {
1080  return (trial_fe.GetVDim() == 3 &&
1081  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1083  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1084  }
1085 
1086  inline virtual const char * FiniteElementTypeFailureMessage() const
1087  {
1088  return "MixedWeakDivCrossIntegrator: "
1089  "Trial space must be a vector field in 3D "
1090  "and the test space must be a scalar field with a gradient";
1091  }
1092 
1093  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1094  { return space_dim; }
1095 
1096  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1098  DenseMatrix & shape)
1099  { test_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1100 };
1101 
1102 /** Class for integrating the bilinear form a(u,v) := (Q Grad u, Grad v) in 3D
1103  or in 2D and where Q is a scalar or matrix coefficient u and v are both in
1104  H1. */
1106 {
1107 public:
1110  : MixedVectorIntegrator(q) { same_calc_shape = true; }
1112  : MixedVectorIntegrator(dq, true) { same_calc_shape = true; }
1114  : MixedVectorIntegrator(mq) { same_calc_shape = true; }
1115 
1116  inline virtual bool VerifyFiniteElementTypes(
1117  const FiniteElement & trial_fe,
1118  const FiniteElement & test_fe) const
1119  {
1120  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1121  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1123  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1124  }
1125 
1126  inline virtual const char * FiniteElementTypeFailureMessage() const
1127  {
1128  return "MixedGradGradIntegrator: "
1129  "Trial and test spaces must both be scalar fields "
1130  "with a gradient operator.";
1131  }
1132 
1133  inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1134  const FiniteElement & test_fe,
1136  {
1137  // Same as DiffusionIntegrator
1138  return test_fe.Space() == FunctionSpace::Pk ?
1139  trial_fe.GetOrder() + test_fe.GetOrder() - 2 :
1140  trial_fe.GetOrder() + test_fe.GetOrder() + test_fe.GetDim() - 1;
1141  }
1142 
1143  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1144  { return space_dim; }
1145 
1146  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1148  DenseMatrix & shape)
1149  { trial_fe.CalcPhysDShape(Trans, shape); }
1150 
1151  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1152  { return space_dim; }
1153 
1154  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1156  DenseMatrix & shape)
1157  { test_fe.CalcPhysDShape(Trans, shape); }
1158 };
1159 
1160 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, Grad v) in 3D
1161  or in 2D and where V is a vector coefficient u and v are both in H1. */
1163 {
1164 public:
1166  : MixedVectorIntegrator(vq, false) { same_calc_shape = true; }
1167 
1168  inline virtual bool VerifyFiniteElementTypes(
1169  const FiniteElement & trial_fe,
1170  const FiniteElement & test_fe) const
1171  {
1172  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1173  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1175  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1176  }
1177 
1178  inline virtual const char * FiniteElementTypeFailureMessage() const
1179  {
1180  return "MixedCrossGradGradIntegrator: "
1181  "Trial and test spaces must both be scalar fields "
1182  "with a gradient operator.";
1183  }
1184 
1185  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1186  { return space_dim; }
1187 
1188  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1190  DenseMatrix & shape)
1191  { trial_fe.CalcPhysDShape(Trans, shape); }
1192 
1193  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1194  { return space_dim; }
1195 
1196  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1198  DenseMatrix & shape)
1199  { test_fe.CalcPhysDShape(Trans, shape); }
1200 };
1201 
1202 /** Class for integrating the bilinear form a(u,v) := (Q Curl u, Curl v) in 3D
1203  and where Q is a scalar or matrix coefficient u and v are both in
1204  H(Curl). */
1206 {
1207 public:
1210  : MixedVectorIntegrator(q) { same_calc_shape = true; }
1212  : MixedVectorIntegrator(dq, true) { same_calc_shape = true; }
1214  : MixedVectorIntegrator(mq) { same_calc_shape = true; }
1215 
1216  inline virtual bool VerifyFiniteElementTypes(
1217  const FiniteElement & trial_fe,
1218  const FiniteElement & test_fe) const
1219  {
1220  return (trial_fe.GetCurlDim() == 3 && test_fe.GetCurlDim() == 3 &&
1221  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1222  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1224  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1225  }
1226 
1227  inline virtual const char * FiniteElementTypeFailureMessage() const
1228  {
1229  return "MixedCurlCurlIntegrator"
1230  "Trial and test spaces must both be vector fields in 3D "
1231  "with a curl.";
1232  }
1233 
1234  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1235  { return trial_fe.GetCurlDim(); }
1236 
1237  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1239  DenseMatrix & shape)
1240  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1241 
1242  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1243  { return test_fe.GetCurlDim(); }
1244 
1245  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1247  DenseMatrix & shape)
1248  { test_fe.CalcPhysCurlShape(Trans, shape); }
1249 };
1250 
1251 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, Curl v) in 3D
1252  and where V is a vector coefficient u and v are both in H(Curl). */
1254 {
1255 public:
1257  : MixedVectorIntegrator(vq, false) { same_calc_shape = true; }
1258 
1259  inline virtual bool VerifyFiniteElementTypes(
1260  const FiniteElement & trial_fe,
1261  const FiniteElement & test_fe) const
1262  {
1263  return (trial_fe.GetCurlDim() == 3 && trial_fe.GetVDim() == 3 &&
1264  test_fe.GetCurlDim() == 3 && test_fe.GetVDim() == 3 &&
1265  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1266  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1268  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1269  }
1270 
1271  inline virtual const char * FiniteElementTypeFailureMessage() const
1272  {
1273  return "MixedCrossCurlCurlIntegrator: "
1274  "Trial and test spaces must both be vector fields in 3D "
1275  "with a curl.";
1276  }
1277 
1278  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1279  { return trial_fe.GetCurlDim(); }
1280 
1281  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1283  DenseMatrix & shape)
1284  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1285 
1286  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1287  { return test_fe.GetCurlDim(); }
1288 
1289  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1291  DenseMatrix & shape)
1292  { test_fe.CalcPhysCurlShape(Trans, shape); }
1293 };
1294 
1295 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, Grad v) in 3D
1296  and where V is a vector coefficient u is in H(Curl) and v is in H1. */
1298 {
1299 public:
1301  : MixedVectorIntegrator(vq, false) {}
1302 
1303  inline virtual bool VerifyFiniteElementTypes(
1304  const FiniteElement & trial_fe,
1305  const FiniteElement & test_fe) const
1306  {
1307  return (trial_fe.GetCurlDim() == 3 &&
1308  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1309  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1311  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1312  }
1313 
1314  inline virtual const char * FiniteElementTypeFailureMessage() const
1315  {
1316  return "MixedCrossCurlGradIntegrator"
1317  "Trial space must be a vector field in 3D with a curl"
1318  "and the test space must be a scalar field with a gradient";
1319  }
1320 
1321  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1322  { return trial_fe.GetCurlDim(); }
1323 
1324  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1326  DenseMatrix & shape)
1327  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1328 
1329  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1330  { return space_dim; }
1331 
1332  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1334  DenseMatrix & shape)
1335  { test_fe.CalcPhysDShape(Trans, shape); }
1336 };
1337 
1338 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, Curl v) in 3D
1339  and where V is a scalar coefficient u is in H1 and v is in H(Curl). */
1341 {
1342 public:
1344  : MixedVectorIntegrator(vq, false) {}
1345 
1346  inline virtual bool VerifyFiniteElementTypes(
1347  const FiniteElement & trial_fe,
1348  const FiniteElement & test_fe) const
1349  {
1350  return (test_fe.GetCurlDim() == 3 &&
1351  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1352  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1354  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1355  }
1356 
1357  inline virtual const char * FiniteElementTypeFailureMessage() const
1358  {
1359  return "MixedCrossGradCurlIntegrator"
1360  "Trial space must be a scalar field in 3D with a gradient"
1361  "and the test space must be a vector field with a curl";
1362  }
1363 
1364  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1365  { return space_dim; }
1366 
1367  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1369  DenseMatrix & shape)
1370  { trial_fe.CalcPhysDShape(Trans, shape); }
1371 
1372  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1373  { return test_fe.GetCurlDim(); }
1374 
1375  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1377  DenseMatrix & shape)
1378  { test_fe.CalcPhysCurlShape(Trans, shape); }
1379 };
1380 
1381 /** Class for integrating the bilinear form a(u,v) := (V x u, Curl v) in 3D and
1382  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in
1383  H(Curl). */
1385 {
1386 public:
1388  : MixedVectorIntegrator(vq, false) {}
1389 
1390  inline virtual bool VerifyFiniteElementTypes(
1391  const FiniteElement & trial_fe,
1392  const FiniteElement & test_fe) const
1393  {
1394  return (trial_fe.GetVDim() == 3 && test_fe.GetCurlDim() == 3 &&
1395  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1397  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1398  }
1399 
1400  inline virtual const char * FiniteElementTypeFailureMessage() const
1401  {
1402  return "MixedWeakCurlCrossIntegrator: "
1403  "Trial space must be a vector field in 3D "
1404  "and the test space must be a vector field with a curl";
1405  }
1406 
1407  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1408  { return test_fe.GetCurlDim(); }
1409 
1410  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1412  DenseMatrix & shape)
1413  { test_fe.CalcPhysCurlShape(Trans, shape); }
1414 };
1415 
1416 /** Class for integrating the bilinear form a(u,v) := (V x u, Curl v) in 2D and
1417  where V is a vector coefficient u is in H(Curl) or H(Div) and v is in
1418  H(Curl). */
1420 {
1421 public:
1423  : MixedScalarVectorIntegrator(vq, true, true) {}
1424 
1425  inline virtual bool VerifyFiniteElementTypes(
1426  const FiniteElement & trial_fe,
1427  const FiniteElement & test_fe) const
1428  {
1429  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1430  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1432  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1433  }
1434 
1435  inline virtual const char * FiniteElementTypeFailureMessage() const
1436  {
1437  return "MixedScalarWeakCurlCrossIntegrator: "
1438  "Trial space must be a vector field in 2D "
1439  "and the test space must be a vector field with a curl";
1440  }
1441 
1442  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1444  Vector & shape)
1445  {
1446  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1447  scalar_fe.CalcPhysCurlShape(Trans, dshape);
1448  }
1449 };
1450 
1451 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, v) in 3D or
1452  in 2D and where V is a vector coefficient u is in H1 and v is in H(Curl) or
1453  H(Div). */
1455 {
1456 public:
1458  : MixedVectorIntegrator(vq, false) {}
1459 
1460  inline virtual bool VerifyFiniteElementTypes(
1461  const FiniteElement & trial_fe,
1462  const FiniteElement & test_fe) const
1463  {
1464  return (test_fe.GetVDim() == 3 &&
1465  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1466  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1468  }
1469 
1470  inline virtual const char * FiniteElementTypeFailureMessage() const
1471  {
1472  return "MixedCrossGradIntegrator: "
1473  "Trial space must be a scalar field with a gradient operator"
1474  " and the test space must be a vector field both in 3D.";
1475  }
1476 
1477  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1478  { return space_dim; }
1479 
1480  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1482  DenseMatrix & shape)
1483  { trial_fe.CalcPhysDShape(Trans, shape); }
1484 
1485  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1487  DenseMatrix & shape)
1488  { test_fe.CalcVShape(Trans, shape); }
1489 };
1490 
1491 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, v) in 3D and
1492  where V is a vector coefficient u is in H(Curl) and v is in H(Curl) or
1493  H(Div). */
1495 {
1496 public:
1498  : MixedVectorIntegrator(vq, false) {}
1499 
1500  inline virtual bool VerifyFiniteElementTypes(
1501  const FiniteElement & trial_fe,
1502  const FiniteElement & test_fe) const
1503  {
1504  return (trial_fe.GetCurlDim() == 3 && test_fe.GetVDim() == 3 &&
1505  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1506  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1508  }
1509 
1510  inline virtual const char * FiniteElementTypeFailureMessage() const
1511  {
1512  return "MixedCrossCurlIntegrator: "
1513  "Trial space must be a vector field in 3D with a curl "
1514  "and the test space must be a vector field";
1515  }
1516 
1517  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1518  { return trial_fe.GetCurlDim(); }
1519 
1520  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1522  DenseMatrix & shape)
1523  { trial_fe.CalcPhysCurlShape(Trans, shape); }
1524 };
1525 
1526 /** Class for integrating the bilinear form a(u,v) := (V x Curl u, v) in 2D and
1527  where V is a vector coefficient u is in H(Curl) and v is in H(Curl) or
1528  H(Div). */
1530 {
1531 public:
1533  : MixedScalarVectorIntegrator(vq, false, true) {}
1534 
1535  inline virtual bool VerifyFiniteElementTypes(
1536  const FiniteElement & trial_fe,
1537  const FiniteElement & test_fe) const
1538  {
1539  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1540  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1541  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1543  }
1544 
1545  inline virtual const char * FiniteElementTypeFailureMessage() const
1546  {
1547  return "MixedCrossCurlIntegrator: "
1548  "Trial space must be a vector field in 2D with a curl "
1549  "and the test space must be a vector field";
1550  }
1551 
1552  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1554  Vector & shape)
1555  {
1556  DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1557  scalar_fe.CalcPhysCurlShape(Trans, dshape); shape *= -1.0;
1558  }
1559 };
1560 
1561 /** Class for integrating the bilinear form a(u,v) := (V x Grad u, v) in 2D and
1562  where V is a vector coefficient u is in H1 and v is in H1 or L2. */
1564 {
1565 public:
1567  : MixedScalarVectorIntegrator(vq, true, true) {}
1568 
1569  inline virtual bool VerifyFiniteElementTypes(
1570  const FiniteElement & trial_fe,
1571  const FiniteElement & test_fe) const
1572  {
1573  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1574  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1575  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1577  }
1578 
1579  inline virtual const char * FiniteElementTypeFailureMessage() const
1580  {
1581  return "MixedScalarCrossGradIntegrator: "
1582  "Trial space must be a scalar field in 2D with a gradient "
1583  "and the test space must be a scalar field";
1584  }
1585 
1586  inline int GetVDim(const FiniteElement & vector_fe)
1587  { return space_dim; }
1588 
1589  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1591  DenseMatrix & shape)
1592  { vector_fe.CalcPhysDShape(Trans, shape); }
1593 };
1594 
1595 /** Class for integrating the bilinear form a(u,v) := (V x u, v) in 2D and where
1596  V is a vector coefficient u is in ND or RT and v is in H1 or L2. */
1598 {
1599 public:
1601  : MixedScalarVectorIntegrator(vq, true, true) {}
1602 
1603  inline virtual bool VerifyFiniteElementTypes(
1604  const FiniteElement & trial_fe,
1605  const FiniteElement & test_fe) const
1606  {
1607  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1608  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1610  }
1611 
1612  inline virtual const char * FiniteElementTypeFailureMessage() const
1613  {
1614  return "MixedScalarCrossProductIntegrator: "
1615  "Trial space must be a vector field in 2D "
1616  "and the test space must be a scalar field";
1617  }
1618 };
1619 
1620 /** Class for integrating the bilinear form a(u,v) := (V x z u, v) in 2D and
1621  where V is a vector coefficient u is in H1 or L2 and v is in ND or RT. */
1623 {
1624 public:
1626  : MixedScalarVectorIntegrator(vq, false, true) {}
1627 
1628  inline virtual bool VerifyFiniteElementTypes(
1629  const FiniteElement & trial_fe,
1630  const FiniteElement & test_fe) const
1631  {
1632  return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1633  trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1635  }
1636 
1637  inline virtual const char * FiniteElementTypeFailureMessage() const
1638  {
1639  return "MixedScalarWeakCrossProductIntegrator: "
1640  "Trial space must be a scalar field in 2D "
1641  "and the test space must be a vector field";
1642  }
1643 
1644  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1646  Vector & shape)
1647  { scalar_fe.CalcPhysShape(Trans, shape); shape *= -1.0; }
1648 };
1649 
1650 /** Class for integrating the bilinear form a(u,v) := (V . Grad u, v) in 2D or
1651  3D and where V is a vector coefficient, u is in H1 and v is in H1 or L2. */
1653 {
1654 public:
1656  : MixedScalarVectorIntegrator(vq, true) {}
1657 
1658  inline virtual bool VerifyFiniteElementTypes(
1659  const FiniteElement & trial_fe,
1660  const FiniteElement & test_fe) const
1661  {
1662  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1663  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1665  }
1666 
1667  inline virtual const char * FiniteElementTypeFailureMessage() const
1668  {
1669  return "MixedDirectionalDerivativeIntegrator: "
1670  "Trial space must be a scalar field with a gradient "
1671  "and the test space must be a scalar field";
1672  }
1673 
1674  inline virtual int GetVDim(const FiniteElement & vector_fe)
1675  { return space_dim; }
1676 
1677  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1679  DenseMatrix & shape)
1680  { vector_fe.CalcPhysDShape(Trans, shape); }
1681 };
1682 
1683 /** Class for integrating the bilinear form a(u,v) := (-V . Grad u, Div v) in 2D
1684  or 3D and where V is a vector coefficient, u is in H1 and v is in RT. */
1686 {
1687 public:
1689  : MixedScalarVectorIntegrator(vq, true) {}
1690 
1691  inline virtual bool VerifyFiniteElementTypes(
1692  const FiniteElement & trial_fe,
1693  const FiniteElement & test_fe) const
1694  {
1695  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1696  trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1698  test_fe.GetDerivType() == mfem::FiniteElement::DIV );
1699  }
1700 
1701  inline virtual const char * FiniteElementTypeFailureMessage() const
1702  {
1703  return "MixedGradDivIntegrator: "
1704  "Trial space must be a scalar field with a gradient"
1705  "and the test space must be a vector field with a divergence";
1706  }
1707 
1708  inline virtual int GetVDim(const FiniteElement & vector_fe)
1709  { return space_dim; }
1710 
1711  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1713  DenseMatrix & shape)
1714  { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1715 
1716  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1718  Vector & shape)
1719  { scalar_fe.CalcPhysDivShape(Trans, shape); }
1720 };
1721 
1722 /** Class for integrating the bilinear form a(u,v) := (-V Div u, Grad v) in 2D
1723  or 3D and where V is a vector coefficient, u is in RT and v is in H1. */
1725 {
1726 public:
1728  : MixedScalarVectorIntegrator(vq, false) {}
1729 
1730  inline virtual bool VerifyFiniteElementTypes(
1731  const FiniteElement & trial_fe,
1732  const FiniteElement & test_fe) const
1733  {
1734  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1735  trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
1738  );
1739  }
1740 
1741  inline virtual const char * FiniteElementTypeFailureMessage() const
1742  {
1743  return "MixedDivGradIntegrator: "
1744  "Trial space must be a vector field with a divergence"
1745  "and the test space must be a scalar field with a gradient";
1746  }
1747 
1748  inline virtual int GetVDim(const FiniteElement & vector_fe)
1749  { return space_dim; }
1750 
1751  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1753  DenseMatrix & shape)
1754  { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1755 
1756  inline virtual void CalcShape(const FiniteElement & scalar_fe,
1758  Vector & shape)
1759  { scalar_fe.CalcPhysDivShape(Trans, shape); }
1760 };
1761 
1762 /** Class for integrating the bilinear form a(u,v) := (-V u, Grad v) in 2D or 3D
1763  and where V is a vector coefficient, u is in H1 or L2 and v is in H1. */
1765 {
1766 public:
1768  : MixedScalarVectorIntegrator(vq, false) {}
1769 
1770  inline virtual bool VerifyFiniteElementTypes(
1771  const FiniteElement & trial_fe,
1772  const FiniteElement & test_fe) const
1773  {
1774  return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1776  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1777  }
1778 
1779  inline virtual const char * FiniteElementTypeFailureMessage() const
1780  {
1781  return "MixedScalarWeakDivergenceIntegrator: "
1782  "Trial space must be a scalar field "
1783  "and the test space must be a scalar field with a gradient";
1784  }
1785 
1786  inline int GetVDim(const FiniteElement & vector_fe)
1787  { return space_dim; }
1788 
1789  inline virtual void CalcVShape(const FiniteElement & vector_fe,
1791  DenseMatrix & shape)
1792  { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1793 };
1794 
1795 /** Class for integrating the bilinear form a(u,v) := (Q grad u, v) in either 2D
1796  or 3D and where Q is an optional coefficient (of type scalar, matrix, or
1797  diagonal matrix) u is in H1 and v is in H(Curl) or H(Div). Partial assembly
1798  (PA) is supported but could be further optimized by using more efficient
1799  threading and shared memory.
1800 */
1802 {
1803 public:
1806  : MixedVectorIntegrator(q) {}
1808  : MixedVectorIntegrator(dq, true) {}
1810  : MixedVectorIntegrator(mq) {}
1811 
1812 protected:
1813  inline virtual bool VerifyFiniteElementTypes(
1814  const FiniteElement & trial_fe,
1815  const FiniteElement & test_fe) const
1816  {
1817  return (trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1819  }
1820 
1821  inline virtual const char * FiniteElementTypeFailureMessage() const
1822  {
1823  return "MixedVectorGradientIntegrator: "
1824  "Trial spaces must be H1 and the test space must be a "
1825  "vector field in 2D or 3D";
1826  }
1827 
1828  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1829  { return space_dim; }
1830 
1831  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1833  DenseMatrix & shape)
1834  {
1835  trial_fe.CalcPhysDShape(Trans, shape);
1836  }
1837 
1839  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1840  const FiniteElementSpace &test_fes);
1841 
1842  virtual void AddMultPA(const Vector&, Vector&) const;
1843  virtual void AddMultTransposePA(const Vector&, Vector&) const;
1844 
1845 private:
1846  DenseMatrix Jinv;
1847 
1848  // PA extension
1849  Vector pa_data;
1850  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1851  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1852  const GeometricFactors *geom; ///< Not owned
1853  int dim, ne, dofs1D, quad1D;
1854 };
1855 
1856 /** Class for integrating the bilinear form a(u,v) := (Q curl u, v) in 3D and
1857  where Q is an optional coefficient (of type scalar, matrix, or diagonal
1858  matrix) u is in H(Curl) and v is in H(Div) or H(Curl). */
1860 {
1861 public:
1864  : MixedVectorIntegrator(q) {}
1866  : MixedVectorIntegrator(dq, true) {}
1868  : MixedVectorIntegrator(mq) {}
1869 
1870 protected:
1871  inline virtual bool VerifyFiniteElementTypes(
1872  const FiniteElement & trial_fe,
1873  const FiniteElement & test_fe) const
1874  {
1875  return (trial_fe.GetCurlDim() == 3 && test_fe.GetVDim() == 3 &&
1876  trial_fe.GetDerivType() == mfem::FiniteElement::CURL &&
1878  }
1879 
1880  inline virtual const char * FiniteElementTypeFailureMessage() const
1881  {
1882  return "MixedVectorCurlIntegrator: "
1883  "Trial space must be H(Curl) and the test space must be a "
1884  "vector field in 3D";
1885  }
1886 
1887  inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1888  { return trial_fe.GetCurlDim(); }
1889 
1890  inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1892  DenseMatrix & shape)
1893  {
1894  trial_fe.CalcPhysCurlShape(Trans, shape);
1895  }
1896 
1898  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1899  const FiniteElementSpace &test_fes);
1900 
1901  virtual void AddMultPA(const Vector&, Vector&) const;
1902 
1903 private:
1904  // PA extension
1905  Vector pa_data;
1906  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1907  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1908  const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
1909  const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
1910  const GeometricFactors *geom; ///< Not owned
1911  int dim, ne, dofs1D, dofs1Dtest,quad1D, testType, trialType, coeffDim;
1912 };
1913 
1914 /** Class for integrating the bilinear form a(u,v) := (Q u, curl v) in 3D and
1915  where Q is an optional coefficient (of type scalar, matrix, or diagonal
1916  matrix) u is in H(Div) or H(Curl) and v is in H(Curl). */
1918 {
1919 public:
1922  : MixedVectorIntegrator(q) {}
1924  : MixedVectorIntegrator(dq, true) {}
1926  : MixedVectorIntegrator(mq) {}
1927 
1928 protected:
1929  inline virtual bool VerifyFiniteElementTypes(
1930  const FiniteElement & trial_fe,
1931  const FiniteElement & test_fe) const
1932  {
1933  return (trial_fe.GetVDim() == 3 && test_fe.GetCurlDim() == 3 &&
1934  trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1935  test_fe.GetDerivType() == mfem::FiniteElement::CURL );
1936  }
1937 
1938  inline virtual const char * FiniteElementTypeFailureMessage() const
1939  {
1940  return "MixedVectorWeakCurlIntegrator: "
1941  "Trial space must be vector field in 3D and the "
1942  "test space must be H(Curl)";
1943  }
1944 
1945  inline virtual int GetTestVDim(const FiniteElement & test_fe)
1946  { return test_fe.GetCurlDim(); }
1947 
1948  inline virtual void CalcTestShape(const FiniteElement & test_fe,
1950  DenseMatrix & shape)
1951  {
1952  test_fe.CalcPhysCurlShape(Trans, shape);
1953  }
1954 
1956  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1957  const FiniteElementSpace &test_fes);
1958 
1959  virtual void AddMultPA(const Vector&, Vector&) const;
1960 
1961 private:
1962  // PA extension
1963  Vector pa_data;
1964  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1965  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1966  const GeometricFactors *geom; ///< Not owned
1967  int dim, ne, dofs1D, quad1D, testType, trialType, coeffDim;
1968 };
1969 
1970 /** Class for integrating the bilinear form a(u,v) := - (Q u, grad v) in either
1971  2D or 3D and where Q is an optional coefficient (of type scalar, matrix, or
1972  diagonal matrix) u is in H(Div) or H(Curl) and v is in H1. */
1974 {
1975 public:
1978  : MixedVectorIntegrator(q) {}
1980  : MixedVectorIntegrator(dq, true) {}
1982  : MixedVectorIntegrator(mq) {}
1983 
1984 protected:
1985  inline virtual bool VerifyFiniteElementTypes(
1986  const FiniteElement & trial_fe,
1987  const FiniteElement & test_fe) const
1988  {
1989  return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1990  test_fe.GetDerivType() == mfem::FiniteElement::GRAD );
1991  }
1992 
1993  inline virtual const char * FiniteElementTypeFailureMessage() const
1994  {
1995  return "MixedVectorWeakDivergenceIntegrator: "
1996  "Trial space must be vector field and the "
1997  "test space must be H1";
1998  }
1999 
2000  inline virtual int GetTestVDim(const FiniteElement & test_fe)
2001  { return space_dim; }
2002 
2003  inline virtual void CalcTestShape(const FiniteElement & test_fe,
2005  DenseMatrix & shape)
2006  {
2007  test_fe.CalcPhysDShape(Trans, shape);
2008  shape *= -1.0;
2009  }
2010 };
2011 
2012 /** Class for integrating the bilinear form a(u,v) := (Q grad u, v) where Q is a
2013  scalar coefficient, and v is a vector with components v_i in the same (H1) space
2014  as u.
2015 
2016  See also MixedVectorGradientIntegrator when v is in H(curl). */
2018 {
2019 protected:
2021 
2022 private:
2023  Vector shape;
2024  DenseMatrix dshape;
2025  DenseMatrix gshape;
2026  DenseMatrix Jadj;
2027  DenseMatrix elmat_comp;
2028  // PA extension
2029  Vector pa_data;
2030  const DofToQuad *trial_maps, *test_maps; ///< Not owned
2031  const GeometricFactors *geom; ///< Not owned
2032  int dim, ne, nq;
2033  int trial_dofs1D, test_dofs1D, quad1D;
2034 
2035 public:
2037  Q{NULL}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2038  { }
2040  Q{q_}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2041  { }
2043  Q{&q}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2044  { }
2045 
2046  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2047  const FiniteElement &test_fe,
2048  ElementTransformation &Trans,
2049  DenseMatrix &elmat);
2050 
2052  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2053  const FiniteElementSpace &test_fes);
2054 
2055  virtual void AddMultPA(const Vector &x, Vector &y) const;
2056  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2057 
2058  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2059  const FiniteElement &test_fe,
2060  ElementTransformation &Trans);
2061 };
2062 
2063 /** Class for integrating the bilinear form a(u,v) := (Q grad u, grad v) where Q
2064  can be a scalar or a matrix coefficient. */
2066 {
2067 protected:
2072 
2073 private:
2074  Vector vec, vecdxt, pointflux, shape;
2075 #ifndef MFEM_THREAD_SAFE
2076  DenseMatrix dshape, dshapedxt, invdfdx, M, dshapedxt_m;
2077  DenseMatrix te_dshape, te_dshapedxt;
2078  Vector D;
2079 #endif
2080 
2081  // PA extension
2082  const FiniteElementSpace *fespace;
2083  const DofToQuad *maps; ///< Not owned
2084  const GeometricFactors *geom; ///< Not owned
2085  int dim, ne, dofs1D, quad1D;
2086  Vector pa_data;
2087  bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2088 
2089 public:
2090  /// Construct a diffusion integrator with coefficient Q = 1
2092  : BilinearFormIntegrator(ir),
2093  Q(NULL), VQ(NULL), MQ(NULL), SMQ(NULL), maps(NULL), geom(NULL) { }
2094 
2095  /// Construct a diffusion integrator with a scalar coefficient q
2097  : BilinearFormIntegrator(ir),
2098  Q(&q), VQ(NULL), MQ(NULL), SMQ(NULL), maps(NULL), geom(NULL) { }
2099 
2100  /// Construct a diffusion integrator with a vector coefficient q
2102  const IntegrationRule *ir = nullptr)
2103  : BilinearFormIntegrator(ir),
2104  Q(NULL), VQ(&q), MQ(NULL), SMQ(NULL), maps(NULL), geom(NULL) { }
2105 
2106  /// Construct a diffusion integrator with a matrix coefficient q
2108  const IntegrationRule *ir = nullptr)
2109  : BilinearFormIntegrator(ir),
2110  Q(NULL), VQ(NULL), MQ(&q), SMQ(NULL), maps(NULL), geom(NULL) { }
2111 
2112  /// Construct a diffusion integrator with a symmetric matrix coefficient q
2114  const IntegrationRule *ir = nullptr)
2115  : BilinearFormIntegrator(ir),
2116  Q(NULL), VQ(NULL), MQ(NULL), SMQ(&q), maps(NULL), geom(NULL) { }
2117 
2118  /** Given a particular Finite Element computes the element stiffness matrix
2119  elmat. */
2120  virtual void AssembleElementMatrix(const FiniteElement &el,
2122  DenseMatrix &elmat);
2123  /** Given a trial and test Finite Element computes the element stiffness
2124  matrix elmat. */
2125  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2126  const FiniteElement &test_fe,
2128  DenseMatrix &elmat);
2129 
2130  /// Perform the local action of the BilinearFormIntegrator
2131  virtual void AssembleElementVector(const FiniteElement &el,
2133  const Vector &elfun, Vector &elvect);
2134 
2135  virtual void ComputeElementFlux(const FiniteElement &el,
2137  Vector &u, const FiniteElement &fluxelem,
2138  Vector &flux, bool with_coef = true);
2139 
2140  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
2142  Vector &flux, Vector *d_energy = NULL);
2143 
2145 
2146  virtual void AssembleMF(const FiniteElementSpace &fes);
2147 
2148  virtual void AssemblePA(const FiniteElementSpace &fes);
2149 
2150  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2151  const bool add);
2152 
2153  virtual void AssembleDiagonalPA(Vector &diag);
2154 
2155  virtual void AssembleDiagonalMF(Vector &diag);
2156 
2157  virtual void AddMultMF(const Vector&, Vector&) const;
2158 
2159  virtual void AddMultPA(const Vector&, Vector&) const;
2160 
2161  virtual void AddMultTransposePA(const Vector&, Vector&) const;
2162 
2163  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2164  const FiniteElement &test_fe);
2165 
2166  bool SupportsCeed() const { return DeviceCanUseCeed(); }
2167 };
2168 
2169 /** Class for local mass matrix assembling a(u,v) := (Q u, v) */
2171 {
2172 protected:
2173 #ifndef MFEM_THREAD_SAFE
2175 #endif
2177  // PA extension
2180  const DofToQuad *maps; ///< Not owned
2181  const GeometricFactors *geom; ///< Not owned
2182  int dim, ne, nq, dofs1D, quad1D;
2183 
2184 public:
2186  : BilinearFormIntegrator(ir), Q(NULL), maps(NULL), geom(NULL) { }
2187 
2188  /// Construct a mass integrator with coefficient q
2190  : BilinearFormIntegrator(ir), Q(&q), maps(NULL), geom(NULL) { }
2191 
2192  /** Given a particular Finite Element computes the element mass matrix
2193  elmat. */
2194  virtual void AssembleElementMatrix(const FiniteElement &el,
2196  DenseMatrix &elmat);
2197  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2198  const FiniteElement &test_fe,
2200  DenseMatrix &elmat);
2201 
2203 
2204  virtual void AssembleMF(const FiniteElementSpace &fes);
2205 
2206  virtual void AssemblePA(const FiniteElementSpace &fes);
2207 
2208  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2209  const bool add);
2210 
2211  virtual void AssembleDiagonalPA(Vector &diag);
2212 
2213  virtual void AssembleDiagonalMF(Vector &diag);
2214 
2215  virtual void AddMultMF(const Vector&, Vector&) const;
2216 
2217  virtual void AddMultPA(const Vector&, Vector&) const;
2218 
2219  virtual void AddMultTransposePA(const Vector&, Vector&) const;
2220 
2221  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2222  const FiniteElement &test_fe,
2224 
2225  bool SupportsCeed() const { return DeviceCanUseCeed(); }
2226 };
2227 
2228 /** Mass integrator (u, v) restricted to the boundary of a domain */
2230 {
2231 public:
2233 
2235 
2236  virtual void AssembleFaceMatrix(const FiniteElement &el1,
2237  const FiniteElement &el2,
2239  DenseMatrix &elmat);
2240 };
2241 
2242 /// alpha (q . grad u, v)
2244 {
2245 protected:
2247  double alpha;
2248  // PA extension
2250  const DofToQuad *maps; ///< Not owned
2251  const GeometricFactors *geom; ///< Not owned
2252  int dim, ne, nq, dofs1D, quad1D;
2253 
2254 private:
2255 #ifndef MFEM_THREAD_SAFE
2256  DenseMatrix dshape, adjJ, Q_ir;
2257  Vector shape, vec2, BdFidxT;
2258 #endif
2259 
2260 public:
2262  : Q(&q) { alpha = a; }
2263 
2264  virtual void AssembleElementMatrix(const FiniteElement &,
2266  DenseMatrix &);
2267 
2269 
2270  virtual void AssembleMF(const FiniteElementSpace &fes);
2271 
2272  virtual void AssemblePA(const FiniteElementSpace&);
2273 
2274  virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2275  const bool add);
2276 
2277  virtual void AssembleDiagonalPA(Vector &diag);
2278 
2279  virtual void AssembleDiagonalMF(Vector &diag);
2280 
2281  virtual void AddMultMF(const Vector&, Vector&) const;
2282 
2283  virtual void AddMultPA(const Vector&, Vector&) const;
2284 
2285  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2286 
2287  static const IntegrationRule &GetRule(const FiniteElement &el,
2289 
2290  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2291  const FiniteElement &test_fe,
2293 
2294  bool SupportsCeed() const { return DeviceCanUseCeed(); }
2295 };
2296 
2297 // Alias for @ConvectionIntegrator.
2299 
2300 /// -alpha (u, q . grad v), negative transpose of ConvectionIntegrator
2302 {
2303 public:
2306 };
2307 
2308 /// alpha (q . grad u, v) using the "group" FE discretization
2310 {
2311 protected:
2313  double alpha;
2314 
2315 private:
2316  DenseMatrix dshape, adjJ, Q_nodal, grad;
2317  Vector shape;
2318 
2319 public:
2321  : Q(&q) { alpha = a; }
2322  virtual void AssembleElementMatrix(const FiniteElement &,
2324  DenseMatrix &);
2325 };
2326 
2327 /** Class for integrating the bilinear form a(u,v) := (Q u, v),
2328  where u=(u1,...,un) and v=(v1,...,vn); ui and vi are defined
2329  by scalar FE through standard transformation. */
2331 {
2332 private:
2333  int vdim;
2334  Vector shape, te_shape, vec;
2335  DenseMatrix partelmat;
2336  DenseMatrix mcoeff;
2337  int Q_order;
2338 
2339 protected:
2343  // PA extension
2345  const DofToQuad *maps; ///< Not owned
2346  const GeometricFactors *geom; ///< Not owned
2347  int dim, ne, nq, dofs1D, quad1D;
2348 
2349 public:
2350  /// Construct an integrator with coefficient 1.0
2352  : vdim(-1), Q_order(0), Q(NULL), VQ(NULL), MQ(NULL) { }
2353  /** Construct an integrator with scalar coefficient q. If possible, save
2354  memory by using a scalar integrator since the resulting matrix is block
2355  diagonal with the same diagonal block repeated. */
2357  : vdim(-1), Q_order(qo), Q(&q), VQ(NULL), MQ(NULL) { }
2359  : BilinearFormIntegrator(ir), vdim(-1), Q_order(0), Q(&q), VQ(NULL),
2360  MQ(NULL) { }
2361  /// Construct an integrator with diagonal coefficient q
2363  : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(&q), MQ(NULL) { }
2364  /// Construct an integrator with matrix coefficient q
2366  : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(NULL), MQ(&q) { }
2367 
2368  int GetVDim() const { return vdim; }
2369  void SetVDim(int vdim_) { vdim = vdim_; }
2370 
2371  virtual void AssembleElementMatrix(const FiniteElement &el,
2373  DenseMatrix &elmat);
2374  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2375  const FiniteElement &test_fe,
2377  DenseMatrix &elmat);
2379  virtual void AssemblePA(const FiniteElementSpace &fes);
2380  virtual void AssembleMF(const FiniteElementSpace &fes);
2381  virtual void AssembleDiagonalPA(Vector &diag);
2382  virtual void AssembleDiagonalMF(Vector &diag);
2383  virtual void AddMultPA(const Vector &x, Vector &y) const;
2384  virtual void AddMultMF(const Vector &x, Vector &y) const;
2385  bool SupportsCeed() const { return DeviceCanUseCeed(); }
2386 };
2387 
2388 
2389 /** Class for integrating (div u, p) where u is a vector field given by
2390  VectorFiniteElement through Piola transformation (for RT elements); p is
2391  scalar function given by FiniteElement through standard transformation.
2392  Here, u is the trial function and p is the test function.
2393 
2394  Note: the element matrix returned by AssembleElementMatrix2 does NOT depend
2395  on the ElementTransformation Trans. */
2397 {
2398 protected:
2400 
2402  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2403  const FiniteElementSpace &test_fes);
2404 
2405  virtual void AddMultPA(const Vector&, Vector&) const;
2406  virtual void AddMultTransposePA(const Vector&, Vector&) const;
2407 
2408 private:
2409 #ifndef MFEM_THREAD_SAFE
2410  Vector divshape, shape;
2411 #endif
2412 
2413  // PA extension
2414  Vector pa_data;
2415  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2416  const DofToQuad *L2mapsO; ///< Not owned. DOF-to-quad map, open.
2417  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2418  int dim, ne, dofs1D, L2dofs1D, quad1D;
2419 
2420 public:
2423  virtual void AssembleElementMatrix(const FiniteElement &el,
2425  DenseMatrix &elmat) { }
2426  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2427  const FiniteElement &test_fe,
2429  DenseMatrix &elmat);
2430 
2431  virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
2432 };
2433 
2434 
2435 /** Integrator for `(-Q u, grad v)` for Nedelec (`u`) and H1 (`v`) elements.
2436  This is equivalent to a weak divergence of the Nedelec basis functions. */
2438 {
2439 protected:
2441 
2442 private:
2443 #ifndef MFEM_THREAD_SAFE
2444  DenseMatrix dshape;
2445  DenseMatrix dshapedxt;
2446  DenseMatrix vshape;
2447  DenseMatrix invdfdx;
2448 #endif
2449 
2450 public:
2453  virtual void AssembleElementMatrix(const FiniteElement &el,
2455  DenseMatrix &elmat) { }
2456  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2457  const FiniteElement &test_fe,
2459  DenseMatrix &elmat);
2460 };
2461 
2462 /** Integrator for (curl u, v) for Nedelec and RT elements. If the trial and
2463  test spaces are switched, assembles the form (u, curl v). */
2465 {
2466 protected:
2468 
2469 private:
2470 #ifndef MFEM_THREAD_SAFE
2471  DenseMatrix curlshapeTrial;
2472  DenseMatrix vshapeTest;
2473  DenseMatrix curlshapeTrial_dFT;
2474 #endif
2475 
2476 public:
2479  virtual void AssembleElementMatrix(const FiniteElement &el,
2481  DenseMatrix &elmat) { }
2482  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2483  const FiniteElement &test_fe,
2485  DenseMatrix &elmat);
2486 };
2487 
2488 /// Class for integrating (Q D_i(u), v); u and v are scalars
2490 {
2491 protected:
2493 
2494 private:
2495  int xi;
2496  DenseMatrix dshape, dshapedxt, invdfdx;
2497  Vector shape, dshapedxi;
2498 
2499 public:
2500  DerivativeIntegrator(Coefficient &q, int i) : Q(&q), xi(i) { }
2501  virtual void AssembleElementMatrix(const FiniteElement &el,
2503  DenseMatrix &elmat)
2504  { AssembleElementMatrix2(el,el,Trans,elmat); }
2505  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2506  const FiniteElement &test_fe,
2508  DenseMatrix &elmat);
2509 };
2510 
2511 /// Integrator for (curl u, curl v) for Nedelec elements
2513 {
2514 private:
2515  Vector vec, pointflux;
2516 #ifndef MFEM_THREAD_SAFE
2517  Vector D;
2518  DenseMatrix curlshape, curlshape_dFt, M;
2519  DenseMatrix vshape, projcurl;
2520 #endif
2521 
2522 protected:
2527 
2528  // PA extension
2530  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2531  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2532  const GeometricFactors *geom; ///< Not owned
2533  int dim, ne, nq, dofs1D, quad1D;
2534  bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2535 
2536 public:
2537  CurlCurlIntegrator() { Q = NULL; DQ = NULL; MQ = NULL; SMQ = NULL; }
2538  /// Construct a bilinear form integrator for Nedelec elements
2540  BilinearFormIntegrator(ir), Q(&q), DQ(NULL), MQ(NULL), SMQ(NULL) { }
2542  const IntegrationRule *ir = NULL) :
2543  BilinearFormIntegrator(ir), Q(NULL), DQ(&dq), MQ(NULL), SMQ(NULL) { }
2545  BilinearFormIntegrator(ir), Q(NULL), DQ(NULL), MQ(&mq), SMQ(NULL) { }
2547  const IntegrationRule *ir = NULL) :
2548  BilinearFormIntegrator(ir), Q(NULL), DQ(NULL), MQ(NULL), SMQ(&smq) { }
2549 
2550  /* Given a particular Finite Element, compute the
2551  element curl-curl matrix elmat */
2552  virtual void AssembleElementMatrix(const FiniteElement &el,
2554  DenseMatrix &elmat);
2555 
2556  virtual void ComputeElementFlux(const FiniteElement &el,
2558  Vector &u, const FiniteElement &fluxelem,
2559  Vector &flux, bool with_coef);
2560 
2561  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
2563  Vector &flux, Vector *d_energy = NULL);
2564 
2566  virtual void AssemblePA(const FiniteElementSpace &fes);
2567  virtual void AddMultPA(const Vector &x, Vector &y) const;
2568  virtual void AssembleDiagonalPA(Vector& diag);
2569 };
2570 
2571 /** Integrator for (curl u, curl v) for FE spaces defined by 'dim' copies of a
2572  scalar FE space. */
2574 {
2575 private:
2576 #ifndef MFEM_THREAD_SAFE
2577  DenseMatrix dshape_hat, dshape, curlshape, Jadj, grad_hat, grad;
2578 #endif
2579 
2580 protected:
2582 
2583 public:
2585 
2587 
2588  /// Assemble an element matrix
2589  virtual void AssembleElementMatrix(const FiniteElement &el,
2591  DenseMatrix &elmat);
2592  /// Compute element energy: (1/2) (curl u, curl u)_E
2593  virtual double GetElementEnergy(const FiniteElement &el,
2595  const Vector &elfun);
2596 };
2597 
2598 /** Integrator for (Q u, v), where Q is an optional coefficient (of type scalar,
2599  vector (diagonal matrix), or matrix), trial function u is in H(Curl) or
2600  H(Div), and test function v is in H(Curl), H(Div), or v=(v1,...,vn), where
2601  vi are in H1. */
2603 {
2604 private:
2607  { Q = q; DQ = dq; MQ = mq; SMQ = smq; }
2608 
2609 #ifndef MFEM_THREAD_SAFE
2610  Vector shape;
2611  Vector D;
2612  DenseMatrix K;
2613  DenseMatrix partelmat;
2614  DenseMatrix test_vshape;
2615  DenseMatrix trial_vshape;
2616 #endif
2617 
2618 protected:
2623 
2624  // PA extension
2626  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2627  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2628  const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2629  const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2630  const GeometricFactors *geom; ///< Not owned
2632  bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2633 
2634 public:
2635  VectorFEMassIntegrator() { Init(NULL, NULL, NULL, NULL); }
2636  VectorFEMassIntegrator(Coefficient *q_) { Init(q_, NULL, NULL, NULL); }
2637  VectorFEMassIntegrator(Coefficient &q) { Init(&q, NULL, NULL, NULL); }
2638  VectorFEMassIntegrator(DiagonalMatrixCoefficient *dq_) { Init(NULL, dq_, NULL, NULL); }
2639  VectorFEMassIntegrator(DiagonalMatrixCoefficient &dq) { Init(NULL, &dq, NULL, NULL); }
2640  VectorFEMassIntegrator(MatrixCoefficient *mq_) { Init(NULL, NULL, mq_, NULL); }
2641  VectorFEMassIntegrator(MatrixCoefficient &mq) { Init(NULL, NULL, &mq, NULL); }
2642  VectorFEMassIntegrator(SymmetricMatrixCoefficient &smq) { Init(NULL, NULL, NULL, &smq); }
2643  VectorFEMassIntegrator(SymmetricMatrixCoefficient *smq) { Init(NULL, NULL, NULL, smq); }
2644 
2645  virtual void AssembleElementMatrix(const FiniteElement &el,
2647  DenseMatrix &elmat);
2648  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2649  const FiniteElement &test_fe,
2651  DenseMatrix &elmat);
2652 
2654  virtual void AssemblePA(const FiniteElementSpace &fes);
2655  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2656  const FiniteElementSpace &test_fes);
2657  virtual void AddMultPA(const Vector &x, Vector &y) const;
2658  virtual void AssembleDiagonalPA(Vector& diag);
2659 };
2660 
2661 /** Integrator for (Q div u, p) where u=(v1,...,vn) and all vi are in the same
2662  scalar FE space; p is also in a (different) scalar FE space. */
2664 {
2665 protected:
2667 
2668 private:
2669  Vector shape;
2670  Vector divshape;
2671  DenseMatrix dshape;
2672  DenseMatrix gshape;
2673  DenseMatrix Jadj;
2674  // PA extension
2675  Vector pa_data;
2676  const DofToQuad *trial_maps, *test_maps; ///< Not owned
2677  const GeometricFactors *geom; ///< Not owned
2678  int dim, ne, nq;
2679  int trial_dofs1D, test_dofs1D, quad1D;
2680 
2681 public:
2683  Q(NULL), trial_maps(NULL), test_maps(NULL), geom(NULL)
2684  { }
2686  Q(q_), trial_maps(NULL), test_maps(NULL), geom(NULL)
2687  { }
2689  Q(&q), trial_maps(NULL), test_maps(NULL), geom(NULL)
2690  { }
2691 
2692  virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2693  const FiniteElement &test_fe,
2695  DenseMatrix &elmat);
2696 
2698  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2699  const FiniteElementSpace &test_fes);
2700 
2701  virtual void AddMultPA(const Vector &x, Vector &y) const;
2702  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2703 
2704  static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2705  const FiniteElement &test_fe,
2707 };
2708 
2709 /// (Q div u, div v) for RT elements
2711 {
2712 protected:
2714 
2716  virtual void AssemblePA(const FiniteElementSpace &fes);
2717  virtual void AddMultPA(const Vector &x, Vector &y) const;
2718  virtual void AssembleDiagonalPA(Vector& diag);
2719 
2720 private:
2721 #ifndef MFEM_THREAD_SAFE
2722  Vector divshape;
2723 #endif
2724 
2725  // PA extension
2726  Vector pa_data;
2727  const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2728  const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2729  const GeometricFactors *geom; ///< Not owned
2730  int dim, ne, dofs1D, quad1D;
2731 
2732 public:
2733  DivDivIntegrator() { Q = NULL; }
2735 
2736  virtual void AssembleElementMatrix(const FiniteElement &el,
2738  DenseMatrix &elmat);
2739 };
2740 
2741 /** Integrator for
2742 
2743  (Q grad u, grad v) = sum_i (Q grad u_i, grad v_i) e_i e_i^T
2744 
2745  for vector FE spaces, where e_i is the unit vector in the i-th direction.
2746  The resulting local element matrix is square, of size <tt> vdim*dof </tt>,
2747  where \c vdim is the vector dimension space and \c dof is the local degrees
2748  of freedom. The integrator is not aware of the true vector dimension and
2749  must use \c VectorCoefficient, \c MatrixCoefficient, or a caller-specified
2750  value to determine the vector space. For a scalar coefficient, the caller
2751  may manually specify the vector dimension or the vector dimension is assumed
2752  to be the spatial dimension (i.e. 2-dimension or 3-dimension).
2753 */
2755 {
2756 protected:
2757  Coefficient *Q = NULL;
2760 
2761  // PA extension
2762  const DofToQuad *maps; ///< Not owned
2763  const GeometricFactors *geom; ///< Not owned
2766 
2767 private:
2768  DenseMatrix dshape, dshapedxt, pelmat;
2769  int vdim = -1;
2770  DenseMatrix mcoeff;
2771  Vector vcoeff;
2772 
2773 public:
2775 
2776  /** \brief Integrator with unit coefficient for caller-specified vector
2777  dimension.
2778 
2779  If the vector dimension does not match the true dimension of the space,
2780  the resulting element matrix will be mathematically invalid. */
2781  VectorDiffusionIntegrator(int vector_dimension)
2782  : vdim(vector_dimension) { }
2783 
2785  : Q(&q) { }
2786 
2788  : BilinearFormIntegrator(ir), Q(&q) { }
2789 
2790  /** \brief Integrator with scalar coefficient for caller-specified vector
2791  dimension.
2792 
2793  The element matrix is block-diagonal with \c vdim copies of the element
2794  matrix integrated with the \c Coefficient.
2795 
2796  If the vector dimension does not match the true dimension of the space,
2797  the resulting element matrix will be mathematically invalid. */
2798  VectorDiffusionIntegrator(Coefficient &q, int vector_dimension)
2799  : Q(&q), vdim(vector_dimension) { }
2800 
2801  /** \brief Integrator with \c VectorCoefficient. The vector dimension of the
2802  \c FiniteElementSpace is assumed to be the same as the dimension of the
2803  \c Vector.
2804 
2805  The element matrix is block-diagonal and each block is integrated with
2806  coefficient q_i.
2807 
2808  If the vector dimension does not match the true dimension of the space,
2809  the resulting element matrix will be mathematically invalid. */
2811  : VQ(&vq), vdim(vq.GetVDim()) { }
2812 
2813  /** \brief Integrator with \c MatrixCoefficient. The vector dimension of the
2814  \c FiniteElementSpace is assumed to be the same as the dimension of the
2815  \c Matrix.
2816 
2817  The element matrix is populated in each block. Each block is integrated
2818  with coefficient q_ij.
2819 
2820  If the vector dimension does not match the true dimension of the space,
2821  the resulting element matrix will be mathematically invalid. */
2823  : MQ(&mq), vdim(mq.GetVDim()) { }
2824 
2825  virtual void AssembleElementMatrix(const FiniteElement &el,
2827  DenseMatrix &elmat);
2828  virtual void AssembleElementVector(const FiniteElement &el,
2830  const Vector &elfun, Vector &elvect);
2832  virtual void AssemblePA(const FiniteElementSpace &fes);
2833  virtual void AssembleMF(const FiniteElementSpace &fes);
2834  virtual void AssembleDiagonalPA(Vector &diag);
2835  virtual void AssembleDiagonalMF(Vector &diag);
2836  virtual void AddMultPA(const Vector &x, Vector &y) const;
2837  virtual void AddMultMF(const Vector &x, Vector &y) const;
2838  bool SupportsCeed() const { return DeviceCanUseCeed(); }
2839 };
2840 
2841 /** Integrator for the linear elasticity form:
2842  a(u,v) = (lambda div(u), div(v)) + (2 mu e(u), e(v)),
2843  where e(v) = (1/2) (grad(v) + grad(v)^T).
2844  This is a 'Vector' integrator, i.e. defined for FE spaces
2845  using multiple copies of a scalar FE space. */
2847 {
2848 protected:
2849  double q_lambda, q_mu;
2851 
2852 private:
2853 #ifndef MFEM_THREAD_SAFE
2854  Vector shape;
2855  DenseMatrix dshape, gshape, pelmat;
2856  Vector divshape;
2857 #endif
2858 
2859 public:
2861  { lambda = &l; mu = &m; }
2862  /** With this constructor lambda = q_l * m and mu = q_m * m;
2863  if dim * q_l + 2 * q_m = 0 then trace(sigma) = 0. */
2864  ElasticityIntegrator(Coefficient &m, double q_l, double q_m)
2865  { lambda = NULL; mu = &m; q_lambda = q_l; q_mu = q_m; }
2866 
2867  virtual void AssembleElementMatrix(const FiniteElement &,
2869  DenseMatrix &);
2870 
2871  /** Compute the stress corresponding to the local displacement @a u and
2872  interpolate it at the nodes of the given @a fluxelem. Only the symmetric
2873  part of the stress is stored, so that the size of @a flux is equal to
2874  the number of DOFs in @a fluxelem times dim*(dim+1)/2. In 2D, the order
2875  of the stress components is: s_xx, s_yy, s_xy. In 3D, it is: s_xx, s_yy,
2876  s_zz, s_xy, s_xz, s_yz. In other words, @a flux is the local vector for
2877  a FE space with dim*(dim+1)/2 vector components, based on the finite
2878  element @a fluxelem. */
2879  virtual void ComputeElementFlux(const FiniteElement &el,
2881  Vector &u,
2882  const FiniteElement &fluxelem,
2883  Vector &flux, bool with_coef = true);
2884 
2885  /** Compute the element energy (integral of the strain energy density)
2886  corresponding to the stress represented by @a flux which is a vector of
2887  coefficients multiplying the basis functions defined by @a fluxelem. In
2888  other words, @a flux is the local vector for a FE space with
2889  dim*(dim+1)/2 vector components, based on the finite element @a fluxelem.
2890  The number of components, dim*(dim+1)/2 is such that it represents the
2891  symmetric part of the (symmetric) stress tensor. The order of the
2892  components is: s_xx, s_yy, s_xy in 2D, and s_xx, s_yy, s_zz, s_xy, s_xz,
2893  s_yz in 3D. */
2894  virtual double ComputeFluxEnergy(const FiniteElement &fluxelem,
2896  Vector &flux, Vector *d_energy = NULL);
2897 };
2898 
2899 /** Integrator for the DG form:
2900  alpha < rho_u (u.n) {v},[w] > + beta < rho_u |u.n| [v],[w] >,
2901  where v and w are the trial and test variables, respectively, and rho/u are
2902  given scalar/vector coefficients. {v} represents the average value of v on
2903  the face and [v] is the jump such that {v}=(v1+v2)/2 and [v]=(v1-v2) for the
2904  face between elements 1 and 2. For boundary elements, v2=0. The vector
2905  coefficient, u, is assumed to be continuous across the faces and when given
2906  the scalar coefficient, rho, is assumed to be discontinuous. The integrator
2907  uses the upwind value of rho, rho_u, which is value from the side into which
2908  the vector coefficient, u, points.
2909 
2910  One use case for this integrator is to discretize the operator -u.grad(v)
2911  with a DG formulation. The resulting formulation uses the
2912  ConvectionIntegrator (with coefficient u, and parameter alpha = -1) and the
2913  transpose of the DGTraceIntegrator (with coefficient u, and parameters alpha
2914  = 1, beta = -1/2 to use the upwind face flux, see also
2915  NonconservativeDGTraceIntegrator). This discretization and the handling of
2916  the inflow and outflow boundaries is illustrated in Example 9/9p.
2917 
2918  Another use case for this integrator is to discretize the operator -div(u v)
2919  with a DG formulation. The resulting formulation is conservative and
2920  consists of the ConservativeConvectionIntegrator (with coefficient u, and
2921  parameter alpha = -1) plus the DGTraceIntegrator (with coefficient u, and
2922  parameters alpha = -1, beta = -1/2 to use the upwind face flux).
2923  */
2925 {
2926 protected:
2929  double alpha, beta;
2930  // PA extension
2932  const DofToQuad *maps; ///< Not owned
2933  const FaceGeometricFactors *geom; ///< Not owned
2934  int dim, nf, nq, dofs1D, quad1D;
2935 
2936 private:
2937  Vector shape1, shape2;
2938 
2939 public:
2940  /// Construct integrator with rho = 1, b = 0.5*a.
2942  { rho = NULL; u = &u_; alpha = a; beta = 0.5*a; }
2943 
2944  /// Construct integrator with rho = 1.
2946  { rho = NULL; u = &u_; alpha = a; beta = b; }
2947 
2949  double a, double b)
2950  { rho = &rho_; u = &u_; alpha = a; beta = b; }
2951 
2953  virtual void AssembleFaceMatrix(const FiniteElement &el1,
2954  const FiniteElement &el2,
2956  DenseMatrix &elmat);
2957 
2959 
2960  virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
2961 
2962  virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
2963 
2964  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2965 
2966  virtual void AddMultPA(const Vector&, Vector&) const;
2967 
2968  virtual void AssembleEAInteriorFaces(const FiniteElementSpace& fes,
2969  Vector &ea_data_int,
2970  Vector &ea_data_ext,
2971  const bool add);
2972 
2973  virtual void AssembleEABoundaryFaces(const FiniteElementSpace& fes,
2974  Vector &ea_data_bdr,
2975  const bool add);
2976 
2977  static const IntegrationRule &GetRule(Geometry::Type geom, int order,
2979 
2980 private:
2981  void SetupPA(const FiniteElementSpace &fes, FaceType type);
2982 };
2983 
2984 // Alias for @a DGTraceIntegrator.
2986 
2987 /** Integrator that represents the face terms used for the non-conservative
2988  DG discretization of the convection equation:
2989  -alpha < rho_u (u.n) {v},[w] > + beta < rho_u |u.n| [v],[w] >.
2990 
2991  This integrator can be used with together with ConvectionIntegrator to
2992  implement an upwind DG discretization in non-conservative form, see ex9 and
2993  ex9p. */
2995 {
2996 public:
2998  : TransposeIntegrator(new DGTraceIntegrator(u, -a, 0.5*a)) { }
2999 
3001  : TransposeIntegrator(new DGTraceIntegrator(u, -a, b)) { }
3002 
3004  double a, double b)
3005  : TransposeIntegrator(new DGTraceIntegrator(rho, u, -a, b)) { }
3006 };
3007 
3008 /** Integrator for the DG form:
3009 
3010  - < {(Q grad(u)).n}, [v] > + sigma < [u], {(Q grad(v)).n} >
3011  + kappa < {h^{-1} Q} [u], [v] >,
3012 
3013  where Q is a scalar or matrix diffusion coefficient and u, v are the trial
3014  and test spaces, respectively. The parameters sigma and kappa determine the
3015  DG method to be used (when this integrator is added to the "broken"
3016  DiffusionIntegrator):
3017  * sigma = -1, kappa >= kappa0: symm. interior penalty (IP or SIPG) method,
3018  * sigma = +1, kappa > 0: non-symmetric interior penalty (NIPG) method,
3019  * sigma = +1, kappa = 0: the method of Baumann and Oden. */
3021 {
3022 protected:
3025  double sigma, kappa;
3026 
3027  // these are not thread-safe!
3030 
3031 public:
3032  DGDiffusionIntegrator(const double s, const double k)
3033  : Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
3034  DGDiffusionIntegrator(Coefficient &q, const double s, const double k)
3035  : Q(&q), MQ(NULL), sigma(s), kappa(k) { }
3036  DGDiffusionIntegrator(MatrixCoefficient &q, const double s, const double k)
3037  : Q(NULL), MQ(&q), sigma(s), kappa(k) { }
3039  virtual void AssembleFaceMatrix(const FiniteElement &el1,
3040  const FiniteElement &el2,
3042  DenseMatrix &elmat);
3043 };
3044 
3045 /** Integrator for the "BR2" diffusion stabilization term
3046 
3047  sum_e eta (r_e([u]), r_e([v]))
3048 
3049  where r_e is the lifting operator defined on each edge e (potentially
3050  weighted by a coefficient Q). The parameter eta can be chosen to be one to
3051  obtain a stable discretization. The constructor for this integrator requires
3052  the finite element space because the lifting operator depends on the
3053  element-wise inverse mass matrix.
3054 
3055  BR2 stands for the second method of Bassi and Rebay:
3056 
3057  - F. Bassi and S. Rebay. A high order discontinuous Galerkin method for
3058  compressible turbulent flows. In B. Cockburn, G. E. Karniadakis, and
3059  C.-W. Shu, editors, Discontinuous Galerkin Methods, pages 77-88. Springer
3060  Berlin Heidelberg, 2000.
3061  - D. N. Arnold, F. Brezzi, B. Cockburn, and L. D. Marini. Unified analysis
3062  of discontinuous Galerkin methods for elliptic problems. SIAM Journal on
3063  Numerical Analysis, 39(5):1749-1779, 2002.
3064 */
3066 {
3067 protected:
3068  double eta;
3069 
3070  // Block factorizations of local mass matrices, with offsets for the case of
3071  // not equally sized blocks (mixed meshes, p-refinement)
3075 
3077 
3079 
3083 
3084  /// Precomputes the inverses (LU factorizations) of the local mass matrices.
3085  /** @a fes must be a DG space, so the mass matrix is block diagonal, and its
3086  inverse can be computed locally. This is required for the computation of
3087  the lifting operators @a r_e.
3088  */
3089  void PrecomputeMassInverse(class FiniteElementSpace &fes);
3090 
3091 public:
3092  DGDiffusionBR2Integrator(class FiniteElementSpace &fes, double e = 1.0);
3094  double e = 1.0);
3095  MFEM_DEPRECATED DGDiffusionBR2Integrator(class FiniteElementSpace *fes,
3096  double e = 1.0);
3097 
3099  virtual void AssembleFaceMatrix(const FiniteElement &el1,
3100  const FiniteElement &el2,
3102  DenseMatrix &elmat);
3103 };
3104 
3105 /** Integrator for the DG elasticity form, for the formulations see:
3106  - PhD Thesis of Jonas De Basabe, High-Order Finite %Element Methods for
3107  Seismic Wave Propagation, UT Austin, 2009, p. 23, and references therein
3108  - Peter Hansbo and Mats G. Larson, Discontinuous Galerkin and the
3109  Crouzeix-Raviart %Element: Application to Elasticity, PREPRINT 2000-09,
3110  p.3
3111 
3112  \f[
3113  - \left< \{ \tau(u) \}, [v] \right> + \alpha \left< \{ \tau(v) \}, [u]
3114  \right> + \kappa \left< h^{-1} \{ \lambda + 2 \mu \} [u], [v] \right>
3115  \f]
3116 
3117  where \f$ \left<u, v\right> = \int_{F} u \cdot v \f$, and \f$ F \f$ is a
3118  face which is either a boundary face \f$ F_b \f$ of an element \f$ K \f$ or
3119  an interior face \f$ F_i \f$ separating elements \f$ K_1 \f$ and \f$ K_2 \f$.
3120 
3121  In the bilinear form above \f$ \tau(u) \f$ is traction, and it's also
3122  \f$ \tau(u) = \sigma(u) \cdot \vec{n} \f$, where \f$ \sigma(u) \f$ is
3123  stress, and \f$ \vec{n} \f$ is the unit normal vector w.r.t. to \f$ F \f$.
3124 
3125  In other words, we have
3126  \f[
3127  - \left< \{ \sigma(u) \cdot \vec{n} \}, [v] \right> + \alpha \left< \{
3128  \sigma(v) \cdot \vec{n} \}, [u] \right> + \kappa \left< h^{-1} \{
3129  \lambda + 2 \mu \} [u], [v] \right>
3130  \f]
3131 
3132  For isotropic media
3133  \f[
3134  \begin{split}
3135  \sigma(u) &= \lambda \nabla \cdot u I + 2 \mu \varepsilon(u) \\
3136  &= \lambda \nabla \cdot u I + 2 \mu \frac{1}{2} (\nabla u + \nabla
3137  u^T) \\
3138  &= \lambda \nabla \cdot u I + \mu (\nabla u + \nabla u^T)
3139  \end{split}
3140  \f]
3141 
3142  where \f$ I \f$ is identity matrix, \f$ \lambda \f$ and \f$ \mu \f$ are Lame
3143  coefficients (see ElasticityIntegrator), \f$ u, v \f$ are the trial and test
3144  functions, respectively.
3145 
3146  The parameters \f$ \alpha \f$ and \f$ \kappa \f$ determine the DG method to
3147  use (when this integrator is added to the "broken" ElasticityIntegrator):
3148 
3149  - IIPG, \f$\alpha = 0\f$,
3150  C. Dawson, S. Sun, M. Wheeler, Compatible algorithms for coupled flow and
3151  transport, Comp. Meth. Appl. Mech. Eng., 193(23-26), 2565-2580, 2004.
3152 
3153  - SIPG, \f$\alpha = -1\f$,
3154  M. Grote, A. Schneebeli, D. Schotzau, Discontinuous Galerkin Finite
3155  %Element Method for the Wave Equation, SINUM, 44(6), 2408-2431, 2006.
3156 
3157  - NIPG, \f$\alpha = 1\f$,
3158  B. Riviere, M. Wheeler, V. Girault, A Priori Error Estimates for Finite
3159  %Element Methods Based on Discontinuous Approximation Spaces for Elliptic
3160  Problems, SINUM, 39(3), 902-931, 2001.
3161 
3162  This is a '%Vector' integrator, i.e. defined for FE spaces using multiple
3163  copies of a scalar FE space.
3164  */
3166 {
3167 public:
3168  DGElasticityIntegrator(double alpha_, double kappa_)
3169  : lambda(NULL), mu(NULL), alpha(alpha_), kappa(kappa_) { }
3170 
3172  double alpha_, double kappa_)
3173  : lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
3174 
3176  virtual void AssembleFaceMatrix(const FiniteElement &el1,
3177  const FiniteElement &el2,
3179  DenseMatrix &elmat);
3180 
3181 protected:
3183  double alpha, kappa;
3184 
3185 #ifndef MFEM_THREAD_SAFE
3186  // values of all scalar basis functions for one component of u (which is a
3187  // vector) at the integration point in the reference space
3189  // values of derivatives of all scalar basis functions for one component
3190  // of u (which is a vector) at the integration point in the reference space
3192  // Adjugate of the Jacobian of the transformation: adjJ = det(J) J^{-1}
3194  // gradient of shape functions in the real (physical, not reference)
3195  // coordinates, scaled by det(J):
3196  // dshape_ps(jdof,jm) = sum_{t} adjJ(t,jm)*dshape(jdof,t)
3198  Vector nor; // nor = |weight(J_face)| n
3199  Vector nL1, nL2; // nL1 = (lambda1 * ip.weight / detJ1) nor
3200  Vector nM1, nM2; // nM1 = (mu1 * ip.weight / detJ1) nor
3201  Vector dshape1_dnM, dshape2_dnM; // dshape1_dnM = dshape1_ps . nM1
3202  // 'jmat' corresponds to the term: kappa <h^{-1} {lambda + 2 mu} [u], [v]>
3204 #endif
3205 
3206  static void AssembleBlock(
3207  const int dim, const int row_ndofs, const int col_ndofs,
3208  const int row_offset, const int col_offset,
3209  const double jmatcoef, const Vector &col_nL, const Vector &col_nM,
3210  const Vector &row_shape, const Vector &col_shape,
3211  const Vector &col_dshape_dnM, const DenseMatrix &col_dshape,
3212  DenseMatrix &elmat, DenseMatrix &jmat);
3213 };
3214 
3215 /** Integrator for the DPG form: < v, [w] > over all faces (the interface) where
3216  the trial variable v is defined on the interface and the test variable w is
3217  defined inside the elements, generally in a DG space. */
3219 {
3220 private:
3221  Vector face_shape, shape1, shape2;
3222 
3223 public:
3226  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3227  const FiniteElement &test_fe1,
3228  const FiniteElement &test_fe2,
3230  DenseMatrix &elmat);
3231 };
3232 
3233 /** Integrator for the form: < v, [w.n] > over all faces (the interface) where
3234  the trial variable v is defined on the interface and the test variable w is
3235  in an H(div)-conforming space. */
3237 {
3238 private:
3239  Vector face_shape, normal, shape1_n, shape2_n;
3240  DenseMatrix shape1, shape2;
3241 
3242 public:
3245  virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3246  const FiniteElement &test_fe1,
3247  const FiniteElement &test_fe2,
3249  DenseMatrix &elmat);
3250 };
3251 
3252 /** Abstract class to serve as a base for local interpolators to be used in the
3253  DiscreteLinearOperator class. */
3255 
3256 
3257 /** Class for constructing the gradient as a DiscreteLinearOperator from an
3258  H1-conforming space to an H(curl)-conforming space. The range space can be
3259  vector L2 space as well. */
3261 {
3262 public:
3263  GradientInterpolator() : dofquad_fe(NULL) { }
3264  virtual ~GradientInterpolator() { delete dofquad_fe; }
3265 
3266  virtual void AssembleElementMatrix2(const FiniteElement &h1_fe,
3267  const FiniteElement &nd_fe,
3269  DenseMatrix &elmat)
3270  { nd_fe.ProjectGrad(h1_fe, Trans, elmat); }
3271 
3273 
3274  /** @brief Setup method for PA data.
3275 
3276  @param[in] trial_fes H1 Lagrange space
3277  @param[in] test_fes H(curl) Nedelec space
3278  */
3279  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
3280  const FiniteElementSpace &test_fes);
3281 
3282  virtual void AddMultPA(const Vector &x, Vector &y) const;
3283  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3284 
3285 private:
3286  /// 1D finite element that generates and owns the 1D DofToQuad maps below
3287  FiniteElement * dofquad_fe;
3288 
3289  bool B_id; // is the B basis operator (maps_C_C) the identity?
3290  const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3291  const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3292  int dim, ne, o_dofs1D, c_dofs1D;
3293 };
3294 
3295 
3296 /** Class for constructing the identity map as a DiscreteLinearOperator. This
3297  is the discrete embedding matrix when the domain space is a subspace of
3298  the range space. Otherwise, a dof projection matrix is constructed. */
3300 {
3301 public:
3302  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3303  const FiniteElement &ran_fe,
3305  DenseMatrix &elmat)
3306  { ran_fe.Project(dom_fe, Trans, elmat); }
3307 
3309 
3310  virtual void AssemblePA(const FiniteElementSpace &trial_fes,
3311  const FiniteElementSpace &test_fes);
3312 
3313  virtual void AddMultPA(const Vector &x, Vector &y) const;
3314  virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3315 
3316 private:
3317  /// 1D finite element that generates and owns the 1D DofToQuad maps below
3318  FiniteElement * dofquad_fe;
3319 
3320  const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3321  const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3322  int dim, ne, o_dofs1D, c_dofs1D;
3323 
3324  Vector pa_data;
3325 };
3326 
3327 
3328 /** Class for constructing the (local) discrete curl matrix which can be used
3329  as an integrator in a DiscreteLinearOperator object to assemble the global
3330  discrete curl matrix. */
3332 {
3333 public:
3334  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3335  const FiniteElement &ran_fe,
3337  DenseMatrix &elmat)
3338  { ran_fe.ProjectCurl(dom_fe, Trans, elmat); }
3339 };
3340 
3341 
3342 /** Class for constructing the (local) discrete divergence matrix which can
3343  be used as an integrator in a DiscreteLinearOperator object to assemble
3344  the global discrete divergence matrix.
3345 
3346  Note: Since the dofs in the L2_FECollection are nodal values, the local
3347  discrete divergence matrix (with an RT-type domain space) will depend on
3348  the transformation. On the other hand, the local matrix returned by
3349  VectorFEDivergenceIntegrator is independent of the transformation. */
3351 {
3352 public:
3353  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3354  const FiniteElement &ran_fe,
3356  DenseMatrix &elmat)
3357  { ran_fe.ProjectDiv(dom_fe, Trans, elmat); }
3358 };
3359 
3360 
3361 /** A trace face interpolator class for interpolating the normal component of
3362  the domain space, e.g. vector H1, into the range space, e.g. the trace of
3363  RT which uses FiniteElement::INTEGRAL map type. */
3365 {
3366 public:
3367  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3368  const FiniteElement &ran_fe,
3370  DenseMatrix &elmat);
3371 };
3372 
3373 /** Interpolator of a scalar coefficient multiplied by a scalar field onto
3374  another scalar field. Note that this can produce inaccurate fields unless
3375  the target is sufficiently high order. */
3377 {
3378 public:
3380 
3381  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3382  const FiniteElement &ran_fe,
3384  DenseMatrix &elmat);
3385 
3386 protected:
3388 };
3389 
3390 /** Interpolator of a scalar coefficient multiplied by a vector field onto
3391  another vector field. Note that this can produce inaccurate fields unless
3392  the target is sufficiently high order. */
3394 {
3395 public:
3397  : Q(&sc) { }
3398 
3399  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3400  const FiniteElement &ran_fe,
3402  DenseMatrix &elmat);
3403 protected:
3405 };
3406 
3407 /** Interpolator of a vector coefficient multiplied by a scalar field onto
3408  another vector field. Note that this can produce inaccurate fields unless
3409  the target is sufficiently high order. */
3411 {
3412 public:
3414  : VQ(&vc) { }
3415 
3416  virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3417  const FiniteElement &ran_fe,
3419  DenseMatrix &elmat);
3420 protected:
3422 };
3423 
3424 /** Interpolator of the 2D cross product between a vector coefficient and an
3425  H(curl)-conforming field onto an L2-conforming field. */
3427 {
3428 public:
3430  : VQ(&vc) { }
3431 
3432  virtual void AssembleElementMatrix2(const FiniteElement &nd_fe,
3433  const FiniteElement &l2_fe,
3435  DenseMatrix &elmat);
3436 protected:
3438 };
3439 
3440 /** Interpolator of the cross product between a vector coefficient and an
3441  H(curl)-conforming field onto an H(div)-conforming field. The range space
3442  can also be vector L2. */
3444 {
3445 public:
3447  : VQ(&vc) { }
3448 
3449  virtual void AssembleElementMatrix2(const FiniteElement &nd_fe,
3450  const FiniteElement &rt_fe,
3452  DenseMatrix &elmat);
3453 protected:
3455 };
3456 
3457 /** Interpolator of the inner product between a vector coefficient and an
3458  H(div)-conforming field onto an L2-conforming field. The range space can
3459  also be H1. */
3461 {
3462 public:
3464 
3465  virtual void AssembleElementMatrix2(const FiniteElement &rt_fe,
3466  const FiniteElement &l2_fe,
3468  DenseMatrix &elmat);
3469 protected:
3471 };
3472 
3473 
3474 
3475 // PA Diffusion Assemble 2D kernel
3476 template<const int T_SDIM>
3477 void PADiffusionSetup2D(const int Q1D,
3478  const int coeffDim,
3479  const int NE,
3480  const Array<double> &w,
3481  const Vector &j,
3482  const Vector &c,
3483  Vector &d);
3484 
3485 }
3486 #endif
Abstract class for all finite elements.
Definition: fe_base.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:747
virtual void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
Definition: bilininteg.hpp:446
DiagonalMatrixCoefficient * DQ
Definition: bilininteg.hpp:573
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:513
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:184
virtual int GetTrialVDim(const FiniteElement &trial_fe)
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_base.hpp:311
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:909
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:880
MixedCrossCurlGradIntegrator(VectorCoefficient &vq)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
bool symmetric
False if using a nonsymmetric matrix coefficient.
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
Definition: bilininteg.cpp:210
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:363
SumIntegrator(int own_integs=1)
Definition: bilininteg.hpp:371
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:272
static const IntegrationRule & GetRule(Geometry::Type geom, int order, FaceElementTransformations &T)
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_base.cpp:39
DiffusionIntegrator(SymmetricMatrixCoefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a symmetric matrix coefficient q.
virtual const char * FiniteElementTypeFailureMessage() const
NonconservativeDGTraceIntegrator(VectorCoefficient &u, double a)
MatrixCoefficient * MQ
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:534
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_base.cpp:174
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:646
virtual int GetTestVDim(const FiniteElement &test_fe)
Definition: bilininteg.hpp:554
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_base.cpp:125
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_base.cpp:57
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
Definition: bilininteg.hpp:288
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
ElasticityIntegrator(Coefficient &l, Coefficient &m)
virtual int GetTestVDim(const FiniteElement &test_fe)
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
VectorCoefficient * VQ
Definition: bilininteg.hpp:572
VectorDiffusionIntegrator(Coefficient &q)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
constexpr int HDIV_MAX_D1D
Definition: bilininteg.hpp:30
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:480
const GeometricFactors * geom
Not owned.
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
SymmetricMatrixCoefficient * SMQ
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:728
Integrator for (curl u, curl v) for Nedelec elements.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
DGTraceIntegrator(VectorCoefficient &u_, double a, double b)
Construct integrator with rho = 1.
VectorCurlCurlIntegrator(Coefficient &q)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:764
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)
MixedScalarVectorIntegrator(VectorCoefficient &vq, bool transpose_=false, bool cross_2d_=false)
Definition: bilininteg.hpp:613
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
MixedScalarMassIntegrator(Coefficient &q)
Definition: bilininteg.hpp:688
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
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Definition: bilininteg.cpp:301
const GeometricFactors * geom
Not owned.
A specialized ElementTransformation class representing a face and its two neighboring elements...
Definition: eltrans.hpp:480
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
Definition: bilininteg.cpp:223
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 AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
ScalarCrossProductInterpolator(VectorCoefficient &vc)
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition: fe_base.hpp:327
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
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:860
MixedGradGradIntegrator(DiagonalMatrixCoefficient &dq)
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
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
Definition: bilininteg.cpp:317
DivDivIntegrator(Coefficient &q)
int Size() const
Returns the size of the vector.
Definition: vector.hpp:199
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
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 void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
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:201
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
Definition: bilininteg.cpp:216
const DofToQuad * maps
Not owned.
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
BilinearFormIntegrator(const IntegrationRule *ir=NULL)
Definition: bilininteg.hpp:37
DGTraceIntegrator(Coefficient &rho_, VectorCoefficient &u_, double a, double b)
DiffusionIntegrator(Coefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a scalar coefficient q.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Definition: bilininteg.hpp:283
int Space() const
Returns the type of FunctionSpace on the element.
Definition: fe_base.hpp:337
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:730
void AddIntegrator(BilinearFormIntegrator *integ)
Definition: bilininteg.hpp:375
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape_)
Definition: bilininteg.hpp:660
virtual const char * FiniteElementTypeFailureMessage() const
VectorFEMassIntegrator(SymmetricMatrixCoefficient *smq)
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Definition: mesh.hpp:1814
DiffusionIntegrator(VectorCoefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a vector coefficient q.
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual int GetVDim(const FiniteElement &vector_fe)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:485
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:242
MixedCrossProductIntegrator(VectorCoefficient &vq)
VectorDiffusionIntegrator(int vector_dimension)
Integrator with unit coefficient for caller-specified vector dimension.
DGDiffusionBR2Integrator(class FiniteElementSpace &fes, double e=1.0)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
Definition: bilininteg.cpp:93
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_base.cpp:160
double * GetData() const
Return a pointer to the beginning of the Vector data.
Definition: vector.hpp:208
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorWeakDivergenceIntegrator(DiagonalMatrixCoefficient &dq)
MixedVectorGradientIntegrator(Coefficient &q)
(Q div u, div v) for RT elements
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
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:630
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
Definition: fe_base.hpp:317
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:300
const DofToQuad * maps
Not owned.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
Definition: bilininteg.cpp:309
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual 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_base.cpp:70
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:422
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.
VectorDiffusionIntegrator(Coefficient &q, int vector_dimension)
Integrator with scalar coefficient for caller-specified vector dimension.
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:1868
virtual int GetTrialVDim(const FiniteElement &trial_fe)
VectorCrossProductInterpolator(VectorCoefficient &vc)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void AddMultTransposeMF(const Vector &x, Vector &y) const
Definition: bilininteg.cpp:365
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:460
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
NonconservativeDGTraceIntegrator(VectorCoefficient &u, double a, double b)
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:655
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:192
Integrator that inverts the matrix assembled by another integrator.
Definition: bilininteg.hpp:343
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_base.cpp:167
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
MatrixCoefficient * MQ
NonconservativeDGTraceIntegrator(Coefficient &rho, VectorCoefficient &u, double a, double b)
ElasticityIntegrator(Coefficient &m, double q_l, double q_m)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
Definition: bilininteg.cpp:373
-alpha (u, q . grad v), negative transpose of ConvectionIntegrator
virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual int GetTestVDim(const FiniteElement &test_fe)
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)
VectorInnerProductInterpolator(VectorCoefficient &vc)
MixedWeakDivCrossIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
FaceType
Definition: mesh.hpp:45
virtual void AddMultMF(const Vector &, Vector &) const
virtual const char * FiniteElementTypeFailureMessage() const
VectorDiffusionIntegrator(MatrixCoefficient &mq)
Integrator with MatrixCoefficient. The vector dimension of the FiniteElementSpace is assumed to be th...
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
VectorDivergenceIntegrator(Coefficient &q)
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:229
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
VectorFEMassIntegrator(SymmetricMatrixCoefficient &smq)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
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
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
Definition: bilininteg.cpp:236
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
MixedScalarWeakCurlIntegrator(Coefficient &q)
Definition: bilininteg.hpp:952
MixedCurlCurlIntegrator(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:785
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:245
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
DGTraceIntegrator(VectorCoefficient &u_, double a)
Construct integrator with rho = 1, b = 0.5*a.
virtual const char * FiniteElementTypeFailureMessage() const
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
Definition: bilininteg.cpp:349
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
TransposeIntegrator(BilinearFormIntegrator *bfi_, int own_bfi_=1)
Definition: bilininteg.hpp:261
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
Definition: bilininteg.hpp:177
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
MixedVectorWeakCurlIntegrator(DiagonalMatrixCoefficient &dq)
VectorFEDivergenceIntegrator(Coefficient &q)
constexpr int HCURL_MAX_D1D
Definition: bilininteg.hpp:23
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Definition: nonlininteg.cpp:25
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AddMultMF(const Vector &, Vector &) const
virtual void AddMultMF(const Vector &x, Vector &y) const
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
VectorFEMassIntegrator(MatrixCoefficient *mq_)
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 CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape_)
Definition: bilininteg.hpp:655
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:542
MixedVectorMassIntegrator(MatrixCoefficient &mq)
Definition: bilininteg.hpp:992
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:781
MixedVectorIntegrator(MatrixCoefficient &mq)
Definition: bilininteg.hpp:531
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
Definition: bilininteg.cpp:401
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:557
MixedVectorMassIntegrator(Coefficient &q)
Definition: bilininteg.hpp:988
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_base.cpp:191
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedDirectionalDerivativeIntegrator(VectorCoefficient &vq)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
DiagonalMatrixCoefficient * DQ
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
MixedCrossGradIntegrator(VectorCoefficient &vq)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:838
GradientIntegrator(Coefficient *q_)
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
ScalarProductInterpolator(Coefficient &sc)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
Definition: bilininteg.cpp:333
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:956
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
ConservativeConvectionIntegrator(VectorCoefficient &q, double a=1.0)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
Definition: bilininteg.cpp:341
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
MixedVectorCurlIntegrator(MatrixCoefficient &mq)
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
Definition: bilininteg.cpp:36
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:972
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:793
int GetVDim() const
Returns the vector dimension for vector-valued finite elements.
Definition: fe_base.hpp:314
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.
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
Definition: bilininteg.hpp:939
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:955
MixedWeakGradDotIntegrator(VectorCoefficient &vq)
ScalarVectorProductInterpolator(Coefficient &sc)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
Definition: bilininteg.hpp:843
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
Definition: bilininteg.hpp:303
Abstract base class BilinearFormIntegrator.
Definition: bilininteg.hpp:34
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:565
const GeometricFactors * geom
Not owned.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
MixedVectorIntegrator(Coefficient &q)
Definition: bilininteg.hpp:526
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:965
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)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:88
MixedScalarWeakCurlCrossIntegrator(VectorCoefficient &vq)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:900
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
void PrecomputeMassInverse(class FiniteElementSpace &fes)
Precomputes the inverses (LU factorizations) of the local mass matrices.
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:821
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:606
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:293
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_base.cpp:181
virtual const char * FiniteElementTypeFailureMessage() const
virtual int GetTrialVDim(const FiniteElement &trial_fe)
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 AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:871
DGDiffusionIntegrator(const double s, const double k)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe)
virtual int GetTestVDim(const FiniteElement &test_fe)
MixedCrossGradCurlIntegrator(VectorCoefficient &vq)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:258
MixedVectorDivergenceIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:817
Structure representing the matrices/tensors needed to evaluate (in reference space) the values...
Definition: fe_base.hpp:136
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
virtual int GetTestVDim(const FiniteElement &test_fe)
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
Polynomials of order k.
Definition: fe_base.hpp:223
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
VectorFEMassIntegrator(DiagonalMatrixCoefficient &dq)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:468
int GetVDim(const FiniteElement &vector_fe)
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.
virtual void AddMultMF(const Vector &x, Vector &y) const
Definition: bilininteg.cpp:357
MixedCrossGradGradIntegrator(VectorCoefficient &vq)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:800
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedScalarCrossCurlIntegrator(VectorCoefficient &vq)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
MatrixCoefficient * MQ
Definition: bilininteg.hpp:574
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Assemble an element matrix.
MixedCurlCurlIntegrator(DiagonalMatrixCoefficient &dq)
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:868
virtual const char * FiniteElementTypeFailureMessage() const
SymmetricMatrixCoefficient * SMQ
virtual const char * FiniteElementTypeFailureMessage() const
VectorMassIntegrator(Coefficient &q, int qo=0)
DGElasticityIntegrator(double alpha_, double kappa_)
MixedScalarDerivativeIntegrator(Coefficient &q)
Definition: bilininteg.hpp:708
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
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.
MixedDotProductIntegrator(VectorCoefficient &vq)
CurlCurlIntegrator(DiagonalMatrixCoefficient &dq, const IntegrationRule *ir=NULL)
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:875
MixedVectorCurlIntegrator(Coefficient &q)
virtual void AddMultMF(const Vector &, Vector &) const
VectorCoefficient * VQ
MixedVectorIntegrator(VectorCoefficient &vq, bool diag=true)
Definition: bilininteg.hpp:528
const GeometricFactors * geom
Not owned.
This class is used to express the local action of a general nonlinear finite element operator...
Definition: nonlininteg.hpp:27
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
Base class for symmetric matrix coefficients that optionally depend on time and space.
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:756
CurlCurlIntegrator(SymmetricMatrixCoefficient &smq, const IntegrationRule *ir=NULL)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
LumpedIntegrator(BilinearFormIntegrator *bfi_, int own_bfi_=1)
Definition: bilininteg.hpp:330
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Implements CalcDivShape methods.
Definition: fe_base.hpp:296
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
int dim
Definition: ex24.cpp:53
SymmetricMatrixCoefficient * SMQ
int GetVDim(const FiniteElement &vector_fe)
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)
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
Definition: bilininteg.hpp:938
virtual int GetTrialVDim(const FiniteElement &trial_fe)
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:481
virtual int GetVDim(const FiniteElement &vector_fe)
virtual int GetVDim(const FiniteElement &vector_fe)
Definition: bilininteg.hpp:652
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
VectorMassIntegrator(MatrixCoefficient &q, int qo=0)
Construct an integrator with matrix coefficient q.
MixedScalarWeakCrossProductIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
VectorFEMassIntegrator(Coefficient *q_)
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:548
GroupConvectionIntegrator(VectorCoefficient &q, double a=1.0)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
DiagonalMatrixCoefficient * DQ
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
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 int GetTrialVDim(const FiniteElement &trial_fe)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual ~SumIntegrator()
Definition: bilininteg.cpp:411
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 int GetTestVDim(const FiniteElement &test_fe)
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:721
constexpr int HDIV_MAX_Q1D
Definition: bilininteg.hpp:31
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:921
bool symmetric
False if using a nonsymmetric matrix coefficient.
virtual void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat)
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 int GetTrialVDim(const FiniteElement &trial_fe)
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:182
MixedCrossCurlIntegrator(VectorCoefficient &vq)
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
Vector data type.
Definition: vector.hpp:60
virtual int GetTrialVDim(const FiniteElement &trial_fe)
int GetDerivType() const
Returns the FiniteElement::DerivType of the element describing the spatial derivative method implemen...
Definition: fe_base.hpp:355
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual const char * FiniteElementTypeFailureMessage() const
Definition: bilininteg.hpp:829
MixedVectorProductIntegrator(VectorCoefficient &vq)
Definition: bilininteg.hpp:698
VectorScalarProductInterpolator(VectorCoefficient &vc)
virtual const char * FiniteElementTypeFailureMessage() const
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
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:896
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:217
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
VectorDiffusionIntegrator(VectorCoefficient &vq)
Integrator with VectorCoefficient. The vector dimension of the FiniteElementSpace is assumed to be th...
RefCoord s[3]
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)
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
Definition: bilininteg.cpp:381
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.cpp:786
VectorDiffusionIntegrator(Coefficient &q, const IntegrationRule *ir)
double u(const Vector &xvec)
Definition: lor_mms.hpp:24
Implements CalcDShape methods.
Definition: fe_base.hpp:295
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add)
Definition: bilininteg.cpp:390
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
Definition: bilininteg.cpp:325
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
Setup method for PA data.
MixedGradGradIntegrator(Coefficient &q)
MixedVectorGradientIntegrator(MatrixCoefficient &mq)
CurlCurlIntegrator(MatrixCoefficient &mq, const IntegrationRule *ir=NULL)
virtual int GetVDim(const FiniteElement &vector_fe)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
VectorFEMassIntegrator(DiagonalMatrixCoefficient *dq_)
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_base.hpp:340
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:805
MixedVectorCurlIntegrator(DiagonalMatrixCoefficient &dq)
constexpr int HCURL_MAX_Q1D
Definition: bilininteg.hpp:25
virtual int GetTrialVDim(const FiniteElement &trial_fe)
Definition: bilininteg.hpp:562
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:298
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Definition: bilininteg.cpp:797
VectorDivergenceIntegrator(Coefficient *q_)
virtual const char * FiniteElementTypeFailureMessage() const
DiffusionIntegrator(MatrixCoefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a matrix coefficient q.
DiffusionIntegrator(const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with coefficient Q = 1.
virtual const char * FiniteElementTypeFailureMessage() const
MassIntegrator(const IntegrationRule *ir=NULL)
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
Definition: bilininteg.cpp:178
MixedVectorGradientIntegrator(DiagonalMatrixCoefficient &dq)
MixedVectorMassIntegrator(DiagonalMatrixCoefficient &dq)
Definition: bilininteg.hpp:990
const GeometricFactors * geom
Not owned.
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
Definition: bilininteg.hpp:474
virtual double ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
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
MixedDivGradIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
Definition: bilininteg.hpp:712
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:916
MixedScalarIntegrator(Coefficient &q)
Definition: bilininteg.hpp:458
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:350
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:617
Implements CalcCurlShape methods.
Definition: fe_base.hpp:297
const DofToQuad * maps
Not owned.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
VectorCoefficient * Q
alpha (q . grad u, v)