xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.h (revision ec3da8bcb94d9f0073544b37b5081a06981a86f7)
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 
20*ec3da8bcSJed Brown #include <ceed/ceed.h>
21*ec3da8bcSJed Brown #include <ceed/backend.h>
223d576824SJeremy L Thompson #include <stdbool.h>
233d576824SJeremy L Thompson #include <stdint.h>
2421617c04Sjeremylt 
2521617c04Sjeremylt typedef struct {
26dfe03796SJeremy L Thompson   CeedScalar *collograd1d;
27dfe03796SJeremy L Thompson   bool collointerp;
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   bool setupdone;
47aedaa0e5Sjeremylt } CeedQFunction_Ref;
48aedaa0e5Sjeremylt 
49aedaa0e5Sjeremylt typedef struct {
50777ff853SJeremy L Thompson   void *data;
51777ff853SJeremy L Thompson   void *data_allocated;
52777ff853SJeremy L Thompson } CeedQFunctionContext_Ref;
53777ff853SJeremy L Thompson 
54777ff853SJeremy L Thompson typedef struct {
5516911fdaSjeremylt   bool identityqf;
5642877f77Sjeremylt   CeedVector
5742877f77Sjeremylt   *evecs;   /// E-vectors needed to apply operator (input followed by outputs)
5842877f77Sjeremylt   CeedScalar **edata;
598d713cf6Sjeremylt   uint64_t *inputstate;  /// State counter of inputs
6091703d3fSjeremylt   CeedVector *evecsin;   /// Input E-vectors needed to apply operator
6191703d3fSjeremylt   CeedVector *evecsout;  /// Output E-vectors needed to apply operator
62aedaa0e5Sjeremylt   CeedVector *qvecsin;   /// Input Q-vectors needed to apply operator
63aedaa0e5Sjeremylt   CeedVector *qvecsout;  /// Output Q-vectors needed to apply operator
6442877f77Sjeremylt   CeedInt    numein;
6542877f77Sjeremylt   CeedInt    numeout;
6621617c04Sjeremylt } CeedOperator_Ref;
6721617c04Sjeremylt 
68667bc5fcSjeremylt CEED_INTERN int CeedVectorCreate_Ref(CeedInt n, CeedVector vec);
6921617c04Sjeremylt 
70667bc5fcSjeremylt CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mtype,
71667bc5fcSjeremylt     CeedCopyMode cmode, const CeedInt *indices, CeedElemRestriction r);
7221617c04Sjeremylt 
73667bc5fcSjeremylt CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P1d,
743661185eSjeremylt     CeedInt Q1d, const CeedScalar *interp1d, const CeedScalar *grad1d,
753661185eSjeremylt     const CeedScalar *qref1d, const CeedScalar *qweight1d, CeedBasis basis);
7621617c04Sjeremylt 
77667bc5fcSjeremylt CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo,
78667bc5fcSjeremylt                                       CeedInt dim, CeedInt ndof, CeedInt nqpts,
79a8de75f0Sjeremylt                                       const CeedScalar *interp,
80a8de75f0Sjeremylt                                       const CeedScalar *grad,
81a8de75f0Sjeremylt                                       const CeedScalar *qref,
82a8de75f0Sjeremylt                                       const CeedScalar *qweight,
83a8de75f0Sjeremylt                                       CeedBasis basis);
84a8de75f0Sjeremylt 
85c71e1dcdSjeremylt CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis,
86c71e1dcdSjeremylt     CeedTensorContract contract);
872f86a920SJeremy L Thompson 
8821617c04Sjeremylt CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf);
8921617c04Sjeremylt 
90777ff853SJeremy L Thompson CEED_INTERN int CeedQFunctionContextCreate_Ref(CeedQFunctionContext ctx);
91777ff853SJeremy L Thompson 
9221617c04Sjeremylt CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op);
93c04a41a7SJeremy L Thompson 
94c04a41a7SJeremy L Thompson CEED_INTERN int CeedCompositeOperatorCreate_Ref(CeedOperator op);
953d576824SJeremy L Thompson 
963d576824SJeremy L Thompson #endif // _ceed_ref_h
97