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