1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 321617c04Sjeremylt // 4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 521617c04Sjeremylt // 6*3d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 721617c04Sjeremylt 83d576824SJeremy L Thompson #ifndef _ceed_ref_h 93d576824SJeremy L Thompson #define _ceed_ref_h 103d576824SJeremy L Thompson 11ec3da8bcSJed Brown #include <ceed/ceed.h> 12ec3da8bcSJed Brown #include <ceed/backend.h> 133d576824SJeremy L Thompson #include <stdbool.h> 143d576824SJeremy L Thompson #include <stdint.h> 1521617c04Sjeremylt 1621617c04Sjeremylt typedef struct { 178c1105f8SJeremy L Thompson CeedScalar *collo_grad_1d; 188c1105f8SJeremy L Thompson bool has_collo_interp; 1984a01de5SJeremy L Thompson } CeedBasis_Ref; 2084a01de5SJeremy L Thompson 2184a01de5SJeremy L Thompson typedef struct { 2221617c04Sjeremylt CeedScalar *array; 239c774eddSJeremy L Thompson CeedScalar *array_borrowed; 249c774eddSJeremy L Thompson CeedScalar *array_owned; 2521617c04Sjeremylt } CeedVector_Ref; 2621617c04Sjeremylt 2721617c04Sjeremylt typedef struct { 28d979a051Sjeremylt const CeedInt *offsets; 29d979a051Sjeremylt CeedInt *offsets_allocated; 30fc0567d9Srezgarshakeri // Orientation, if it exists, is true when the face must be flipped (multiplies by -1.). 31fc0567d9Srezgarshakeri const bool *orient; 32fc0567d9Srezgarshakeri bool *orient_allocated; 33d979a051Sjeremylt int (*Apply)(CeedElemRestriction, const CeedInt, const CeedInt, 34d979a051Sjeremylt const CeedInt, CeedInt, CeedInt, CeedTransposeMode, CeedVector, 35d979a051Sjeremylt CeedVector, CeedRequest *); 3621617c04Sjeremylt } CeedElemRestriction_Ref; 3721617c04Sjeremylt 3821617c04Sjeremylt typedef struct { 39aedaa0e5Sjeremylt const CeedScalar **inputs; 40aedaa0e5Sjeremylt CeedScalar **outputs; 41aedaa0e5Sjeremylt } CeedQFunction_Ref; 42aedaa0e5Sjeremylt 43aedaa0e5Sjeremylt typedef struct { 44777ff853SJeremy L Thompson void *data; 459c774eddSJeremy L Thompson void *data_borrowed; 469c774eddSJeremy L Thompson void *data_owned; 47777ff853SJeremy L Thompson } CeedQFunctionContext_Ref; 48777ff853SJeremy L Thompson 49777ff853SJeremy L Thompson typedef struct { 500b454692Sjeremylt bool is_identity_qf, is_identity_restr_op; 514fc1f125SJeremy L Thompson CeedVector *e_vecs_full; /* Full E-vectors, inputs followed by outputs */ 524fc1f125SJeremy L Thompson uint64_t *input_states; /* State counter of inputs */ 534fc1f125SJeremy L Thompson CeedVector *e_vecs_in; /* Single element input E-vectors */ 544fc1f125SJeremy L Thompson CeedVector *e_vecs_out; /* Single element output E-vectors */ 554fc1f125SJeremy L Thompson CeedVector *q_vecs_in; /* Single element input Q-vectors */ 564fc1f125SJeremy L Thompson CeedVector *q_vecs_out; /* Single element output Q-vectors */ 574fc1f125SJeremy L Thompson CeedInt num_inputs, num_outputs; 584fc1f125SJeremy L Thompson CeedInt num_active_in, num_active_out; 59bb219a0fSJeremy L Thompson CeedVector *qf_active_in; 6021617c04Sjeremylt } CeedOperator_Ref; 6121617c04Sjeremylt 621f9221feSJeremy L Thompson CEED_INTERN int CeedVectorCreate_Ref(CeedSize n, CeedVector vec); 6321617c04Sjeremylt 64d1d35e2fSjeremylt CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mem_type, 65d1d35e2fSjeremylt CeedCopyMode copy_mode, const CeedInt *indices, CeedElemRestriction r); 6621617c04Sjeremylt 67fc0567d9Srezgarshakeri CEED_INTERN int CeedElemRestrictionCreateOriented_Ref(CeedMemType mem_type, 68fc0567d9Srezgarshakeri CeedCopyMode copy_mode, const CeedInt *indices, 69fc0567d9Srezgarshakeri const bool *orient, CeedElemRestriction r); 70fc0567d9Srezgarshakeri 71d1d35e2fSjeremylt CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P_1d, 72d1d35e2fSjeremylt CeedInt Q_1d, const CeedScalar *interp_1d, const CeedScalar *grad_1d, 73d1d35e2fSjeremylt const CeedScalar *q_ref_1d, const CeedScalar *q_weight_1d, CeedBasis basis); 7421617c04Sjeremylt 75667bc5fcSjeremylt CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo, 76d1d35e2fSjeremylt CeedInt dim, CeedInt num_dof, CeedInt num_qpts, 77a8de75f0Sjeremylt const CeedScalar *interp, 78a8de75f0Sjeremylt const CeedScalar *grad, 79d1d35e2fSjeremylt const CeedScalar *q_ref, 80d1d35e2fSjeremylt const CeedScalar *q_weight, 81a8de75f0Sjeremylt CeedBasis basis); 82a8de75f0Sjeremylt 8350c301a5SRezgar Shakeri CEED_INTERN int CeedBasisCreateHdiv_Ref(CeedElemTopology topo, 8450c301a5SRezgar Shakeri CeedInt dim, CeedInt num_dof, CeedInt num_qpts, 8550c301a5SRezgar Shakeri const CeedScalar *interp, 8650c301a5SRezgar Shakeri const CeedScalar *div, 8750c301a5SRezgar Shakeri const CeedScalar *q_ref, 8850c301a5SRezgar Shakeri const CeedScalar *q_weight, 8950c301a5SRezgar Shakeri CeedBasis basis); 9050c301a5SRezgar Shakeri 91c71e1dcdSjeremylt CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis, 92c71e1dcdSjeremylt CeedTensorContract contract); 932f86a920SJeremy L Thompson 9421617c04Sjeremylt CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf); 9521617c04Sjeremylt 96777ff853SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx); 97777ff853SJeremy L Thompson 9821617c04Sjeremylt CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op); 99c04a41a7SJeremy L Thompson 1003d576824SJeremy L Thompson #endif // _ceed_ref_h 101