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.");
76 MFEM_VERIFY(
a == 1.0,
"General coefficient case is not yet supported!");
77 const CeedScalar *x_ptr;
80 CeedGetPreferredMemType(mfem::internal::ceed, &mem);
92 CeedVectorSetArray(
u, mem, CEED_USE_POINTER, const_cast<CeedScalar*>(x_ptr));
93 CeedVectorSetArray(
v, mem, CEED_USE_POINTER, y_ptr);
95 CeedOperatorApplyAdd(
oper,
u,
v, CEED_REQUEST_IMMEDIATE);
97 CeedVectorTakeArray(
u, mem, const_cast<CeedScalar**>(&x_ptr));
98 CeedVectorTakeArray(
v, mem, &y_ptr);
100 MFEM_ABORT(
"MFEM must be built with MFEM_USE_CEED=YES to use libCEED.");
109 CeedGetPreferredMemType(mfem::internal::ceed, &mem);
119 CeedVectorSetArray(
v, mem, CEED_USE_POINTER, d_ptr);
121 CeedOperatorLinearAssembleAddDiagonal(
oper,
v, CEED_REQUEST_IMMEDIATE);
123 CeedVectorTakeArray(
v, mem, &d_ptr);
125 MFEM_ABORT(
"MFEM must be built with MFEM_USE_CEED=YES to use libCEED.");
virtual const double * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
virtual double * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
virtual const double * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
void AddMult(const mfem::Vector &x, mfem::Vector &y, const double a=1.0) const override
Operator application: y+=A(x) (default) or y+=a*A(x).
virtual double * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
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 GetDiagonal(mfem::Vector &diag) const
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Operator application: y=A(x).
Biwise-OR of all device backends.
virtual double * HostReadWrite()
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), false).
int width
Dimension of the input / number of columns in the matrix.