xref: /libCEED/rust/libceed-sys/c-src/backends/ref/ceed-ref.h (revision 3661185ec24cb7db8be31791839e73c243a7fbe2)
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 
17d863ab9bSjeremylt #include <ceed-backend.h>
1821617c04Sjeremylt #include <string.h>
19dfe03796SJeremy L Thompson #include <math.h>
2021617c04Sjeremylt 
2121617c04Sjeremylt typedef struct {
22dfe03796SJeremy L Thompson   CeedScalar *collograd1d;
23dfe03796SJeremy L Thompson   bool collointerp;
2484a01de5SJeremy L Thompson } CeedBasis_Ref;
2584a01de5SJeremy L Thompson 
2684a01de5SJeremy L Thompson typedef struct {
2721617c04Sjeremylt   CeedScalar *array;
2821617c04Sjeremylt   CeedScalar *array_allocated;
2921617c04Sjeremylt } CeedVector_Ref;
3021617c04Sjeremylt 
3121617c04Sjeremylt typedef struct {
32d979a051Sjeremylt   const CeedInt *offsets;
33d979a051Sjeremylt   CeedInt *offsets_allocated;
34d979a051Sjeremylt   int (*Apply)(CeedElemRestriction, const CeedInt, const CeedInt,
35d979a051Sjeremylt                const CeedInt, CeedInt, CeedInt, CeedTransposeMode, CeedVector,
36d979a051Sjeremylt                CeedVector, CeedRequest *);
3721617c04Sjeremylt } CeedElemRestriction_Ref;
3821617c04Sjeremylt 
3921617c04Sjeremylt typedef struct {
40aedaa0e5Sjeremylt   const CeedScalar **inputs;
41aedaa0e5Sjeremylt   CeedScalar **outputs;
42aedaa0e5Sjeremylt   bool setupdone;
43aedaa0e5Sjeremylt } CeedQFunction_Ref;
44aedaa0e5Sjeremylt 
45aedaa0e5Sjeremylt typedef struct {
4616911fdaSjeremylt   bool identityqf;
4742877f77Sjeremylt   CeedVector
4842877f77Sjeremylt   *evecs;   /// E-vectors needed to apply operator (input followed by outputs)
4942877f77Sjeremylt   CeedScalar **edata;
508d713cf6Sjeremylt   uint64_t *inputstate;  /// State counter of inputs
5191703d3fSjeremylt   CeedVector *evecsin;   /// Input E-vectors needed to apply operator
5291703d3fSjeremylt   CeedVector *evecsout;  /// Output E-vectors needed to apply operator
53aedaa0e5Sjeremylt   CeedVector *qvecsin;   /// Input Q-vectors needed to apply operator
54aedaa0e5Sjeremylt   CeedVector *qvecsout;  /// Output Q-vectors needed to apply operator
5542877f77Sjeremylt   CeedInt    numein;
5642877f77Sjeremylt   CeedInt    numeout;
5721617c04Sjeremylt } CeedOperator_Ref;
5821617c04Sjeremylt 
59667bc5fcSjeremylt CEED_INTERN int CeedVectorCreate_Ref(CeedInt n, CeedVector vec);
6021617c04Sjeremylt 
61667bc5fcSjeremylt CEED_INTERN int CeedElemRestrictionCreate_Ref(CeedMemType mtype,
62667bc5fcSjeremylt     CeedCopyMode cmode, const CeedInt *indices, CeedElemRestriction r);
6321617c04Sjeremylt 
64667bc5fcSjeremylt CEED_INTERN int CeedBasisCreateTensorH1_Ref(CeedInt dim, CeedInt P1d,
65*3661185eSjeremylt     CeedInt Q1d, const CeedScalar *interp1d, const CeedScalar *grad1d,
66*3661185eSjeremylt     const CeedScalar *qref1d, const CeedScalar *qweight1d, CeedBasis basis);
6721617c04Sjeremylt 
68667bc5fcSjeremylt CEED_INTERN int CeedBasisCreateH1_Ref(CeedElemTopology topo,
69667bc5fcSjeremylt                                       CeedInt dim, CeedInt ndof, CeedInt nqpts,
70a8de75f0Sjeremylt                                       const CeedScalar *interp,
71a8de75f0Sjeremylt                                       const CeedScalar *grad,
72a8de75f0Sjeremylt                                       const CeedScalar *qref,
73a8de75f0Sjeremylt                                       const CeedScalar *qweight,
74a8de75f0Sjeremylt                                       CeedBasis basis);
75a8de75f0Sjeremylt 
76c71e1dcdSjeremylt CEED_INTERN int CeedTensorContractCreate_Ref(CeedBasis basis,
77c71e1dcdSjeremylt     CeedTensorContract contract);
782f86a920SJeremy L Thompson 
7921617c04Sjeremylt CEED_INTERN int CeedQFunctionCreate_Ref(CeedQFunction qf);
8021617c04Sjeremylt 
8121617c04Sjeremylt CEED_INTERN int CeedOperatorCreate_Ref(CeedOperator op);
82