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. 3fc7cf9a0Sjeremylt // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5fc7cf9a0Sjeremylt // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7fc7cf9a0Sjeremylt 894b7b29bSJeremy L Thompson #ifndef CEED_MEMCHECK_H 994b7b29bSJeremy L Thompson #define CEED_MEMCHECK_H 103d576824SJeremy L Thompson 1149aac155SJeremy L Thompson #include <ceed.h> 12ec3da8bcSJed Brown #include <ceed/backend.h> 13fc7cf9a0Sjeremylt 14fc7cf9a0Sjeremylt typedef struct { 159798701eSJeremy L Thompson int mem_block_id; 16df852985SJeremy L Thompson bool is_write_only_access; 179798701eSJeremy L Thompson CeedScalar *array; 189798701eSJeremy L Thompson CeedScalar *array_allocated; 199798701eSJeremy L Thompson CeedScalar *array_owned; 209798701eSJeremy L Thompson CeedScalar *array_borrowed; 219798701eSJeremy L Thompson CeedScalar *array_read_only_copy; 229798701eSJeremy L Thompson } CeedVector_Memcheck; 239798701eSJeremy L Thompson 249798701eSJeremy L Thompson typedef struct { 25*9e82028bSJeremy L Thompson const CeedInt *offsets; 26*9e82028bSJeremy L Thompson CeedInt *offsets_allocated; 27*9e82028bSJeremy L Thompson const bool *orients; /* Orientation, if it exists, is true when the dof must be flipped */ 28*9e82028bSJeremy L Thompson bool *orients_allocated; 29*9e82028bSJeremy L Thompson const CeedInt8 *curl_orients; /* Tridiagonal matrix (row-major) for a general transformation during restriction */ 30*9e82028bSJeremy L Thompson CeedInt8 *curl_orients_allocated; 31*9e82028bSJeremy L Thompson int (*Apply)(CeedElemRestriction, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, bool, bool, CeedVector, CeedVector, 32*9e82028bSJeremy L Thompson CeedRequest *); 33*9e82028bSJeremy L Thompson } CeedElemRestriction_Memcheck; 34*9e82028bSJeremy L Thompson 35*9e82028bSJeremy L Thompson typedef struct { 36fc7cf9a0Sjeremylt const CeedScalar **inputs; 37fc7cf9a0Sjeremylt CeedScalar **outputs; 38d1d35e2fSjeremylt bool setup_done; 39fc7cf9a0Sjeremylt } CeedQFunction_Memcheck; 40fc7cf9a0Sjeremylt 410f58c348SJeremy L Thompson typedef struct { 420f58c348SJeremy L Thompson int mem_block_id; 430f58c348SJeremy L Thompson void *data; 440f58c348SJeremy L Thompson void *data_allocated; 450f58c348SJeremy L Thompson void *data_owned; 468e457467SJeremy L Thompson void *data_borrowed; 478e457467SJeremy L Thompson void *data_read_only_copy; 480f58c348SJeremy L Thompson } CeedQFunctionContext_Memcheck; 490f58c348SJeremy L Thompson 509798701eSJeremy L Thompson CEED_INTERN int CeedVectorCreate_Memcheck(CeedSize n, CeedVector vec); 519798701eSJeremy L Thompson 52*9e82028bSJeremy L Thompson CEED_INTERN int CeedElemRestrictionCreate_Memcheck(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients, 53*9e82028bSJeremy L Thompson const CeedInt8 *curl_orients, CeedElemRestriction r); 54*9e82028bSJeremy L Thompson 55fc7cf9a0Sjeremylt CEED_INTERN int CeedQFunctionCreate_Memcheck(CeedQFunction qf); 563d576824SJeremy L Thompson 570f58c348SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Memcheck(CeedQFunctionContext ctx); 580f58c348SJeremy L Thompson 5994b7b29bSJeremy L Thompson #endif // CEED_MEMCHECK_H 60