xref: /libCEED/include/ceed-impl.h (revision 3047f7896db8a74672e0eaf4fe2741a47841cabb)
16ea7c6c1SJed Brown // Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
26ea7c6c1SJed Brown // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
36ea7c6c1SJed Brown // reserved. See files LICENSE and NOTICE for details.
46ea7c6c1SJed Brown //
56ea7c6c1SJed Brown // This file is part of CEED, a collection of benchmarks, miniapps, software
66ea7c6c1SJed Brown // libraries and APIs for efficient high-order finite element and spectral
76ea7c6c1SJed Brown // element discretizations for exascale applications. For more information and
86ea7c6c1SJed Brown // source code availability see http://github.com/ceed.
96ea7c6c1SJed Brown //
106ea7c6c1SJed Brown // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
116ea7c6c1SJed Brown // a collaborative effort of two U.S. Department of Energy organizations (Office
126ea7c6c1SJed Brown // of Science and the National Nuclear Security Administration) responsible for
136ea7c6c1SJed Brown // the planning and preparation of a capable exascale ecosystem, including
146ea7c6c1SJed Brown // software, applications, hardware, advanced system engineering and early
156ea7c6c1SJed Brown // testbed platforms, in support of the nation's exascale computing imperative.
166ea7c6c1SJed Brown 
175d6bafb2Sjeremylt /// @file
185d6bafb2Sjeremylt /// Private header for frontend components of libCEED
196ea7c6c1SJed Brown #ifndef _ceed_impl_h
206ea7c6c1SJed Brown #define _ceed_impl_h
216ea7c6c1SJed Brown 
22ec3da8bcSJed Brown #include <ceed/ceed.h>
23ec3da8bcSJed Brown #include <ceed/backend.h>
24ff8ca64bSJed Brown #include <stdbool.h>
256ea7c6c1SJed Brown 
267a982d89SJeremy L. Thompson /** @defgroup CeedUser Public API for Ceed
277a982d89SJeremy L. Thompson     @ingroup Ceed
287a982d89SJeremy L. Thompson */
297a982d89SJeremy L. Thompson /** @defgroup CeedBackend Backend API for Ceed
307a982d89SJeremy L. Thompson     @ingroup Ceed
317a982d89SJeremy L. Thompson */
327a982d89SJeremy L. Thompson /** @defgroup CeedDeveloper Internal library functions for Ceed
337a982d89SJeremy L. Thompson     @ingroup Ceed
347a982d89SJeremy L. Thompson */
357a982d89SJeremy L. Thompson /** @defgroup CeedVectorUser Public API for CeedVector
367a982d89SJeremy L. Thompson     @ingroup CeedVector
377a982d89SJeremy L. Thompson */
387a982d89SJeremy L. Thompson /** @defgroup CeedVectorBackend Backend API for CeedVector
397a982d89SJeremy L. Thompson     @ingroup CeedVector
407a982d89SJeremy L. Thompson */
417a982d89SJeremy L. Thompson /** @defgroup CeedVectorDeveloper Internal library functions for CeedVector
427a982d89SJeremy L. Thompson     @ingroup CeedVector
437a982d89SJeremy L. Thompson */
447a982d89SJeremy L. Thompson /** @defgroup CeedElemRestrictionUser Public API for CeedElemRestriction
457a982d89SJeremy L. Thompson     @ingroup CeedElemRestriction
467a982d89SJeremy L. Thompson */
477a982d89SJeremy L. Thompson /** @defgroup CeedElemRestrictionBackend Backend API for CeedElemRestriction
487a982d89SJeremy L. Thompson     @ingroup CeedElemRestriction
497a982d89SJeremy L. Thompson */
507a982d89SJeremy L. Thompson /** @defgroup CeedElemRestrictionDeveloper Internal library functions for CeedElemRestriction
517a982d89SJeremy L. Thompson     @ingroup CeedElemRestriction
527a982d89SJeremy L. Thompson */
537a982d89SJeremy L. Thompson /** @defgroup CeedBasisUser Public API for CeedBasis
547a982d89SJeremy L. Thompson     @ingroup CeedBasis
557a982d89SJeremy L. Thompson */
567a982d89SJeremy L. Thompson /** @defgroup CeedBasisBackend Backend API for CeedBasis
577a982d89SJeremy L. Thompson     @ingroup CeedBasis
587a982d89SJeremy L. Thompson */
597a982d89SJeremy L. Thompson /** @defgroup CeedBasisDeveloper Internal library functions for CeedBasis
607a982d89SJeremy L. Thompson     @ingroup CeedBasis
617a982d89SJeremy L. Thompson */
627a982d89SJeremy L. Thompson /** @defgroup CeedQFunctionUser Public API for CeedQFunction
637a982d89SJeremy L. Thompson     @ingroup CeedQFunction
647a982d89SJeremy L. Thompson */
657a982d89SJeremy L. Thompson /** @defgroup CeedQFunctionBackend Backend API for CeedQFunction
667a982d89SJeremy L. Thompson     @ingroup CeedQFunction
677a982d89SJeremy L. Thompson */
687a982d89SJeremy L. Thompson /** @defgroup CeedQFunctionDeveloper Internal library functions for CeedQFunction
697a982d89SJeremy L. Thompson     @ingroup CeedQFunction
707a982d89SJeremy L. Thompson */
717a982d89SJeremy L. Thompson /** @defgroup CeedOperatorUser Public API for CeedOperator
727a982d89SJeremy L. Thompson     @ingroup CeedOperator
737a982d89SJeremy L. Thompson */
747a982d89SJeremy L. Thompson /** @defgroup CeedOperatorBackend Backend API for CeedOperator
757a982d89SJeremy L. Thompson     @ingroup CeedOperator
767a982d89SJeremy L. Thompson */
777a982d89SJeremy L. Thompson /** @defgroup CeedOperatorDeveloper Internal library functions for CeedOperator
787a982d89SJeremy L. Thompson     @ingroup CeedOperator
797a982d89SJeremy L. Thompson */
807a982d89SJeremy L. Thompson 
81fe2413ffSjeremylt // Lookup table field for backend functions
82fe2413ffSjeremylt typedef struct {
83d1d35e2fSjeremylt   const char *func_name;
84fe2413ffSjeremylt   size_t offset;
85d1d35e2fSjeremylt } FOffset;
86fe2413ffSjeremylt 
87aefd8378Sjeremylt // Lookup table field for object delegates
88aefd8378Sjeremylt typedef struct {
89d1d35e2fSjeremylt   char *obj_name;
90aefd8378Sjeremylt   Ceed delegate;
91d1d35e2fSjeremylt } ObjDelegate;
92aefd8378Sjeremylt 
936ea7c6c1SJed Brown struct Ceed_private {
94e07206deSjeremylt   const char *resource;
955fe0d4faSjeremylt   Ceed delegate;
962f86a920SJeremy L Thompson   Ceed parent;
97d1d35e2fSjeremylt   ObjDelegate *obj_delegates;
98d1d35e2fSjeremylt   int obj_delegate_count;
99d1d35e2fSjeremylt   Ceed op_fallback_ceed, op_fallback_parent;
100d1d35e2fSjeremylt   const char *op_fallback_resource;
1012f86a920SJeremy L Thompson   int (*Error)(Ceed, const char *, int, const char *, int, const char *,
102f9982c62SWill Pazner                va_list *);
103c907536fSjeremylt   int (*GetPreferredMemType)(CeedMemType *);
1046ea7c6c1SJed Brown   int (*Destroy)(Ceed);
105f8902d9eSjeremylt   int (*VectorCreate)(CeedInt, CeedVector);
106667bc5fcSjeremylt   int (*ElemRestrictionCreate)(CeedMemType, CeedCopyMode,
107667bc5fcSjeremylt                                const CeedInt *, CeedElemRestriction);
108fc0567d9Srezgarshakeri   int (*ElemRestrictionCreateOriented)(CeedMemType, CeedCopyMode,
109fc0567d9Srezgarshakeri                                        const CeedInt *, const bool *,
110fc0567d9Srezgarshakeri                                        CeedElemRestriction);
111667bc5fcSjeremylt   int (*ElemRestrictionCreateBlocked)(CeedMemType, CeedCopyMode,
112667bc5fcSjeremylt                                       const CeedInt *, CeedElemRestriction);
113667bc5fcSjeremylt   int (*BasisCreateTensorH1)(CeedInt, CeedInt, CeedInt, const CeedScalar *,
1142f86a920SJeremy L Thompson                              const CeedScalar *, const CeedScalar *,
1152f86a920SJeremy L Thompson                              const CeedScalar *, CeedBasis);
116667bc5fcSjeremylt   int (*BasisCreateH1)(CeedElemTopology, CeedInt, CeedInt, CeedInt,
117a8de75f0Sjeremylt                        const CeedScalar *,
1182f86a920SJeremy L Thompson                        const CeedScalar *, const CeedScalar *,
1192f86a920SJeremy L Thompson                        const CeedScalar *, CeedBasis);
12050c301a5SRezgar Shakeri   int (*BasisCreateHdiv)(CeedElemTopology, CeedInt, CeedInt, CeedInt,
12150c301a5SRezgar Shakeri                          const CeedScalar *,
12250c301a5SRezgar Shakeri                          const CeedScalar *, const CeedScalar *,
12350c301a5SRezgar Shakeri                          const CeedScalar *, CeedBasis);
124c71e1dcdSjeremylt   int (*TensorContractCreate)(CeedBasis, CeedTensorContract);
1256ea7c6c1SJed Brown   int (*QFunctionCreate)(CeedQFunction);
126777ff853SJeremy L Thompson   int (*QFunctionContextCreate)(CeedQFunctionContext);
1276ea7c6c1SJed Brown   int (*OperatorCreate)(CeedOperator);
12852d6035fSJeremy L Thompson   int (*CompositeOperatorCreate)(CeedOperator);
129d1d35e2fSjeremylt   int ref_count;
1306ea7c6c1SJed Brown   void *data;
1313f21f6b1SJeremy L Thompson   bool is_debug;
1323f21f6b1SJeremy L Thompson   bool is_deterministic;
133d1d35e2fSjeremylt   char err_msg[CEED_MAX_RESOURCE_LEN];
134d1d35e2fSjeremylt   FOffset *f_offsets;
1356ea7c6c1SJed Brown };
1366ea7c6c1SJed Brown 
1376ea7c6c1SJed Brown struct CeedVector_private {
1386ea7c6c1SJed Brown   Ceed ceed;
1399c774eddSJeremy L Thompson   int (*HasValidArray)(CeedVector, bool *);
1409c774eddSJeremy L Thompson   int (*HasBorrowedArrayOfType)(CeedVector, CeedMemType, bool *);
1416ea7c6c1SJed Brown   int (*SetArray)(CeedVector, CeedMemType, CeedCopyMode, CeedScalar *);
1422a1ab385Sjeremylt   int (*SetValue)(CeedVector, CeedScalar);
14354540941SJeremy L Thompson   int (*SyncArray)(CeedVector, CeedMemType);
1446a6c615bSJeremy L Thompson   int (*TakeArray)(CeedVector, CeedMemType, CeedScalar **);
1456ea7c6c1SJed Brown   int (*GetArray)(CeedVector, CeedMemType, CeedScalar **);
1466ea7c6c1SJed Brown   int (*GetArrayRead)(CeedVector, CeedMemType, const CeedScalar **);
1479c774eddSJeremy L Thompson   int (*GetArrayWrite)(CeedVector, CeedMemType, CeedScalar **);
148f05116b9SJeremy L Thompson   int (*RestoreArray)(CeedVector);
149f05116b9SJeremy L Thompson   int (*RestoreArrayRead)(CeedVector);
150547d9b97Sjeremylt   int (*Norm)(CeedVector, CeedNormType, CeedScalar *);
151e0dd3b27Sjeremylt   int (*Scale)(CeedVector, CeedScalar);
1520f7fd0f8Sjeremylt   int (*AXPY)(CeedVector, CeedScalar, CeedVector);
1530f7fd0f8Sjeremylt   int (*PointwiseMult)(CeedVector, CeedVector, CeedVector);
154d99fa3c5SJeremy L Thompson   int (*Reciprocal)(CeedVector);
1556ea7c6c1SJed Brown   int (*Destroy)(CeedVector);
156d1d35e2fSjeremylt   int ref_count;
1576ea7c6c1SJed Brown   CeedInt length;
15836ac90ebSjeremylt   uint64_t state;
159d1d35e2fSjeremylt   uint64_t num_readers;
1606ea7c6c1SJed Brown   void *data;
1616ea7c6c1SJed Brown };
1626ea7c6c1SJed Brown 
1636ea7c6c1SJed Brown struct CeedElemRestriction_private {
1646ea7c6c1SJed Brown   Ceed ceed;
165074cb416Sjeremylt   int (*Apply)(CeedElemRestriction, CeedTransposeMode, CeedVector, CeedVector,
166074cb416Sjeremylt                CeedRequest *);
167074cb416Sjeremylt   int (*ApplyBlock)(CeedElemRestriction, CeedInt, CeedTransposeMode, CeedVector,
168074cb416Sjeremylt                     CeedVector, CeedRequest *);
169bd33150aSjeremylt   int (*GetOffsets)(CeedElemRestriction, CeedMemType, const CeedInt **);
1706ea7c6c1SJed Brown   int (*Destroy)(CeedElemRestriction);
171d1d35e2fSjeremylt   int ref_count;
172d1d35e2fSjeremylt   CeedInt num_elem;      /* number of elements */
173d1d35e2fSjeremylt   CeedInt elem_size;     /* number of nodes per element */
174d1d35e2fSjeremylt   CeedInt num_comp;      /* number of components */
175d1d35e2fSjeremylt   CeedInt comp_stride;   /* Component stride for L-vector ordering */
176d1d35e2fSjeremylt   CeedInt l_size;        /* size of the L-vector, can be used for checking
177d979a051Sjeremylt                               for correct vector sizes */
178d1d35e2fSjeremylt   CeedInt blk_size;      /* number of elements in a batch */
179d1d35e2fSjeremylt   CeedInt num_blk;       /* number of blocks of elements */
1807509a596Sjeremylt   CeedInt *strides;      /* strides between [nodes, components, elements] */
18149fd234cSJeremy L Thompson   CeedInt layout[3];     /* E-vector layout [nodes, components, elements] */
182d1d35e2fSjeremylt   uint64_t num_readers;  /* number of instances of offset read only access */
183b435c5a6Srezgarshakeri   bool is_oriented;       /* flag for oriented restriction */
1846ea7c6c1SJed Brown   void *data;            /* place for the backend to store any data */
1856ea7c6c1SJed Brown };
1866ea7c6c1SJed Brown 
1876ea7c6c1SJed Brown struct CeedBasis_private {
1886ea7c6c1SJed Brown   Ceed ceed;
1894b8bea3bSJed Brown   int (*Apply)(CeedBasis, CeedInt, CeedTransposeMode, CeedEvalMode,
190aedaa0e5Sjeremylt                CeedVector, CeedVector);
1916ea7c6c1SJed Brown   int (*Destroy)(CeedBasis);
192d1d35e2fSjeremylt   int ref_count;
193d1d35e2fSjeremylt   bool tensor_basis;       /* flag for tensor basis */
1940f5de9e9Sjeremylt   CeedInt dim;             /* topological dimension */
195d99fa3c5SJeremy L Thompson   CeedElemTopology topo;   /* element topology */
196d1d35e2fSjeremylt   CeedInt num_comp;        /* number of field components (1 for scalar fields) */
19750c301a5SRezgar Shakeri   CeedInt Q_comp;        /* number of Q-vector components (1 for H^1, dim for H(div)) */
198d1d35e2fSjeremylt   CeedInt P_1d;            /* number of nodes in one dimension */
199d1d35e2fSjeremylt   CeedInt Q_1d;            /* number of quadrature points in one dimension */
200a8de75f0Sjeremylt   CeedInt P;               /* total number of nodes */
201a8de75f0Sjeremylt   CeedInt Q;               /* total number of quadrature points */
202d1d35e2fSjeremylt   CeedScalar *q_ref_1d;    /* Array of length Q1d holding the locations of
203a8d32208Sjeremylt                                 quadrature points on the 1D reference
204a8d32208Sjeremylt                                 element [-1, 1] */
205d1d35e2fSjeremylt   CeedScalar
206d1d35e2fSjeremylt   *q_weight_1d; /* array of length Q1d holding the quadrature weights on
2070f5de9e9Sjeremylt                                the reference element */
2084b8bea3bSJed Brown   CeedScalar
20950c301a5SRezgar Shakeri   *interp;    /* row-major matrix of shape [Q_comp*Q, P] expressing the values of
21000f91b2bSjeremylt                    nodal basis functions at quadrature points */
21100f91b2bSjeremylt   CeedScalar
212d1d35e2fSjeremylt   *interp_1d; /* row-major matrix of shape [Q1d, P1d] expressing the values of
2130f5de9e9Sjeremylt                    nodal basis functions at quadrature points */
2144b8bea3bSJed Brown   CeedScalar
21550c301a5SRezgar Shakeri   *grad;      /* row-major matrix of shape [dim*Q_comp*Q, P] matrix expressing
216a8d32208Sjeremylt                    derivatives of nodal basis functions at quadrature points */
21700f91b2bSjeremylt   CeedScalar
218d1d35e2fSjeremylt   *grad_1d;   /* row-major matrix of shape [Q1d, P1d] matrix expressing
219a8d32208Sjeremylt                    derivatives of nodal basis functions at quadrature points */
2202f86a920SJeremy L Thompson   CeedTensorContract contract; /* tensor contraction object */
22150c301a5SRezgar Shakeri   CeedInt basis_space;  /* Initialize in basis constructor
22250c301a5SRezgar Shakeri                         with 1,2 for H^1, H(div) FE space */
22350c301a5SRezgar Shakeri   CeedScalar *div;  /* row-major matrix of shape [Q, P] expressing
22450c301a5SRezgar Shakeri                         the divergence of nodal basis functions
22550c301a5SRezgar Shakeri                         at quadrature points for H(div) discretizations */
226c01dd730Scamierjs   void *data;                  /* place for the backend to store any data */
2276ea7c6c1SJed Brown };
2286ea7c6c1SJed Brown 
2292f86a920SJeremy L Thompson struct CeedTensorContract_private {
2302f86a920SJeremy L Thompson   Ceed ceed;
2312f86a920SJeremy L Thompson   int (*Apply)(CeedTensorContract, CeedInt, CeedInt, CeedInt, CeedInt,
2322f86a920SJeremy L Thompson                const CeedScalar *restrict, CeedTransposeMode, const CeedInt,
2332f86a920SJeremy L Thompson                const CeedScalar *restrict, CeedScalar *restrict);
2342f86a920SJeremy L Thompson   int (*Destroy)(CeedTensorContract);
235d1d35e2fSjeremylt   int ref_count;
2362f86a920SJeremy L Thompson   void *data;
2372f86a920SJeremy L Thompson };
2382f86a920SJeremy L Thompson 
239d1bcdac9Sjeremylt struct CeedQFunctionField_private {
240d1d35e2fSjeremylt   const char *field_name;
2414d537eeaSYohann   CeedInt size;
242d1d35e2fSjeremylt   CeedEvalMode eval_mode;
243ff8ca64bSJed Brown };
244ff8ca64bSJed Brown 
2456ea7c6c1SJed Brown struct CeedQFunction_private {
2466ea7c6c1SJed Brown   Ceed ceed;
2472f86a920SJeremy L Thompson   int (*Apply)(CeedQFunction, CeedInt, CeedVector *, CeedVector *);
2488c84ac63Sjeremylt   int (*SetCUDAUserFunction)(CeedQFunction, void *);
2498c84ac63Sjeremylt   int (*SetHIPUserFunction)(CeedQFunction, void *);
2506ea7c6c1SJed Brown   int (*Destroy)(CeedQFunction);
251d1d35e2fSjeremylt   int ref_count;
252d1d35e2fSjeremylt   CeedInt vec_length; /* Number of quadrature points must be padded to a
253d1d35e2fSjeremylt                            multiple of vec_length */
254d1d35e2fSjeremylt   CeedQFunctionField *input_fields;
255d1d35e2fSjeremylt   CeedQFunctionField *output_fields;
256d1d35e2fSjeremylt   CeedInt num_input_fields, num_output_fields;
2579f0427d9SYohann   CeedQFunctionUser function;
258d1d35e2fSjeremylt   const char *source_path;
25943e1b16fSJeremy L Thompson   const char *kernel_name;
26043e1b16fSJeremy L Thompson   const char *gallery_name;
26143e1b16fSJeremy L Thompson   bool is_gallery;
262f04ea552SJeremy L Thompson   bool is_identity;
263f04ea552SJeremy L Thompson   bool is_fortran;
264f04ea552SJeremy L Thompson   bool is_immutable;
265441428dfSJeremy L Thompson   bool is_context_writable;
266777ff853SJeremy L Thompson   CeedQFunctionContext ctx; /* user context for function */
267a8d32208Sjeremylt   void *data;          /* place for the backend to store any data */
2686ea7c6c1SJed Brown };
2696ea7c6c1SJed Brown 
270777ff853SJeremy L Thompson struct CeedQFunctionContext_private {
271777ff853SJeremy L Thompson   Ceed ceed;
272d1d35e2fSjeremylt   int ref_count;
2739c774eddSJeremy L Thompson   int (*HasValidData)(CeedQFunctionContext, bool *);
2749c774eddSJeremy L Thompson   int (*HasBorrowedDataOfType)(CeedQFunctionContext, CeedMemType, bool *);
275777ff853SJeremy L Thompson   int (*SetData)(CeedQFunctionContext, CeedMemType, CeedCopyMode, void *);
276891038deSjeremylt   int (*TakeData)(CeedQFunctionContext, CeedMemType, void *);
277777ff853SJeremy L Thompson   int (*GetData)(CeedQFunctionContext, CeedMemType, void *);
27828bfd0b7SJeremy L Thompson   int (*GetDataRead)(CeedQFunctionContext, CeedMemType, void *);
279777ff853SJeremy L Thompson   int (*RestoreData)(CeedQFunctionContext);
28028bfd0b7SJeremy L Thompson   int (*RestoreDataRead)(CeedQFunctionContext);
281777ff853SJeremy L Thompson   int (*Destroy)(CeedQFunctionContext);
282cdf32b93SJeremy L Thompson   CeedInt num_fields;
283cdf32b93SJeremy L Thompson   CeedInt max_fields;
2843668ca4bSJeremy L Thompson   CeedContextFieldLabel *field_labels;
285777ff853SJeremy L Thompson   uint64_t state;
28628bfd0b7SJeremy L Thompson   uint64_t num_readers;
287d1d35e2fSjeremylt   size_t ctx_size;
288777ff853SJeremy L Thompson   void *data;
289777ff853SJeremy L Thompson };
290777ff853SJeremy L Thompson 
2911e35832bSjeremylt /// Struct to handle the context data to use the Fortran QFunction stub
2921e35832bSjeremylt /// @ingroup CeedQFunction
293777ff853SJeremy L Thompson struct CeedFortranContext_private {
2948cb0412aSJeremy L Thompson   CeedQFunctionContext inner_ctx;
295069aeabaSjeremylt   void (*f)(void *ctx, int *nq,
296069aeabaSjeremylt             const CeedScalar *u,const CeedScalar *u1,
297069aeabaSjeremylt             const CeedScalar *u2,const CeedScalar *u3,
298069aeabaSjeremylt             const CeedScalar *u4,const CeedScalar *u5,
299069aeabaSjeremylt             const CeedScalar *u6,const CeedScalar *u7,
300069aeabaSjeremylt             const CeedScalar *u8,const CeedScalar *u9,
301069aeabaSjeremylt             const CeedScalar *u10,const CeedScalar *u11,
302069aeabaSjeremylt             const CeedScalar *u12,const CeedScalar *u13,
303069aeabaSjeremylt             const CeedScalar *u14,const CeedScalar *u15,
304069aeabaSjeremylt             CeedScalar *v,CeedScalar *v1,CeedScalar *v2,
305069aeabaSjeremylt             CeedScalar *v3,CeedScalar *v4,CeedScalar *v5,
306069aeabaSjeremylt             CeedScalar *v6,CeedScalar *v7,CeedScalar *v8,
307069aeabaSjeremylt             CeedScalar *v9, CeedScalar *v10,CeedScalar *v11,
308069aeabaSjeremylt             CeedScalar *v12,CeedScalar *v13,CeedScalar *v14,
309069aeabaSjeremylt             CeedScalar *v15, int *err);
310777ff853SJeremy L Thompson };
311777ff853SJeremy L Thompson typedef struct CeedFortranContext_private *CeedFortranContext;
312069aeabaSjeremylt 
3133668ca4bSJeremy L Thompson struct CeedContextFieldLabel_private {
3143668ca4bSJeremy L Thompson   const char *name;
3153668ca4bSJeremy L Thompson   const char *description;
3163668ca4bSJeremy L Thompson   CeedContextFieldType type;
3173668ca4bSJeremy L Thompson   size_t size;
3187bfe0f0eSJeremy L Thompson   size_t num_values;
3193668ca4bSJeremy L Thompson   size_t offset;
3203668ca4bSJeremy L Thompson   CeedInt num_sub_labels;
3213668ca4bSJeremy L Thompson   CeedContextFieldLabel *sub_labels;
3223668ca4bSJeremy L Thompson };
3233668ca4bSJeremy L Thompson 
324d1bcdac9Sjeremylt struct CeedOperatorField_private {
325d1d35e2fSjeremylt   CeedElemRestriction elem_restr; /* Restriction from L-vector */
326a8d32208Sjeremylt   CeedBasis basis;                /* Basis or CEED_BASIS_COLLOCATED for
327a8d32208Sjeremylt                                        collocated fields */
328a8d32208Sjeremylt   CeedVector vec;                 /* State vector for passive fields or
329a8d32208Sjeremylt                                        CEED_VECTOR_NONE for no vector */
330d1d35e2fSjeremylt   const char *field_name;          /* matching QFunction field name */
331ff8ca64bSJed Brown };
332ff8ca64bSJed Brown 
3336ea7c6c1SJed Brown struct CeedOperator_private {
3346ea7c6c1SJed Brown   Ceed ceed;
335d1d35e2fSjeremylt   CeedOperator op_fallback;
336d1d35e2fSjeremylt   CeedQFunction qf_fallback;
337d1d35e2fSjeremylt   int ref_count;
33880ac2e43SJeremy L Thompson   int (*LinearAssembleQFunction)(CeedOperator, CeedVector *,
3391d102b48SJeremy L Thompson                                  CeedElemRestriction *, CeedRequest *);
34070a7ffb3SJeremy L Thompson   int (*LinearAssembleQFunctionUpdate)(CeedOperator, CeedVector,
34170a7ffb3SJeremy L Thompson                                        CeedElemRestriction, CeedRequest *);
3422bba3ffaSJeremy L Thompson   int (*LinearAssembleDiagonal)(CeedOperator, CeedVector, CeedRequest *);
3439e9210b8SJeremy L Thompson   int (*LinearAssembleAddDiagonal)(CeedOperator, CeedVector, CeedRequest *);
3442bba3ffaSJeremy L Thompson   int (*LinearAssemblePointBlockDiagonal)(CeedOperator, CeedVector,
345d965c7a7SJeremy L Thompson                                           CeedRequest *);
3469e9210b8SJeremy L Thompson   int (*LinearAssembleAddPointBlockDiagonal)(CeedOperator, CeedVector,
3479e9210b8SJeremy L Thompson       CeedRequest *);
348*3047f789SJeremy L Thompson   int (*LinearAssembleSymbolic)(CeedOperator, ptrdiff_t *, CeedInt **,
349*3047f789SJeremy L Thompson                                 CeedInt **);
350e2f04181SAndrew T. Barker   int (*LinearAssemble)(CeedOperator, CeedVector);
351713f43c3Sjeremylt   int (*CreateFDMElementInverse)(CeedOperator, CeedOperator *, CeedRequest *);
352ff8ca64bSJed Brown   int (*Apply)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
353250756a7Sjeremylt   int (*ApplyComposite)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
354cae8b89aSjeremylt   int (*ApplyAdd)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
355250756a7Sjeremylt   int (*ApplyAddComposite)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
3566ea7c6c1SJed Brown   int (*ApplyJacobian)(CeedOperator, CeedVector, CeedVector, CeedVector,
3576ea7c6c1SJed Brown                        CeedVector, CeedRequest *);
3586ea7c6c1SJed Brown   int (*Destroy)(CeedOperator);
359d1d35e2fSjeremylt   CeedOperatorField *input_fields;
360d1d35e2fSjeremylt   CeedOperatorField *output_fields;
361d1d35e2fSjeremylt   CeedInt num_elem;   /* Number of elements */
362d1d35e2fSjeremylt   CeedInt num_qpts;   /* Number of quadrature points over all elements */
363d1d35e2fSjeremylt   CeedInt num_fields; /* Number of fields that have been set */
3646ea7c6c1SJed Brown   CeedQFunction qf;
3656ea7c6c1SJed Brown   CeedQFunction dqf;
3666ea7c6c1SJed Brown   CeedQFunction dqfT;
367f04ea552SJeremy L Thompson   bool is_immutable;
368f04ea552SJeremy L Thompson   bool is_interface_setup;
369f04ea552SJeremy L Thompson   bool is_backend_setup;
370f04ea552SJeremy L Thompson   bool is_composite;
371d1d35e2fSjeremylt   bool has_restriction;
37270a7ffb3SJeremy L Thompson   bool has_qf_assembled;
37370a7ffb3SJeremy L Thompson   CeedVector qf_assembled;
37470a7ffb3SJeremy L Thompson   CeedElemRestriction qf_assembled_rstr;
375d1d35e2fSjeremylt   CeedOperator *sub_operators;
376d1d35e2fSjeremylt   CeedInt num_suboperators;
3776ea7c6c1SJed Brown   void *data;
3783668ca4bSJeremy L Thompson   CeedInt num_context_labels;
3793668ca4bSJeremy L Thompson   CeedInt max_context_labels;
3803668ca4bSJeremy L Thompson   CeedContextFieldLabel *context_labels;
3816ea7c6c1SJed Brown };
3826ea7c6c1SJed Brown 
3836ea7c6c1SJed Brown #endif
384