MFEM  v4.4.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
bilininteg_convection_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/convection.hpp"
16 
17 using namespace std;
18 
19 namespace mfem
20 {
21 
22 void ConvectionIntegrator::AssembleMF(const FiniteElementSpace &fes)
23 {
24  // Assuming the same element type
25  Mesh *mesh = fes.GetMesh();
26  if (mesh->GetNE() == 0) { return; }
27  const FiniteElement &el = *fes.GetFE(0);
29  const IntegrationRule *ir = IntRule ? IntRule : &GetRule(el, Trans);
30  if (DeviceCanUseCeed())
31  {
32  delete ceedOp;
33  ceedOp = new ceed::MFConvectionIntegrator(fes, *ir, Q, alpha);
34  return;
35  }
36  MFEM_ABORT("Error: ConvectionIntegrator::AssembleMF only implemented with"
37  " libCEED");
38 }
39 
40 void ConvectionIntegrator::AssembleDiagonalMF(Vector &diag)
41 {
42  if (DeviceCanUseCeed())
43  {
44  ceedOp->GetDiagonal(diag);
45  }
46  else
47  {
48  MFEM_ABORT("Error: ConvectionIntegrator::AssembleDiagonalMF only"
49  " implemented with libCEED");
50  }
51 }
52 
53 void ConvectionIntegrator::AddMultMF(const Vector &x, Vector &y) const
54 {
55  if (DeviceCanUseCeed())
56  {
57  ceedOp->AddMult(x, y);
58  }
59  else
60  {
61  MFEM_ABORT("Error: ConvectionIntegrator::AddMultMF only implemented with"
62  " libCEED");
63  }
64 }
65 
66 }
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
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
Definition: fespace.hpp:623
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:88
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
const double alpha
Definition: ex15.cpp:369
Vector data type.
Definition: vector.hpp:60