MFEM v4.8.0
Finite element discretization library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bilininteg_diffusion_mf.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 "../bilininteg.hpp"
13#include "../gridfunc.hpp"
15
16namespace mfem
17{
18
20{
21 // Assuming the same element type
22 fespace = &fes;
23 Mesh *mesh = fes.GetMesh();
24 const FiniteElement &el = *fes.GetTypicalFE();
25 const IntegrationRule *ir = IntRule ? IntRule : &GetRule(el, el);
26 if (DeviceCanUseCeed())
27 {
28 delete ceedOp;
29 MFEM_VERIFY(!VQ && !MQ,
30 "Only scalar coefficient supported for DiffusionIntegrator"
31 " with libCEED");
32 const bool mixed = mesh->GetNumGeometries(mesh->Dimension()) > 1 ||
33 fes.IsVariableOrder();
34 if (mixed)
35 {
36 ceedOp = new ceed::MixedMFDiffusionIntegrator(*this, fes, Q);
37 }
38 else
39 {
40 ceedOp = new ceed::MFDiffusionIntegrator(fes, *ir, Q);
41 }
42 return;
43 }
44 MFEM_ABORT("Error: DiffusionIntegrator::AssembleMF only implemented with"
45 " libCEED");
46}
47
49{
50 if (DeviceCanUseCeed())
51 {
52 ceedOp->GetDiagonal(diag);
53 }
54 else
55 {
56 MFEM_ABORT("Error: DiffusionIntegrator::AssembleDiagonalMF only"
57 " implemented with libCEED");
58 }
59}
60
62{
63 if (DeviceCanUseCeed())
64 {
65 ceedOp->AddMult(x, y);
66 }
67 else
68 {
69 MFEM_ABORT("Error: DiffusionIntegrator::AddMultMF only implemented with"
70 " libCEED");
71 }
72}
73
74}
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe)
void AddMultMF(const Vector &, Vector &) const override
MatrixCoefficient * MQ
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
VectorCoefficient * VQ
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:244
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
Definition fespace.hpp:709
Mesh * GetMesh() const
Returns the mesh.
Definition fespace.hpp:679
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
Definition fespace.cpp:3871
Abstract class for all finite elements.
Definition fe_base.hpp:244
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
const IntegrationRule * IntRule
Mesh data type.
Definition mesh.hpp:64
int Dimension() const
Dimension of the reference space used within the elements.
Definition mesh.hpp:1216
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
Definition mesh.cpp:7243
Vector data type.
Definition vector.hpp:82
Represent a DiffusionIntegrator with AssemblyLevel::None using libCEED.
Definition diffusion.hpp:48
void GetDiagonal(mfem::Vector &diag) const
Definition operator.cpp:104
void AddMult(const mfem::Vector &x, mfem::Vector &y, const real_t a=1.0) const override
Operator application: y+=A(x) (default) or y+=a*A(x).
Definition operator.cpp:72
bool DeviceCanUseCeed()
Function that determines if a CEED kernel should be used, based on the current mfem::Device configura...
Definition util.cpp:33