MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
lininteg_domain.cpp
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#include "../../fem/kernels.hpp"
14#include "../fem.hpp"
15
17
18/// \cond DO_NOT_DOCUMENT
19
20namespace mfem
21{
22static void DLFEvalAssemble(const FiniteElementSpace &fes,
23 const IntegrationRule *ir,
24 const Array<int> &markers, const Vector &coeff,
25 Vector &y)
26{
27 Mesh *mesh = fes.GetMesh();
28 const int dim = mesh->Dimension();
29 const FiniteElement &el = *fes.GetTypicalFE();
31 const DofToQuad &maps = el.GetDofToQuad(*ir, DofToQuad::TENSOR);
32 const int d = maps.ndof, q = maps.nqpt;
33 constexpr int flags = GeometricFactors::DETERMINANTS;
34 const GeometricFactors *geom = mesh->GetGeometricFactors(*ir, flags, mt);
35 const int map_type = fes.GetTypicalFE()->GetMapType();
36
37 const int vdim = fes.GetVDim();
38 const int ne = fes.GetMesh()->GetNE();
39 const real_t *B = maps.B.Read();
40 const int *M = markers.Read();
41 const real_t *detJ = geom->detJ.Read();
42 const real_t *W = ir->GetWeights().Read();
43 real_t *Y = y.ReadWrite();
44 DomainLFIntegrator::AssembleKernels::Run(dim, d, q, vdim, ne, d, q, map_type,
45 M, B, detJ, W, coeff, Y);
46}
47
48void DomainLFIntegrator::AssembleDevice(const FiniteElementSpace &fes,
49 const Array<int> &markers, Vector &b)
50{
51 const FiniteElement &fe = *fes.GetTypicalFE();
52 const int qorder = oa * fe.GetOrder() + ob;
53 const Geometry::Type gtype = fe.GetGeomType();
54 const IntegrationRule *ir = IntRule ? IntRule : &IntRules.Get(gtype, qorder);
55
56 QuadratureSpace qs(*fes.GetMesh(), *ir);
57 CoefficientVector coeff(Q, qs, CoefficientStorage::COMPRESSED);
58 DLFEvalAssemble(fes, ir, markers, coeff, b);
59}
60
61void VectorDomainLFIntegrator::AssembleDevice(const FiniteElementSpace &fes,
62 const Array<int> &markers,
63 Vector &b)
64{
65 const FiniteElement &fe = *fes.GetTypicalFE();
66 const int qorder = 2 * fe.GetOrder();
67 const Geometry::Type gtype = fe.GetGeomType();
68 const IntegrationRule *ir = IntRule ? IntRule : &IntRules.Get(gtype, qorder);
69
70 QuadratureSpace qs(*fes.GetMesh(), *ir);
71 CoefficientVector coeff(Q, qs, CoefficientStorage::COMPRESSED);
72 DLFEvalAssemble(fes, ir, markers, coeff, b);
73}
74
76DomainLFIntegrator::AssembleKernels::Fallback(int DIM, int, int)
77{
78 switch (DIM)
79 {
80 case 1:
81 return DLFEvalAssemble1D<0, 0>;
82 case 2:
83 return DLFEvalAssemble2D<0, 0>;
84 case 3:
85 return DLFEvalAssemble3D<0, 0>;
86 }
87 MFEM_ABORT("");
88}
89
90DomainLFIntegrator::Kernels::Kernels()
91{
92 // 2D
93 // Q = P+1
99 // Q = P+2
104 // 3D
105 // Q = P+1
111 // Q = P+2
116}
117
118/// \endcond DO_NOT_DOCUMENT
119
120} // namespace mfem
static MemoryType GetDeviceMemoryType()
Get the current Device MemoryType. This is the MemoryType used by most MFEM classes when allocating m...
Definition device.hpp:277
@ TENSOR
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
Definition fe_base.hpp:165
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.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
const IntegrationRule * IntRule
void AssembleDevice(const FiniteElementSpace &fes, const Array< int > &markers, Vector &b) override
Method defining assembly on device.
int dim
Definition ex24.cpp:53
real_t b
Definition lissajous.cpp:42
constexpr int DIM
mfem::real_t real_t
@ COMPRESSED
Enable all above compressions.
MemoryType
Memory types supported by MFEM.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
Definition intrules.hpp:492