MFEM v4.10.0
Finite element discretization library
Loading...
Searching...
No Matches
lininteg.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2026, 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_LININTEG
13#define MFEM_LININTEG
14
15#include "../config/config.hpp"
16#include "coefficient.hpp"
17#include "bilininteg.hpp"
18#include <random>
19#include "integrator.hpp"
20
21#include "kernel_dispatch.hpp"
22
23namespace mfem
24{
25
26/// Abstract base class LinearFormIntegrator
28{
29protected:
30
32
33public:
34
35 /// Method probing for assembly on device
36 virtual bool SupportsDevice() const { return false; }
37
38 /// Method defining assembly on device
39 virtual void AssembleDevice(const FiniteElementSpace &fes,
40 const Array<int> &markers,
41 Vector &b);
42
43 /** Given a particular Finite Element and a transformation (Tr)
44 computes the element vector, elvect. */
45 virtual void AssembleRHSElementVect(const FiniteElement &el,
47 Vector &elvect) = 0;
48 virtual void AssembleRHSElementVect(const FiniteElement &el,
50 Vector &elvect);
51 virtual void AssembleRHSElementVect(const FiniteElement &el1,
52 const FiniteElement &el2,
54 Vector &elvect);
55
57};
58
59
60/// Abstract class for integrators that support delta coefficients
62{
63protected:
66
67 /** @brief This constructor should be used by derived classes that use a
68 scalar DeltaCoefficient. */
71 delta(dynamic_cast<DeltaCoefficient*>(&q)),
72 vec_delta(NULL) { }
73
74 /** @brief This constructor should be used by derived classes that use a
75 VectorDeltaCoefficient. */
77 const IntegrationRule *ir = NULL)
79 delta(NULL),
80 vec_delta(dynamic_cast<VectorDeltaCoefficient*>(&vq)) { }
81
82public:
83 /// Returns true if the derived class instance uses a delta coefficient.
84 bool IsDelta() const { return (delta || vec_delta); }
85
86 /// Returns the center of the delta coefficient.
87 void GetDeltaCenter(Vector &center)
88 {
89 if (delta) { delta->GetDeltaCenter(center); return; }
90 if (vec_delta) { vec_delta->GetDeltaCenter(center); return; }
91 center.SetSize(0);
92 }
93
94 /** @brief Assemble the delta coefficient at the IntegrationPoint set in
95 @a Trans which is assumed to map to the delta coefficient center.
96
97 @note This method should be called for one mesh element only, including
98 in parallel, even when the center of the delta coefficient is shared by
99 multiple elements. */
102 Vector &elvect) = 0;
103};
104
105
106/// Class for domain integration $ L(v) := (f, v) $
108{
109 Vector shape;
110 Coefficient &Q;
111 int oa, ob;
112public:
113 /// Constructs a domain integrator with a given Coefficient
114 /// the old default was a = 1, b = 1
115 /// for simple elliptic problems a = 2, b = -2 is OK
116 DomainLFIntegrator(Coefficient &QF, int a = 2, int b = 0);
117
118 /// Constructs a domain integrator with a given Coefficient
120
121 bool SupportsDevice() const override { return true; }
122
123 /// Method defining assembly on device
125 const Array<int> &markers,
126 Vector &b) override;
127
128 /** Given a particular Finite Element and a transformation (Tr)
129 computes the element right hand side element vector, elvect. */
132 Vector &elvect) override;
133
136 Vector &elvect) override;
137
139
140 /// args: vdim, ne, d1d, q1d, map_type, markers, B, detJ, W, coeff, y
141 using AssembleKernelType = void (*)(const int, const int, const int,
142 const int, const int, const int *,
143 const real_t *, const real_t *,
144 const real_t *, const Vector &coeff,
145 real_t *y);
146
147 /// parameters: use DIM, T_D1D, T_Q1D
148 MFEM_REGISTER_KERNELS(AssembleKernels, AssembleKernelType, (int, int, int));
149 struct Kernels { Kernels(); };
150
151 template <int DIM, int D1D, int Q1D> static void AddSpecialization()
152 {
153 AssembleKernels::Specialization<DIM, D1D, Q1D>::Add();
154 }
155};
156
157/// Class for domain integrator $ L(v) := (f, \nabla v) $
159{
160private:
161 Vector shape, Qvec;
163 DenseMatrix dshape;
164
165public:
166 /// Constructs the domain integrator $ (Q, \nabla v) $
168 : DeltaLFIntegrator(QF, ir), Q(QF) { }
169
170 bool SupportsDevice() const override { return true; }
171
172 /// Method defining assembly on device
173 void AssembleDevice(const FiniteElementSpace &fes,
174 const Array<int> &markers,
175 Vector &b) override;
176
177 /** Given a particular Finite Element and a transformation (Tr)
178 computes the element right hand side element vector, elvect. */
181 Vector &elvect) override;
182
185 Vector &elvect) override;
186
188};
189
190
191/// Class for boundary integration $ L(v) := (g, v) $
193{
194 Vector shape;
195 Coefficient &Q;
196 int oa, ob;
197public:
198 /** @brief Constructs a boundary integrator with a given Coefficient @a QG.
199 Integration order will be @a a * basis_order + @a b. */
200 BoundaryLFIntegrator(Coefficient &QG, int a = 1, int b = 1)
201 : Q(QG), oa(a), ob(b) { }
202
203 bool SupportsDevice() const override { return true; }
204
205 /// Method defining assembly on device
206 void AssembleDevice(const FiniteElementSpace &fes,
207 const Array<int> &markers,
208 Vector &b) override;
209
210 /** Given a particular boundary Finite Element and a transformation (Tr)
211 computes the element boundary vector, elvect. */
214 Vector &elvect) override;
217 Vector &elvect) override;
218
220};
221
222/// Class for boundary integration $ L(v) = (g \cdot n, v) $
224{
225 Vector shape;
227 int oa, ob;
228public:
229 /// Constructs a boundary integrator with a given Coefficient QG
231 : Q(QG), oa(a), ob(b) { }
232
233 bool SupportsDevice() const override { return true; }
234
235 /// Method defining assembly on device
236 void AssembleDevice(const FiniteElementSpace &fes,
237 const Array<int> &markers,
238 Vector &b) override;
239
242 Vector &elvect) override;
243
245};
246
247/// Class for boundary integration $ L(v) = (g \cdot \tau, v) $ in 2D
249{
250 Vector shape;
252 int oa, ob;
253public:
254 /// Constructs a boundary integrator with a given Coefficient QG
256 : Q(QG), oa(a), ob(b) { }
257
260 Vector &elvect) override;
261
263};
264
265/** Class for domain integration of $ L(v) := (f, v) $, where
266 $ f = (f_1,\dots,f_n)$ and $ v = (v_1,\dots,v_n) $. */
268{
269private:
270 Vector shape, Qvec;
272
273public:
274 /// Constructs a domain integrator with a given VectorCoefficient
276 const IntegrationRule *ir = nullptr);
277
278 bool SupportsDevice() const override { return true; }
279
280 /// Method defining assembly on device
281 void AssembleDevice(const FiniteElementSpace &fes, const Array<int> &markers,
282 Vector &b) override;
283
284 /** Given a particular Finite Element and a transformation (Tr)
285 computes the element right hand side element vector, elvect. */
288 Vector &elvect) override;
289
292 Vector &elvect) override;
293
295
296 template <int DIM, int D1D, int Q1D> static void AddSpecialization()
297 {
298 // uses the same kernels for assembly
299 DomainLFIntegrator::AssembleKernels::Specialization<DIM, D1D, Q1D>::Add();
300 }
301};
302
303/** Class for domain integrator $ L(v) := (f, \nabla v) $, where
304 $ f = (f_{1x},f_{1y},f_{1z},\dots,f_{nx},f_{ny},f_{nz})$ and $v=(v_1,\dots,v_n)$. */
306{
307private:
308 Vector shape, Qvec;
310 DenseMatrix dshape;
311
312public:
313 /// Constructs the domain integrator (Q, grad v)
316
317 bool SupportsDevice() const override { return true; }
318
319 /// Method defining assembly on device
320 void AssembleDevice(const FiniteElementSpace &fes,
321 const Array<int> &markers,
322 Vector &b) override;
323
324 /** Given a particular Finite Element and a transformation (Tr)
325 computes the element right hand side element vector, elvect. */
328 Vector &elvect) override;
329
332 Vector &elvect) override;
333
335};
336
337/** Class for boundary integration of $ L(v) := (g, v) $, where
338 $g=(g_1,\dots,g_n)$ and $v=(v_1,\dots,v_n)$. */
340{
341private:
342 Vector shape, vec;
344
345public:
346 /// Constructs a boundary integrator with a given VectorCoefficient QG
348
349 /** Given a particular boundary Finite Element and a transformation (Tr)
350 computes the element boundary vector, elvect. */
353 Vector &elvect) override;
354
355 // For DG spaces
358 Vector &elvect) override;
359
361};
362
363/// $ (f, v)_{\Omega} $ for VectorFiniteElements (Nedelec, Raviart-Thomas)
365{
366private:
368 DenseMatrix vshape;
369 Vector vec;
370
371public:
373 const IntegrationRule *ir = nullptr);
374
377 Vector &elvect) override;
378
381 Vector &elvect) override;
382
383 bool SupportsDevice() const override { return true; }
384
385 void AssembleDevice(const FiniteElementSpace &fes,
386 const Array<int> &markers,
387 Vector &b) override;
388
390
391 /// @param NE number of elements
392 /// @param markers array where entry markers[e] == 0 to skip assembly over
393 /// element e
394 /// @param jac Spatial Jacobians evaluated at all quadrature points
395 /// @param weights 1D quadrature weights
396 /// @param testBO 1D open basis test functions
397 /// @param testBC 1D closed basis test functions
398 /// @param coeff coefficient values evaluated at quadrature points, possibly
399 /// compressed.
400 /// @param y output E-vector of assembled contributions
401 /// @param testd1d number of 1D closed dofs
402 /// @param q1d number of 1D quadrature points
403 using AssembleKernelType = void (*)(const int NE, const Array<int> &markers,
404 const Vector &jac,
405 const Array<real_t> &weights,
406 const Array<real_t> &testBO,
407 const Array<real_t> &testBC,
408 const Vector &coeff, Vector &y,
409 const int testd1d, const int q1d);
410
411 /// parameters: test_fetype, ndims, test_d1d, q1d
413 (FiniteElement::DerivType, int, int, int));
414
415 struct Kernels
416 {
417 Kernels();
418 };
419
420 template <FiniteElement::DerivType TestType, int DIM, int TEST_D1D, int Q1D>
421 static void AddSpecialization()
422 {
423 AssembleKernels::Specialization<TestType, DIM, TEST_D1D, Q1D>::Add();
424 }
425};
426
427/// $ (Q, \mathrm{curl}(v))_{\Omega} $ for Nedelec Elements
429{
430private:
431 VectorCoefficient *QF=nullptr;
432 DenseMatrix curlshape;
433 Vector vec;
434
435public:
436 /// Constructs the domain integrator $(Q, \mathrm{curl}(v)) $
439
442 Vector &elvect) override;
443
446 Vector &elvect) override;
447
449};
450
451/// $ (Q, \mathrm{div}(v))_{\Omega} $ for RT Elements
453{
454private:
455 Vector divshape;
456 Coefficient &Q;
457public:
458 /// Constructs the domain integrator $ (Q, \mathrm{div}(v)) $
461
462 /** Given a particular Finite Element and a transformation (Tr)
463 computes the element right hand side element vector, elvect. */
466 Vector &elvect) override;
467
470 Vector &elvect) override;
471
473};
474
475/** $ (f, v \cdot n)_{\partial\Omega} $ for vector test function
476 $v=(v_1,\dots,v_n)$ where all vi are in the same scalar FE space and $f$ is a
477 scalar function. */
479{
480private:
481 real_t Sign;
482 Coefficient *F;
483 Vector shape, nor;
484
485public:
487 const IntegrationRule *ir = NULL)
488 : LinearFormIntegrator(ir), Sign(s), F(&f) { }
489
492 Vector &elvect) override;
493
495};
496
497/** Class for boundary integration of $ (f, v \cdot n) $ for scalar coefficient $f$ and
498 RT vector test function $v$. This integrator works with RT spaces defined
499 using the RT_FECollection class. */
501{
502private:
503 Coefficient *F;
504 Vector shape;
505 int oa, ob; // these control the quadrature order, see DomainLFIntegrator
506
507public:
509 : F(NULL), oa(a), ob(b) { }
511 : F(&f), oa(a), ob(b) { }
512
515 Vector &elvect) override;
516
518
519 bool SupportsDevice() const override { return true; }
520
521 void AssembleDevice(const FiniteElementSpace &fes,
522 const Array<int> &markers,
523 Vector &b) override;
524};
525
526/** Class for boundary integration of (f.n, v.n) for vector coefficient f and
527 RT vector test function v. This integrator works with RT spaces defined
528 using the RT_FECollection class. */
530{
531private:
533 Vector shape;
534
535public:
537
538 virtual void AssembleRHSElementVect(const FiniteElement &el,
540 Vector &elvect) override;
541
543};
544
545/// Class for boundary integration $ L(v) = (n \times f, v) $
547{
548private:
550 int oa, ob;
551
552public:
554 int a = 2, int b = 0)
555 : f(QG), oa(a), ob(b) { }
556
559 Vector &elvect) override;
560
562};
563
564
565/** Class for boundary integration of the linear form:
566 $ \frac{\alpha}{2} \langle (u \cdot n) f, w \rangle - \beta \langle |u \cdot n| f, w \rangle $
567 where $f$ and $u$ are given scalar and vector coefficients, respectively,
568 and $w$ is the scalar test function. */
570{
571private:
572 Coefficient *f;
574 real_t alpha, beta;
575
576 Vector shape;
577
578public:
580 real_t a)
581 { f = &f_; u = &u_; alpha = a; beta = 0.5*a; }
582
584 real_t a, real_t b)
585 { f = &f_; u = &u_; alpha = a; beta = b; }
586
589 Vector &elvect) override;
592 Vector &elvect) override;
593
595};
596
597
598/** Boundary linear integrator for imposing non-zero Dirichlet boundary
599 conditions, to be used in conjunction with DGDiffusionIntegrator.
600 Specifically, given the Dirichlet data $u_D$, the linear form assembles the
601 following integrals on the boundary:
602 $$
603 \sigma \langle u_D, (Q \nabla v) \cdot n \rangle + \kappa \langle {h^{-1} Q} u_D, v \rangle,
604 $$
605 where Q is a scalar or matrix diffusion coefficient and v is the test
606 function. The parameters $\sigma$ and $\kappa$ should be the same as the ones
607 used in the DGDiffusionIntegrator. */
609{
610protected:
614
615 // these are not thread-safe!
618
619public:
621 : uD(&u), Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
623 const real_t s, const real_t k)
624 : uD(&u), Q(&q), MQ(NULL), sigma(s), kappa(k) { }
626 const real_t s, const real_t k)
627 : uD(&u), Q(NULL), MQ(&q), sigma(s), kappa(k) { }
628
631 Vector &elvect) override;
634 Vector &elvect) override;
635
637};
638
639
640/** Boundary linear form integrator for imposing non-zero Dirichlet boundary
641 conditions, in a DG elasticity formulation. Specifically, the linear form is
642 given by
643 $$
644 \alpha \langle u_D, (\lambda \mathrm{div}(v) I + \mu (\nabla v + \nabla v^{\mathrm{T}})) \cdot n \rangle +
645 + \kappa \langle h^{-1} (\lambda + 2 \mu) u_D, v \rangle,
646 $$
647 where u_D is the given Dirichlet data. The parameters $\alpha$, $\kappa$, $\lambda$
648 and $\mu$, should match the parameters with the same names used in the bilinear
649 form integrator, DGElasticityIntegrator. */
651{
652protected:
656
657#ifndef MFEM_THREAD_SAFE
666#endif
667
668public:
670 Coefficient &lambda_, Coefficient &mu_,
671 real_t alpha_, real_t kappa_)
672 : uD(uD_), lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
673
676 Vector &elvect) override;
679 Vector &elvect) override;
680
682};
683
684
685/** Class for spatial white Gaussian noise integration.
686
687 The target problem is the linear SPDE $ a(u,v) = F(v)$ with $F(v) := <\dot{W},v> $,
688 where $\dot{W}$ is spatial white Gaussian noise. When the Galerkin method is used to
689 discretize this problem into a linear system of equations $Ax = b$, the RHS is
690 a Gaussian random vector $b \sim N(0,M)$ whose covariance matrix is the same as the
691 mass matrix $M_{ij} = (v_i,v_j)$. This property can be ensured if $b = H w$, where
692 $HH^{\mathrm{T}} = M$ and each component $w_i\sim N(0,1)$.
693
694 There is much flexibility in how we may wish to define $H$. In this PR, we
695 define $H = P^{\mathrm{T}} diag(L_e)$, where $P$ is the local-to-global dof assembly matrix
696 and $\mathrm{diag}(L_e)$ is a block-diagonal matrix with $L_e L_e^{\mathrm{T}} = M_e$, where $M_e$ is
697 the element mass matrix for element $e$. A straightforward computation shows
698 that $HH^{\mathrm{T}} = P^{\mathrm{T}} diag(M_e) P = M$, as necessary. */
700{
701#ifdef MFEM_USE_MPI
702 MPI_Comm comm;
703#endif
704 MassIntegrator massinteg;
706
707 // Define random generator with Gaussian distribution
708 std::default_random_engine generator;
709 std::normal_distribution<real_t> dist;
710
711 bool save_factors = false;
712public:
713
714#ifdef MFEM_USE_MPI
715 /** @brief Sets the @a seed_ of the random number generator. A fixed seed
716 allows for a reproducible sequence of white noise vectors. */
718 : LinearFormIntegrator(), comm(MPI_COMM_NULL)
719 {
720 if (seed_ > 0) { SetSeed(seed_); }
721 }
722
723 /** @brief Sets the MPI communicator @a comm_ and the @a seed_ of the random
724 number generator. A fixed seed allows for a reproducible sequence of
725 white noise vectors. */
726 WhiteGaussianNoiseDomainLFIntegrator(MPI_Comm comm_, int seed_)
727 : LinearFormIntegrator(), comm(comm_)
728 {
729 int myid;
730 MPI_Comm_rank(comm, &myid);
731
732 int seed = (seed_ > 0) ? seed_ + myid : time(nullptr) + myid;
733 SetSeed(seed);
734 }
735#else
736 /** @brief Sets the @a seed_ of the random number generator. A fixed seed
737 allows for a reproducible sequence of white noise vectors. */
740 {
741 if (seed_ > 0) { SetSeed(seed_); }
742 }
743#endif
744 /// @brief Sets/resets the @a seed of the random number generator.
745 void SetSeed(int seed)
746 {
747 generator.seed(seed);
748 }
749
753 Vector &elvect) override;
754
755 /** @brief Saves the lower triangular matrices in the element-wise Cholesky
756 decomposition. The parameter @a NE should be the number of elements in
757 the mesh. */
758 void SaveFactors(int NE)
759 {
760 save_factors = true;
761 ResetFactors(NE);
762 }
763
764 /** @brief Resets the array of saved lower triangular Cholesky decomposition
765 matrices. The parameter @a NE should be the number of elements in the
766 mesh. */
767 void ResetFactors(int NE)
768 {
769 for (int i = 0; i<L.Size(); i++)
770 {
771 delete L[i];
772 }
773 L.DeleteAll();
774
775 L.SetSize(NE);
776 for (int i = 0; i<NE; i++)
777 {
778 L[i] = nullptr;
779 }
780 }
781
783 {
784 for (int i = 0; i<L.Size(); i++)
785 {
786 delete L[i];
787 }
788 L.DeleteAll();
789 }
790};
791
792
793/** Class for domain integration of $ L(v) := (f, v) $, where
794 $ f=(f_1,\dots,f_n)$ and $v=(v_1,\dots,v_n)$. that makes use of
795 VectorQuadratureFunctionCoefficient*/
797{
798private:
800
801public:
803 const IntegrationRule *ir = NULL)
804 : LinearFormIntegrator(ir), vqfc(vqfc)
805 {
806 if (ir)
807 {
808 MFEM_WARNING("Integration rule not used in this class. "
809 "The QuadratureFunction integration rules are used instead");
810 }
811 }
812
816 Vector &elvect) override;
817
818 void SetIntRule(const IntegrationRule *ir) override
819 {
820 MFEM_WARNING("Integration rule not used in this class. "
821 "The QuadratureFunction integration rules are used instead");
822 }
823};
824
825
826/** Class for domain integration $ L(v) := (f, v) $ that makes use
827 of QuadratureFunctionCoefficient. */
829{
830private:
832
833public:
835 const IntegrationRule *ir = NULL)
836 : LinearFormIntegrator(ir), qfc(qfc)
837 {
838 if (ir)
839 {
840 MFEM_WARNING("Integration rule not used in this class. "
841 "The QuadratureFunction integration rules are used instead");
842 }
843 }
844
848 Vector &elvect) override;
849
850 void SetIntRule(const IntegrationRule *ir) override
851 {
852 MFEM_WARNING("Integration rule not used in this class. "
853 "The QuadratureFunction integration rules are used instead");
854 }
855};
856
857}
858
859
860#endif
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition array.hpp:869
int Size() const
Return the logical size of the array.
Definition array.hpp:192
void DeleteAll()
Delete the whole array.
Definition array.hpp:1062
BoundaryFlowIntegrator(Coefficient &f_, VectorCoefficient &u_, real_t a, real_t b)
Definition lininteg.hpp:583
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:771
BoundaryFlowIntegrator(Coefficient &f_, VectorCoefficient &u_, real_t a)
Definition lininteg.hpp:579
Class for boundary integration .
Definition lininteg.hpp:193
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:140
BoundaryLFIntegrator(Coefficient &QG, int a=1, int b=1)
Constructs a boundary integrator with a given Coefficient QG. Integration order will be a * basis_ord...
Definition lininteg.hpp:200
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:203
Class for boundary integration .
Definition lininteg.hpp:224
BoundaryNormalLFIntegrator(VectorCoefficient &QG, int a=1, int b=1)
Constructs a boundary integrator with a given Coefficient QG.
Definition lininteg.hpp:230
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:233
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:203
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
Class for boundary integration in 2D.
Definition lininteg.hpp:249
BoundaryTangentialLFIntegrator(VectorCoefficient &QG, int a=1, int b=1)
Constructs a boundary integrator with a given Coefficient QG.
Definition lininteg.hpp:255
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:242
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
DGDirichletLFIntegrator(Coefficient &u, MatrixCoefficient &q, const real_t s, const real_t k)
Definition lininteg.hpp:625
DGDirichletLFIntegrator(Coefficient &u, Coefficient &q, const real_t s, const real_t k)
Definition lininteg.hpp:622
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:837
DGDirichletLFIntegrator(Coefficient &u, const real_t s, const real_t k)
Definition lininteg.hpp:620
MatrixCoefficient * MQ
Definition lininteg.hpp:612
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:928
DGElasticityDirichletLFIntegrator(VectorCoefficient &uD_, Coefficient &lambda_, Coefficient &mu_, real_t alpha_, real_t kappa_)
Definition lininteg.hpp:669
Delta function coefficient optionally multiplied by a weight coefficient and a scaled time dependent ...
void GetDeltaCenter(Vector &center)
Write the center of the delta function into center.
Abstract class for integrators that support delta coefficients.
Definition lininteg.hpp:62
VectorDeltaCoefficient * vec_delta
Definition lininteg.hpp:65
bool IsDelta() const
Returns true if the derived class instance uses a delta coefficient.
Definition lininteg.hpp:84
DeltaCoefficient * delta
Definition lininteg.hpp:64
DeltaLFIntegrator(VectorCoefficient &vq, const IntegrationRule *ir=NULL)
This constructor should be used by derived classes that use a VectorDeltaCoefficient.
Definition lininteg.hpp:76
DeltaLFIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
This constructor should be used by derived classes that use a scalar DeltaCoefficient.
Definition lininteg.hpp:69
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)=0
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
void GetDeltaCenter(Vector &center)
Returns the center of the delta coefficient.
Definition lininteg.hpp:87
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
Class for domain integrator .
Definition lininteg.hpp:159
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:170
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:124
DomainLFGradIntegrator(VectorCoefficient &QF, const IntegrationRule *ir=NULL)
Constructs the domain integrator .
Definition lininteg.hpp:167
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:92
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
Class for domain integration .
Definition lininteg.hpp:108
void(*)(const int, const int, const int, const int, const int, const int *, const real_t *, const real_t *, const real_t *, const Vector &coeff, real_t *y) AssembleKernelType
args: vdim, ne, d1d, q1d, map_type, markers, B, detJ, W, coeff, y
Definition lininteg.hpp:141
static void AddSpecialization()
Definition lininteg.hpp:151
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
MFEM_REGISTER_KERNELS(AssembleKernels, AssembleKernelType,(int, int, int))
parameters: use DIM, T_D1D, T_Q1D
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:51
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:121
DomainLFIntegrator(Coefficient &QF, int a=2, int b=0)
Definition lininteg.cpp:38
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:83
A specialized ElementTransformation class representing a face and its two neighboring elements.
Definition eltrans.hpp:750
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:210
Abstract class for all finite elements.
Definition fe_base.hpp:294
DerivType
Enumeration for DerivType: defines which derivative method is implemented.
Definition fe_base.hpp:363
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:96
This base class implements some shared functionality between linear and nonlinear form integrators.
Abstract base class LinearFormIntegrator.
Definition lininteg.hpp:28
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)=0
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
Definition lininteg.cpp:18
LinearFormIntegrator(const IntegrationRule *ir=NULL)
Definition lininteg.hpp:31
virtual bool SupportsDevice() const
Method probing for assembly on device.
Definition lininteg.hpp:36
Quadrature function coefficient which requires that the quadrature rules used for this coefficient be...
void AssembleRHSElementVect(const FiniteElement &fe, ElementTransformation &Tr, Vector &elvect) override
QuadratureLFIntegrator(QuadratureFunctionCoefficient &qfc, const IntegrationRule *ir=NULL)
Definition lininteg.hpp:834
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
Definition lininteg.hpp:850
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:617
VectorBoundaryFluxLFIntegrator(Coefficient &f, real_t s=1.0, const IntegrationRule *ir=NULL)
Definition lininteg.hpp:486
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:396
VectorBoundaryLFIntegrator(VectorCoefficient &QG)
Constructs a boundary integrator with a given VectorCoefficient QG.
Definition lininteg.hpp:347
Base class for vector Coefficients that optionally depend on time and space.
Vector coefficient defined by a scalar DeltaCoefficient and a constant vector direction.
void GetDeltaCenter(Vector &center)
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:317
VectorDomainLFGradIntegrator(VectorCoefficient &QF)
Constructs the domain integrator (Q, grad v)
Definition lininteg.hpp:314
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:348
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:390
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:331
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
VectorDomainLFIntegrator(VectorCoefficient &QF, const IntegrationRule *ir=nullptr)
Constructs a domain integrator with a given VectorCoefficient.
Definition lininteg.cpp:282
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:289
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:278
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:519
VectorFEBoundaryFluxLFIntegrator(int a=1, int b=-1)
Definition lininteg.hpp:508
VectorFEBoundaryFluxLFIntegrator(Coefficient &f, int a=2, int b=0)
Definition lininteg.hpp:510
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:650
VectorFEBoundaryNormalLFIntegrator(VectorCoefficient &f)
Definition lininteg.hpp:536
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:682
Class for boundary integration .
Definition lininteg.hpp:547
VectorFEBoundaryTangentLFIntegrator(VectorCoefficient &QG, int a=2, int b=0)
Definition lininteg.hpp:553
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:715
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:563
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:531
VectorFEDomainLFCurlIntegrator(VectorCoefficient &F)
Constructs the domain integrator .
Definition lininteg.hpp:437
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:608
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:580
VectorFEDomainLFDivIntegrator(Coefficient &QF)
Constructs the domain integrator .
Definition lininteg.hpp:459
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Definition lininteg.hpp:365
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:383
MFEM_REGISTER_KERNELS(AssembleKernels, AssembleKernelType,(FiniteElement::DerivType, int, int, int))
parameters: test_fetype, ndims, test_d1d, q1d
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:481
void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect) override
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition lininteg.cpp:515
VectorFEDomainLFIntegrator(VectorCoefficient &F, const IntegrationRule *ir=nullptr)
Definition lininteg.cpp:474
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
void(*)(const int NE, const Array< int > &markers, const Vector &jac, const Array< real_t > &weights, const Array< real_t > &testBO, const Array< real_t > &testBC, const Vector &coeff, Vector &y, const int testd1d, const int q1d) AssembleKernelType
Definition lininteg.hpp:403
Vector quadrature function coefficient which requires that the quadrature rules used for this vector ...
void AssembleRHSElementVect(const FiniteElement &fe, ElementTransformation &Tr, Vector &elvect) override
void SetIntRule(const IntegrationRule *ir) override
Prescribe a fixed IntegrationRule to use, or set to null to let the integrator choose an appropriate ...
Definition lininteg.hpp:818
VectorQuadratureLFIntegrator(VectorQuadratureFunctionCoefficient &vqfc, const IntegrationRule *ir=NULL)
Definition lininteg.hpp:802
Vector data type.
Definition vector.hpp:82
void SetSize(int s)
Resize the vector to size s.
Definition vector.hpp:633
WhiteGaussianNoiseDomainLFIntegrator(MPI_Comm comm_, int seed_)
Sets the MPI communicator comm_ and the seed_ of the random number generator. A fixed seed allows for...
Definition lininteg.hpp:726
WhiteGaussianNoiseDomainLFIntegrator(int seed_=0)
Sets the seed_ of the random number generator. A fixed seed allows for a reproducible sequence of whi...
Definition lininteg.hpp:717
void SetSeed(int seed)
Sets/resets the seed of the random number generator.
Definition lininteg.hpp:745
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
void ResetFactors(int NE)
Resets the array of saved lower triangular Cholesky decomposition matrices. The parameter NE should b...
Definition lininteg.hpp:767
void SaveFactors(int NE)
Saves the lower triangular matrices in the element-wise Cholesky decomposition. The parameter NE shou...
Definition lininteg.hpp:758
const real_t alpha
Definition ex15.cpp:369
real_t b
Definition lissajous.cpp:42
real_t a
Definition lissajous.cpp:41
real_t f(const Vector &p)
real_t u(const Vector &xvec)
Definition lor_mms.hpp:22
float real_t
Definition config.hpp:46
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30