xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.h (revision 50c301a53d2cec48a2aa861bf6f38393f4831c2f)
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 {
268c1105f8SJeremy L Thompson   CeedScalar *collo_grad_1d;
278c1105f8SJeremy L Thompson   bool has_collo_interp;
2884a01de5SJeremy L Thompson } CeedBasis_Ref;
2984a01de5SJeremy L Thompson 
3084a01de5SJeremy L Thompson typedef struct {
3121617c04Sjeremylt   CeedScalar *array;
329c774eddSJeremy L Thompson   CeedScalar *array_borrowed;
339c774eddSJeremy L Thompson   CeedScalar *array_owned;
3421617c04Sjeremylt } CeedVector_Ref;
3521617c04Sjeremylt 
3621617c04Sjeremylt typedef struct {
37d979a051Sjeremylt   const CeedInt *offsets;
38d979a051Sjeremylt   CeedInt *offsets_allocated;
39d979a051Sjeremylt   int (*Apply)(CeedElemRestriction, const CeedInt, const CeedInt,
40d979a051Sjeremylt                const CeedInt, CeedInt, CeedInt, CeedTransposeMode, CeedVector,
41d979a051Sjeremylt                CeedVector, CeedRequest *);
4221617c04Sjeremylt } CeedElemRestriction_Ref;
4321617c04Sjeremylt 
4421617c04Sjeremylt typedef struct {
45aedaa0e5Sjeremylt   const CeedScalar **inputs;
46aedaa0e5Sjeremylt   CeedScalar **outputs;
47aedaa0e5Sjeremylt } CeedQFunction_Ref;
48aedaa0e5Sjeremylt 
49aedaa0e5Sjeremylt typedef struct {
50777ff853SJeremy L Thompson   void *data;
519c774eddSJeremy L Thompson   void *data_borrowed;
529c774eddSJeremy L Thompson   void *data_owned;
53777ff853SJeremy L Thompson } CeedQFunctionContext_Ref;
54777ff853SJeremy L Thompson 
55777ff853SJeremy L Thompson typedef struct {
560b454692Sjeremylt   bool is_identity_qf, is_identity_restr_op;
574fc1f125SJeremy L Thompson   CeedVector *e_vecs_full; /* Full E-vectors, inputs followed by outputs */
584fc1f125SJeremy L Thompson   uint64_t *input_states;  /* State counter of inputs */
594fc1f125SJeremy L Thompson   CeedVector *e_vecs_in;   /* Single element input E-vectors  */
604fc1f125SJeremy L Thompson   CeedVector *e_vecs_out;  /* Single element output E-vectors */
614fc1f125SJeremy L Thompson   CeedVector *q_vecs_in;   /* Single element input Q-vectors  */
624fc1f125SJeremy L Thompson   CeedVector *q_vecs_out;  /* Single element output Q-vectors */
634fc1f125SJeremy L Thompson   CeedInt    num_inputs, num_outputs;
644fc1f125SJeremy L Thompson   CeedInt    num_active_in, num_active_out;
65bb219a0fSJeremy L Thompson   CeedVector *qf_active_in;
6621617c04Sjeremylt } CeedOperator_Ref;
6721617c04Sjeremylt 
68667bc5fcSjeremylt CEED_INTERN int CeedVectorCreate_Ref(CeedInt n, CeedVector vec);
6921617c04Sjeremylt 
70d1d35e2fSjeremylt CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mem_type,
71d1d35e2fSjeremylt     CeedCopyMode copy_mode, const CeedInt *indices, CeedElemRestriction r);
7221617c04Sjeremylt 
73d1d35e2fSjeremylt CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P_1d,
74d1d35e2fSjeremylt     CeedInt Q_1d, const CeedScalar *interp_1d, const CeedScalar *grad_1d,
75d1d35e2fSjeremylt     const CeedScalar *q_ref_1d, const CeedScalar *q_weight_1d, CeedBasis basis);
7621617c04Sjeremylt 
77667bc5fcSjeremylt CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo,
78d1d35e2fSjeremylt                                       CeedInt dim, CeedInt num_dof, CeedInt num_qpts,
79a8de75f0Sjeremylt                                       const CeedScalar *interp,
80a8de75f0Sjeremylt                                       const CeedScalar *grad,
81d1d35e2fSjeremylt                                       const CeedScalar *q_ref,
82d1d35e2fSjeremylt                                       const CeedScalar *q_weight,
83a8de75f0Sjeremylt                                       CeedBasis basis);
84a8de75f0Sjeremylt 
85*50c301a5SRezgar Shakeri CEED_INTERN int CeedBasisCreateHdiv_Ref(CeedElemTopology topo,
86*50c301a5SRezgar Shakeri                                         CeedInt dim, CeedInt num_dof, CeedInt num_qpts,
87*50c301a5SRezgar Shakeri                                         const CeedScalar *interp,
88*50c301a5SRezgar Shakeri                                         const CeedScalar *div,
89*50c301a5SRezgar Shakeri                                         const CeedScalar *q_ref,
90*50c301a5SRezgar Shakeri                                         const CeedScalar *q_weight,
91*50c301a5SRezgar Shakeri                                         CeedBasis basis);
92*50c301a5SRezgar Shakeri 
93c71e1dcdSjeremylt CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis,
94c71e1dcdSjeremylt     CeedTensorContract contract);
952f86a920SJeremy L Thompson 
9621617c04Sjeremylt CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf);
9721617c04Sjeremylt 
98777ff853SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx);
99777ff853SJeremy L Thompson 
10021617c04Sjeremylt CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op);
101c04a41a7SJeremy L Thompson 
1023d576824SJeremy L Thompson #endif // _ceed_ref_h
103