MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
bilininteg.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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
22namespace mfem
23{
24
25/// Abstract base class BilinearFormIntegrator
27{
28protected:
31
32public:
33 // TODO: add support for other assembly levels (in addition to PA) and their
34 // actions.
35
36 // TODO: for mixed meshes the quadrature rules to be used by methods like
37 // AssemblePA() can be given as a QuadratureSpace, e.g. using a new method:
38 // SetQuadratureSpace().
39
40 // TODO: the methods for the various assembly levels make sense even in the
41 // base class NonlinearFormIntegrator, except that not all assembly levels
42 // make sense for the action of the nonlinear operator (but they all make
43 // sense for its Jacobian).
44
45 /// Method defining partial assembly.
46 /** The result of the partial assembly is stored internally so that it can be
47 used later in the methods AddMultPA() and AddMultTransposePA(). */
48 virtual void AssemblePA(const FiniteElementSpace &fes);
49 /** Used with BilinearFormIntegrators that have different spaces. */
50 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
51 const FiniteElementSpace &test_fes);
52
53 /// Method defining partial assembly on NURBS patches.
54 /** The result of the partial assembly is stored internally so that it can be
55 used later in the method AddMultNURBSPA(). */
56 virtual void AssembleNURBSPA(const FiniteElementSpace &fes);
57
58 virtual void AssemblePABoundary(const FiniteElementSpace &fes);
59
60 virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
61
62 virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
63
64 /// Assemble diagonal and add it to Vector @a diag.
65 virtual void AssembleDiagonalPA(Vector &diag);
66
67 /// Assemble diagonal of $A D A^T$ ($A$ is this integrator) and add it to @a diag.
68 virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
69
70 /// Method for partially assembled action.
71 /** Perform the action of integrator on the input @a x and add the result to
72 the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
73 the element-wise discontinuous version of the FE space.
74
75 This method can be called only after the method AssemblePA() has been
76 called. */
77 virtual void AddMultPA(const Vector &x, Vector &y) const;
78
79 /// Method for partially assembled action on NURBS patches.
80 virtual void AddMultNURBSPA(const Vector&x, Vector&y) const;
81
82 /// Method for partially assembled transposed action.
83 /** Perform the transpose action of integrator on the input @a x and add the
84 result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
85 represent the element-wise discontinuous version of the FE space.
86
87 This method can be called only after the method AssemblePA() has been
88 called. */
89 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
90
91 /// Method defining element assembly.
92 /** The result of the element assembly is added to the @a emat Vector if
93 @a add is true. Otherwise, if @a add is false, we set @a emat. */
94 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
95 const bool add = true);
96 /** Used with BilinearFormIntegrators that have different spaces. */
97 // virtual void AssembleEA(const FiniteElementSpace &trial_fes,
98 // const FiniteElementSpace &test_fes,
99 // Vector &emat);
100
101 /// Method defining matrix-free assembly.
102 /** The result of fully matrix-free assembly is stored internally so that it
103 can be used later in the methods AddMultMF() and AddMultTransposeMF(). */
104 virtual void AssembleMF(const FiniteElementSpace &fes);
105
106 /** Perform the action of integrator on the input @a x and add the result to
107 the output @a y. Both @a x and @a y are E-vectors, i.e. they represent
108 the element-wise discontinuous version of the FE space.
109
110 This method can be called only after the method AssembleMF() has been
111 called. */
112 virtual void AddMultMF(const Vector &x, Vector &y) const;
113
114 /** Perform the transpose action of integrator on the input @a x and add the
115 result to the output @a y. Both @a x and @a y are E-vectors, i.e. they
116 represent the element-wise discontinuous version of the FE space.
117
118 This method can be called only after the method AssemblePA() has been
119 called. */
120 virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
121
122 /// Assemble diagonal and add it to Vector @a diag.
123 virtual void AssembleDiagonalMF(Vector &diag);
124
125 virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
126 Vector &ea_data_int,
127 Vector &ea_data_ext,
128 const bool add = true);
129
130 virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
131 Vector &ea_data_bdr,
132 const bool add = true);
133
134 /// Given a particular Finite Element computes the element matrix elmat.
135 virtual void AssembleElementMatrix(const FiniteElement &el,
137 DenseMatrix &elmat);
138
139 /** Compute the local matrix representation of a bilinear form
140 $a(u,v)$ defined on different trial (given by $u$) and test
141 (given by $v$) spaces. The rows in the local matrix correspond
142 to the test dofs and the columns -- to the trial dofs. */
143 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
144 const FiniteElement &test_fe,
146 DenseMatrix &elmat);
147
148 /** Given a particular NURBS patch, computes the patch matrix as a
149 SparseMatrix @a smat.
150 */
151 virtual void AssemblePatchMatrix(const int patch,
152 const FiniteElementSpace &fes,
153 SparseMatrix*& smat);
154
155 virtual void AssembleFaceMatrix(const FiniteElement &el1,
156 const FiniteElement &el2,
158 DenseMatrix &elmat);
159
160 /** Abstract method used for assembling TraceFaceIntegrators in a
161 MixedBilinearForm. */
162 virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
163 const FiniteElement &test_fe1,
164 const FiniteElement &test_fe2,
166 DenseMatrix &elmat);
167
168 /** Abstract method used for assembling TraceFaceIntegrators for
169 DPG weak formulations. */
170 virtual void AssembleTraceFaceMatrix(int elem,
171 const FiniteElement &trial_face_fe,
172 const FiniteElement &test_fe,
174 DenseMatrix &elmat);
175
176
177 /// @brief Perform the local action of the BilinearFormIntegrator.
178 /// Note that the default implementation in the base class is general but not
179 /// efficient.
180 virtual void AssembleElementVector(const FiniteElement &el,
182 const Vector &elfun, Vector &elvect);
183
184 /// @brief Perform the local action of the BilinearFormIntegrator resulting
185 /// from a face integral term.
186 /// Note that the default implementation in the base class is general but not
187 /// efficient.
188 virtual void AssembleFaceVector(const FiniteElement &el1,
189 const FiniteElement &el2,
191 const Vector &elfun, Vector &elvect);
192
193 virtual void AssembleElementGrad(const FiniteElement &el,
195 const Vector &elfun, DenseMatrix &elmat)
196 { AssembleElementMatrix(el, Tr, elmat); }
197
198 virtual void AssembleFaceGrad(const FiniteElement &el1,
199 const FiniteElement &el2,
201 const Vector &elfun, DenseMatrix &elmat)
202 { AssembleFaceMatrix(el1, el2, Tr, elmat); }
203
204 /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
205
206 The purpose of the method is to compute a local "flux" finite element
207 function given a local finite element solution. The "flux" function has
208 to be computed in terms of its coefficients (represented by the Vector
209 @a flux) which multiply the basis functions defined by the FiniteElement
210 @a fluxelem. Typically, the "flux" function will have more than one
211 component and consequently @a flux should be store the coefficients of
212 all components: first all coefficient for component 0, then all
213 coefficients for component 1, etc. What the "flux" function represents
214 depends on the specific integrator. For example, in the case of
215 DiffusionIntegrator, the flux is the gradient of the solution multiplied
216 by the diffusion coefficient.
217
218 @param[in] el FiniteElement of the solution.
219 @param[in] Trans The ElementTransformation describing the physical
220 position of the mesh element.
221 @param[in] u Solution coefficients representing the expansion of the
222 solution function in the basis of @a el.
223 @param[in] fluxelem FiniteElement of the "flux".
224 @param[out] flux "Flux" coefficients representing the expansion of the
225 "flux" function in the basis of @a fluxelem. The size
226 of @a flux as a Vector has to be set by this method,
227 e.g. using Vector::SetSize().
228 @param[in] with_coef If zero (the default value is 1) the implementation
229 of the method may choose not to scale the "flux"
230 function by any coefficients describing the
231 integrator.
232 @param[in] ir If passed (the default value is NULL), the implementation
233 of the method will ignore the integration rule provided
234 by the @a fluxelem parameter and, instead, compute the
235 discrete flux at the points specified by the integration
236 rule @a ir.
237 */
238 virtual void ComputeElementFlux(const FiniteElement &el,
240 Vector &u,
241 const FiniteElement &fluxelem,
242 Vector &flux, bool with_coef = true,
243 const IntegrationRule *ir = NULL) { }
244
245 /** @brief Virtual method required for Zienkiewicz-Zhu type error estimators.
246
247 The purpose of this method is to compute a local number that measures the
248 energy of a given "flux" function (see ComputeElementFlux() for a
249 description of the "flux" function). Typically, the energy of a "flux"
250 function should be equal to a_local(u,u), if the "flux" is defined from
251 a solution u; here a_local(.,.) denotes the element-local bilinear
252 form represented by the integrator.
253
254 @param[in] fluxelem FiniteElement of the "flux".
255 @param[in] Trans The ElementTransformation describing the physical
256 position of the mesh element.
257 @param[in] flux "Flux" coefficients representing the expansion of the
258 "flux" function in the basis of @a fluxelem.
259 @param[out] d_energy If not NULL, the given Vector should be set to
260 represent directional energy split that can be used
261 for anisotropic error estimation.
262 @returns The computed energy.
263 */
264 virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
266 Vector &flux, Vector *d_energy = NULL)
267 { return 0.0; }
268
269 /** @brief For bilinear forms on element faces, specifies if the normal
270 derivatives are needed on the faces or just the face restriction.
271
272 @details if RequiresFaceNormalDerivatives() == true, then
273 AddMultPAFaceNormalDerivatives(...) should be invoked in place
274 of AddMultPA(...) and L2NormalDerivativeFaceRestriction should
275 be used to compute the normal derivatives. This is used for some
276 DG integrators, for example DGDiffusionIntegrator.
277
278 @returns whether normal derivatives appear in the bilinear form.
279 */
280 virtual bool RequiresFaceNormalDerivatives() const { return false; }
281
282 /// Method for partially assembled action.
283 /** @brief For bilinear forms on element faces that depend on the normal
284 derivative on the faces, computes the action of integrator to the
285 face values @a x and reference-normal derivatives @a dxdn and adds
286 the result to @a y and @a dydn.
287
288 @details This method can be called only after the method AssemblePA() has
289 been called.
290
291 @param[in] x E-vector of face values (provided by
292 FaceRestriction::Mult)
293 @param[in] dxdn E-vector of face reference-normal derivatives
294 (provided by FaceRestriction::NormalDerivativeMult)
295 @param[in,out] y E-vector of face values to add action to.
296 @param[in,out] dydn E-vector of face reference-normal derivative values to
297 add action to.
298 */
299 virtual void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn,
300 Vector &y, Vector &dydn) const;
301
303};
304
305/** Wraps a given @a BilinearFormIntegrator and transposes the resulting element
306 matrices. See for example ex9, ex9p. */
308{
309private:
310 int own_bfi;
312
313 DenseMatrix bfi_elmat;
314
315public:
317 { bfi = bfi_; own_bfi = own_bfi_; }
318
319 virtual void SetIntRule(const IntegrationRule *ir);
320
321 virtual void AssembleElementMatrix(const FiniteElement &el,
323 DenseMatrix &elmat);
324
325 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
326 const FiniteElement &test_fe,
328 DenseMatrix &elmat);
329
331 virtual void AssembleFaceMatrix(const FiniteElement &el1,
332 const FiniteElement &el2,
334 DenseMatrix &elmat);
335
336 virtual void AssemblePA(const FiniteElementSpace& fes)
337 {
338 bfi->AssemblePA(fes);
339 }
340
341 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
342 const FiniteElementSpace &test_fes)
343 {
344 bfi->AssemblePA(test_fes, trial_fes); // Reverse test and trial
345 }
346
348 {
349 bfi->AssemblePAInteriorFaces(fes);
350 }
351
353 {
354 bfi->AssemblePABoundaryFaces(fes);
355 }
356
357 virtual void AddMultTransposePA(const Vector &x, Vector &y) const
358 {
359 bfi->AddMultPA(x, y);
360 }
361
362 virtual void AddMultPA(const Vector& x, Vector& y) const
363 {
364 bfi->AddMultTransposePA(x, y);
365 }
366
367 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
368 const bool add);
369
371 Vector &ea_data_int,
372 Vector &ea_data_ext,
373 const bool add);
374
376 Vector &ea_data_bdr,
377 const bool add);
378
379 virtual ~TransposeIntegrator() { if (own_bfi) { delete bfi; } }
380};
381
383{
384private:
385 int own_bfi;
387
388public:
389 LumpedIntegrator (BilinearFormIntegrator *bfi_, int own_bfi_ = 1)
390 { bfi = bfi_; own_bfi = own_bfi_; }
391
392 virtual void SetIntRule(const IntegrationRule *ir);
393
394 virtual void AssembleElementMatrix(const FiniteElement &el,
396 DenseMatrix &elmat);
397
398 virtual ~LumpedIntegrator() { if (own_bfi) { delete bfi; } }
399};
400
401/// Integrator that inverts the matrix assembled by another integrator.
403{
404private:
405 int own_integrator;
406 BilinearFormIntegrator *integrator;
407
408public:
409 InverseIntegrator(BilinearFormIntegrator *integ, int own_integ = 1)
410 { integrator = integ; own_integrator = own_integ; }
411
412 virtual void SetIntRule(const IntegrationRule *ir);
413
414 virtual void AssembleElementMatrix(const FiniteElement &el,
416 DenseMatrix &elmat);
417
418 virtual ~InverseIntegrator() { if (own_integrator) { delete integrator; } }
419};
420
421/// Integrator defining a sum of multiple Integrators.
423{
424private:
425 int own_integrators;
426 mutable DenseMatrix elem_mat;
428
429public:
430 SumIntegrator(int own_integs = 1) { own_integrators = own_integs; }
431
432 virtual void SetIntRule(const IntegrationRule *ir);
433
435 { integrators.Append(integ); }
436
437 virtual void AssembleElementMatrix(const FiniteElement &el,
439 DenseMatrix &elmat);
440 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
441 const FiniteElement &test_fe,
443 DenseMatrix &elmat);
444
446 virtual void AssembleFaceMatrix(const FiniteElement &el1,
447 const FiniteElement &el2,
449 DenseMatrix &elmat);
450
451 virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
452 const FiniteElement &test_fe1,
453 const FiniteElement &test_fe2,
455 DenseMatrix &elmat);
456
458 virtual void AssemblePA(const FiniteElementSpace& fes);
459
460 virtual void AssembleDiagonalPA(Vector &diag);
461
462 virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes);
463
464 virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes);
465
466 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
467
468 virtual void AddMultPA(const Vector& x, Vector& y) const;
469
470 virtual void AssembleMF(const FiniteElementSpace &fes);
471
472 virtual void AddMultMF(const Vector &x, Vector &y) const;
473
474 virtual void AddMultTransposeMF(const Vector &x, Vector &y) const;
475
476 virtual void AssembleDiagonalMF(Vector &diag);
477
478 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
479 const bool add);
480
481 virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes,
482 Vector &ea_data_int,
483 Vector &ea_data_ext,
484 const bool add);
485
486 virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes,
487 Vector &ea_data_bdr,
488 const bool add);
489
490 virtual ~SumIntegrator();
491};
492
493/** An abstract class for integrating the product of two scalar basis functions
494 with an optional scalar coefficient. */
496{
497public:
498
499 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
500 const FiniteElement &test_fe,
502 DenseMatrix &elmat);
503
504 /// Support for use in BilinearForm. Can be used only when appropriate.
505 virtual void AssembleElementMatrix(const FiniteElement &fe,
507 DenseMatrix &elmat)
508 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
509
510protected:
511 /// This parameter can be set by derived methods to enable single shape
512 /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
513 /// result if given the same FiniteElement. The default is false.
515
518
519 inline virtual bool VerifyFiniteElementTypes(
520 const FiniteElement & trial_fe,
521 const FiniteElement & test_fe) const
522 {
523 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
525 }
526
527 inline virtual const char * FiniteElementTypeFailureMessage() const
528 {
529 return "MixedScalarIntegrator: "
530 "Trial and test spaces must both be scalar fields.";
531 }
532
533 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
534 const FiniteElement & test_fe,
536 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
537
538
539 inline virtual void CalcTestShape(const FiniteElement & test_fe,
541 Vector & shape)
542 { test_fe.CalcPhysShape(Trans, shape); }
543
544 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
546 Vector & shape)
547 { trial_fe.CalcPhysShape(Trans, shape); }
548
550
551private:
552
553#ifndef MFEM_THREAD_SAFE
554 Vector test_shape;
555 Vector trial_shape;
556#endif
557
558};
559
560/** An abstract class for integrating the inner product of two vector basis
561 functions with an optional scalar, vector, or matrix coefficient. */
563{
564public:
565
566 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
567 const FiniteElement &test_fe,
569 DenseMatrix &elmat);
570
571 /// Support for use in BilinearForm. Can be used only when appropriate.
572 virtual void AssembleElementMatrix(const FiniteElement &fe,
574 DenseMatrix &elmat)
575 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
576
577protected:
578 /// This parameter can be set by derived methods to enable single shape
579 /// evaluation in case CalcTestShape() and CalcTrialShape() return the same
580 /// result if given the same FiniteElement. The default is false.
582
584 : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(NULL) {}
586 : same_calc_shape(false), Q(&q), VQ(NULL), DQ(NULL), MQ(NULL) {}
588 : same_calc_shape(false), Q(NULL), VQ(diag?NULL:&vq), DQ(diag?&vq:NULL),
589 MQ(NULL) {}
591 : same_calc_shape(false), Q(NULL), VQ(NULL), DQ(NULL), MQ(&mq) {}
592
593 inline virtual bool VerifyFiniteElementTypes(
594 const FiniteElement & trial_fe,
595 const FiniteElement & test_fe) const
596 {
597 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
599 }
600
601 inline virtual const char * FiniteElementTypeFailureMessage() const
602 {
603 return "MixedVectorIntegrator: "
604 "Trial and test spaces must both be vector fields";
605 }
606
607 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
608 const FiniteElement & test_fe,
610 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
611
612
613 inline virtual int GetTestVDim(const FiniteElement & test_fe)
614 { return std::max(space_dim, test_fe.GetRangeDim()); }
615
616 inline virtual void CalcTestShape(const FiniteElement & test_fe,
618 DenseMatrix & shape)
619 { test_fe.CalcVShape(Trans, shape); }
620
621 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
622 { return std::max(space_dim, trial_fe.GetRangeDim()); }
623
624 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
626 DenseMatrix & shape)
627 { trial_fe.CalcVShape(Trans, shape); }
628
634
635private:
636
637#ifndef MFEM_THREAD_SAFE
638 Vector V;
639 Vector D;
640 DenseMatrix M;
641 DenseMatrix test_shape;
642 DenseMatrix trial_shape;
643 DenseMatrix shape_tmp;
644#endif
645
646};
647
648/** An abstract class for integrating the product of a scalar basis function and
649 the inner product of a vector basis function with a vector coefficient. In
650 2D the inner product can be replaced with a cross product. */
652{
653public:
654
655 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
656 const FiniteElement &test_fe,
658 DenseMatrix &elmat);
659
660 /// Support for use in BilinearForm. Can be used only when appropriate.
661 /** Appropriate use cases are classes derived from
662 MixedScalarVectorIntegrator where the trial and test spaces can be the
663 same. Examples of such classes are: MixedVectorDivergenceIntegrator,
664 MixedScalarWeakDivergenceIntegrator, etc. */
665 virtual void AssembleElementMatrix(const FiniteElement &fe,
667 DenseMatrix &elmat)
668 { AssembleElementMatrix2(fe, fe, Trans, elmat); }
669
670protected:
671
672 MixedScalarVectorIntegrator(VectorCoefficient &vq, bool transpose_ = false,
673 bool cross_2d_ = false)
674 : VQ(&vq), transpose(transpose_), cross_2d(cross_2d_) {}
675
676 inline virtual bool VerifyFiniteElementTypes(
677 const FiniteElement & trial_fe,
678 const FiniteElement & test_fe) const
679 {
680 return ((transpose &&
683 (!transpose &&
686 );
687 }
688
689 inline virtual const char * FiniteElementTypeFailureMessage() const
690 {
691 if ( transpose )
692 {
693 return "MixedScalarVectorIntegrator: "
694 "Trial space must be a vector field "
695 "and the test space must be a scalar field";
696 }
697 else
698 {
699 return "MixedScalarVectorIntegrator: "
700 "Trial space must be a scalar field "
701 "and the test space must be a vector field";
702 }
703 }
704
705 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
706 const FiniteElement & test_fe,
708 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW(); }
709
710
711 inline virtual int GetVDim(const FiniteElement & vector_fe)
712 { return std::max(space_dim, vector_fe.GetRangeDim()); }
713
714 inline virtual void CalcVShape(const FiniteElement & vector_fe,
716 DenseMatrix & shape_)
717 { vector_fe.CalcVShape(Trans, shape_); }
718
719 inline virtual void CalcShape(const FiniteElement & scalar_fe,
721 Vector & shape_)
722 { scalar_fe.CalcPhysShape(Trans, shape_); }
723
727 bool cross_2d; // In 2D use a cross product rather than a dot product
728
729private:
730
731#ifndef MFEM_THREAD_SAFE
732 Vector V;
733 DenseMatrix vshape;
734 Vector shape;
735 Vector vshape_tmp;
736#endif
737
738};
739
740/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$ in either 1D, 2D,
741 or 3D and where $Q$ is an optional scalar coefficient, $u$ and $v$ are each in $H^1$
742 or $L_2$. */
750
751/** Class for integrating the bilinear form $a(u,v) := (\vec{V} u, v)$ in either 2D, or
752 3D and where $\vec{V}$ is a vector coefficient, $u$ is in $H^1$ or $L_2$ and $v$ is in $H(curl$
753 or $H(div)$. */
760
761/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ in 1D where Q
762 is an optional scalar coefficient, $u$ is in $H^1$, and $v$ is in $L_2$. */
764{
765public:
769
770protected:
771 inline virtual bool VerifyFiniteElementTypes(
772 const FiniteElement & trial_fe,
773 const FiniteElement & test_fe) const
774 {
775 return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
778 }
779
780 inline virtual const char * FiniteElementTypeFailureMessage() const
781 {
782 return "MixedScalarDerivativeIntegrator: "
783 "Trial and test spaces must both be scalar fields in 1D "
784 "and the trial space must implement CalcDShape.";
785 }
786
787 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
789 Vector & shape)
790 {
791 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
792 trial_fe.CalcPhysDShape(Trans, dshape);
793 }
794};
795
796/** Class for integrating the bilinear form $a(u,v) := -(Q u, \nabla v)$ in 1D where $Q$
797 is an optional scalar coefficient, $u$ is in $L_2$, and $v$ is in $H^1$. */
799{
800public:
804
805protected:
806 inline virtual bool VerifyFiniteElementTypes(
807 const FiniteElement & trial_fe,
808 const FiniteElement & test_fe) const
809 {
810 return (trial_fe.GetDim() == 1 && test_fe.GetDim() == 1 &&
813 }
814
815 inline virtual const char * FiniteElementTypeFailureMessage() const
816 {
817 return "MixedScalarWeakDerivativeIntegrator: "
818 "Trial and test spaces must both be scalar fields in 1D "
819 "and the test space must implement CalcDShape with "
820 "map type \"VALUE\".";
821 }
822
823 inline virtual void CalcTestShape(const FiniteElement & test_fe,
825 Vector & shape)
826 {
827 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
828 test_fe.CalcPhysDShape(Trans, dshape);
829 shape *= -1.0;
830 }
831};
832
833/** Class for integrating the bilinear form $a(u,v) := (Q \nabla \cdot u, v)$ in either 2D
834 or 3D where $Q$ is an optional scalar coefficient, $u$ is in $H(div)$, and $v$ is a
835 scalar field. */
837{
838public:
842
843protected:
844 inline virtual bool VerifyFiniteElementTypes(
845 const FiniteElement & trial_fe,
846 const FiniteElement & test_fe) const
847 {
848 return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
850 }
851
852 inline virtual const char * FiniteElementTypeFailureMessage() const
853 {
854 return "MixedScalarDivergenceIntegrator: "
855 "Trial must be $H(div)$ and the test space must be a "
856 "scalar field";
857 }
858
859 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
860 const FiniteElement & test_fe,
862 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
863
864 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
866 Vector & shape)
867 { trial_fe.CalcPhysDivShape(Trans, shape); }
868};
869
870/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \nabla \cdot u, v)$ in either 2D
871 or 3D where $\vec{V}$ is a vector coefficient, $u$ is in $H(div)$, and $v$ is in $H(div)$. */
873{
874public:
877
878protected:
879 inline virtual bool VerifyFiniteElementTypes(
880 const FiniteElement & trial_fe,
881 const FiniteElement & test_fe) const
882 {
883 return (trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
885 }
886
887 inline virtual const char * FiniteElementTypeFailureMessage() const
888 {
889 return "MixedVectorDivergenceIntegrator: "
890 "Trial must be H(Div) and the test space must be a "
891 "vector field";
892 }
893
894 // Subtract one due to the divergence and add one for the coefficient
895 // which is assumed to be at least linear.
896 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
897 const FiniteElement & test_fe,
899 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
900
901 inline virtual void CalcShape(const FiniteElement & scalar_fe,
903 Vector & shape)
904 { scalar_fe.CalcPhysDivShape(Trans, shape); }
905};
906
907/** Class for integrating the bilinear form $a(u,v) := -(Q u, \nabla \cdot v)$ in either 2D
908 or 3D where $Q$ is an optional scalar coefficient, $u$ is in $L_2$ or $H^1$, and $v$ is
909 in $H(div)$. */
911{
912public:
916
917protected:
918 inline virtual bool VerifyFiniteElementTypes(
919 const FiniteElement & trial_fe,
920 const FiniteElement & test_fe) const
921 {
922 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
924 }
925
926 inline virtual const char * FiniteElementTypeFailureMessage() const
927 {
928 return "MixedScalarWeakGradientIntegrator: "
929 "Trial space must be a scalar field "
930 "and the test space must be H(Div)";
931 }
932
933 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
934 const FiniteElement & test_fe,
936 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1; }
937
938 virtual void CalcTestShape(const FiniteElement & test_fe,
940 Vector & shape)
941 {
942 test_fe.CalcPhysDivShape(Trans, shape);
943 shape *= -1.0;
944 }
945};
946
947/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ in 2D where
948 $Q$ is an optional scalar coefficient, $u$ is in $H(curl$, and $v$ is in $L_2$ or
949 $H^1$. */
951{
952public:
956
957protected:
958 inline virtual bool VerifyFiniteElementTypes(
959 const FiniteElement & trial_fe,
960 const FiniteElement & test_fe) const
961 {
962 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
965 }
966
967 inline virtual const char * FiniteElementTypeFailureMessage() const
968 {
969 return "MixedScalarCurlIntegrator: "
970 "Trial must be H(Curl) and the test space must be a "
971 "scalar field";
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 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
981 Vector & shape)
982 {
983 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
984 trial_fe.CalcPhysCurlShape(Trans, dshape);
985 }
986
988 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
989 const FiniteElementSpace &test_fes);
990
991 virtual void AddMultPA(const Vector&, Vector&) const;
992 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
993
994 // PA extension
996 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
997 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
999};
1000
1001/** Class for integrating the bilinear form $a(u,v) := (Q u, \mathrm{curl}(v))$ in 2D where
1002 $Q$ is an optional scalar coefficient, $u$ is in $L_2$ or $H^1$, and $v$ is in
1003 $H(curl$. Partial assembly (PA) is supported but could be further optimized
1004 by using more efficient threading and shared memory.
1005*/
1007{
1008public:
1012
1013protected:
1014 inline virtual bool VerifyFiniteElementTypes(
1015 const FiniteElement & trial_fe,
1016 const FiniteElement & test_fe) const
1017 {
1018 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1021 }
1022
1023 inline virtual const char * FiniteElementTypeFailureMessage() const
1024 {
1025 return "MixedScalarWeakCurlIntegrator: "
1026 "Trial space must be a scalar field "
1027 "and the test space must be H(Curl)";
1028 }
1029
1030 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1031 ElementTransformation &Trans,
1032 Vector & shape)
1033 {
1034 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1035 test_fe.CalcPhysCurlShape(Trans, dshape);
1036 }
1037};
1038
1039/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$ in either 2D or
1040 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
1041 diagonal matrix) $u$ and $v$ are each in $H(curl$ or $H(div)$. */
1053
1054/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, v)$ in 3D and where
1055 $\vec{V}$ is a vector coefficient $u$ and $v$ are each in $H(curl$ or $H(div)$. */
1062
1063/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \cdot u, v)$ in 2D or 3D and
1064 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$ or
1065 $L_2$. */
1067{
1068public:
1071
1072 inline virtual bool VerifyFiniteElementTypes(
1073 const FiniteElement & trial_fe,
1074 const FiniteElement & test_fe) const
1075 {
1076 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1078 }
1079
1080 inline virtual const char * FiniteElementTypeFailureMessage() const
1081 {
1082 return "MixedDotProductIntegrator: "
1083 "Trial space must be a vector field "
1084 "and the test space must be a scalar field";
1085 }
1086};
1087
1088/** Class for integrating the bilinear form $a(u,v) := (-\vec{V} \cdot u, \nabla \cdot v)$ in 2D or
1089 3D and where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1090 $H(div)$. */
1092{
1093public:
1096
1097 inline virtual bool VerifyFiniteElementTypes(
1098 const FiniteElement & trial_fe,
1099 const FiniteElement & test_fe) const
1100 {
1101 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1104 }
1105
1106 inline virtual const char * FiniteElementTypeFailureMessage() const
1107 {
1108 return "MixedWeakGradDotIntegrator: "
1109 "Trial space must be a vector field "
1110 "and the test space must be a vector field with a divergence";
1111 }
1112
1113 // Subtract one due to the gradient and add one for the coefficient
1114 // which is assumed to be at least linear.
1115 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1116 const FiniteElement & test_fe,
1117 ElementTransformation &Trans)
1118 { return trial_fe.GetOrder() + test_fe.GetOrder() + Trans.OrderW() - 1 + 1; }
1119
1120 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1121 ElementTransformation &Trans,
1122 Vector & shape)
1123 { scalar_fe.CalcPhysDivShape(Trans, shape); shape *= -1.0; }
1124};
1125
1126/** Class for integrating the bilinear form $a(u,v) := (v \vec{V} \times u, \nabla v)$ in 3D and
1127 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$. */
1129{
1130public:
1133
1134 inline virtual bool VerifyFiniteElementTypes(
1135 const FiniteElement & trial_fe,
1136 const FiniteElement & test_fe) const
1137 {
1138 return (trial_fe.GetRangeDim() == 3 &&
1142 }
1143
1144 inline virtual const char * FiniteElementTypeFailureMessage() const
1145 {
1146 return "MixedWeakDivCrossIntegrator: "
1147 "Trial space must be a vector field in 3D "
1148 "and the test space must be a scalar field with a gradient";
1149 }
1150
1151 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1152 { return space_dim; }
1153
1154 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1155 ElementTransformation &Trans,
1156 DenseMatrix & shape)
1157 { test_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1158};
1159
1160/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$ in 3D
1161 or in 2D and where $Q$ is a scalar or matrix coefficient $u$ and $v$ are both in
1162 $H^1$. */
1164{
1165public:
1173
1174 inline virtual bool VerifyFiniteElementTypes(
1175 const FiniteElement & trial_fe,
1176 const FiniteElement & test_fe) const
1177 {
1178 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1182 }
1183
1184 inline virtual const char * FiniteElementTypeFailureMessage() const
1185 {
1186 return "MixedGradGradIntegrator: "
1187 "Trial and test spaces must both be scalar fields "
1188 "with a gradient operator.";
1189 }
1190
1191 inline virtual int GetIntegrationOrder(const FiniteElement & trial_fe,
1192 const FiniteElement & test_fe,
1193 ElementTransformation &Trans)
1194 {
1195 // Same as DiffusionIntegrator
1196 return test_fe.Space() == FunctionSpace::Pk ?
1197 trial_fe.GetOrder() + test_fe.GetOrder() - 2 :
1198 trial_fe.GetOrder() + test_fe.GetOrder() + test_fe.GetDim() - 1;
1199 }
1200
1201 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1202 { return space_dim; }
1203
1204 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1205 ElementTransformation &Trans,
1206 DenseMatrix & shape)
1207 { trial_fe.CalcPhysDShape(Trans, shape); }
1208
1209 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1210 { return space_dim; }
1211
1212 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1213 ElementTransformation &Trans,
1214 DenseMatrix & shape)
1215 { test_fe.CalcPhysDShape(Trans, shape); }
1216};
1217
1218/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla u, \nabla v)$ in 3D
1219 or in 2D and where $\vec{V}$ is a vector coefficient $u$ and $v$ are both in $H^1$. */
1221{
1222public:
1225
1226 inline virtual bool VerifyFiniteElementTypes(
1227 const FiniteElement & trial_fe,
1228 const FiniteElement & test_fe) const
1229 {
1230 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1234 }
1235
1236 inline virtual const char * FiniteElementTypeFailureMessage() const
1237 {
1238 return "MixedCrossGradGradIntegrator: "
1239 "Trial and test spaces must both be scalar fields "
1240 "with a gradient operator.";
1241 }
1242
1243 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1244 { return space_dim; }
1245
1246 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1247 ElementTransformation &Trans,
1248 DenseMatrix & shape)
1249 { trial_fe.CalcPhysDShape(Trans, shape); }
1250
1251 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1252 { return space_dim; }
1253
1254 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1255 ElementTransformation &Trans,
1256 DenseMatrix & shape)
1257 { test_fe.CalcPhysDShape(Trans, shape); }
1258};
1259
1260/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), \mathrm{curl}(v))$ in 3D
1261 and where $Q$ is a scalar or matrix coefficient $u$ and $v$ are both in
1262 $H(curl$. */
1264{
1265public:
1273
1274 inline virtual bool VerifyFiniteElementTypes(
1275 const FiniteElement & trial_fe,
1276 const FiniteElement & test_fe) const
1277 {
1278 return (trial_fe.GetCurlDim() == 3 && test_fe.GetCurlDim() == 3 &&
1283 }
1284
1285 inline virtual const char * FiniteElementTypeFailureMessage() const
1286 {
1287 return "MixedCurlCurlIntegrator"
1288 "Trial and test spaces must both be vector fields in 3D "
1289 "with a curl.";
1290 }
1291
1292 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1293 { return trial_fe.GetCurlDim(); }
1294
1295 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1296 ElementTransformation &Trans,
1297 DenseMatrix & shape)
1298 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1299
1300 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1301 { return test_fe.GetCurlDim(); }
1302
1303 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1304 ElementTransformation &Trans,
1305 DenseMatrix & shape)
1306 { test_fe.CalcPhysCurlShape(Trans, shape); }
1307};
1308
1309/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), \mathrm{curl}(v))$ in 3D
1310 and where $\vec{V}$ is a vector coefficient $u$ and $v$ are both in $H(curl$. */
1312{
1313public:
1316
1317 inline virtual bool VerifyFiniteElementTypes(
1318 const FiniteElement & trial_fe,
1319 const FiniteElement & test_fe) const
1320 {
1321 return (trial_fe.GetCurlDim() == 3 && trial_fe.GetRangeDim() == 3 &&
1322 test_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1327 }
1328
1329 inline virtual const char * FiniteElementTypeFailureMessage() const
1330 {
1331 return "MixedCrossCurlCurlIntegrator: "
1332 "Trial and test spaces must both be vector fields in 3D "
1333 "with a curl.";
1334 }
1335
1336 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1337 { return trial_fe.GetCurlDim(); }
1338
1339 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1340 ElementTransformation &Trans,
1341 DenseMatrix & shape)
1342 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1343
1344 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1345 { return test_fe.GetCurlDim(); }
1346
1347 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1348 ElementTransformation &Trans,
1349 DenseMatrix & shape)
1350 { test_fe.CalcPhysCurlShape(Trans, shape); }
1351};
1352
1353/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), \nabla \cdot v)$ in 3D
1354 and where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H^1$. */
1356{
1357public:
1360
1361 inline virtual bool VerifyFiniteElementTypes(
1362 const FiniteElement & trial_fe,
1363 const FiniteElement & test_fe) const
1364 {
1365 return (trial_fe.GetCurlDim() == 3 &&
1370 }
1371
1372 inline virtual const char * FiniteElementTypeFailureMessage() const
1373 {
1374 return "MixedCrossCurlGradIntegrator"
1375 "Trial space must be a vector field in 3D with a curl"
1376 "and the test space must be a scalar field with a gradient";
1377 }
1378
1379 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1380 { return trial_fe.GetCurlDim(); }
1381
1382 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1383 ElementTransformation &Trans,
1384 DenseMatrix & shape)
1385 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1386
1387 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1388 { return space_dim; }
1389
1390 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1391 ElementTransformation &Trans,
1392 DenseMatrix & shape)
1393 { test_fe.CalcPhysDShape(Trans, shape); }
1394};
1395
1396/** Class for integrating the bilinear form $a(u,v) := (v \times \nabla \cdot u, \mathrm{curl}(v))$ in 3D
1397 and where $v$ is a scalar coefficient $u$ is in $H^1$ and $v$ is in $H(curl$. */
1399{
1400public:
1403
1404 inline virtual bool VerifyFiniteElementTypes(
1405 const FiniteElement & trial_fe,
1406 const FiniteElement & test_fe) const
1407 {
1408 return (test_fe.GetCurlDim() == 3 &&
1413 }
1414
1415 inline virtual const char * FiniteElementTypeFailureMessage() const
1416 {
1417 return "MixedCrossGradCurlIntegrator"
1418 "Trial space must be a scalar field in 3D with a gradient"
1419 "and the test space must be a vector field with a curl";
1420 }
1421
1422 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1423 { return space_dim; }
1424
1425 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1426 ElementTransformation &Trans,
1427 DenseMatrix & shape)
1428 { trial_fe.CalcPhysDShape(Trans, shape); }
1429
1430 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1431 { return test_fe.GetCurlDim(); }
1432
1433 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1434 ElementTransformation &Trans,
1435 DenseMatrix & shape)
1436 { test_fe.CalcPhysCurlShape(Trans, shape); }
1437};
1438
1439/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, \mathrm{curl}(v))$ in 3D and
1440 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1441 $H(curl$. */
1443{
1444public:
1447
1448 inline virtual bool VerifyFiniteElementTypes(
1449 const FiniteElement & trial_fe,
1450 const FiniteElement & test_fe) const
1451 {
1452 return (trial_fe.GetRangeDim() == 3 && test_fe.GetCurlDim() == 3 &&
1456 }
1457
1458 inline virtual const char * FiniteElementTypeFailureMessage() const
1459 {
1460 return "MixedWeakCurlCrossIntegrator: "
1461 "Trial space must be a vector field in 3D "
1462 "and the test space must be a vector field with a curl";
1463 }
1464
1465 inline virtual int GetTestVDim(const FiniteElement & test_fe)
1466 { return test_fe.GetCurlDim(); }
1467
1468 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1469 ElementTransformation &Trans,
1470 DenseMatrix & shape)
1471 { test_fe.CalcPhysCurlShape(Trans, shape); }
1472};
1473
1474/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, \mathrm{curl}(v))$ in 2D and
1475 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in
1476 $H(curl$. */
1478{
1479public:
1482
1483 inline virtual bool VerifyFiniteElementTypes(
1484 const FiniteElement & trial_fe,
1485 const FiniteElement & test_fe) const
1486 {
1487 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1491 }
1492
1493 inline virtual const char * FiniteElementTypeFailureMessage() const
1494 {
1495 return "MixedScalarWeakCurlCrossIntegrator: "
1496 "Trial space must be a vector field in 2D "
1497 "and the test space must be a vector field with a curl";
1498 }
1499
1500 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1501 ElementTransformation &Trans,
1502 Vector & shape)
1503 {
1504 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1505 scalar_fe.CalcPhysCurlShape(Trans, dshape);
1506 }
1507};
1508
1509/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla \cdot u, v)$ in 3D or
1510 in 2D and where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ and $v$ is in $H(curl$ or
1511 $H(div)$. */
1513{
1514public:
1517
1518 inline virtual bool VerifyFiniteElementTypes(
1519 const FiniteElement & trial_fe,
1520 const FiniteElement & test_fe) const
1521 {
1522 return (test_fe.GetRangeDim() == 3 &&
1526 }
1527
1528 inline virtual const char * FiniteElementTypeFailureMessage() const
1529 {
1530 return "MixedCrossGradIntegrator: "
1531 "Trial space must be a scalar field with a gradient operator"
1532 " and the test space must be a vector field both in 3D.";
1533 }
1534
1535 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1536 { return space_dim; }
1537
1538 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1539 ElementTransformation &Trans,
1540 DenseMatrix & shape)
1541 { trial_fe.CalcPhysDShape(Trans, shape); }
1542
1543 inline virtual void CalcTestShape(const FiniteElement & test_fe,
1544 ElementTransformation &Trans,
1545 DenseMatrix & shape)
1546 { test_fe.CalcVShape(Trans, shape); }
1547};
1548
1549/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), v)$ in 3D and
1550 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H(curl$ or
1551 $H(div)$. */
1553{
1554public:
1557
1558 inline virtual bool VerifyFiniteElementTypes(
1559 const FiniteElement & trial_fe,
1560 const FiniteElement & test_fe) const
1561 {
1562 return (trial_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1566 }
1567
1568 inline virtual const char * FiniteElementTypeFailureMessage() const
1569 {
1570 return "MixedCrossCurlIntegrator: "
1571 "Trial space must be a vector field in 3D with a curl "
1572 "and the test space must be a vector field";
1573 }
1574
1575 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1576 { return trial_fe.GetCurlDim(); }
1577
1578 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1579 ElementTransformation &Trans,
1580 DenseMatrix & shape)
1581 { trial_fe.CalcPhysCurlShape(Trans, shape); }
1582};
1583
1584/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \mathrm{curl}(u), v)$ in 2D and
1585 where $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ and $v$ is in $H(curl$ or
1586 $H(div)$. */
1588{
1589public:
1592
1593 inline virtual bool VerifyFiniteElementTypes(
1594 const FiniteElement & trial_fe,
1595 const FiniteElement & test_fe) const
1596 {
1597 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1601 }
1602
1603 inline virtual const char * FiniteElementTypeFailureMessage() const
1604 {
1605 return "MixedCrossCurlIntegrator: "
1606 "Trial space must be a vector field in 2D with a curl "
1607 "and the test space must be a vector field";
1608 }
1609
1610 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1611 ElementTransformation &Trans,
1612 Vector & shape)
1613 {
1614 DenseMatrix dshape(shape.GetData(), shape.Size(), 1);
1615 scalar_fe.CalcPhysCurlShape(Trans, dshape); shape *= -1.0;
1616 }
1617};
1618
1619/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times \nabla \cdot u, v)$ in 2D and
1620 where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ and $v$ is in $H^1$ or $L_2$. */
1622{
1623public:
1626
1627 inline virtual bool VerifyFiniteElementTypes(
1628 const FiniteElement & trial_fe,
1629 const FiniteElement & test_fe) const
1630 {
1631 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1635 }
1636
1637 inline virtual const char * FiniteElementTypeFailureMessage() const
1638 {
1639 return "MixedScalarCrossGradIntegrator: "
1640 "Trial space must be a scalar field in 2D with a gradient "
1641 "and the test space must be a scalar field";
1642 }
1643
1644 inline int GetVDim(const FiniteElement & vector_fe)
1645 { return space_dim; }
1646
1647 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1648 ElementTransformation &Trans,
1649 DenseMatrix & shape)
1650 { vector_fe.CalcPhysDShape(Trans, shape); }
1651};
1652
1653/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u, v)$ in 2D and where
1654 $\vec{V}$ is a vector coefficient $u$ is in $H(curl$ or $H(div)$ and $v$ is in $H^1$ or $L_2$. */
1656{
1657public:
1660
1661 inline virtual bool VerifyFiniteElementTypes(
1662 const FiniteElement & trial_fe,
1663 const FiniteElement & test_fe) const
1664 {
1665 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1668 }
1669
1670 inline virtual const char * FiniteElementTypeFailureMessage() const
1671 {
1672 return "MixedScalarCrossProductIntegrator: "
1673 "Trial space must be a vector field in 2D "
1674 "and the test space must be a scalar field";
1675 }
1676};
1677
1678/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \times u \hat{z}, v)$ in 2D and
1679 where $\vec{V}$ is a vector coefficient $u$ is in $H^1$ or $L_2$ and $v$ is in $H(curl$ or $H(div)$.
1680
1681 \todo Documentation what $\hat{z}$ is (also missing in https://mfem.org/bilininteg/).
1682 */
1684{
1685public:
1688
1689 inline virtual bool VerifyFiniteElementTypes(
1690 const FiniteElement & trial_fe,
1691 const FiniteElement & test_fe) const
1692 {
1693 return (trial_fe.GetDim() == 2 && test_fe.GetDim() == 2 &&
1696 }
1697
1698 inline virtual const char * FiniteElementTypeFailureMessage() const
1699 {
1700 return "MixedScalarWeakCrossProductIntegrator: "
1701 "Trial space must be a scalar field in 2D "
1702 "and the test space must be a vector field";
1703 }
1704
1705 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1706 ElementTransformation &Trans,
1707 Vector & shape)
1708 { scalar_fe.CalcPhysShape(Trans, shape); shape *= -1.0; }
1709};
1710
1711/** Class for integrating the bilinear form $a(u,v) := (\vec{V} \cdot \nabla u, v)$ in 2D or
1712 3D and where $\vec{V}$ is a vector coefficient, $u$ is in $H^1$ and $v$ is in $H^1$ or $L_2$. */
1714{
1715public:
1718
1719 inline virtual bool VerifyFiniteElementTypes(
1720 const FiniteElement & trial_fe,
1721 const FiniteElement & test_fe) const
1722 {
1723 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1726 }
1727
1728 inline virtual const char * FiniteElementTypeFailureMessage() const
1729 {
1730 return "MixedDirectionalDerivativeIntegrator: "
1731 "Trial space must be a scalar field with a gradient "
1732 "and the test space must be a scalar field";
1733 }
1734
1735 inline virtual int GetVDim(const FiniteElement & vector_fe)
1736 { return space_dim; }
1737
1738 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1739 ElementTransformation &Trans,
1740 DenseMatrix & shape)
1741 { vector_fe.CalcPhysDShape(Trans, shape); }
1742};
1743
1744/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} \cdot \nabla \cdot u, \nabla \cdot v)$ in 2D
1745 or 3D and where $\hat{V}$ is a vector coefficient, $u$ is in $H^1$ and $v$ is in $H(div)$. */
1747{
1748public:
1751
1752 inline virtual bool VerifyFiniteElementTypes(
1753 const FiniteElement & trial_fe,
1754 const FiniteElement & test_fe) const
1755 {
1756 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1760 }
1761
1762 inline virtual const char * FiniteElementTypeFailureMessage() const
1763 {
1764 return "MixedGradDivIntegrator: "
1765 "Trial space must be a scalar field with a gradient"
1766 "and the test space must be a vector field with a divergence";
1767 }
1768
1769 inline virtual int GetVDim(const FiniteElement & vector_fe)
1770 { return space_dim; }
1771
1772 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1773 ElementTransformation &Trans,
1774 DenseMatrix & shape)
1775 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1776
1777 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1778 ElementTransformation &Trans,
1779 Vector & shape)
1780 { scalar_fe.CalcPhysDivShape(Trans, shape); }
1781};
1782
1783/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} \nabla \cdot u, \nabla \cdot v)$ in 2D
1784 or 3D and where $\hat{V}$ is a vector coefficient, $u$ is in $H(div)$ and $v$ is in $H^1$. */
1786{
1787public:
1790
1791 inline virtual bool VerifyFiniteElementTypes(
1792 const FiniteElement & trial_fe,
1793 const FiniteElement & test_fe) const
1794 {
1795 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
1796 trial_fe.GetDerivType() == mfem::FiniteElement::DIV &&
1799 );
1800 }
1801
1802 inline virtual const char * FiniteElementTypeFailureMessage() const
1803 {
1804 return "MixedDivGradIntegrator: "
1805 "Trial space must be a vector field with a divergence"
1806 "and the test space must be a scalar field with a gradient";
1807 }
1808
1809 inline virtual int GetVDim(const FiniteElement & vector_fe)
1810 { return space_dim; }
1811
1812 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1813 ElementTransformation &Trans,
1814 DenseMatrix & shape)
1815 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1816
1817 inline virtual void CalcShape(const FiniteElement & scalar_fe,
1818 ElementTransformation &Trans,
1819 Vector & shape)
1820 { scalar_fe.CalcPhysDivShape(Trans, shape); }
1821};
1822
1823/** Class for integrating the bilinear form $a(u,v) := (-\hat{V} u, \nabla \cdot v)$ in 2D or 3D
1824 and where $\hat{V}$ is a vector coefficient, $u$ is in $H^1$ or $L_2$ and $v$ is in $H^1$. */
1826{
1827public:
1830
1831 inline virtual bool VerifyFiniteElementTypes(
1832 const FiniteElement & trial_fe,
1833 const FiniteElement & test_fe) const
1834 {
1835 return (trial_fe.GetRangeType() == mfem::FiniteElement::SCALAR &&
1838 }
1839
1840 inline virtual const char * FiniteElementTypeFailureMessage() const
1841 {
1842 return "MixedScalarWeakDivergenceIntegrator: "
1843 "Trial space must be a scalar field "
1844 "and the test space must be a scalar field with a gradient";
1845 }
1846
1847 inline int GetVDim(const FiniteElement & vector_fe)
1848 { return space_dim; }
1849
1850 inline virtual void CalcVShape(const FiniteElement & vector_fe,
1851 ElementTransformation &Trans,
1852 DenseMatrix & shape)
1853 { vector_fe.CalcPhysDShape(Trans, shape); shape *= -1.0; }
1854};
1855
1856/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ in either 2D
1857 or 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
1858 diagonal matrix) $u$ is in $H^1$ and $v$ is in $H(curl$ or $H(div)$. Partial assembly
1859 (PA) is supported but could be further optimized by using more efficient
1860 threading and shared memory.
1861*/
1863{
1864public:
1872
1873protected:
1874 inline virtual bool VerifyFiniteElementTypes(
1875 const FiniteElement & trial_fe,
1876 const FiniteElement & test_fe) const
1877 {
1878 return (trial_fe.GetDerivType() == mfem::FiniteElement::GRAD &&
1880 }
1881
1882 inline virtual const char * FiniteElementTypeFailureMessage() const
1883 {
1884 return "MixedVectorGradientIntegrator: "
1885 "Trial spaces must be $H^1$ and the test space must be a "
1886 "vector field in 2D or 3D";
1887 }
1888
1889 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1890 { return space_dim; }
1891
1892 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1893 ElementTransformation &Trans,
1894 DenseMatrix & shape)
1895 {
1896 trial_fe.CalcPhysDShape(Trans, shape);
1897 }
1898
1900 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1901 const FiniteElementSpace &test_fes);
1902
1903 virtual void AddMultPA(const Vector&, Vector&) const;
1904 virtual void AddMultTransposePA(const Vector&, Vector&) const;
1905
1906private:
1907 DenseMatrix Jinv;
1908
1909 // PA extension
1910 Vector pa_data;
1911 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1912 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1913 const GeometricFactors *geom; ///< Not owned
1914 int dim, ne, dofs1D, quad1D;
1915};
1916
1917/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ in 3D and
1918 where $Q$ is an optional coefficient (of type scalar, matrix, or diagonal
1919 matrix) $u$ is in $H(curl$ and $v$ is in $H(div)$ or $H(curl$. */
1921{
1922public:
1930
1931protected:
1932 inline virtual bool VerifyFiniteElementTypes(
1933 const FiniteElement & trial_fe,
1934 const FiniteElement & test_fe) const
1935 {
1936 return (trial_fe.GetCurlDim() == 3 && test_fe.GetRangeDim() == 3 &&
1939 }
1940
1941 inline virtual const char * FiniteElementTypeFailureMessage() const
1942 {
1943 return "MixedVectorCurlIntegrator: "
1944 "Trial space must be H(Curl) and the test space must be a "
1945 "vector field in 3D";
1946 }
1947
1948 inline virtual int GetTrialVDim(const FiniteElement & trial_fe)
1949 { return trial_fe.GetCurlDim(); }
1950
1951 inline virtual void CalcTrialShape(const FiniteElement & trial_fe,
1952 ElementTransformation &Trans,
1953 DenseMatrix & shape)
1954 {
1955 trial_fe.CalcPhysCurlShape(Trans, shape);
1956 }
1957
1959 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
1960 const FiniteElementSpace &test_fes);
1961
1962 virtual void AddMultPA(const Vector&, Vector&) const;
1963 virtual void AddMultTransposePA(const Vector&, Vector&) const;
1964
1965private:
1966 // PA extension
1967 Vector pa_data;
1968 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
1969 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
1970 const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
1971 const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
1972 const GeometricFactors *geom; ///< Not owned
1973 int dim, ne, dofs1D, dofs1Dtest,quad1D, testType, trialType, coeffDim;
1974};
1975
1976/** Class for integrating the bilinear form $a(u,v) := (Q u, \mathrm{curl}(v))$ in 3D and
1977 where $Q$ is an optional coefficient (of type scalar, matrix, or diagonal
1978 matrix) $u$ is in $H(div)$ or $H(curl$ and $v$ is in $H(curl$. */
1980{
1981public:
1989
1990protected:
1991 inline virtual bool VerifyFiniteElementTypes(
1992 const FiniteElement & trial_fe,
1993 const FiniteElement & test_fe) const
1994 {
1995 return (trial_fe.GetRangeDim() == 3 && test_fe.GetCurlDim() == 3 &&
1998 }
1999
2000 inline virtual const char * FiniteElementTypeFailureMessage() const
2001 {
2002 return "MixedVectorWeakCurlIntegrator: "
2003 "Trial space must be vector field in 3D and the "
2004 "test space must be H(Curl)";
2005 }
2006
2007 inline virtual int GetTestVDim(const FiniteElement & test_fe)
2008 { return test_fe.GetCurlDim(); }
2009
2010 inline virtual void CalcTestShape(const FiniteElement & test_fe,
2011 ElementTransformation &Trans,
2012 DenseMatrix & shape)
2013 {
2014 test_fe.CalcPhysCurlShape(Trans, shape);
2015 }
2016
2018 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2019 const FiniteElementSpace &test_fes);
2020
2021 virtual void AddMultPA(const Vector&, Vector&) const;
2022 virtual void AddMultTransposePA(const Vector&, Vector&) const;
2023
2024private:
2025 // PA extension
2026 Vector pa_data;
2027 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2028 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2029 const GeometricFactors *geom; ///< Not owned
2030 int dim, ne, dofs1D, quad1D, testType, trialType, coeffDim;
2031};
2032
2033/** Class for integrating the bilinear form $a(u,v) := - (Q u, \nabla v)$ in either
2034 2D or 3D and where $Q$ is an optional coefficient (of type scalar, matrix, or
2035 diagonal matrix) $u$ is in $H(div)$ or $H(curl$ and $v$ is in $H^1$. */
2037{
2038public:
2046
2047protected:
2048 inline virtual bool VerifyFiniteElementTypes(
2049 const FiniteElement & trial_fe,
2050 const FiniteElement & test_fe) const
2051 {
2052 return (trial_fe.GetRangeType() == mfem::FiniteElement::VECTOR &&
2054 }
2055
2056 inline virtual const char * FiniteElementTypeFailureMessage() const
2057 {
2058 return "MixedVectorWeakDivergenceIntegrator: "
2059 "Trial space must be vector field and the "
2060 "test space must be H1";
2061 }
2062
2063 inline virtual int GetTestVDim(const FiniteElement & test_fe)
2064 { return space_dim; }
2065
2066 inline virtual void CalcTestShape(const FiniteElement & test_fe,
2067 ElementTransformation &Trans,
2068 DenseMatrix & shape)
2069 {
2070 test_fe.CalcPhysDShape(Trans, shape);
2071 shape *= -1.0;
2072 }
2073};
2074
2075/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, v)$ where $Q$ is a
2076 scalar coefficient, $u$ is in ($H^1$), and $v$ is a vector with components
2077 $v_i$ in ($H^1$) or ($L^2$).
2078
2079 See also MixedVectorGradientIntegrator when $v$ is in $H(curl$. */
2081{
2082protected:
2084
2085private:
2086 Vector shape;
2087 DenseMatrix dshape;
2088 DenseMatrix gshape;
2089 DenseMatrix Jadj;
2090 DenseMatrix elmat_comp;
2091 // PA extension
2092 Vector pa_data;
2093 const DofToQuad *trial_maps, *test_maps; ///< Not owned
2094 const GeometricFactors *geom; ///< Not owned
2095 int dim, ne, nq;
2096 int trial_dofs1D, test_dofs1D, quad1D;
2097
2098public:
2100 Q{NULL}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2101 { }
2103 Q{q_}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2104 { }
2106 Q{&q}, trial_maps{NULL}, test_maps{NULL}, geom{NULL}
2107 { }
2108
2109 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2110 const FiniteElement &test_fe,
2111 ElementTransformation &Trans,
2112 DenseMatrix &elmat);
2113
2115 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2116 const FiniteElementSpace &test_fes);
2117
2118 virtual void AddMultPA(const Vector &x, Vector &y) const;
2119 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2120
2121 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2122 const FiniteElement &test_fe,
2123 ElementTransformation &Trans);
2124};
2125
2126/** Class for integrating the bilinear form $a(u,v) := (Q \nabla u, \nabla v)$ where $Q$
2127 can be a scalar or a matrix coefficient. */
2129{
2130protected:
2134
2135private:
2136 Vector vec, vecdxt, pointflux, shape;
2137#ifndef MFEM_THREAD_SAFE
2138 DenseMatrix dshape, dshapedxt, invdfdx, M, dshapedxt_m;
2139 DenseMatrix te_dshape, te_dshapedxt;
2140 Vector D;
2141#endif
2142
2143 // PA extension
2144 const FiniteElementSpace *fespace;
2145 const DofToQuad *maps; ///< Not owned
2146 const GeometricFactors *geom; ///< Not owned
2147 int dim, ne, dofs1D, quad1D;
2148 Vector pa_data;
2149 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2150
2151 // Data for NURBS patch PA
2152
2153 // Type for a variable-row-length 2D array, used for data related to 1D
2154 // quadrature rules in each dimension.
2155 typedef std::vector<std::vector<int>> IntArrayVar2D;
2156
2157 int numPatches = 0;
2158 static constexpr int numTypes = 2; // Number of rule types
2159
2160 // In the case integrationMode == Mode::PATCHWISE_REDUCED, an approximate
2161 // integration rule with sparse nonzero weights is computed by NNLSSolver,
2162 // for each 1D basis function on each patch, in each spatial dimension. For a
2163 // fixed 1D basis function b_i with DOF index i, in the tensor product basis
2164 // of patch p, the prescribed exact 1D rule is of the form
2165 // \sum_k a_{i,j,k} w_k for some integration points indexed by k, with
2166 // weights w_k and coefficients a_{i,j,k} depending on Q(x), an element
2167 // transformation, b_i, and b_j, for all 1D basis functions b_j whose support
2168 // overlaps that of b_i. Define the constraint matrix G = [g_{j,k}] with
2169 // g_{j,k} = a_{i,j,k} and the vector of exact weights w = [w_k]. A reduced
2170 // rule should have different weights w_r, many of them zero, and should
2171 // approximately satisfy Gw_r = Gw. A sparse approximate solution to this
2172 // underdetermined system is computed by NNLSSolver, and its data is stored
2173 // in the following members.
2174
2175 // For each patch p, spatial dimension d (total dim), and rule type t (total
2176 // numTypes), an std::vector<Vector> of reduced quadrature weights for all
2177 // basis functions is stored in reducedWeights[t + numTypes * (d + dim * p)],
2178 // reshaped as rw(t,d,p). Note that nd may vary with respect to the patch and
2179 // spatial dimension. Array reducedIDs is treated similarly.
2180 std::vector<std::vector<Vector>> reducedWeights;
2181 std::vector<IntArrayVar2D> reducedIDs;
2182 std::vector<Array<int>> pQ1D, pD1D;
2183 std::vector<std::vector<Array2D<real_t>>> pB, pG;
2184 std::vector<IntArrayVar2D> pminD, pmaxD, pminQ, pmaxQ, pminDD, pmaxDD;
2185
2186 std::vector<Array<const IntegrationRule*>> pir1d;
2187
2188 void SetupPatchPA(const int patch, Mesh *mesh, bool unitWeights=false);
2189
2190 void SetupPatchBasisData(Mesh *mesh, unsigned int patch);
2191
2192 /** Called by AssemblePatchMatrix for sparse matrix assembly on a NURBS patch
2193 with full 1D quadrature rules. */
2194 void AssemblePatchMatrix_fullQuadrature(const int patch,
2195 const FiniteElementSpace &fes,
2196 SparseMatrix*& smat);
2197
2198 /** Called by AssemblePatchMatrix for sparse matrix assembly on a NURBS patch
2199 with reduced 1D quadrature rules. */
2200 void AssemblePatchMatrix_reducedQuadrature(const int patch,
2201 const FiniteElementSpace &fes,
2202 SparseMatrix*& smat);
2203
2204public:
2205 /// Construct a diffusion integrator with coefficient Q = 1
2208 Q(NULL), VQ(NULL), MQ(NULL), maps(NULL), geom(NULL) { }
2209
2210 /// Construct a diffusion integrator with a scalar coefficient q
2213 Q(&q), VQ(NULL), MQ(NULL), maps(NULL), geom(NULL) { }
2214
2215 /// Construct a diffusion integrator with a vector coefficient q
2217 const IntegrationRule *ir = nullptr)
2219 Q(NULL), VQ(&q), MQ(NULL), maps(NULL), geom(NULL) { }
2220
2221 /// Construct a diffusion integrator with a matrix coefficient q
2223 const IntegrationRule *ir = nullptr)
2225 Q(NULL), VQ(NULL), MQ(&q), maps(NULL), geom(NULL) { }
2226
2227 /** Given a particular Finite Element computes the element stiffness matrix
2228 elmat. */
2229 virtual void AssembleElementMatrix(const FiniteElement &el,
2230 ElementTransformation &Trans,
2231 DenseMatrix &elmat);
2232 /** Given a trial and test Finite Element computes the element stiffness
2233 matrix elmat. */
2234 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2235 const FiniteElement &test_fe,
2236 ElementTransformation &Trans,
2237 DenseMatrix &elmat);
2238
2239 virtual void AssemblePatchMatrix(const int patch,
2240 const FiniteElementSpace &fes,
2241 SparseMatrix*& smat);
2242
2243 virtual void AssembleNURBSPA(const FiniteElementSpace &fes);
2244
2245 void AssemblePatchPA(const int patch, const FiniteElementSpace &fes);
2246
2247 /// Perform the local action of the BilinearFormIntegrator
2248 virtual void AssembleElementVector(const FiniteElement &el,
2250 const Vector &elfun, Vector &elvect);
2251
2252 virtual void ComputeElementFlux(const FiniteElement &el,
2253 ElementTransformation &Trans,
2254 Vector &u, const FiniteElement &fluxelem,
2255 Vector &flux, bool with_coef = true,
2256 const IntegrationRule *ir = NULL);
2257
2258 virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
2259 ElementTransformation &Trans,
2260 Vector &flux, Vector *d_energy = NULL);
2261
2262 virtual void AssembleMF(const FiniteElementSpace &fes);
2263
2265 virtual void AssemblePA(const FiniteElementSpace &fes);
2266
2267 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2268 const bool add);
2269
2270 virtual void AssembleDiagonalPA(Vector &diag);
2271
2272 virtual void AssembleDiagonalMF(Vector &diag);
2273
2274 virtual void AddMultMF(const Vector&, Vector&) const;
2275
2276 virtual void AddMultPA(const Vector&, Vector&) const;
2277
2278 virtual void AddMultTransposePA(const Vector&, Vector&) const;
2279
2280 virtual void AddMultNURBSPA(const Vector&, Vector&) const;
2281
2282 void AddMultPatchPA(const int patch, const Vector &x, Vector &y) const;
2283
2284 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2285 const FiniteElement &test_fe);
2286
2287 bool SupportsCeed() const { return DeviceCanUseCeed(); }
2288
2289 Coefficient *GetCoefficient() const { return Q; }
2290};
2291
2292/** Class for local mass matrix assembling $a(u,v) := (Q u, v)$ */
2294{
2295 friend class DGMassInverse;
2296protected:
2297#ifndef MFEM_THREAD_SAFE
2299#endif
2301 // PA extension
2304 const DofToQuad *maps; ///< Not owned
2305 const GeometricFactors *geom; ///< Not owned
2306 const FaceGeometricFactors *face_geom; ///< Not owned
2308
2309public:
2311 : BilinearFormIntegrator(ir), Q(NULL), maps(NULL), geom(NULL) { }
2312
2313 /// Construct a mass integrator with coefficient q
2315 : BilinearFormIntegrator(ir), Q(&q), maps(NULL), geom(NULL) { }
2316
2317 /** Given a particular Finite Element computes the element mass matrix
2318 elmat. */
2319 virtual void AssembleElementMatrix(const FiniteElement &el,
2320 ElementTransformation &Trans,
2321 DenseMatrix &elmat);
2322 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2323 const FiniteElement &test_fe,
2324 ElementTransformation &Trans,
2325 DenseMatrix &elmat);
2326
2327 virtual void AssembleMF(const FiniteElementSpace &fes);
2328
2330 virtual void AssemblePA(const FiniteElementSpace &fes);
2331
2332 virtual void AssemblePABoundary(const FiniteElementSpace &fes);
2333
2334 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2335 const bool add);
2336
2337 virtual void AssembleDiagonalPA(Vector &diag);
2338
2339 virtual void AssembleDiagonalMF(Vector &diag);
2340
2341 virtual void AddMultMF(const Vector&, Vector&) const;
2342
2343 virtual void AddMultPA(const Vector&, Vector&) const;
2344
2345 virtual void AddMultTransposePA(const Vector&, Vector&) const;
2346
2347 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2348 const FiniteElement &test_fe,
2349 ElementTransformation &Trans);
2350
2351 bool SupportsCeed() const { return DeviceCanUseCeed(); }
2352
2353 const Coefficient *GetCoefficient() const { return Q; }
2354};
2355
2356/** Mass integrator $(u, v)$ restricted to the boundary of a domain */
2358{
2359public:
2361
2363 virtual void AssembleFaceMatrix(const FiniteElement &el1,
2364 const FiniteElement &el2,
2366 DenseMatrix &elmat);
2367};
2368
2369/// $\alpha (Q \cdot \nabla u, v)$
2371{
2372protected:
2375 // PA extension
2377 const DofToQuad *maps; ///< Not owned
2378 const GeometricFactors *geom; ///< Not owned
2380
2381private:
2382#ifndef MFEM_THREAD_SAFE
2383 DenseMatrix dshape, adjJ, Q_ir;
2384 Vector shape, vec2, BdFidxT;
2385#endif
2386
2387public:
2390
2391 virtual void AssembleElementMatrix(const FiniteElement &,
2393 DenseMatrix &);
2394
2395 virtual void AssembleMF(const FiniteElementSpace &fes);
2396
2398 virtual void AssemblePA(const FiniteElementSpace&);
2399
2400 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
2401 const bool add);
2402
2403 virtual void AssembleDiagonalPA(Vector &diag);
2404
2405 virtual void AssembleDiagonalMF(Vector &diag);
2406
2407 virtual void AddMultMF(const Vector&, Vector&) const;
2408
2409 virtual void AddMultPA(const Vector&, Vector&) const;
2410
2411 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2412
2413 static const IntegrationRule &GetRule(const FiniteElement &el,
2414 ElementTransformation &Trans);
2415
2416 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2417 const FiniteElement &test_fe,
2418 ElementTransformation &Trans);
2419
2420 bool SupportsCeed() const { return DeviceCanUseCeed(); }
2421};
2422
2423// Alias for @ConvectionIntegrator.
2425
2426/// $-\alpha (u, q \cdot \nabla v)$, negative transpose of ConvectionIntegrator
2433
2434/// $\alpha (Q \cdot \nabla u, v)$ using the "group" FE discretization
2436{
2437protected:
2440
2441private:
2442 DenseMatrix dshape, adjJ, Q_nodal, grad;
2443 Vector shape;
2444
2445public:
2448 virtual void AssembleElementMatrix(const FiniteElement &,
2450 DenseMatrix &);
2451};
2452
2453/** Class for integrating the bilinear form $a(u,v) := (Q u, v)$,
2454 where $u=(u_1,\dots,u_n)$ and $v=(v_1,\dots,v_n)$, $u_i$ and $v_i$ are defined
2455 by scalar FE through standard transformation. */
2457{
2458private:
2459 int vdim;
2460 Vector shape, te_shape, vec;
2461 DenseMatrix partelmat;
2462 DenseMatrix mcoeff;
2463 int Q_order;
2464
2465protected:
2469 // PA extension
2471 const DofToQuad *maps; ///< Not owned
2472 const GeometricFactors *geom; ///< Not owned
2474
2475public:
2476 /// Construct an integrator with coefficient 1.0
2478 : vdim(-1), Q_order(0), Q(NULL), VQ(NULL), MQ(NULL) { }
2479 /** Construct an integrator with scalar coefficient q. If possible, save
2480 memory by using a scalar integrator since the resulting matrix is block
2481 diagonal with the same diagonal block repeated. */
2483 : vdim(-1), Q_order(qo), Q(&q), VQ(NULL), MQ(NULL) { }
2485 : BilinearFormIntegrator(ir), vdim(-1), Q_order(0), Q(&q), VQ(NULL),
2486 MQ(NULL) { }
2487 /// Construct an integrator with diagonal coefficient q
2489 : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(&q), MQ(NULL) { }
2490 /// Construct an integrator with matrix coefficient q
2492 : vdim(q.GetVDim()), Q_order(qo), Q(NULL), VQ(NULL), MQ(&q) { }
2493
2494 int GetVDim() const { return vdim; }
2495 void SetVDim(int vdim_) { vdim = vdim_; }
2496
2497 virtual void AssembleElementMatrix(const FiniteElement &el,
2498 ElementTransformation &Trans,
2499 DenseMatrix &elmat);
2500 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2501 const FiniteElement &test_fe,
2502 ElementTransformation &Trans,
2503 DenseMatrix &elmat);
2505 virtual void AssemblePA(const FiniteElementSpace &fes);
2506 virtual void AssembleMF(const FiniteElementSpace &fes);
2507 virtual void AssembleDiagonalPA(Vector &diag);
2508 virtual void AssembleDiagonalMF(Vector &diag);
2509 virtual void AddMultPA(const Vector &x, Vector &y) const;
2510 virtual void AddMultMF(const Vector &x, Vector &y) const;
2511 bool SupportsCeed() const { return DeviceCanUseCeed(); }
2512};
2513
2514
2515/** Class for integrating $(\nabla \cdot u, p)$ where $u$ is a vector field given by
2516 VectorFiniteElement through Piola transformation (for Raviart-Thomas elements); $p$ is
2517 scalar function given by FiniteElement through standard transformation.
2518 Here, $u$ is the trial function and $p$ is the test function.
2519
2520 Note: if the test space does not have map type INTEGRAL, then the element
2521 matrix returned by AssembleElementMatrix2 will not depend on the
2522 ElementTransformation Trans. */
2524{
2525protected:
2527
2529 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2530 const FiniteElementSpace &test_fes);
2531
2532 virtual void AddMultPA(const Vector&, Vector&) const;
2533 virtual void AddMultTransposePA(const Vector&, Vector&) const;
2534
2535private:
2536#ifndef MFEM_THREAD_SAFE
2537 Vector divshape, shape;
2538#endif
2539
2540 // PA extension
2541 Vector pa_data;
2542 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2543 const DofToQuad *L2mapsO; ///< Not owned. DOF-to-quad map, open.
2544 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2545 int dim, ne, dofs1D, L2dofs1D, quad1D;
2546
2547public:
2550 virtual void AssembleElementMatrix(const FiniteElement &el,
2551 ElementTransformation &Trans,
2552 DenseMatrix &elmat) { }
2553 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2554 const FiniteElement &test_fe,
2555 ElementTransformation &Trans,
2556 DenseMatrix &elmat);
2557
2558 virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag);
2559};
2560
2561
2562/** Integrator for $(-Q u, \nabla v)$ for Nedelec ($u$) and $H^1$ ($v$) elements.
2563 This is equivalent to a weak divergence of the $H(curl$ basis functions. */
2565{
2566protected:
2568
2569private:
2570#ifndef MFEM_THREAD_SAFE
2571 DenseMatrix dshape;
2572 DenseMatrix dshapedxt;
2573 DenseMatrix vshape;
2574 DenseMatrix invdfdx;
2575#endif
2576
2577public:
2580 virtual void AssembleElementMatrix(const FiniteElement &el,
2581 ElementTransformation &Trans,
2582 DenseMatrix &elmat) { }
2583 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2584 const FiniteElement &test_fe,
2585 ElementTransformation &Trans,
2586 DenseMatrix &elmat);
2587};
2588
2589/** Integrator for $(\mathrm{curl}(u), v)$ for Nedelec and Raviart-Thomas elements. If the trial and
2590 test spaces are switched, assembles the form $(u, \mathrm{curl}(v))$. */
2592{
2593protected:
2595
2596private:
2597#ifndef MFEM_THREAD_SAFE
2598 DenseMatrix curlshapeTrial;
2599 DenseMatrix vshapeTest;
2600 DenseMatrix curlshapeTrial_dFT;
2601#endif
2602
2603public:
2606 virtual void AssembleElementMatrix(const FiniteElement &el,
2607 ElementTransformation &Trans,
2608 DenseMatrix &elmat) { }
2609 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2610 const FiniteElement &test_fe,
2611 ElementTransformation &Trans,
2612 DenseMatrix &elmat);
2613};
2614
2615/// Class for integrating $ (Q \partial_i(u), v) $ where $u$ and $v$ are scalars
2617{
2618protected:
2620
2621private:
2622 int xi;
2623 DenseMatrix dshape, dshapedxt, invdfdx;
2624 Vector shape, dshapedxi;
2625
2626public:
2627 DerivativeIntegrator(Coefficient &q, int i) : Q(&q), xi(i) { }
2628 virtual void AssembleElementMatrix(const FiniteElement &el,
2629 ElementTransformation &Trans,
2630 DenseMatrix &elmat)
2631 { AssembleElementMatrix2(el,el,Trans,elmat); }
2632 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2633 const FiniteElement &test_fe,
2634 ElementTransformation &Trans,
2635 DenseMatrix &elmat);
2636};
2637
2638/// Integrator for $(\mathrm{curl}(u), \mathrm{curl}(v))$ for Nedelec elements
2640{
2641private:
2642 Vector vec, pointflux;
2643#ifndef MFEM_THREAD_SAFE
2644 Vector D;
2645 DenseMatrix curlshape, curlshape_dFt, M;
2646 DenseMatrix te_curlshape, te_curlshape_dFt;
2647 DenseMatrix vshape, projcurl;
2648#endif
2649
2650protected:
2654
2655 // PA extension
2657 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2658 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2659 const GeometricFactors *geom; ///< Not owned
2661 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2662
2663public:
2664 CurlCurlIntegrator() { Q = NULL; DQ = NULL; MQ = NULL; }
2665 /// Construct a bilinear form integrator for Nedelec elements
2667 BilinearFormIntegrator(ir), Q(&q), DQ(NULL), MQ(NULL) { }
2669 const IntegrationRule *ir = NULL) :
2670 BilinearFormIntegrator(ir), Q(NULL), DQ(&dq), MQ(NULL) { }
2672 BilinearFormIntegrator(ir), Q(NULL), DQ(NULL), MQ(&mq) { }
2673
2674 /* Given a particular Finite Element, compute the
2675 element curl-curl matrix elmat */
2676 virtual void AssembleElementMatrix(const FiniteElement &el,
2677 ElementTransformation &Trans,
2678 DenseMatrix &elmat);
2679
2680 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2681 const FiniteElement &test_fe,
2682 ElementTransformation &Trans,
2683 DenseMatrix &elmat);
2684
2685 virtual void ComputeElementFlux(const FiniteElement &el,
2686 ElementTransformation &Trans,
2687 Vector &u, const FiniteElement &fluxelem,
2688 Vector &flux, bool with_coef,
2689 const IntegrationRule *ir = NULL);
2690
2691 virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
2692 ElementTransformation &Trans,
2693 Vector &flux, Vector *d_energy = NULL);
2694
2696 virtual void AssemblePA(const FiniteElementSpace &fes);
2697 virtual void AddMultPA(const Vector &x, Vector &y) const;
2698 virtual void AssembleDiagonalPA(Vector& diag);
2699
2700 const Coefficient *GetCoefficient() const { return Q; }
2701};
2702
2703/** Integrator for $(\mathrm{curl}(u), \mathrm{curl}(v))$ for FE spaces defined by 'dim' copies of a
2704 scalar FE space. */
2706{
2707private:
2708#ifndef MFEM_THREAD_SAFE
2709 DenseMatrix dshape_hat, dshape, curlshape, Jadj, grad_hat, grad;
2710#endif
2711
2712protected:
2714
2715public:
2717
2719
2720 /// Assemble an element matrix
2721 virtual void AssembleElementMatrix(const FiniteElement &el,
2722 ElementTransformation &Trans,
2723 DenseMatrix &elmat);
2724 /// Compute element energy: $ \frac{1}{2} (\mathrm{curl}(u), \mathrm{curl}(u))_E$
2725 virtual real_t GetElementEnergy(const FiniteElement &el,
2727 const Vector &elfun);
2728};
2729
2730/** Class for integrating the bilinear form $a(u,v) := (Q \mathrm{curl}(u), v)$ where $Q$ is
2731 an optional scalar coefficient, and $v$ is a vector with components $v_i$ in
2732 the $L_2$ or $H^1$ space. This integrator handles 3 cases:
2733 1. u ∈ $H(curl$ in 3D, $v$ is a 3D vector with components $v_i$ in $L^2$ or $H^1$
2734 2. u ∈ $H(curl$ in 2D, $v$ is a scalar field in $L^2$ or $H^1$
2735 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
2736 2D vector field with components $v_i$ in $L^2$ or $H^1$ space.
2737
2738 Note: Case 2 can also be handled by MixedScalarCurlIntegrator */
2740{
2741protected:
2743
2744private:
2745 Vector shape;
2746 DenseMatrix dshape;
2747 DenseMatrix curlshape;
2748 DenseMatrix elmat_comp;
2749public:
2753
2754 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2755 const FiniteElement &test_fe,
2756 ElementTransformation &Trans,
2757 DenseMatrix &elmat);
2758};
2759
2760/** Integrator for $(Q u, v)$, where $Q$ is an optional coefficient (of type scalar,
2761 vector (diagonal matrix), or matrix), trial function $u$ is in $H(curl$ or
2762 $H(div)$, and test function $v$ is in $H(curl$, $H(div)$, or $v=(v_1,\dots,v_n)$, where
2763 $v_i$ are in $H^1$. */
2765{
2766private:
2768 { Q = q; DQ = dq; MQ = mq; }
2769
2770#ifndef MFEM_THREAD_SAFE
2771 Vector shape;
2772 Vector D;
2773 DenseMatrix K;
2774 DenseMatrix partelmat;
2775 DenseMatrix test_vshape;
2776 DenseMatrix trial_vshape;
2777#endif
2778
2779protected:
2783
2784 // PA extension
2786 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2787 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2788 const DofToQuad *mapsOtest; ///< Not owned. DOF-to-quad map, open.
2789 const DofToQuad *mapsCtest; ///< Not owned. DOF-to-quad map, closed.
2790 const GeometricFactors *geom; ///< Not owned
2792 bool symmetric = true; ///< False if using a nonsymmetric matrix coefficient
2793
2794public:
2795 VectorFEMassIntegrator() { Init(NULL, NULL, NULL); }
2796 VectorFEMassIntegrator(Coefficient *q_) { Init(q_, NULL, NULL); }
2797 VectorFEMassIntegrator(Coefficient &q) { Init(&q, NULL, NULL); }
2802
2803 virtual void AssembleElementMatrix(const FiniteElement &el,
2804 ElementTransformation &Trans,
2805 DenseMatrix &elmat);
2806 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2807 const FiniteElement &test_fe,
2808 ElementTransformation &Trans,
2809 DenseMatrix &elmat);
2810
2811 virtual void AssemblePA(const FiniteElementSpace &fes);
2812 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2813 const FiniteElementSpace &test_fes);
2814 virtual void AddMultPA(const Vector &x, Vector &y) const;
2815 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2816 virtual void AssembleDiagonalPA(Vector& diag);
2817
2818 const Coefficient *GetCoefficient() const { return Q; }
2819};
2820
2821/** Integrator for $(Q \nabla \cdot u, v)$ where $u=(u_1,\cdots,u_n)$ and all $u_i$ are in the same
2822 scalar FE space; $v$ is also in a (different) scalar FE space. */
2824{
2825protected:
2827
2828private:
2829 Vector shape;
2830 Vector divshape;
2831 DenseMatrix dshape;
2832 DenseMatrix gshape;
2833 DenseMatrix Jadj;
2834 // PA extension
2835 Vector pa_data;
2836 const DofToQuad *trial_maps, *test_maps; ///< Not owned
2837 const GeometricFactors *geom; ///< Not owned
2838 int dim, ne, nq;
2839 int trial_dofs1D, test_dofs1D, quad1D;
2840
2841public:
2843 Q(NULL), trial_maps(NULL), test_maps(NULL), geom(NULL)
2844 { }
2846 Q(q_), trial_maps(NULL), test_maps(NULL), geom(NULL)
2847 { }
2849 Q(&q), trial_maps(NULL), test_maps(NULL), geom(NULL)
2850 { }
2851
2852 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2853 const FiniteElement &test_fe,
2854 ElementTransformation &Trans,
2855 DenseMatrix &elmat);
2856
2858 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
2859 const FiniteElementSpace &test_fes);
2860
2861 virtual void AddMultPA(const Vector &x, Vector &y) const;
2862 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
2863
2864 static const IntegrationRule &GetRule(const FiniteElement &trial_fe,
2865 const FiniteElement &test_fe,
2866 ElementTransformation &Trans);
2867};
2868
2869/// $(Q \nabla \cdot u, \nabla \cdot v)$ for Raviart-Thomas elements
2871{
2872protected:
2874
2876 virtual void AssemblePA(const FiniteElementSpace &fes);
2877 virtual void AddMultPA(const Vector &x, Vector &y) const;
2878 virtual void AssembleDiagonalPA(Vector& diag);
2879
2880private:
2881#ifndef MFEM_THREAD_SAFE
2882 Vector divshape, te_divshape;
2883#endif
2884
2885 // PA extension
2886 Vector pa_data;
2887 const DofToQuad *mapsO; ///< Not owned. DOF-to-quad map, open.
2888 const DofToQuad *mapsC; ///< Not owned. DOF-to-quad map, closed.
2889 const GeometricFactors *geom; ///< Not owned
2890 int dim, ne, dofs1D, quad1D;
2891
2892public:
2893 DivDivIntegrator() { Q = NULL; }
2895 BilinearFormIntegrator(ir), Q(&q) { }
2896
2897 virtual void AssembleElementMatrix(const FiniteElement &el,
2898 ElementTransformation &Trans,
2899 DenseMatrix &elmat);
2900
2901 virtual void AssembleElementMatrix2(const FiniteElement &trial_fe,
2902 const FiniteElement &test_fe,
2903 ElementTransformation &Trans,
2904 DenseMatrix &elmat);
2905
2906 const Coefficient *GetCoefficient() const { return Q; }
2907};
2908
2909/** Integrator for
2910 $$
2911 (Q \nabla u, \nabla v) = \sum_i (Q \nabla u_i, \nabla v_i) e_i e_i^{\mathrm{T}}
2912 $$
2913 for vector FE spaces, where $e_i$ is the unit vector in the $i$-th direction.
2914 The resulting local element matrix is square, of size <tt> vdim*dof </tt>,
2915 where \c vdim is the vector dimension space and \c dof is the local degrees
2916 of freedom. The integrator is not aware of the true vector dimension and
2917 must use \c VectorCoefficient, \c MatrixCoefficient, or a caller-specified
2918 value to determine the vector space. For a scalar coefficient, the caller
2919 may manually specify the vector dimension or the vector dimension is assumed
2920 to be the spatial dimension (i.e. 2-dimension or 3-dimension).
2921*/
2923{
2924protected:
2928
2929 // PA extension
2930 const DofToQuad *maps; ///< Not owned
2931 const GeometricFactors *geom; ///< Not owned
2934
2935private:
2936 DenseMatrix dshape, dshapedxt, pelmat;
2937 int vdim = -1;
2938 DenseMatrix mcoeff;
2939 Vector vcoeff;
2940
2941public:
2943
2944 /** \brief Integrator with unit coefficient for caller-specified vector
2945 dimension.
2946
2947 If the vector dimension does not match the true dimension of the space,
2948 the resulting element matrix will be mathematically invalid. */
2949 VectorDiffusionIntegrator(int vector_dimension)
2950 : vdim(vector_dimension) { }
2951
2954
2957
2958 /** \brief Integrator with scalar coefficient for caller-specified vector
2959 dimension.
2960
2961 The element matrix is block-diagonal with \c vdim copies of the element
2962 matrix integrated with the \c Coefficient.
2963
2964 If the vector dimension does not match the true dimension of the space,
2965 the resulting element matrix will be mathematically invalid. */
2966 VectorDiffusionIntegrator(Coefficient &q, int vector_dimension)
2967 : Q(&q), vdim(vector_dimension) { }
2968
2969 /** \brief Integrator with \c VectorCoefficient. The vector dimension of the
2970 \c FiniteElementSpace is assumed to be the same as the dimension of the
2971 \c Vector.
2972
2973 The element matrix is block-diagonal and each block is integrated with
2974 coefficient $q_{i}$.
2975
2976 If the vector dimension does not match the true dimension of the space,
2977 the resulting element matrix will be mathematically invalid. */
2979 : VQ(&vq), vdim(vq.GetVDim()) { }
2980
2981 /** \brief Integrator with \c MatrixCoefficient. The vector dimension of the
2982 \c FiniteElementSpace is assumed to be the same as the dimension of the
2983 \c Matrix.
2984
2985 The element matrix is populated in each block. Each block is integrated
2986 with coefficient $q_{ij}$.
2987
2988 If the vector dimension does not match the true dimension of the space,
2989 the resulting element matrix will be mathematically invalid. */
2991 : MQ(&mq), vdim(mq.GetVDim()) { }
2992
2993 virtual void AssembleElementMatrix(const FiniteElement &el,
2994 ElementTransformation &Trans,
2995 DenseMatrix &elmat);
2996 virtual void AssembleElementVector(const FiniteElement &el,
2998 const Vector &elfun, Vector &elvect);
3000 virtual void AssemblePA(const FiniteElementSpace &fes);
3001 virtual void AssembleMF(const FiniteElementSpace &fes);
3002 virtual void AssembleDiagonalPA(Vector &diag);
3003 virtual void AssembleDiagonalMF(Vector &diag);
3004 virtual void AddMultPA(const Vector &x, Vector &y) const;
3005 virtual void AddMultMF(const Vector &x, Vector &y) const;
3006 bool SupportsCeed() const { return DeviceCanUseCeed(); }
3007};
3008
3009/** Integrator for the linear elasticity form:
3010 $$
3011 a(u,v) = (\lambda \mathrm{div}(u), \mathrm{div}(v)) + (2 \mu \varepsilon(u), \varepsilon(v)),
3012 $$
3013 where $\varepsilon(v) = \frac{1}{2} (\mathrm{grad}(v) + \mathrm{grad}(v)^{\mathrm{T}})$.
3014 This is a 'Vector' integrator, i.e. defined for FE spaces
3015 using multiple copies of a scalar FE space. */
3017{
3019
3020protected:
3023
3024private:
3025#ifndef MFEM_THREAD_SAFE
3026 Vector shape;
3027 DenseMatrix dshape, gshape, pelmat;
3028 Vector divshape;
3029#endif
3030
3031 // PA extension
3032
3033 const DofToQuad *maps; ///< Not owned
3034 const GeometricFactors *geom; ///< Not owned
3035 int vdim, ndofs;
3036 const FiniteElementSpace *fespace; ///< Not owned.
3037
3038 std::unique_ptr<QuadratureSpace> q_space;
3039 /// Coefficients projected onto q_space
3040 std::unique_ptr<CoefficientVector> lambda_quad, mu_quad;
3041 /// Workspace vector
3042 std::unique_ptr<QuadratureFunction> q_vec;
3043
3044 /// Set up the quadrature space and project lambda and mu coefficients
3045 void SetUpQuadratureSpaceAndCoefficients(const FiniteElementSpace &fes);
3046
3047public:
3050 /** With this constructor $\lambda = q_l m$ and $\mu = q_m m$
3051 if $dim q_l + 2 q_m = 0$ then $tr(\sigma) = 0$. */
3053 { lambda = NULL; mu = &m; q_lambda = q_l; q_mu = q_m; }
3054
3055 virtual void AssembleElementMatrix(const FiniteElement &el,
3057 DenseMatrix &elmat);
3058
3060 virtual void AssemblePA(const FiniteElementSpace &fes);
3061
3062 virtual void AssembleDiagonalPA(Vector &diag);
3063
3064 virtual void AddMultPA(const Vector &x, Vector &y) const;
3065
3066 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3067
3068 /** Compute the stress corresponding to the local displacement @a $u$ and
3069 interpolate it at the nodes of the given @a fluxelem. Only the symmetric
3070 part of the stress is stored, so that the size of @a flux is equal to
3071 the number of DOFs in @a fluxelem times dim*(dim+1)/2. In 2D, the order
3072 of the stress components is: $s_xx, s_yy, s_xy$. In 3D, it is: $s_xx, s_yy,
3073 s_zz, s_xy, s_xz, s_yz$. In other words, @a flux is the local vector for
3074 a FE space with dim*(dim+1)/2 vector components, based on the finite
3075 element @a fluxelem. The integration rule is taken from @a fluxelem.
3076 @a ir exists to specific an alternative integration rule. */
3077 virtual void ComputeElementFlux(const FiniteElement &el,
3078 ElementTransformation &Trans,
3079 Vector &u,
3080 const FiniteElement &fluxelem,
3081 Vector &flux, bool with_coef = true,
3082 const IntegrationRule *ir = NULL);
3083
3084 /** Compute the element energy (integral of the strain energy density)
3085 corresponding to the stress represented by @a flux which is a vector of
3086 coefficients multiplying the basis functions defined by @a fluxelem. In
3087 other words, @a flux is the local vector for a FE space with
3088 dim*(dim+1)/2 vector components, based on the finite element @a fluxelem.
3089 The number of components, dim*(dim+1)/2 is such that it represents the
3090 symmetric part of the (symmetric) stress tensor. The order of the
3091 components is: $s_xx, s_yy, s_xy$ in 2D, and $s_xx, s_yy, s_zz, s_xy, s_xz,
3092 s_yz$ in 3D. */
3093 virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem,
3094 ElementTransformation &Trans,
3095 Vector &flux, Vector *d_energy = NULL);
3096};
3097
3098/// @brief Integrator that computes the PA action of one of the blocks in an
3099/// ElasticityIntegrator, considering the elasticity operator as a dim x dim
3100/// block operator.
3102{
3103 ElasticityIntegrator &parent;
3104 const int i_block;
3105 const int j_block;
3106
3107 const DofToQuad *maps; ///< Not owned
3108 const GeometricFactors *geom; ///< Not owned
3109 const FiniteElementSpace *fespace; ///< Not owned.
3110
3111public:
3112 /// @brief Given an ElasticityIntegrator, create an integrator that
3113 /// represents the $(i,j)$th component block.
3114 ///
3115 /// @note The parent ElasticityIntegrator must remain valid throughout the
3116 /// lifetime of this integrator.
3117 ElasticityComponentIntegrator(ElasticityIntegrator &parent_, int i_, int j_);
3118
3120 virtual void AssemblePA(const FiniteElementSpace &fes);
3121
3122 virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat,
3123 const bool add = true);
3124
3125 virtual void AddMultPA(const Vector &x, Vector &y) const;
3126
3127 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3128};
3129
3130/** Integrator for the DG form:
3131 $$
3132 \alpha \langle \rho_u (u \cdot n) \{v\},[w] \rangle + \beta \langle \rho_u |u \cdot n| [v],[w] \rangle,
3133 $$
3134 where $v$ and $w$ are the trial and test variables, respectively, and $\rho$/$u$ are
3135 given scalar/vector coefficients. $\{v\}$ represents the average value of $v$ on
3136 the face and $[v]$ is the jump such that $\{v\}=(v_1+v_2)/2$ and $[v]=(v_1-v_2)$ for the
3137 face between elements $1$ and $2$. For boundary elements, $v2=0$. The vector
3138 coefficient, $u$, is assumed to be continuous across the faces and when given
3139 the scalar coefficient, $\rho$, is assumed to be discontinuous. The integrator
3140 uses the upwind value of $\rho$, denoted by $\rho_u$, which is value from the side into which
3141 the vector coefficient, $u$, points.
3142
3143 One use case for this integrator is to discretize the operator $-u \cdot \nabla v$
3144 with a DG formulation. The resulting formulation uses the
3145 ConvectionIntegrator (with coefficient $u$, and parameter $\alpha = -1$) and the
3146 transpose of the DGTraceIntegrator (with coefficient $u$, and parameters $\alpha = 1$,
3147 $\beta = -1/2$ to use the upwind face flux, see also
3148 NonconservativeDGTraceIntegrator). This discretization and the handling of
3149 the inflow and outflow boundaries is illustrated in Example 9/9p.
3150
3151 Another use case for this integrator is to discretize the operator $-\mathrm{div}(u v)$
3152 with a DG formulation. The resulting formulation is conservative and
3153 consists of the ConservativeConvectionIntegrator (with coefficient $u$, and
3154 parameter $\alpha = -1$) plus the DGTraceIntegrator (with coefficient $u$, and
3155 parameters $\alpha = -1$, $\beta = -1/2$ to use the upwind face flux).
3156 */
3158{
3159protected:
3163 // PA extension
3165 const DofToQuad *maps; ///< Not owned
3166 const FaceGeometricFactors *geom; ///< Not owned
3168
3169private:
3170 Vector shape1, shape2;
3171
3172public:
3173 /// Construct integrator with $\rho = 1$, $\beta = \alpha/2$.
3175 { rho = NULL; u = &u_; alpha = a; beta = 0.5*a; }
3176
3177 /// Construct integrator with $\rho = 1$.
3179 { rho = NULL; u = &u_; alpha = a; beta = b; }
3180
3182 real_t a, real_t b)
3183 { rho = &rho_; u = &u_; alpha = a; beta = b; }
3184
3186 virtual void AssembleFaceMatrix(const FiniteElement &el1,
3187 const FiniteElement &el2,
3189 DenseMatrix &elmat);
3190
3192
3194
3195 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3196
3197 virtual void AddMultPA(const Vector&, Vector&) const;
3198
3200 Vector &ea_data_int,
3201 Vector &ea_data_ext,
3202 const bool add);
3203
3205 Vector &ea_data_bdr,
3206 const bool add);
3207
3208 static const IntegrationRule &GetRule(Geometry::Type geom, int order,
3210
3211private:
3212 void SetupPA(const FiniteElementSpace &fes, FaceType type);
3213};
3214
3215// Alias for @a DGTraceIntegrator.
3217
3218/** Integrator that represents the face terms used for the non-conservative
3219 DG discretization of the convection equation:
3220 $$
3221 -\alpha \langle \rho_u (u \cdot n) \{v\},[w] \rangle + \beta \langle \rho_u |u \cdot n| [v],[w] \rangle.
3222 $$
3223 This integrator can be used with together with ConvectionIntegrator to
3224 implement an upwind DG discretization in non-conservative form, see ex9 and
3225 ex9p. */
3239
3240/** Integrator for the DG form:
3241 $$
3242 - \langle \{(Q \nabla u) \cdot n\}, [v] \rangle + \sigma \langle [u], \{(Q \nabla v) \cdot n \} \rangle
3243 + \kappa \langle \{h^{-1} Q\} [u], [v] \rangle
3244 $$
3245 where $Q$ is a scalar or matrix diffusion coefficient and $u$, $v$ are the trial
3246 and test spaces, respectively. The parameters $\sigma$ and $\kappa$ determine the
3247 DG method to be used (when this integrator is added to the "broken"
3248 DiffusionIntegrator):
3249 - $\sigma = -1$, $\kappa \geq \kappa_0$: symm. interior penalty (IP or SIPG) method,
3250 - $\sigma = +1$, $\kappa > 0$: non-symmetric interior penalty (NIPG) method,
3251 - $\sigma = +1$, $\kappa = 0$: the method of Baumann and Oden.
3252
3253 \todo Clarify used notation. */
3255{
3256protected:
3260
3261 // these are not thread-safe!
3264
3265
3266 // PA extension
3267 Vector pa_data; // (Q, h, dot(n,J)|el0, dot(n,J)|el1)
3268 const DofToQuad *maps; ///< Not owned
3271
3272public:
3274 : Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
3276 : Q(&q), MQ(NULL), sigma(s), kappa(k) { }
3278 : Q(NULL), MQ(&q), sigma(s), kappa(k) { }
3280 void AssembleFaceMatrix(const FiniteElement &el1,
3281 const FiniteElement &el2,
3283 DenseMatrix &elmat) override;
3284
3285 bool RequiresFaceNormalDerivatives() const override { return true; }
3286
3288
3290
3292
3294 Vector &y, Vector &dydn) const override;
3295
3297
3298private:
3299 void SetupPA(const FiniteElementSpace &fes, FaceType type);
3300};
3301
3302/** Integrator for the "BR2" diffusion stabilization term
3303 $$
3304 \sum_e \eta (r_e([u]), r_e([v]))
3305 $$
3306 where $r_e$ is the lifting operator defined on each edge $e$ (potentially
3307 weighted by a coefficient $Q$). The parameter eta can be chosen to be one to
3308 obtain a stable discretization. The constructor for this integrator requires
3309 the finite element space because the lifting operator depends on the
3310 element-wise inverse mass matrix.
3311
3312 BR2 stands for the second method of Bassi and Rebay:
3313
3314 - F. Bassi and S. Rebay. A high order discontinuous Galerkin method for
3315 compressible turbulent flows. In B. Cockburn, G. E. Karniadakis, and
3316 C.-W. Shu, editors, Discontinuous Galerkin Methods, pages 77-88. Springer
3317 Berlin Heidelberg, 2000.
3318 - D. N. Arnold, F. Brezzi, B. Cockburn, and L. D. Marini. Unified analysis
3319 of discontinuous Galerkin methods for elliptic problems. SIAM Journal on
3320 Numerical Analysis, 39(5):1749-1779, 2002.
3321*/
3323{
3324protected:
3326
3327 // Block factorizations of local mass matrices, with offsets for the case of
3328 // not equally sized blocks (mixed meshes, p-refinement)
3332
3334
3336
3340
3341 /// Precomputes the inverses (LU factorizations) of the local mass matrices.
3342 /** @a fes must be a DG space, so the mass matrix is block diagonal, and its
3343 inverse can be computed locally. This is required for the computation of
3344 the lifting operators @a r_e.
3345 */
3347
3348public:
3351 real_t e = 1.0);
3353 real_t e = 1.0);
3354
3356 virtual void AssembleFaceMatrix(const FiniteElement &el1,
3357 const FiniteElement &el2,
3359 DenseMatrix &elmat);
3360};
3361
3362/** Integrator for the DG elasticity form, for the formulations see:
3363 - PhD Thesis of Jonas De Basabe, High-Order Finite %Element Methods for
3364 Seismic Wave Propagation, UT Austin, 2009, p. 23, and references therein
3365 - Peter Hansbo and Mats G. Larson, Discontinuous Galerkin and the
3366 Crouzeix-Raviart %Element: Application to Elasticity, PREPRINT 2000-09,
3367 p.3
3368
3369 $$
3370 - \left< \{ \tau(u) \}, [v] \right> + \alpha \left< \{ \tau(v) \}, [u]
3371 \right> + \kappa \left< h^{-1} \{ \lambda + 2 \mu \} [u], [v] \right>
3372 $$
3373
3374 where $ \left<u, v\right> = \int_{F} u \cdot v $, and $ F $ is a
3375 face which is either a boundary face $ F_b $ of an element $ K $ or
3376 an interior face $ F_i $ separating elements $ K_1 $ and $ K_2 $.
3377
3378 In the bilinear form above $ \tau(u) $ is traction, and it's also
3379 $ \tau(u) = \sigma(u) \cdot \vec{n} $, where $ \sigma(u) $ is
3380 stress, and $ \vec{n} $ is the unit normal vector w.r.t. to $ F $.
3381
3382 In other words, we have
3383 $$
3384 - \left< \{ \sigma(u) \cdot \vec{n} \}, [v] \right> + \alpha \left< \{
3385 \sigma(v) \cdot \vec{n} \}, [u] \right> + \kappa \left< h^{-1} \{
3386 \lambda + 2 \mu \} [u], [v] \right>
3387 $$
3388
3389 For isotropic media
3390 $$
3391 \begin{split}
3392 \sigma(u) &= \lambda \nabla \cdot u I + 2 \mu \varepsilon(u) \\
3393 &= \lambda \nabla \cdot u I + 2 \mu \frac{1}{2} (\nabla u + \nabla
3394 u^{\mathrm{T}}) \\
3395 &= \lambda \nabla \cdot u I + \mu (\nabla u + \nabla u^{\mathrm{T}})
3396 \end{split}
3397 $$
3398
3399 where $ I $ is identity matrix, $ \lambda $ and $ \mu $ are Lame
3400 coefficients (see ElasticityIntegrator), $ u, v $ are the trial and test
3401 functions, respectively.
3402
3403 The parameters $ \alpha $ and $ \kappa $ determine the DG method to
3404 use (when this integrator is added to the "broken" ElasticityIntegrator):
3405
3406 - IIPG, $\alpha = 0$,
3407 C. Dawson, S. Sun, M. Wheeler, Compatible algorithms for coupled flow and
3408 transport, Comp. Meth. Appl. Mech. Eng., 193(23-26), 2565-2580, 2004.
3409
3410 - SIPG, $\alpha = -1$,
3411 M. Grote, A. Schneebeli, D. Schotzau, Discontinuous Galerkin Finite
3412 %Element Method for the Wave Equation, SINUM, 44(6), 2408-2431, 2006.
3413
3414 - NIPG, $\alpha = 1$,
3415 B. Riviere, M. Wheeler, V. Girault, A Priori Error Estimates for Finite
3416 %Element Methods Based on Discontinuous Approximation Spaces for Elliptic
3417 Problems, SINUM, 39(3), 902-931, 2001.
3418
3419 This is a '%Vector' integrator, i.e. defined for FE spaces using multiple
3420 copies of a scalar FE space.
3421 */
3423{
3424public:
3426 : lambda(NULL), mu(NULL), alpha(alpha_), kappa(kappa_) { }
3427
3429 real_t alpha_, real_t kappa_)
3430 : lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
3431
3433 virtual void AssembleFaceMatrix(const FiniteElement &el1,
3434 const FiniteElement &el2,
3436 DenseMatrix &elmat);
3437
3438protected:
3441
3442#ifndef MFEM_THREAD_SAFE
3443 // values of all scalar basis functions for one component of u (which is a
3444 // vector) at the integration point in the reference space
3446 // values of derivatives of all scalar basis functions for one component
3447 // of u (which is a vector) at the integration point in the reference space
3449 // Adjugate of the Jacobian of the transformation: adjJ = det(J) J^{-1}
3451 // gradient of shape functions in the real (physical, not reference)
3452 // coordinates, scaled by det(J):
3453 // dshape_ps(jdof,jm) = sum_{t} adjJ(t,jm)*dshape(jdof,t)
3455 Vector nor; // nor = |weight(J_face)| n
3456 Vector nL1, nL2; // nL1 = (lambda1 * ip.weight / detJ1) nor
3457 Vector nM1, nM2; // nM1 = (mu1 * ip.weight / detJ1) nor
3458 Vector dshape1_dnM, dshape2_dnM; // dshape1_dnM = dshape1_ps . nM1
3459 // 'jmat' corresponds to the term: kappa <h^{-1} {lambda + 2 mu} [u], [v]>
3461#endif
3462
3463 static void AssembleBlock(
3464 const int dim, const int row_ndofs, const int col_ndofs,
3465 const int row_offset, const int col_offset,
3466 const real_t jmatcoef, const Vector &col_nL, const Vector &col_nM,
3467 const Vector &row_shape, const Vector &col_shape,
3468 const Vector &col_dshape_dnM, const DenseMatrix &col_dshape,
3469 DenseMatrix &elmat, DenseMatrix &jmat);
3470};
3471
3472/** Integrator for the DPG form:$ \langle v, [w] \rangle $ over all faces (the interface) where
3473 the trial variable $v$ is defined on the interface and the test variable $w$ is
3474 defined inside the elements, generally in a DG space. */
3476{
3477private:
3478 Vector face_shape, shape1, shape2;
3479
3480public:
3483 virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3484 const FiniteElement &test_fe1,
3485 const FiniteElement &test_fe2,
3487 DenseMatrix &elmat);
3488};
3489
3490/** Integrator for the form:$ \langle v, [w \cdot n] \rangle $ over all faces (the interface) where
3491 the trial variable $v$ is defined on the interface and the test variable $w$ is
3492 in an $H(div)$-conforming space. */
3494{
3495private:
3496 Vector face_shape, normal, shape1_n, shape2_n;
3497 DenseMatrix shape1, shape2;
3498
3499public:
3502 virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe,
3503 const FiniteElement &test_fe1,
3504 const FiniteElement &test_fe2,
3506 DenseMatrix &elmat);
3507};
3508
3509/** Integrator for the DPG form:$ \langle v, w \rangle $ over a face (the interface) where
3510 the trial variable $v$ is defined on the interface
3511 ($H^{-1/2}$ i.e., $v := u \cdot n$ normal trace of $H(div)$)
3512 and the test variable $w$ is in an $H^1$-conforming space. */
3514{
3515private:
3516 Vector face_shape, shape;
3517public:
3519 void AssembleTraceFaceMatrix(int elem,
3520 const FiniteElement &trial_face_fe,
3521 const FiniteElement &test_fe,
3523 DenseMatrix &elmat);
3524};
3525
3526/** Integrator for the form: $ \langle v, w \cdot n \rangle $ over a face (the interface) where
3527 the trial variable $v$ is defined on the interface ($H^{1/2}$, i.e., trace of $H^1$)
3528 and the test variable $w$ is in an $H(div)$-conforming space. */
3530{
3531private:
3532 Vector face_shape, normal, shape_n;
3533 DenseMatrix shape;
3534
3535public:
3537 virtual void AssembleTraceFaceMatrix(int ielem,
3538 const FiniteElement &trial_face_fe,
3539 const FiniteElement &test_fe,
3541 DenseMatrix &elmat);
3542};
3543
3544
3545/** Integrator for the form: $\langle v, w \times n \rangle$ over a face (the interface)
3546 * In 3D the trial variable $v$ is defined on the interface ($H^{-1/2}$(curl), trace of $H(curl$)
3547 * In 2D it's defined on the interface ($H^{1/2}$, trace of $H^1$)
3548 * The test variable $w$ is in an $H(curl$-conforming space. */
3550{
3551private:
3552 DenseMatrix face_shape, shape, shape_n;
3553 Vector normal;
3554 Vector temp;
3555
3556 void cross_product(const Vector & x, const DenseMatrix & Y, DenseMatrix & Z)
3557 {
3558 int dim = x.Size();
3559 MFEM_VERIFY(Y.Width() == dim, "Size mismatch");
3560 int dimc = dim == 3 ? dim : 1;
3561 int h = Y.Height();
3562 Z.SetSize(h,dimc);
3563 if (dim == 3)
3564 {
3565 for (int i = 0; i<h; i++)
3566 {
3567 Z(i,0) = x(2) * Y(i,1) - x(1) * Y(i,2);
3568 Z(i,1) = x(0) * Y(i,2) - x(2) * Y(i,0);
3569 Z(i,2) = x(1) * Y(i,0) - x(0) * Y(i,1);
3570 }
3571 }
3572 else
3573 {
3574 for (int i = 0; i<h; i++)
3575 {
3576 Z(i,0) = x(1) * Y(i,0) - x(0) * Y(i,1);
3577 }
3578 }
3579 }
3580
3581public:
3583 void AssembleTraceFaceMatrix(int elem,
3584 const FiniteElement &trial_face_fe,
3585 const FiniteElement &test_fe,
3587 DenseMatrix &elmat);
3588};
3589
3590/** Abstract class to serve as a base for local interpolators to be used in the
3591 DiscreteLinearOperator class. */
3593
3594
3595/** Class for constructing the gradient as a DiscreteLinearOperator from an
3596 $H^1$-conforming space to an $H(curl$-conforming space. The range space can be
3597 vector $L_2$ space as well. */
3599{
3600public:
3601 GradientInterpolator() : dofquad_fe(NULL) { }
3602 virtual ~GradientInterpolator() { delete dofquad_fe; }
3603
3604 virtual void AssembleElementMatrix2(const FiniteElement &h1_fe,
3605 const FiniteElement &nd_fe,
3606 ElementTransformation &Trans,
3607 DenseMatrix &elmat)
3608 { nd_fe.ProjectGrad(h1_fe, Trans, elmat); }
3609
3611
3612 /** @brief Setup method for PA data.
3613
3614 @param[in] trial_fes $H^1$ Lagrange space
3615 @param[in] test_fes $H(curl$ Nedelec space
3616 */
3617 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
3618 const FiniteElementSpace &test_fes);
3619
3620 virtual void AddMultPA(const Vector &x, Vector &y) const;
3621 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3622
3623private:
3624 /// 1D finite element that generates and owns the 1D DofToQuad maps below
3625 FiniteElement *dofquad_fe;
3626
3627 bool B_id; // is the B basis operator (maps_C_C) the identity?
3628 const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3629 const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3630 int dim, ne, o_dofs1D, c_dofs1D;
3631};
3632
3633
3634/** Class for constructing the identity map as a DiscreteLinearOperator. This
3635 is the discrete embedding matrix when the domain space is a subspace of
3636 the range space. Otherwise, a dof projection matrix is constructed. */
3638{
3639public:
3640 IdentityInterpolator(): dofquad_fe(NULL) { }
3641
3642 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3643 const FiniteElement &ran_fe,
3644 ElementTransformation &Trans,
3645 DenseMatrix &elmat)
3646 { ran_fe.Project(dom_fe, Trans, elmat); }
3647
3649 virtual void AssemblePA(const FiniteElementSpace &trial_fes,
3650 const FiniteElementSpace &test_fes);
3651
3652 virtual void AddMultPA(const Vector &x, Vector &y) const;
3653 virtual void AddMultTransposePA(const Vector &x, Vector &y) const;
3654
3655 virtual ~IdentityInterpolator() { delete dofquad_fe; }
3656
3657private:
3658 /// 1D finite element that generates and owns the 1D DofToQuad maps below
3659 FiniteElement *dofquad_fe;
3660
3661 const DofToQuad *maps_C_C; // one-d map with Lobatto rows, Lobatto columns
3662 const DofToQuad *maps_O_C; // one-d map with Legendre rows, Lobatto columns
3663 int dim, ne, o_dofs1D, c_dofs1D;
3664
3665 Vector pa_data;
3666};
3667
3668
3669/** Class for constructing the (local) discrete curl matrix which can be used
3670 as an integrator in a DiscreteLinearOperator object to assemble the global
3671 discrete curl matrix. */
3673{
3674public:
3675 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3676 const FiniteElement &ran_fe,
3677 ElementTransformation &Trans,
3678 DenseMatrix &elmat)
3679 { ran_fe.ProjectCurl(dom_fe, Trans, elmat); }
3680};
3681
3682
3683/** Class for constructing the (local) discrete divergence matrix which can
3684 be used as an integrator in a DiscreteLinearOperator object to assemble
3685 the global discrete divergence matrix.
3686
3687 Note: Since the dofs in the L2_FECollection are nodal values, the local
3688 discrete divergence matrix (with an $H(div)$-type domain space) will depend on
3689 the transformation. On the other hand, the local matrix returned by
3690 VectorFEDivergenceIntegrator is independent of the transformation. */
3692{
3693public:
3694 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3695 const FiniteElement &ran_fe,
3696 ElementTransformation &Trans,
3697 DenseMatrix &elmat)
3698 { ran_fe.ProjectDiv(dom_fe, Trans, elmat); }
3699};
3700
3701
3702/** A trace face interpolator class for interpolating the normal component of
3703 the domain space, e.g. vector $H^1$, into the range space, e.g. the trace of
3704 $H(div)$ which uses FiniteElement::INTEGRAL map type. */
3706{
3707public:
3708 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3709 const FiniteElement &ran_fe,
3710 ElementTransformation &Trans,
3711 DenseMatrix &elmat);
3712};
3713
3714/** Interpolator of a scalar coefficient multiplied by a scalar field onto
3715 another scalar field. Note that this can produce inaccurate fields unless
3716 the target is sufficiently high order. */
3718{
3719public:
3721
3722 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3723 const FiniteElement &ran_fe,
3724 ElementTransformation &Trans,
3725 DenseMatrix &elmat);
3726
3727protected:
3729};
3730
3731/** Interpolator of a scalar coefficient multiplied by a vector field onto
3732 another vector field. Note that this can produce inaccurate fields unless
3733 the target is sufficiently high order. */
3735{
3736public:
3739
3740 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3741 const FiniteElement &ran_fe,
3742 ElementTransformation &Trans,
3743 DenseMatrix &elmat);
3744protected:
3746};
3747
3748/** Interpolator of a vector coefficient multiplied by a scalar field onto
3749 another vector field. Note that this can produce inaccurate fields unless
3750 the target is sufficiently high order. */
3752{
3753public:
3756
3757 virtual void AssembleElementMatrix2(const FiniteElement &dom_fe,
3758 const FiniteElement &ran_fe,
3759 ElementTransformation &Trans,
3760 DenseMatrix &elmat);
3761protected:
3763};
3764
3765/** Interpolator of the 2D cross product between a vector coefficient and an
3766 $H(curl$-conforming field onto an $L_2$-conforming field. */
3768{
3769public:
3772
3773 virtual void AssembleElementMatrix2(const FiniteElement &nd_fe,
3774 const FiniteElement &l2_fe,
3775 ElementTransformation &Trans,
3776 DenseMatrix &elmat);
3777protected:
3779};
3780
3781/** Interpolator of the cross product between a vector coefficient and an
3782 $H(curl$-conforming field onto an $H(div)$-conforming field. The range space
3783 can also be vector $L_2$. */
3785{
3786public:
3789
3790 virtual void AssembleElementMatrix2(const FiniteElement &nd_fe,
3791 const FiniteElement &rt_fe,
3792 ElementTransformation &Trans,
3793 DenseMatrix &elmat);
3794protected:
3796};
3797
3798/** Interpolator of the inner product between a vector coefficient and an
3799 $H(div)$-conforming field onto an $L_2$-conforming field. The range space can
3800 also be $H^1$. */
3802{
3803public:
3805
3806 virtual void AssembleElementMatrix2(const FiniteElement &rt_fe,
3807 const FiniteElement &l2_fe,
3808 ElementTransformation &Trans,
3809 DenseMatrix &elmat);
3810protected:
3812};
3813
3814}
3815#endif
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Definition array.hpp:769
Abstract base class BilinearFormIntegrator.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
virtual void AssembleTraceFaceMatrix(int elem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
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
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.
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 AssembleFaceGrad(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local action of the gradient of the NonlinearFormIntegrator resulting from a face integr...
virtual void AssemblePatchMatrix(const int patch, const FiniteElementSpace &fes, SparseMatrix *&smat)
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 AddMultMF(const Vector &x, Vector &y) const
virtual void AssembleFaceVector(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator resulting from a face integral term....
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.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
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)
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
const DofToQuad * maps
Not owned.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
static const IntegrationRule & GetRule(const FiniteElement &el, ElementTransformation &Trans)
virtual void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
VectorCoefficient * Q
ConvectionIntegrator(VectorCoefficient &q, real_t a=1.0)
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
const GeometricFactors * geom
Not owned.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AddMultMF(const Vector &, Vector &) const
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
Integrator for for Nedelec elements.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
CurlCurlIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
Construct a bilinear form integrator for Nedelec elements.
const GeometricFactors * geom
Not owned.
bool symmetric
False if using a nonsymmetric matrix coefficient.
const Coefficient * GetCoefficient() const
CurlCurlIntegrator(DiagonalMatrixCoefficient &dq, const IntegrationRule *ir=NULL)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
MatrixCoefficient * MQ
CurlCurlIntegrator(MatrixCoefficient &mq, const IntegrationRule *ir=NULL)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
DiagonalMatrixCoefficient * DQ
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef, const IntegrationRule *ir=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
void PrecomputeMassInverse(class FiniteElementSpace &fes)
Precomputes the inverses (LU factorizations) of the local mass matrices.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
MFEM_DEPRECATED DGDiffusionBR2Integrator(class FiniteElementSpace *fes, real_t e=1.0)
DGDiffusionBR2Integrator(class FiniteElementSpace &fes, real_t e=1.0)
DGDiffusionBR2Integrator(class FiniteElementSpace &fes, Coefficient &Q_, real_t e=1.0)
bool RequiresFaceNormalDerivatives() const override
For bilinear forms on element faces, specifies if the normal derivatives are needed on the faces or j...
void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat) override
void AssemblePAInteriorFaces(const FiniteElementSpace &fes) override
const IntegrationRule & GetRule(int order, FaceElementTransformations &T)
DGDiffusionIntegrator(const real_t s, const real_t k)
DGDiffusionIntegrator(Coefficient &q, const real_t s, const real_t k)
DGDiffusionIntegrator(MatrixCoefficient &q, const real_t s, const real_t k)
void AddMultPAFaceNormalDerivatives(const Vector &x, const Vector &dxdn, Vector &y, Vector &dydn) const override
Method for partially assembled action.
void AssemblePABoundaryFaces(const FiniteElementSpace &fes) override
const DofToQuad * maps
Not owned.
static void AssembleBlock(const int dim, const int row_ndofs, const int col_ndofs, const int row_offset, const int col_offset, const real_t jmatcoef, const Vector &col_nL, const Vector &col_nM, const Vector &row_shape, const Vector &col_shape, const Vector &col_dshape_dnM, const DenseMatrix &col_dshape, DenseMatrix &elmat, DenseMatrix &jmat)
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
DGElasticityIntegrator(real_t alpha_, real_t kappa_)
DGElasticityIntegrator(Coefficient &lambda_, Coefficient &mu_, real_t alpha_, real_t kappa_)
Solver for the discontinuous Galerkin mass matrix.
Definition dgmassinv.hpp:28
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
VectorCoefficient * u
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add)
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
DGTraceIntegrator(VectorCoefficient &u_, real_t a)
Construct integrator with , .
const FaceGeometricFactors * geom
Not owned.
static const IntegrationRule & GetRule(Geometry::Type geom, int order, FaceElementTransformations &T)
DGTraceIntegrator(VectorCoefficient &u_, real_t a, real_t b)
Construct integrator with .
DGTraceIntegrator(Coefficient &rho_, VectorCoefficient &u_, real_t a, real_t b)
const DofToQuad * maps
Not owned.
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
Definition densemat.hpp:105
Class for integrating where and are scalars.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
DerivativeIntegrator(Coefficient &q, int i)
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe)
DiffusionIntegrator(const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with coefficient Q = 1.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
void AssemblePatchPA(const int patch, const FiniteElementSpace &fes)
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
MatrixCoefficient * MQ
virtual void AddMultNURBSPA(const Vector &, Vector &) const
Method for partially assembled action on NURBS patches.
DiffusionIntegrator(VectorCoefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a vector coefficient q.
DiffusionIntegrator(MatrixCoefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a matrix coefficient q.
virtual void AssembleNURBSPA(const FiniteElementSpace &fes)
Method defining partial assembly on NURBS patches.
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
VectorCoefficient * VQ
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator.
virtual void AddMultMF(const Vector &, Vector &) const
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssemblePatchMatrix(const int patch, const FiniteElementSpace &fes, SparseMatrix *&smat)
void AddMultPatchPA(const int patch, const Vector &x, Vector &y) const
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
Virtual method required for Zienkiewicz-Zhu type error estimators.
DiffusionIntegrator(Coefficient &q, const IntegrationRule *ir=nullptr)
Construct a diffusion integrator with a scalar coefficient q.
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 AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
Coefficient * GetCoefficient() const
for Raviart-Thomas elements
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
DivDivIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
const Coefficient * GetCoefficient() const
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Structure representing the matrices/tensors needed to evaluate (in reference space) the values,...
Definition fe_base.hpp:137
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.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add=true)
Method defining element assembly.
ElasticityIntegrator(Coefficient &m, real_t q_l, real_t q_m)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Tr, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
ElasticityIntegrator(Coefficient &l, Coefficient &m)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual real_t ComputeFluxEnergy(const FiniteElement &fluxelem, ElementTransformation &Trans, Vector &flux, Vector *d_energy=NULL)
virtual void ComputeElementFlux(const FiniteElement &el, ElementTransformation &Trans, Vector &u, const FiniteElement &fluxelem, Vector &flux, bool with_coef=true, const IntegrationRule *ir=NULL)
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:484
Structure for storing face geometric factors: coordinates, Jacobians, determinants of the Jacobians,...
Definition mesh.hpp:2844
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:220
Abstract class for all finite elements.
Definition fe_base.hpp:239
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
Definition fe_base.cpp:40
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_base.cpp:175
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
Definition fe_base.hpp:320
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Definition fe_base.hpp:333
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
Definition fe_base.cpp:192
int GetDerivType() const
Returns the FiniteElement::DerivType of the element describing the spatial derivative method implemen...
Definition fe_base.hpp:360
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_base.cpp:161
int GetDim() const
Returns the reference space dimension for the finite element.
Definition fe_base.hpp:316
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
Definition fe_base.hpp:346
int Space() const
Returns the type of FunctionSpace on the element.
Definition fe_base.hpp:343
@ DIV
Implements CalcDivShape methods.
Definition fe_base.hpp:301
@ CURL
Implements CalcCurlShape methods.
Definition fe_base.hpp:302
@ GRAD
Implements CalcDShape methods.
Definition fe_base.hpp:300
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition fe_base.cpp:126
void CalcPhysDivShape(ElementTransformation &Trans, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in physical space at the po...
Definition fe_base.cpp:58
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
Definition fe_base.hpp:323
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_base.cpp:168
virtual void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
Definition fe_base.cpp:71
void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in physical space at the point ...
Definition fe_base.cpp:182
@ Pk
Polynomials of order k.
Definition fe_base.hpp:226
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Definition mesh.hpp:2790
GradientIntegrator(Coefficient *q_)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
GradientIntegrator(Coefficient &q)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
virtual void AssembleElementMatrix2(const FiniteElement &h1_fe, const FiniteElement &nd_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
Setup method for PA data.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
using the "group" FE discretization
GroupConvectionIntegrator(VectorCoefficient &q, real_t a=1.0)
virtual void AssembleElementMatrix(const FiniteElement &, ElementTransformation &, DenseMatrix &)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
A class to initialize the size of a Tensor.
Definition dtensor.hpp:55
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
Container class for integration rules.
Definition intrules.hpp:416
Integrator that inverts the matrix assembled by another integrator.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
InverseIntegrator(BilinearFormIntegrator *integ, int own_integ=1)
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
LumpedIntegrator(BilinearFormIntegrator *bfi_, int own_bfi_=1)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
const FiniteElementSpace * fespace
const FaceGeometricFactors * face_geom
Not owned.
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
MassIntegrator(const IntegrationRule *ir=NULL)
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
const DofToQuad * maps
Not owned.
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
MassIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
Construct a mass integrator with coefficient q.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssemblePABoundary(const FiniteElementSpace &fes)
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AddMultMF(const Vector &, Vector &) const
const GeometricFactors * geom
Not owned.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
const Coefficient * GetCoefficient() const
Base class for Matrix Coefficients that optionally depend on time and space.
Mesh data type.
Definition mesh.hpp:56
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
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
MixedCurlIntegrator(Coefficient &q)
MixedCurlIntegrator(Coefficient *q_)
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.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
const DofToQuad * mapsC
Not owned. DOF-to-quad map, closed.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
MixedScalarCurlIntegrator(Coefficient &q)
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 void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
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
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, Vector &shape)
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 void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
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_)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual int GetVDim(const FiniteElement &vector_fe)
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
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
MixedVectorCurlIntegrator(Coefficient &q)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
MixedVectorCurlIntegrator(DiagonalMatrixCoefficient &dq)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
MixedVectorCurlIntegrator(MatrixCoefficient &mq)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
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
virtual const char * FiniteElementTypeFailureMessage() const
MixedVectorGradientIntegrator(MatrixCoefficient &mq)
MixedVectorGradientIntegrator(DiagonalMatrixCoefficient &dq)
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual int GetTrialVDim(const FiniteElement &trial_fe)
virtual void CalcTrialShape(const FiniteElement &trial_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual const char * FiniteElementTypeFailureMessage() const
VectorCoefficient * VQ
MixedVectorIntegrator(VectorCoefficient &vq, bool diag=true)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
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)
virtual void AssembleElementMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &elmat)
Support for use in BilinearForm. Can be used only when appropriate.
DiagonalMatrixCoefficient * DQ
MixedVectorIntegrator(MatrixCoefficient &mq)
MixedVectorMassIntegrator(Coefficient &q)
MixedVectorMassIntegrator(DiagonalMatrixCoefficient &dq)
MixedVectorMassIntegrator(MatrixCoefficient &mq)
MixedVectorProductIntegrator(VectorCoefficient &vq)
virtual bool VerifyFiniteElementTypes(const FiniteElement &trial_fe, const FiniteElement &test_fe) const
virtual void CalcTestShape(const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &shape)
virtual const char * FiniteElementTypeFailureMessage() const
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
MixedVectorWeakCurlIntegrator(DiagonalMatrixCoefficient &dq)
MixedVectorWeakCurlIntegrator(MatrixCoefficient &mq)
virtual int GetTestVDim(const FiniteElement &test_fe)
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
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....
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleTraceFaceMatrix(int ielem, const FiniteElement &trial_face_fe, const FiniteElement &test_fe, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat)
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
virtual void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat)
ScalarCrossProductInterpolator(VectorCoefficient &vc)
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
ScalarProductInterpolator(Coefficient &sc)
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
Data type sparse matrix.
Definition sparsemat.hpp:51
Integrator defining a sum of multiple Integrators.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AddMultMF(const Vector &x, Vector &y) const
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
void AddIntegrator(BilinearFormIntegrator *integ)
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add)
virtual void AddMultTransposeMF(const Vector &x, Vector &y) const
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
SumIntegrator(int own_integs=1)
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
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)
virtual void AssembleFaceMatrix(const FiniteElement &trial_face_fe, const FiniteElement &test_fe1, const FiniteElement &test_fe2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssembleEA(const FiniteElementSpace &fes, Vector &emat, const bool add)
Method defining element assembly.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
TransposeIntegrator(BilinearFormIntegrator *bfi_, int own_bfi_=1)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void SetIntRule(const IntegrationRule *ir)
Prescribe a fixed IntegrationRule to use (when ir != NULL) or let the integrator choose (when ir == N...
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssemblePAInteriorFaces(const FiniteElementSpace &fes)
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AssemblePABoundaryFaces(const FiniteElementSpace &fes)
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
virtual void AssembleEAInteriorFaces(const FiniteElementSpace &fes, Vector &ea_data_int, Vector &ea_data_ext, const bool add)
virtual void AssembleEABoundaryFaces(const FiniteElementSpace &fes, Vector &ea_data_bdr, const bool add)
Base class for vector Coefficients that optionally depend on time and space.
virtual void AssembleElementMatrix2(const FiniteElement &nd_fe, const FiniteElement &rt_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorCrossProductInterpolator(VectorCoefficient &vc)
VectorCurlCurlIntegrator(Coefficient &q)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Assemble an element matrix.
virtual real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun)
Compute element energy: .
VectorDiffusionIntegrator(int vector_dimension)
Integrator with unit coefficient for caller-specified vector dimension.
VectorDiffusionIntegrator(Coefficient &q)
const DofToQuad * maps
Not owned.
VectorDiffusionIntegrator(Coefficient &q, int vector_dimension)
Integrator with scalar coefficient for caller-specified vector dimension.
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the BilinearFormIntegrator. Note that the default implementation in the b...
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
virtual void AddMultMF(const Vector &x, Vector &y) const
VectorDiffusionIntegrator(VectorCoefficient &vq)
Integrator with VectorCoefficient. The vector dimension of the FiniteElementSpace is assumed to be th...
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
VectorDiffusionIntegrator(Coefficient &q, const IntegrationRule *ir)
const GeometricFactors * geom
Not owned.
VectorDiffusionIntegrator(MatrixCoefficient &mq)
Integrator with MatrixCoefficient. The vector dimension of the FiniteElementSpace is assumed to be th...
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
VectorDivergenceIntegrator(Coefficient &q)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
VectorDivergenceIntegrator(Coefficient *q_)
VectorFECurlIntegrator(Coefficient &q)
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleDiagonalPA_ADAt(const Vector &D, Vector &diag)
Assemble diagonal of ( is this integrator) and add it to diag.
virtual void AddMultTransposePA(const Vector &, Vector &) const
Method for partially assembled transposed action.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
VectorFEMassIntegrator(DiagonalMatrixCoefficient *dq_)
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
const Coefficient * GetCoefficient() const
VectorFEMassIntegrator(MatrixCoefficient &mq)
VectorFEMassIntegrator(MatrixCoefficient *mq_)
virtual void AssemblePA(const FiniteElementSpace &trial_fes, const FiniteElementSpace &test_fes)
VectorFEMassIntegrator(Coefficient *q_)
const DofToQuad * mapsO
Not owned. DOF-to-quad map, open.
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
const DofToQuad * mapsOtest
Not owned. DOF-to-quad map, open.
VectorFEMassIntegrator(DiagonalMatrixCoefficient &dq)
VectorFEMassIntegrator(Coefficient &q)
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
bool symmetric
False if using a nonsymmetric matrix coefficient.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
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.
virtual void AddMultTransposePA(const Vector &x, Vector &y) const
Method for partially assembled transposed action.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AssembleElementMatrix2(const FiniteElement &rt_fe, const FiniteElement &l2_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorInnerProductInterpolator(VectorCoefficient &vc)
VectorCoefficient * VQ
virtual void AssembleDiagonalMF(Vector &diag)
Assemble diagonal and add it to Vector diag.
virtual void AssembleMF(const FiniteElementSpace &fes)
Method defining matrix-free assembly.
const DofToQuad * maps
Not owned.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorMassIntegrator(VectorCoefficient &q, int qo=0)
Construct an integrator with diagonal coefficient q.
virtual void AddMultPA(const Vector &x, Vector &y) const
Method for partially assembled action.
VectorMassIntegrator(Coefficient &q, int qo=0)
virtual void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat)
Given a particular Finite Element computes the element matrix elmat.
virtual void AddMultMF(const Vector &x, Vector &y) const
virtual void AssemblePA(const FiniteElementSpace &fes)
Method defining partial assembly.
VectorMassIntegrator(MatrixCoefficient &q, int qo=0)
Construct an integrator with matrix coefficient q.
MatrixCoefficient * MQ
virtual void AssembleDiagonalPA(Vector &diag)
Assemble diagonal and add it to Vector diag.
VectorMassIntegrator(Coefficient &q, const IntegrationRule *ir)
VectorMassIntegrator()
Construct an integrator with coefficient 1.0.
const GeometricFactors * geom
Not owned.
bool SupportsCeed() const
Indicates whether this integrator can use a Ceed backend.
virtual void AssembleElementMatrix2(const FiniteElement &dom_fe, const FiniteElement &ran_fe, ElementTransformation &Trans, DenseMatrix &elmat)
VectorScalarProductInterpolator(VectorCoefficient &vc)
Vector data type.
Definition vector.hpp:80
int Size() const
Returns the size of the vector.
Definition vector.hpp:218
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
Definition vector.hpp:227
int dimc
Definition maxwell.cpp:123
int dim
Definition ex24.cpp:53
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:316
bool DeviceCanUseCeed()
Function that determines if a CEED kernel should be used, based on the current mfem::Device configura...
Definition util.cpp:33
float real_t
Definition config.hpp:43
FaceType
Definition mesh.hpp:47
RefCoord s[3]