MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
bilininteg.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, 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"
19#include "qfunction.hpp"
20#include <memory>
21
22#include "kernel_dispatch.hpp"
23
24namespace mfem
25{
26
27/// Abstract base class BilinearFormIntegrator
29{
30protected:
33
34public:
35 // TODO: add support for other assembly levels (in addition to PA) and their
36 // actions.
37
38 // TODO: for mixed meshes the quadrature rules to be used by methods like
39 // AssemblePA() can be given as a QuadratureSpace, e.g. using a new method:
40 // SetQuadratureSpace().
41
42 // TODO: the methods for the various assembly levels make sense even in the
43 // base class NonlinearFormIntegrator, except that not all assembly levels
44 // make sense for the action of the nonlinear operator (but they all make
45 // sense for its Jacobian).
46
47 /// Method defining partial assembly.
48 /** The result of the partial assembly is stored internally so that it can be
49 used later in the methods AddMultPA() and AddMultTransposePA(). */
50 void AssemblePA(const FiniteElementSpace &fes) override;
51 /** Used with BilinearFormIntegrators that have different spaces. */
52 void AssemblePA(const FiniteElementSpace &trial_fes,
53 const FiniteElementSpace &test_fes) override;
54
55 /// Method defining partial assembly on NURBS patches.
56 /** The result of the partial assembly is stored internally so that it can be
57 used later in the method AddMultNURBSPA(). */
58 virtual void AssembleNURBSPA(const FiniteElementSpace &fes);
59
60 virtual void AssemblePABoundary(const FiniteElementSpace &fes);
61
62 virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
63
64 virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
65
66 /// Assemble diagonal and add it to Vector @a diag.
67 virtual void AssembleDiagonalPA(Vector &diag);
68
69 /// Assemble diagonal of $A D A^T$ ($A$ is this integrator) and add it to @a diag.
70 virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
71
72 /// Method for partially assembled action.
73 /** Perform the action of integrator on the input @a x and add the result to
74 the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
75 the element-wise discontinuous version of the FE space.
76
77 This method can be called only after the method AssemblePA() has been
78 called. */
79 void AddMultPA(const Vector &x, Vector &y) const override;
80
81 /// Method for partially assembled action on NURBS patches.
82 virtual void AddMultNURBSPA(const Vector&x, Vector&y) const;
83
84 /// Method for partially assembled transposed action.
85 /** Perform the transpose action of integrator on the input @a x and add the
86 result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
87 represent the element-wise discontinuous version of the FE space.
88
89 This method can be called only after the method AssemblePA() has been
90 called. */
91 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
92
93 /// Method defining element assembly.
94 /** The result of the element assembly is added to the @a emat Vector if
95 @a add is true. Otherwise, if @a add is false, we set @a emat. */
96 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
97 const bool add = true);
98 /** Used with BilinearFormIntegrators that have different spaces. */
99 // virtual void AssembleEA(const FiniteElementSpace &trial_fes,
100 // const FiniteElementSpace &test_fes,
101 // Vector &emat);
102
103 /// Method defining matrix-free assembly.
104 /** The result of fully matrix-free assembly is stored internally so that it
105 can be used later in the methods AddMultMF() and AddMultTransposeMF(). */
106 void AssembleMF(const FiniteElementSpace &fes) override;
107
108 /** Perform the action of integrator on the input @a x and add the result to
109 the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
110 the element-wise discontinuous version of the FE space.
111
112 This method can be called only after the method AssembleMF() has been
113 called. */
114 void AddMultMF(const Vector &x, Vector &y) const override;
115
116 /** Perform the transpose action of integrator on the input @a x and add the
117 result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
118 represent the element-wise discontinuous version of the FE space.
119
120 This method can be called only after the method AssemblePA() has been
121 called. */
122 virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
123
124 /// Assemble diagonal and add it to Vector @a diag.
125 virtual void AssembleDiagonalMF(Vector &diag);
126
127 virtual void AssembleEABoundary(const FiniteElementSpace &fes,
128 Vector &ea_data_bdr,
129 const bool add = true);
130
131 virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
132 Vector &ea_data_int,
133 Vector &ea_data_ext,
134 const bool add = true);
135
136 /// @brief Method defining element assembly for mixed trace integrators.
137 ///
138 /// This is the element assembly analogue of AssembleFaceMatrix(const
139 /// FiniteElement&, const FiniteElement&, const FiniteElement&,
140 /// FaceElementTransformations&, DenseMatrix&).
141 virtual void AssembleEAInteriorFaces(const FiniteElementSpace &trial_fes,
142 const FiniteElementSpace &test_fes,
143 Vector &emat,
144 const bool add = true);
145
146 virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
147 Vector &ea_data_bdr,
148 const bool add = true);
149
150 /// Given a particular Finite Element computes the element matrix elmat.
151 virtual void AssembleElementMatrix(const FiniteElement &el,
153 DenseMatrix &elmat);
154
155 /** Compute the local matrix representation of a bilinear form
156 $a(u,v)$ defined on different trial (given by $u$) and test
157 (given by $v$) spaces. The rows in the local matrix correspond
158 to the test dofs and the columns -- to the trial dofs. */
159 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
160 const FiniteElement &test_fe,
162 DenseMatrix &elmat);
163
164 /** Given a particular NURBS patch, computes the patch matrix as a
165 SparseMatrix @a smat.
166 */
167 virtual void AssemblePatchMatrix(const int patch,
168 const FiniteElementSpace &fes,
169 SparseMatrix*& smat);
170
171 virtual void AssembleFaceMatrix(const FiniteElement &el1,
172 const FiniteElement &el2,
174 DenseMatrix &elmat);
175
176 virtual void AssembleFaceMatrix(const FiniteElement &trial_fe1,
177 const FiniteElement &test_fe1,
178 const FiniteElement &trial_fe2,
179 const FiniteElement &test_fe2,
181 DenseMatrix &elmat);
182
183 /** Abstract method used for assembling TraceFaceIntegrators in a
184 MixedBilinearForm. */
185 virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
186 const FiniteElement &test_fe1,
187 const FiniteElement &test_fe2,
189 DenseMatrix &elmat);
190
191 /** Abstract method used for assembling TraceFaceIntegrators for
192 DPG weak formulations. */
193 virtual void AssembleTraceFaceMatrix(int elem,
194 const FiniteElement &trial_face_fe,
195 const FiniteElement &test_fe,
197 DenseMatrix &elmat);
198
199
200 /// @brief Perform the local action of the BilinearFormIntegrator.
201 /// Note that the default implementation in the base class is general but not
202 /// efficient.
205 const Vector &elfun, Vector &elvect) override;
206
207 /// @brief Perform the local action of the BilinearFormIntegrator resulting
208 /// from a face integral term.
209 /// Note that the default implementation in the base class is general but not
210 /// efficient.
211 void AssembleFaceVector(const FiniteElement &el1,
212 const FiniteElement &el2,
214 const Vector &elfun, Vector &elvect) override;
215
218 const Vector &elfun, DenseMatrix &elmat) override
219 { AssembleElementMatrix(el, Tr, elmat); }
220
222 const FiniteElement &el2,
224 const Vector &elfun, DenseMatrix &elmat) override
225 { AssembleFaceMatrix(el1, el2, Tr, elmat); }
226
227 /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
228
229 The purpose of the method is to compute a local "flux" finite element
230 function given a local finite element solution. The "flux" function has
231 to be computed in terms of its coefficients (represented by the Vector
232 @a flux) which multiply the basis functions defined by the FiniteElement
233 @a fluxelem. Typically, the "flux" function will have more than one
234 component and consequently @a flux should be store the coefficients of
235 all components: first all coefficient for component 0, then all
236 coefficients for component 1, etc. What the "flux" function represents
237 depends on the specific integrator. For example, in the case of
238 DiffusionIntegrator, the flux is the gradient of the solution multiplied
239 by the diffusion coefficient.
240
241 @param[in] el FiniteElement of the solution.
242 @param[in] Trans The ElementTransformation describing the physical
243 position of the mesh element.
244 @param[in] u Solution coefficients representing the expansion of the
245 solution function in the basis of @a el.
246 @param[in] fluxelem FiniteElement of the "flux".
247 @param[out] flux "Flux" coefficients representing the expansion of the
248 "flux" function in the basis of @a fluxelem. The size
249 of @a flux as a Vector has to be set by this method,
250 e.g. using Vector::SetSize().
251 @param[in] with_coef If zero (the default value is 1) the implementation
252 of the method may choose not to scale the "flux"
253 function by any coefficients describing the
254 integrator.
255 @param[in] ir If passed (the default value is NULL), the implementation
256 of the method will ignore the integration rule provided
257 by the @a fluxelem parameter and, instead, compute the
258 discrete flux at the points specified by the integration
259 rule @a ir.
260 */
261 virtual void ComputeElementFlux(const FiniteElement &el,
263 Vector &u,
264 const FiniteElement &fluxelem,
265 Vector &flux, bool with_coef = true,
266 const IntegrationRule *ir = NULL) { }
267
268 /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
269
270 The purpose of this method is to compute a local number that measures the
271 energy of a given "flux" function (see ComputeElementFlux() for a
272 description of the "flux" function). Typically, the energy of a "flux"
273 function should be equal to a_local(u,u), if the "flux" is defined from
274 a solution u; here a_local(.,.) denotes the element-local bilinear
275 form represented by the integrator.
276
277 @param[in] fluxelem FiniteElement of the "flux".
278 @param[in] Trans The ElementTransformation describing the physical
279 position of the mesh element.
280 @param[in] flux "Flux" coefficients representing the expansion of the
281 "flux" function in the basis of @a fluxelem.
282 @param[out] d_energy If not NULL, the given Vector should be set to
283 represent directional energy split that can be used
284 for anisotropic error estimation.
285 @returns The computed energy.
286 */
287 virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
289 Vector &flux, Vector *d_energy = NULL)
290 { return 0.0; }
291
292 /** @brief For bilinear forms on element faces, specifies if the normal
293 derivatives are needed on the faces or just the face restriction.
294
295 @details if RequiresFaceNormalDerivatives() == true, then
296 AddMultPAFaceNormalDerivatives(...) should be invoked in place
297 of AddMultPA(...) and L2NormalDerivativeFaceRestriction should
298 be used to compute the normal derivatives. This is used for some
299 DG integrators, for example DGDiffusionIntegrator.
300
301 @returns whether normal derivatives appear in the bilinear form.
302 */
303 virtual bool RequiresFaceNormalDerivatives() const { return false; }
304
305 /// Method for partially assembled action.
306 /** @brief For bilinear forms on element faces that depend on the normal
307 derivative on the faces, computes the action of integrator to the
308 face values @a x and reference-normal derivatives @a dxdn and adds
309 the result to @a y and @a dydn.
310
311 @details This method can be called only after the method AssemblePA() has
312 been called.
313
314 @param[in] x E-vector of face values (provided by
315 FaceRestriction::Mult)
316 @param[in] dxdn E-vector of face reference-normal derivatives
317 (provided by FaceRestriction::NormalDerivativeMult)
318 @param[in,out] y E-vector of face values to add action to.
319 @param[in,out] dydn E-vector of face reference-normal derivative values to
320 add action to.
321 */
322 virtual void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn,
323 Vector &y, Vector &dydn) const;
324
326};
327
328/** Wraps a given @a BilinearFormIntegrator and transposes the resulting element
329 matrices. See for example ex9, ex9p. */
331{
332private:
333 int own_bfi;
335
336 DenseMatrix bfi_elmat;
337
338public:
340 { bfi = bfi_; own_bfi = own_bfi_; }
341
342 void SetIntRule(const IntegrationRule *ir) override;
343
346 DenseMatrix &elmat) override;
347
348 void AssembleElementMatrix2(const FiniteElement &trial_fe,
349 const FiniteElement &test_fe,
351 DenseMatrix &elmat) override;
352
354 void AssembleFaceMatrix(const FiniteElement &el1,
355 const FiniteElement &el2,
357 DenseMatrix &elmat) override;
358
359 void AssembleFaceMatrix(const FiniteElement &trial_fe1,
360 const FiniteElement &test_fe1,
361 const FiniteElement &trial_fe2,
362 const FiniteElement &test_fe2,
364 DenseMatrix &elmat) override;
365
366 void AssemblePA(const FiniteElementSpace& fes) override
367 {
368 bfi->AssemblePA(fes);
369 }
370
371 void AssemblePA(const FiniteElementSpace &trial_fes,
372 const FiniteElementSpace &test_fes) override
373 {
374 bfi->AssemblePA(test_fes, trial_fes); // Reverse test and trial
375 }
376
378 {
379 bfi->AssemblePAInteriorFaces(fes);
380 }
381
383 {
384 bfi->AssemblePABoundaryFaces(fes);
385 }
386
387 void AddMultTransposePA(const Vector &x, Vector &y) const override
388 {
389 bfi->AddMultPA(x, y);
390 }
391
392 void AddMultPA(const Vector& x, Vector& y) const override
393 {
394 bfi->AddMultTransposePA(x, y);
395 }
396
397 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
398 const bool add) override;
399
402 Vector &ea_data_int,
403 Vector &ea_data_ext,
404 const bool add) override;
405
407 Vector &ea_data_bdr,
408 const bool add) override;
409
410 virtual ~TransposeIntegrator() { if (own_bfi) { delete bfi; } }
411};
412
414{
415private:
416 int own_bfi;
418
419public:
420 LumpedIntegrator (BilinearFormIntegrator *bfi_, int own_bfi_ = 1)
421 { bfi = bfi_; own_bfi = own_bfi_; }
422
423 void SetIntRule(const IntegrationRule *ir) override;
424
427 DenseMatrix &elmat) override;
428
429 virtual ~LumpedIntegrator() { if (own_bfi) { delete bfi; } }
430};
431
432/// Integrator that inverts the matrix assembled by another integrator.
434{
435private:
436 int own_integrator;
437 BilinearFormIntegrator *integrator;
438
439public:
440 InverseIntegrator(BilinearFormIntegrator *integ, int own_integ = 1)
441 { integrator = integ; own_integrator = own_integ; }
442
443 void SetIntRule(const IntegrationRule *ir) override;
444
447 DenseMatrix &elmat) override;
448
449 virtual ~InverseIntegrator() { if (own_integrator) { delete integrator; } }
450};
451
452/// Integrator defining a sum of multiple Integrators.
454{
455private:
456 int own_integrators;
457 mutable DenseMatrix elem_mat;
459
460public:
461 SumIntegrator(int own_integs = 1) { own_integrators = own_integs; }
462
463 void SetIntRule(const IntegrationRule *ir) override;
464
466 { integrators.Append(integ); }
467
470 DenseMatrix &elmat) override;
471 void AssembleElementMatrix2(const FiniteElement &trial_fe,
472 const FiniteElement &test_fe,
474 DenseMatrix &elmat) override;
475
477 void AssembleFaceMatrix(const FiniteElement &el1,
478 const FiniteElement &el2,
480 DenseMatrix &elmat) override;
481
482 void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
483 const FiniteElement &test_fe1,
484 const FiniteElement &test_fe2,
486 DenseMatrix &elmat) override;
487
489 void AssemblePA(const FiniteElementSpace& fes) override;
490
491 void AssembleDiagonalPA(Vector &diag) override;
492
493 void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override;
494
495 void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override;
496
497 void AddMultTransposePA(const Vector &x, Vector &y) const override;
498
499 void AddMultPA(const Vector& x, Vector& y) const override;
500
501 void AssembleMF(const FiniteElementSpace &fes) override;
502
503 void AddMultMF(const Vector &x, Vector &y) const override;
504
505 void AddMultTransposeMF(const Vector &x, Vector &y) const override;
506
507 void AssembleDiagonalMF(Vector &diag) override;
508
509 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
510 const bool add) override;
511
514 Vector &ea_data_int,
515 Vector &ea_data_ext,
516 const bool add) override;
517
519 Vector &ea_data_bdr,
520 const bool add) override;
521
522 virtual ~SumIntegrator();
523};
524
525/** An abstract class for integrating the product of two scalar basis functions
526 with an optional scalar coefficient. */
528{
529public:
530 void AssembleElementMatrix2(const FiniteElement &trial_fe,
531 const FiniteElement &test_fe,
533 DenseMatrix &elmat) override;
534
535 /// Support for use in BilinearForm. Can be used only when appropriate.
538 DenseMatrix &elmat) override
539 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
540
541protected:
542 /// This parameter can be set by derived methods to enable single shape
543 /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
544 /// result if given the same FiniteElement. The default is false.
546
549
550 inline virtual bool VerifyFiniteElementTypes(
551 const FiniteElement & trial_fe,
552 const FiniteElement & test_fe) const
553 {
554 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
556 }
557
558 inline virtual const char * FiniteElementTypeFailureMessage() const
559 {
560 return "MixedScalarIntegrator: "
561 "Trial and test spaces must both be scalar fields.";
562 }
563
564 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
565 const FiniteElement & test_fe,
567 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
568
569
570 inline virtual void CalcTestShape(const FiniteElement & test_fe,
572 Vector & shape)
573 { test_fe.CalcPhysShape(Trans, shape); }
574
575 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
577 Vector & shape)
578 { trial_fe.CalcPhysShape(Trans, shape); }
579
581
582private:
583
584#ifndef MFEM_THREAD_SAFE
585 Vector test_shape;
586 Vector trial_shape;
587#endif
588
589};
590
591/** An abstract class for integrating the inner product of two vector basis
592 functions with an optional scalar, vector, or matrix coefficient. */
594{
595public:
596
597 void AssembleElementMatrix2(const FiniteElement &trial_fe,
598 const FiniteElement &test_fe,
600 DenseMatrix &elmat) override;
601
602 /// Support for use in BilinearForm. Can be used only when appropriate.
605 DenseMatrix &elmat) override
606 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
607
608protected:
609 /// This parameter can be set by derived methods to enable single shape
610 /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
611 /// result if given the same FiniteElement. The default is false.
613
615 : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(NULL) {}
617 : same_calc_shape(false), Q(&q), VQ(NULL), DQ(NULL), MQ(NULL) {}
619 : same_calc_shape(false), Q(NULL), VQ(diag?NULL:&vq), DQ(diag?&vq:NULL),
620 MQ(NULL) {}
622 : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(&mq) {}
623
624 inline virtual bool VerifyFiniteElementTypes(
625 const FiniteElement & trial_fe,
626 const FiniteElement & test_fe) const
627 {
628 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
630 }
631
632 inline virtual const char * FiniteElementTypeFailureMessage() const
633 {
634 return "MixedVectorIntegrator: "
635 "Trial and test spaces must both be vector fields";
636 }
637
638 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
639 const FiniteElement & test_fe,
641 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
642
643
644 inline virtual int GetTestVDim(const FiniteElement & test_fe)
645 { return std::max(space_dim, test_fe.GetRangeDim()); }
646
647 inline virtual void CalcTestShape(const FiniteElement & test_fe,
649 DenseMatrix & shape)
650 { test_fe.CalcVShape(Trans, shape); }
651
652 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
653 { return std::max(space_dim, trial_fe.GetRangeDim()); }
654
655 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
657 DenseMatrix & shape)
658 { trial_fe.CalcVShape(Trans, shape); }
659
665
666private:
667
668#ifndef MFEM_THREAD_SAFE
669 Vector V;
670 Vector D;
671 DenseMatrix M;
672 DenseMatrix test_shape;
673 DenseMatrix trial_shape;
674 DenseMatrix shape_tmp;
675#endif
676
677};
678
679/** An abstract class for integrating the product of a scalar basis function and
680 the inner product of a vector basis function with a vector coefficient. In
681 2D the inner product can be replaced with a cross product. */
683{
684public:
685
686 void AssembleElementMatrix2(const FiniteElement &trial_fe,
687 const FiniteElement &test_fe,
689 DenseMatrix &elmat) override;
690
691 /// Support for use in BilinearForm. Can be used only when appropriate.
692 /** Appropriate use cases are classes derived from
693 MixedScalarVectorIntegrator where the trial and test spaces can be the
694 same. Examples of such classes are: MixedVectorDivergenceIntegrator,
695 MixedScalarWeakDivergenceIntegrator, etc. */
698 DenseMatrix &elmat) override
699 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
700
701protected:
702
703 MixedScalarVectorIntegrator(VectorCoefficient &vq, bool transpose_ = false,
704 bool cross_2d_ = false)
705 : VQ(&vq), transpose(transpose_), cross_2d(cross_2d_) {}
706
707 inline virtual bool VerifyFiniteElementTypes(
708 const FiniteElement & trial_fe,
709 const FiniteElement & test_fe) const
710 {
711 return ((transpose &&
714 (!transpose &&
717 );
718 }
719
720 inline virtual const char * FiniteElementTypeFailureMessage() const
721 {
722 if ( transpose )
723 {
724 return "MixedScalarVectorIntegrator: "
725 "Trial space must be a vector field "
726 "and the test space must be a scalar field";
727 }
728 else
729 {
730 return "MixedScalarVectorIntegrator: "
731 "Trial space must be a scalar field "
732 "and the test space must be a vector field";
733 }
734 }
735
736 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
737 const FiniteElement & test_fe,
739 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
740
741
742 inline virtual int GetVDim(const FiniteElement & vector_fe)
743 { return std::max(space_dim, vector_fe.GetRangeDim()); }
744
745 inline virtual void CalcVShape(const FiniteElement & vector_fe,
747 DenseMatrix & shape_)
748 { vector_fe.CalcVShape(Trans, shape_); }
749
750 inline virtual void CalcShape(const FiniteElement & scalar_fe,
752 Vector & shape_)
753 { scalar_fe.CalcPhysShape(Trans, shape_); }
754
758 bool cross_2d; // In 2D use a cross product rather than a dot product
759
760private:
761
762#ifndef MFEM_THREAD_SAFE
763 Vector V;
764 DenseMatrix vshape;
765 Vector shape;
766 Vector vshape_tmp;
767#endif
768
769};
770
771/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$ in either 1D, 2D,
772 or 3D and where $Q$ is an optional scalar coefficient, $u$ and $v$ are each in $H^1$
773 or $L_2$. */
781
782/** Class for integrating the bilinear form $a(u,v) := (\vec{V} u, v)$ in either 2D, or
783 3D and where $\vec{V}$ is a vector coefficient, $u$ is in $H^1$ or $L_2$ and $v$ is in $H(curl$
784 or $H(div)$. */
791
792/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ in 1D where Q
793 is an optional scalar coefficient, $u$ is in $H^1$, and $v$ is in $L_2$. */
795{
796public:
800
801protected:
802 inline virtual bool VerifyFiniteElementTypes(
803 const FiniteElement & trial_fe,
804 const FiniteElement & test_fe) const
805 {
806 return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
809 }
810
811 inline virtual const char * FiniteElementTypeFailureMessage() const
812 {
813 return "MixedScalarDerivativeIntegrator: "
814 "Trial and test spaces must both be scalar fields in 1D "
815 "and the trial space must implement CalcDShape.";
816 }
817
818 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
820 Vector & shape)
821 {
822 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
823 trial_fe.CalcPhysDShape(Trans, dshape);
824 }
825};
826
827/** Class for integrating the bilinear form $a(u,v) := -(Q u, \nabla v)$ in 1D where $Q$
828 is an optional scalar coefficient, $u$ is in $L_2$, and $v$ is in $H^1$. */
830{
831public:
835
836protected:
837 inline virtual bool VerifyFiniteElementTypes(
838 const FiniteElement & trial_fe,
839 const FiniteElement & test_fe) const
840 {
841 return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
844 }
845
846 inline virtual const char * FiniteElementTypeFailureMessage() const
847 {
848 return "MixedScalarWeakDerivativeIntegrator: "
849 "Trial and test spaces must both be scalar fields in 1D "
850 "and the test space must implement CalcDShape with "
851 "map type \"VALUE\".";
852 }
853
854 inline virtual void CalcTestShape(const FiniteElement & test_fe,
856 Vector & shape)
857 {
858 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
859 test_fe.CalcPhysDShape(Trans, dshape);
860 shape *= -1.0;
861 }
862};
863
864/** Class for integrating the bilinear form $a(u,v) := (Q \nabla \cdot u, v)$ in either 2D
865 or 3D where $Q$ is an optional scalar coefficient, $u$ is in $H(div)$, and $v$ is a
866 scalar field. */
868{
869public:
873
874protected:
875 inline virtual bool VerifyFiniteElementTypes(
876 const FiniteElement & trial_fe,
877 const FiniteElement & test_fe) const
878 {
879 return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
881 }
882
883 inline virtual const char * FiniteElementTypeFailureMessage() const
884 {
885 return "MixedScalarDivergenceIntegrator: "
886 "Trial must be $H(div)$ and the test space must be a "
887 "scalar field";
888 }
889
890 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
891 const FiniteElement & test_fe,
893 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
894
895 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
897 Vector & shape)
898 { trial_fe.CalcPhysDivShape(Trans, shape); }
899};
900
901/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \nabla \cdot u, v)$ in either 2D
902 or 3D where $\vec{V}$ is a vector coefficient, $u$ is in $H(div)$, and $v$ is in $H(div)$. */
904{
905public:
908
909protected:
910 inline virtual bool VerifyFiniteElementTypes(
911 const FiniteElement & trial_fe,
912 const FiniteElement & test_fe) const
913 {
914 return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
916 }
917
918 inline virtual const char * FiniteElementTypeFailureMessage() const
919 {
920 return "MixedVectorDivergenceIntegrator: "
921 "Trial must be H(Div) and the test space must be a "
922 "vector field";
923 }
924
925 // Subtract one due to the divergence and add one for the coefficient
926 // which is assumed to be at least linear.
927 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
928 const FiniteElement & test_fe,
930 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
931
932 inline virtual void CalcShape(const FiniteElement & scalar_fe,
934 Vector & shape)
935 { scalar_fe.CalcPhysDivShape(Trans, shape); }
936};
937
938/** Class for integrating the bilinear form $a(u,v) := -(Q u, \nabla \cdot v)$ in either 2D
939 or 3D where $Q$ is an optional scalar coefficient, $u$ is in $L_2$ or $H^1$, and $v$ is
940 in $H(div)$. */
942{
943public:
947
948protected:
949 inline virtual bool VerifyFiniteElementTypes(
950 const FiniteElement & trial_fe,
951 const FiniteElement & test_fe) const
952 {
953 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
955 }
956
957 inline virtual const char * FiniteElementTypeFailureMessage() const
958 {
959 return "MixedScalarWeakGradientIntegrator: "
960 "Trial space must be a scalar field "
961 "and the test space must be H(Div)";
962 }
963
964 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
965 const FiniteElement & test_fe,
967 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
968
969 virtual void CalcTestShape(const FiniteElement & test_fe,
971 Vector & shape)
972 {
973 test_fe.CalcPhysDivShape(Trans, shape);
974 shape *= -1.0;
975 }
976};
977
978/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ in 2D where
979 $Q$ is an optional scalar coefficient, $u$ is in $H(curl$, and $v$ is in $L_2$ or
980 $H^1$. */
982{
983public:
987
988protected:
990 const FiniteElement & trial_fe,
991 const FiniteElement & test_fe) const override
992 {
993 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
996 }
997
998 inline const char * FiniteElementTypeFailureMessage() const override
999 {
1000 return "MixedScalarCurlIntegrator: "
1001 "Trial must be H(Curl) and the test space must be a "
1002 "scalar field";
1003 }
1004
1005 inline int GetIntegrationOrder(const FiniteElement & trial_fe,
1006 const FiniteElement & test_fe,
1007 ElementTransformation &Trans) override
1008 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
1009
1010 inline void CalcTrialShape(const FiniteElement & trial_fe,
1011 ElementTransformation &Trans,
1012 Vector & shape) override
1013 {
1014 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1015 trial_fe.CalcPhysCurlShape(Trans, dshape);
1016 }
1017
1019 void AssemblePA(const FiniteElementSpace &trial_fes,
1020 const FiniteElementSpace &test_fes) override;
1021
1022 void AddMultPA(const Vector&, Vector&) const override;
1023 void AddMultTransposePA(const Vector &x, Vector &y) const override;
1024
1025 // PA extension
1027 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1028 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1030};
1031
1032/** Class for integrating the bilinear form $a(u,v) := (Q u, \mathrm{curl}(v))$ in 2D where
1033 $Q$ is an optional scalar coefficient, $u$ is in $L_2$ or $H^1$, and $v$ is in
1034 $H(curl$. Partial assembly (PA) is supported but could be further optimized
1035 by using more efficient threading and shared memory.
1036*/
1038{
1039public:
1043
1044protected:
1045 inline virtual bool VerifyFiniteElementTypes(
1046 const FiniteElement & trial_fe,
1047 const FiniteElement & test_fe) const
1048 {
1049 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1052 }
1053
1054 inline virtual const char * FiniteElementTypeFailureMessage() const
1055 {
1056 return "MixedScalarWeakCurlIntegrator: "
1057 "Trial space must be a scalar field "
1058 "and the test space must be H(Curl)";
1059 }
1060
1061 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1062 ElementTransformation &Trans,
1063 Vector & shape)
1064 {
1065 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1066 test_fe.CalcPhysCurlShape(Trans, dshape);
1067 }
1068};
1069
1070/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$ in either 2D or
1071 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
1072 diagonal matrix) $u$ and $v$ are each in $H(curl$ or $H(div)$. */
1084
1085/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, v)$ in 3D and where
1086 $\vec{V}$ is a vector coefficient $u$ and $v$ are each in $H(curl$ or $H(div)$. */
1093
1094/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \cdot u, v)$ in 2D or 3D and
1095 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$ or
1096 $L_2$. */
1098{
1099public:
1102
1103 inline virtual bool VerifyFiniteElementTypes(
1104 const FiniteElement & trial_fe,
1105 const FiniteElement & test_fe) const
1106 {
1107 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1109 }
1110
1111 inline virtual const char * FiniteElementTypeFailureMessage() const
1112 {
1113 return "MixedDotProductIntegrator: "
1114 "Trial space must be a vector field "
1115 "and the test space must be a scalar field";
1116 }
1117};
1118
1119/** Class for integrating the bilinear form $a(u,v) := (-\vec{V} \cdot u, \nabla \cdot v)$ in 2D or
1120 3D and where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1121 $H(div)$. */
1123{
1124public:
1127
1128 inline virtual bool VerifyFiniteElementTypes(
1129 const FiniteElement & trial_fe,
1130 const FiniteElement & test_fe) const
1131 {
1132 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1135 }
1136
1137 inline virtual const char * FiniteElementTypeFailureMessage() const
1138 {
1139 return "MixedWeakGradDotIntegrator: "
1140 "Trial space must be a vector field "
1141 "and the test space must be a vector field with a divergence";
1142 }
1143
1144 // Subtract one due to the gradient and add one for the coefficient
1145 // which is assumed to be at least linear.
1146 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1147 const FiniteElement & test_fe,
1148 ElementTransformation &Trans)
1149 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
1150
1151 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1152 ElementTransformation &Trans,
1153 Vector & shape)
1154 { scalar_fe.CalcPhysDivShape(Trans, shape); shape *= -1.0; }
1155};
1156
1157/** Class for integrating the bilinear form $a(u,v) := (v \vec{V} \times u, \nabla v)$ in 3D and
1158 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$. */
1160{
1161public:
1164
1165 inline virtual bool VerifyFiniteElementTypes(
1166 const FiniteElement & trial_fe,
1167 const FiniteElement & test_fe) const
1168 {
1169 return (trial_fe.GetRangeDim() == 3 &&
1173 }
1174
1175 inline virtual const char * FiniteElementTypeFailureMessage() const
1176 {
1177 return "MixedWeakDivCrossIntegrator: "
1178 "Trial space must be a vector field in 3D "
1179 "and the test space must be a scalar field with a gradient";
1180 }
1181
1182 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1183 { return space_dim; }
1184
1185 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1186 ElementTransformation &Trans,
1187 DenseMatrix & shape)
1188 { test_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1189};
1190
1191/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$ in 3D
1192 or in 2D and where $Q$ is a scalar or matrix coefficient $u$ and $v$ are both in
1193 $H^1$. */
1195{
1196public:
1204
1205 inline virtual bool VerifyFiniteElementTypes(
1206 const FiniteElement & trial_fe,
1207 const FiniteElement & test_fe) const
1208 {
1209 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1213 }
1214
1215 inline virtual const char * FiniteElementTypeFailureMessage() const
1216 {
1217 return "MixedGradGradIntegrator: "
1218 "Trial and test spaces must both be scalar fields "
1219 "with a gradient operator.";
1220 }
1221
1222 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1223 const FiniteElement & test_fe,
1224 ElementTransformation &Trans)
1225 {
1226 // Same as DiffusionIntegrator
1227 return test_fe.Space() == FunctionSpace::Pk ?
1228 trial_fe.GetOrder() + test_fe.GetOrder() - 2 :
1229 trial_fe.GetOrder() + test_fe.GetOrder() + test_fe.GetDim() - 1;
1230 }
1231
1232 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1233 { return space_dim; }
1234
1235 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1236 ElementTransformation &Trans,
1237 DenseMatrix & shape)
1238 { trial_fe.CalcPhysDShape(Trans, shape); }
1239
1240 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1241 { return space_dim; }
1242
1243 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1244 ElementTransformation &Trans,
1245 DenseMatrix & shape)
1246 { test_fe.CalcPhysDShape(Trans, shape); }
1247};
1248
1249/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla u, \nabla v)$ in 3D
1250 or in 2D and where $\vec{V}$ is a vector coefficient $u$ and $v$ are both in $H^1$. */
1252{
1253public:
1256
1257 inline virtual bool VerifyFiniteElementTypes(
1258 const FiniteElement & trial_fe,
1259 const FiniteElement & test_fe) const
1260 {
1261 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1265 }
1266
1267 inline virtual const char * FiniteElementTypeFailureMessage() const
1268 {
1269 return "MixedCrossGradGradIntegrator: "
1270 "Trial and test spaces must both be scalar fields "
1271 "with a gradient operator.";
1272 }
1273
1274 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1275 { return space_dim; }
1276
1277 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1278 ElementTransformation &Trans,
1279 DenseMatrix & shape)
1280 { trial_fe.CalcPhysDShape(Trans, shape); }
1281
1282 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1283 { return space_dim; }
1284
1285 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1286 ElementTransformation &Trans,
1287 DenseMatrix & shape)
1288 { test_fe.CalcPhysDShape(Trans, shape); }
1289};
1290
1291/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), \mathrm{curl}(v))$ in 3D
1292 and where $Q$ is a scalar or matrix coefficient $u$ and $v$ are both in
1293 $H(curl$. */
1295{
1296public:
1304
1305 inline virtual bool VerifyFiniteElementTypes(
1306 const FiniteElement & trial_fe,
1307 const FiniteElement & test_fe) const
1308 {
1309 return (trial_fe.GetCurlDim() == 3 && test_fe.GetCurlDim() == 3 &&
1314 }
1315
1316 inline virtual const char * FiniteElementTypeFailureMessage() const
1317 {
1318 return "MixedCurlCurlIntegrator"
1319 "Trial and test spaces must both be vector fields in 3D "
1320 "with a curl.";
1321 }
1322
1323 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1324 { return trial_fe.GetCurlDim(); }
1325
1326 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1327 ElementTransformation &Trans,
1328 DenseMatrix & shape)
1329 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1330
1331 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1332 { return test_fe.GetCurlDim(); }
1333
1334 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1335 ElementTransformation &Trans,
1336 DenseMatrix & shape)
1337 { test_fe.CalcPhysCurlShape(Trans, shape); }
1338};
1339
1340/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), \mathrm{curl}(v))$ in 3D
1341 and where $\vec{V}$ is a vector coefficient $u$ and $v$ are both in $H(curl$. */
1343{
1344public:
1347
1348 inline virtual bool VerifyFiniteElementTypes(
1349 const FiniteElement & trial_fe,
1350 const FiniteElement & test_fe) const
1351 {
1352 return (trial_fe.GetCurlDim() == 3 && trial_fe.GetRangeDim() == 3 &&
1353 test_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1358 }
1359
1360 inline virtual const char * FiniteElementTypeFailureMessage() const
1361 {
1362 return "MixedCrossCurlCurlIntegrator: "
1363 "Trial and test spaces must both be vector fields in 3D "
1364 "with a curl.";
1365 }
1366
1367 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1368 { return trial_fe.GetCurlDim(); }
1369
1370 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1371 ElementTransformation &Trans,
1372 DenseMatrix & shape)
1373 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1374
1375 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1376 { return test_fe.GetCurlDim(); }
1377
1378 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1379 ElementTransformation &Trans,
1380 DenseMatrix & shape)
1381 { test_fe.CalcPhysCurlShape(Trans, shape); }
1382};
1383
1384/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), \nabla \cdot v)$ in 3D
1385 and where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H^1$. */
1387{
1388public:
1391
1392 inline virtual bool VerifyFiniteElementTypes(
1393 const FiniteElement & trial_fe,
1394 const FiniteElement & test_fe) const
1395 {
1396 return (trial_fe.GetCurlDim() == 3 &&
1401 }
1402
1403 inline virtual const char * FiniteElementTypeFailureMessage() const
1404 {
1405 return "MixedCrossCurlGradIntegrator"
1406 "Trial space must be a vector field in 3D with a curl"
1407 "and the test space must be a scalar field with a gradient";
1408 }
1409
1410 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1411 { return trial_fe.GetCurlDim(); }
1412
1413 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1414 ElementTransformation &Trans,
1415 DenseMatrix & shape)
1416 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1417
1418 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1419 { return space_dim; }
1420
1421 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1422 ElementTransformation &Trans,
1423 DenseMatrix & shape)
1424 { test_fe.CalcPhysDShape(Trans, shape); }
1425};
1426
1427/** Class for integrating the bilinear form $a(u,v) := (v \times \nabla \cdot u, \mathrm{curl}(v))$ in 3D
1428 and where $v$ is a scalar coefficient $u$ is in $H^1$ and $v$ is in $H(curl$. */
1430{
1431public:
1434
1435 inline virtual bool VerifyFiniteElementTypes(
1436 const FiniteElement & trial_fe,
1437 const FiniteElement & test_fe) const
1438 {
1439 return (test_fe.GetCurlDim() == 3 &&
1444 }
1445
1446 inline virtual const char * FiniteElementTypeFailureMessage() const
1447 {
1448 return "MixedCrossGradCurlIntegrator"
1449 "Trial space must be a scalar field in 3D with a gradient"
1450 "and the test space must be a vector field with a curl";
1451 }
1452
1453 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1454 { return space_dim; }
1455
1456 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1457 ElementTransformation &Trans,
1458 DenseMatrix & shape)
1459 { trial_fe.CalcPhysDShape(Trans, shape); }
1460
1461 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1462 { return test_fe.GetCurlDim(); }
1463
1464 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1465 ElementTransformation &Trans,
1466 DenseMatrix & shape)
1467 { test_fe.CalcPhysCurlShape(Trans, shape); }
1468};
1469
1470/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, \mathrm{curl}(v))$ in 3D and
1471 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1472 $H(curl$. */
1474{
1475public:
1478
1479 inline virtual bool VerifyFiniteElementTypes(
1480 const FiniteElement & trial_fe,
1481 const FiniteElement & test_fe) const
1482 {
1483 return (trial_fe.GetRangeDim() == 3 && test_fe.GetCurlDim() == 3 &&
1487 }
1488
1489 inline virtual const char * FiniteElementTypeFailureMessage() const
1490 {
1491 return "MixedWeakCurlCrossIntegrator: "
1492 "Trial space must be a vector field in 3D "
1493 "and the test space must be a vector field with a curl";
1494 }
1495
1496 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1497 { return test_fe.GetCurlDim(); }
1498
1499 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1500 ElementTransformation &Trans,
1501 DenseMatrix & shape)
1502 { test_fe.CalcPhysCurlShape(Trans, shape); }
1503};
1504
1505/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, \mathrm{curl}(v))$ in 2D and
1506 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1507 $H(curl$. */
1509{
1510public:
1513
1514 inline virtual bool VerifyFiniteElementTypes(
1515 const FiniteElement & trial_fe,
1516 const FiniteElement & test_fe) const
1517 {
1518 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1522 }
1523
1524 inline virtual const char * FiniteElementTypeFailureMessage() const
1525 {
1526 return "MixedScalarWeakCurlCrossIntegrator: "
1527 "Trial space must be a vector field in 2D "
1528 "and the test space must be a vector field with a curl";
1529 }
1530
1531 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1532 ElementTransformation &Trans,
1533 Vector & shape)
1534 {
1535 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1536 scalar_fe.CalcPhysCurlShape(Trans, dshape);
1537 }
1538};
1539
1540/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla \cdot u, v)$ in 3D or
1541 in 2D and where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ and $v$ is in $H(curl$ or
1542 $H(div)$. */
1544{
1545public:
1548
1549 inline virtual bool VerifyFiniteElementTypes(
1550 const FiniteElement & trial_fe,
1551 const FiniteElement & test_fe) const
1552 {
1553 return (test_fe.GetRangeDim() == 3 &&
1557 }
1558
1559 inline virtual const char * FiniteElementTypeFailureMessage() const
1560 {
1561 return "MixedCrossGradIntegrator: "
1562 "Trial space must be a scalar field with a gradient operator"
1563 " and the test space must be a vector field both in 3D.";
1564 }
1565
1566 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1567 { return space_dim; }
1568
1569 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1570 ElementTransformation &Trans,
1571 DenseMatrix & shape)
1572 { trial_fe.CalcPhysDShape(Trans, shape); }
1573
1574 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1575 ElementTransformation &Trans,
1576 DenseMatrix & shape)
1577 { test_fe.CalcVShape(Trans, shape); }
1578};
1579
1580/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), v)$ in 3D and
1581 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H(curl$ or
1582 $H(div)$. */
1584{
1585public:
1588
1589 inline virtual bool VerifyFiniteElementTypes(
1590 const FiniteElement & trial_fe,
1591 const FiniteElement & test_fe) const
1592 {
1593 return (trial_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1597 }
1598
1599 inline virtual const char * FiniteElementTypeFailureMessage() const
1600 {
1601 return "MixedCrossCurlIntegrator: "
1602 "Trial space must be a vector field in 3D with a curl "
1603 "and the test space must be a vector field";
1604 }
1605
1606 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1607 { return trial_fe.GetCurlDim(); }
1608
1609 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1610 ElementTransformation &Trans,
1611 DenseMatrix & shape)
1612 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1613};
1614
1615/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), v)$ in 2D and
1616 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H(curl$ or
1617 $H(div)$. */
1619{
1620public:
1623
1624 inline virtual bool VerifyFiniteElementTypes(
1625 const FiniteElement & trial_fe,
1626 const FiniteElement & test_fe) const
1627 {
1628 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1632 }
1633
1634 inline virtual const char * FiniteElementTypeFailureMessage() const
1635 {
1636 return "MixedCrossCurlIntegrator: "
1637 "Trial space must be a vector field in 2D with a curl "
1638 "and the test space must be a vector field";
1639 }
1640
1641 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1642 ElementTransformation &Trans,
1643 Vector & shape)
1644 {
1645 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1646 scalar_fe.CalcPhysCurlShape(Trans, dshape); shape *= -1.0;
1647 }
1648};
1649
1650/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla \cdot u, v)$ in 2D and
1651 where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ and $v$ is in $H^1$ or $L_2$. */
1653{
1654public:
1657
1658 inline virtual bool VerifyFiniteElementTypes(
1659 const FiniteElement & trial_fe,
1660 const FiniteElement & test_fe) const
1661 {
1662 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1666 }
1667
1668 inline virtual const char * FiniteElementTypeFailureMessage() const
1669 {
1670 return "MixedScalarCrossGradIntegrator: "
1671 "Trial space must be a scalar field in 2D with a gradient "
1672 "and the test space must be a scalar field";
1673 }
1674
1675 inline int GetVDim(const FiniteElement & vector_fe)
1676 { return space_dim; }
1677
1678 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1679 ElementTransformation &Trans,
1680 DenseMatrix & shape)
1681 { vector_fe.CalcPhysDShape(Trans, shape); }
1682};
1683
1684/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, v)$ in 2D and where
1685 $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$ or $L_2$. */
1687{
1688public:
1691
1692 inline virtual bool VerifyFiniteElementTypes(
1693 const FiniteElement & trial_fe,
1694 const FiniteElement & test_fe) const
1695 {
1696 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1699 }
1700
1701 inline virtual const char * FiniteElementTypeFailureMessage() const
1702 {
1703 return "MixedScalarCrossProductIntegrator: "
1704 "Trial space must be a vector field in 2D "
1705 "and the test space must be a scalar field";
1706 }
1707};
1708
1709/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u \hat{z}, v)$ in 2D and
1710 where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ or $L_2$ and $v$ is in $H(curl$ or $H(div)$.
1711
1712 \todo Documentation what $\hat{z}$ is (also missing in https://mfem.org/bilininteg/).
1713 */
1715{
1716public:
1719
1720 inline virtual bool VerifyFiniteElementTypes(
1721 const FiniteElement & trial_fe,
1722 const FiniteElement & test_fe) const
1723 {
1724 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1727 }
1728
1729 inline virtual const char * FiniteElementTypeFailureMessage() const
1730 {
1731 return "MixedScalarWeakCrossProductIntegrator: "
1732 "Trial space must be a scalar field in 2D "
1733 "and the test space must be a vector field";
1734 }
1735
1736 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1737 ElementTransformation &Trans,
1738 Vector & shape)
1739 { scalar_fe.CalcPhysShape(Trans, shape); shape *= -1.0; }
1740};
1741
1742/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \cdot \nabla u, v)$ in 2D or
1743 3D and where $\vec{V}$ is a vector coefficient, $u$ is in $H^1$ and $v$ is in $H^1$ or $L_2$. */
1745{
1746public:
1749
1750 inline virtual bool VerifyFiniteElementTypes(
1751 const FiniteElement & trial_fe,
1752 const FiniteElement & test_fe) const
1753 {
1754 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1757 }
1758
1759 inline virtual const char * FiniteElementTypeFailureMessage() const
1760 {
1761 return "MixedDirectionalDerivativeIntegrator: "
1762 "Trial space must be a scalar field with a gradient "
1763 "and the test space must be a scalar field";
1764 }
1765
1766 inline virtual int GetVDim(const FiniteElement & vector_fe)
1767 { return space_dim; }
1768
1769 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1770 ElementTransformation &Trans,
1771 DenseMatrix & shape)
1772 { vector_fe.CalcPhysDShape(Trans, shape); }
1773};
1774
1775/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} \cdot \nabla u, \nabla \cdot v)$ in 2D
1776 or 3D and where $\hat{V}$ is a vector coefficient, $u$ is in $H^1$ and $v$ is in $H(div)$. */
1778{
1779public:
1782
1783 inline virtual bool VerifyFiniteElementTypes(
1784 const FiniteElement & trial_fe,
1785 const FiniteElement & test_fe) const
1786 {
1787 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1791 }
1792
1793 inline virtual const char * FiniteElementTypeFailureMessage() const
1794 {
1795 return "MixedGradDivIntegrator: "
1796 "Trial space must be a scalar field with a gradient"
1797 "and the test space must be a vector field with a divergence";
1798 }
1799
1800 inline virtual int GetVDim(const FiniteElement & vector_fe)
1801 { return space_dim; }
1802
1803 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1804 ElementTransformation &Trans,
1805 DenseMatrix & shape)
1806 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1807
1808 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1809 ElementTransformation &Trans,
1810 Vector & shape)
1811 { scalar_fe.CalcPhysDivShape(Trans, shape); }
1812};
1813
1814/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} \nabla \cdot u, \nabla v)$ in 2D
1815 or 3D and where $\hat{V}$ is a vector coefficient, $u$ is in $H(div)$ and $v$ is in $H^1$. */
1817{
1818public:
1821
1822 inline virtual bool VerifyFiniteElementTypes(
1823 const FiniteElement & trial_fe,
1824 const FiniteElement & test_fe) const
1825 {
1826 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1827 trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
1830 );
1831 }
1832
1833 inline virtual const char * FiniteElementTypeFailureMessage() const
1834 {
1835 return "MixedDivGradIntegrator: "
1836 "Trial space must be a vector field with a divergence"
1837 "and the test space must be a scalar field with a gradient";
1838 }
1839
1840 inline virtual int GetVDim(const FiniteElement & vector_fe)
1841 { return space_dim; }
1842
1843 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1844 ElementTransformation &Trans,
1845 DenseMatrix & shape)
1846 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1847
1848 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1849 ElementTransformation &Trans,
1850 Vector & shape)
1851 { scalar_fe.CalcPhysDivShape(Trans, shape); }
1852};
1853
1854/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} u, \nabla v)$ in 2D or 3D
1855 and where $\hat{V}$ is a vector coefficient, $u$ is in $H^1$ or $L_2$ and $v$ is in $H^1$. */
1857{
1858public:
1861
1862 inline virtual bool VerifyFiniteElementTypes(
1863 const FiniteElement & trial_fe,
1864 const FiniteElement & test_fe) const
1865 {
1866 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1869 }
1870
1871 inline virtual const char * FiniteElementTypeFailureMessage() const
1872 {
1873 return "MixedScalarWeakDivergenceIntegrator: "
1874 "Trial space must be a scalar field "
1875 "and the test space must be a scalar field with a gradient";
1876 }
1877
1878 inline int GetVDim(const FiniteElement & vector_fe)
1879 { return space_dim; }
1880
1881 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1882 ElementTransformation &Trans,
1883 DenseMatrix & shape)
1884 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1885};
1886
1887/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ in either 2D
1888 or 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
1889 diagonal matrix) $u$ is in $H^1$ and $v$ is in $H(curl$ or $H(div)$. Partial assembly
1890 (PA) is supported but could be further optimized by using more efficient
1891 threading and shared memory.
1892*/
1894{
1895public:
1903
1904protected:
1906 const FiniteElement & trial_fe,
1907 const FiniteElement & test_fe) const override
1908 {
1909 return (trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1911 }
1912
1913 inline const char * FiniteElementTypeFailureMessage() const override
1914 {
1915 return "MixedVectorGradientIntegrator: "
1916 "Trial spaces must be $H^1$ and the test space must be a "
1917 "vector field in 2D or 3D";
1918 }
1919
1920 inline int GetTrialVDim(const FiniteElement & trial_fe) override
1921 { return space_dim; }
1922
1923 inline void CalcTrialShape(const FiniteElement & trial_fe,
1924 ElementTransformation &Trans,
1925 DenseMatrix & shape) override
1926 {
1927 trial_fe.CalcPhysDShape(Trans, shape);
1928 }
1929
1931 void AssemblePA(const FiniteElementSpace &trial_fes,
1932 const FiniteElementSpace &test_fes) override;
1933
1934 void AddMultPA(const Vector&, Vector&) const override;
1935 void AddMultTransposePA(const Vector&, Vector&) const override;
1936
1937private:
1938 DenseMatrix Jinv;
1939
1940 // PA extension
1941 Vector pa_data;
1942 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1943 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1944 const GeometricFactors *geom; ///< Not owned
1945 int dim, ne, dofs1D, quad1D;
1946};
1947
1948/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ in 3D and
1949 where $Q$ is an optional coefficient (of type scalar, matrix, or diagonal
1950 matrix) $u$ is in $H(curl$ and $v$ is in $H(div)$ or $H(curl$. */
1952{
1953public:
1961
1962protected:
1964 const FiniteElement & trial_fe,
1965 const FiniteElement & test_fe) const override
1966 {
1967 return (trial_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1970 }
1971
1972 inline const char * FiniteElementTypeFailureMessage() const override
1973 {
1974 return "MixedVectorCurlIntegrator: "
1975 "Trial space must be H(Curl) and the test space must be a "
1976 "vector field in 3D";
1977 }
1978
1979 inline int GetTrialVDim(const FiniteElement & trial_fe) override
1980 { return trial_fe.GetCurlDim(); }
1981
1982 inline void CalcTrialShape(const FiniteElement & trial_fe,
1983 ElementTransformation &Trans,
1984 DenseMatrix & shape) override
1985 {
1986 trial_fe.CalcPhysCurlShape(Trans, shape);
1987 }
1988
1990 void AssemblePA(const FiniteElementSpace &trial_fes,
1991 const FiniteElementSpace &test_fes) override;
1992
1993 void AddMultPA(const Vector&, Vector&) const override;
1994 void AddMultTransposePA(const Vector&, Vector&) const override;
1995
1996private:
1997 // PA extension
1998 Vector pa_data;
1999 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2000 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2001 const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2002 const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2003 const GeometricFactors *geom; ///< Not owned
2004 int dim, ne, dofs1D, dofs1Dtest,quad1D, testType, trialType, coeffDim;
2005};
2006
2007/** Class for integrating the bilinear form $a(u,v) := (Q u, \mathrm{curl}(v))$ in 3D and
2008 where $Q$ is an optional coefficient (of type scalar, matrix, or diagonal
2009 matrix) $u$ is in $H(div)$ or $H(curl$ and $v$ is in $H(curl$. */
2011{
2012public:
2020
2021protected:
2023 const FiniteElement & trial_fe,
2024 const FiniteElement & test_fe) const override
2025 {
2026 return (trial_fe.GetRangeDim() == 3 && test_fe.GetCurlDim() == 3 &&
2029 }
2030
2031 inline const char * FiniteElementTypeFailureMessage() const override
2032 {
2033 return "MixedVectorWeakCurlIntegrator: "
2034 "Trial space must be vector field in 3D and the "
2035 "test space must be H(Curl)";
2036 }
2037
2038 inline int GetTestVDim(const FiniteElement & test_fe) override
2039 { return test_fe.GetCurlDim(); }
2040
2041 inline void CalcTestShape (const FiniteElement & test_fe,
2042 ElementTransformation &Trans,
2043 DenseMatrix & shape) override
2044 {
2045 test_fe.CalcPhysCurlShape(Trans, shape);
2046 }
2047
2049 void AssemblePA(const FiniteElementSpace &trial_fes,
2050 const FiniteElementSpace &test_fes) override;
2051
2052 void AddMultPA(const Vector&, Vector&) const override;
2053 void AddMultTransposePA(const Vector&, Vector&) const override;
2054
2055private:
2056 // PA extension
2057 Vector pa_data;
2058 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2059 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2060 const GeometricFactors *geom; ///< Not owned
2061 int dim, ne, dofs1D, quad1D, testType, trialType, coeffDim;
2062};
2063
2064/** Class for integrating the bilinear form $a(u,v) := - (Q u, \nabla v)$ in either
2065 2D or 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
2066 diagonal matrix) $u$ is in $H(div)$ or $H(curl$ and $v$ is in $H^1$. */
2068{
2069public:
2077
2078protected:
2079 inline virtual bool VerifyFiniteElementTypes(
2080 const FiniteElement & trial_fe,
2081 const FiniteElement & test_fe) const
2082 {
2083 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
2085 }
2086
2087 inline virtual const char * FiniteElementTypeFailureMessage() const
2088 {
2089 return "MixedVectorWeakDivergenceIntegrator: "
2090 "Trial space must be vector field and the "
2091 "test space must be H1";
2092 }
2093
2094 inline virtual int GetTestVDim(const FiniteElement & test_fe)
2095 { return space_dim; }
2096
2097 inline virtual void CalcTestShape(const FiniteElement & test_fe,
2098 ElementTransformation &Trans,
2099 DenseMatrix & shape)
2100 {
2101 test_fe.CalcPhysDShape(Trans, shape);
2102 shape *= -1.0;
2103 }
2104};
2105
2106/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ where $Q$ is a
2107 scalar coefficient, $u$ is in ($H^1$), and $v$ is a vector with components
2108 $v_i$ in ($H^1$) or ($L^2$).
2109
2110 See also MixedVectorGradientIntegrator when $v$ is in $H(curl$. */
2112{
2113protected:
2115
2116private:
2117 Vector shape;
2118 DenseMatrix dshape;
2119 DenseMatrix gshape;
2120 DenseMatrix Jadj;
2121 DenseMatrix elmat_comp;
2122 // PA extension
2123 Vector pa_data;
2124 const DofToQuad *trial_maps, *test_maps; ///< Not owned
2125 const GeometricFactors *geom; ///< Not owned
2126 int dim, ne, nq;
2127 int trial_dofs1D, test_dofs1D, quad1D;
2128
2129public:
2131 Q{NULL}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2132 { }
2134 Q{q_}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2135 { }
2137 Q{&q}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2138 { }
2139
2140 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2141 const FiniteElement &test_fe,
2142 ElementTransformation &Trans,
2143 DenseMatrix &elmat) override;
2144
2146 void AssemblePA(const FiniteElementSpace &trial_fes,
2147 const FiniteElementSpace &test_fes) override;
2148
2149 void AddMultPA(const Vector &x, Vector &y) const override;
2150 void AddMultTransposePA(const Vector &x, Vector &y) const override;
2151
2152 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2153 const FiniteElement &test_fe,
2154 const ElementTransformation &Trans);
2155protected:
2157 const FiniteElement& trial_fe,
2158 const FiniteElement& test_fe,
2159 const ElementTransformation& trans) const override
2160 {
2161 return &GetRule(trial_fe, test_fe, trans);
2162 }
2163};
2164
2165/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$ where $Q$
2166 can be a scalar or a matrix coefficient. */
2168{
2169public:
2170
2171 using ApplyKernelType = void(*)(const int, const bool, const Array<real_t>&,
2172 const Array<real_t>&, const Array<real_t>&,
2173 const Array<real_t>&,
2174 const Vector&, const Vector&,
2175 Vector&, const int, const int);
2176
2177 using DiagonalKernelType = void(*)(const int, const bool, const Array<real_t>&,
2178 const Array<real_t>&, const Vector&, Vector&,
2179 const int, const int);
2180
2181 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
2182 MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType, (int, int, int));
2183 struct Kernels { Kernels(); };
2184
2185protected:
2189
2190private:
2191 Vector vec, vecdxt, pointflux, shape;
2192#ifndef MFEM_THREAD_SAFE
2193 DenseMatrix dshape, dshapedxt, invdfdx, M, dshapedxt_m;
2194 DenseMatrix te_dshape, te_dshapedxt;
2195 Vector D;
2196#endif
2197
2198 // PA extension
2199 const FiniteElementSpace *fespace;
2200 const DofToQuad *maps; ///< Not owned
2201 const GeometricFactors *geom; ///< Not owned
2202 int dim, ne, dofs1D, quad1D;
2203 Vector pa_data;
2204 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2205
2206 // Data for NURBS patch PA
2207
2208 // Type for a variable-row-length 2D array, used for data related to 1D
2209 // quadrature rules in each dimension.
2210 typedef std::vector<std::vector<int>> IntArrayVar2D;
2211
2212 int numPatches = 0;
2213 static constexpr int numTypes = 2; // Number of rule types
2214
2215 // In the case integrationMode == Mode::PATCHWISE_REDUCED, an approximate
2216 // integration rule with sparse nonzero weights is computed by NNLSSolver,
2217 // for each 1D basis function on each patch, in each spatial dimension. For a
2218 // fixed 1D basis function b_i with DOF index i, in the tensor product basis
2219 // of patch p, the prescribed exact 1D rule is of the form
2220 // \sum_k a_{i,j,k} w_k for some integration points indexed by k, with
2221 // weights w_k and coefficients a_{i,j,k} depending on Q(x), an element
2222 // transformation, b_i, and b_j, for all 1D basis functions b_j whose support
2223 // overlaps that of b_i. Define the constraint matrix G = [g_{j,k}] with
2224 // g_{j,k} = a_{i,j,k} and the vector of exact weights w = [w_k]. A reduced
2225 // rule should have different weights w_r, many of them zero, and should
2226 // approximately satisfy Gw_r = Gw. A sparse approximate solution to this
2227 // underdetermined system is computed by NNLSSolver, and its data is stored
2228 // in the following members.
2229
2230 // For each patch p, spatial dimension d (total dim), and rule type t (total
2231 // numTypes), an std::vector<Vector> of reduced quadrature weights for all
2232 // basis functions is stored in reducedWeights[t + numTypes * (d + dim * p)],
2233 // reshaped as rw(t,d,p). Note that nd may vary with respect to the patch and
2234 // spatial dimension. Array reducedIDs is treated similarly.
2235 std::vector<std::vector<Vector>> reducedWeights;
2236 std::vector<IntArrayVar2D> reducedIDs;
2237 std::vector<Array<int>> pQ1D, pD1D;
2238 std::vector<std::vector<Array2D<real_t>>> pB, pG;
2239 std::vector<IntArrayVar2D> pminD, pmaxD, pminQ, pmaxQ, pminDD, pmaxDD;
2240
2241 std::vector<Array<const IntegrationRule*>> pir1d;
2242
2243 void SetupPatchPA(const int patch, Mesh *mesh, bool unitWeights=false);
2244
2245 void SetupPatchBasisData(Mesh *mesh, unsigned int patch);
2246
2247 /** Called by AssemblePatchMatrix for sparse matrix assembly on a NURBS patch
2248 with full 1D quadrature rules. */
2249 void AssemblePatchMatrix_fullQuadrature(const int patch,
2250 const FiniteElementSpace &fes,
2251 SparseMatrix*& smat);
2252
2253 /** Called by AssemblePatchMatrix for sparse matrix assembly on a NURBS patch
2254 with reduced 1D quadrature rules. */
2255 void AssemblePatchMatrix_reducedQuadrature(const int patch,
2256 const FiniteElementSpace &fes,
2257 SparseMatrix*& smat);
2258
2259public:
2260 /// Construct a diffusion integrator with coefficient Q = 1
2261 DiffusionIntegrator(const IntegrationRule *ir = nullptr);
2262
2263 /// Construct a diffusion integrator with a scalar coefficient q
2264 DiffusionIntegrator(Coefficient &q, const IntegrationRule *ir = nullptr);
2265
2266 /// Construct a diffusion integrator with a vector coefficient q
2267 DiffusionIntegrator(VectorCoefficient &q, const IntegrationRule *ir = nullptr);
2268
2269 /// Construct a diffusion integrator with a matrix coefficient q
2270 DiffusionIntegrator(MatrixCoefficient &q, const IntegrationRule *ir = nullptr);
2271
2272 /** Given a particular Finite Element computes the element stiffness matrix
2273 elmat. */
2274 void AssembleElementMatrix(const FiniteElement &el,
2275 ElementTransformation &Trans,
2276 DenseMatrix &elmat) override;
2277 /** Given a trial and test Finite Element computes the element stiffness
2278 matrix elmat. */
2279 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2280 const FiniteElement &test_fe,
2281 ElementTransformation &Trans,
2282 DenseMatrix &elmat) override;
2283
2284 void AssemblePatchMatrix(const int patch,
2285 const FiniteElementSpace &fes,
2286 SparseMatrix*& smat) override;
2287
2288 void AssembleNURBSPA(const FiniteElementSpace &fes) override;
2289
2290 void AssemblePatchPA(const int patch, const FiniteElementSpace &fes);
2291
2292 /// Perform the local action of the BilinearFormIntegrator
2293 void AssembleElementVector(const FiniteElement &el,
2295 const Vector &elfun, Vector &elvect) override;
2296
2297 void ComputeElementFlux(const FiniteElement &el,
2298 ElementTransformation &Trans,
2299 Vector &u, const FiniteElement &fluxelem,
2300 Vector &flux, bool with_coef = true,
2301 const IntegrationRule *ir = NULL) override;
2302
2303 real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
2304 ElementTransformation &Trans,
2305 Vector &flux, Vector *d_energy = NULL) override;
2306
2307 void AssembleMF(const FiniteElementSpace &fes) override;
2308
2310 void AssemblePA(const FiniteElementSpace &fes) override;
2311
2312 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2313 const bool add) override;
2314
2315 void AssembleDiagonalPA(Vector &diag) override;
2316
2317 void AssembleDiagonalMF(Vector &diag) override;
2318
2319 void AddMultMF(const Vector&, Vector&) const override;
2320
2321 void AddMultPA(const Vector&, Vector&) const override;
2322
2323 void AddMultTransposePA(const Vector&, Vector&) const override;
2324
2325 void AddMultNURBSPA(const Vector&, Vector&) const override;
2326
2327 void AddMultPatchPA(const int patch, const Vector &x, Vector &y) const;
2328
2329 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2330 const FiniteElement &test_fe);
2331
2332 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2333
2334 Coefficient *GetCoefficient() const { return Q; }
2335
2336 template <int DIM, int D1D, int Q1D>
2337 static void AddSpecialization()
2338 {
2339 ApplyPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2340 DiagonalPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2341 }
2342protected:
2344 const FiniteElement& trial_fe,
2345 const FiniteElement& test_fe,
2346 const ElementTransformation& trans) const override
2347 {
2348 return &GetRule(trial_fe, test_fe);
2349 }
2350};
2351
2352/** Class for local mass matrix assembling $a(u,v) := (Q u, v)$ */
2354{
2355 friend class DGMassInverse;
2356protected:
2357#ifndef MFEM_THREAD_SAFE
2359#endif
2361 // PA extension
2364 const DofToQuad *maps; ///< Not owned
2365 const GeometricFactors *geom; ///< Not owned
2366 const FaceGeometricFactors *face_geom; ///< Not owned
2368
2369 void AssembleEA_(Vector &ea, const bool add);
2370
2371public:
2372
2373 using ApplyKernelType = void(*)(const int, const Array<real_t>&,
2374 const Array<real_t>&, const Vector&,
2375 const Vector&, Vector&, const int, const int);
2376
2377 using DiagonalKernelType = void(*)(const int, const Array<real_t>&,
2378 const Vector&, Vector&, const int,
2379 const int);
2380
2381 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
2382 MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType, (int, int, int));
2383 struct Kernels { Kernels(); };
2384
2385public:
2386 MassIntegrator(const IntegrationRule *ir = nullptr);
2387
2388 /// Construct a mass integrator with coefficient q
2389 MassIntegrator(Coefficient &q, const IntegrationRule *ir = NULL);
2390
2391 /** Given a particular Finite Element computes the element mass matrix
2392 elmat. */
2393 void AssembleElementMatrix(const FiniteElement &el,
2394 ElementTransformation &Trans,
2395 DenseMatrix &elmat) override;
2396 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2397 const FiniteElement &test_fe,
2398 ElementTransformation &Trans,
2399 DenseMatrix &elmat) override;
2400
2401 void AssembleMF(const FiniteElementSpace &fes) override;
2402
2404 void AssemblePA(const FiniteElementSpace &fes) override;
2405
2406 void AssemblePABoundary(const FiniteElementSpace &fes) override;
2407
2408 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2409 const bool add) override;
2410
2411 virtual void AssembleEABoundary(const FiniteElementSpace &fes, Vector &emat,
2412 const bool add) override;
2413
2414 virtual void AssembleDiagonalPA(Vector &diag) override;
2415
2416 void AssembleDiagonalMF(Vector &diag) override;
2417
2418 void AddMultMF(const Vector&, Vector&) const override;
2419
2420 void AddMultPA(const Vector&, Vector&) const override;
2421
2422 void AddMultTransposePA(const Vector&, Vector&) const override;
2423
2424 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2425 const FiniteElement &test_fe,
2426 const ElementTransformation &Trans);
2427
2428 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2429
2430 const Coefficient *GetCoefficient() const { return Q; }
2431
2432 template <int DIM, int D1D, int Q1D>
2433 static void AddSpecialization()
2434 {
2435 ApplyPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2436 DiagonalPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2437 }
2438
2439protected:
2441 const FiniteElement& trial_fe,
2442 const FiniteElement& test_fe,
2443 const ElementTransformation& trans) const override
2444 {
2445 return &GetRule(trial_fe, test_fe, trans);
2446 }
2447};
2448
2449/** Mass integrator $(u, v)$ restricted to the boundary of a domain */
2451{
2452public:
2454
2456 void AssembleFaceMatrix(const FiniteElement &el1,
2457 const FiniteElement &el2,
2459 DenseMatrix &elmat) override;
2460};
2461
2462/// $\alpha (Q \cdot \nabla u, v)$
2464{
2465protected:
2468 // PA extension
2470 const DofToQuad *maps; ///< Not owned
2471 const GeometricFactors *geom; ///< Not owned
2473
2474private:
2475#ifndef MFEM_THREAD_SAFE
2476 DenseMatrix dshape, adjJ, Q_ir;
2477 Vector shape, vec2, BdFidxT;
2478#endif
2479
2480public:
2483
2486 DenseMatrix &) override;
2487
2488 void AssembleMF(const FiniteElementSpace &fes) override;
2489
2491 void AssemblePA(const FiniteElementSpace&) override;
2492
2493 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2494 const bool add) override;
2495
2496 void AssembleDiagonalPA(Vector &diag) override;
2497
2498 void AssembleDiagonalMF(Vector &diag) override;
2499
2500 void AddMultMF(const Vector&, Vector&) const override;
2501
2502 void AddMultPA(const Vector&, Vector&) const override;
2503
2504 void AddMultTransposePA(const Vector &x, Vector &y) const override;
2505
2506 static const IntegrationRule &GetRule(const FiniteElement &el,
2507 const ElementTransformation &Trans);
2508
2509 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2510 const FiniteElement &test_fe,
2511 const ElementTransformation &Trans);
2512
2513 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2514
2515protected:
2517 const FiniteElement& trial_fe,
2518 const FiniteElement& test_fe,
2519 const ElementTransformation& trans) const override
2520 {
2521 return &GetRule(trial_fe, test_fe, trans);
2522 }
2523};
2524
2525// Alias for @ConvectionIntegrator.
2527
2528/// $-\alpha (u, q \cdot \nabla v)$, negative transpose of ConvectionIntegrator
2535
2536/// $\alpha (Q \cdot \nabla u, v)$ using the "group" FE discretization
2538{
2539protected:
2542
2543private:
2544 DenseMatrix dshape, adjJ, Q_nodal, grad;
2545 Vector shape;
2546
2547public:
2552 DenseMatrix &) override;
2553};
2554
2555/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$,
2556 where $u=(u_1,\dots,u_n)$ and $v=(v_1,\dots,v_n)$, $u_i$ and $v_i$ are defined
2557 by scalar FE through standard transformation. */
2559{
2560private:
2561 int vdim;
2562 Vector shape, te_shape, vec;
2563 DenseMatrix partelmat;
2564 DenseMatrix mcoeff;
2565 int Q_order;
2566
2567protected:
2571 // PA extension
2573 const DofToQuad *maps; ///< Not owned
2574 const GeometricFactors *geom; ///< Not owned
2576
2577public:
2578 /// Construct an integrator with coefficient 1.0
2580 : vdim(-1), Q_order(0), Q(NULL), VQ(NULL), MQ(NULL) { }
2581 /** Construct an integrator with scalar coefficient q. If possible, save
2582 memory by using a scalar integrator since the resulting matrix is block
2583 diagonal with the same diagonal block repeated. */
2585 : vdim(-1), Q_order(qo), Q(&q), VQ(NULL), MQ(NULL) { }
2587 : BilinearFormIntegrator(ir), vdim(-1), Q_order(0), Q(&q), VQ(NULL),
2588 MQ(NULL) { }
2589 /// Construct an integrator with diagonal coefficient q
2591 : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(&q), MQ(NULL) { }
2592 /// Construct an integrator with matrix coefficient q
2594 : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(NULL), MQ(&q) { }
2595
2596 int GetVDim() const { return vdim; }
2597 void SetVDim(int vdim_) { vdim = vdim_; }
2598
2599 void AssembleElementMatrix(const FiniteElement &el,
2600 ElementTransformation &Trans,
2601 DenseMatrix &elmat) override;
2602 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2603 const FiniteElement &test_fe,
2604 ElementTransformation &Trans,
2605 DenseMatrix &elmat) override;
2607 void AssemblePA(const FiniteElementSpace &fes) override;
2608 void AssembleMF(const FiniteElementSpace &fes) override;
2609 void AssembleDiagonalPA(Vector &diag) override;
2610 void AssembleDiagonalMF(Vector &diag) override;
2611 void AddMultPA(const Vector &x, Vector &y) const override;
2612 void AddMultMF(const Vector &x, Vector &y) const override;
2613 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2614};
2615
2616
2617/** Class for integrating $(\nabla \cdot u, p)$ where $u$ is a vector field given by
2618 VectorFiniteElement through Piola transformation (for Raviart-Thomas elements); $p$ is
2619 scalar function given by FiniteElement through standard transformation.
2620 Here, $u$ is the trial function and $p$ is the test function.
2621
2622 Note: if the test space does not have map type INTEGRAL, then the element
2623 matrix returned by AssembleElementMatrix2 will not depend on the
2624 ElementTransformation Trans. */
2626{
2627protected:
2629
2631 void AssemblePA(const FiniteElementSpace &trial_fes,
2632 const FiniteElementSpace &test_fes) override;
2633
2634 void AddMultPA(const Vector&, Vector&) const override;
2635 void AddMultTransposePA(const Vector&, Vector&) const override;
2636
2637private:
2638#ifndef MFEM_THREAD_SAFE
2639 Vector divshape, shape;
2640#endif
2641
2642 // PA extension
2643 Vector pa_data;
2644 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2645 const DofToQuad *L2mapsO; ///< Not owned. DOF-to-quad map, open.
2646 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2647 int dim, ne, dofs1D, L2dofs1D, quad1D;
2648
2649public:
2653 ElementTransformation &Trans,
2654 DenseMatrix &elmat) override { }
2655 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2656 const FiniteElement &test_fe,
2657 ElementTransformation &Trans,
2658 DenseMatrix &elmat) override;
2659
2660 void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag) override;
2661};
2662
2663
2664/** Integrator for $(-Q u, \nabla v)$ for Nedelec ($u$) and $H^1$ ($v$) elements.
2665 This is equivalent to a weak divergence of the $H(curl$ basis functions. */
2667{
2668protected:
2670
2671private:
2672#ifndef MFEM_THREAD_SAFE
2673 DenseMatrix dshape;
2674 DenseMatrix dshapedxt;
2675 DenseMatrix vshape;
2676 DenseMatrix invdfdx;
2677#endif
2678
2679public:
2683 ElementTransformation &Trans,
2684 DenseMatrix &elmat) override { }
2685 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2686 const FiniteElement &test_fe,
2687 ElementTransformation &Trans,
2688 DenseMatrix &elmat) override;
2689};
2690
2691/** Integrator for $(\mathrm{curl}(u), v)$ for Nedelec and Raviart-Thomas elements. If the trial and
2692 test spaces are switched, assembles the form $(u, \mathrm{curl}(v))$. */
2694{
2695protected:
2697
2698private:
2699#ifndef MFEM_THREAD_SAFE
2700 DenseMatrix curlshapeTrial;
2701 DenseMatrix vshapeTest;
2702 DenseMatrix curlshapeTrial_dFT;
2703#endif
2704
2705public:
2709 ElementTransformation &Trans,
2710 DenseMatrix &elmat) override { }
2711 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2712 const FiniteElement &test_fe,
2713 ElementTransformation &Trans,
2714 DenseMatrix &elmat) override;
2715};
2716
2717/// Integrator for (Q u.n, v.n) for RT elements
2719{
2720 Coefficient *Q;
2721#ifndef MFEM_THREAD_SAFE
2722 Vector shape, te_shape;
2723#endif
2724public:
2727 void AssembleElementMatrix(const FiniteElement &el,
2728 ElementTransformation &Trans,
2729 DenseMatrix &elmat) override;
2730 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2731 const FiniteElement &test_fe,
2732 ElementTransformation &Trans,
2733 DenseMatrix &elmat) override;
2734};
2735
2736/// Class for integrating $ (Q \partial_i(u), v) $ where $u$ and $v$ are scalars
2738{
2739protected:
2741
2742private:
2743 int xi;
2744 DenseMatrix dshape, dshapedxt, invdfdx;
2745 Vector shape, dshapedxi;
2746
2747public:
2748 DerivativeIntegrator(Coefficient &q, int i) : Q(&q), xi(i) { }
2750 ElementTransformation &Trans,
2751 DenseMatrix &elmat) override
2752 { AssembleElementMatrix2(el,el,Trans,elmat); }
2753 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2754 const FiniteElement &test_fe,
2755 ElementTransformation &Trans,
2756 DenseMatrix &elmat) override;
2757};
2758
2759/// Integrator for $(\mathrm{curl}(u), \mathrm{curl}(v))$ for Nedelec elements
2761{
2762private:
2763 Vector vec, pointflux;
2764#ifndef MFEM_THREAD_SAFE
2765 Vector D;
2766 DenseMatrix curlshape, curlshape_dFt, M;
2767 DenseMatrix te_curlshape, te_curlshape_dFt;
2768 DenseMatrix vshape, projcurl;
2769#endif
2770
2771protected:
2775
2776 // PA extension
2778 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2779 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2780 const GeometricFactors *geom; ///< Not owned
2782 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2783
2784public:
2785 CurlCurlIntegrator() { Q = NULL; DQ = NULL; MQ = NULL; }
2786 /// Construct a bilinear form integrator for Nedelec elements
2788 BilinearFormIntegrator(ir), Q(&q), DQ(NULL), MQ(NULL) { }
2790 const IntegrationRule *ir = NULL) :
2791 BilinearFormIntegrator(ir), Q(NULL), DQ(&dq), MQ(NULL) { }
2793 BilinearFormIntegrator(ir), Q(NULL), DQ(NULL), MQ(&mq) { }
2794
2795 /* Given a particular Finite Element, compute the
2796 element curl-curl matrix elmat */
2797 void AssembleElementMatrix(const FiniteElement &el,
2798 ElementTransformation &Trans,
2799 DenseMatrix &elmat) override;
2800
2801 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2802 const FiniteElement &test_fe,
2803 ElementTransformation &Trans,
2804 DenseMatrix &elmat) override;
2805
2806 void ComputeElementFlux(const FiniteElement &el,
2807 ElementTransformation &Trans,
2808 Vector &u, const FiniteElement &fluxelem,
2809 Vector &flux, bool with_coef,
2810 const IntegrationRule *ir = NULL) override;
2811
2812 real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
2813 ElementTransformation &Trans,
2814 Vector &flux, Vector *d_energy = NULL) override;
2815
2817 void AssemblePA(const FiniteElementSpace &fes) override;
2818 void AddMultPA(const Vector &x, Vector &y) const override;
2819 void AssembleDiagonalPA(Vector& diag) override;
2820
2821 const Coefficient *GetCoefficient() const { return Q; }
2822};
2823
2824/** Integrator for $(\mathrm{curl}(u), \mathrm{curl}(v))$ for FE spaces defined by 'dim' copies of a
2825 scalar FE space. */
2827{
2828private:
2829#ifndef MFEM_THREAD_SAFE
2830 DenseMatrix dshape_hat, dshape, curlshape, Jadj, grad_hat, grad;
2831#endif
2832
2833protected:
2835
2836public:
2838
2840
2841 /// Assemble an element matrix
2842 void AssembleElementMatrix(const FiniteElement &el,
2843 ElementTransformation &Trans,
2844 DenseMatrix &elmat) override;
2845 /// Compute element energy: $ \frac{1}{2} (\mathrm{curl}(u), \mathrm{curl}(u))_E$
2848 const Vector &elfun) override;
2849};
2850
2851/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ where $Q$ is
2852 an optional scalar coefficient, and $v$ is a vector with components $v_i$ in
2853 the $L_2$ or $H^1$ space. This integrator handles 3 cases:
2854 1. u ∈ $H(curl$ in 3D, $v$ is a 3D vector with components $v_i$ in $L^2$ or $H^1$
2855 2. u ∈ $H(curl$ in 2D, $v$ is a scalar field in $L^2$ or $H^1$
2856 3. u is a scalar field in $H^1$, i.e, $\mathrm{curl}(u) := \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}$, $\nabla u$ and $v$ is a
2857 2D vector field with components $v_i$ in $L^2$ or $H^1$ space.
2858
2859 Note: Case 2 can also be handled by MixedScalarCurlIntegrator */
2861{
2862protected:
2864
2865private:
2866 Vector shape;
2867 DenseMatrix dshape;
2868 DenseMatrix curlshape;
2869 DenseMatrix elmat_comp;
2870public:
2874
2875 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2876 const FiniteElement &test_fe,
2877 ElementTransformation &Trans,
2878 DenseMatrix &elmat) override;
2879};
2880
2881/** Integrator for $(Q u, v)$, where $Q$ is an optional coefficient (of type scalar,
2882 vector (diagonal matrix), or matrix), trial function $u$ is in $H(curl$ or
2883 $H(div)$, and test function $v$ is in $H(curl$, $H(div)$, or $v=(v_1,\dots,v_n)$, where
2884 $v_i$ are in $H^1$. */
2886{
2887private:
2889 { Q = q; DQ = dq; MQ = mq; }
2890
2891#ifndef MFEM_THREAD_SAFE
2892 Vector shape;
2893 Vector D;
2894 DenseMatrix K;
2895 DenseMatrix partelmat;
2896 DenseMatrix test_vshape;
2897 DenseMatrix trial_vshape;
2898#endif
2899
2900protected:
2904
2905 // PA extension
2907 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2908 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2909 const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2910 const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2911 const GeometricFactors *geom; ///< Not owned
2913 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2914
2915public:
2916 VectorFEMassIntegrator() { Init(NULL, NULL, NULL); }
2917 VectorFEMassIntegrator(Coefficient *q_) { Init(q_, NULL, NULL); }
2918 VectorFEMassIntegrator(Coefficient &q) { Init(&q, NULL, NULL); }
2923
2924 void AssembleElementMatrix(const FiniteElement &el,
2925 ElementTransformation &Trans,
2926 DenseMatrix &elmat) override;
2927 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2928 const FiniteElement &test_fe,
2929 ElementTransformation &Trans,
2930 DenseMatrix &elmat) override;
2931
2932 void AssemblePA(const FiniteElementSpace &fes) override;
2933 void AssemblePA(const FiniteElementSpace &trial_fes,
2934 const FiniteElementSpace &test_fes) override;
2935 void AddMultPA(const Vector &x, Vector &y) const override;
2936 void AddMultTransposePA(const Vector &x, Vector &y) const override;
2937 void AssembleDiagonalPA(Vector& diag) override;
2938 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2939 const bool add) override;
2940
2941 const Coefficient *GetCoefficient() const { return Q; }
2942};
2943
2944/** Integrator for $(Q \nabla \cdot u, v)$ where $u=(u_1,\cdots,u_n)$ and all $u_i$ are in the same
2945 scalar FE space; $v$ is also in a (different) scalar FE space. */
2947{
2948protected:
2950
2951private:
2952 Vector shape;
2953 Vector divshape;
2954 DenseMatrix dshape;
2955 DenseMatrix gshape;
2956 DenseMatrix Jadj;
2957 // PA extension
2958 Vector pa_data;
2959 const DofToQuad *trial_maps, *test_maps; ///< Not owned
2960 const GeometricFactors *geom; ///< Not owned
2961 int dim, sdim, ne, nq;
2962 int trial_dofs1D, test_dofs1D, quad1D;
2963
2964public:
2966 Q(NULL), trial_maps(NULL), test_maps(NULL), geom(NULL)
2967 { }
2969 Q(q_), trial_maps(NULL), test_maps(NULL), geom(NULL)
2970 { }
2972 Q(&q), trial_maps(NULL), test_maps(NULL), geom(NULL)
2973 { }
2974
2975 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2976 const FiniteElement &test_fe,
2977 ElementTransformation &Trans,
2978 DenseMatrix &elmat) override;
2979
2981 void AssemblePA(const FiniteElementSpace &trial_fes,
2982 const FiniteElementSpace &test_fes) override;
2983
2984 void AddMultPA(const Vector &x, Vector &y) const override;
2985 void AddMultTransposePA(const Vector &x, Vector &y) const override;
2986
2987 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2988 const FiniteElement &test_fe,
2989 const ElementTransformation &Trans);
2990
2991protected:
2993 const FiniteElement& trial_fe,
2994 const FiniteElement& test_fe,
2995 const ElementTransformation& trans) const override
2996 {
2997 return &GetRule(trial_fe, test_fe, trans);
2998 }
2999};
3000
3001/// $(Q \nabla \cdot u, \nabla \cdot v)$ for Raviart-Thomas elements
3003{
3004protected:
3006
3007private:
3008#ifndef MFEM_THREAD_SAFE
3009 Vector divshape, te_divshape;
3010#endif
3011
3012 // PA extension
3013 Vector pa_data;
3014 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
3015 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
3016 const GeometricFactors *geom; ///< Not owned
3017 int dim, ne, dofs1D, quad1D;
3018
3019public:
3020 DivDivIntegrator() { Q = NULL; }
3022 BilinearFormIntegrator(ir), Q(&q) { }
3023
3024 void AssembleElementMatrix(const FiniteElement &el,
3025 ElementTransformation &Trans,
3026 DenseMatrix &elmat) override;
3027
3028 void AssembleElementMatrix2(const FiniteElement &trial_fe,
3029 const FiniteElement &test_fe,
3030 ElementTransformation &Trans,
3031 DenseMatrix &elmat) override;
3032
3034 void AssemblePA(const FiniteElementSpace &fes) override;
3035 void AddMultPA(const Vector &x, Vector &y) const override;
3036 void AssembleDiagonalPA(Vector& diag) override;
3037 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
3038 const bool add) override;
3039
3040 const Coefficient *GetCoefficient() const { return Q; }
3041};
3042
3043/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$,
3044 where $u=(u_1,\dots,u_n)$ and $v=(v_1,\dots,v_n)$, $u_i$ and $v_i$ are
3045 defined by scalar FE through standard transformation.
3046 See the constructors' documentation for all Coefficient options.
3047 The computed local element matrix is square, of size <tt> vdim*dof </tt>,
3048 where \c vdim is the vector dimension space and \c dof is the local degrees
3049 of freedom. The integrator is not aware of the true vector dimension and
3050 must use \c VectorCoefficient, \c MatrixCoefficient, or a caller-specified
3051 value to determine the vector space. For a scalar coefficient, the caller
3052 may manually specify the vector dimension or the vector dimension is assumed
3053 to be the spatial dimension (i.e. 2-dimension or 3-dimension). */
3055{
3056protected:
3060
3061 // PA extension
3062 const DofToQuad *maps; ///< Not owned
3063 const GeometricFactors *geom; ///< Not owned
3066
3067private:
3068 DenseMatrix dshape, dshapedxt, pelmat;
3069 int vdim = -1;
3070 DenseMatrix mcoeff;
3071 Vector vcoeff;
3072
3073public:
3075
3076 /** \brief Integrator with unit coefficient for caller-specified vector
3077 dimension.
3078
3079 If the vector dimension does not match the true dimension of the space,
3080 the resulting element matrix will be mathematically invalid. */
3081 VectorDiffusionIntegrator(int vector_dimension)
3082 : vdim(vector_dimension) { }
3083
3086
3089
3090 /** \brief Integrator with scalar coefficient for caller-specified vector
3091 dimension.
3092
3093 The element matrix is block-diagonal with \c vdim copies of the element
3094 matrix integrated with the \c Coefficient.
3095
3096 If the vector dimension does not match the true dimension of the space,
3097 the resulting element matrix will be mathematically invalid. */
3098 VectorDiffusionIntegrator(Coefficient &q, int vector_dimension)
3099 : Q(&q), vdim(vector_dimension) { }
3100
3101 /** \brief Integrator with \c VectorCoefficient. The vector dimension of the
3102 \c FiniteElementSpace is assumed to be the same as the dimension of the
3103 \c Vector.
3104
3105 The element matrix is block-diagonal and each block is integrated with
3106 coefficient $q_{i}$.
3107
3108 If the vector dimension does not match the true dimension of the space,
3109 the resulting element matrix will be mathematically invalid. */
3111 : VQ(&vq), vdim(vq.GetVDim()) { }
3112
3113 /** \brief Integrator with \c MatrixCoefficient. The vector dimension of the
3114 \c FiniteElementSpace is assumed to be the same as the dimension of the
3115 \c Matrix.
3116
3117 The element matrix is populated in each block. Each block is integrated
3118 with coefficient $q_{ij}$.
3119
3120 If the vector dimension does not match the true dimension of the space,
3121 the resulting element matrix will be mathematically invalid. */
3123 : MQ(&mq), vdim(mq.GetVDim()) { }
3124
3125 void AssembleElementMatrix(const FiniteElement &el,
3126 ElementTransformation &Trans,
3127 DenseMatrix &elmat) override;
3128 void AssembleElementVector(const FiniteElement &el,
3130 const Vector &elfun, Vector &elvect) override;
3132 void AssemblePA(const FiniteElementSpace &fes) override;
3133 void AssembleMF(const FiniteElementSpace &fes) override;
3134 void AssembleDiagonalPA(Vector &diag) override;
3135 void AssembleDiagonalMF(Vector &diag) override;
3136 void AddMultPA(const Vector &x, Vector &y) const override;
3137 void AddMultMF(const Vector &x, Vector &y) const override;
3138 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
3139};
3140
3141/** Integrator for the linear elasticity form:
3142 $$
3143 a(u,v) = (\lambda \mathrm{div}(u), \mathrm{div}(v)) + (2 \mu \varepsilon(u), \varepsilon(v)),
3144 $$
3145 where $\varepsilon(v) = \frac{1}{2} (\mathrm{grad}(v) + \mathrm{grad}(v)^{\mathrm{T}})$.
3146 This is a 'Vector' integrator, i.e. defined for FE spaces
3147 using multiple copies of a scalar FE space. */
3149{
3151
3152protected:
3155
3156private:
3157#ifndef MFEM_THREAD_SAFE
3158 Vector shape;
3159 DenseMatrix dshape, gshape, pelmat;
3160 Vector divshape;
3161#endif
3162
3163 // PA extension
3164
3165 const DofToQuad *maps; ///< Not owned
3166 const GeometricFactors *geom; ///< Not owned
3167 int vdim, ndofs;
3168 const FiniteElementSpace *fespace; ///< Not owned.
3169
3170 std::unique_ptr<QuadratureSpace> q_space;
3171 /// Coefficients projected onto q_space
3172 std::unique_ptr<CoefficientVector> lambda_quad, mu_quad;
3173 /// Workspace vector
3174 std::unique_ptr<QuadratureFunction> q_vec;
3175
3176 /// Set up the quadrature space and project lambda and mu coefficients
3177 void SetUpQuadratureSpaceAndCoefficients(const FiniteElementSpace &fes);
3178
3179public:
3182 /** With this constructor $\lambda = q_l m$ and $\mu = q_m m$
3183 if $dim q_l + 2 q_m = 0$ then $tr(\sigma) = 0$. */
3185 { lambda = NULL; mu = &m; q_lambda = q_l; q_mu = q_m; }
3186
3187 void AssembleElementMatrix(const FiniteElement &el,
3189 DenseMatrix &elmat) override;
3190
3192 void AssemblePA(const FiniteElementSpace &fes) override;
3193
3194 void AssembleDiagonalPA(Vector &diag) override;
3195
3196 void AddMultPA(const Vector &x, Vector &y) const override;
3197
3198 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3199
3200 /** Compute the stress corresponding to the local displacement @a $u$ and
3201 interpolate it at the nodes of the given @a fluxelem. Only the symmetric
3202 part of the stress is stored, so that the size of @a flux is equal to
3203 the number of DOFs in @a fluxelem times dim*(dim+1)/2. In 2D, the order
3204 of the stress components is: $s_xx, s_yy, s_xy$. In 3D, it is: $s_xx, s_yy,
3205 s_zz, s_xy, s_xz, s_yz$. In other words, @a flux is the local vector for
3206 a FE space with dim*(dim+1)/2 vector components, based on the finite
3207 element @a fluxelem. The integration rule is taken from @a fluxelem.
3208 @a ir exists to specific an alternative integration rule. */
3209 void ComputeElementFlux(const FiniteElement &el,
3210 ElementTransformation &Trans,
3211 Vector &u,
3212 const FiniteElement &fluxelem,
3213 Vector &flux, bool with_coef = true,
3214 const IntegrationRule *ir = NULL) override;
3215
3216 /** Compute the element energy (integral of the strain energy density)
3217 corresponding to the stress represented by @a flux which is a vector of
3218 coefficients multiplying the basis functions defined by @a fluxelem. In
3219 other words, @a flux is the local vector for a FE space with
3220 dim*(dim+1)/2 vector components, based on the finite element @a fluxelem.
3221 The number of components, dim*(dim+1)/2 is such that it represents the
3222 symmetric part of the (symmetric) stress tensor. The order of the
3223 components is: $s_xx, s_yy, s_xy$ in 2D, and $s_xx, s_yy, s_zz, s_xy, s_xz,
3224 s_yz$ in 3D. */
3225 real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
3226 ElementTransformation &Trans,
3227 Vector &flux, Vector *d_energy = NULL) override;
3228};
3229
3230/// @brief Integrator that computes the PA action of one of the blocks in an
3231/// ElasticityIntegrator, considering the elasticity operator as a dim x dim
3232/// block operator.
3234{
3235 ElasticityIntegrator &parent;
3236 const int i_block;
3237 const int j_block;
3238
3239 const DofToQuad *maps; ///< Not owned
3240 const GeometricFactors *geom; ///< Not owned
3241 const FiniteElementSpace *fespace; ///< Not owned.
3242
3243public:
3244 /// @brief Given an ElasticityIntegrator, create an integrator that
3245 /// represents the $(i,j)$th component block.
3246 ///
3247 /// @note The parent ElasticityIntegrator must remain valid throughout the
3248 /// lifetime of this integrator.
3249 ElasticityComponentIntegrator(ElasticityIntegrator &parent_, int i_, int j_);
3250
3252 void AssemblePA(const FiniteElementSpace &fes) override;
3253
3254 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
3255 const bool add = true) override;
3256
3257 void AddMultPA(const Vector &x, Vector &y) const override;
3258
3259 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3260};
3261
3262/** Integrator for the DG form:
3263 $$
3264 \alpha \langle \rho_u (u \cdot n) \{v\},[w] \rangle + \beta \langle \rho_u |u \cdot n| [v],[w] \rangle,
3265 $$
3266 where $v$ and $w$ are the trial and test variables, respectively, and $\rho$/$u$ are
3267 given scalar/vector coefficients. $\{v\}$ represents the average value of $v$ on
3268 the face and $[v]$ is the jump such that $\{v\}=(v_1+v_2)/2$ and $[v]=(v_1-v_2)$ for the
3269 face between elements $1$ and $2$. For boundary elements, $v2=0$. The vector
3270 coefficient, $u$, is assumed to be continuous across the faces and when given
3271 the scalar coefficient, $\rho$, is assumed to be discontinuous. The integrator
3272 uses the upwind value of $\rho$, denoted by $\rho_u$, which is value from the side into which
3273 the vector coefficient, $u$, points.
3274
3275 One use case for this integrator is to discretize the operator $-u \cdot \nabla v$
3276 with a DG formulation. The resulting formulation uses the
3277 ConvectionIntegrator (with coefficient $u$, and parameter $\alpha = -1$) and the
3278 transpose of the DGTraceIntegrator (with coefficient $u$, and parameters $\alpha = 1$,
3279 $\beta = -1/2$ to use the upwind face flux, see also
3280 NonconservativeDGTraceIntegrator). This discretization and the handling of
3281 the inflow and outflow boundaries is illustrated in Example 9/9p.
3282
3283 Another use case for this integrator is to discretize the operator $-\mathrm{div}(u v)$
3284 with a DG formulation. The resulting formulation is conservative and
3285 consists of the ConservativeConvectionIntegrator (with coefficient $u$, and
3286 parameter $\alpha = -1$) plus the DGTraceIntegrator (with coefficient $u$, and
3287 parameters $\alpha = -1$, $\beta = -1/2$ to use the upwind face flux).
3288 */
3290{
3291protected:
3295 // PA extension
3297 const DofToQuad *maps; ///< Not owned
3298 const FaceGeometricFactors *geom; ///< Not owned
3300
3301private:
3302 Vector shape1, shape2;
3303 Vector tr_shape1, te_shape1, tr_shape2, te_shape2;
3304
3305public:
3306 /// Construct integrator with $\rho = 1$, $\beta = \alpha/2$.
3308 { rho = NULL; u = &u_; alpha = a; beta = 0.5*a; }
3309
3310 /// Construct integrator with $\rho = 1$.
3312 { rho = NULL; u = &u_; alpha = a; beta = b; }
3313
3315 real_t a, real_t b)
3316 { rho = &rho_; u = &u_; alpha = a; beta = b; }
3317
3319 void AssembleFaceMatrix(const FiniteElement &el1,
3320 const FiniteElement &el2,
3322 DenseMatrix &elmat) override;
3323
3324 void AssembleFaceMatrix(const FiniteElement &trial_fe1,
3325 const FiniteElement &test_fe1,
3326 const FiniteElement &trial_fe2,
3327 const FiniteElement &test_fe2,
3329 DenseMatrix &elmat) override;
3330
3331 void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override;
3332
3333 void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override;
3334
3335 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3336
3337 void AddMultPA(const Vector&, Vector&) const override;
3338
3341 Vector &ea_data_int,
3342 Vector &ea_data_ext,
3343 const bool add) override;
3344
3346 Vector &ea_data_bdr,
3347 const bool add) override;
3348
3349 static const IntegrationRule &GetRule(Geometry::Type geom, int order,
3351
3352 static const IntegrationRule &GetRule(Geometry::Type geom, int order,
3353 const ElementTransformation &T);
3354
3355private:
3356 void SetupPA(const FiniteElementSpace &fes, FaceType type);
3357};
3358
3359// Alias for @a DGTraceIntegrator.
3361
3362/** Integrator that represents the face terms used for the non-conservative
3363 DG discretization of the convection equation:
3364 $$
3365 -\alpha \langle \rho_u (u \cdot n) \{v\},[w] \rangle + \beta \langle \rho_u |u \cdot n| [v],[w] \rangle.
3366 $$
3367 This integrator can be used with together with ConvectionIntegrator to
3368 implement an upwind DG discretization in non-conservative form, see ex9 and
3369 ex9p. */
3383
3384/** Integrator for the DG form:
3385 $$
3386 - \langle \{(Q \nabla u) \cdot n\}, [v] \rangle + \sigma \langle [u], \{(Q \nabla v) \cdot n \} \rangle
3387 + \kappa \langle \{h^{-1} Q\} [u], [v] \rangle
3388 $$
3389 where $Q$ is a scalar or matrix diffusion coefficient and $u$, $v$ are the trial
3390 and test spaces, respectively. The parameters $\sigma$ and $\kappa$ determine the
3391 DG method to be used (when this integrator is added to the "broken"
3392 DiffusionIntegrator):
3393 - $\sigma = -1$, $\kappa \geq \kappa_0$: symm. interior penalty (IP or SIPG) method,
3394 - $\sigma = +1$, $\kappa > 0$: non-symmetric interior penalty (NIPG) method,
3395 - $\sigma = +1$, $\kappa = 0$: the method of Baumann and Oden.
3396
3397 \todo Clarify used notation. */
3399{
3400protected:
3404
3405 // these are not thread-safe!
3408
3409
3410 // PA extension
3411 Vector pa_data; // (Q, h, dot(n,J)|el0, dot(n,J)|el1)
3412 const DofToQuad *maps; ///< Not owned
3415
3416public:
3418 : Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
3420 : Q(&q), MQ(NULL), sigma(s), kappa(k) { }
3422 : Q(NULL), MQ(&q), sigma(s), kappa(k) { }
3424 void AssembleFaceMatrix(const FiniteElement &el1,
3425 const FiniteElement &el2,
3427 DenseMatrix &elmat) override;
3428
3429 bool RequiresFaceNormalDerivatives() const override { return true; }
3430
3432
3433 void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override;
3434
3435 void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override;
3436
3437 void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn,
3438 Vector &y, Vector &dydn) const override;
3439
3441
3442 const IntegrationRule &GetRule(int order, Geometry::Type geom);
3443
3444private:
3445 void SetupPA(const FiniteElementSpace &fes, FaceType type);
3446};
3447
3448/** Integrator for the "BR2" diffusion stabilization term
3449 $$
3450 \sum_e \eta (r_e([u]), r_e([v]))
3451 $$
3452 where $r_e$ is the lifting operator defined on each edge $e$ (potentially
3453 weighted by a coefficient $Q$). The parameter eta can be chosen to be one to
3454 obtain a stable discretization. The constructor for this integrator requires
3455 the finite element space because the lifting operator depends on the
3456 element-wise inverse mass matrix.
3457
3458 BR2 stands for the second method of Bassi and Rebay:
3459
3460 - F. Bassi and S. Rebay. A high order discontinuous Galerkin method for
3461 compressible turbulent flows. In B. Cockburn, G. E. Karniadakis, and
3462 C.-W. Shu, editors, Discontinuous Galerkin Methods, pages 77-88. Springer
3463 Berlin Heidelberg, 2000.
3464 - D. N. Arnold, F. Brezzi, B. Cockburn, and L. D. Marini. Unified analysis
3465 of discontinuous Galerkin methods for elliptic problems. SIAM Journal on
3466 Numerical Analysis, 39(5):1749-1779, 2002.
3467*/
3469{
3470protected:
3472
3473 // Block factorizations of local mass matrices, with offsets for the case of
3474 // not equally sized blocks (mixed meshes, p-refinement)
3478
3480
3482
3486
3487 /// Precomputes the inverses (LU factorizations) of the local mass matrices.
3488 /** @a fes must be a DG space, so the mass matrix is block diagonal, and its
3489 inverse can be computed locally. This is required for the computation of
3490 the lifting operators @a r_e.
3491 */
3493
3494public:
3497 real_t e = 1.0);
3498 MFEM_DEPRECATED DGDiffusionBR2Integrator(class FiniteElementSpace *fes,
3499 real_t e = 1.0);
3500
3502 void AssembleFaceMatrix(const FiniteElement &el1,
3503 const FiniteElement &el2,
3505 DenseMatrix &elmat) override;
3506};
3507
3508/** Integrator for the DG elasticity form, for the formulations see:
3509 - PhD Thesis of Jonas De Basabe, High-Order Finite %Element Methods for
3510 Seismic Wave Propagation, UT Austin, 2009, p. 23, and references therein
3511 - Peter Hansbo and Mats G. Larson, Discontinuous Galerkin and the
3512 Crouzeix-Raviart %Element: Application to Elasticity, PREPRINT 2000-09,
3513 p.3
3514
3515 $$
3516 - \left< \{ \tau(u) \}, [v] \right> + \alpha \left< \{ \tau(v) \}, [u]
3517 \right> + \kappa \left< h^{-1} \{ \lambda + 2 \mu \} [u], [v] \right>
3518 $$
3519
3520 where $ \left<u, v\right> = \int_{F} u \cdot v $, and $ F $ is a
3521 face which is either a boundary face $ F_b $ of an element $ K $ or
3522 an interior face $ F_i $ separating elements $ K_1 $ and $ K_2 $.
3523
3524 In the bilinear form above $ \tau(u) $ is traction, and it's also
3525 $ \tau(u) = \sigma(u) \cdot \vec{n} $, where $ \sigma(u) $ is
3526 stress, and $ \vec{n} $ is the unit normal vector w.r.t. to $ F $.
3527
3528 In other words, we have
3529 $$
3530 - \left< \{ \sigma(u) \cdot \vec{n} \}, [v] \right> + \alpha \left< \{
3531 \sigma(v) \cdot \vec{n} \}, [u] \right> + \kappa \left< h^{-1} \{
3532 \lambda + 2 \mu \} [u], [v] \right>
3533 $$
3534
3535 For isotropic media
3536 $$
3537 \begin{split}
3538 \sigma(u) &= \lambda \nabla \cdot u I + 2 \mu \varepsilon(u) \\
3539 &= \lambda \nabla \cdot u I + 2 \mu \frac{1}{2} (\nabla u + \nabla
3540 u^{\mathrm{T}}) \\
3541 &= \lambda \nabla \cdot u I + \mu (\nabla u + \nabla u^{\mathrm{T}})
3542 \end{split}
3543 $$
3544
3545 where $ I $ is identity matrix, $ \lambda $ and $ \mu $ are Lame
3546 coefficients (see ElasticityIntegrator), $ u, v $ are the trial and test
3547 functions, respectively.
3548
3549 The parameters $ \alpha $ and $ \kappa $ determine the DG method to
3550 use (when this integrator is added to the "broken" ElasticityIntegrator):
3551
3552 - IIPG, $\alpha = 0$,
3553 C. Dawson, S. Sun, M. Wheeler, Compatible algorithms for coupled flow and
3554 transport, Comp. Meth. Appl. Mech. Eng., 193(23-26), 2565-2580, 2004.
3555
3556 - SIPG, $\alpha = -1$,
3557 M. Grote, A. Schneebeli, D. Schotzau, Discontinuous Galerkin Finite
3558 %Element Method for the Wave Equation, SINUM, 44(6), 2408-2431, 2006.
3559
3560 - NIPG, $\alpha = 1$,
3561 B. Riviere, M. Wheeler, V. Girault, A Priori Error Estimates for Finite
3562 %Element Methods Based on Discontinuous Approximation Spaces for Elliptic
3563 Problems, SINUM, 39(3), 902-931, 2001.
3564
3565 This is a '%Vector' integrator, i.e. defined for FE spaces using multiple
3566 copies of a scalar FE space.
3567 */
3569{
3570public:
3572 : lambda(NULL), mu(NULL), alpha(alpha_), kappa(kappa_) { }
3573
3575 real_t alpha_, real_t kappa_)
3576 : lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
3577
3579 void AssembleFaceMatrix(const FiniteElement &el1,
3580 const FiniteElement &el2,
3582 DenseMatrix &elmat) override;
3583
3584protected:
3587
3588#ifndef MFEM_THREAD_SAFE
3589 // values of all scalar basis functions for one component of u (which is a
3590 // vector) at the integration point in the reference space
3592 // values of derivatives of all scalar basis functions for one component
3593 // of u (which is a vector) at the integration point in the reference space
3595 // Adjugate of the Jacobian of the transformation: adjJ = det(J) J^{-1}
3597 // gradient of shape functions in the real (physical, not reference)
3598 // coordinates, scaled by det(J):
3599 // dshape_ps(jdof,jm) = sum_{t} adjJ(t,jm)*dshape(jdof,t)
3601 Vector nor; // nor = |weight(J_face)| n
3602 Vector nL1, nL2; // nL1 = (lambda1 * ip.weight / detJ1) nor
3603 Vector nM1, nM2; // nM1 = (mu1 * ip.weight / detJ1) nor
3604 Vector dshape1_dnM, dshape2_dnM; // dshape1_dnM = dshape1_ps . nM1
3605 // 'jmat' corresponds to the term: kappa <h^{-1} {lambda + 2 mu} [u], [v]>
3607#endif
3608
3609 static void AssembleBlock(
3610 const int dim, const int row_ndofs, const int col_ndofs,
3611 const int row_offset, const int col_offset,
3612 const real_t jmatcoef, const Vector &col_nL, const Vector &col_nM,
3613 const Vector &row_shape, const Vector &col_shape,
3614 const Vector &col_dshape_dnM, const DenseMatrix &col_dshape,
3615 DenseMatrix &elmat, DenseMatrix &jmat);
3616};
3617
3618/** Integrator for the DPG form:$ \langle v, [w] \rangle $ over all faces (the interface) where
3619 the trial variable $v$ is defined on the interface and the test variable $w$ is
3620 defined inside the elements, generally in a DG space. */
3622{
3623private:
3624 Vector face_shape, shape1, shape2;
3625
3626public:
3629 void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3630 const FiniteElement &test_fe1,
3631 const FiniteElement &test_fe2,
3633 DenseMatrix &elmat) override;
3634};
3635
3636/** Integrator for the form:$ \langle v, [w \cdot n] \rangle $ over all faces (the interface) where
3637 the trial variable $v$ is defined on the interface and the test variable $w$ is
3638 in an $H(div)$-conforming space. */
3640{
3641private:
3642 Vector face_shape, normal, shape1_n, shape2_n;
3643 DenseMatrix shape1, shape2;
3644
3645public:
3648 void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3649 const FiniteElement &test_fe1,
3650 const FiniteElement &test_fe2,
3652 DenseMatrix &elmat) override;
3653
3655 void AssembleEAInteriorFaces(const FiniteElementSpace &trial_fes,
3656 const FiniteElementSpace &test_fes,
3657 Vector &emat,
3658 const bool add = true) override;
3659};
3660
3661/** Integrator for the DPG form:$ \langle v, w \rangle $ over a face (the interface) where
3662 the trial variable $v$ is defined on the interface
3663 ($H^{-1/2}$ i.e., $v := u \cdot n$ normal trace of $H(div)$)
3664 and the test variable $w$ is in an $H^1$-conforming space. */
3666{
3667private:
3668 Vector face_shape, shape;
3669public:
3671 void AssembleTraceFaceMatrix(int elem,
3672 const FiniteElement &trial_face_fe,
3673 const FiniteElement &test_fe,
3675 DenseMatrix &elmat);
3676};
3677
3678/** Integrator for the form: $ \langle v, w \cdot n \rangle $ over a face (the interface) where
3679 the trial variable $v$ is defined on the interface ($H^{1/2}$, i.e., trace of $H^1$)
3680 and the test variable $w$ is in an $H(div)$-conforming space. */
3682{
3683private:
3684 Vector face_shape, normal, shape_n;
3685 DenseMatrix shape;
3686
3687public:
3689 void AssembleTraceFaceMatrix(int ielem,
3690 const FiniteElement &trial_face_fe,
3691 const FiniteElement &test_fe,
3693 DenseMatrix &elmat) override;
3694};
3695
3696
3697/** Integrator for the form: $\langle v, w \times n \rangle$ over a face (the interface)
3698 * In 3D the trial variable $v$ is defined on the interface ($H^{-1/2}$(curl), trace of $H(curl$)
3699 * In 2D it's defined on the interface ($H^{1/2}$, trace of $H^1$)
3700 * The test variable $w$ is in an $H(curl$-conforming space. */
3702{
3703private:
3704 DenseMatrix face_shape, shape, shape_n;
3705 Vector normal;
3706 Vector temp;
3707
3708 void cross_product(const Vector & x, const DenseMatrix & Y, DenseMatrix & Z)
3709 {
3710 int dim = x.Size();
3711 MFEM_VERIFY(Y.Width() == dim, "Size mismatch");
3712 int dimc = dim == 3 ? dim : 1;
3713 int h = Y.Height();
3714 Z.SetSize(h,dimc);
3715 if (dim == 3)
3716 {
3717 for (int i = 0; i<h; i++)
3718 {
3719 Z(i,0) = x(2) * Y(i,1) - x(1) * Y(i,2);
3720 Z(i,1) = x(0) * Y(i,2) - x(2) * Y(i,0);
3721 Z(i,2) = x(1) * Y(i,0) - x(0) * Y(i,1);
3722 }
3723 }
3724 else
3725 {
3726 for (int i = 0; i<h; i++)
3727 {
3728 Z(i,0) = x(1) * Y(i,0) - x(0) * Y(i,1);
3729 }
3730 }
3731 }
3732
3733public:
3735 void AssembleTraceFaceMatrix(int elem,
3736 const FiniteElement &trial_face_fe,
3737 const FiniteElement &test_fe,
3739 DenseMatrix &elmat);
3740};
3741
3742/** Abstract class to serve as a base for local interpolators to be used in the
3743 DiscreteLinearOperator class. */
3745
3746
3747/** Class for constructing the gradient as a DiscreteLinearOperator from an
3748 $H^1$-conforming space to an $H(curl$-conforming space. The range space can be
3749 vector $L_2$ space as well. */
3751{
3752public:
3753 GradientInterpolator() : dofquad_fe(NULL) { }
3754 virtual ~GradientInterpolator() { delete dofquad_fe; }
3755
3757 const FiniteElement &nd_fe,
3758 ElementTransformation &Trans,
3759 DenseMatrix &elmat) override
3760 { nd_fe.ProjectGrad(h1_fe, Trans, elmat); }
3761
3763
3764 /** @brief Setup method for PA data.
3765
3766 @param[in] trial_fes $H^1$ Lagrange space
3767 @param[in] test_fes $H(curl$ Nedelec space
3768 */
3769 void AssemblePA(const FiniteElementSpace &trial_fes,
3770 const FiniteElementSpace &test_fes) override;
3771
3772 void AddMultPA(const Vector &x, Vector &y) const override;
3773 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3774
3775private:
3776 /// 1D finite element that generates and owns the 1D DofToQuad maps below
3777 FiniteElement *dofquad_fe;
3778
3779 bool B_id; // is the B basis operator (maps_C_C) the identity?
3780 const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3781 const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3782 int dim, ne, o_dofs1D, c_dofs1D;
3783};
3784
3785
3786/** Class for constructing the identity map as a DiscreteLinearOperator. This
3787 is the discrete embedding matrix when the domain space is a subspace of
3788 the range space. Otherwise, a dof projection matrix is constructed. */
3790{
3791protected:
3792 const int vdim;
3793
3794public:
3795 /** @brief Construct an identity interpolator.
3796
3797 @param[in] vdim_ Vector dimension (number of components) in the domain
3798 and range FE spaces.
3799 */
3800 IdentityInterpolator(int vdim_ = 1) : vdim(vdim_) { }
3801
3803 const FiniteElement &ran_fe,
3804 ElementTransformation &Trans,
3805 DenseMatrix &elmat) override
3806 {
3807 if (vdim == 1)
3808 {
3809 ran_fe.Project(dom_fe, Trans, elmat);
3810 return;
3811 }
3812 DenseMatrix elmat_block;
3813 ran_fe.Project(dom_fe, Trans, elmat_block);
3814 elmat.SetSize(vdim*elmat_block.Height(), vdim*elmat_block.Width());
3815 elmat = 0_r;
3816 for (int i = 0; i < vdim; i++)
3817 {
3818 elmat.SetSubMatrix(i*elmat_block.Height(), i*elmat_block.Width(),
3819 elmat_block);
3820 }
3821 }
3822
3824 void AssemblePA(const FiniteElementSpace &trial_fes,
3825 const FiniteElementSpace &test_fes) override;
3826
3827 void AddMultPA(const Vector &x, Vector &y) const override;
3828 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3829
3830private:
3831 /// 1D finite element that generates and owns the 1D DofToQuad maps below
3832 std::unique_ptr<FiniteElement> dofquad_fe;
3833
3834 const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3835 const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3836 int dim, ne, o_dofs1D, c_dofs1D;
3837
3838 Vector pa_data;
3839};
3840
3841
3842/** @brief Class identical to IdentityInterpolator with the exception that it
3843 requires the vector dimension (number of components) to be specified during
3844 construction. */
3846{
3847public:
3849};
3850
3851
3852/** Class for constructing the (local) discrete curl matrix which can be used
3853 as an integrator in a DiscreteLinearOperator object to assemble the global
3854 discrete curl matrix. */
3856{
3857public:
3859 const FiniteElement &ran_fe,
3860 ElementTransformation &Trans,
3861 DenseMatrix &elmat) override
3862 { ran_fe.ProjectCurl(dom_fe, Trans, elmat); }
3863};
3864
3865
3866/** Class for constructing the (local) discrete divergence matrix which can
3867 be used as an integrator in a DiscreteLinearOperator object to assemble
3868 the global discrete divergence matrix.
3869
3870 Note: Since the dofs in the L2_FECollection are nodal values, the local
3871 discrete divergence matrix (with an $H(div)$-type domain space) will depend on
3872 the transformation. On the other hand, the local matrix returned by
3873 VectorFEDivergenceIntegrator is independent of the transformation. */
3875{
3876public:
3878 const FiniteElement &ran_fe,
3879 ElementTransformation &Trans,
3880 DenseMatrix &elmat) override
3881 { ran_fe.ProjectDiv(dom_fe, Trans, elmat); }
3882};
3883
3884
3885/** A trace face interpolator class for interpolating the normal component of
3886 the domain space, e.g. vector $H^1$, into the range space, e.g. the trace of
3887 $H(div)$ which uses FiniteElement::INTEGRAL map type. */
3889{
3890public:
3891 void AssembleElementMatrix2(const FiniteElement &dom_fe,
3892 const FiniteElement &ran_fe,
3893 ElementTransformation &Trans,
3894 DenseMatrix &elmat) override;
3895};
3896
3897/** Interpolator of a scalar coefficient multiplied by a scalar field onto
3898 another scalar field. Note that this can produce inaccurate fields unless
3899 the target is sufficiently high order. */
3901{
3902public:
3904
3905 void AssembleElementMatrix2(const FiniteElement &dom_fe,
3906 const FiniteElement &ran_fe,
3907 ElementTransformation &Trans,
3908 DenseMatrix &elmat) override;
3909
3910protected:
3912};
3913
3914/** Interpolator of a scalar coefficient multiplied by a vector field onto
3915 another vector field. Note that this can produce inaccurate fields unless
3916 the target is sufficiently high order. */
3918{
3919public:
3922
3923 void AssembleElementMatrix2(const FiniteElement &dom_fe,
3924 const FiniteElement &ran_fe,
3925 ElementTransformation &Trans,
3926 DenseMatrix &elmat) override;
3927protected:
3929};
3930
3931/** Interpolator of a vector coefficient multiplied by a scalar field onto
3932 another vector field. Note that this can produce inaccurate fields unless
3933 the target is sufficiently high order. */
3935{
3936public:
3939
3940 void AssembleElementMatrix2(const FiniteElement &dom_fe,
3941 const FiniteElement &ran_fe,
3942 ElementTransformation &Trans,
3943 DenseMatrix &elmat) override;
3944protected:
3946};
3947
3948/** Interpolator of the 2D cross product between a vector coefficient and an
3949 $H(curl$-conforming field onto an $L_2$-conforming field. */
3951{
3952public:
3955
3956 void AssembleElementMatrix2(const FiniteElement &nd_fe,
3957 const FiniteElement &l2_fe,
3958 ElementTransformation &Trans,
3959 DenseMatrix &elmat) override;
3960protected:
3962};
3963
3964/** Interpolator of the cross product between a vector coefficient and an
3965 $H(curl$-conforming field onto an $H(div)$-conforming field. The range space
3966 can also be vector $L_2$. */
3968{
3969public:
3972
3973 void AssembleElementMatrix2(const FiniteElement &nd_fe,
3974 const FiniteElement &rt_fe,
3975 ElementTransformation &Trans,
3976 DenseMatrix &elmat) override;
3977protected:
3979};
3980
3981/** Interpolator of the inner product between a vector coefficient and an
3982 $H(div)$-conforming field onto an $L_2$-conforming field. The range space can
3983 also be $H^1$. */
3985{
3986public:
3988
3989 void AssembleElementMatrix2(const FiniteElement &rt_fe,
3990 const FiniteElement &l2_fe,
3991 ElementTransformation &Trans,
3992 DenseMatrix &elmat) override;
3993protected:
3995};
3996
3997}
3998#endif
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Definition array.hpp:830
Abstract base class BilinearFormIntegrator.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssembleEABoundary(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add=true)
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect) override
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
virtual void AssembleTraceFaceMatrix(int elem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
void AssembleFaceVector(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, Vector &elvect) override
Perform the local action of the BilinearFormIntegrator resulting from a face integral term....
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add=true)
Method defining element assembly.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AddMultTransposeMF(const Vector &x, Vector &y) const
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag)
Assemble diagonal of ( is this integrator) and add it to diag.
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add=true)
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true, const IntegrationRule *ir=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
BilinearFormIntegrator(const IntegrationRule *ir=NULL)
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add=true)
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssemblePatchMatrix(const int patch, const FiniteElementSpace &fes, SparseMatrix *&smat)
void AssembleFaceGrad(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, DenseMatrix &elmat) override
Assemble the local action of the gradient of the NonlinearFormIntegrator resulting from a face integr...
void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat) override
Assemble the local gradient matrix.
virtual void AssemblePABoundary(const FiniteElementSpace &fes)
virtual void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn, Vector &y, Vector &dydn) const
Method for partially assembled action.
virtual bool RequiresFaceNormalDerivatives() const
For bilinear forms on element faces, specifies if the normal derivatives are needed on the faces or j...
virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
void AddMultMF(const Vector &x, Vector &y) const override
virtual void AddMultNURBSPA(const Vector &x, Vector &y) const
Method for partially assembled action on NURBS patches.
virtual void AssembleNURBSPA(const FiniteElementSpace &fes)
Method defining partial assembly on NURBS patches.
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
BoundaryMassIntegrator(Coefficient &q)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
, negative transpose of ConvectionIntegrator
ConservativeConvectionIntegrator(VectorCoefficient &q, real_t a=1.0)
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
const DofToQuad * maps
Not owned.
bool SupportsCeed() const override
Indicates whether this integrator can use a Ceed backend.
static const IntegrationRule & GetRule(const FiniteElement &el, const ElementTransformation &Trans)
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssemblePA(const FiniteElementSpace &) override
Method defining partial assembly.
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
VectorCoefficient * Q
ConvectionIntegrator(VectorCoefficient &q, real_t a=1.0)
void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &) override
Given a particular Finite Element computes the element matrix elmat.
void AddMultMF(const Vector &, Vector &) const override
const GeometricFactors * geom
Not owned.
const IntegrationRule * GetDefaultIntegrationRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &trans) const override
Subclasses should override to choose a default integration rule.
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
Integrator for for Nedelec elements.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
CurlCurlIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
Construct a bilinear form integrator for Nedelec elements.
const GeometricFactors * geom
Not owned.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef, const IntegrationRule *ir=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
bool symmetric
False if using a nonsymmetric matrix coefficient.
const Coefficient * GetCoefficient() const
CurlCurlIntegrator(DiagonalMatrixCoefficient &dq, const IntegrationRule *ir=NULL)
MatrixCoefficient * MQ
CurlCurlIntegrator(MatrixCoefficient &mq, const IntegrationRule *ir=NULL)
real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
DiagonalMatrixCoefficient * DQ
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void PrecomputeMassInverse(class FiniteElementSpace &fes)
Precomputes the inverses (LU factorizations) of the local mass matrices.
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
DGDiffusionBR2Integrator(class FiniteElementSpace &fes, real_t e=1.0)
bool RequiresFaceNormalDerivatives() const override
For bilinear forms on element faces, specifies if the normal derivatives are needed on the faces or j...
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
const IntegrationRule & GetRule(int order, FaceElementTransformations &T)
DGDiffusionIntegrator(const real_t s, const real_t k)
DGDiffusionIntegrator(Coefficient &q, const real_t s, const real_t k)
DGDiffusionIntegrator(MatrixCoefficient &q, const real_t s, const real_t k)
void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn, Vector &y, Vector &dydn) const override
Method for partially assembled action.
void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override
const DofToQuad * maps
Not owned.
static void AssembleBlock(const int dim, const int row_ndofs, const int col_ndofs, const int row_offset, const int col_offset, const real_t 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)
DGElasticityIntegrator(real_t alpha_, real_t kappa_)
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
DGElasticityIntegrator(Coefficient &lambda_, Coefficient &mu_, real_t alpha_, real_t kappa_)
Solver for the discontinuous Galerkin mass matrix.
Definition dgmassinv.hpp:28
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
VectorCoefficient * u
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
static const IntegrationRule & GetRule(Geometry::Type geom, int order, const FaceElementTransformations &T)
DGTraceIntegrator(VectorCoefficient &u_, real_t a)
Construct integrator with , .
const FaceGeometricFactors * geom
Not owned.
DGTraceIntegrator(VectorCoefficient &u_, real_t a, real_t b)
Construct integrator with .
void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add) override
DGTraceIntegrator(Coefficient &rho_, VectorCoefficient &u_, real_t a, real_t b)
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add) override
const DofToQuad * maps
Not owned.
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Definition densemat.hpp:108
void SetSubMatrix(const Array< int > &idx, const DenseMatrix &A)
Set (*this)(idx[i],idx[j]) = A(i,j)
Class for integrating where and are scalars.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
DerivativeIntegrator(Coefficient &q, int i)
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe)
void AddMultMF(const Vector &, Vector &) const override
real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
void AssemblePatchMatrix(const int patch, const FiniteElementSpace &fes, SparseMatrix *&smat) override
void AddMultNURBSPA(const Vector &, Vector &) const override
Method for partially assembled action on NURBS patches.
DiffusionIntegrator(const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with coefficient Q = 1.
void AssemblePatchPA(const int patch, const FiniteElementSpace &fes)
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
void(*)(const int, const bool, const Array< real_t > &, const Array< real_t > &, const Vector &, Vector &, const int, const int) DiagonalKernelType
void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect) override
Perform the local action of the BilinearFormIntegrator.
MatrixCoefficient * MQ
bool SupportsCeed() const override
Indicates whether this integrator can use a Ceed backend.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true, const IntegrationRule *ir=NULL) override
Virtual method required for Zienkiewicz-Zhu type error estimators.
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int))
const IntegrationRule * GetDefaultIntegrationRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &trans) const override
Subclasses should override to choose a default integration rule.
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
VectorCoefficient * VQ
void AddMultPatchPA(const int patch, const Vector &x, Vector &y) const
static void AddSpecialization()
void AssembleNURBSPA(const FiniteElementSpace &fes) override
Method defining partial assembly on NURBS patches.
MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType,(int, int, int))
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AddMultTransposePA(const Vector &, Vector &) const override
Method for partially assembled transposed action.
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void(*)(const int, const bool, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, Vector &, const int, const int) ApplyKernelType
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
Coefficient * GetCoefficient() const
for Raviart-Thomas elements
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
DivDivIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
const Coefficient * GetCoefficient() const
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Structure representing the matrices/tensors needed to evaluate (in reference space) the values,...
Definition fe_base.hpp:141
Integrator that computes the PA action of one of the blocks in an ElasticityIntegrator,...
ElasticityComponentIntegrator(ElasticityIntegrator &parent_, int i_, int j_)
Given an ElasticityIntegrator, create an integrator that represents the th component block.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add=true) override
Method defining element assembly.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
ElasticityIntegrator(Coefficient &m, real_t q_l, real_t q_m)
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true, const IntegrationRule *ir=NULL) override
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Tr, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
ElasticityIntegrator(Coefficient &l, Coefficient &m)
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
virtual int OrderW() const =0
Return the order of the determinant of the Jacobian (weight) of the transformation.
A specialized ElementTransformation class representing a face and its two neighboring elements.
Definition eltrans.hpp:750
Structure for storing face geometric factors: coordinates, Jacobians, determinants of the Jacobians,...
Definition mesh.hpp:2991
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:244
Abstract class for all finite elements.
Definition fe_base.hpp:244
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:40
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_base.cpp:175
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
Definition fe_base.hpp:325
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition fe_base.hpp:338
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:192
int GetDerivType() const
Returns the FiniteElement::DerivType of the element describing the spatial derivative method implemen...
Definition fe_base.hpp:365
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_base.cpp:161
int GetDim() const
Returns the reference space dimension for the finite element.
Definition fe_base.hpp:321
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
Definition fe_base.hpp:351
int Space() const
Returns the type of FunctionSpace on the element.
Definition fe_base.hpp:348
@ DIV
Implements CalcDivShape methods.
Definition fe_base.hpp:306
@ CURL
Implements CalcCurlShape methods.
Definition fe_base.hpp:307
@ GRAD
Implements CalcDShape methods.
Definition fe_base.hpp:305
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:126
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:58
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
Definition fe_base.hpp:328
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_base.cpp:168
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:71
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:182
@ Pk
Polynomials of order k.
Definition fe_base.hpp:230
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Definition mesh.hpp:2937
GradientIntegrator(Coefficient *q_)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
const IntegrationRule * GetDefaultIntegrationRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &trans) const override
Subclasses should override to choose a default integration rule.
GradientIntegrator(Coefficient &q)
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
Setup method for PA data.
void AssembleElementMatrix2(const FiniteElement &h1_fe, const FiniteElement &nd_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
using the "group" FE discretization
void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &) override
Given a particular Finite Element computes the element matrix elmat.
GroupConvectionIntegrator(VectorCoefficient &q, real_t a=1.0)
IdentityInterpolator(int vdim_=1)
Construct an identity interpolator.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
A class to initialize the size of a Tensor.
Definition dtensor.hpp:55
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
Container class for integration rules.
Definition intrules.hpp:422
Integrator that inverts the matrix assembled by another integrator.
InverseIntegrator(BilinearFormIntegrator *integ, int own_integ=1)
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
LumpedIntegrator(BilinearFormIntegrator *bfi_, int own_bfi_=1)
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
const FiniteElementSpace * fespace
const FaceGeometricFactors * face_geom
Not owned.
MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType,(int, int, int))
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int))
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
const DofToQuad * maps
Not owned.
void(*)(const int, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, Vector &, const int, const int) ApplyKernelType
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void(*)(const int, const Array< real_t > &, const Vector &, Vector &, const int, const int) DiagonalKernelType
void AssembleEA_(Vector &ea, const bool add)
void AssemblePABoundary(const FiniteElementSpace &fes) override
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
const IntegrationRule * GetDefaultIntegrationRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &trans) const override
Subclasses should override to choose a default integration rule.
MassIntegrator(const IntegrationRule *ir=nullptr)
bool SupportsCeed() const override
Indicates whether this integrator can use a Ceed backend.
virtual void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
const GeometricFactors * geom
Not owned.
virtual void AssembleEABoundary(const FiniteElementSpace &fes, Vector &emat, const bool add) override
void AddMultMF(const Vector &, Vector &) const override
void AddMultTransposePA(const Vector &, Vector &) const override
Method for partially assembled transposed action.
static void AddSpecialization()
const Coefficient * GetCoefficient() const
Base class for Matrix Coefficients that optionally depend on time and space.
Mesh data type.
Definition mesh.hpp:64
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedCrossCurlCurlIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedCrossCurlGradIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual const char * FiniteElementTypeFailureMessage() const
MixedCrossCurlIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedCrossGradCurlIntegrator(VectorCoefficient &vq)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedCrossGradGradIntegrator(VectorCoefficient &vq)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual int GetTrialVDim(const FiniteElement &trial_fe)
MixedCrossGradIntegrator(VectorCoefficient &vq)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedCrossProductIntegrator(VectorCoefficient &vq)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedCurlCurlIntegrator(MatrixCoefficient &mq)
MixedCurlCurlIntegrator(DiagonalMatrixCoefficient &dq)
MixedCurlCurlIntegrator(Coefficient &q)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedCurlIntegrator(Coefficient &q)
MixedCurlIntegrator(Coefficient *q_)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedDirectionalDerivativeIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetVDim(const FiniteElement &vector_fe)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedDivGradIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
virtual int GetVDim(const FiniteElement &vector_fe)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedDotProductIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
MixedGradDivIntegrator(VectorCoefficient &vq)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual int GetVDim(const FiniteElement &vector_fe)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual const char * FiniteElementTypeFailureMessage() const
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedGradGradIntegrator(DiagonalMatrixCoefficient &dq)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedGradGradIntegrator(Coefficient &q)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTestVDim(const FiniteElement &test_fe)
MixedGradGradIntegrator(MatrixCoefficient &mq)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
MixedScalarCrossCurlIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedScalarCrossGradIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
int GetVDim(const FiniteElement &vector_fe)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
MixedScalarCrossProductIntegrator(VectorCoefficient &vq)
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
const char * FiniteElementTypeFailureMessage() const override
bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const override
MixedScalarCurlIntegrator(Coefficient &q)
int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans) override
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape) override
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Support for use in BilinearForm. Can be used only when appropriate.
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, Vector &shape)
MixedScalarIntegrator(Coefficient &q)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
MixedScalarMassIntegrator(Coefficient &q)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedScalarVectorIntegrator(VectorCoefficient &vq, bool transpose_=false, bool cross_2d_=false)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape_)
void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Support for use in BilinearForm. Can be used only when appropriate.
virtual int GetVDim(const FiniteElement &vector_fe)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape_)
MixedScalarWeakCrossProductIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedScalarWeakCurlCrossIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
MixedScalarWeakDivergenceIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
int GetVDim(const FiniteElement &vector_fe)
virtual void CalcVShape(const FiniteElement &vector_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
void AddMultTransposePA(const Vector &, Vector &) const override
Method for partially assembled transposed action.
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
int GetTrialVDim(const FiniteElement &trial_fe) override
MixedVectorCurlIntegrator(Coefficient &q)
void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape) override
const char * FiniteElementTypeFailureMessage() const override
MixedVectorCurlIntegrator(DiagonalMatrixCoefficient &dq)
bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const override
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
MixedVectorCurlIntegrator(MatrixCoefficient &mq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
MixedVectorDivergenceIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
const char * FiniteElementTypeFailureMessage() const override
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const override
MixedVectorGradientIntegrator(MatrixCoefficient &mq)
MixedVectorGradientIntegrator(DiagonalMatrixCoefficient &dq)
void AddMultTransposePA(const Vector &, Vector &) const override
Method for partially assembled transposed action.
int GetTrialVDim(const FiniteElement &trial_fe) override
void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape) override
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
virtual const char * FiniteElementTypeFailureMessage() const
VectorCoefficient * VQ
void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Support for use in BilinearForm. Can be used only when appropriate.
MixedVectorIntegrator(VectorCoefficient &vq, bool diag=true)
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual int GetTestVDim(const FiniteElement &test_fe)
MatrixCoefficient * MQ
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTrialVDim(const FiniteElement &trial_fe)
MixedVectorIntegrator(Coefficient &q)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
DiagonalMatrixCoefficient * DQ
MixedVectorIntegrator(MatrixCoefficient &mq)
MixedVectorMassIntegrator(Coefficient &q)
MixedVectorMassIntegrator(DiagonalMatrixCoefficient &dq)
MixedVectorMassIntegrator(MatrixCoefficient &mq)
MixedVectorProductIntegrator(VectorCoefficient &vq)
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
int GetTestVDim(const FiniteElement &test_fe) override
void AddMultTransposePA(const Vector &, Vector &) const override
Method for partially assembled transposed action.
MixedVectorWeakCurlIntegrator(DiagonalMatrixCoefficient &dq)
bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const override
MixedVectorWeakCurlIntegrator(MatrixCoefficient &mq)
const char * FiniteElementTypeFailureMessage() const override
void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape) override
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorWeakDivergenceIntegrator(DiagonalMatrixCoefficient &dq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
MixedVectorWeakDivergenceIntegrator(MatrixCoefficient &mq)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual const char * FiniteElementTypeFailureMessage() const
MixedWeakCurlCrossIntegrator(VectorCoefficient &vq)
MixedWeakDivCrossIntegrator(VectorCoefficient &vq)
virtual const char * FiniteElementTypeFailureMessage() const
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual int GetTestVDim(const FiniteElement &test_fe)
MixedWeakGradDotIntegrator(VectorCoefficient &vq)
virtual void CalcShape(const FiniteElement &scalar_fe, ElementTransformation &Trans, Vector &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual int GetIntegrationOrder(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
NonconservativeDGTraceIntegrator(VectorCoefficient &u, real_t a, real_t b)
NonconservativeDGTraceIntegrator(Coefficient &rho, VectorCoefficient &u, real_t a, real_t b)
NonconservativeDGTraceIntegrator(VectorCoefficient &u, real_t a)
This class is used to express the local action of a general nonlinear finite element operator....
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleTraceFaceMatrix(int ielem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleEAInteriorFaces(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes, Vector &emat, const bool add=true) override
Method defining element assembly for mixed trace integrators.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition operator.hpp:66
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Definition operator.hpp:72
void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
ScalarCrossProductInterpolator(VectorCoefficient &vc)
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
ScalarProductInterpolator(Coefficient &sc)
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Data type sparse matrix.
Definition sparsemat.hpp:51
Integrator defining a sum of multiple Integrators.
void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add) override
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AddIntegrator(BilinearFormIntegrator *integ)
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AddMultMF(const Vector &x, Vector &y) const override
void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add) override
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override
void AddMultTransposeMF(const Vector &x, Vector &y) const override
SumIntegrator(int own_integs=1)
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
void AssembleTraceFaceMatrix(int elem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
void AssembleTraceFaceMatrix(int elem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
TransposeIntegrator(BilinearFormIntegrator *bfi_, int own_bfi_=1)
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override
void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add) override
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add) override
Base class for vector Coefficients that optionally depend on time and space.
void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &rt_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
VectorCrossProductInterpolator(VectorCoefficient &vc)
VectorCurlCurlIntegrator(Coefficient &q)
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Assemble an element matrix.
real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun) override
Compute element energy: .
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
VectorDiffusionIntegrator(int vector_dimension)
Integrator with unit coefficient for caller-specified vector dimension.
VectorDiffusionIntegrator(Coefficient &q)
const DofToQuad * maps
Not owned.
VectorDiffusionIntegrator(Coefficient &q, int vector_dimension)
Integrator with scalar coefficient for caller-specified vector dimension.
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
VectorDiffusionIntegrator(VectorCoefficient &vq)
Integrator with VectorCoefficient. The vector dimension of the FiniteElementSpace is assumed to be th...
void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect) override
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
VectorDiffusionIntegrator(Coefficient &q, const IntegrationRule *ir)
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AddMultMF(const Vector &x, Vector &y) const override
const GeometricFactors * geom
Not owned.
bool SupportsCeed() const override
Indicates whether this integrator can use a Ceed backend.
VectorDiffusionIntegrator(MatrixCoefficient &mq)
Integrator with MatrixCoefficient. The vector dimension of the FiniteElementSpace is assumed to be th...
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
const IntegrationRule * GetDefaultIntegrationRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &trans) const override
Subclasses should override to choose a default integration rule.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
VectorDivergenceIntegrator(Coefficient &q)
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
VectorDivergenceIntegrator(Coefficient *q_)
Integrator for (Q u.n, v.n) for RT elements.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
VectorFECurlIntegrator(Coefficient &q)
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
void AddMultTransposePA(const Vector &, Vector &) const override
Method for partially assembled transposed action.
void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes) override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag) override
Assemble diagonal of ( is this integrator) and add it to diag.
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
VectorFEMassIntegrator(DiagonalMatrixCoefficient *dq_)
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
const Coefficient * GetCoefficient() const
VectorFEMassIntegrator(MatrixCoefficient &mq)
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
VectorFEMassIntegrator(MatrixCoefficient *mq_)
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
VectorFEMassIntegrator(Coefficient *q_)
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add) override
Method defining element assembly.
const DofToQuad * mapsOtest
Not owned. DOF-to-quad map, open.
VectorFEMassIntegrator(DiagonalMatrixCoefficient &dq)
VectorFEMassIntegrator(Coefficient &q)
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
bool symmetric
False if using a nonsymmetric matrix coefficient.
void AddMultTransposePA(const Vector &x, Vector &y) const override
Method for partially assembled transposed action.
DiagonalMatrixCoefficient * DQ
const DofToQuad * mapsCtest
Not owned. DOF-to-quad map, closed.
const GeometricFactors * geom
Not owned.
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Class identical to IdentityInterpolator with the exception that it requires the vector dimension (num...
void AssembleElementMatrix2(const FiniteElement &rt_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
VectorInnerProductInterpolator(VectorCoefficient &vc)
VectorCoefficient * VQ
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AssembleDiagonalPA(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AddMultMF(const Vector &x, Vector &y) const override
const DofToQuad * maps
Not owned.
VectorMassIntegrator(VectorCoefficient &q, int qo=0)
Construct an integrator with diagonal coefficient q.
VectorMassIntegrator(Coefficient &q, int qo=0)
void AddMultPA(const Vector &x, Vector &y) const override
Method for partially assembled action.
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
VectorMassIntegrator(MatrixCoefficient &q, int qo=0)
Construct an integrator with matrix coefficient q.
MatrixCoefficient * MQ
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
VectorMassIntegrator(Coefficient &q, const IntegrationRule *ir)
VectorMassIntegrator()
Construct an integrator with coefficient 1.0.
const GeometricFactors * geom
Not owned.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
bool SupportsCeed() const override
Indicates whether this integrator can use a Ceed backend.
VectorScalarProductInterpolator(VectorCoefficient &vc)
void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
Vector data type.
Definition vector.hpp:82
int Size() const
Returns the size of the vector.
Definition vector.hpp:226
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
Definition vector.hpp:235
int dimc
Definition maxwell.cpp:123
int dim
Definition ex24.cpp:53
void trans(const Vector &u, Vector &x)
Definition ex27.cpp:412
real_t b
Definition lissajous.cpp:42
real_t a
Definition lissajous.cpp:41
real_t u(const Vector &xvec)
Definition lor_mms.hpp:22
void add(const Vector &v1, const Vector &v2, Vector &v)
Definition vector.cpp:391
bool DeviceCanUseCeed()
Function that determines if a CEED kernel should be used, based on the current mfem::Device configura...
Definition util.cpp:33
float real_t
Definition config.hpp:43
FaceType
Definition mesh.hpp:48