xref: /libCEED/rust/libceed-sys/c-src/backends/memcheck/ceed-memcheck.h (revision 509d4af65d23546c690c9766d8b29e47dc3b3afb)
15aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, 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
7*509d4af6SJeremy L Thompson #pragma once
83d576824SJeremy L Thompson 
949aac155SJeremy L Thompson #include <ceed.h>
10ec3da8bcSJed Brown #include <ceed/backend.h>
11fc7cf9a0Sjeremylt 
12fc7cf9a0Sjeremylt typedef struct {
139798701eSJeremy L Thompson   int         mem_block_id;
14df852985SJeremy L Thompson   bool        is_write_only_access;
159798701eSJeremy L Thompson   CeedScalar *array;
169798701eSJeremy L Thompson   CeedScalar *array_allocated;
179798701eSJeremy L Thompson   CeedScalar *array_owned;
189798701eSJeremy L Thompson   CeedScalar *array_borrowed;
199798701eSJeremy L Thompson   CeedScalar *array_read_only_copy;
209798701eSJeremy L Thompson } CeedVector_Memcheck;
219798701eSJeremy L Thompson 
229798701eSJeremy L Thompson typedef struct {
239e82028bSJeremy L Thompson   const CeedInt  *offsets;
249e82028bSJeremy L Thompson   CeedInt        *offsets_allocated;
259e82028bSJeremy L Thompson   const bool     *orients; /* Orientation, if it exists, is true when the dof must be flipped */
269e82028bSJeremy L Thompson   bool           *orients_allocated;
279e82028bSJeremy L Thompson   const CeedInt8 *curl_orients; /* Tridiagonal matrix (row-major) for a general transformation during restriction */
289e82028bSJeremy L Thompson   CeedInt8       *curl_orients_allocated;
299e82028bSJeremy L Thompson   int (*Apply)(CeedElemRestriction, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, bool, bool, CeedVector, CeedVector,
309e82028bSJeremy L Thompson                CeedRequest *);
319e82028bSJeremy L Thompson } CeedElemRestriction_Memcheck;
329e82028bSJeremy L Thompson 
339e82028bSJeremy L Thompson typedef struct {
34fc7cf9a0Sjeremylt   const CeedScalar **inputs;
35fc7cf9a0Sjeremylt   CeedScalar       **outputs;
36d1d35e2fSjeremylt   bool               setup_done;
37fc7cf9a0Sjeremylt } CeedQFunction_Memcheck;
38fc7cf9a0Sjeremylt 
390f58c348SJeremy L Thompson typedef struct {
400f58c348SJeremy L Thompson   int   mem_block_id;
410f58c348SJeremy L Thompson   void *data;
420f58c348SJeremy L Thompson   void *data_allocated;
430f58c348SJeremy L Thompson   void *data_owned;
448e457467SJeremy L Thompson   void *data_borrowed;
458e457467SJeremy L Thompson   void *data_read_only_copy;
460f58c348SJeremy L Thompson } CeedQFunctionContext_Memcheck;
470f58c348SJeremy L Thompson 
489798701eSJeremy L Thompson CEED_INTERN int CeedVectorCreate_Memcheck(CeedSize n, CeedVector vec);
499798701eSJeremy L Thompson 
509e82028bSJeremy L Thompson CEED_INTERN int CeedElemRestrictionCreate_Memcheck(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients,
519e82028bSJeremy L Thompson                                                    const CeedInt8 *curl_orients, CeedElemRestriction r);
529e82028bSJeremy L Thompson 
53fc7cf9a0Sjeremylt CEED_INTERN int CeedQFunctionCreate_Memcheck(CeedQFunction qf);
543d576824SJeremy L Thompson 
550f58c348SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Memcheck(CeedQFunctionContext ctx);
56