1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, 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 7509d4af6SJeremy L Thompson #pragma once 83d576824SJeremy L Thompson 949aac155SJeremy L Thompson #include <ceed.h> 10ec3da8bcSJed Brown #include <ceed/backend.h> 11fc7cf9a0Sjeremylt 12fc7cf9a0Sjeremylt typedef struct { 139937a20eSJeremy L Thompson // Internal array buffer 149937a20eSJeremy L Thompson int allocated_block_id; 159798701eSJeremy L Thompson CeedScalar *array_allocated; 169937a20eSJeremy L Thompson // Owned external array 179937a20eSJeremy L Thompson int owned_block_id; 189798701eSJeremy L Thompson CeedScalar *array_owned; 199937a20eSJeremy L Thompson // Borrowed external array 209937a20eSJeremy L Thompson int borrowed_block_id; 219798701eSJeremy L Thompson CeedScalar *array_borrowed; 229937a20eSJeremy L Thompson // Externally viewable read-only array 239937a20eSJeremy L Thompson int read_only_block_id; 249798701eSJeremy L Thompson CeedScalar *array_read_only_copy; 259937a20eSJeremy L Thompson // Externally viewable writable array 269937a20eSJeremy L Thompson bool is_write_only_access; 279937a20eSJeremy L Thompson int writable_block_id; 281a3e18b3SJeremy L Thompson CeedScalar *array_writable_copy; 299798701eSJeremy L Thompson } CeedVector_Memcheck; 309798701eSJeremy L Thompson 319798701eSJeremy L Thompson typedef struct { 329e82028bSJeremy L Thompson const CeedInt *offsets; 339e82028bSJeremy L Thompson CeedInt *offsets_allocated; 349e82028bSJeremy L Thompson const bool *orients; /* Orientation, if it exists, is true when the dof must be flipped */ 359e82028bSJeremy L Thompson bool *orients_allocated; 369e82028bSJeremy L Thompson const CeedInt8 *curl_orients; /* Tridiagonal matrix (row-major) for a general transformation during restriction */ 379e82028bSJeremy L Thompson CeedInt8 *curl_orients_allocated; 389e82028bSJeremy L Thompson int (*Apply)(CeedElemRestriction, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, bool, bool, CeedVector, CeedVector, 399e82028bSJeremy L Thompson CeedRequest *); 409e82028bSJeremy L Thompson } CeedElemRestriction_Memcheck; 419e82028bSJeremy L Thompson 429e82028bSJeremy L Thompson typedef struct { 433345ba21SJeremy L Thompson bool setup_done; 44fc7cf9a0Sjeremylt const CeedScalar **inputs; 45fc7cf9a0Sjeremylt CeedScalar **outputs; 46fc7cf9a0Sjeremylt } CeedQFunction_Memcheck; 47fc7cf9a0Sjeremylt 480f58c348SJeremy L Thompson typedef struct { 490307dd02SJeremy L Thompson // Internal data buffer 500307dd02SJeremy L Thompson int allocated_block_id; 510f58c348SJeremy L Thompson void *data_allocated; 520307dd02SJeremy L Thompson // Owned external data 530307dd02SJeremy L Thompson int owned_block_id; 540f58c348SJeremy L Thompson void *data_owned; 550307dd02SJeremy L Thompson // Borrowed external data 560307dd02SJeremy L Thompson int borrowed_block_id; 578e457467SJeremy L Thompson void *data_borrowed; 580307dd02SJeremy L Thompson // Externally viewable read-only data 590307dd02SJeremy L Thompson int read_only_block_id; 608e457467SJeremy L Thompson void *data_read_only_copy; 610307dd02SJeremy L Thompson // Externally viewable writable data 620307dd02SJeremy L Thompson int writable_block_id; 630307dd02SJeremy L Thompson void *data_writable_copy; 640f58c348SJeremy L Thompson } CeedQFunctionContext_Memcheck; 650f58c348SJeremy L Thompson 669798701eSJeremy L Thompson CEED_INTERN int CeedVectorCreate_Memcheck(CeedSize n, CeedVector vec); 679798701eSJeremy L Thompson 689e82028bSJeremy L Thompson CEED_INTERN int CeedElemRestrictionCreate_Memcheck(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients, 699e82028bSJeremy L Thompson const CeedInt8 *curl_orients, CeedElemRestriction r); 709e82028bSJeremy L Thompson 71fc7cf9a0Sjeremylt CEED_INTERN int CeedQFunctionCreate_Memcheck(CeedQFunction qf); 723d576824SJeremy L Thompson 730f58c348SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Memcheck(CeedQFunctionContext ctx); 74