1 // Copyright (c) 2017-2022, 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 8 /// @file 9 /// Operations for PETSc MatShell 10 #pragma once 11 12 #include <ceed.h> 13 #include <petsc.h> 14 15 #include "structs.h" 16 17 PetscErrorCode SetupApplyOperatorCtx(MPI_Comm comm, DM dm, Ceed ceed, CeedData ceed_data, Vec X_loc, OperatorApplyContext op_apply_ctx); 18 PetscErrorCode SetupErrorOperatorCtx(MPI_Comm comm, DM dm, Ceed ceed, CeedData ceed_data, Vec X_loc, CeedOperator op_error, 19 OperatorApplyContext op_error_ctx); 20 PetscErrorCode MatGetDiag(Mat A, Vec D); 21 PetscErrorCode ApplyLocal_Ceed(Vec X, Vec Y, OperatorApplyContext op_apply_ctx); 22 PetscErrorCode MatMult_Ceed(Mat A, Vec X, Vec Y); 23 PetscErrorCode FormResidual_Ceed(SNES snes, Vec X, Vec Y, void *ctx); 24 PetscErrorCode MatMult_Prolong(Mat A, Vec X, Vec Y); 25 PetscErrorCode MatMult_Restrict(Mat A, Vec X, Vec Y); 26 PetscErrorCode ComputeL2Error(Vec X, PetscScalar *l2_error, OperatorApplyContext op_error_ctx); 27