MFEM v4.9.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{
26class QuadratureSpace;
27class FaceQuadratureSpace;
28
29/// Abstract base class BilinearFormIntegrator
31{
32protected:
35
36public:
37 // TODO: add support for other assembly levels (in addition to PA) and their
38 // actions.
39
40 // TODO: for mixed meshes the quadrature rules to be used by methods like
41 // AssemblePA() can be given as a QuadratureSpace, e.g. using a new method:
42 // SetQuadratureSpace().
43
44 // TODO: the methods for the various assembly levels make sense even in the
45 // base class NonlinearFormIntegrator, except that not all assembly levels
46 // make sense for the action of the nonlinear operator (but they all make
47 // sense for its Jacobian).
48
49 /// Method defining partial assembly.
50 /** The result of the partial assembly is stored internally so that it can be
51 used later in the methods AddMultPA() and AddMultTransposePA(). */
52 void AssemblePA(const FiniteElementSpace &fes) override;
53 /** Used with BilinearFormIntegrators that have different spaces. */
54 void AssemblePA(const FiniteElementSpace &trial_fes,
55 const FiniteElementSpace &test_fes) override;
56
57 /// Method defining partial assembly on NURBS patches.
58 /** The result of the partial assembly is stored internally so that it can be
59 used later in the method AddMultNURBSPA(). */
60 virtual void AssembleNURBSPA(const FiniteElementSpace &fes);
61
62 virtual void AssemblePABoundary(const FiniteElementSpace &fes);
63
64 virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
65
66 virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
67
68 /// Assemble diagonal and add it to Vector @a diag.
69 virtual void AssembleDiagonalPA(Vector &diag);
70
71 /// Assemble diagonal of $A D A^T$ ($A$ is this integrator) and add it to @a diag.
72 virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
73
74 /// Method for partially assembled action.
75 /** Perform the action of integrator on the input @a x and add the result to
76 the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
77 the element-wise discontinuous version of the FE space.
78
79 This method can be called only after the method AssemblePA() has been
80 called. */
81 void AddMultPA(const Vector &x, Vector &y) const override;
82
83 virtual void AddAbsMultPA(const Vector &x, Vector &y) const;
84
85 /// Method for partially assembled action on NURBS patches.
86 virtual void AddMultNURBSPA(const Vector&x, Vector&y) const;
87
88 /// Method for partially assembled transposed action.
89 /** Perform the transpose action of integrator on the input @a x and add the
90 result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
91 represent the element-wise discontinuous version of the FE space.
92
93 This method can be called only after the method AssemblePA() has been
94 called. */
95 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
96
97 virtual void AddAbsMultTransposePA(const Vector &x, Vector &y) const;
98
99 /// Method defining element assembly.
100 /** The result of the element assembly is added to the @a emat Vector if
101 @a add is true. Otherwise, if @a add is false, we set @a emat. */
102 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
103 const bool add = true);
104 /** Used with BilinearFormIntegrators that have different spaces. */
105 // virtual void AssembleEA(const FiniteElementSpace &trial_fes,
106 // const FiniteElementSpace &test_fes,
107 // Vector &emat);
108
109 /// Method defining matrix-free assembly.
110 /** The result of fully matrix-free assembly is stored internally so that it
111 can be used later in the methods AddMultMF() and AddMultTransposeMF(). */
112 void AssembleMF(const FiniteElementSpace &fes) override;
113
114 /** Perform the action of integrator on the input @a x and add the result to
115 the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
116 the element-wise discontinuous version of the FE space.
117
118 This method can be called only after the method AssembleMF() has been
119 called. */
120 void AddMultMF(const Vector &x, Vector &y) const override;
121
122 /** Perform the transpose action of integrator on the input @a x and add the
123 result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
124 represent the element-wise discontinuous version of the FE space.
125
126 This method can be called only after the method AssemblePA() has been
127 called. */
128 virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
129
130 /// Assemble diagonal and add it to Vector @a diag.
131 virtual void AssembleDiagonalMF(Vector &diag);
132
133 virtual void AssembleEABoundary(const FiniteElementSpace &fes,
134 Vector &ea_data_bdr,
135 const bool add = true);
136
137 virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
138 Vector &ea_data_int,
139 Vector &ea_data_ext,
140 const bool add = true);
141
142 /// @brief Method defining element assembly for mixed trace integrators.
143 ///
144 /// This is the element assembly analogue of AssembleFaceMatrix(const
145 /// FiniteElement&, const FiniteElement&, const FiniteElement&,
146 /// FaceElementTransformations&, DenseMatrix&).
147 virtual void AssembleEAInteriorFaces(const FiniteElementSpace &trial_fes,
148 const FiniteElementSpace &test_fes,
149 Vector &emat,
150 const bool add = true);
151
152 virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
153 Vector &ea_data_bdr,
154 const bool add = true);
155
156 /// Given a particular Finite Element computes the element matrix elmat.
157 virtual void AssembleElementMatrix(const FiniteElement &el,
159 DenseMatrix &elmat);
160
161 /** Compute the local matrix representation of a bilinear form
162 $a(u,v)$ defined on different trial (given by $u$) and test
163 (given by $v$) spaces. The rows in the local matrix correspond
164 to the test dofs and the columns -- to the trial dofs. */
165 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
166 const FiniteElement &test_fe,
168 DenseMatrix &elmat);
169
170 /** Given a particular NURBS patch, computes the patch matrix as a
171 SparseMatrix @a smat.
172 */
173 virtual void AssemblePatchMatrix(const int patch,
174 const FiniteElementSpace &fes,
175 SparseMatrix*& smat);
176
177 virtual void AssembleFaceMatrix(const FiniteElement &el1,
178 const FiniteElement &el2,
180 DenseMatrix &elmat);
181
182 virtual void AssembleFaceMatrix(const FiniteElement &trial_fe1,
183 const FiniteElement &test_fe1,
184 const FiniteElement &trial_fe2,
185 const FiniteElement &test_fe2,
187 DenseMatrix &elmat);
188
189 /** Abstract method used for assembling TraceFaceIntegrators in a
190 MixedBilinearForm. */
191 virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
192 const FiniteElement &test_fe1,
193 const FiniteElement &test_fe2,
195 DenseMatrix &elmat);
196
197 /** Abstract method used for assembling TraceFaceIntegrators for
198 DPG weak formulations. */
199 virtual void AssembleTraceFaceMatrix(int elem,
200 const FiniteElement &trial_face_fe,
201 const FiniteElement &test_fe,
203 DenseMatrix &elmat);
204
205
206 /// @brief Perform the local action of the BilinearFormIntegrator.
207 /// Note that the default implementation in the base class is general but not
208 /// efficient.
211 const Vector &elfun, Vector &elvect) override;
212
213 /// @brief Perform the local action of the BilinearFormIntegrator resulting
214 /// from a face integral term.
215 /// Note that the default implementation in the base class is general but not
216 /// efficient.
217 void AssembleFaceVector(const FiniteElement &el1,
218 const FiniteElement &el2,
220 const Vector &elfun, Vector &elvect) override;
221
224 const Vector &elfun, DenseMatrix &elmat) override
225 { AssembleElementMatrix(el, Tr, elmat); }
226
228 const FiniteElement &el2,
230 const Vector &elfun, DenseMatrix &elmat) override
231 { AssembleFaceMatrix(el1, el2, Tr, elmat); }
232
233 /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
234
235 The purpose of the method is to compute a local "flux" finite element
236 function given a local finite element solution. The "flux" function has
237 to be computed in terms of its coefficients (represented by the Vector
238 @a flux) which multiply the basis functions defined by the FiniteElement
239 @a fluxelem. Typically, the "flux" function will have more than one
240 component and consequently @a flux should be store the coefficients of
241 all components: first all coefficient for component 0, then all
242 coefficients for component 1, etc. What the "flux" function represents
243 depends on the specific integrator. For example, in the case of
244 DiffusionIntegrator, the flux is the gradient of the solution multiplied
245 by the diffusion coefficient.
246
247 @param[in] el FiniteElement of the solution.
248 @param[in] Trans The ElementTransformation describing the physical
249 position of the mesh element.
250 @param[in] u Solution coefficients representing the expansion of the
251 solution function in the basis of @a el.
252 @param[in] fluxelem FiniteElement of the "flux".
253 @param[out] flux "Flux" coefficients representing the expansion of the
254 "flux" function in the basis of @a fluxelem. The size
255 of @a flux as a Vector has to be set by this method,
256 e.g. using Vector::SetSize().
257 @param[in] with_coef If zero (the default value is 1) the implementation
258 of the method may choose not to scale the "flux"
259 function by any coefficients describing the
260 integrator.
261 @param[in] ir If passed (the default value is NULL), the implementation
262 of the method will ignore the integration rule provided
263 by the @a fluxelem parameter and, instead, compute the
264 discrete flux at the points specified by the integration
265 rule @a ir.
266 */
267 virtual void ComputeElementFlux(const FiniteElement &el,
269 Vector &u,
270 const FiniteElement &fluxelem,
271 Vector &flux, bool with_coef = true,
272 const IntegrationRule *ir = NULL) { }
273
274 /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
275
276 The purpose of this method is to compute a local number that measures the
277 energy of a given "flux" function (see ComputeElementFlux() for a
278 description of the "flux" function). Typically, the energy of a "flux"
279 function should be equal to a_local(u,u), if the "flux" is defined from
280 a solution u; here a_local(.,.) denotes the element-local bilinear
281 form represented by the integrator.
282
283 @param[in] fluxelem FiniteElement of the "flux".
284 @param[in] Trans The ElementTransformation describing the physical
285 position of the mesh element.
286 @param[in] flux "Flux" coefficients representing the expansion of the
287 "flux" function in the basis of @a fluxelem.
288 @param[out] d_energy If not NULL, the given Vector should be set to
289 represent directional energy split that can be used
290 for anisotropic error estimation.
291 @returns The computed energy.
292 */
293 virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
295 Vector &flux, Vector *d_energy = NULL)
296 { return 0.0; }
297
298 /** @brief For bilinear forms on element faces, specifies if the normal
299 derivatives are needed on the faces or just the face restriction.
300
301 @details if RequiresFaceNormalDerivatives() == true, then
302 AddMultPAFaceNormalDerivatives(...) should be invoked in place
303 of AddMultPA(...) and L2NormalDerivativeFaceRestriction should
304 be used to compute the normal derivatives. This is used for some
305 DG integrators, for example DGDiffusionIntegrator.
306
307 @returns whether normal derivatives appear in the bilinear form.
308 */
309 virtual bool RequiresFaceNormalDerivatives() const { return false; }
310
311 /// Method for partially assembled action.
312 /** @brief For bilinear forms on element faces that depend on the normal
313 derivative on the faces, computes the action of integrator to the
314 face values @a x and reference-normal derivatives @a dxdn and adds
315 the result to @a y and @a dydn.
316
317 @details This method can be called only after the method AssemblePA() has
318 been called.
319
320 @param[in] x E-vector of face values (provided by
321 FaceRestriction::Mult)
322 @param[in] dxdn E-vector of face reference-normal derivatives
323 (provided by FaceRestriction::NormalDerivativeMult)
324 @param[in,out] y E-vector of face values to add action to.
325 @param[in,out] dydn E-vector of face reference-normal derivative values to
326 add action to.
327 */
328 virtual void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn,
329 Vector &y, Vector &dydn) const;
330
332};
333
334/** Wraps a given @a BilinearFormIntegrator and transposes the resulting element
335 matrices. See for example ex9, ex9p. */
337{
338private:
339 int own_bfi;
341
342 DenseMatrix bfi_elmat;
343
344public:
346 { bfi = bfi_; own_bfi = own_bfi_; }
347
348 void SetIntRule(const IntegrationRule *ir) override;
349
352 DenseMatrix &elmat) override;
353
354 void AssembleElementMatrix2(const FiniteElement &trial_fe,
355 const FiniteElement &test_fe,
357 DenseMatrix &elmat) override;
358
360 void AssembleFaceMatrix(const FiniteElement &el1,
361 const FiniteElement &el2,
363 DenseMatrix &elmat) override;
364
365 void AssembleFaceMatrix(const FiniteElement &trial_fe1,
366 const FiniteElement &test_fe1,
367 const FiniteElement &trial_fe2,
368 const FiniteElement &test_fe2,
370 DenseMatrix &elmat) override;
371
372 void AssemblePA(const FiniteElementSpace& fes) override
373 {
374 bfi->AssemblePA(fes);
375 }
376
377 void AssemblePA(const FiniteElementSpace &trial_fes,
378 const FiniteElementSpace &test_fes) override
379 {
380 bfi->AssemblePA(test_fes, trial_fes); // Reverse test and trial
381 }
382
384 {
385 bfi->AssemblePAInteriorFaces(fes);
386 }
387
389 {
390 bfi->AssemblePABoundaryFaces(fes);
391 }
392
393 void AddMultTransposePA(const Vector &x, Vector &y) const override
394 {
395 bfi->AddMultPA(x, y);
396 }
397
398 void AddMultPA(const Vector& x, Vector& y) const override
399 {
400 bfi->AddMultTransposePA(x, y);
401 }
402
403 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
404 const bool add) override;
405
408 Vector &ea_data_int,
409 Vector &ea_data_ext,
410 const bool add) override;
411
413 Vector &ea_data_bdr,
414 const bool add) override;
415
416 virtual ~TransposeIntegrator() { if (own_bfi) { delete bfi; } }
417};
418
420{
421private:
422 int own_bfi;
424
425public:
426 LumpedIntegrator (BilinearFormIntegrator *bfi_, int own_bfi_ = 1)
427 { bfi = bfi_; own_bfi = own_bfi_; }
428
429 void SetIntRule(const IntegrationRule *ir) override;
430
433 DenseMatrix &elmat) override;
434
435 virtual ~LumpedIntegrator() { if (own_bfi) { delete bfi; } }
436};
437
438/// Integrator that inverts the matrix assembled by another integrator.
440{
441private:
442 int own_integrator;
443 BilinearFormIntegrator *integrator;
444
445public:
446 InverseIntegrator(BilinearFormIntegrator *integ, int own_integ = 1)
447 { integrator = integ; own_integrator = own_integ; }
448
449 void SetIntRule(const IntegrationRule *ir) override;
450
453 DenseMatrix &elmat) override;
454
455 virtual ~InverseIntegrator() { if (own_integrator) { delete integrator; } }
456};
457
458/// Integrator defining a sum of multiple Integrators.
460{
461private:
462 int own_integrators;
463 mutable DenseMatrix elem_mat;
465
466public:
467 SumIntegrator(int own_integs = 1) { own_integrators = own_integs; }
468
469 void SetIntRule(const IntegrationRule *ir) override;
470
472 { integrators.Append(integ); }
473
476 DenseMatrix &elmat) override;
477 void AssembleElementMatrix2(const FiniteElement &trial_fe,
478 const FiniteElement &test_fe,
480 DenseMatrix &elmat) override;
481
483 void AssembleFaceMatrix(const FiniteElement &el1,
484 const FiniteElement &el2,
486 DenseMatrix &elmat) override;
487
488 void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
489 const FiniteElement &test_fe1,
490 const FiniteElement &test_fe2,
492 DenseMatrix &elmat) override;
493
495 void AssemblePA(const FiniteElementSpace& fes) override;
496
497 void AssembleDiagonalPA(Vector &diag) override;
498
499 void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override;
500
501 void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override;
502
503 void AddMultTransposePA(const Vector &x, Vector &y) const override;
504
505 void AddAbsMultTransposePA(const Vector &x, Vector &y) const override;
506
507 void AddMultPA(const Vector& x, Vector& y) const override;
508
509 void AddAbsMultPA(const Vector& x, Vector& y) const override;
510
511 void AssembleMF(const FiniteElementSpace &fes) override;
512
513 void AddMultMF(const Vector &x, Vector &y) const override;
514
515 void AddMultTransposeMF(const Vector &x, Vector &y) const override;
516
517 void AssembleDiagonalMF(Vector &diag) override;
518
519 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
520 const bool add) override;
521
524 Vector &ea_data_int,
525 Vector &ea_data_ext,
526 const bool add) override;
527
529 Vector &ea_data_bdr,
530 const bool add) override;
531
532 virtual ~SumIntegrator();
533};
534
535/** An abstract class for integrating the product of two scalar basis functions
536 with an optional scalar coefficient. */
538{
539public:
540 void AssembleElementMatrix2(const FiniteElement &trial_fe,
541 const FiniteElement &test_fe,
543 DenseMatrix &elmat) override;
544
545 /// Support for use in BilinearForm. Can be used only when appropriate.
548 DenseMatrix &elmat) override
549 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
550
551protected:
552 /// This parameter can be set by derived methods to enable single shape
553 /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
554 /// result if given the same FiniteElement. The default is false.
556
559
560 inline virtual bool VerifyFiniteElementTypes(
561 const FiniteElement & trial_fe,
562 const FiniteElement & test_fe) const
563 {
564 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
566 }
567
568 inline virtual const char * FiniteElementTypeFailureMessage() const
569 {
570 return "MixedScalarIntegrator: "
571 "Trial and test spaces must both be scalar fields.";
572 }
573
574 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
575 const FiniteElement & test_fe,
577 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
578
579
580 inline virtual void CalcTestShape(const FiniteElement & test_fe,
582 Vector & shape)
583 { test_fe.CalcPhysShape(Trans, shape); }
584
585 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
587 Vector & shape)
588 { trial_fe.CalcPhysShape(Trans, shape); }
589
591
592private:
593
594#ifndef MFEM_THREAD_SAFE
595 Vector test_shape;
596 Vector trial_shape;
597#endif
598
599};
600
601/** An abstract class for integrating the inner product of two vector basis
602 functions with an optional scalar, vector, or matrix coefficient. */
604{
605public:
606
607 void AssembleElementMatrix2(const FiniteElement &trial_fe,
608 const FiniteElement &test_fe,
610 DenseMatrix &elmat) override;
611
612 /// Support for use in BilinearForm. Can be used only when appropriate.
615 DenseMatrix &elmat) override
616 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
617
618protected:
619 /// This parameter can be set by derived methods to enable single shape
620 /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
621 /// result if given the same FiniteElement. The default is false.
623
625 : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(NULL) {}
627 : same_calc_shape(false), Q(&q), VQ(NULL), DQ(NULL), MQ(NULL) {}
629 : same_calc_shape(false), Q(NULL), VQ(diag?NULL:&vq), DQ(diag?&vq:NULL),
630 MQ(NULL) {}
632 : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(&mq) {}
633
634 inline virtual bool VerifyFiniteElementTypes(
635 const FiniteElement & trial_fe,
636 const FiniteElement & test_fe) const
637 {
638 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
640 }
641
642 inline virtual const char * FiniteElementTypeFailureMessage() const
643 {
644 return "MixedVectorIntegrator: "
645 "Trial and test spaces must both be vector fields";
646 }
647
648 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
649 const FiniteElement & test_fe,
651 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
652
653
654 inline virtual int GetTestVDim(const FiniteElement & test_fe)
655 { return std::max(space_dim, test_fe.GetRangeDim()); }
656
657 inline virtual void CalcTestShape(const FiniteElement & test_fe,
659 DenseMatrix & shape)
660 { test_fe.CalcVShape(Trans, shape); }
661
662 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
663 { return std::max(space_dim, trial_fe.GetRangeDim()); }
664
665 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
667 DenseMatrix & shape)
668 { trial_fe.CalcVShape(Trans, shape); }
669
675
676private:
677
678#ifndef MFEM_THREAD_SAFE
679 Vector V;
680 Vector D;
681 DenseMatrix M;
682 DenseMatrix test_shape;
683 DenseMatrix trial_shape;
684 DenseMatrix shape_tmp;
685#endif
686
687};
688
689/** An abstract class for integrating the product of a scalar basis function and
690 the inner product of a vector basis function with a vector coefficient. In
691 2D the inner product can be replaced with a cross product. */
693{
694public:
695
696 void AssembleElementMatrix2(const FiniteElement &trial_fe,
697 const FiniteElement &test_fe,
699 DenseMatrix &elmat) override;
700
701 /// Support for use in BilinearForm. Can be used only when appropriate.
702 /** Appropriate use cases are classes derived from
703 MixedScalarVectorIntegrator where the trial and test spaces can be the
704 same. Examples of such classes are: MixedVectorDivergenceIntegrator,
705 MixedScalarWeakDivergenceIntegrator, etc. */
708 DenseMatrix &elmat) override
709 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
710
711protected:
712
713 MixedScalarVectorIntegrator(VectorCoefficient &vq, bool transpose_ = false,
714 bool cross_2d_ = false)
715 : VQ(&vq), transpose(transpose_), cross_2d(cross_2d_) {}
716
717 inline virtual bool VerifyFiniteElementTypes(
718 const FiniteElement & trial_fe,
719 const FiniteElement & test_fe) const
720 {
721 return ((transpose &&
724 (!transpose &&
727 );
728 }
729
730 inline virtual const char * FiniteElementTypeFailureMessage() const
731 {
732 if ( transpose )
733 {
734 return "MixedScalarVectorIntegrator: "
735 "Trial space must be a vector field "
736 "and the test space must be a scalar field";
737 }
738 else
739 {
740 return "MixedScalarVectorIntegrator: "
741 "Trial space must be a scalar field "
742 "and the test space must be a vector field";
743 }
744 }
745
746 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
747 const FiniteElement & test_fe,
749 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
750
751
752 inline virtual int GetVDim(const FiniteElement & vector_fe)
753 { return std::max(space_dim, vector_fe.GetRangeDim()); }
754
755 inline virtual void CalcVShape(const FiniteElement & vector_fe,
757 DenseMatrix & shape_)
758 { vector_fe.CalcVShape(Trans, shape_); }
759
760 inline virtual void CalcShape(const FiniteElement & scalar_fe,
762 Vector & shape_)
763 { scalar_fe.CalcPhysShape(Trans, shape_); }
764
768 bool cross_2d; // In 2D use a cross product rather than a dot product
769
770private:
771
772#ifndef MFEM_THREAD_SAFE
773 Vector V;
774 DenseMatrix vshape;
775 Vector shape;
776 Vector vshape_tmp;
777#endif
778
779};
780
781/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$ in either 1D, 2D,
782 or 3D and where $Q$ is an optional scalar coefficient, $u$ and $v$ are each in $H^1$
783 or $L_2$. */
791
792/** Class for integrating the bilinear form $a(u,v) := (\vec{V} u, v)$ in either 2D, or
793 3D and where $\vec{V}$ is a vector coefficient, $u$ is in $H^1$ or $L_2$ and $v$ is in $H(curl$
794 or $H(div)$. */
801
802/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ in 1D where Q
803 is an optional scalar coefficient, $u$ is in $H^1$, and $v$ is in $L_2$. */
805{
806public:
810
811protected:
812 inline virtual bool VerifyFiniteElementTypes(
813 const FiniteElement & trial_fe,
814 const FiniteElement & test_fe) const
815 {
816 return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
819 }
820
821 inline virtual const char * FiniteElementTypeFailureMessage() const
822 {
823 return "MixedScalarDerivativeIntegrator: "
824 "Trial and test spaces must both be scalar fields in 1D "
825 "and the trial space must implement CalcDShape.";
826 }
827
828 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
830 Vector & shape)
831 {
832 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
833 trial_fe.CalcPhysDShape(Trans, dshape);
834 }
835};
836
837/** Class for integrating the bilinear form $a(u,v) := -(Q u, \nabla v)$ in 1D where $Q$
838 is an optional scalar coefficient, $u$ is in $L_2$, and $v$ is in $H^1$. */
840{
841public:
845
846protected:
847 inline virtual bool VerifyFiniteElementTypes(
848 const FiniteElement & trial_fe,
849 const FiniteElement & test_fe) const
850 {
851 return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
854 }
855
856 inline virtual const char * FiniteElementTypeFailureMessage() const
857 {
858 return "MixedScalarWeakDerivativeIntegrator: "
859 "Trial and test spaces must both be scalar fields in 1D "
860 "and the test space must implement CalcDShape with "
861 "map type \"VALUE\".";
862 }
863
864 inline virtual void CalcTestShape(const FiniteElement & test_fe,
866 Vector & shape)
867 {
868 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
869 test_fe.CalcPhysDShape(Trans, dshape);
870 shape *= -1.0;
871 }
872};
873
874/** Class for integrating the bilinear form $a(u,v) := (Q \nabla \cdot u, v)$ in either 2D
875 or 3D where $Q$ is an optional scalar coefficient, $u$ is in $H(div)$, and $v$ is a
876 scalar field. */
878{
879public:
883
884protected:
885 inline virtual bool VerifyFiniteElementTypes(
886 const FiniteElement & trial_fe,
887 const FiniteElement & test_fe) const
888 {
889 return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
891 }
892
893 inline virtual const char * FiniteElementTypeFailureMessage() const
894 {
895 return "MixedScalarDivergenceIntegrator: "
896 "Trial must be $H(div)$ and the test space must be a "
897 "scalar field";
898 }
899
900 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
901 const FiniteElement & test_fe,
903 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
904
905 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
907 Vector & shape)
908 { trial_fe.CalcPhysDivShape(Trans, shape); }
909};
910
911/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \nabla \cdot u, v)$ in either 2D
912 or 3D where $\vec{V}$ is a vector coefficient, $u$ is in $H(div)$, and $v$ is in $H(div)$. */
914{
915public:
918
919protected:
920 inline virtual bool VerifyFiniteElementTypes(
921 const FiniteElement & trial_fe,
922 const FiniteElement & test_fe) const
923 {
924 return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
926 }
927
928 inline virtual const char * FiniteElementTypeFailureMessage() const
929 {
930 return "MixedVectorDivergenceIntegrator: "
931 "Trial must be H(Div) and the test space must be a "
932 "vector field";
933 }
934
935 // Subtract one due to the divergence and add one for the coefficient
936 // which is assumed to be at least linear.
937 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
938 const FiniteElement & test_fe,
940 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
941
942 inline virtual void CalcShape(const FiniteElement & scalar_fe,
944 Vector & shape)
945 { scalar_fe.CalcPhysDivShape(Trans, shape); }
946};
947
948/** Class for integrating the bilinear form $a(u,v) := -(Q u, \nabla \cdot v)$ in either 2D
949 or 3D where $Q$ is an optional scalar coefficient, $u$ is in $L_2$ or $H^1$, and $v$ is
950 in $H(div)$. */
952{
953public:
957
958protected:
959 inline virtual bool VerifyFiniteElementTypes(
960 const FiniteElement & trial_fe,
961 const FiniteElement & test_fe) const
962 {
963 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
965 }
966
967 inline virtual const char * FiniteElementTypeFailureMessage() const
968 {
969 return "MixedScalarWeakGradientIntegrator: "
970 "Trial space must be a scalar field "
971 "and the test space must be H(Div)";
972 }
973
974 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
975 const FiniteElement & test_fe,
977 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
978
979 virtual void CalcTestShape(const FiniteElement & test_fe,
981 Vector & shape)
982 {
983 test_fe.CalcPhysDivShape(Trans, shape);
984 shape *= -1.0;
985 }
986};
987
988/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ in 2D where
989 $Q$ is an optional scalar coefficient, $u$ is in $H(curl$, and $v$ is in $L_2$ or
990 $H^1$. */
992{
993public:
997
998protected:
1000 const FiniteElement & trial_fe,
1001 const FiniteElement & test_fe) const override
1002 {
1003 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1006 }
1007
1008 inline const char * FiniteElementTypeFailureMessage() const override
1009 {
1010 return "MixedScalarCurlIntegrator: "
1011 "Trial must be H(Curl) and the test space must be a "
1012 "scalar field";
1013 }
1014
1015 inline int GetIntegrationOrder(const FiniteElement & trial_fe,
1016 const FiniteElement & test_fe,
1017 ElementTransformation &Trans) override
1018 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
1019
1020 inline void CalcTrialShape(const FiniteElement & trial_fe,
1021 ElementTransformation &Trans,
1022 Vector & shape) override
1023 {
1024 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1025 trial_fe.CalcPhysCurlShape(Trans, dshape);
1026 }
1027
1029 void AssemblePA(const FiniteElementSpace &trial_fes,
1030 const FiniteElementSpace &test_fes) override;
1031
1032 void AddMultPA(const Vector&, Vector&) const override;
1033 void AddMultTransposePA(const Vector &x, Vector &y) const override;
1034
1035 // PA extension
1037 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1038 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1040};
1041
1042/** Class for integrating the bilinear form $a(u,v) := (Q u, \mathrm{curl}(v))$ in 2D where
1043 $Q$ is an optional scalar coefficient, $u$ is in $L_2$ or $H^1$, and $v$ is in
1044 $H(curl$. Partial assembly (PA) is supported but could be further optimized
1045 by using more efficient threading and shared memory.
1046*/
1048{
1049public:
1053
1054protected:
1055 inline virtual bool VerifyFiniteElementTypes(
1056 const FiniteElement & trial_fe,
1057 const FiniteElement & test_fe) const
1058 {
1059 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1062 }
1063
1064 inline virtual const char * FiniteElementTypeFailureMessage() const
1065 {
1066 return "MixedScalarWeakCurlIntegrator: "
1067 "Trial space must be a scalar field "
1068 "and the test space must be H(Curl)";
1069 }
1070
1071 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1072 ElementTransformation &Trans,
1073 Vector & shape)
1074 {
1075 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1076 test_fe.CalcPhysCurlShape(Trans, dshape);
1077 }
1078};
1079
1080/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$ in either 2D or
1081 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
1082 diagonal matrix) $u$ and $v$ are each in $H(curl$ or $H(div)$. */
1094
1095/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, v)$ in 3D and where
1096 $\vec{V}$ is a vector coefficient $u$ and $v$ are each in $H(curl$ or $H(div)$. */
1103
1104/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \cdot u, v)$ in 2D or 3D and
1105 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$ or
1106 $L_2$. */
1108{
1109public:
1112
1113 inline virtual bool VerifyFiniteElementTypes(
1114 const FiniteElement & trial_fe,
1115 const FiniteElement & test_fe) const
1116 {
1117 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1119 }
1120
1121 inline virtual const char * FiniteElementTypeFailureMessage() const
1122 {
1123 return "MixedDotProductIntegrator: "
1124 "Trial space must be a vector field "
1125 "and the test space must be a scalar field";
1126 }
1127};
1128
1129/** Class for integrating the bilinear form $a(u,v) := (-\vec{V} \cdot u, \nabla \cdot v)$ in 2D or
1130 3D and where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1131 $H(div)$. */
1133{
1134public:
1137
1138 inline virtual bool VerifyFiniteElementTypes(
1139 const FiniteElement & trial_fe,
1140 const FiniteElement & test_fe) const
1141 {
1142 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1145 }
1146
1147 inline virtual const char * FiniteElementTypeFailureMessage() const
1148 {
1149 return "MixedWeakGradDotIntegrator: "
1150 "Trial space must be a vector field "
1151 "and the test space must be a vector field with a divergence";
1152 }
1153
1154 // Subtract one due to the gradient and add one for the coefficient
1155 // which is assumed to be at least linear.
1156 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1157 const FiniteElement & test_fe,
1158 ElementTransformation &Trans)
1159 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
1160
1161 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1162 ElementTransformation &Trans,
1163 Vector & shape)
1164 { scalar_fe.CalcPhysDivShape(Trans, shape); shape *= -1.0; }
1165};
1166
1167/** Class for integrating the bilinear form $a(u,v) := (v \vec{V} \times u, \nabla v)$ in 3D and
1168 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$. */
1170{
1171public:
1174
1175 inline virtual bool VerifyFiniteElementTypes(
1176 const FiniteElement & trial_fe,
1177 const FiniteElement & test_fe) const
1178 {
1179 return (trial_fe.GetRangeDim() == 3 &&
1183 }
1184
1185 inline virtual const char * FiniteElementTypeFailureMessage() const
1186 {
1187 return "MixedWeakDivCrossIntegrator: "
1188 "Trial space must be a vector field in 3D "
1189 "and the test space must be a scalar field with a gradient";
1190 }
1191
1192 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1193 { return space_dim; }
1194
1195 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1196 ElementTransformation &Trans,
1197 DenseMatrix & shape)
1198 { test_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1199};
1200
1201/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$ in 3D
1202 or in 2D and where $Q$ is a scalar or matrix coefficient $u$ and $v$ are both in
1203 $H^1$. */
1205{
1206public:
1214
1215 inline virtual bool VerifyFiniteElementTypes(
1216 const FiniteElement & trial_fe,
1217 const FiniteElement & test_fe) const
1218 {
1219 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1223 }
1224
1225 inline virtual const char * FiniteElementTypeFailureMessage() const
1226 {
1227 return "MixedGradGradIntegrator: "
1228 "Trial and test spaces must both be scalar fields "
1229 "with a gradient operator.";
1230 }
1231
1232 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1233 const FiniteElement & test_fe,
1234 ElementTransformation &Trans)
1235 {
1236 // Same as DiffusionIntegrator
1237 return test_fe.Space() == FunctionSpace::Pk ?
1238 trial_fe.GetOrder() + test_fe.GetOrder() - 2 :
1239 trial_fe.GetOrder() + test_fe.GetOrder() + test_fe.GetDim() - 1;
1240 }
1241
1242 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1243 { return space_dim; }
1244
1245 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1246 ElementTransformation &Trans,
1247 DenseMatrix & shape)
1248 { trial_fe.CalcPhysDShape(Trans, shape); }
1249
1250 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1251 { return space_dim; }
1252
1253 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1254 ElementTransformation &Trans,
1255 DenseMatrix & shape)
1256 { test_fe.CalcPhysDShape(Trans, shape); }
1257};
1258
1259/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla u, \nabla v)$ in 3D
1260 or in 2D and where $\vec{V}$ is a vector coefficient $u$ and $v$ are both in $H^1$. */
1262{
1263public:
1266
1267 inline virtual bool VerifyFiniteElementTypes(
1268 const FiniteElement & trial_fe,
1269 const FiniteElement & test_fe) const
1270 {
1271 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1275 }
1276
1277 inline virtual const char * FiniteElementTypeFailureMessage() const
1278 {
1279 return "MixedCrossGradGradIntegrator: "
1280 "Trial and test spaces must both be scalar fields "
1281 "with a gradient operator.";
1282 }
1283
1284 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1285 { return space_dim; }
1286
1287 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1288 ElementTransformation &Trans,
1289 DenseMatrix & shape)
1290 { trial_fe.CalcPhysDShape(Trans, shape); }
1291
1292 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1293 { return space_dim; }
1294
1295 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1296 ElementTransformation &Trans,
1297 DenseMatrix & shape)
1298 { test_fe.CalcPhysDShape(Trans, shape); }
1299};
1300
1301/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), \mathrm{curl}(v))$ in 3D
1302 and where $Q$ is a scalar or matrix coefficient $u$ and $v$ are both in
1303 $H(curl$. */
1305{
1306public:
1314
1315 inline virtual bool VerifyFiniteElementTypes(
1316 const FiniteElement & trial_fe,
1317 const FiniteElement & test_fe) const
1318 {
1319 return (trial_fe.GetCurlDim() == 3 && test_fe.GetCurlDim() == 3 &&
1324 }
1325
1326 inline virtual const char * FiniteElementTypeFailureMessage() const
1327 {
1328 return "MixedCurlCurlIntegrator"
1329 "Trial and test spaces must both be vector fields in 3D "
1330 "with a curl.";
1331 }
1332
1333 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1334 { return trial_fe.GetCurlDim(); }
1335
1336 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1337 ElementTransformation &Trans,
1338 DenseMatrix & shape)
1339 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1340
1341 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1342 { return test_fe.GetCurlDim(); }
1343
1344 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1345 ElementTransformation &Trans,
1346 DenseMatrix & shape)
1347 { test_fe.CalcPhysCurlShape(Trans, shape); }
1348};
1349
1350/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), \mathrm{curl}(v))$ in 3D
1351 and where $\vec{V}$ is a vector coefficient $u$ and $v$ are both in $H(curl$. */
1353{
1354public:
1357
1358 inline virtual bool VerifyFiniteElementTypes(
1359 const FiniteElement & trial_fe,
1360 const FiniteElement & test_fe) const
1361 {
1362 return (trial_fe.GetCurlDim() == 3 && trial_fe.GetRangeDim() == 3 &&
1363 test_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1368 }
1369
1370 inline virtual const char * FiniteElementTypeFailureMessage() const
1371 {
1372 return "MixedCrossCurlCurlIntegrator: "
1373 "Trial and test spaces must both be vector fields in 3D "
1374 "with a curl.";
1375 }
1376
1377 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1378 { return trial_fe.GetCurlDim(); }
1379
1380 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1381 ElementTransformation &Trans,
1382 DenseMatrix & shape)
1383 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1384
1385 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1386 { return test_fe.GetCurlDim(); }
1387
1388 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1389 ElementTransformation &Trans,
1390 DenseMatrix & shape)
1391 { test_fe.CalcPhysCurlShape(Trans, shape); }
1392};
1393
1394/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), \nabla \cdot v)$ in 3D
1395 and where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H^1$. */
1397{
1398public:
1401
1402 inline virtual bool VerifyFiniteElementTypes(
1403 const FiniteElement & trial_fe,
1404 const FiniteElement & test_fe) const
1405 {
1406 return (trial_fe.GetCurlDim() == 3 &&
1411 }
1412
1413 inline virtual const char * FiniteElementTypeFailureMessage() const
1414 {
1415 return "MixedCrossCurlGradIntegrator"
1416 "Trial space must be a vector field in 3D with a curl"
1417 "and the test space must be a scalar field with a gradient";
1418 }
1419
1420 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1421 { return trial_fe.GetCurlDim(); }
1422
1423 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1424 ElementTransformation &Trans,
1425 DenseMatrix & shape)
1426 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1427
1428 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1429 { return space_dim; }
1430
1431 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1432 ElementTransformation &Trans,
1433 DenseMatrix & shape)
1434 { test_fe.CalcPhysDShape(Trans, shape); }
1435};
1436
1437/** Class for integrating the bilinear form $a(u,v) := (v \times \nabla \cdot u, \mathrm{curl}(v))$ in 3D
1438 and where $v$ is a scalar coefficient $u$ is in $H^1$ and $v$ is in $H(curl$. */
1440{
1441public:
1444
1445 inline virtual bool VerifyFiniteElementTypes(
1446 const FiniteElement & trial_fe,
1447 const FiniteElement & test_fe) const
1448 {
1449 return (test_fe.GetCurlDim() == 3 &&
1454 }
1455
1456 inline virtual const char * FiniteElementTypeFailureMessage() const
1457 {
1458 return "MixedCrossGradCurlIntegrator"
1459 "Trial space must be a scalar field in 3D with a gradient"
1460 "and the test space must be a vector field with a curl";
1461 }
1462
1463 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1464 { return space_dim; }
1465
1466 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1467 ElementTransformation &Trans,
1468 DenseMatrix & shape)
1469 { trial_fe.CalcPhysDShape(Trans, shape); }
1470
1471 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1472 { return test_fe.GetCurlDim(); }
1473
1474 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1475 ElementTransformation &Trans,
1476 DenseMatrix & shape)
1477 { test_fe.CalcPhysCurlShape(Trans, shape); }
1478};
1479
1480/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, \mathrm{curl}(v))$ in 3D and
1481 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1482 $H(curl$. */
1484{
1485public:
1488
1489 inline virtual bool VerifyFiniteElementTypes(
1490 const FiniteElement & trial_fe,
1491 const FiniteElement & test_fe) const
1492 {
1493 return (trial_fe.GetRangeDim() == 3 && test_fe.GetCurlDim() == 3 &&
1497 }
1498
1499 inline virtual const char * FiniteElementTypeFailureMessage() const
1500 {
1501 return "MixedWeakCurlCrossIntegrator: "
1502 "Trial space must be a vector field in 3D "
1503 "and the test space must be a vector field with a curl";
1504 }
1505
1506 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1507 { return test_fe.GetCurlDim(); }
1508
1509 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1510 ElementTransformation &Trans,
1511 DenseMatrix & shape)
1512 { test_fe.CalcPhysCurlShape(Trans, shape); }
1513};
1514
1515/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, \mathrm{curl}(v))$ in 2D and
1516 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1517 $H(curl$. */
1519{
1520public:
1523
1524 inline virtual bool VerifyFiniteElementTypes(
1525 const FiniteElement & trial_fe,
1526 const FiniteElement & test_fe) const
1527 {
1528 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1532 }
1533
1534 inline virtual const char * FiniteElementTypeFailureMessage() const
1535 {
1536 return "MixedScalarWeakCurlCrossIntegrator: "
1537 "Trial space must be a vector field in 2D "
1538 "and the test space must be a vector field with a curl";
1539 }
1540
1541 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1542 ElementTransformation &Trans,
1543 Vector & shape)
1544 {
1545 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1546 scalar_fe.CalcPhysCurlShape(Trans, dshape);
1547 }
1548};
1549
1550/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla \cdot u, v)$ in 3D or
1551 in 2D and where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ and $v$ is in $H(curl$ or
1552 $H(div)$. */
1554{
1555public:
1558
1559 inline virtual bool VerifyFiniteElementTypes(
1560 const FiniteElement & trial_fe,
1561 const FiniteElement & test_fe) const
1562 {
1563 return (test_fe.GetRangeDim() == 3 &&
1567 }
1568
1569 inline virtual const char * FiniteElementTypeFailureMessage() const
1570 {
1571 return "MixedCrossGradIntegrator: "
1572 "Trial space must be a scalar field with a gradient operator"
1573 " and the test space must be a vector field both in 3D.";
1574 }
1575
1576 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1577 { return space_dim; }
1578
1579 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1580 ElementTransformation &Trans,
1581 DenseMatrix & shape)
1582 { trial_fe.CalcPhysDShape(Trans, shape); }
1583
1584 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1585 ElementTransformation &Trans,
1586 DenseMatrix & shape)
1587 { test_fe.CalcVShape(Trans, shape); }
1588};
1589
1590/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), v)$ in 3D and
1591 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H(curl$ or
1592 $H(div)$. */
1594{
1595public:
1598
1599 inline virtual bool VerifyFiniteElementTypes(
1600 const FiniteElement & trial_fe,
1601 const FiniteElement & test_fe) const
1602 {
1603 return (trial_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1607 }
1608
1609 inline virtual const char * FiniteElementTypeFailureMessage() const
1610 {
1611 return "MixedCrossCurlIntegrator: "
1612 "Trial space must be a vector field in 3D with a curl "
1613 "and the test space must be a vector field";
1614 }
1615
1616 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1617 { return trial_fe.GetCurlDim(); }
1618
1619 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1620 ElementTransformation &Trans,
1621 DenseMatrix & shape)
1622 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1623};
1624
1625/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), v)$ in 2D and
1626 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H(curl$ or
1627 $H(div)$. */
1629{
1630public:
1633
1634 inline virtual bool VerifyFiniteElementTypes(
1635 const FiniteElement & trial_fe,
1636 const FiniteElement & test_fe) const
1637 {
1638 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1642 }
1643
1644 inline virtual const char * FiniteElementTypeFailureMessage() const
1645 {
1646 return "MixedCrossCurlIntegrator: "
1647 "Trial space must be a vector field in 2D with a curl "
1648 "and the test space must be a vector field";
1649 }
1650
1651 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1652 ElementTransformation &Trans,
1653 Vector & shape)
1654 {
1655 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1656 scalar_fe.CalcPhysCurlShape(Trans, dshape); shape *= -1.0;
1657 }
1658};
1659
1660/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla \cdot u, v)$ in 2D and
1661 where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ and $v$ is in $H^1$ or $L_2$. */
1663{
1664public:
1667
1668 inline virtual bool VerifyFiniteElementTypes(
1669 const FiniteElement & trial_fe,
1670 const FiniteElement & test_fe) const
1671 {
1672 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1676 }
1677
1678 inline virtual const char * FiniteElementTypeFailureMessage() const
1679 {
1680 return "MixedScalarCrossGradIntegrator: "
1681 "Trial space must be a scalar field in 2D with a gradient "
1682 "and the test space must be a scalar field";
1683 }
1684
1685 inline int GetVDim(const FiniteElement & vector_fe)
1686 { return space_dim; }
1687
1688 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1689 ElementTransformation &Trans,
1690 DenseMatrix & shape)
1691 { vector_fe.CalcPhysDShape(Trans, shape); }
1692};
1693
1694/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, v)$ in 2D and where
1695 $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$ or $L_2$. */
1697{
1698public:
1701
1702 inline virtual bool VerifyFiniteElementTypes(
1703 const FiniteElement & trial_fe,
1704 const FiniteElement & test_fe) const
1705 {
1706 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1709 }
1710
1711 inline virtual const char * FiniteElementTypeFailureMessage() const
1712 {
1713 return "MixedScalarCrossProductIntegrator: "
1714 "Trial space must be a vector field in 2D "
1715 "and the test space must be a scalar field";
1716 }
1717};
1718
1719/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u \hat{z}, v)$ in 2D and
1720 where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ or $L_2$ and $v$ is in $H(curl$ or $H(div)$.
1721
1722 \todo Documentation what $\hat{z}$ is (also missing in https://mfem.org/bilininteg/).
1723 */
1725{
1726public:
1729
1730 inline virtual bool VerifyFiniteElementTypes(
1731 const FiniteElement & trial_fe,
1732 const FiniteElement & test_fe) const
1733 {
1734 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1737 }
1738
1739 inline virtual const char * FiniteElementTypeFailureMessage() const
1740 {
1741 return "MixedScalarWeakCrossProductIntegrator: "
1742 "Trial space must be a scalar field in 2D "
1743 "and the test space must be a vector field";
1744 }
1745
1746 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1747 ElementTransformation &Trans,
1748 Vector & shape)
1749 { scalar_fe.CalcPhysShape(Trans, shape); shape *= -1.0; }
1750};
1751
1752/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \cdot \nabla u, v)$ in 2D or
1753 3D and where $\vec{V}$ is a vector coefficient, $u$ is in $H^1$ and $v$ is in $H^1$ or $L_2$. */
1755{
1756public:
1759
1760 inline virtual bool VerifyFiniteElementTypes(
1761 const FiniteElement & trial_fe,
1762 const FiniteElement & test_fe) const
1763 {
1764 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1767 }
1768
1769 inline virtual const char * FiniteElementTypeFailureMessage() const
1770 {
1771 return "MixedDirectionalDerivativeIntegrator: "
1772 "Trial space must be a scalar field with a gradient "
1773 "and the test space must be a scalar field";
1774 }
1775
1776 inline virtual int GetVDim(const FiniteElement & vector_fe)
1777 { return space_dim; }
1778
1779 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1780 ElementTransformation &Trans,
1781 DenseMatrix & shape)
1782 { vector_fe.CalcPhysDShape(Trans, shape); }
1783};
1784
1785/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} \cdot \nabla u, \nabla \cdot v)$ in 2D
1786 or 3D and where $\hat{V}$ is a vector coefficient, $u$ is in $H^1$ and $v$ is in $H(div)$. */
1788{
1789public:
1792
1793 inline virtual bool VerifyFiniteElementTypes(
1794 const FiniteElement & trial_fe,
1795 const FiniteElement & test_fe) const
1796 {
1797 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1801 }
1802
1803 inline virtual const char * FiniteElementTypeFailureMessage() const
1804 {
1805 return "MixedGradDivIntegrator: "
1806 "Trial space must be a scalar field with a gradient"
1807 "and the test space must be a vector field with a divergence";
1808 }
1809
1810 inline virtual int GetVDim(const FiniteElement & vector_fe)
1811 { return space_dim; }
1812
1813 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1814 ElementTransformation &Trans,
1815 DenseMatrix & shape)
1816 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1817
1818 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1819 ElementTransformation &Trans,
1820 Vector & shape)
1821 { scalar_fe.CalcPhysDivShape(Trans, shape); }
1822};
1823
1824/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} \nabla \cdot u, \nabla v)$ in 2D
1825 or 3D and where $\hat{V}$ is a vector coefficient, $u$ is in $H(div)$ and $v$ is in $H^1$. */
1827{
1828public:
1831
1832 inline virtual bool VerifyFiniteElementTypes(
1833 const FiniteElement & trial_fe,
1834 const FiniteElement & test_fe) const
1835 {
1836 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1837 trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
1840 );
1841 }
1842
1843 inline virtual const char * FiniteElementTypeFailureMessage() const
1844 {
1845 return "MixedDivGradIntegrator: "
1846 "Trial space must be a vector field with a divergence"
1847 "and the test space must be a scalar field with a gradient";
1848 }
1849
1850 inline virtual int GetVDim(const FiniteElement & vector_fe)
1851 { return space_dim; }
1852
1853 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1854 ElementTransformation &Trans,
1855 DenseMatrix & shape)
1856 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1857
1858 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1859 ElementTransformation &Trans,
1860 Vector & shape)
1861 { scalar_fe.CalcPhysDivShape(Trans, shape); }
1862};
1863
1864/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} u, \nabla v)$ in 2D or 3D
1865 and where $\hat{V}$ is a vector coefficient, $u$ is in $H^1$ or $L_2$ and $v$ is in $H^1$. */
1867{
1868public:
1871
1872 inline virtual bool VerifyFiniteElementTypes(
1873 const FiniteElement & trial_fe,
1874 const FiniteElement & test_fe) const
1875 {
1876 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1879 }
1880
1881 inline virtual const char * FiniteElementTypeFailureMessage() const
1882 {
1883 return "MixedScalarWeakDivergenceIntegrator: "
1884 "Trial space must be a scalar field "
1885 "and the test space must be a scalar field with a gradient";
1886 }
1887
1888 inline int GetVDim(const FiniteElement & vector_fe)
1889 { return space_dim; }
1890
1891 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1892 ElementTransformation &Trans,
1893 DenseMatrix & shape)
1894 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1895};
1896
1897/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ in either 2D
1898 or 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
1899 diagonal matrix) $u$ is in $H^1$ and $v$ is in $H(curl$ or $H(div)$. Partial assembly
1900 (PA) is supported but could be further optimized by using more efficient
1901 threading and shared memory.
1902*/
1904{
1905public:
1913
1914protected:
1916 const FiniteElement & trial_fe,
1917 const FiniteElement & test_fe) const override
1918 {
1919 return (trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1921 }
1922
1923 inline const char * FiniteElementTypeFailureMessage() const override
1924 {
1925 return "MixedVectorGradientIntegrator: "
1926 "Trial spaces must be $H^1$ and the test space must be a "
1927 "vector field in 2D or 3D";
1928 }
1929
1930 inline int GetTrialVDim(const FiniteElement & trial_fe) override
1931 { return space_dim; }
1932
1933 inline void CalcTrialShape(const FiniteElement & trial_fe,
1934 ElementTransformation &Trans,
1935 DenseMatrix & shape) override
1936 {
1937 trial_fe.CalcPhysDShape(Trans, shape);
1938 }
1939
1941 void AssemblePA(const FiniteElementSpace &trial_fes,
1942 const FiniteElementSpace &test_fes) override;
1943
1944 void AddMultPA(const Vector&, Vector&) const override;
1945 void AddMultTransposePA(const Vector&, Vector&) const override;
1946
1947private:
1948 DenseMatrix Jinv;
1949
1950 // PA extension
1951 Vector pa_data;
1952 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1953 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1954 const GeometricFactors *geom; ///< Not owned
1955 int dim, ne, dofs1D, quad1D;
1956};
1957
1958/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ in 3D and
1959 where $Q$ is an optional coefficient (of type scalar, matrix, or diagonal
1960 matrix) $u$ is in $H(curl$ and $v$ is in $H(div)$ or $H(curl$. */
1962{
1963public:
1971
1972protected:
1974 const FiniteElement & trial_fe,
1975 const FiniteElement & test_fe) const override
1976 {
1977 return (trial_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1980 }
1981
1982 inline const char * FiniteElementTypeFailureMessage() const override
1983 {
1984 return "MixedVectorCurlIntegrator: "
1985 "Trial space must be H(Curl) and the test space must be a "
1986 "vector field in 3D";
1987 }
1988
1989 inline int GetTrialVDim(const FiniteElement & trial_fe) override
1990 { return trial_fe.GetCurlDim(); }
1991
1992 inline void CalcTrialShape(const FiniteElement & trial_fe,
1993 ElementTransformation &Trans,
1994 DenseMatrix & shape) override
1995 {
1996 trial_fe.CalcPhysCurlShape(Trans, shape);
1997 }
1998
2000 void AssemblePA(const FiniteElementSpace &trial_fes,
2001 const FiniteElementSpace &test_fes) override;
2002
2003 void AddMultPA(const Vector&, Vector&) const override;
2004 void AddMultTransposePA(const Vector&, Vector&) const override;
2005
2006private:
2007 // PA extension
2008 Vector pa_data;
2009 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2010 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2011 const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2012 const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2013 const GeometricFactors *geom; ///< Not owned
2014 int dim, ne, dofs1D, dofs1Dtest,quad1D, testType, trialType, coeffDim;
2015};
2016
2017/** Class for integrating the bilinear form $a(u,v) := (Q u, \mathrm{curl}(v))$ in 3D and
2018 where $Q$ is an optional coefficient (of type scalar, matrix, or diagonal
2019 matrix) $u$ is in $H(div)$ or $H(curl$ and $v$ is in $H(curl$. */
2021{
2022public:
2030
2031protected:
2033 const FiniteElement & trial_fe,
2034 const FiniteElement & test_fe) const override
2035 {
2036 return (trial_fe.GetRangeDim() == 3 && test_fe.GetCurlDim() == 3 &&
2039 }
2040
2041 inline const char * FiniteElementTypeFailureMessage() const override
2042 {
2043 return "MixedVectorWeakCurlIntegrator: "
2044 "Trial space must be vector field in 3D and the "
2045 "test space must be H(Curl)";
2046 }
2047
2048 inline int GetTestVDim(const FiniteElement & test_fe) override
2049 { return test_fe.GetCurlDim(); }
2050
2051 inline void CalcTestShape (const FiniteElement & test_fe,
2052 ElementTransformation &Trans,
2053 DenseMatrix & shape) override
2054 {
2055 test_fe.CalcPhysCurlShape(Trans, shape);
2056 }
2057
2059 void AssemblePA(const FiniteElementSpace &trial_fes,
2060 const FiniteElementSpace &test_fes) override;
2061
2062 void AddMultPA(const Vector&, Vector&) const override;
2063 void AddMultTransposePA(const Vector&, Vector&) const override;
2064
2065private:
2066 // PA extension
2067 Vector pa_data;
2068 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2069 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2070 const GeometricFactors *geom; ///< Not owned
2071 int dim, ne, dofs1D, quad1D, testType, trialType, coeffDim;
2072};
2073
2074/** Class for integrating the bilinear form $a(u,v) := - (Q u, \nabla v)$ in either
2075 2D or 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
2076 diagonal matrix) $u$ is in $H(div)$ or $H(curl$ and $v$ is in $H^1$. */
2078{
2079public:
2087
2088protected:
2089 inline virtual bool VerifyFiniteElementTypes(
2090 const FiniteElement & trial_fe,
2091 const FiniteElement & test_fe) const
2092 {
2093 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
2095 }
2096
2097 inline virtual const char * FiniteElementTypeFailureMessage() const
2098 {
2099 return "MixedVectorWeakDivergenceIntegrator: "
2100 "Trial space must be vector field and the "
2101 "test space must be H1";
2102 }
2103
2104 inline virtual int GetTestVDim(const FiniteElement & test_fe)
2105 { return space_dim; }
2106
2107 inline virtual void CalcTestShape(const FiniteElement & test_fe,
2108 ElementTransformation &Trans,
2109 DenseMatrix & shape)
2110 {
2111 test_fe.CalcPhysDShape(Trans, shape);
2112 shape *= -1.0;
2113 }
2114};
2115
2116/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ where $Q$ is a
2117 scalar coefficient, $u$ is in ($H^1$), and $v$ is a vector with components
2118 $v_i$ in ($H^1$) or ($L^2$).
2119
2120 See also MixedVectorGradientIntegrator when $v$ is in $H(curl$. */
2122{
2123protected:
2125
2126private:
2127 Vector shape;
2128 DenseMatrix dshape;
2129 DenseMatrix gshape;
2130 DenseMatrix Jadj;
2131 DenseMatrix elmat_comp;
2132 // PA extension
2133 Vector pa_data;
2134 const DofToQuad *trial_maps, *test_maps; ///< Not owned
2135 const GeometricFactors *geom; ///< Not owned
2136 int dim, ne, nq;
2137 int trial_dofs1D, test_dofs1D, quad1D;
2138
2139public:
2141 Q{NULL}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2142 { }
2144 Q{q_}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2145 { }
2147 Q{&q}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2148 { }
2149
2150 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2151 const FiniteElement &test_fe,
2152 ElementTransformation &Trans,
2153 DenseMatrix &elmat) override;
2154
2156 void AssemblePA(const FiniteElementSpace &trial_fes,
2157 const FiniteElementSpace &test_fes) override;
2158
2159 void AddMultPA(const Vector &x, Vector &y) const override;
2160 void AddMultTransposePA(const Vector &x, Vector &y) const override;
2161
2162 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2163 const FiniteElement &test_fe,
2164 const ElementTransformation &Trans);
2165protected:
2167 const FiniteElement& trial_fe,
2168 const FiniteElement& test_fe,
2169 const ElementTransformation& trans) const override
2170 {
2171 return &GetRule(trial_fe, test_fe, trans);
2172 }
2173};
2174
2175/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$ where $Q$
2176 can be a scalar or a matrix coefficient. */
2178{
2179public:
2180
2181 using ApplyKernelType = void(*)(const int, const bool, const Array<real_t>&,
2182 const Array<real_t>&, const Array<real_t>&,
2183 const Array<real_t>&,
2184 const Vector&, const Vector&,
2185 Vector&, const int, const int);
2186
2187 using DiagonalKernelType = void(*)(const int, const bool, const Array<real_t>&,
2188 const Array<real_t>&, const Vector&, Vector&,
2189 const int, const int);
2190
2191 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
2192 MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType, (int, int, int));
2193 struct Kernels { Kernels(); };
2194
2195protected:
2199
2200private:
2201 Vector vec, vecdxt, pointflux, shape;
2202#ifndef MFEM_THREAD_SAFE
2203 DenseMatrix dshape, dshapedxt, invdfdx, M, dshapedxt_m;
2204 DenseMatrix te_dshape, te_dshapedxt;
2205 Vector D;
2206#endif
2207
2208 // PA extension
2209 const FiniteElementSpace *fespace;
2210 const DofToQuad *maps; ///< Not owned
2211 const GeometricFactors *geom; ///< Not owned
2212 int dim, ne, dofs1D, quad1D;
2213 Vector pa_data;
2214 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2215
2216 // Data for NURBS patch PA
2217
2218 // Type for a variable-row-length 2D array, used for data related to 1D
2219 // quadrature rules in each dimension.
2220 typedef std::vector<std::vector<int>> IntArrayVar2D;
2221
2222 int numPatches = 0;
2223 static constexpr int numTypes = 2; // Number of rule types
2224
2225 // In the case integrationMode == Mode::PATCHWISE_REDUCED, an approximate
2226 // integration rule with sparse nonzero weights is computed by NNLSSolver,
2227 // for each 1D basis function on each patch, in each spatial dimension. For a
2228 // fixed 1D basis function b_i with DOF index i, in the tensor product basis
2229 // of patch p, the prescribed exact 1D rule is of the form
2230 // \sum_k a_{i,j,k} w_k for some integration points indexed by k, with
2231 // weights w_k and coefficients a_{i,j,k} depending on Q(x), an element
2232 // transformation, b_i, and b_j, for all 1D basis functions b_j whose support
2233 // overlaps that of b_i. Define the constraint matrix G = [g_{j,k}] with
2234 // g_{j,k} = a_{i,j,k} and the vector of exact weights w = [w_k]. A reduced
2235 // rule should have different weights w_r, many of them zero, and should
2236 // approximately satisfy Gw_r = Gw. A sparse approximate solution to this
2237 // underdetermined system is computed by NNLSSolver, and its data is stored
2238 // in the following members.
2239
2240 // For each patch p, spatial dimension d (total dim), and rule type t (total
2241 // numTypes), an std::vector<Vector> of reduced quadrature weights for all
2242 // basis functions is stored in reducedWeights[t + numTypes * (d + dim * p)],
2243 // reshaped as rw(t,d,p). Note that nd may vary with respect to the patch and
2244 // spatial dimension. Array reducedIDs is treated similarly.
2245 std::vector<std::vector<Vector>> reducedWeights;
2246 std::vector<IntArrayVar2D> reducedIDs;
2247 std::vector<Array<int>> pQ1D, pD1D;
2248 std::vector<std::vector<Array2D<real_t>>> pB, pG;
2249 std::vector<IntArrayVar2D> pminD, pmaxD, pminQ, pmaxQ, pminDD, pmaxDD;
2250
2251 std::vector<Array<const IntegrationRule*>> pir1d;
2252
2253 void SetupPatchPA(const int patch, Mesh *mesh, bool unitWeights=false);
2254
2255 void SetupPatchBasisData(Mesh *mesh, unsigned int patch);
2256
2257 /** Called by AssemblePatchMatrix for sparse matrix assembly on a NURBS patch
2258 with full 1D quadrature rules. */
2259 void AssemblePatchMatrix_fullQuadrature(const int patch,
2260 const FiniteElementSpace &fes,
2261 SparseMatrix*& smat);
2262
2263 /** Called by AssemblePatchMatrix for sparse matrix assembly on a NURBS patch
2264 with reduced 1D quadrature rules. */
2265 void AssemblePatchMatrix_reducedQuadrature(const int patch,
2266 const FiniteElementSpace &fes,
2267 SparseMatrix*& smat);
2268
2269public:
2270 /// Construct a diffusion integrator with coefficient Q = 1
2271 DiffusionIntegrator(const IntegrationRule *ir = nullptr);
2272
2273 /// Construct a diffusion integrator with a scalar coefficient q
2274 DiffusionIntegrator(Coefficient &q, const IntegrationRule *ir = nullptr);
2275
2276 /// Construct a diffusion integrator with a vector coefficient q
2277 DiffusionIntegrator(VectorCoefficient &q, const IntegrationRule *ir = nullptr);
2278
2279 /// Construct a diffusion integrator with a matrix coefficient q
2280 DiffusionIntegrator(MatrixCoefficient &q, const IntegrationRule *ir = nullptr);
2281
2282 /** Given a particular Finite Element computes the element stiffness matrix
2283 elmat. */
2284 void AssembleElementMatrix(const FiniteElement &el,
2285 ElementTransformation &Trans,
2286 DenseMatrix &elmat) override;
2287 /** Given a trial and test Finite Element computes the element stiffness
2288 matrix elmat. */
2289 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2290 const FiniteElement &test_fe,
2291 ElementTransformation &Trans,
2292 DenseMatrix &elmat) override;
2293
2294 void AssemblePatchMatrix(const int patch,
2295 const FiniteElementSpace &fes,
2296 SparseMatrix*& smat) override;
2297
2298 void AssembleNURBSPA(const FiniteElementSpace &fes) override;
2299
2300 void AssemblePatchPA(const int patch, const FiniteElementSpace &fes);
2301
2302 /// Perform the local action of the BilinearFormIntegrator
2303 void AssembleElementVector(const FiniteElement &el,
2305 const Vector &elfun, Vector &elvect) override;
2306
2307 void ComputeElementFlux(const FiniteElement &el,
2308 ElementTransformation &Trans,
2309 Vector &u, const FiniteElement &fluxelem,
2310 Vector &flux, bool with_coef = true,
2311 const IntegrationRule *ir = NULL) override;
2312
2313 real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
2314 ElementTransformation &Trans,
2315 Vector &flux, Vector *d_energy = NULL) override;
2316
2317 void AssembleMF(const FiniteElementSpace &fes) override;
2318
2320 void AssemblePA(const FiniteElementSpace &fes) override;
2321
2322 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2323 const bool add) override;
2324
2325 void AssembleDiagonalPA(Vector &diag) override;
2326
2327 void AssembleDiagonalMF(Vector &diag) override;
2328
2329 void AddMultMF(const Vector&, Vector&) const override;
2330
2331 void AddMultPA(const Vector&, Vector&) const override;
2332
2333 void AddAbsMultPA(const Vector&, Vector&) const override;
2334
2335 void AddMultTransposePA(const Vector&, Vector&) const override;
2336
2337 void AddAbsMultTransposePA(const Vector&, Vector&) const override;
2338
2339 void AddMultNURBSPA(const Vector&, Vector&) const override;
2340
2341 void AddMultPatchPA(const int patch, const Vector &x, Vector &y) const;
2342
2343 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2344 const FiniteElement &test_fe);
2345
2346 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2347
2348 Coefficient *GetCoefficient() const { return Q; }
2349
2350 template <int DIM, int D1D, int Q1D>
2351 static void AddSpecialization()
2352 {
2353 ApplyPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2354 DiagonalPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2355 }
2356protected:
2358 const FiniteElement& trial_fe,
2359 const FiniteElement& test_fe,
2360 const ElementTransformation& trans) const override
2361 {
2362 return &GetRule(trial_fe, test_fe);
2363 }
2364};
2365
2366/** Class for local mass matrix assembling $a(u,v) := (Q u, v)$ */
2368{
2369 friend class DGMassInverse;
2370protected:
2371#ifndef MFEM_THREAD_SAFE
2373#endif
2375 // PA extension
2378 const DofToQuad *maps; ///< Not owned
2379 const GeometricFactors *geom; ///< Not owned
2380 const FaceGeometricFactors *face_geom; ///< Not owned
2382
2383 void AssembleEA_(Vector &ea, const bool add);
2384
2385public:
2386
2387 using ApplyKernelType = void(*)(const int, const Array<real_t>&,
2388 const Array<real_t>&, const Vector&,
2389 const Vector&, Vector&, const int, const int);
2390
2391 using DiagonalKernelType = void(*)(const int, const Array<real_t>&,
2392 const Vector&, Vector&, const int,
2393 const int);
2394
2395 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
2396 MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType, (int, int, int));
2397 struct Kernels { Kernels(); };
2398
2399public:
2400 MassIntegrator(const IntegrationRule *ir = nullptr);
2401
2402 /// Construct a mass integrator with coefficient q
2403 MassIntegrator(Coefficient &q, const IntegrationRule *ir = NULL);
2404
2405 /** Given a particular Finite Element computes the element mass matrix
2406 elmat. */
2407 void AssembleElementMatrix(const FiniteElement &el,
2408 ElementTransformation &Trans,
2409 DenseMatrix &elmat) override;
2410 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2411 const FiniteElement &test_fe,
2412 ElementTransformation &Trans,
2413 DenseMatrix &elmat) override;
2414
2415 void AssembleMF(const FiniteElementSpace &fes) override;
2416
2418 void AssemblePA(const FiniteElementSpace &fes) override;
2419
2420 void AssemblePABoundary(const FiniteElementSpace &fes) override;
2421
2422 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2423 const bool add) override;
2424
2425 virtual void AssembleEABoundary(const FiniteElementSpace &fes, Vector &emat,
2426 const bool add) override;
2427
2428 virtual void AssembleDiagonalPA(Vector &diag) override;
2429
2430 void AssembleDiagonalMF(Vector &diag) override;
2431
2432 void AddMultMF(const Vector&, Vector&) const override;
2433
2434 void AddMultPA(const Vector&, Vector&) const override;
2435
2436 void AddAbsMultPA(const Vector&, Vector&) const override;
2437
2438 void AddMultTransposePA(const Vector&, Vector&) const override;
2439
2440 void AddAbsMultTransposePA(const Vector&, Vector&) const override;
2441
2442 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2443 const FiniteElement &test_fe,
2444 const ElementTransformation &Trans);
2445
2446 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2447
2448 const Coefficient *GetCoefficient() const { return Q; }
2449
2450 template <int DIM, int D1D, int Q1D>
2451 static void AddSpecialization()
2452 {
2453 ApplyPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2454 DiagonalPAKernels::Specialization<DIM,D1D,Q1D>::Add();
2455 }
2456
2457protected:
2459 const FiniteElement& trial_fe,
2460 const FiniteElement& test_fe,
2461 const ElementTransformation& trans) const override
2462 {
2463 return &GetRule(trial_fe, test_fe, trans);
2464 }
2465};
2466
2467/** Mass integrator $(u, v)$ restricted to the boundary of a domain */
2469{
2470public:
2472
2474 void AssembleFaceMatrix(const FiniteElement &el1,
2475 const FiniteElement &el2,
2477 DenseMatrix &elmat) override;
2478};
2479
2480/// $\alpha (Q \cdot \nabla u, v)$
2482{
2483protected:
2486 // PA extension
2488 const DofToQuad *maps; ///< Not owned
2489 const GeometricFactors *geom; ///< Not owned
2491
2492private:
2493#ifndef MFEM_THREAD_SAFE
2494 DenseMatrix dshape, adjJ, Q_ir;
2495 Vector shape, vec2, BdFidxT;
2496#endif
2497
2498public:
2500
2503 DenseMatrix &) override;
2504
2505 void AssembleMF(const FiniteElementSpace &fes) override;
2506
2508 void AssemblePA(const FiniteElementSpace&) override;
2509
2510 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2511 const bool add) override;
2512
2513 void AssembleDiagonalPA(Vector &diag) override;
2514
2515 void AssembleDiagonalMF(Vector &diag) override;
2516
2517 void AddMultMF(const Vector&, Vector&) const override;
2518
2519 void AddMultPA(const Vector&, Vector&) const override;
2520
2521 void AddMultTransposePA(const Vector &x, Vector &y) const override;
2522
2523 static const IntegrationRule &GetRule(const FiniteElement &el,
2524 const ElementTransformation &Trans);
2525
2526 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2527 const FiniteElement &test_fe,
2528 const ElementTransformation &Trans);
2529
2530 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2531
2532 /// arguments: NE, B, G, Bt, Gt, pa_data, x, y, D1D, Q1D
2533 using ApplyKernelType = void (*)(const int, const Array<real_t> &,
2534 const Array<real_t> &,
2535 const Array<real_t> &,
2536 const Array<real_t> &, const Vector &,
2537 const Vector &, Vector &, const int,
2538 const int);
2539
2540 /// arguments: DIMS, D1D, Q1D
2541 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
2542 /// arguments: DIMS, D1D, Q1D
2543 MFEM_REGISTER_KERNELS(ApplyPATKernels, ApplyKernelType, (int, int, int));
2544
2545 template <int DIM, int D1D, int Q1D>
2546 static void AddSpecialization()
2547 {
2548 ApplyPAKernels::Specialization<DIM, D1D, Q1D>::Add();
2549 ApplyPATKernels::Specialization<DIM, D1D, Q1D>::Add();
2550 }
2551
2552 struct Kernels { Kernels(); };
2553
2554protected:
2556 const FiniteElement& trial_fe,
2557 const FiniteElement& test_fe,
2558 const ElementTransformation& trans) const override
2559 {
2560 return &GetRule(trial_fe, test_fe, trans);
2561 }
2562};
2563
2564// Alias for @ConvectionIntegrator.
2566
2567/// $-\alpha (u, q \cdot \nabla v)$, negative transpose of ConvectionIntegrator
2574
2575/// $\alpha (Q \cdot \nabla u, v)$ using the "group" FE discretization
2577{
2578protected:
2581
2582private:
2583 DenseMatrix dshape, adjJ, Q_nodal, grad;
2584 Vector shape;
2585
2586public:
2591 DenseMatrix &) override;
2592};
2593
2594/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$,
2595 where $u=(u_1,\dots,u_n)$ and $v=(v_1,\dots,v_n)$, $u_i$ and $v_i$ are defined
2596 by scalar FE through standard transformation. */
2598{
2599 int vdim = -1, Q_order = 0;
2600 Vector shape, te_shape, vec;
2601 DenseMatrix partelmat;
2602 DenseMatrix mcoeff;
2603
2604protected:
2605 Coefficient *Q = nullptr;
2608 // PA extension
2609 const DofToQuad *maps; ///< Not owned
2610 const GeometricFactors *geom; ///< Not owned
2613
2614public:
2615 /// Construct an integrator with coefficient 1.0
2617
2618 /** Construct an integrator with scalar coefficient q. If possible, save
2619 memory by using a scalar integrator since the resulting matrix is block
2620 diagonal with the same diagonal block repeated. */
2621 VectorMassIntegrator(Coefficient &q, int qo = 0): Q_order(qo), Q(&q) { }
2622
2625
2626 /// Construct an integrator with diagonal coefficient q
2628 vdim(q.GetVDim()), Q_order(qo), VQ(&q) { }
2629
2630 /// Construct an integrator with matrix coefficient q
2632 vdim(q.GetVDim()), Q_order(qo), MQ(&q) { }
2633
2634 int GetVDim() const { return vdim; }
2635 void SetVDim(int vdim_) { vdim = vdim_; }
2636
2637 void AssembleElementMatrix(const FiniteElement &el,
2638 ElementTransformation &Trans,
2639 DenseMatrix &elmat) override;
2640 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2641 const FiniteElement &test_fe,
2642 ElementTransformation &Trans,
2643 DenseMatrix &elmat) override;
2644
2646 void AssemblePA(const FiniteElementSpace &fes) override;
2647 void AssembleMF(const FiniteElementSpace &fes) override;
2648 void AssembleDiagonalPA(Vector &diag) override;
2649 void AssembleDiagonalMF(Vector &diag) override;
2650 void AddMultPA(const Vector &x, Vector &y) const override;
2651 void AddMultMF(const Vector &x, Vector &y) const override;
2652 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
2653
2655 void(*)(const int, const int,
2656 const Array<real_t>&, const Vector&,
2657 const Vector&, Vector&, const int, const int);
2658
2659 MFEM_REGISTER_KERNELS(VectorMassAddMultPA,
2661 (int, int, int));
2662};
2663
2664
2665/** Class for integrating $(\nabla \cdot u, p)$ where $u$ is a vector field given by
2666 VectorFiniteElement through Piola transformation (for Raviart-Thomas elements); $p$ is
2667 scalar function given by FiniteElement through standard transformation.
2668 Here, $u$ is the trial function and $p$ is the test function.
2669
2670 Note: if the test space does not have map type INTEGRAL, then the element
2671 matrix returned by AssembleElementMatrix2 will not depend on the
2672 ElementTransformation Trans. */
2674{
2675protected:
2677
2679 void AssemblePA(const FiniteElementSpace &trial_fes,
2680 const FiniteElementSpace &test_fes) override;
2681
2682 void AddMultPA(const Vector&, Vector&) const override;
2683 void AddMultTransposePA(const Vector&, Vector&) const override;
2684
2685private:
2686#ifndef MFEM_THREAD_SAFE
2687 Vector divshape, shape;
2688#endif
2689
2690 // PA extension
2691 Vector pa_data;
2692 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2693 const DofToQuad *L2mapsO; ///< Not owned. DOF-to-quad map, open.
2694 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2695 int dim, ne, dofs1D, L2dofs1D, quad1D;
2696
2697public:
2701 ElementTransformation &Trans,
2702 DenseMatrix &elmat) override { }
2703 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2704 const FiniteElement &test_fe,
2705 ElementTransformation &Trans,
2706 DenseMatrix &elmat) override;
2707
2708 void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag) override;
2709};
2710
2711
2712/** Integrator for $(-Q u, \nabla v)$ for Nedelec ($u$) and $H^1$ ($v$) elements.
2713 This is equivalent to a weak divergence of the $H(curl$ basis functions. */
2715{
2716protected:
2718
2719private:
2720#ifndef MFEM_THREAD_SAFE
2721 DenseMatrix dshape;
2722 DenseMatrix dshapedxt;
2723 DenseMatrix vshape;
2724 DenseMatrix invdfdx;
2725#endif
2726
2727public:
2731 ElementTransformation &Trans,
2732 DenseMatrix &elmat) override { }
2733 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2734 const FiniteElement &test_fe,
2735 ElementTransformation &Trans,
2736 DenseMatrix &elmat) override;
2737};
2738
2739/** Integrator for $(\mathrm{curl}(u), v)$ for Nedelec and Raviart-Thomas elements. If the trial and
2740 test spaces are switched, assembles the form $(u, \mathrm{curl}(v))$. */
2742{
2743protected:
2745
2746private:
2747#ifndef MFEM_THREAD_SAFE
2748 DenseMatrix curlshapeTrial;
2749 DenseMatrix vshapeTest;
2750 DenseMatrix curlshapeTrial_dFT;
2751#endif
2752
2753public:
2757 ElementTransformation &Trans,
2758 DenseMatrix &elmat) override { }
2759 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2760 const FiniteElement &test_fe,
2761 ElementTransformation &Trans,
2762 DenseMatrix &elmat) override;
2763};
2764
2765/// Integrator for (Q u.n, v.n) for RT elements
2767{
2768 Coefficient *Q;
2769#ifndef MFEM_THREAD_SAFE
2770 Vector shape, te_shape;
2771#endif
2772public:
2775 void AssembleElementMatrix(const FiniteElement &el,
2776 ElementTransformation &Trans,
2777 DenseMatrix &elmat) override;
2778 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2779 const FiniteElement &test_fe,
2780 ElementTransformation &Trans,
2781 DenseMatrix &elmat) override;
2782};
2783
2784/// Class for integrating $ (Q \partial_i(u), v) $ where $u$ and $v$ are scalars
2786{
2787protected:
2789
2790private:
2791 int xi;
2792 DenseMatrix dshape, dshapedxt, invdfdx;
2793 Vector shape, dshapedxi;
2794
2795public:
2796 DerivativeIntegrator(Coefficient &q, int i) : Q(&q), xi(i) { }
2798 ElementTransformation &Trans,
2799 DenseMatrix &elmat) override
2800 { AssembleElementMatrix2(el,el,Trans,elmat); }
2801 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2802 const FiniteElement &test_fe,
2803 ElementTransformation &Trans,
2804 DenseMatrix &elmat) override;
2805};
2806
2807/// Integrator for $(\mathrm{curl}(u), \mathrm{curl}(v))$ for Nedelec elements
2809{
2810private:
2811 Vector vec, pointflux;
2812#ifndef MFEM_THREAD_SAFE
2813 Vector D;
2814 DenseMatrix curlshape, curlshape_dFt, M;
2815 DenseMatrix te_curlshape, te_curlshape_dFt;
2816 DenseMatrix vshape, projcurl;
2817#endif
2818
2819protected:
2823
2824 // PA extension
2826 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2827 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2828 const GeometricFactors *geom; ///< Not owned
2830 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2831
2832public:
2834 /// Construct a bilinear form integrator for Nedelec elements
2835 CurlCurlIntegrator(Coefficient &q, const IntegrationRule *ir = nullptr);
2837 const IntegrationRule *ir = nullptr);
2839 const IntegrationRule *ir = nullptr);
2840
2841 /* Given a particular Finite Element, compute the
2842 element curl-curl matrix elmat */
2843 void AssembleElementMatrix(const FiniteElement &el,
2844 ElementTransformation &Trans,
2845 DenseMatrix &elmat) override;
2846
2847 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2848 const FiniteElement &test_fe,
2849 ElementTransformation &Trans,
2850 DenseMatrix &elmat) override;
2851
2852 void ComputeElementFlux(const FiniteElement &el,
2853 ElementTransformation &Trans,
2854 Vector &u, const FiniteElement &fluxelem,
2855 Vector &flux, bool with_coef,
2856 const IntegrationRule *ir = NULL) override;
2857
2858 real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
2859 ElementTransformation &Trans,
2860 Vector &flux, Vector *d_energy = NULL) override;
2861
2863 void AssemblePA(const FiniteElementSpace &fes) override;
2864 void AddMultPA(const Vector &x, Vector &y) const override;
2865 void AddAbsMultPA(const Vector &x, Vector &y) const override;
2866 void AssembleDiagonalPA(Vector& diag) override;
2867
2868 const Coefficient *GetCoefficient() const { return Q; }
2869
2870 /// arguments: d1d, q1d, symmetric, NE, bo, bc, bot, bct, gc, gct, pa_data,
2871 /// x, y, useAbs
2872 using ApplyKernelType = void (*)(
2873 const int, const int, const bool, const int, const Array<real_t> &,
2874 const Array<real_t> &, const Array<real_t> &, const Array<real_t> &,
2875 const Array<real_t> &, const Array<real_t> &, const Vector &,
2876 const Vector &, Vector &, const bool);
2877
2878 /// arguments: d1d, q1d, symmetric, ne, Bo, Bc, Go, Gc, pa_data, diag
2879 using DiagonalKernelType = void (*)(const int, const int, const bool,
2880 const int, const Array<real_t> &,
2881 const Array<real_t> &,
2882 const Array<real_t> &,
2883 const Array<real_t> &, const Vector &,
2884 Vector &);
2885
2886 /// parameters: dim, d1d, q1d
2887 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
2888 /// parameters: dim, d1d, q1d
2889 MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType, (int, int, int));
2890 struct Kernels { Kernels(); };
2891
2892 template <int DIM, int D1D, int Q1D> static void AddSpecialization()
2893 {
2894 ApplyPAKernels::Specialization<DIM, D1D, Q1D>::Add();
2895 DiagonalPAKernels::Specialization<DIM, D1D, Q1D>::Add();
2896 }
2897};
2898
2899/** Integrator for $(\mathrm{curl}(u), \mathrm{curl}(v))$ for FE spaces defined by 'dim' copies of a
2900 scalar FE space. */
2902{
2903private:
2904#ifndef MFEM_THREAD_SAFE
2905 DenseMatrix dshape_hat, dshape, curlshape, Jadj, grad_hat, grad;
2906#endif
2907
2908protected:
2910
2911public:
2913
2915
2916 /// Assemble an element matrix
2917 void AssembleElementMatrix(const FiniteElement &el,
2918 ElementTransformation &Trans,
2919 DenseMatrix &elmat) override;
2920 /// Compute element energy: $ \frac{1}{2} (\mathrm{curl}(u), \mathrm{curl}(u))_E$
2923 const Vector &elfun) override;
2924};
2925
2926/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ where $Q$ is
2927 an optional scalar coefficient, and $v$ is a vector with components $v_i$ in
2928 the $L_2$ or $H^1$ space. This integrator handles 3 cases:
2929 1. u ∈ $H(curl$ in 3D, $v$ is a 3D vector with components $v_i$ in $L^2$ or $H^1$
2930 2. u ∈ $H(curl$ in 2D, $v$ is a scalar field in $L^2$ or $H^1$
2931 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
2932 2D vector field with components $v_i$ in $L^2$ or $H^1$ space.
2933
2934 Note: Case 2 can also be handled by MixedScalarCurlIntegrator */
2936{
2937protected:
2939
2940private:
2941 Vector shape;
2942 DenseMatrix dshape;
2943 DenseMatrix curlshape;
2944 DenseMatrix elmat_comp;
2945public:
2949
2950 void AssembleElementMatrix2(const FiniteElement &trial_fe,
2951 const FiniteElement &test_fe,
2952 ElementTransformation &Trans,
2953 DenseMatrix &elmat) override;
2954};
2955
2956/** Integrator for $(Q u, v)$, where $Q$ is an optional coefficient (of type scalar,
2957 vector (diagonal matrix), or matrix), trial function $u$ is in $H(curl$ or
2958 $H(div)$, and test function $v$ is in $H(curl$, $H(div)$, or $v=(v_1,\dots,v_n)$, where
2959 $v_i$ are in $H^1$. */
2961{
2962private:
2964 { Q = q; DQ = dq; MQ = mq; }
2965
2966#ifndef MFEM_THREAD_SAFE
2967 Vector shape;
2968 Vector D;
2969 DenseMatrix K;
2970 DenseMatrix partelmat;
2971 DenseMatrix test_vshape;
2972 DenseMatrix trial_vshape;
2973#endif
2974
2975protected:
2979
2980 // PA extension
2982 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2983 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2984 const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2985 const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2986 const GeometricFactors *geom; ///< Not owned
2988 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2989
2990public:
2991 VectorFEMassIntegrator() { Init(NULL, NULL, NULL); }
2992 VectorFEMassIntegrator(Coefficient *q_) { Init(q_, NULL, NULL); }
2993 VectorFEMassIntegrator(Coefficient &q) { Init(&q, NULL, NULL); }
2998
2999 void AssembleElementMatrix(const FiniteElement &el,
3000 ElementTransformation &Trans,
3001 DenseMatrix &elmat) override;
3002 void AssembleElementMatrix2(const FiniteElement &trial_fe,
3003 const FiniteElement &test_fe,
3004 ElementTransformation &Trans,
3005 DenseMatrix &elmat) override;
3006
3007 void AssemblePA(const FiniteElementSpace &fes) override;
3008 void AssemblePA(const FiniteElementSpace &trial_fes,
3009 const FiniteElementSpace &test_fes) override;
3010 void AddMultPA(const Vector &x, Vector &y) const override;
3011 void AddAbsMultPA(const Vector &x, Vector &y) const override;
3012 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3013 void AssembleDiagonalPA(Vector& diag) override;
3014 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
3015 const bool add) override;
3016
3017 const Coefficient *GetCoefficient() const { return Q; }
3018};
3019
3020/** Integrator for $(Q \nabla \cdot u, v)$ where $u=(u_1,\cdots,u_n)$ and all $u_i$ are in the same
3021 scalar FE space; $v$ is also in a (different) scalar FE space. */
3023{
3024protected:
3026
3027private:
3028 Vector shape;
3029 Vector divshape;
3030 DenseMatrix dshape;
3031 DenseMatrix gshape;
3032 DenseMatrix Jadj;
3033 // PA extension
3034 Vector pa_data;
3035 const DofToQuad *trial_maps, *test_maps; ///< Not owned
3036 const GeometricFactors *geom; ///< Not owned
3037 int dim, sdim, ne, nq;
3038 int trial_dofs1D, test_dofs1D, quad1D;
3039
3040public:
3042 Q(NULL), trial_maps(NULL), test_maps(NULL), geom(NULL)
3043 { }
3045 Q(q_), trial_maps(NULL), test_maps(NULL), geom(NULL)
3046 { }
3048 Q(&q), trial_maps(NULL), test_maps(NULL), geom(NULL)
3049 { }
3050
3051 void AssembleElementMatrix2(const FiniteElement &trial_fe,
3052 const FiniteElement &test_fe,
3053 ElementTransformation &Trans,
3054 DenseMatrix &elmat) override;
3055
3057 void AssemblePA(const FiniteElementSpace &trial_fes,
3058 const FiniteElementSpace &test_fes) override;
3059
3060 void AddMultPA(const Vector &x, Vector &y) const override;
3061 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3062
3063 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
3064 const FiniteElement &test_fe,
3065 const ElementTransformation &Trans);
3066
3067protected:
3069 const FiniteElement& trial_fe,
3070 const FiniteElement& test_fe,
3071 const ElementTransformation& trans) const override
3072 {
3073 return &GetRule(trial_fe, test_fe, trans);
3074 }
3075};
3076
3077/// $(Q \nabla \cdot u, \nabla \cdot v)$ for Raviart-Thomas elements
3079{
3080protected:
3082
3083private:
3084#ifndef MFEM_THREAD_SAFE
3085 Vector divshape, te_divshape;
3086#endif
3087
3088 // PA extension
3089 Vector pa_data;
3090 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
3091 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
3092 const GeometricFactors *geom; ///< Not owned
3093 int dim, ne, dofs1D, quad1D;
3094
3095public:
3096 DivDivIntegrator() { Q = NULL; }
3098 BilinearFormIntegrator(ir), Q(&q) { }
3099
3100 void AssembleElementMatrix(const FiniteElement &el,
3101 ElementTransformation &Trans,
3102 DenseMatrix &elmat) override;
3103
3104 void AssembleElementMatrix2(const FiniteElement &trial_fe,
3105 const FiniteElement &test_fe,
3106 ElementTransformation &Trans,
3107 DenseMatrix &elmat) override;
3108
3110 void AssemblePA(const FiniteElementSpace &fes) override;
3111 void AddMultPA(const Vector &x, Vector &y) const override;
3112 void AssembleDiagonalPA(Vector& diag) override;
3113 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
3114 const bool add) override;
3115
3116 const Coefficient *GetCoefficient() const { return Q; }
3117};
3118
3119/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$,
3120 where $u=(u_1,\dots,u_n)$ and $v=(v_1,\dots,v_n)$, $u_i$ and $v_i$ are
3121 defined by scalar FE through standard transformation.
3122 See the constructors' documentation for all Coefficient options.
3123 The computed local element matrix is square, of size <tt> vdim*dof </tt>,
3124 where \c vdim is the vector dimension space and \c dof is the local degrees
3125 of freedom. The integrator is not aware of the true vector dimension and
3126 must use \c VectorCoefficient, \c MatrixCoefficient, or a caller-specified
3127 value to determine the vector space. For a scalar coefficient, the caller
3128 may manually specify the vector dimension or the vector dimension is assumed
3129 to be the spatial dimension (i.e. 2-dimension or 3-dimension). */
3131{
3132 int vdim = -1;
3133 DenseMatrix dshape, dshapedxt, pelmat;
3134 DenseMatrix mcoeff;
3135 Vector vcoeff;
3136
3137protected:
3138 Coefficient *Q = nullptr;
3141 // PA extension
3142 const DofToQuad *maps; ///< Not owned
3143 const GeometricFactors *geom; ///< Not owned
3146
3147public:
3148 VectorDiffusionIntegrator(const IntegrationRule *ir = nullptr);
3149
3150 /** \brief Integrator with unit coefficient for caller-specified vector
3151 dimension.
3152
3153 If the vector dimension does not match the true dimension of the space,
3154 the resulting element matrix will be mathematically invalid. */
3155 VectorDiffusionIntegrator(int vector_dimension);
3156
3158
3160
3161 /** \brief Integrator with scalar coefficient for caller-specified vector
3162 dimension.
3163
3164 The element matrix is block-diagonal with \c vdim copies of the element
3165 matrix integrated with the \c Coefficient.
3166
3167 If the vector dimension does not match the true dimension of the space,
3168 the resulting element matrix will be mathematically invalid. */
3169 VectorDiffusionIntegrator(Coefficient &q, int vector_dimension);
3170
3171 /** \brief Integrator with \c VectorCoefficient. The vector dimension of the
3172 \c FiniteElementSpace is assumed to be the same as the dimension of the
3173 \c Vector.
3174
3175 The element matrix is block-diagonal and each block is integrated with
3176 coefficient $q_{i}$.
3177
3178 If the vector dimension does not match the true dimension of the space,
3179 the resulting element matrix will be mathematically invalid. */
3181
3182 /** \brief Integrator with \c MatrixCoefficient. The vector dimension of the
3183 \c FiniteElementSpace is assumed to be the same as the dimension of the
3184 \c Matrix.
3185
3186 The element matrix is populated in each block. Each block is integrated
3187 with coefficient $q_{ij}$.
3188
3189 If the vector dimension does not match the true dimension of the space,
3190 the resulting element matrix will be mathematically invalid. */
3192
3193 void AssembleElementMatrix(const FiniteElement &el,
3194 ElementTransformation &Trans,
3195 DenseMatrix &elmat) override;
3196 void AssembleElementVector(const FiniteElement &el,
3198 const Vector &elfun, Vector &elvect) override;
3199
3201 void AssemblePA(const FiniteElementSpace &fes) override;
3202 void AssembleMF(const FiniteElementSpace &fes) override;
3203 void AssembleDiagonalPA(Vector &diag) override;
3204 void AssembleDiagonalMF(Vector &diag) override;
3205 void AddMultPA(const Vector &x, Vector &y) const override;
3206 void AddMultMF(const Vector &x, Vector &y) const override;
3207 bool SupportsCeed() const override { return DeviceCanUseCeed(); }
3208
3209 /// arguments: ne, coeff_vdim, B, G, pa_data, x, y, d1d, q1d, vdim
3210 using ApplyKernelType = void (*)(const int, const int,
3211 const Array<real_t> &, const Array<real_t> &,
3212 const Vector &, const Vector &, Vector &,
3213 const int, const int, const int);
3214
3215 /// arguments: dim, vdim, d1d, q1d
3216 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int, int));
3217
3218 template <int DIM, int VDIM, int D1D, int Q1D>
3219 static void AddSpecialization()
3220 {
3221 ApplyPAKernels::Specialization<DIM, VDIM, D1D, Q1D>::Add();
3222 }
3223
3224 // struct Kernels { Kernels(); };
3225};
3226
3227/** Integrator for the linear elasticity form:
3228 $$
3229 a(u,v) = (\lambda \mathrm{div}(u), \mathrm{div}(v)) + (2 \mu \varepsilon(u), \varepsilon(v)),
3230 $$
3231 where $\varepsilon(v) = \frac{1}{2} (\mathrm{grad}(v) + \mathrm{grad}(v)^{\mathrm{T}})$.
3232 This is a 'Vector' integrator, i.e. defined for FE spaces
3233 using multiple copies of a scalar FE space. */
3235{
3237
3238protected:
3241
3242private:
3243#ifndef MFEM_THREAD_SAFE
3244 Vector shape;
3245 DenseMatrix dshape, gshape, pelmat;
3246 Vector divshape;
3247#endif
3248
3249 // PA extension
3250
3251 const DofToQuad *maps; ///< Not owned
3252 const GeometricFactors *geom; ///< Not owned
3253 int vdim, ndofs;
3254 const FiniteElementSpace *fespace; ///< Not owned.
3255
3256 std::unique_ptr<QuadratureSpace> q_space;
3257 /// Coefficients projected onto q_space
3258 std::unique_ptr<CoefficientVector> lambda_quad, mu_quad;
3259 /// Workspace vector
3260 std::unique_ptr<QuadratureFunction> q_vec;
3261
3262 /// Set up the quadrature space and project lambda and mu coefficients
3263 void SetUpQuadratureSpaceAndCoefficients(const FiniteElementSpace &fes);
3264
3265public:
3268 /** With this constructor $\lambda = q_l m$ and $\mu = q_m m$
3269 if $dim q_l + 2 q_m = 0$ then $tr(\sigma) = 0$. */
3271 { lambda = NULL; mu = &m; q_lambda = q_l; q_mu = q_m; }
3272
3273 void AssembleElementMatrix(const FiniteElement &el,
3275 DenseMatrix &elmat) override;
3276
3278 void AssemblePA(const FiniteElementSpace &fes) override;
3279
3280 void AssembleDiagonalPA(Vector &diag) override;
3281
3282 void AddMultPA(const Vector &x, Vector &y) const override;
3283
3284 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3285
3286 /** Compute the stress corresponding to the local displacement @a $u$ and
3287 interpolate it at the nodes of the given @a fluxelem. Only the symmetric
3288 part of the stress is stored, so that the size of @a flux is equal to
3289 the number of DOFs in @a fluxelem times dim*(dim+1)/2. In 2D, the order
3290 of the stress components is: $s_xx, s_yy, s_xy$. In 3D, it is: $s_xx, s_yy,
3291 s_zz, s_xy, s_xz, s_yz$. In other words, @a flux is the local vector for
3292 a FE space with dim*(dim+1)/2 vector components, based on the finite
3293 element @a fluxelem. The integration rule is taken from @a fluxelem.
3294 @a ir exists to specific an alternative integration rule. */
3295 void ComputeElementFlux(const FiniteElement &el,
3296 ElementTransformation &Trans,
3297 Vector &u,
3298 const FiniteElement &fluxelem,
3299 Vector &flux, bool with_coef = true,
3300 const IntegrationRule *ir = NULL) override;
3301
3302 /** Compute the element energy (integral of the strain energy density)
3303 corresponding to the stress represented by @a flux which is a vector of
3304 coefficients multiplying the basis functions defined by @a fluxelem. In
3305 other words, @a flux is the local vector for a FE space with
3306 dim*(dim+1)/2 vector components, based on the finite element @a fluxelem.
3307 The number of components, dim*(dim+1)/2 is such that it represents the
3308 symmetric part of the (symmetric) stress tensor. The order of the
3309 components is: $s_xx, s_yy, s_xy$ in 2D, and $s_xx, s_yy, s_zz, s_xy, s_xz,
3310 s_yz$ in 3D. */
3311 real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
3312 ElementTransformation &Trans,
3313 Vector &flux, Vector *d_energy = NULL) override;
3314};
3315
3316/// @brief Integrator that computes the PA action of one of the blocks in an
3317/// ElasticityIntegrator, considering the elasticity operator as a dim x dim
3318/// block operator.
3320{
3321 ElasticityIntegrator &parent;
3322 const int i_block;
3323 const int j_block;
3324
3325 const DofToQuad *maps; ///< Not owned
3326 const GeometricFactors *geom; ///< Not owned
3327 const FiniteElementSpace *fespace; ///< Not owned.
3328
3329public:
3330 /// @brief Given an ElasticityIntegrator, create an integrator that
3331 /// represents the $(i,j)$th component block.
3332 ///
3333 /// @note The parent ElasticityIntegrator must remain valid throughout the
3334 /// lifetime of this integrator.
3335 ElasticityComponentIntegrator(ElasticityIntegrator &parent_, int i_, int j_);
3336
3338 void AssemblePA(const FiniteElementSpace &fes) override;
3339
3340 void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
3341 const bool add = true) override;
3342
3343 void AddMultPA(const Vector &x, Vector &y) const override;
3344
3345 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3346};
3347
3348/** Integrator for the DG form:
3349 $$
3350 \alpha \langle \rho_u (u \cdot n) \{v\},[w] \rangle + \beta \langle \rho_u |u \cdot n| [v],[w] \rangle,
3351 $$
3352 where $v$ and $w$ are the trial and test variables, respectively, and $\rho$/$u$ are
3353 given scalar/vector coefficients. $\{v\}$ represents the average value of $v$ on
3354 the face and $[v]$ is the jump such that $\{v\}=(v_1+v_2)/2$ and $[v]=(v_1-v_2)$ for the
3355 face between elements $1$ and $2$. For boundary elements, $v2=0$. The vector
3356 coefficient, $u$, is assumed to be continuous across the faces and when given
3357 the scalar coefficient, $\rho$, is assumed to be discontinuous. The integrator
3358 uses the upwind value of $\rho$, denoted by $\rho_u$, which is value from the side into which
3359 the vector coefficient, $u$, points.
3360
3361 One use case for this integrator is to discretize the operator $-u \cdot \nabla v$
3362 with a DG formulation. The resulting formulation uses the
3363 ConvectionIntegrator (with coefficient $u$, and parameter $\alpha = -1$) and the
3364 transpose of the DGTraceIntegrator (with coefficient $u$, and parameters $\alpha = 1$,
3365 $\beta = -1/2$ to use the upwind face flux, see also
3366 NonconservativeDGTraceIntegrator). This discretization and the handling of
3367 the inflow and outflow boundaries is illustrated in Example 9/9p.
3368
3369 Another use case for this integrator is to discretize the operator $-\mathrm{div}(u v)$
3370 with a DG formulation. The resulting formulation is conservative and
3371 consists of the ConservativeConvectionIntegrator (with coefficient $u$, and
3372 parameter $\alpha = -1$) plus the DGTraceIntegrator (with coefficient $u$, and
3373 parameters $\alpha = -1$, $\beta = -1/2$ to use the upwind face flux).
3374 */
3376{
3377protected:
3378 Coefficient *rho = nullptr;
3381 // PA extension
3383 const DofToQuad *maps; ///< Not owned
3384 const FaceGeometricFactors *geom; ///< Not owned
3386
3387private:
3388 Vector shape1, shape2;
3389 Vector tr_shape1, te_shape1, tr_shape2, te_shape2;
3390
3391public:
3393
3394 /// Construct integrator with $\rho = 1$, $\beta = \alpha/2$.
3396
3397 /// Construct integrator with $\rho = 1$.
3399
3401 real_t a, real_t b);
3402
3404 void AssembleFaceMatrix(const FiniteElement &el1,
3405 const FiniteElement &el2,
3407 DenseMatrix &elmat) override;
3408
3409 void AssembleFaceMatrix(const FiniteElement &trial_fe1,
3410 const FiniteElement &test_fe1,
3411 const FiniteElement &trial_fe2,
3412 const FiniteElement &test_fe2,
3414 DenseMatrix &elmat) override;
3415
3416 void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override;
3417
3418 void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override;
3419
3420 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3421
3422 void AddMultPA(const Vector&, Vector&) const override;
3423
3426 Vector &ea_data_int,
3427 Vector &ea_data_ext,
3428 const bool add) override;
3429
3431 Vector &ea_data_bdr,
3432 const bool add) override;
3433
3434 static const IntegrationRule &GetRule(Geometry::Type geom, int order,
3436
3437 static const IntegrationRule &GetRule(Geometry::Type geom, int order,
3438 const ElementTransformation &T);
3439
3440 /// arguments: nf, B, Bt, pa_data, x, y, dofs1D, quad1D
3441 using ApplyKernelType = void (*)(const int, const Array<real_t> &,
3442 const Array<real_t> &, const Vector &,
3443 const Vector &, Vector &, const int,
3444 const int);
3445
3446 /// arguments: DIM, d1d, q1d
3447 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
3448 /// arguments: DIM, d1d, q1d
3449 MFEM_REGISTER_KERNELS(ApplyPATKernels, ApplyKernelType, (int, int, int));
3450
3451 template <int DIM, int D1D, int Q1D> static void AddSpecialization()
3452 {
3453 ApplyPAKernels::Specialization<DIM, D1D, Q1D>::Add();
3454 ApplyPATKernels::Specialization<DIM, D1D, Q1D>::Add();
3455 }
3456
3457 struct Kernels { Kernels(); };
3458
3459
3460private:
3461 void SetupPA(const FiniteElementSpace &fes, FaceType type);
3462};
3463
3464// Alias for @a DGTraceIntegrator.
3466
3467/** Integrator that represents the face terms used for the non-conservative
3468 DG discretization of the convection equation:
3469 $$
3470 -\alpha \langle \rho_u (u \cdot n) \{v\},[w] \rangle + \beta \langle \rho_u |u \cdot n| [v],[w] \rangle.
3471 $$
3472 This integrator can be used with together with ConvectionIntegrator to
3473 implement an upwind DG discretization in non-conservative form, see ex9 and
3474 ex9p. */
3488
3489/** Integrator for the DG form:
3490 $$
3491 - \langle \{(Q \nabla u) \cdot n\}, [v] \rangle + \sigma \langle [u], \{(Q \nabla v) \cdot n \} \rangle
3492 + \kappa \langle \{h^{-1} Q\} [u], [v] \rangle
3493 $$
3494 where $Q$ is a scalar or matrix diffusion coefficient and $u$, $v$ are the trial
3495 and test spaces, respectively. The parameters $\sigma$ and $\kappa$ determine the
3496 DG method to be used (when this integrator is added to the "broken"
3497 DiffusionIntegrator):
3498 - $\sigma = -1$, $\kappa \geq \kappa_0$: symm. interior penalty (IP or SIPG) method,
3499 - $\sigma = +1$, $\kappa > 0$: non-symmetric interior penalty (NIPG) method,
3500 - $\sigma = +1$, $\kappa = 0$: the method of Baumann and Oden.
3501
3502 \todo Clarify used notation. */
3504{
3505protected:
3506 Coefficient *Q = nullptr;
3509
3510 // these are not thread-safe!
3513
3514
3515 // PA extension
3516 Vector pa_data; // (Q, h, dot(n,J)|el0, dot(n,J)|el1)
3517 const DofToQuad *maps; ///< Not owned
3520
3521public:
3522 DGDiffusionIntegrator(const real_t s, const real_t k);
3523 DGDiffusionIntegrator(Coefficient &q, const real_t s, const real_t k);
3526 void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2,
3528 DenseMatrix &elmat) override;
3529
3530 bool RequiresFaceNormalDerivatives() const override { return true; }
3531
3533
3534 void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override;
3535
3536 void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override;
3537
3538 void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn,
3539 Vector &y, Vector &dydn) const override;
3540
3542
3543 const IntegrationRule &GetRule(int order, Geometry::Type geom);
3544
3546
3547 /// arguments: nf, B, Bt, G, Gt, sigma, pa_data, x, dxdn, y, dydn, dofs1D,
3548 /// quad1D
3549 using ApplyKernelType = void (*)(const int, const Array<real_t> &,
3550 const Array<real_t> &,
3551 const Array<real_t> &,
3552 const Array<real_t> &, const real_t,
3553 const Vector &, const Vector &_,
3554 const Vector &, Vector &, Vector &,
3555 const int, const int);
3556
3557 /// arguments: DIM, d1d, q1d
3558 MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType, (int, int, int));
3559
3560 template <int DIM, int D1D, int Q1D> static void AddSpecialization()
3561 {
3562 ApplyPAKernels::Specialization<DIM, D1D, Q1D>::Add();
3563 }
3564
3565 struct Kernels { Kernels(); };
3566
3567private:
3568 void SetupPA(const FiniteElementSpace &fes, FaceType type);
3569};
3570
3571/** Integrator for the "BR2" diffusion stabilization term
3572 $$
3573 \sum_e \eta (r_e([u]), r_e([v]))
3574 $$
3575 where $r_e$ is the lifting operator defined on each edge $e$ (potentially
3576 weighted by a coefficient $Q$). The parameter eta can be chosen to be one to
3577 obtain a stable discretization. The constructor for this integrator requires
3578 the finite element space because the lifting operator depends on the
3579 element-wise inverse mass matrix.
3580
3581 BR2 stands for the second method of Bassi and Rebay:
3582
3583 - F. Bassi and S. Rebay. A high order discontinuous Galerkin method for
3584 compressible turbulent flows. In B. Cockburn, G. E. Karniadakis, and
3585 C.-W. Shu, editors, Discontinuous Galerkin Methods, pages 77-88. Springer
3586 Berlin Heidelberg, 2000.
3587 - D. N. Arnold, F. Brezzi, B. Cockburn, and L. D. Marini. Unified analysis
3588 of discontinuous Galerkin methods for elliptic problems. SIAM Journal on
3589 Numerical Analysis, 39(5):1749-1779, 2002.
3590*/
3592{
3593protected:
3595
3596 // Block factorizations of local mass matrices, with offsets for the case of
3597 // not equally sized blocks (mixed meshes, p-refinement)
3601
3603
3605
3609
3610 /// Precomputes the inverses (LU factorizations) of the local mass matrices.
3611 /** @a fes must be a DG space, so the mass matrix is block diagonal, and its
3612 inverse can be computed locally. This is required for the computation of
3613 the lifting operators @a r_e.
3614 */
3616
3617public:
3620 real_t e = 1.0);
3621 MFEM_DEPRECATED DGDiffusionBR2Integrator(class FiniteElementSpace *fes,
3622 real_t e = 1.0);
3623
3625 void AssembleFaceMatrix(const FiniteElement &el1,
3626 const FiniteElement &el2,
3628 DenseMatrix &elmat) override;
3629};
3630
3631/** Integrator for the DG elasticity form, for the formulations see:
3632 - PhD Thesis of Jonas De Basabe, High-Order Finite %Element Methods for
3633 Seismic Wave Propagation, UT Austin, 2009, p. 23, and references therein
3634 - Peter Hansbo and Mats G. Larson, Discontinuous Galerkin and the
3635 Crouzeix-Raviart %Element: Application to Elasticity, PREPRINT 2000-09,
3636 p.3
3637
3638 $$
3639 - \left< \{ \tau(u) \}, [v] \right> + \alpha \left< \{ \tau(v) \}, [u]
3640 \right> + \kappa \left< h^{-1} \{ \lambda + 2 \mu \} [u], [v] \right>
3641 $$
3642
3643 where $ \left<u, v\right> = \int_{F} u \cdot v $, and $ F $ is a
3644 face which is either a boundary face $ F_b $ of an element $ K $ or
3645 an interior face $ F_i $ separating elements $ K_1 $ and $ K_2 $.
3646
3647 In the bilinear form above $ \tau(u) $ is traction, and it's also
3648 $ \tau(u) = \sigma(u) \cdot \vec{n} $, where $ \sigma(u) $ is
3649 stress, and $ \vec{n} $ is the unit normal vector w.r.t. to $ F $.
3650
3651 In other words, we have
3652 $$
3653 - \left< \{ \sigma(u) \cdot \vec{n} \}, [v] \right> + \alpha \left< \{
3654 \sigma(v) \cdot \vec{n} \}, [u] \right> + \kappa \left< h^{-1} \{
3655 \lambda + 2 \mu \} [u], [v] \right>
3656 $$
3657
3658 For isotropic media
3659 $$
3660 \begin{split}
3661 \sigma(u) &= \lambda \nabla \cdot u I + 2 \mu \varepsilon(u) \\
3662 &= \lambda \nabla \cdot u I + 2 \mu \frac{1}{2} (\nabla u + \nabla
3663 u^{\mathrm{T}}) \\
3664 &= \lambda \nabla \cdot u I + \mu (\nabla u + \nabla u^{\mathrm{T}})
3665 \end{split}
3666 $$
3667
3668 where $ I $ is identity matrix, $ \lambda $ and $ \mu $ are Lame
3669 coefficients (see ElasticityIntegrator), $ u, v $ are the trial and test
3670 functions, respectively.
3671
3672 The parameters $ \alpha $ and $ \kappa $ determine the DG method to
3673 use (when this integrator is added to the "broken" ElasticityIntegrator):
3674
3675 - IIPG, $\alpha = 0$,
3676 C. Dawson, S. Sun, M. Wheeler, Compatible algorithms for coupled flow and
3677 transport, Comp. Meth. Appl. Mech. Eng., 193(23-26), 2565-2580, 2004.
3678
3679 - SIPG, $\alpha = -1$,
3680 M. Grote, A. Schneebeli, D. Schotzau, Discontinuous Galerkin Finite
3681 %Element Method for the Wave Equation, SINUM, 44(6), 2408-2431, 2006.
3682
3683 - NIPG, $\alpha = 1$,
3684 B. Riviere, M. Wheeler, V. Girault, A Priori Error Estimates for Finite
3685 %Element Methods Based on Discontinuous Approximation Spaces for Elliptic
3686 Problems, SINUM, 39(3), 902-931, 2001.
3687
3688 This is a '%Vector' integrator, i.e. defined for FE spaces using multiple
3689 copies of a scalar FE space.
3690 */
3692{
3693public:
3695 : lambda(NULL), mu(NULL), alpha(alpha_), kappa(kappa_) { }
3696
3698 real_t alpha_, real_t kappa_)
3699 : lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
3700
3702 void AssembleFaceMatrix(const FiniteElement &el1,
3703 const FiniteElement &el2,
3705 DenseMatrix &elmat) override;
3706
3707protected:
3710
3711#ifndef MFEM_THREAD_SAFE
3712 // values of all scalar basis functions for one component of u (which is a
3713 // vector) at the integration point in the reference space
3715 // values of derivatives of all scalar basis functions for one component
3716 // of u (which is a vector) at the integration point in the reference space
3718 // Adjugate of the Jacobian of the transformation: adjJ = det(J) J^{-1}
3720 // gradient of shape functions in the real (physical, not reference)
3721 // coordinates, scaled by det(J):
3722 // dshape_ps(jdof,jm) = sum_{t} adjJ(t,jm)*dshape(jdof,t)
3724 Vector nor; // nor = |weight(J_face)| n
3725 Vector nL1, nL2; // nL1 = (lambda1 * ip.weight / detJ1) nor
3726 Vector nM1, nM2; // nM1 = (mu1 * ip.weight / detJ1) nor
3727 Vector dshape1_dnM, dshape2_dnM; // dshape1_dnM = dshape1_ps . nM1
3728 // 'jmat' corresponds to the term: kappa <h^{-1} {lambda + 2 mu} [u], [v]>
3730#endif
3731
3732 static void AssembleBlock(
3733 const int dim, const int row_ndofs, const int col_ndofs,
3734 const int row_offset, const int col_offset,
3735 const real_t jmatcoef, const Vector &col_nL, const Vector &col_nM,
3736 const Vector &row_shape, const Vector &col_shape,
3737 const Vector &col_dshape_dnM, const DenseMatrix &col_dshape,
3738 DenseMatrix &elmat, DenseMatrix &jmat);
3739};
3740
3741/** Integrator for the DPG form:$ \langle v, [w] \rangle $ over all faces (the interface) where
3742 the trial variable $v$ is defined on the interface and the test variable $w$ is
3743 defined inside the elements, generally in a DG space. */
3745{
3746private:
3747 Vector face_shape, shape1, shape2;
3748
3749public:
3752 void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3753 const FiniteElement &test_fe1,
3754 const FiniteElement &test_fe2,
3756 DenseMatrix &elmat) override;
3757};
3758
3759/** Integrator for the form:$ \langle v, [w \cdot n] \rangle $ over all faces (the interface) where
3760 the trial variable $v$ is defined on the interface and the test variable $w$ is
3761 in an $H(div)$-conforming space. */
3763{
3764private:
3765 Vector face_shape, normal, shape1_n, shape2_n;
3766 DenseMatrix shape1, shape2;
3767
3768public:
3771 void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3772 const FiniteElement &test_fe1,
3773 const FiniteElement &test_fe2,
3775 DenseMatrix &elmat) override;
3776
3778 void AssembleEAInteriorFaces(const FiniteElementSpace &trial_fes,
3779 const FiniteElementSpace &test_fes,
3780 Vector &emat,
3781 const bool add = true) override;
3782};
3783
3784/** Integrator for the DPG form:$ \langle v, w \rangle $ over a face (the interface) where
3785 the trial variable $v$ is defined on the interface
3786 ($H^{-1/2}$ i.e., $v := u \cdot n$ normal trace of $H(div)$)
3787 and the test variable $w$ is in an $H^1$-conforming space. */
3789{
3790private:
3791 Vector face_shape, shape;
3792public:
3794 void AssembleTraceFaceMatrix(int elem,
3795 const FiniteElement &trial_face_fe,
3796 const FiniteElement &test_fe,
3798 DenseMatrix &elmat);
3799};
3800
3801/** Integrator for the form: $ \langle v, w \cdot n \rangle $ over a face (the interface) where
3802 the trial variable $v$ is defined on the interface ($H^{1/2}$, i.e., trace of $H^1$)
3803 and the test variable $w$ is in an $H(div)$-conforming space. */
3805{
3806private:
3807 Vector face_shape, normal, shape_n;
3808 DenseMatrix shape;
3809
3810public:
3812 void AssembleTraceFaceMatrix(int ielem,
3813 const FiniteElement &trial_face_fe,
3814 const FiniteElement &test_fe,
3816 DenseMatrix &elmat) override;
3817};
3818
3819
3820/** Integrator for the form: $\langle v, w \times n \rangle$ over a face (the interface)
3821 * In 3D the trial variable $v$ is defined on the interface ($H^{-1/2}$(curl), trace of $H(curl$)
3822 * In 2D it's defined on the interface ($H^{1/2}$, trace of $H^1$)
3823 * The test variable $w$ is in an $H(curl$-conforming space. */
3825{
3826private:
3827 DenseMatrix face_shape, shape, shape_n;
3828 Vector normal;
3829 Vector temp;
3830
3831 void cross_product(const Vector & x, const DenseMatrix & Y, DenseMatrix & Z)
3832 {
3833 int dim = x.Size();
3834 MFEM_VERIFY(Y.Width() == dim, "Size mismatch");
3835 int dimc = dim == 3 ? dim : 1;
3836 int h = Y.Height();
3837 Z.SetSize(h,dimc);
3838 if (dim == 3)
3839 {
3840 for (int i = 0; i<h; i++)
3841 {
3842 Z(i,0) = x(2) * Y(i,1) - x(1) * Y(i,2);
3843 Z(i,1) = x(0) * Y(i,2) - x(2) * Y(i,0);
3844 Z(i,2) = x(1) * Y(i,0) - x(0) * Y(i,1);
3845 }
3846 }
3847 else
3848 {
3849 for (int i = 0; i<h; i++)
3850 {
3851 Z(i,0) = x(1) * Y(i,0) - x(0) * Y(i,1);
3852 }
3853 }
3854 }
3855
3856public:
3858 void AssembleTraceFaceMatrix(int elem,
3859 const FiniteElement &trial_face_fe,
3860 const FiniteElement &test_fe,
3862 DenseMatrix &elmat);
3863};
3864
3865/** Abstract class to serve as a base for local interpolators to be used in the
3866 DiscreteLinearOperator class. */
3868
3869
3870/** Class for constructing the gradient as a DiscreteLinearOperator from an
3871 $H^1$-conforming space to an $H(curl$-conforming space. The range space can be
3872 vector $L_2$ space as well. */
3874{
3875public:
3876 GradientInterpolator() : dofquad_fe(NULL) { }
3877 virtual ~GradientInterpolator() { delete dofquad_fe; }
3878
3880 const FiniteElement &nd_fe,
3881 ElementTransformation &Trans,
3882 DenseMatrix &elmat) override
3883 { nd_fe.ProjectGrad(h1_fe, Trans, elmat); }
3884
3886
3887 /** @brief Setup method for PA data.
3888
3889 @param[in] trial_fes $H^1$ Lagrange space
3890 @param[in] test_fes $H(curl$ Nedelec space
3891 */
3892 void AssemblePA(const FiniteElementSpace &trial_fes,
3893 const FiniteElementSpace &test_fes) override;
3894
3895 void AddMultPA(const Vector &x, Vector &y) const override;
3896 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3897
3898private:
3899 /// 1D finite element that generates and owns the 1D DofToQuad maps below
3900 FiniteElement *dofquad_fe;
3901
3902 bool B_id; // is the B basis operator (maps_C_C) the identity?
3903 const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3904 const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3905 int dim, ne, o_dofs1D, c_dofs1D;
3906};
3907
3908
3909/** Class for constructing the identity map as a DiscreteLinearOperator. This
3910 is the discrete embedding matrix when the domain space is a subspace of
3911 the range space. Otherwise, a dof projection matrix is constructed. */
3913{
3914protected:
3915 const int vdim;
3916
3917public:
3918 /** @brief Construct an identity interpolator.
3919
3920 @param[in] vdim_ Vector dimension (number of components) in the domain
3921 and range FE spaces.
3922 */
3923 IdentityInterpolator(int vdim_ = 1) : vdim(vdim_) { }
3924
3926 const FiniteElement &ran_fe,
3927 ElementTransformation &Trans,
3928 DenseMatrix &elmat) override
3929 {
3930 if (vdim == 1)
3931 {
3932 ran_fe.Project(dom_fe, Trans, elmat);
3933 return;
3934 }
3935 DenseMatrix elmat_block;
3936 ran_fe.Project(dom_fe, Trans, elmat_block);
3937 elmat.SetSize(vdim*elmat_block.Height(), vdim*elmat_block.Width());
3938 elmat = 0_r;
3939 for (int i = 0; i < vdim; i++)
3940 {
3941 elmat.SetSubMatrix(i*elmat_block.Height(), i*elmat_block.Width(),
3942 elmat_block);
3943 }
3944 }
3945
3947 void AssemblePA(const FiniteElementSpace &trial_fes,
3948 const FiniteElementSpace &test_fes) override;
3949
3950 void AddMultPA(const Vector &x, Vector &y) const override;
3951 void AddMultTransposePA(const Vector &x, Vector &y) const override;
3952
3953private:
3954 /// 1D finite element that generates and owns the 1D DofToQuad maps below
3955 std::unique_ptr<FiniteElement> dofquad_fe;
3956
3957 const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3958 const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3959 int dim, ne, o_dofs1D, c_dofs1D;
3960
3961 Vector pa_data;
3962};
3963
3964
3965/** @brief Class identical to IdentityInterpolator with the exception that it
3966 requires the vector dimension (number of components) to be specified during
3967 construction. */
3969{
3970public:
3972};
3973
3974
3975/** Class for constructing the (local) discrete curl matrix which can be used
3976 as an integrator in a DiscreteLinearOperator object to assemble the global
3977 discrete curl matrix. */
3979{
3980public:
3982 const FiniteElement &ran_fe,
3983 ElementTransformation &Trans,
3984 DenseMatrix &elmat) override
3985 { ran_fe.ProjectCurl(dom_fe, Trans, elmat); }
3986};
3987
3988
3989/** Class for constructing the (local) discrete divergence matrix which can
3990 be used as an integrator in a DiscreteLinearOperator object to assemble
3991 the global discrete divergence matrix.
3992
3993 Note: Since the dofs in the L2_FECollection are nodal values, the local
3994 discrete divergence matrix (with an $H(div)$-type domain space) will depend on
3995 the transformation. On the other hand, the local matrix returned by
3996 VectorFEDivergenceIntegrator is independent of the transformation. */
3998{
3999public:
4001 const FiniteElement &ran_fe,
4002 ElementTransformation &Trans,
4003 DenseMatrix &elmat) override
4004 { ran_fe.ProjectDiv(dom_fe, Trans, elmat); }
4005};
4006
4007
4008/** A trace face interpolator class for interpolating the normal component of
4009 the domain space, e.g. vector $H^1$, into the range space, e.g. the trace of
4010 $H(div)$ which uses FiniteElement::INTEGRAL map type. */
4012{
4013public:
4014 void AssembleElementMatrix2(const FiniteElement &dom_fe,
4015 const FiniteElement &ran_fe,
4016 ElementTransformation &Trans,
4017 DenseMatrix &elmat) override;
4018};
4019
4020/** Interpolator of a scalar coefficient multiplied by a scalar field onto
4021 another scalar field. Note that this can produce inaccurate fields unless
4022 the target is sufficiently high order. */
4024{
4025public:
4027
4028 void AssembleElementMatrix2(const FiniteElement &dom_fe,
4029 const FiniteElement &ran_fe,
4030 ElementTransformation &Trans,
4031 DenseMatrix &elmat) override;
4032
4033protected:
4035};
4036
4037/** Interpolator of a scalar coefficient multiplied by a vector field onto
4038 another vector field. Note that this can produce inaccurate fields unless
4039 the target is sufficiently high order. */
4041{
4042public:
4045
4046 void AssembleElementMatrix2(const FiniteElement &dom_fe,
4047 const FiniteElement &ran_fe,
4048 ElementTransformation &Trans,
4049 DenseMatrix &elmat) override;
4050protected:
4052};
4053
4054/** Interpolator of a vector coefficient multiplied by a scalar field onto
4055 another vector field. Note that this can produce inaccurate fields unless
4056 the target is sufficiently high order. */
4058{
4059public:
4062
4063 void AssembleElementMatrix2(const FiniteElement &dom_fe,
4064 const FiniteElement &ran_fe,
4065 ElementTransformation &Trans,
4066 DenseMatrix &elmat) override;
4067protected:
4069};
4070
4071/** Interpolator of the 2D cross product between a vector coefficient and an
4072 $H(curl$-conforming field onto an $L_2$-conforming field. */
4074{
4075public:
4078
4079 void AssembleElementMatrix2(const FiniteElement &nd_fe,
4080 const FiniteElement &l2_fe,
4081 ElementTransformation &Trans,
4082 DenseMatrix &elmat) override;
4083protected:
4085};
4086
4087/** Interpolator of the cross product between a vector coefficient and an
4088 $H(curl$-conforming field onto an $H(div)$-conforming field. The range space
4089 can also be vector $L_2$. */
4091{
4092public:
4095
4096 void AssembleElementMatrix2(const FiniteElement &nd_fe,
4097 const FiniteElement &rt_fe,
4098 ElementTransformation &Trans,
4099 DenseMatrix &elmat) override;
4100protected:
4102};
4103
4104/** Interpolator of the inner product between a vector coefficient and an
4105 $H(div)$-conforming field onto an $L_2$-conforming field. The range space can
4106 also be $H^1$. */
4108{
4109public:
4111
4112 void AssembleElementMatrix2(const FiniteElement &rt_fe,
4113 const FiniteElement &l2_fe,
4114 ElementTransformation &Trans,
4115 DenseMatrix &elmat) override;
4116protected:
4118};
4119
4120}
4121#endif
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Definition array.hpp:912
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 AddAbsMultPA(const Vector &x, Vector &y) const
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.
virtual void AddAbsMultTransposePA(const Vector &x, Vector &y) const
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.
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int))
arguments: DIMS, D1D, Q1D
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
MFEM_REGISTER_KERNELS(ApplyPATKernels, ApplyKernelType,(int, int, int))
arguments: DIMS, D1D, Q1D
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(*)(const int, 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
arguments: NE, B, G, Bt, Gt, pa_data, x, y, D1D, Q1D
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.
MFEM_REGISTER_KERNELS(DiagonalPAKernels, DiagonalKernelType,(int, int, int))
parameters: dim, d1d, q1d
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
const GeometricFactors * geom
Not owned.
void AddAbsMultPA(const Vector &x, Vector &y) const override
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
Given a particular Finite Element computes the element matrix elmat.
static void AddSpecialization()
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
void(*)(const int, const int, const bool, const int, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Vector &, Vector &) DiagonalKernelType
arguments: d1d, q1d, symmetric, ne, Bo, Bc, Go, Gc, pa_data, diag
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int))
parameters: dim, d1d, q1d
MatrixCoefficient * MQ
void(*)( const int, const int, const bool, const int, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, Vector &, const bool) ApplyKernelType
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.
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
void AssemblePA(const FiniteElementSpace &fes) override
Method defining partial assembly.
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...
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int))
arguments: DIM, d1d, q1d
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)
real_t GetPenaltyParameter() const
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
void(*)(const int, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const real_t, const Vector &, const Vector &_, const Vector &, Vector &, Vector &, const int, const int) ApplyKernelType
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:30
MFEM_REGISTER_KERNELS(ApplyPATKernels, ApplyKernelType,(int, int, int))
arguments: DIM, d1d, q1d
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int))
arguments: DIM, d1d, q1d
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.
DGTraceIntegrator(real_t a, real_t b)
VectorCoefficient * u
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
void(*)(const int, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, Vector &, const int, const int) ApplyKernelType
arguments: nf, B, Bt, pa_data, x, y, dofs1D, quad1D
static const IntegrationRule & GetRule(Geometry::Type geom, int order, const FaceElementTransformations &T)
const FaceGeometricFactors * geom
Not owned.
void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add) override
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.
static void AddSpecialization()
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:116
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 AddAbsMultTransposePA(const Vector &, Vector &) const 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 AddAbsMultPA(const Vector &, Vector &) const override
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:3130
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:208
Abstract class for all finite elements.
Definition fe_base.hpp:247
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:50
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:185
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
Definition fe_base.hpp:328
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition fe_base.hpp:341
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:202
int GetDerivType() const
Returns the FiniteElement::DerivType of the element describing the spatial derivative method implemen...
Definition fe_base.hpp:368
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:171
int GetDim() const
Returns the reference space dimension for the finite element.
Definition fe_base.hpp:324
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
Definition fe_base.hpp:354
int Space() const
Returns the type of FunctionSpace on the element.
Definition fe_base.hpp:351
@ DIV
Implements CalcDivShape methods.
Definition fe_base.hpp:309
@ CURL
Implements CalcCurlShape methods.
Definition fe_base.hpp:310
@ GRAD
Implements CalcDShape methods.
Definition fe_base.hpp:308
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:136
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:68
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
Definition fe_base.hpp:331
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:178
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:81
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:192
@ Pk
Polynomials of order k.
Definition fe_base.hpp:233
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Definition mesh.hpp:3076
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:57
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))
void AddAbsMultPA(const Vector &, Vector &) const override
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.
void AddAbsMultTransposePA(const Vector &, Vector &) const override
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:65
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 AddAbsMultTransposePA(const Vector &x, Vector &y) const override
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 AddAbsMultPA(const Vector &x, Vector &y) const override
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.
const DofToQuad * maps
Not owned.
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(const IntegrationRule *ir=nullptr)
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...
MFEM_REGISTER_KERNELS(ApplyPAKernels, ApplyKernelType,(int, int, int, int))
arguments: dim, vdim, d1d, q1d
void(*)(const int, const int, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, Vector &, const int, const int, const int) ApplyKernelType
arguments: ne, coeff_vdim, B, G, pa_data, x, y, d1d, q1d, vdim
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.
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
void AddAbsMultPA(const Vector &x, Vector &y) const 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.
MFEM_REGISTER_KERNELS(VectorMassAddMultPA, VectorMassAddMultPAType,(int, int, int))
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()=default
Construct an integrator with coefficient 1.0.
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)
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(*)(const int, const int, const Array< real_t > &, const Vector &, const Vector &, Vector &, const int, const int) VectorMassAddMultPAType
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:234
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
Definition vector.hpp:243
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:414
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:46
FaceType
Definition mesh.hpp:49