19 :
Operator(), mesh_(mesh), order_(order), dim_(mesh_.SpaceDimension()),
20 vdim_(mesh_.SpaceDimension()), ne_(mesh_.GetNE()), h1_fec_(order_, dim_),
29 out <<
"#dofs: " << global_tdof_size << std::endl;
138 const auto d_dX = dX.
Read();
143 d_Y[d_ess_tdof_list[i]] = d_dX[d_ess_tdof_list[i]];
164 for (
int i = 0; i <
dim_; i++)
171 Vector vin_local, vout_local;
172 vin_local.
MakeRef(Ke_diag, i * sce_sz, sce_sz);
173 vout_local.
MakeRef(K_diag_local, i * scl_sz, scl_sz);
181 vout.
MakeRef(K_diag, i * sct_sz, sct_sz);
194 int submat = ess_idx % num_submats;
195 int row = ess_idx / num_submats;
196 for (
int j = 0; j <
dim_; j++)
200 K_diag_submats(submat, row, j) = 1.0;
204 K_diag_submats(submat, row, j) = 0.0;
205 K_diag_submats(submat, j, row) = 0.0;
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
int Size() const
Return the logical size of the array.
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
Array< real_t > G
Gradients/divergences/curls of basis functions evaluated at quadrature points.
@ TENSOR
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
Array< real_t > B
Basis functions evaluated at quadrature points.
int ndof
Number of degrees of freedom = number of basis functions. When mode is TENSOR, this is the 1D number.
int nqpt
Number of quadrature points. When mode is TENSOR, this is the 1D number.
ElasticityGradientOperator is a wrapper class to pass ElasticityOperator::AssembleGradientDiagonal an...
const Operator * h1_element_restriction_
int d1d_
Number of degrees of freedom in 1D.
Vector Y_local_
Output state L-vector.
Vector X_el_
Input state E-vector.
ElasticityOperator(ParMesh &mesh, const int order)
Vector Y_el_
Output state E-Vector.
std::function< void(const int, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, const Vector &, Vector &)> element_kernel_assemble_diagonal_wrapper
Wrapper for the assembly of the gradient on each diagonal element.
Vector X_local_
Input state L-vector.
const int ne_
Number of elements in the mesh (rank local)
int q1d_
Number of quadrature points in 1D.
std::function< void(const int, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, const Vector &, Vector &, const Vector &)> element_apply_gradient_kernel_wrapper
Wrapper for the application of the gradient of the residual.
Array< int > ess_tdof_list_
std::function< void(const int, const Array< real_t > &, const Array< real_t > &, const Array< real_t > &, const Vector &, const Vector &, const Vector &, Vector &)> element_apply_kernel_wrapper
Wrapper for the application of the residual R(U).
void GradientMult(const Vector &dX, Vector &Y) const
Multiply the linearization of the residual R(U) wrt to the current state U by a perturbation dX.
virtual void Mult(const Vector &U, Vector &Y) const override
Compute the residual Y = R(U) representing the elasticity equation with a material model chosen by ca...
const Operator * h1_prolongation_
Operator & GetGradient(const Vector &U) const override
Get the Gradient object.
const GeometricFactors * geometric_factors_
ParFiniteElementSpace h1_fes_
H1 finite element space.
void AssembleGradientDiagonal(Vector &Ke_diag, Vector &K_diag_local, Vector &K_diag) const
Assemble the linearization of the residual K = dR(U)/dU.
int GetOrder(int i) const
Returns the polynomial degree of the i'th finite element.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
int GetVDim() const
Returns vector dimension.
virtual const DofToQuad & GetDofToQuad(const IntegrationRule &ir, DofToQuad::Mode mode) const
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
Vector detJ
Determinants of the Jacobians at all quadrature points.
Vector J
Jacobians of the element transformations at all quadrature points.
Class for an integration rule - an Array of IntegrationPoint.
const Array< real_t > & GetWeights() const
Return the quadrature weights in a contiguous array.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SyncAlias(const Memory &base, int alias_size) const
Update the alias Memory *this to match the memory location (all valid locations) of its base Memory,...
const GeometricFactors * GetGeometricFactors(const IntegrationRule &ir, const int flags, MemoryType d_mt=MemoryType::DEFAULT)
Return the mesh geometric factors corresponding to the given integration rule.
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.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
The ordering method used when the number of unknowns per mesh node (vector dimension) is bigger than ...
HYPRE_BigInt GlobalTrueVSize() const
int GetTrueVSize() const override
Return the number of local vector true dofs.
const Operator * GetProlongationMatrix() const override
The returned Operator is owned by the FiniteElementSpace.
ParMesh * GetParMesh() const
const FiniteElement * GetFE(int i) const override
Class for parallel meshes.
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
Memory< real_t > & GetMemory()
Return a reference to the Memory object used by the Vector.
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
void SetSize(int s)
Resize the vector to size s.
virtual real_t * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
@ byNODES
NQPT x VDIM x NE (values) / NQPT x VDIM x DIM x NE (grads)
@ LEXICOGRAPHIC
Lexicographic ordering for tensor-product FiniteElements.
void forall(int N, lambda &&body)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)