MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
lininteg.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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 
20 namespace mfem
21 {
22 
23 /// Abstract base class LinearFormIntegrator
25 {
26 protected:
28 
29  LinearFormIntegrator(const IntegrationRule *ir = NULL) { IntRule = ir; }
30 
31 public:
32 
33  /// Method probing for assembly on device
34  virtual bool SupportsDevice() { return false; }
35 
36  /// Method defining assembly on device
37  virtual void AssembleDevice(const FiniteElementSpace &fes,
38  const Array<int> &markers,
39  Vector &b);
40 
41  /** Given a particular Finite Element and a transformation (Tr)
42  computes the element vector, elvect. */
43  virtual void AssembleRHSElementVect(const FiniteElement &el,
45  Vector &elvect) = 0;
46  virtual void AssembleRHSElementVect(const FiniteElement &el,
48  Vector &elvect);
49  virtual void AssembleRHSElementVect(const FiniteElement &el1,
50  const FiniteElement &el2,
52  Vector &elvect);
53 
54  virtual void SetIntRule(const IntegrationRule *ir) { IntRule = ir; }
55  const IntegrationRule* GetIntRule() { return IntRule; }
56 
57  virtual ~LinearFormIntegrator() { }
58 };
59 
60 
61 /// Abstract class for integrators that support delta coefficients
63 {
64 protected:
67 
68  /** @brief This constructor should be used by derived classes that use a
69  scalar DeltaCoefficient. */
72  delta(dynamic_cast<DeltaCoefficient*>(&q)),
73  vec_delta(NULL) { }
74 
75  /** @brief This constructor should be used by derived classes that use a
76  VectorDeltaCoefficient. */
78  const IntegrationRule *ir = NULL)
80  delta(NULL),
81  vec_delta(dynamic_cast<VectorDeltaCoefficient*>(&vq)) { }
82 
83 public:
84  /// Returns true if the derived class instance uses a delta coefficient.
85  bool IsDelta() const { return (delta || vec_delta); }
86 
87  /// Returns the center of the delta coefficient.
88  void GetDeltaCenter(Vector &center)
89  {
90  if (delta) { delta->GetDeltaCenter(center); return; }
91  if (vec_delta) { vec_delta->GetDeltaCenter(center); return; }
92  center.SetSize(0);
93  }
94 
95  /** @brief Assemble the delta coefficient at the IntegrationPoint set in
96  @a Trans which is assumed to map to the delta coefficient center.
97 
98  @note This method should be called for one mesh element only, including
99  in parallel, even when the center of the delta coefficient is shared by
100  multiple elements. */
101  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
103  Vector &elvect) = 0;
104 };
105 
106 
107 /// Class for domain integration L(v) := (f, v)
109 {
110  Vector shape;
111  Coefficient &Q;
112  int oa, ob;
113 public:
114  /// Constructs a domain integrator with a given Coefficient
115  DomainLFIntegrator(Coefficient &QF, int a = 2, int b = 0)
116  // the old default was a = 1, b = 1
117  // for simple elliptic problems a = 2, b = -2 is OK
118  : DeltaLFIntegrator(QF), Q(QF), oa(a), ob(b) { }
119 
120  /// Constructs a domain integrator with a given Coefficient
122  : DeltaLFIntegrator(QF, ir), Q(QF), oa(1), ob(1) { }
123 
124  virtual bool SupportsDevice() { return true; }
125 
126  /// Method defining assembly on device
127  virtual void AssembleDevice(const FiniteElementSpace &fes,
128  const Array<int> &markers,
129  Vector &b);
130 
131  /** Given a particular Finite Element and a transformation (Tr)
132  computes the element right hand side element vector, elvect. */
133  virtual void AssembleRHSElementVect(const FiniteElement &el,
135  Vector &elvect);
136 
137  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
139  Vector &elvect);
140 
142 };
143 
144 /// Class for domain integrator L(v) := (f, grad v)
146 {
147 private:
148  Vector shape, Qvec;
150  DenseMatrix dshape;
151 
152 public:
153  /// Constructs the domain integrator (Q, grad v)
155  : DeltaLFIntegrator(QF), Q(QF) { }
156 
157  virtual bool SupportsDevice() { return true; }
158 
159  /// Method defining assembly on device
160  virtual void AssembleDevice(const FiniteElementSpace &fes,
161  const Array<int> &markers,
162  Vector &b);
163 
164  /** Given a particular Finite Element and a transformation (Tr)
165  computes the element right hand side element vector, elvect. */
166  virtual void AssembleRHSElementVect(const FiniteElement &el,
168  Vector &elvect);
169 
170  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
172  Vector &elvect);
173 
175 };
176 
177 
178 /// Class for boundary integration L(v) := (g, v)
180 {
181  Vector shape;
182  Coefficient &Q;
183  int oa, ob;
184 public:
185  /** @brief Constructs a boundary integrator with a given Coefficient @a QG.
186  Integration order will be @a a * basis_order + @a b. */
187  BoundaryLFIntegrator(Coefficient &QG, int a = 1, int b = 1)
188  : Q(QG), oa(a), ob(b) { }
189 
190  virtual bool SupportsDevice() { return true; }
191 
192  /// Method defining assembly on device
193  virtual void AssembleDevice(const FiniteElementSpace &fes,
194  const Array<int> &markers,
195  Vector &b);
196 
197  /** Given a particular boundary Finite Element and a transformation (Tr)
198  computes the element boundary vector, elvect. */
199  virtual void AssembleRHSElementVect(const FiniteElement &el,
201  Vector &elvect);
202  virtual void AssembleRHSElementVect(const FiniteElement &el,
204  Vector &elvect);
205 
207 };
208 
209 /// Class for boundary integration \f$ L(v) = (g \cdot n, v) \f$
211 {
212  Vector shape;
214  int oa, ob;
215 public:
216  /// Constructs a boundary integrator with a given Coefficient QG
218  : Q(QG), oa(a), ob(b) { }
219 
220  virtual bool SupportsDevice() { return true; }
221 
222  /// Method defining assembly on device
223  virtual void AssembleDevice(const FiniteElementSpace &fes,
224  const Array<int> &markers,
225  Vector &b);
226 
227  virtual void AssembleRHSElementVect(const FiniteElement &el,
229  Vector &elvect);
230 
232 };
233 
234 /// Class for boundary integration \f$ L(v) = (g \cdot \tau, v) \f$ in 2D
236 {
237  Vector shape;
239  int oa, ob;
240 public:
241  /// Constructs a boundary integrator with a given Coefficient QG
243  : Q(QG), oa(a), ob(b) { }
244 
245  virtual void AssembleRHSElementVect(const FiniteElement &el,
247  Vector &elvect);
248 
250 };
251 
252 /** Class for domain integration of L(v) := (f, v), where
253  f=(f1,...,fn) and v=(v1,...,vn). */
255 {
256 private:
257  Vector shape, Qvec;
259 
260 public:
261  /// Constructs a domain integrator with a given VectorCoefficient
263  : DeltaLFIntegrator(QF), Q(QF) { }
264 
265  virtual bool SupportsDevice() { return true; }
266 
267  /// Method defining assembly on device
268  virtual void AssembleDevice(const FiniteElementSpace &fes,
269  const Array<int> &markers,
270  Vector &b);
271 
272  /** Given a particular Finite Element and a transformation (Tr)
273  computes the element right hand side element vector, elvect. */
274  virtual void AssembleRHSElementVect(const FiniteElement &el,
276  Vector &elvect);
277 
278  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
280  Vector &elvect);
281 
283 };
284 
285 /** Class for domain integrator L(v) := (f, grad v), where
286  f=(f1x,f1y,f1z,...,fnx,fny,fnz) and v=(v1,...,vn). */
288 {
289 private:
290  Vector shape, Qvec;
292  DenseMatrix dshape;
293 
294 public:
295  /// Constructs the domain integrator (Q, grad v)
297  : DeltaLFIntegrator(QF), Q(QF) { }
298 
299  virtual bool SupportsDevice() override { return true; }
300 
301  /// Method defining assembly on device
302  virtual void AssembleDevice(const FiniteElementSpace &fes,
303  const Array<int> &markers,
304  Vector &b) override;
305 
306  /** Given a particular Finite Element and a transformation (Tr)
307  computes the element right hand side element vector, elvect. */
308  virtual void AssembleRHSElementVect(const FiniteElement &el,
310  Vector &elvect) override;
311 
312  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
314  Vector &elvect) override;
315 
317 };
318 
319 /** Class for boundary integration of L(v) := (g, v), where
320  f=(f1,...,fn) and v=(v1,...,vn). */
322 {
323 private:
324  Vector shape, vec;
326 
327 public:
328  /// Constructs a boundary integrator with a given VectorCoefficient QG
330 
331  /** Given a particular boundary Finite Element and a transformation (Tr)
332  computes the element boundary vector, elvect. */
333  virtual void AssembleRHSElementVect(const FiniteElement &el,
335  Vector &elvect);
336 
337  // For DG spaces
338  virtual void AssembleRHSElementVect(const FiniteElement &el,
340  Vector &elvect);
341 
343 };
344 
345 /// \f$ (f, v)_{\Omega} \f$ for VectorFiniteElements (Nedelec, Raviart-Thomas)
347 {
348 private:
349  VectorCoefficient &QF;
350  DenseMatrix vshape;
351  Vector vec;
352 
353 public:
355  : DeltaLFIntegrator(F), QF(F) { }
356 
357  virtual void AssembleRHSElementVect(const FiniteElement &el,
359  Vector &elvect);
360 
361  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
363  Vector &elvect);
364 
366 };
367 
368 /// \f$ (Q, curl v)_{\Omega} \f$ for Nedelec Elements)
370 {
371 private:
372  VectorCoefficient *QF=nullptr;
373  DenseMatrix curlshape;
374  Vector vec;
375 
376 public:
377  /// Constructs the domain integrator (Q, curl v)
379  : DeltaLFIntegrator(F), QF(&F) { }
380 
381  virtual void AssembleRHSElementVect(const FiniteElement &el,
383  Vector &elvect);
384 
385  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
387  Vector &elvect);
388 
390 };
391 
392 /// \f$ (Q, div v)_{\Omega} \f$ for RT Elements)
394 {
395 private:
396  Vector divshape;
397  Coefficient &Q;
398 public:
399  /// Constructs the domain integrator (Q, div v)
401  : DeltaLFIntegrator(QF), Q(QF) { }
402 
403  /** Given a particular Finite Element and a transformation (Tr)
404  computes the element right hand side element vector, elvect. */
405  virtual void AssembleRHSElementVect(const FiniteElement &el,
407  Vector &elvect);
408 
409  virtual void AssembleDeltaElementVect(const FiniteElement &fe,
411  Vector &elvect);
412 
414 };
415 
416 /** \f$ (f, v \cdot n)_{\partial\Omega} \f$ for vector test function
417  v=(v1,...,vn) where all vi are in the same scalar FE space and f is a
418  scalar function. */
420 {
421 private:
422  double Sign;
423  Coefficient *F;
424  Vector shape, nor;
425 
426 public:
428  const IntegrationRule *ir = NULL)
429  : LinearFormIntegrator(ir), Sign(s), F(&f) { }
430 
431  virtual void AssembleRHSElementVect(const FiniteElement &el,
433  Vector &elvect);
434 
436 };
437 
438 /** Class for boundary integration of (f, v.n) for scalar coefficient f and
439  RT vector test function v. This integrator works with RT spaces defined
440  using the RT_FECollection class. */
442 {
443 private:
444  Coefficient *F;
445  Vector shape;
446  int oa, ob; // these control the quadrature order, see DomainLFIntegrator
447 
448 public:
450  : F(NULL), oa(a), ob(b) { }
452  : F(&f), oa(a), ob(b) { }
453 
454  virtual void AssembleRHSElementVect(const FiniteElement &el,
456  Vector &elvect);
457 
459 };
460 
461 /// Class for boundary integration \f$ L(v) = (n \times f, v) \f$
463 {
464 private:
466  int oa, ob;
467 
468 public:
470  int a = 2, int b = 0)
471  : f(QG), oa(a), ob(b) { }
472 
473  virtual void AssembleRHSElementVect(const FiniteElement &el,
475  Vector &elvect);
476 
478 };
479 
480 
481 /** Class for boundary integration of the linear form:
482  (alpha/2) < (u.n) f, w > - beta < |u.n| f, w >,
483  where f and u are given scalar and vector coefficients, respectively,
484  and w is the scalar test function. */
486 {
487 private:
488  Coefficient *f;
490  double alpha, beta;
491 
492  Vector shape;
493 
494 public:
496  double a)
497  { f = &f_; u = &u_; alpha = a; beta = 0.5*a; }
498 
500  double a, double b)
501  { f = &f_; u = &u_; alpha = a; beta = b; }
502 
503  virtual void AssembleRHSElementVect(const FiniteElement &el,
505  Vector &elvect);
506  virtual void AssembleRHSElementVect(const FiniteElement &el,
508  Vector &elvect);
509 
511 };
512 
513 
514 /** Boundary linear integrator for imposing non-zero Dirichlet boundary
515  conditions, to be used in conjunction with DGDiffusionIntegrator.
516  Specifically, given the Dirichlet data u_D, the linear form assembles the
517  following integrals on the boundary:
518 
519  sigma < u_D, (Q grad(v)).n > + kappa < {h^{-1} Q} u_D, v >,
520 
521  where Q is a scalar or matrix diffusion coefficient and v is the test
522  function. The parameters sigma and kappa should be the same as the ones
523  used in the DGDiffusionIntegrator. */
525 {
526 protected:
529  double sigma, kappa;
530 
531  // these are not thread-safe!
534 
535 public:
536  DGDirichletLFIntegrator(Coefficient &u, const double s, const double k)
537  : uD(&u), Q(NULL), MQ(NULL), sigma(s), kappa(k) { }
539  const double s, const double k)
540  : uD(&u), Q(&q), MQ(NULL), sigma(s), kappa(k) { }
542  const double s, const double k)
543  : uD(&u), Q(NULL), MQ(&q), sigma(s), kappa(k) { }
544 
545  virtual void AssembleRHSElementVect(const FiniteElement &el,
547  Vector &elvect);
548  virtual void AssembleRHSElementVect(const FiniteElement &el,
550  Vector &elvect);
551 
553 };
554 
555 
556 /** Boundary linear form integrator for imposing non-zero Dirichlet boundary
557  conditions, in a DG elasticity formulation. Specifically, the linear form is
558  given by
559 
560  alpha < u_D, (lambda div(v) I + mu (grad(v) + grad(v)^T)) . n > +
561  + kappa < h^{-1} (lambda + 2 mu) u_D, v >,
562 
563  where u_D is the given Dirichlet data. The parameters alpha, kappa, lambda
564  and mu, should match the parameters with the same names used in the bilinear
565  form integrator, DGElasticityIntegrator. */
567 {
568 protected:
571  double alpha, kappa;
572 
573 #ifndef MFEM_THREAD_SAFE
582 #endif
583 
584 public:
586  Coefficient &lambda_, Coefficient &mu_,
587  double alpha_, double kappa_)
588  : uD(uD_), lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
589 
590  virtual void AssembleRHSElementVect(const FiniteElement &el,
592  Vector &elvect);
593  virtual void AssembleRHSElementVect(const FiniteElement &el,
595  Vector &elvect);
596 
598 };
599 
600 
601 /** Class for spatial white Gaussian noise integration.
602 
603  The target problem is the linear SPDE a(u,v) = F(v) with F(v) := <Ẇ,v>,
604  where Ẇ is spatial white Gaussian noise. When the Galerkin method is used to
605  discretize this problem into a linear system of equations Ax = b, the RHS is
606  a Gaussian random vector b~N(0,M) whose covariance matrix is the same as the
607  mass matrix M_ij = (v_i,v_j). This property can be ensured if b = H w, where
608  HHáµ€ = M and each component w_i~N(0,1).
609 
610  There is much flexibility in how we may wish to define H. In this PR, we
611  define H = Páµ€ diag(L_e), where P is the local-to-global dof assembly matrix
612  and diag(L_e) is a block-diagonal matrix with L_e L_eáµ€ = M_e, where M_e is
613  the element mass matrix for element e. A straightforward computation shows
614  that HHáµ€ = Páµ€ diag(M_e) P = M, as necessary. */
616 {
617 #ifdef MFEM_USE_MPI
618  MPI_Comm comm;
619 #endif
620  MassIntegrator massinteg;
622 
623  // Define random generator with Gaussian distribution
624  std::default_random_engine generator;
625  std::normal_distribution<double> dist;
626 
627  bool save_factors = false;
628 public:
629 
630 #ifdef MFEM_USE_MPI
631  /** @brief Sets the @a seed_ of the random number generator. A fixed seed
632  allows for a reproducible sequence of white noise vectors. */
634  : LinearFormIntegrator(), comm(MPI_COMM_NULL)
635  {
636  if (seed_ > 0) { SetSeed(seed_); }
637  }
638 
639  /** @brief Sets the MPI communicator @a comm_ and the @a seed_ of the random
640  number generator. A fixed seed allows for a reproducible sequence of
641  white noise vectors. */
642  WhiteGaussianNoiseDomainLFIntegrator(MPI_Comm comm_, int seed_)
643  : LinearFormIntegrator(), comm(comm_)
644  {
645  int myid;
646  MPI_Comm_rank(comm, &myid);
647 
648  int seed = (seed_ > 0) ? seed_ + myid : time(0) + myid;
649  SetSeed(seed);
650  }
651 #else
652  /** @brief Sets the @a seed_ of the random number generator. A fixed seed
653  allows for a reproducible sequence of white noise vectors. */
656  {
657  if (seed_ > 0) { SetSeed(seed_); }
658  }
659 #endif
660  /// @brief Sets/resets the @a seed of the random number generator.
661  void SetSeed(int seed)
662  {
663  generator.seed(seed);
664  }
665 
667  virtual void AssembleRHSElementVect(const FiniteElement &el,
669  Vector &elvect);
670 
671  /** @brief Saves the lower triangular matrices in the element-wise Cholesky
672  decomposition. The parameter @a NE should be the number of elements in
673  the mesh. */
674  void SaveFactors(int NE)
675  {
676  save_factors = true;
677  ResetFactors(NE);
678  }
679 
680  /** @brief Resets the array of saved lower triangular Cholesky decomposition
681  matrices. The parameter @a NE should be the number of elements in the
682  mesh. */
683  void ResetFactors(int NE)
684  {
685  for (int i = 0; i<L.Size(); i++)
686  {
687  delete L[i];
688  }
689  L.DeleteAll();
690 
691  L.SetSize(NE);
692  for (int i = 0; i<NE; i++)
693  {
694  L[i] = nullptr;
695  }
696  }
697 
699  {
700  for (int i = 0; i<L.Size(); i++)
701  {
702  delete L[i];
703  }
704  L.DeleteAll();
705  }
706 };
707 
708 
709 /** Class for domain integration of L(v) := (f, v), where
710  f=(f1,...,fn) and v=(v1,...,vn). that makes use of
711  VectorQuadratureFunctionCoefficient*/
713 {
714 private:
716 
717 public:
719  const IntegrationRule *ir)
720  : LinearFormIntegrator(ir), vqfc(vqfc)
721  {
722  if (ir)
723  {
724  MFEM_WARNING("Integration rule not used in this class. "
725  "The QuadratureFunction integration rules are used instead");
726  }
727  }
728 
730  virtual void AssembleRHSElementVect(const FiniteElement &fe,
732  Vector &elvect);
733 
734  virtual void SetIntRule(const IntegrationRule *ir)
735  {
736  MFEM_WARNING("Integration rule not used in this class. "
737  "The QuadratureFunction integration rules are used instead");
738  }
739 };
740 
741 
742 /** Class for domain integration L(v) := (f, v) that makes use
743  of QuadratureFunctionCoefficient. */
745 {
746 private:
748 
749 public:
751  const IntegrationRule *ir)
752  : LinearFormIntegrator(ir), qfc(qfc)
753  {
754  if (ir)
755  {
756  MFEM_WARNING("Integration rule not used in this class. "
757  "The QuadratureFunction integration rules are used instead");
758  }
759  }
760 
762  virtual void AssembleRHSElementVect(const FiniteElement &fe,
764  Vector &elvect);
765 
766  virtual void SetIntRule(const IntegrationRule *ir)
767  {
768  MFEM_WARNING("Integration rule not used in this class. "
769  "The QuadratureFunction integration rules are used instead");
770  }
771 };
772 
773 }
774 
775 
776 #endif
Abstract class for all finite elements.
Definition: fe_base.hpp:235
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition: lininteg.cpp:111
virtual bool SupportsDevice()
Method probing for assembly on device.
Definition: lininteg.hpp:220
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:623
Class for domain integration L(v) := (f, v)
Definition: lininteg.hpp:108
void GetDeltaCenter(Vector &center)
VectorFEDomainLFCurlIntegrator(VectorCoefficient &F)
Constructs the domain integrator (Q, curl v)
Definition: lininteg.hpp:378
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition: lininteg.cpp:581
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:1007
Base class for vector Coefficients that optionally depend on time and space.
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:553
void SetSize(int s)
Resize the vector to size s.
Definition: vector.hpp:513
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:711
VectorBoundaryLFIntegrator(VectorCoefficient &QG)
Constructs a boundary integrator with a given VectorCoefficient QG.
Definition: lininteg.hpp:329
Class for domain integrator L(v) := (f, grad v)
Definition: lininteg.hpp:145
BoundaryNormalLFIntegrator(VectorCoefficient &QG, int a=1, int b=1)
Constructs a boundary integrator with a given Coefficient QG.
Definition: lininteg.hpp:217
DGElasticityDirichletLFIntegrator(VectorCoefficient &uD_, Coefficient &lambda_, Coefficient &mu_, double alpha_, double kappa_)
Definition: lininteg.hpp:585
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:868
Vector quadrature function coefficient which requires that the quadrature rules used for this vector ...
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:79
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:633
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition: lininteg.cpp:70
A specialized ElementTransformation class representing a face and its two neighboring elements...
Definition: eltrans.hpp:480
DeltaLFIntegrator(VectorCoefficient &vq, const IntegrationRule *ir=NULL)
This constructor should be used by derived classes that use a VectorDeltaCoefficient.
Definition: lininteg.hpp:77
virtual ~LinearFormIntegrator()
Definition: lininteg.hpp:57
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
Delta function coefficient optionally multiplied by a weight coefficient and a scaled time dependent ...
const IntegrationRule * GetIntRule()
Definition: lininteg.hpp:55
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:269
Class for boundary integration L(v) := (g, v)
Definition: lininteg.hpp:179
virtual void SetIntRule(const IntegrationRule *ir)
Definition: lininteg.hpp:54
const IntegrationRule * IntRule
Definition: lininteg.hpp:27
BoundaryFlowIntegrator(Coefficient &f_, VectorCoefficient &u_, double a, double b)
Definition: lininteg.hpp:499
DGDirichletLFIntegrator(Coefficient &u, const double s, const double k)
Definition: lininteg.hpp:536
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:127
Abstract base class LinearFormIntegrator.
Definition: lininteg.hpp:24
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
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:642
void GetDeltaCenter(Vector &center)
Returns the center of the delta coefficient.
Definition: lininteg.hpp:88
LinearFormIntegrator(const IntegrationRule *ir=NULL)
Definition: lininteg.hpp:29
VectorBoundaryFluxLFIntegrator(Coefficient &f, double s=1.0, const IntegrationRule *ir=NULL)
Definition: lininteg.hpp:427
DomainLFGradIntegrator(VectorCoefficient &QF)
Constructs the domain integrator (Q, grad v)
Definition: lininteg.hpp:154
Quadrature function coefficient which requires that the quadrature rules used for this coefficient be...
double f(const Vector &xvec)
Definition: lor_mms.hpp:32
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
virtual 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:370
BoundaryFlowIntegrator(Coefficient &f_, VectorCoefficient &u_, double a)
Definition: lininteg.hpp:495
Class for boundary integration .
Definition: lininteg.hpp:210
DomainLFIntegrator(Coefficient &QF, int a=2, int b=0)
Constructs a domain integrator with a given Coefficient.
Definition: lininteg.hpp:115
double b
Definition: lissajous.cpp:42
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:376
VectorFEBoundaryFluxLFIntegrator(int a=1, int b=-1)
Definition: lininteg.hpp:449
VectorFEBoundaryTangentLFIntegrator(VectorCoefficient &QG, int a=2, int b=0)
Definition: lininteg.hpp:469
virtual bool SupportsDevice()
Method probing for assembly on device.
Definition: lininteg.hpp:157
virtual bool SupportsDevice()
Method probing for assembly on device.
Definition: lininteg.hpp:124
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:187
VectorDeltaCoefficient * vec_delta
Definition: lininteg.hpp:66
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition: lininteg.cpp:536
MatrixCoefficient * MQ
Definition: lininteg.hpp:528
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
Definition: lininteg.cpp:19
VectorFEBoundaryFluxLFIntegrator(Coefficient &f, int a=2, int b=0)
Definition: lininteg.hpp:451
void SetSeed(int seed)
Sets/resets the seed of the random number generator.
Definition: lininteg.hpp:661
bool IsDelta() const
Returns true if the derived class instance uses a delta coefficient.
Definition: lininteg.hpp:85
virtual void SetIntRule(const IntegrationRule *ir)
Definition: lininteg.hpp:734
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:229
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:777
DomainLFIntegrator(Coefficient &QF, const IntegrationRule *ir)
Constructs a domain integrator with a given Coefficient.
Definition: lininteg.hpp:121
void GetDeltaCenter(Vector &center)
Write the center of the delta function into center.
virtual bool SupportsDevice() override
Method probing for assembly on device.
Definition: lininteg.hpp:299
VectorFEDomainLFDivIntegrator(Coefficient &QF)
Constructs the domain integrator (Q, div v)
Definition: lininteg.hpp:400
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)=0
DeltaLFIntegrator(Coefficient &q, const IntegrationRule *ir=NULL)
This constructor should be used by derived classes that use a scalar DeltaCoefficient.
Definition: lininteg.hpp:70
QuadratureLFIntegrator(QuadratureFunctionCoefficient &qfc, const IntegrationRule *ir)
Definition: lininteg.hpp:750
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:96
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Definition: coefficient.hpp:41
DeltaCoefficient * delta
Definition: lininteg.hpp:65
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
Base class for Matrix Coefficients that optionally depend on time and space.
Abstract class for integrators that support delta coefficients.
Definition: lininteg.hpp:62
VectorDomainLFIntegrator(VectorCoefficient &QF)
Constructs a domain integrator with a given VectorCoefficient.
Definition: lininteg.hpp:262
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:590
VectorFEDomainLFIntegrator(VectorCoefficient &F)
Definition: lininteg.hpp:354
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
Vector coefficient defined by a scalar DeltaCoefficient and a constant vector direction.
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:655
double a
Definition: lissajous.cpp:41
for Nedelec Elements)
Definition: lininteg.hpp:369
void ResetFactors(int NE)
Resets the array of saved lower triangular Cholesky decomposition matrices. The parameter NE should b...
Definition: lininteg.hpp:683
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition: lininteg.cpp:488
BoundaryTangentialLFIntegrator(VectorCoefficient &QG, int a=1, int b=1)
Constructs a boundary integrator with a given Coefficient QG.
Definition: lininteg.hpp:242
virtual void SetIntRule(const IntegrationRule *ir)
Definition: lininteg.hpp:766
virtual void AssembleRHSElementVect(const FiniteElement &fe, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:1045
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:190
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:504
virtual bool SupportsDevice()
Method probing for assembly on device.
Definition: lininteg.hpp:190
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Definition: lininteg.hpp:346
virtual void AssembleRHSElementVect(const FiniteElement &fe, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:1076
virtual void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b)
Method defining assembly on device.
Vector data type.
Definition: vector.hpp:60
void SaveFactors(int NE)
Saves the lower triangular matrices in the element-wise Cholesky decomposition. The parameter NE shou...
Definition: lininteg.hpp:674
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:454
virtual bool SupportsDevice()
Method probing for assembly on device.
Definition: lininteg.hpp:34
Class for boundary integration .
Definition: lininteg.hpp:462
VectorDomainLFGradIntegrator(VectorCoefficient &QF)
Constructs the domain integrator (Q, grad v)
Definition: lininteg.hpp:296
RefCoord s[3]
virtual void AssembleDeltaElementVect(const FiniteElement &fe, ElementTransformation &Trans, Vector &elvect)
Assemble the delta coefficient at the IntegrationPoint set in Trans which is assumed to map to the de...
Definition: lininteg.cpp:311
double u(const Vector &xvec)
Definition: lor_mms.hpp:24
DGDirichletLFIntegrator(Coefficient &u, MatrixCoefficient &q, const double s, const double k)
Definition: lininteg.hpp:541
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
Definition: lininteg.cpp:39
Class for boundary integration in 2D.
Definition: lininteg.hpp:235
VectorQuadratureLFIntegrator(VectorQuadratureFunctionCoefficient &vqfc, const IntegrationRule *ir)
Definition: lininteg.hpp:718
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect) override
Definition: lininteg.cpp:328
DGDirichletLFIntegrator(Coefficient &u, Coefficient &q, const double s, const double k)
Definition: lininteg.hpp:538
virtual bool SupportsDevice()
Method probing for assembly on device.
Definition: lininteg.hpp:265
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...