MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
lininteg.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_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) $
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:
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
392/// $ (Q, \mathrm{curl}(v))_{\Omega} $ for Nedelec Elements
394{
395private:
396 VectorCoefficient *QF=nullptr;
397 DenseMatrix curlshape;
398 Vector vec;
399
400public:
401 /// Constructs the domain integrator $(Q, \mathrm{curl}(v)) $
404
407 Vector &elvect) override;
408
411 Vector &elvect) override;
412
414};
415
416/// $ (Q, \mathrm{div}(v))_{\Omega} $ for RT Elements
418{
419private:
420 Vector divshape;
421 Coefficient &Q;
422public:
423 /// Constructs the domain integrator $ (Q, \mathrm{div}(v)) $
426
427 /** Given a particular Finite Element and a transformation (Tr)
428 computes the element right hand side element vector, elvect. */
431 Vector &elvect) override;
432
435 Vector &elvect) override;
436
438};
439
440/** $ (f, v \cdot n)_{\partial\Omega} $ for vector test function
441 $v=(v_1,\dots,v_n)$ where all vi are in the same scalar FE space and $f$ is a
442 scalar function. */
444{
445private:
446 real_t Sign;
447 Coefficient *F;
448 Vector shape, nor;
449
450public:
452 const IntegrationRule *ir = NULL)
453 : LinearFormIntegrator(ir), Sign(s), F(&f) { }
454
457 Vector &elvect) override;
458
460};
461
462/** Class for boundary integration of $ (f, v \cdot n) $ for scalar coefficient $f$ and
463 RT vector test function $v$. This integrator works with RT spaces defined
464 using the RT_FECollection class. */
466{
467private:
468 Coefficient *F;
469 Vector shape;
470 int oa, ob; // these control the quadrature order, see DomainLFIntegrator
471
472public:
474 : F(NULL), oa(a), ob(b) { }
476 : F(&f), oa(a), ob(b) { }
477
480 Vector &elvect) override;
481
483
484 bool SupportsDevice() const override { return true; }
485
486 void AssembleDevice(const FiniteElementSpace &fes,
487 const Array<int> &markers,
488 Vector &b) override;
489};
490
491/** Class for boundary integration of (f.n, v.n) for vector coefficient f and
492 RT vector test function v. This integrator works with RT spaces defined
493 using the RT_FECollection class. */
495{
496private:
498 Vector shape;
499
500public:
502
503 virtual void AssembleRHSElementVect(const FiniteElement &el,
505 Vector &elvect) override;
506
508};
509
510/// Class for boundary integration $ L(v) = (n \times f, v) $
512{
513private:
515 int oa, ob;
516
517public:
519 int a = 2, int b = 0)
520 : f(QG), oa(a), ob(b) { }
521
524 Vector &elvect) override;
525
527};
528
529
530/** Class for boundary integration of the linear form:
531 $ \frac{\alpha}{2} \langle (u \cdot n) f, w \rangle - \beta \langle |u \cdot n| f, w \rangle $
532 where $f$ and $u$ are given scalar and vector coefficients, respectively,
533 and $w$ is the scalar test function. */
535{
536private:
537 Coefficient *f;
539 real_t alpha, beta;
540
541 Vector shape;
542
543public:
545 real_t a)
546 { f = &f_; u = &u_; alpha = a; beta = 0.5*a; }
547
549 real_t a, real_t b)
550 { f = &f_; u = &u_; alpha = a; beta = b; }
551
554 Vector &elvect) override;
557 Vector &elvect) override;
558
560};
561
562
563/** Boundary linear integrator for imposing non-zero Dirichlet boundary
564 conditions, to be used in conjunction with DGDiffusionIntegrator.
565 Specifically, given the Dirichlet data $u_D$, the linear form assembles the
566 following integrals on the boundary:
567 $$
568 \sigma \langle u_D, (Q \nabla v) \cdot n \rangle + \kappa \langle {h^{-1} Q} u_D, v \rangle,
569 $$
570 where Q is a scalar or matrix diffusion coefficient and v is the test
571 function. The parameters $\sigma$ and $\kappa$ should be the same as the ones
572 used in the DGDiffusionIntegrator. */
574{
575protected:
579
580 // these are not thread-safe!
583
584public:
586 : uD(&u), Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
588 const real_t s, const real_t k)
589 : uD(&u), Q(&q), MQ(NULL), sigma(s), kappa(k) { }
591 const real_t s, const real_t k)
592 : uD(&u), Q(NULL), MQ(&q), sigma(s), kappa(k) { }
593
596 Vector &elvect) override;
599 Vector &elvect) override;
600
602};
603
604
605/** Boundary linear form integrator for imposing non-zero Dirichlet boundary
606 conditions, in a DG elasticity formulation. Specifically, the linear form is
607 given by
608 $$
609 \alpha \langle u_D, (\lambda \mathrm{div}(v) I + \mu (\nabla v + \nabla v^{\mathrm{T}})) \cdot n \rangle +
610 + \kappa \langle h^{-1} (\lambda + 2 \mu) u_D, v \rangle,
611 $$
612 where u_D is the given Dirichlet data. The parameters $\alpha$, $\kappa$, $\lambda$
613 and $\mu$, should match the parameters with the same names used in the bilinear
614 form integrator, DGElasticityIntegrator. */
616{
617protected:
621
622#ifndef MFEM_THREAD_SAFE
631#endif
632
633public:
635 Coefficient &lambda_, Coefficient &mu_,
636 real_t alpha_, real_t kappa_)
637 : uD(uD_), lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
638
641 Vector &elvect) override;
644 Vector &elvect) override;
645
647};
648
649
650/** Class for spatial white Gaussian noise integration.
651
652 The target problem is the linear SPDE $ a(u,v) = F(v)$ with $F(v) := <\dot{W},v> $,
653 where $\dot{W}$ is spatial white Gaussian noise. When the Galerkin method is used to
654 discretize this problem into a linear system of equations $Ax = b$, the RHS is
655 a Gaussian random vector $b \sim N(0,M)$ whose covariance matrix is the same as the
656 mass matrix $M_{ij} = (v_i,v_j)$. This property can be ensured if $b = H w$, where
657 $HH^{\mathrm{T}} = M$ and each component $w_i\sim N(0,1)$.
658
659 There is much flexibility in how we may wish to define $H$. In this PR, we
660 define $H = P^{\mathrm{T}} diag(L_e)$, where $P$ is the local-to-global dof assembly matrix
661 and $\mathrm{diag}(L_e)$ is a block-diagonal matrix with $L_e L_e^{\mathrm{T}} = M_e$, where $M_e$ is
662 the element mass matrix for element $e$. A straightforward computation shows
663 that $HH^{\mathrm{T}} = P^{\mathrm{T}} diag(M_e) P = M$, as necessary. */
665{
666#ifdef MFEM_USE_MPI
667 MPI_Comm comm;
668#endif
669 MassIntegrator massinteg;
671
672 // Define random generator with Gaussian distribution
673 std::default_random_engine generator;
674 std::normal_distribution<real_t> dist;
675
676 bool save_factors = false;
677public:
678
679#ifdef MFEM_USE_MPI
680 /** @brief Sets the @a seed_ of the random number generator. A fixed seed
681 allows for a reproducible sequence of white noise vectors. */
683 : LinearFormIntegrator(), comm(MPI_COMM_NULL)
684 {
685 if (seed_ > 0) { SetSeed(seed_); }
686 }
687
688 /** @brief Sets the MPI communicator @a comm_ and the @a seed_ of the random
689 number generator. A fixed seed allows for a reproducible sequence of
690 white noise vectors. */
691 WhiteGaussianNoiseDomainLFIntegrator(MPI_Comm comm_, int seed_)
692 : LinearFormIntegrator(), comm(comm_)
693 {
694 int myid;
695 MPI_Comm_rank(comm, &myid);
696
697 int seed = (seed_ > 0) ? seed_ + myid : time(nullptr) + myid;
698 SetSeed(seed);
699 }
700#else
701 /** @brief Sets the @a seed_ of the random number generator. A fixed seed
702 allows for a reproducible sequence of white noise vectors. */
705 {
706 if (seed_ > 0) { SetSeed(seed_); }
707 }
708#endif
709 /// @brief Sets/resets the @a seed of the random number generator.
710 void SetSeed(int seed)
711 {
712 generator.seed(seed);
713 }
714
718 Vector &elvect) override;
719
720 /** @brief Saves the lower triangular matrices in the element-wise Cholesky
721 decomposition. The parameter @a NE should be the number of elements in
722 the mesh. */
723 void SaveFactors(int NE)
724 {
725 save_factors = true;
726 ResetFactors(NE);
727 }
728
729 /** @brief Resets the array of saved lower triangular Cholesky decomposition
730 matrices. The parameter @a NE should be the number of elements in the
731 mesh. */
732 void ResetFactors(int NE)
733 {
734 for (int i = 0; i<L.Size(); i++)
735 {
736 delete L[i];
737 }
738 L.DeleteAll();
739
740 L.SetSize(NE);
741 for (int i = 0; i<NE; i++)
742 {
743 L[i] = nullptr;
744 }
745 }
746
748 {
749 for (int i = 0; i<L.Size(); i++)
750 {
751 delete L[i];
752 }
753 L.DeleteAll();
754 }
755};
756
757
758/** Class for domain integration of $ L(v) := (f, v) $, where
759 $ f=(f_1,\dots,f_n)$ and $v=(v_1,\dots,v_n)$. that makes use of
760 VectorQuadratureFunctionCoefficient*/
762{
763private:
765
766public:
768 const IntegrationRule *ir = NULL)
769 : LinearFormIntegrator(ir), vqfc(vqfc)
770 {
771 if (ir)
772 {
773 MFEM_WARNING("Integration rule not used in this class. "
774 "The QuadratureFunction integration rules are used instead");
775 }
776 }
777
781 Vector &elvect) override;
782
783 void SetIntRule(const IntegrationRule *ir) override
784 {
785 MFEM_WARNING("Integration rule not used in this class. "
786 "The QuadratureFunction integration rules are used instead");
787 }
788};
789
790
791/** Class for domain integration $ L(v) := (f, v) $ that makes use
792 of QuadratureFunctionCoefficient. */
794{
795private:
797
798public:
800 const IntegrationRule *ir = NULL)
801 : LinearFormIntegrator(ir), qfc(qfc)
802 {
803 if (ir)
804 {
805 MFEM_WARNING("Integration rule not used in this class. "
806 "The QuadratureFunction integration rules are used instead");
807 }
808 }
809
813 Vector &elvect) override;
814
815 void SetIntRule(const IntegrationRule *ir) override
816 {
817 MFEM_WARNING("Integration rule not used in this class. "
818 "The QuadratureFunction integration rules are used instead");
819 }
820};
821
822}
823
824
825#endif
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition array.hpp:840
int Size() const
Return the logical size of the array.
Definition array.hpp:166
void DeleteAll()
Delete the whole array.
Definition array.hpp:1033
BoundaryFlowIntegrator(Coefficient &f_, VectorCoefficient &u_, real_t a, real_t b)
Definition lininteg.hpp:548
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:764
BoundaryFlowIntegrator(Coefficient &f_, VectorCoefficient &u_, real_t a)
Definition lininteg.hpp:544
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:590
DGDirichletLFIntegrator(Coefficient &u, Coefficient &q, const real_t s, const real_t k)
Definition lininteg.hpp:587
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:830
DGDirichletLFIntegrator(Coefficient &u, const real_t s, const real_t k)
Definition lininteg.hpp:585
MatrixCoefficient * MQ
Definition lininteg.hpp:577
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:921
DGElasticityDirichletLFIntegrator(VectorCoefficient &uD_, Coefficient &lambda_, Coefficient &mu_, real_t alpha_, real_t kappa_)
Definition lininteg.hpp:634
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
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.
DomainLFGradIntegrator(VectorCoefficient &QF)
Constructs the domain integrator .
Definition lininteg.hpp:167
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:208
Abstract class for all finite elements.
Definition fe_base.hpp:247
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
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
Base class for Matrix Coefficients that optionally depend on time and space.
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:799
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:815
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:610
VectorBoundaryFluxLFIntegrator(Coefficient &f, real_t s=1.0, const IntegrationRule *ir=NULL)
Definition lininteg.hpp:451
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:484
VectorFEBoundaryFluxLFIntegrator(int a=1, int b=-1)
Definition lininteg.hpp:473
VectorFEBoundaryFluxLFIntegrator(Coefficient &f, int a=2, int b=0)
Definition lininteg.hpp:475
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:643
VectorFEBoundaryNormalLFIntegrator(VectorCoefficient &f)
Definition lininteg.hpp:501
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:675
Class for boundary integration .
Definition lininteg.hpp:512
VectorFEBoundaryTangentLFIntegrator(VectorCoefficient &QG, int a=2, int b=0)
Definition lininteg.hpp:518
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:708
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:556
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:524
VectorFEDomainLFCurlIntegrator(VectorCoefficient &F)
Constructs the domain integrator .
Definition lininteg.hpp:402
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:601
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:573
VectorFEDomainLFDivIntegrator(Coefficient &QF)
Constructs the domain integrator .
Definition lininteg.hpp:424
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Definition lininteg.hpp:365
bool SupportsDevice() const override
Method probing for assembly on device.
Definition lininteg.hpp:383
VectorFEDomainLFIntegrator(VectorCoefficient &F)
Definition lininteg.hpp:372
void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition lininteg.cpp:474
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:508
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
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:783
VectorQuadratureLFIntegrator(VectorQuadratureFunctionCoefficient &vqfc, const IntegrationRule *ir=NULL)
Definition lininteg.hpp:767
Vector data type.
Definition vector.hpp:82
void SetSize(int s)
Resize the vector to size s.
Definition vector.hpp:584
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:691
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:682
void SetSeed(int seed)
Sets/resets the seed of the random number generator.
Definition lininteg.hpp:710
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:732
void SaveFactors(int NE)
Saves the lower triangular matrices in the element-wise Cholesky decomposition. The parameter NE shou...
Definition lininteg.hpp:723
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