1*18fb7758SJeremy L Thompson // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and other CEED contributors. 2*18fb7758SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*18fb7758SJeremy L Thompson // 4*18fb7758SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5*18fb7758SJeremy L Thompson // 6*18fb7758SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7*18fb7758SJeremy L Thompson #pragma once 858600ac3SJames Wright 958600ac3SJames Wright #include <ceed.h> 1058600ac3SJames Wright #include <petscdm.h> 1158600ac3SJames Wright #include <petscmat.h> 1258600ac3SJames Wright 1358600ac3SJames Wright #define MATCEED "ceed" 1458600ac3SJames Wright 1558600ac3SJames Wright #if defined(__clang_analyzer__) 1658600ac3SJames Wright #define MATCEED_EXTERN extern 1758600ac3SJames Wright #elif defined(__cplusplus) 1858600ac3SJames Wright #define MATCEED_EXTERN extern "C" 1958600ac3SJames Wright #else 2058600ac3SJames Wright #define MATCEED_EXTERN extern 2158600ac3SJames Wright #endif 2258600ac3SJames Wright 2358600ac3SJames Wright #if defined(__clang_analyzer__) 2458600ac3SJames Wright #define MATCEED_INTERN 2558600ac3SJames Wright #else 2658600ac3SJames Wright #define MATCEED_INTERN MATCEED_EXTERN __attribute__((visibility("hidden"))) 2758600ac3SJames Wright #endif 2858600ac3SJames Wright 2958600ac3SJames Wright // Context data 3058600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedCreate(DM dm_x, DM dm_y, CeedOperator op_mult, CeedOperator op_mult_transpose, Mat *mat); 3158600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedCopy(Mat mat_ceed, Mat mat_other); 3258600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedAssembleCOO(Mat mat_ceed, Mat mat_coo); 3358600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedSetContext(Mat mat, PetscErrorCode (*f)(void *), void *ctx); 3458600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedGetContext(Mat mat, void *ctx); 3558600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedSetInnerMatType(Mat mat, MatType type); 3658600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedGetInnerMatType(Mat mat, MatType *type); 3758600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedSetOperation(Mat mat, MatOperation op, void (*g)(void)); 3858600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedSetLocalVectors(Mat mat, Vec X_loc, Vec Y_loc_transpose); 3958600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedGetLocalVectors(Mat mat, Vec *X_loc, Vec *Y_loc_transpose); 4058600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedRestoreLocalVectors(Mat mat, Vec *X_loc, Vec *Y_loc_transpose); 4158600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedGetCeedOperators(Mat mat, CeedOperator *op_mult, CeedOperator *op_mult_transpose); 4258600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedRestoreCeedOperators(Mat mat, CeedOperator *op_mult, CeedOperator *op_mult_transpose); 4358600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedSetLogEvents(Mat mat, PetscLogEvent log_event_mult, PetscLogEvent log_event_mult_transpose); 4458600ac3SJames Wright MATCEED_INTERN PetscErrorCode MatCeedGetLogEvents(Mat mat, PetscLogEvent *log_event_mult, PetscLogEvent *log_event_mult_transpose); 45