xref: /libCEED/backends/memcheck/ceed-memcheck.h (revision 097cc79570fc1ccd17774d2bf9cd5e51d3925370)
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   CeedScalar *array_writable_copy;
21 } CeedVector_Memcheck;
22 
23 typedef struct {
24   const CeedInt  *offsets;
25   CeedInt        *offsets_allocated;
26   const bool     *orients; /* Orientation, if it exists, is true when the dof must be flipped */
27   bool           *orients_allocated;
28   const CeedInt8 *curl_orients; /* Tridiagonal matrix (row-major) for a general transformation during restriction */
29   CeedInt8       *curl_orients_allocated;
30   int (*Apply)(CeedElemRestriction, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, bool, bool, CeedVector, CeedVector,
31                CeedRequest *);
32 } CeedElemRestriction_Memcheck;
33 
34 typedef struct {
35   const CeedScalar **inputs;
36   CeedScalar       **outputs;
37   bool               setup_done;
38 } CeedQFunction_Memcheck;
39 
40 typedef struct {
41   int   mem_block_id;
42   void *data;
43   void *data_allocated;
44   void *data_owned;
45   void *data_borrowed;
46   void *data_read_only_copy;
47 } CeedQFunctionContext_Memcheck;
48 
49 CEED_INTERN int CeedVectorCreate_Memcheck(CeedSize n, CeedVector vec);
50 
51 CEED_INTERN int CeedElemRestrictionCreate_Memcheck(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients,
52                                                    const CeedInt8 *curl_orients, CeedElemRestriction r);
53 
54 CEED_INTERN int CeedQFunctionCreate_Memcheck(CeedQFunction qf);
55 
56 CEED_INTERN int CeedQFunctionContextCreate_Memcheck(CeedQFunctionContext ctx);
57