23 MFEM_ASSERT(gradient_operator_ !=
nullptr,
24 "Operator is not ElasticityGradientOperator");
38 const int ns = num_submats_, sh = submat_height_, nsh = ns * sh;
40 const auto K_diag_submats =
Reshape(K_diag_.
Read(), ns, sh, sh);
50 const int s = si / sh;
51 const int i = si % sh;
52 Y(s, i) = X(s, i) / K_diag_submats(s, i, i);
59 const auto submat = make_tensor<dim, dim>(
60 [&](
int i,
int j) {
return K_diag_submats(s, i, j); });
62 const auto submat_inv = inv(submat);
64 const auto x_block = make_tensor<dim>([&](
int i) {
return X(s, i); });
68 for (
int i = 0; i < dim; i++)
76 MFEM_ABORT(
"Unknown ElasticityDiagonalPreconditioner::Type");
void SetOperator(const Operator &op) override
Set/update the solver for the given operator.
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
ElasticityGradientOperator is a wrapper class to pass ElasticityOperator::AssembleGradientDiagonal an...
void AssembleGradientDiagonal(Vector &Ke_diag, Vector &K_diag_local, Vector &K_diag) const
ElasticityOperator & elasticity_op_
ParFiniteElementSpace h1_fes_
H1 finite element space.
int GetVDim() const
Returns the vector dimension of the finite element space.
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
int GetTrueVSize() const override
Return the number of local vector true dofs.
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
void forall(int N, lambda &&body)
Implementation of the tensor class.