MFEM  v4.4.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bilininteg_vecmass_mf.cpp
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 #include "../general/forall.hpp"
13 #include "bilininteg.hpp"
14 #include "gridfunc.hpp"
15 #include "ceed/mass.hpp"
16 
17 using namespace std;
18 
19 namespace mfem
20 {
21 
22 // MF Mass Integrator
23 
24 // MF Mass Assemble kernel
25 void VectorMassIntegrator::AssembleMF(const FiniteElementSpace &fes)
26 {
27  // Assuming the same element type
28  Mesh *mesh = fes.GetMesh();
29  if (mesh->GetNE() == 0) { return; }
30  const FiniteElement &el = *fes.GetFE(0);
32  const IntegrationRule *ir
33  = IntRule ? IntRule : &MassIntegrator::GetRule(el, el, *T);
34  if (DeviceCanUseCeed())
35  {
36  delete ceedOp;
37  ceedOp = new ceed::MFMassIntegrator(fes, *ir, Q);
38  return;
39  }
40  MFEM_ABORT("Error: VectorMassIntegrator::AssembleMF only implemented with"
41  " libCEED");
42 }
43 
44 void VectorMassIntegrator::AddMultMF(const Vector &x, Vector &y) const
45 {
46  if (DeviceCanUseCeed())
47  {
48  ceedOp->AddMult(x, y);
49  }
50  else
51  {
52  MFEM_ABORT("Error: VectorMassIntegrator::AddMultMF only implemented with"
53  " libCEED");
54  }
55 }
56 
57 void VectorMassIntegrator::AssembleDiagonalMF(Vector &diag)
58 {
59  if (DeviceCanUseCeed())
60  {
61  ceedOp->GetDiagonal(diag);
62  }
63  else
64  {
65  MFEM_ABORT("Error: VectorMassIntegrator::AssembleDiagonalMF only"
66  " implemented with libCEED");
67  }
68 }
69 
70 } // namespace mfem
Abstract class for all finite elements.
Definition: fe_base.hpp:235
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
int GetNE() const
Returns number of elements.
Definition: mesh.hpp:928
Mesh * GetMesh() const
Returns the mesh.
Definition: fespace.hpp:433
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:88
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
Definition: mesh.cpp:348
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Definition: fespace.cpp:2783
Vector data type.
Definition: vector.hpp:60