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