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 #include <stdbool.h> 12 #include <stdint.h> 13 14 typedef struct { 15 CeedScalar *array; 16 CeedScalar *array_borrowed; 17 CeedScalar *array_owned; 18 } CeedVector_Ref; 19 20 typedef struct { 21 const CeedInt *offsets; 22 const CeedInt *offsets_borrowed; 23 const CeedInt *offsets_owned; 24 const bool *orients; /* Orientation, if it exists, is true when the dof must be flipped */ 25 const bool *orients_borrowed; 26 const bool *orients_owned; 27 const CeedInt8 *curl_orients; /* Tridiagonal matrix (row-major) for a general transformation during restriction */ 28 const CeedInt8 *curl_orients_borrowed; 29 const CeedInt8 *curl_orients_owned; 30 int (*Apply)(CeedElemRestriction, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, bool, bool, CeedVector, CeedVector, 31 CeedRequest *); 32 } CeedElemRestriction_Ref; 33 34 typedef struct { 35 CeedScalar *collo_grad_1d; 36 bool has_collo_interp; 37 } CeedBasis_Ref; 38 39 typedef struct { 40 const CeedScalar **inputs; 41 CeedScalar **outputs; 42 } CeedQFunction_Ref; 43 44 typedef struct { 45 void *data; 46 void *data_borrowed; 47 void *data_owned; 48 } CeedQFunctionContext_Ref; 49 50 typedef struct { 51 bool is_identity_qf, is_identity_rstr_op; 52 CeedVector *e_vecs_full; /* Full E-vectors, inputs followed by outputs */ 53 uint64_t *input_states; /* State counter of inputs */ 54 CeedVector *e_vecs_in; /* Single element input E-vectors */ 55 CeedVector *e_vecs_out; /* Single element output E-vectors */ 56 CeedVector *q_vecs_in; /* Single element input Q-vectors */ 57 CeedVector *q_vecs_out; /* Single element output Q-vectors */ 58 CeedInt num_inputs, num_outputs; 59 CeedInt num_active_in, num_active_out; 60 CeedVector point_coords_elem; 61 } CeedOperator_Ref; 62 63 CEED_INTERN int CeedVectorCreate_Ref(CeedSize n, CeedVector vec); 64 65 CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orients, 66 const CeedInt8 *curl_orients, CeedElemRestriction r); 67 68 CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P_1d, CeedInt Q_1d, const CeedScalar *interp_1d, const CeedScalar *grad_1d, 69 const CeedScalar *q_ref_1d, const CeedScalar *q_weight_1d, CeedBasis basis); 70 CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo, CeedInt dim, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, 71 const CeedScalar *grad, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis); 72 CEED_INTERN int CeedBasisCreateHdiv_Ref(CeedElemTopology topo, CeedInt dim, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, 73 const CeedScalar *div, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis); 74 CEED_INTERN int CeedBasisCreateHcurl_Ref(CeedElemTopology topo, CeedInt dim, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, 75 const CeedScalar *curl, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis); 76 77 CEED_INTERN int CeedTensorContractCreate_Ref(CeedTensorContract contract); 78 79 CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf); 80 81 CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx); 82 83 CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op); 84 CEED_INTERN int CeedOperatorCreateAtPoints_Ref(CeedOperator op); 85