xref: /libCEED/examples/solids/include/matops.h (revision fc0f7cc68128f3536a834f19d72828f4c59a4439)
1 // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause
5 //
6 // This file is part of CEED:  http://github.com/ceed
7 #pragma once
8 
9 #include <ceed.h>
10 #include <petscdm.h>
11 #include <petscsnes.h>
12 
13 #include "../include/structs.h"
14 
15 // This function uses libCEED to compute the local action of an operator
16 PetscErrorCode ApplyLocalCeedOp(Vec X, Vec Y, UserMult user);
17 
18 // This function uses libCEED to compute the non-linear residual
19 PetscErrorCode FormResidual_Ceed(SNES snes, Vec X, Vec Y, void *ctx);
20 
21 // This function uses libCEED to apply the Jacobian for assembly via a SNES
22 PetscErrorCode ApplyJacobianCoarse_Ceed(SNES snes, Vec X, Vec Y, void *ctx);
23 
24 // This function uses libCEED to compute the action of the Jacobian
25 PetscErrorCode ApplyJacobian_Ceed(Mat A, Vec X, Vec Y);
26 
27 // This function uses libCEED to compute the action of the prolongation operator
28 PetscErrorCode Prolong_Ceed(Mat A, Vec X, Vec Y);
29 
30 // This function uses libCEED to compute the action of the restriction operator
31 PetscErrorCode Restrict_Ceed(Mat A, Vec X, Vec Y);
32 
33 // This function returns the computed diagonal of the operator
34 PetscErrorCode GetDiag_Ceed(Mat A, Vec D);
35 
36 // This function calculates the strain energy in the final solution
37 PetscErrorCode ComputeStrainEnergy(DM dm_energy, UserMult user, CeedOperator op_energy, Vec X, PetscReal *energy);
38 
39 // this function checks to see if the computed energy is close enough to reference file energy.
40 PetscErrorCode RegressionTests_solids(AppCtx app_ctx, PetscReal energy);
41