xref: /libCEED/examples/solids/include/matops.h (revision 3d8e882215d238700cdceb37404f76ca7fa24eaa)
1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*3d8e8822SJeremy L Thompson //
4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5*3d8e8822SJeremy L Thompson //
6*3d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*3d8e8822SJeremy L Thompson 
8b7c563b6SJeremy L Thompson #ifndef libceed_solids_examples_matops_h
9b7c563b6SJeremy L Thompson #define libceed_solids_examples_matops_h
105754ecacSJeremy L Thompson 
115754ecacSJeremy L Thompson #include <ceed.h>
125754ecacSJeremy L Thompson #include <petsc.h>
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
375754ecacSJeremy L Thompson PetscErrorCode ComputeStrainEnergy(DM dm_energy, UserMult user,
385754ecacSJeremy L Thompson                                    CeedOperator op_energy, Vec X,
395754ecacSJeremy L Thompson                                    PetscReal *energy);
405754ecacSJeremy L Thompson 
415754ecacSJeremy L Thompson // this function checks to see if the computed energy is close enough to reference file energy.
425754ecacSJeremy L Thompson PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy);
435754ecacSJeremy L Thompson 
44b7c563b6SJeremy L Thompson #endif // libceed_solids_examples_matopts_h
45