MFEM  v4.2.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-2020, 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 "libceed/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 #ifdef MFEM_USE_CEED
28  // Assuming the same element type
29  Mesh *mesh = fes.GetMesh();
30  if (mesh->GetNE() == 0) { return; }
31  const FiniteElement &el = *fes.GetFE(0);
33  const IntegrationRule *ir
34  = IntRule ? IntRule : &MassIntegrator::GetRule(el, el, *T);
35  if (DeviceCanUseCeed())
36  {
37  delete ceedDataPtr;
38  ceedDataPtr = new CeedData;
39  InitCeedCoeff(Q, *mesh, *ir, ceedDataPtr);
40  return CeedMFMassAssemble(fes, *ir, *ceedDataPtr);
41  }
42 #endif
43  mfem_error("Error: VectorMassIntegrator::AssembleMF only implemented with libCEED");
44 }
45 
46 void VectorMassIntegrator::AddMultMF(const Vector &x, Vector &y) const
47 {
48 #ifdef MFEM_USE_CEED
49  if (DeviceCanUseCeed())
50  {
51  CeedAddMult(ceedDataPtr, x, y);
52  }
53  else
54 #endif
55  {
56  mfem_error("Error: VectorMassIntegrator::AssembleDiagonalMF only implemented with libCEED");
57  }
58 }
59 
60 void VectorMassIntegrator::AssembleDiagonalMF(Vector &diag)
61 {
62 #ifdef MFEM_USE_CEED
63  if (DeviceCanUseCeed())
64  {
65  CeedAssembleDiagonal(ceedDataPtr, diag);
66  }
67  else
68 #endif
69  {
70  mfem_error("Error: VectorMassIntegrator::AddMultMF only implemented with libCEED");
71  }
72 }
73 
74 } // namespace mfem
Abstract class for all finite elements.
Definition: fe.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:737
Mesh * GetMesh() const
Returns the mesh.
Definition: fespace.hpp:314
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
Definition: error.cpp:153
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
Definition: mesh.cpp:336
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Definition: fespace.cpp:1798
Vector data type.
Definition: vector.hpp:51