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 #ifndef CEED_MEMCHECK_H 9 #define CEED_MEMCHECK_H 10 11 #include <ceed.h> 12 #include <ceed/backend.h> 13 14 typedef struct { 15 int mem_block_id; 16 bool is_write_only_access; 17 CeedScalar *array; 18 CeedScalar *array_allocated; 19 CeedScalar *array_owned; 20 CeedScalar *array_borrowed; 21 CeedScalar *array_read_only_copy; 22 } CeedVector_Memcheck; 23 24 typedef struct { 25 const CeedInt *offsets; 26 CeedInt *offsets_allocated; 27 const bool *orients; /* Orientation, if it exists, is true when the dof must be flipped */ 28 bool *orients_allocated; 29 const CeedInt8 *curl_orients; /* Tridiagonal matrix (row-major) for a general transformation during restriction */ 30 CeedInt8 *curl_orients_allocated; 31 int (*Apply)(CeedElemRestriction, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, bool, bool, CeedVector, CeedVector, 32 CeedRequest *); 33 } CeedElemRestriction_Memcheck; 34 35 typedef struct { 36 const CeedScalar **inputs; 37 CeedScalar **outputs; 38 bool setup_done; 39 } CeedQFunction_Memcheck; 40 41 typedef struct { 42 int mem_block_id; 43 void *data; 44 void *data_allocated; 45 void *data_owned; 46 void *data_borrowed; 47 void *data_read_only_copy; 48 } CeedQFunctionContext_Memcheck; 49 50 CEED_INTERN int CeedVectorCreate_Memcheck(CeedSize n, CeedVector vec); 51 52 CEED_INTERN int CeedElemRestrictionCreate_Memcheck(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients, 53 const CeedInt8 *curl_orients, CeedElemRestriction r); 54 55 CEED_INTERN int CeedQFunctionCreate_Memcheck(CeedQFunction qf); 56 57 CEED_INTERN int CeedQFunctionContextCreate_Memcheck(CeedQFunctionContext ctx); 58 59 #endif // CEED_MEMCHECK_H 60