MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
bilininteg_vecmass_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 Mesh *mesh = fes.GetMesh();
23 const FiniteElement &el = *fes.GetTypicalFE();
25 const IntegrationRule *ir
26 = IntRule ? IntRule : &MassIntegrator::GetRule(el, el, *T);
27 if (DeviceCanUseCeed())
28 {
29 delete ceedOp;
30 const bool mixed = mesh->GetNumGeometries(mesh->Dimension()) > 1 ||
31 fes.IsVariableOrder();
32 if (mixed)
33 {
34 ceedOp = new ceed::MixedMFMassIntegrator(*this, fes, Q);
35 }
36 else
37 {
38 ceedOp = new ceed::MFMassIntegrator(fes, *ir, Q);
39 }
40 return;
41 }
42 MFEM_ABORT("Error: VectorMassIntegrator::AssembleMF only implemented with"
43 " libCEED");
44}
45
47{
48 if (DeviceCanUseCeed())
49 {
50 ceedOp->AddMult(x, y);
51 }
52 else
53 {
54 MFEM_ABORT("Error: VectorMassIntegrator::AddMultMF only implemented with"
55 " libCEED");
56 }
57}
58
60{
61 if (DeviceCanUseCeed())
62 {
63 ceedOp->GetDiagonal(diag);
64 }
65 else
66 {
67 MFEM_ABORT("Error: VectorMassIntegrator::AssembleDiagonalMF only"
68 " implemented with libCEED");
69 }
70}
71
72} // namespace mfem
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
static const IntegrationRule & GetRule(const FiniteElement &trial_fe, const FiniteElement &test_fe, const ElementTransformation &Trans)
Mesh data type.
Definition mesh.hpp:64
int Dimension() const
Dimension of the reference space used within the elements.
Definition mesh.hpp:1216
ElementTransformation * GetTypicalElementTransformation()
If the local mesh is not empty return GetElementTransformation(0); otherwise, return the identity tra...
Definition mesh.cpp:390
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
Definition mesh.cpp:7243
void AssembleMF(const FiniteElementSpace &fes) override
Method defining matrix-free assembly.
void AddMultMF(const Vector &x, Vector &y) const override
void AssembleDiagonalMF(Vector &diag) override
Assemble diagonal and add it to Vector diag.
Vector data type.
Definition vector.hpp:82
Represent a MassIntegrator with AssemblyLevel::None using libCEED.
Definition mass.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