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, CeedInt, CeedInt, CeedInt, CeedInt, CeedInt, CeedTransposeMode, CeedVector, CeedVector, CeedRequest *); 34 } CeedElemRestriction_Ref; 35 36 typedef struct { 37 const CeedScalar **inputs; 38 CeedScalar **outputs; 39 } CeedQFunction_Ref; 40 41 typedef struct { 42 void *data; 43 void *data_borrowed; 44 void *data_owned; 45 } CeedQFunctionContext_Ref; 46 47 typedef struct { 48 bool is_identity_qf, is_identity_restr_op; 49 CeedVector *e_vecs_full; /* Full E-vectors, inputs followed by outputs */ 50 uint64_t *input_states; /* State counter of inputs */ 51 CeedVector *e_vecs_in; /* Single element input E-vectors */ 52 CeedVector *e_vecs_out; /* Single element output E-vectors */ 53 CeedVector *q_vecs_in; /* Single element input Q-vectors */ 54 CeedVector *q_vecs_out; /* Single element output Q-vectors */ 55 CeedInt num_inputs, num_outputs; 56 CeedInt num_active_in, num_active_out; 57 CeedVector *qf_active_in; 58 } CeedOperator_Ref; 59 60 CEED_INTERN int CeedVectorCreate_Ref(CeedSize n, CeedVector vec); 61 62 CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, CeedElemRestriction r); 63 CEED_INTERN int CeedElemRestrictionCreateOriented_Ref(CeedMemType mem_type, CeedCopyMode copy_mode, const CeedInt *offsets, const bool *orient, 64 CeedElemRestriction r); 65 66 CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P_1d, CeedInt Q_1d, const CeedScalar *interp_1d, const CeedScalar *grad_1d, 67 const CeedScalar *q_ref_1d, const CeedScalar *q_weight_1d, CeedBasis basis); 68 CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo, CeedInt dim, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, 69 const CeedScalar *grad, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis); 70 CEED_INTERN int CeedBasisCreateHdiv_Ref(CeedElemTopology topo, CeedInt dim, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, 71 const CeedScalar *div, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis); 72 CEED_INTERN int CeedBasisCreateHcurl_Ref(CeedElemTopology topo, CeedInt dim, CeedInt num_nodes, CeedInt num_qpts, const CeedScalar *interp, 73 const CeedScalar *curl, const CeedScalar *q_ref, const CeedScalar *q_weight, CeedBasis basis); 74 75 CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis, CeedTensorContract contract); 76 77 CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf); 78 79 CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx); 80 81 CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op); 82 83 #endif // _ceed_ref_h 84