MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bilininteg_vecdiffusion_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"
16 
17 using namespace std;
18 
19 namespace mfem
20 {
21 
22 void VectorDiffusionIntegrator::AssembleMF(const FiniteElementSpace &fes)
23 {
24  // Assumes tensor-product elements
25  Mesh *mesh = fes.GetMesh();
26  if (mesh->GetNE() == 0) { return; }
27  const FiniteElement &el = *fes.GetFE(0);
28  const IntegrationRule *ir
29  = IntRule ? IntRule : &DiffusionIntegrator::GetRule(el, el);
30  if (DeviceCanUseCeed())
31  {
32  delete ceedOp;
33  MFEM_VERIFY(!VQ && !MQ,
34  "Only scalar coefficient supported for DiffusionIntegrator"
35  " with libCEED");
36  const bool mixed = mesh->GetNumGeometries(mesh->Dimension()) > 1 ||
37  fes.IsVariableOrder();
38  if (mixed)
39  {
40  ceedOp = new ceed::MixedMFDiffusionIntegrator(*this, fes, Q);
41  }
42  else
43  {
44  ceedOp = new ceed::MFDiffusionIntegrator(fes, *ir, Q);
45  }
46  return;
47  }
48  MFEM_ABORT("Error: VectorDiffusionIntegrator::AssembleMF only implemented"
49  " with libCEED");
50 }
51 
52 void VectorDiffusionIntegrator::AddMultMF(const Vector &x, Vector &y) const
53 {
54  if (DeviceCanUseCeed())
55  {
56  ceedOp->AddMult(x, y);
57  }
58  else
59  {
60  MFEM_ABORT("Error: VectorDiffusionIntegrator::AddMultMF only implemented"
61  " with libCEED");
62  }
63 }
64 
65 void VectorDiffusionIntegrator::AssembleDiagonalMF(Vector &diag)
66 {
67  if (DeviceCanUseCeed())
68  {
69  ceedOp->GetDiagonal(diag);
70  }
71  else
72  {
73  MFEM_ABORT("Error: VectorDiffusionIntegrator::AssembleDiagonalMF only"
74  " implemented with libCEED");
75  }
76 }
77 
78 } // 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
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
Definition: fespace.hpp:463
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
Definition: mesh.cpp:5908
int GetNE() const
Returns number of elements.
Definition: mesh.hpp:923
Represent a DiffusionIntegrator with AssemblyLevel::None using libCEED.
Definition: diffusion.hpp:47
Mesh * GetMesh() const
Returns the mesh.
Definition: fespace.hpp:441
int Dimension() const
Definition: mesh.hpp:1006
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:96
bool DeviceCanUseCeed()
Function that determines if a CEED kernel should be used, based on the current mfem::Device configura...
Definition: util.cpp:33
const IntegrationRule & GetRule(const Integrator &integ, const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans)
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:2781
Vector data type.
Definition: vector.hpp:60