13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, 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 73d8e8822SJeremy 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> 12*49aac155SJeremy L Thompson #include <petscdm.h> 13*49aac155SJeremy L Thompson #include <petscsnes.h> 142b730f8bSJeremy L Thompson 155754ecacSJeremy L Thompson #include "../include/structs.h" 165754ecacSJeremy L Thompson 175754ecacSJeremy L Thompson // This function uses libCEED to compute the local action of an operator 185754ecacSJeremy L Thompson PetscErrorCode ApplyLocalCeedOp(Vec X, Vec Y, UserMult user); 195754ecacSJeremy L Thompson 205754ecacSJeremy L Thompson // This function uses libCEED to compute the non-linear residual 215754ecacSJeremy L Thompson PetscErrorCode FormResidual_Ceed(SNES snes, Vec X, Vec Y, void *ctx); 225754ecacSJeremy L Thompson 235754ecacSJeremy L Thompson // This function uses libCEED to apply the Jacobian for assembly via a SNES 245754ecacSJeremy L Thompson PetscErrorCode ApplyJacobianCoarse_Ceed(SNES snes, Vec X, Vec Y, void *ctx); 255754ecacSJeremy L Thompson 265754ecacSJeremy L Thompson // This function uses libCEED to compute the action of the Jacobian 275754ecacSJeremy L Thompson PetscErrorCode ApplyJacobian_Ceed(Mat A, Vec X, Vec Y); 285754ecacSJeremy L Thompson 295754ecacSJeremy L Thompson // This function uses libCEED to compute the action of the prolongation operator 305754ecacSJeremy L Thompson PetscErrorCode Prolong_Ceed(Mat A, Vec X, Vec Y); 315754ecacSJeremy L Thompson 325754ecacSJeremy L Thompson // This function uses libCEED to compute the action of the restriction operator 335754ecacSJeremy L Thompson PetscErrorCode Restrict_Ceed(Mat A, Vec X, Vec Y); 345754ecacSJeremy L Thompson 355754ecacSJeremy L Thompson // This function returns the computed diagonal of the operator 365754ecacSJeremy L Thompson PetscErrorCode GetDiag_Ceed(Mat A, Vec D); 375754ecacSJeremy L Thompson 385754ecacSJeremy L Thompson // This function calculates the strain energy in the final solution 392b730f8bSJeremy L Thompson PetscErrorCode ComputeStrainEnergy(DM dm_energy, UserMult user, CeedOperator op_energy, Vec X, 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