1 // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 2 // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 3 // All Rights reserved. See files LICENSE and NOTICE for details. 4 // 5 // This file is part of CEED, a collection of benchmarks, miniapps, software 6 // libraries and APIs for efficient high-order finite element and spectral 7 // element discretizations for exascale applications. For more information and 8 // source code availability see http://github.com/ceed. 9 // 10 // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11 // a collaborative effort of two U.S. Department of Energy organizations (Office 12 // of Science and the National Nuclear Security Administration) responsible for 13 // the planning and preparation of a capable exascale ecosystem, including 14 // software, applications, hardware, advanced system engineering and early 15 // testbed platforms, in support of the nation's exascale computing imperative. 16 17 #ifndef _ceed_ref_h 18 #define _ceed_ref_h 19 20 #include <ceed/ceed.h> 21 #include <ceed/backend.h> 22 #include <stdbool.h> 23 #include <stdint.h> 24 25 typedef struct { 26 CeedScalar *collograd1d; 27 bool collo_interp; 28 } CeedBasis_Ref; 29 30 typedef struct { 31 CeedScalar *array; 32 CeedScalar *array_allocated; 33 } CeedVector_Ref; 34 35 typedef struct { 36 const CeedInt *offsets; 37 CeedInt *offsets_allocated; 38 int (*Apply)(CeedElemRestriction, const CeedInt, const CeedInt, 39 const CeedInt, CeedInt, CeedInt, CeedTransposeMode, CeedVector, 40 CeedVector, CeedRequest *); 41 } CeedElemRestriction_Ref; 42 43 typedef struct { 44 const CeedScalar **inputs; 45 CeedScalar **outputs; 46 bool setup_done; 47 } CeedQFunction_Ref; 48 49 typedef struct { 50 void *data; 51 void *data_allocated; 52 } CeedQFunctionContext_Ref; 53 54 typedef struct { 55 bool is_identity_qf, is_identity_restr_op; 56 CeedVector 57 *e_vecs; /* E-vectors needed to apply operator (input followed by outputs) */ 58 CeedScalar **e_data; 59 uint64_t *input_state; /* State counter of inputs */ 60 CeedVector *e_vecs_in; /* Input E-vectors needed to apply operator */ 61 CeedVector *e_vecs_out; /* Output E-vectors needed to apply operator */ 62 CeedVector *q_vecs_in; /* Input Q-vectors needed to apply operator */ 63 CeedVector *q_vecs_out; /* Output Q-vectors needed to apply operator */ 64 CeedInt num_e_vecs_in; 65 CeedInt num_e_vecs_out; 66 CeedInt qf_num_active_in, qf_num_active_out; 67 CeedVector *qf_active_in; 68 } CeedOperator_Ref; 69 70 CEED_INTERN int CeedVectorCreate_Ref(CeedInt n, CeedVector vec); 71 72 CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mem_type, 73 CeedCopyMode copy_mode, const CeedInt *indices, CeedElemRestriction r); 74 75 CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P_1d, 76 CeedInt Q_1d, const CeedScalar *interp_1d, const CeedScalar *grad_1d, 77 const CeedScalar *q_ref_1d, const CeedScalar *q_weight_1d, CeedBasis basis); 78 79 CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo, 80 CeedInt dim, CeedInt num_dof, CeedInt num_qpts, 81 const CeedScalar *interp, 82 const CeedScalar *grad, 83 const CeedScalar *q_ref, 84 const CeedScalar *q_weight, 85 CeedBasis basis); 86 87 CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis, 88 CeedTensorContract contract); 89 90 CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf); 91 92 CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx); 93 94 CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op); 95 96 #endif // _ceed_ref_h 97