xref: /libCEED/examples/solids/include/matops.h (revision d4cc18453651bd0f94c1a2e078b2646a92dafdcc)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33d8e8822SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
53d8e8822SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
724a65d3dSJeremy L Thompson #pragma once
85754ecacSJeremy L Thompson 
95754ecacSJeremy L Thompson #include <ceed.h>
1049aac155SJeremy L Thompson #include <petscdm.h>
1149aac155SJeremy L Thompson #include <petscsnes.h>
122b730f8bSJeremy L Thompson 
135754ecacSJeremy L Thompson #include "../include/structs.h"
145754ecacSJeremy L Thompson 
155754ecacSJeremy L Thompson // This function uses libCEED to compute the local action of an operator
165754ecacSJeremy L Thompson PetscErrorCode ApplyLocalCeedOp(Vec X, Vec Y, UserMult user);
175754ecacSJeremy L Thompson 
185754ecacSJeremy L Thompson // This function uses libCEED to compute the non-linear residual
195754ecacSJeremy L Thompson PetscErrorCode FormResidual_Ceed(SNES snes, Vec X, Vec Y, void *ctx);
205754ecacSJeremy L Thompson 
215754ecacSJeremy L Thompson // This function uses libCEED to apply the Jacobian for assembly via a SNES
225754ecacSJeremy L Thompson PetscErrorCode ApplyJacobianCoarse_Ceed(SNES snes, Vec X, Vec Y, void *ctx);
235754ecacSJeremy L Thompson 
245754ecacSJeremy L Thompson // This function uses libCEED to compute the action of the Jacobian
255754ecacSJeremy L Thompson PetscErrorCode ApplyJacobian_Ceed(Mat A, Vec X, Vec Y);
265754ecacSJeremy L Thompson 
275754ecacSJeremy L Thompson // This function uses libCEED to compute the action of the prolongation operator
285754ecacSJeremy L Thompson PetscErrorCode Prolong_Ceed(Mat A, Vec X, Vec Y);
295754ecacSJeremy L Thompson 
305754ecacSJeremy L Thompson // This function uses libCEED to compute the action of the restriction operator
315754ecacSJeremy L Thompson PetscErrorCode Restrict_Ceed(Mat A, Vec X, Vec Y);
325754ecacSJeremy L Thompson 
335754ecacSJeremy L Thompson // This function returns the computed diagonal of the operator
345754ecacSJeremy L Thompson PetscErrorCode GetDiag_Ceed(Mat A, Vec D);
355754ecacSJeremy L Thompson 
365754ecacSJeremy L Thompson // This function calculates the strain energy in the final solution
372b730f8bSJeremy L Thompson PetscErrorCode ComputeStrainEnergy(DM dm_energy, UserMult user, CeedOperator op_energy, Vec X, PetscReal *energy);
385754ecacSJeremy L Thompson 
395754ecacSJeremy L Thompson // this function checks to see if the computed energy is close enough to reference file energy.
405754ecacSJeremy L Thompson PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy);
41