xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.h (revision 8c1105f8b5a9a47b9186b27dfe8d8efa69fd63e1)
121617c04Sjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
221617c04Sjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
321617c04Sjeremylt // All Rights reserved. See files LICENSE and NOTICE for details.
421617c04Sjeremylt //
521617c04Sjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software
621617c04Sjeremylt // libraries and APIs for efficient high-order finite element and spectral
721617c04Sjeremylt // element discretizations for exascale applications. For more information and
821617c04Sjeremylt // source code availability see http://github.com/ceed.
921617c04Sjeremylt //
1021617c04Sjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
1121617c04Sjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office
1221617c04Sjeremylt // of Science and the National Nuclear Security Administration) responsible for
1321617c04Sjeremylt // the planning and preparation of a capable exascale ecosystem, including
1421617c04Sjeremylt // software, applications, hardware, advanced system engineering and early
1521617c04Sjeremylt // testbed platforms, in support of the nation's exascale computing imperative.
1621617c04Sjeremylt 
173d576824SJeremy L Thompson #ifndef _ceed_ref_h
183d576824SJeremy L Thompson #define _ceed_ref_h
193d576824SJeremy L Thompson 
20ec3da8bcSJed Brown #include <ceed/ceed.h>
21ec3da8bcSJed Brown #include <ceed/backend.h>
223d576824SJeremy L Thompson #include <stdbool.h>
233d576824SJeremy L Thompson #include <stdint.h>
2421617c04Sjeremylt 
2521617c04Sjeremylt typedef struct {
26*8c1105f8SJeremy L Thompson   CeedScalar *collo_grad_1d;
27*8c1105f8SJeremy L Thompson   bool has_collo_interp;
2884a01de5SJeremy L Thompson } CeedBasis_Ref;
2984a01de5SJeremy L Thompson 
3084a01de5SJeremy L Thompson typedef struct {
3121617c04Sjeremylt   CeedScalar *array;
3221617c04Sjeremylt   CeedScalar *array_allocated;
3321617c04Sjeremylt } CeedVector_Ref;
3421617c04Sjeremylt 
3521617c04Sjeremylt typedef struct {
36d979a051Sjeremylt   const CeedInt *offsets;
37d979a051Sjeremylt   CeedInt *offsets_allocated;
38d979a051Sjeremylt   int (*Apply)(CeedElemRestriction, const CeedInt, const CeedInt,
39d979a051Sjeremylt                const CeedInt, CeedInt, CeedInt, CeedTransposeMode, CeedVector,
40d979a051Sjeremylt                CeedVector, CeedRequest *);
4121617c04Sjeremylt } CeedElemRestriction_Ref;
4221617c04Sjeremylt 
4321617c04Sjeremylt typedef struct {
44aedaa0e5Sjeremylt   const CeedScalar **inputs;
45aedaa0e5Sjeremylt   CeedScalar **outputs;
46aedaa0e5Sjeremylt } CeedQFunction_Ref;
47aedaa0e5Sjeremylt 
48aedaa0e5Sjeremylt typedef struct {
49777ff853SJeremy L Thompson   void *data;
50777ff853SJeremy L Thompson   void *data_allocated;
51777ff853SJeremy L Thompson } CeedQFunctionContext_Ref;
52777ff853SJeremy L Thompson 
53777ff853SJeremy L Thompson typedef struct {
540b454692Sjeremylt   bool is_identity_qf, is_identity_restr_op;
554fc1f125SJeremy L Thompson   CeedVector *e_vecs_full; /* Full E-vectors, inputs followed by outputs */
564fc1f125SJeremy L Thompson   uint64_t *input_states;  /* State counter of inputs */
574fc1f125SJeremy L Thompson   CeedVector *e_vecs_in;   /* Single element input E-vectors  */
584fc1f125SJeremy L Thompson   CeedVector *e_vecs_out;  /* Single element output E-vectors */
594fc1f125SJeremy L Thompson   CeedVector *q_vecs_in;   /* Single element input Q-vectors  */
604fc1f125SJeremy L Thompson   CeedVector *q_vecs_out;  /* Single element output Q-vectors */
614fc1f125SJeremy L Thompson   CeedInt    num_inputs, num_outputs;
624fc1f125SJeremy L Thompson   CeedInt    num_active_in, num_active_out;
63bb219a0fSJeremy L Thompson   CeedVector *qf_active_in;
6421617c04Sjeremylt } CeedOperator_Ref;
6521617c04Sjeremylt 
66667bc5fcSjeremylt CEED_INTERN int CeedVectorCreate_Ref(CeedInt n, CeedVector vec);
6721617c04Sjeremylt 
68d1d35e2fSjeremylt CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mem_type,
69d1d35e2fSjeremylt     CeedCopyMode copy_mode, const CeedInt *indices, CeedElemRestriction r);
7021617c04Sjeremylt 
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 
83c71e1dcdSjeremylt CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis,
84c71e1dcdSjeremylt     CeedTensorContract contract);
852f86a920SJeremy L Thompson 
8621617c04Sjeremylt CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf);
8721617c04Sjeremylt 
88777ff853SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx);
89777ff853SJeremy L Thompson 
9021617c04Sjeremylt CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op);
91c04a41a7SJeremy L Thompson 
923d576824SJeremy L Thompson #endif // _ceed_ref_h
93