12 #include "operator.hpp"
14 #include "../../../config/config.hpp"
15 #include "../../../linalg/vector.hpp"
16 #include "../../fespace.hpp"
30 CeedSize in_len, out_len;
31 int ierr = CeedOperatorGetActiveVectorLengths(
oper, &in_len, &out_len);
35 MFEM_VERIFY(
height == out_len,
"height overflow");
36 MFEM_VERIFY(
width == in_len,
"width overflow");
37 CeedVectorCreate(internal::ceed,
height, &
v);
38 CeedVectorCreate(internal::ceed,
width, &
u);
45 const CeedScalar *x_ptr;
48 CeedGetPreferredMemType(mfem::internal::ceed, &mem);
60 CeedVectorSetArray(
u, mem, CEED_USE_POINTER, const_cast<CeedScalar*>(x_ptr));
61 CeedVectorSetArray(
v, mem, CEED_USE_POINTER, y_ptr);
63 CeedOperatorApply(
oper,
u,
v, CEED_REQUEST_IMMEDIATE);
65 CeedVectorTakeArray(
u, mem, const_cast<CeedScalar**>(&x_ptr));
66 CeedVectorTakeArray(
v, mem, &y_ptr);
68 MFEM_ABORT(
"MFEM must be built with MFEM_USE_CEED=YES to use libCEED.");
75 const CeedScalar *x_ptr;
78 CeedGetPreferredMemType(mfem::internal::ceed, &mem);
90 CeedVectorSetArray(
u, mem, CEED_USE_POINTER, const_cast<CeedScalar*>(x_ptr));
91 CeedVectorSetArray(
v, mem, CEED_USE_POINTER, y_ptr);
93 CeedOperatorApplyAdd(
oper,
u,
v, CEED_REQUEST_IMMEDIATE);
95 CeedVectorTakeArray(
u, mem, const_cast<CeedScalar**>(&x_ptr));
96 CeedVectorTakeArray(
v, mem, &y_ptr);
98 MFEM_ABORT(
"MFEM must be built with MFEM_USE_CEED=YES to use libCEED.");
107 CeedGetPreferredMemType(mfem::internal::ceed, &mem);
117 CeedVectorSetArray(
v, mem, CEED_USE_POINTER, d_ptr);
119 CeedOperatorLinearAssembleAddDiagonal(
oper,
v, CEED_REQUEST_IMMEDIATE);
121 CeedVectorTakeArray(
v, mem, &d_ptr);
123 MFEM_ABORT(
"MFEM must be built with MFEM_USE_CEED=YES to use libCEED.");
virtual double * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
virtual double * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
void AddMult(const mfem::Vector &x, mfem::Vector &y) const
virtual const double * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
void GetDiagonal(mfem::Vector &diag) const
static bool Allows(unsigned long b_mask)
Return true if any of the backends in the backend mask, b_mask, are allowed.
int height
Dimension of the output / number of rows in the matrix.
virtual double * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Operator application: y=A(x).
Biwise-OR of all device backends.
virtual const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual double * HostReadWrite()
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), false).
int width
Dimension of the input / number of columns in the matrix.