xref: /libCEED/rust/libceed-sys/c-src/include/ceed-impl.h (revision 3d8e882215d238700cdceb37404f76ca7fa24eaa)
1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
36ea7c6c1SJed Brown //
4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
56ea7c6c1SJed Brown //
6*3d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
76ea7c6c1SJed Brown 
85d6bafb2Sjeremylt /// @file
95d6bafb2Sjeremylt /// Private header for frontend components of libCEED
106ea7c6c1SJed Brown #ifndef _ceed_impl_h
116ea7c6c1SJed Brown #define _ceed_impl_h
126ea7c6c1SJed Brown 
13ec3da8bcSJed Brown #include <ceed/ceed.h>
14ec3da8bcSJed Brown #include <ceed/backend.h>
15ff8ca64bSJed Brown #include <stdbool.h>
166ea7c6c1SJed Brown 
177a982d89SJeremy L. Thompson /** @defgroup CeedUser Public API for Ceed
187a982d89SJeremy L. Thompson     @ingroup Ceed
197a982d89SJeremy L. Thompson */
207a982d89SJeremy L. Thompson /** @defgroup CeedBackend Backend API for Ceed
217a982d89SJeremy L. Thompson     @ingroup Ceed
227a982d89SJeremy L. Thompson */
237a982d89SJeremy L. Thompson /** @defgroup CeedDeveloper Internal library functions for Ceed
247a982d89SJeremy L. Thompson     @ingroup Ceed
257a982d89SJeremy L. Thompson */
267a982d89SJeremy L. Thompson /** @defgroup CeedVectorUser Public API for CeedVector
277a982d89SJeremy L. Thompson     @ingroup CeedVector
287a982d89SJeremy L. Thompson */
297a982d89SJeremy L. Thompson /** @defgroup CeedVectorBackend Backend API for CeedVector
307a982d89SJeremy L. Thompson     @ingroup CeedVector
317a982d89SJeremy L. Thompson */
327a982d89SJeremy L. Thompson /** @defgroup CeedVectorDeveloper Internal library functions for CeedVector
337a982d89SJeremy L. Thompson     @ingroup CeedVector
347a982d89SJeremy L. Thompson */
357a982d89SJeremy L. Thompson /** @defgroup CeedElemRestrictionUser Public API for CeedElemRestriction
367a982d89SJeremy L. Thompson     @ingroup CeedElemRestriction
377a982d89SJeremy L. Thompson */
387a982d89SJeremy L. Thompson /** @defgroup CeedElemRestrictionBackend Backend API for CeedElemRestriction
397a982d89SJeremy L. Thompson     @ingroup CeedElemRestriction
407a982d89SJeremy L. Thompson */
417a982d89SJeremy L. Thompson /** @defgroup CeedElemRestrictionDeveloper Internal library functions for CeedElemRestriction
427a982d89SJeremy L. Thompson     @ingroup CeedElemRestriction
437a982d89SJeremy L. Thompson */
447a982d89SJeremy L. Thompson /** @defgroup CeedBasisUser Public API for CeedBasis
457a982d89SJeremy L. Thompson     @ingroup CeedBasis
467a982d89SJeremy L. Thompson */
477a982d89SJeremy L. Thompson /** @defgroup CeedBasisBackend Backend API for CeedBasis
487a982d89SJeremy L. Thompson     @ingroup CeedBasis
497a982d89SJeremy L. Thompson */
507a982d89SJeremy L. Thompson /** @defgroup CeedBasisDeveloper Internal library functions for CeedBasis
517a982d89SJeremy L. Thompson     @ingroup CeedBasis
527a982d89SJeremy L. Thompson */
537a982d89SJeremy L. Thompson /** @defgroup CeedQFunctionUser Public API for CeedQFunction
547a982d89SJeremy L. Thompson     @ingroup CeedQFunction
557a982d89SJeremy L. Thompson */
567a982d89SJeremy L. Thompson /** @defgroup CeedQFunctionBackend Backend API for CeedQFunction
577a982d89SJeremy L. Thompson     @ingroup CeedQFunction
587a982d89SJeremy L. Thompson */
597a982d89SJeremy L. Thompson /** @defgroup CeedQFunctionDeveloper Internal library functions for CeedQFunction
607a982d89SJeremy L. Thompson     @ingroup CeedQFunction
617a982d89SJeremy L. Thompson */
627a982d89SJeremy L. Thompson /** @defgroup CeedOperatorUser Public API for CeedOperator
637a982d89SJeremy L. Thompson     @ingroup CeedOperator
647a982d89SJeremy L. Thompson */
657a982d89SJeremy L. Thompson /** @defgroup CeedOperatorBackend Backend API for CeedOperator
667a982d89SJeremy L. Thompson     @ingroup CeedOperator
677a982d89SJeremy L. Thompson */
687a982d89SJeremy L. Thompson /** @defgroup CeedOperatorDeveloper Internal library functions for CeedOperator
697a982d89SJeremy L. Thompson     @ingroup CeedOperator
707a982d89SJeremy L. Thompson */
717a982d89SJeremy L. Thompson 
72fe2413ffSjeremylt // Lookup table field for backend functions
73fe2413ffSjeremylt typedef struct {
74d1d35e2fSjeremylt   const char *func_name;
75fe2413ffSjeremylt   size_t offset;
76d1d35e2fSjeremylt } FOffset;
77fe2413ffSjeremylt 
78aefd8378Sjeremylt // Lookup table field for object delegates
79aefd8378Sjeremylt typedef struct {
80d1d35e2fSjeremylt   char *obj_name;
81aefd8378Sjeremylt   Ceed delegate;
82d1d35e2fSjeremylt } ObjDelegate;
83aefd8378Sjeremylt 
846ea7c6c1SJed Brown struct Ceed_private {
85e07206deSjeremylt   const char *resource;
865fe0d4faSjeremylt   Ceed delegate;
872f86a920SJeremy L Thompson   Ceed parent;
88d1d35e2fSjeremylt   ObjDelegate *obj_delegates;
89d1d35e2fSjeremylt   int obj_delegate_count;
90d1d35e2fSjeremylt   Ceed op_fallback_ceed, op_fallback_parent;
91d1d35e2fSjeremylt   const char *op_fallback_resource;
922f86a920SJeremy L Thompson   int (*Error)(Ceed, const char *, int, const char *, int, const char *,
93f9982c62SWill Pazner                va_list *);
94c907536fSjeremylt   int (*GetPreferredMemType)(CeedMemType *);
956ea7c6c1SJed Brown   int (*Destroy)(Ceed);
961f9221feSJeremy L Thompson   int (*VectorCreate)(CeedSize, CeedVector);
97667bc5fcSjeremylt   int (*ElemRestrictionCreate)(CeedMemType, CeedCopyMode,
98667bc5fcSjeremylt                                const CeedInt *, CeedElemRestriction);
99fc0567d9Srezgarshakeri   int (*ElemRestrictionCreateOriented)(CeedMemType, CeedCopyMode,
100fc0567d9Srezgarshakeri                                        const CeedInt *, const bool *,
101fc0567d9Srezgarshakeri                                        CeedElemRestriction);
102667bc5fcSjeremylt   int (*ElemRestrictionCreateBlocked)(CeedMemType, CeedCopyMode,
103667bc5fcSjeremylt                                       const CeedInt *, CeedElemRestriction);
104667bc5fcSjeremylt   int (*BasisCreateTensorH1)(CeedInt, CeedInt, CeedInt, const CeedScalar *,
1052f86a920SJeremy L Thompson                              const CeedScalar *, const CeedScalar *,
1062f86a920SJeremy L Thompson                              const CeedScalar *, CeedBasis);
107667bc5fcSjeremylt   int (*BasisCreateH1)(CeedElemTopology, CeedInt, CeedInt, CeedInt,
108a8de75f0Sjeremylt                        const CeedScalar *,
1092f86a920SJeremy L Thompson                        const CeedScalar *, const CeedScalar *,
1102f86a920SJeremy L Thompson                        const CeedScalar *, CeedBasis);
11150c301a5SRezgar Shakeri   int (*BasisCreateHdiv)(CeedElemTopology, CeedInt, CeedInt, CeedInt,
11250c301a5SRezgar Shakeri                          const CeedScalar *,
11350c301a5SRezgar Shakeri                          const CeedScalar *, const CeedScalar *,
11450c301a5SRezgar Shakeri                          const CeedScalar *, CeedBasis);
115c71e1dcdSjeremylt   int (*TensorContractCreate)(CeedBasis, CeedTensorContract);
1166ea7c6c1SJed Brown   int (*QFunctionCreate)(CeedQFunction);
117777ff853SJeremy L Thompson   int (*QFunctionContextCreate)(CeedQFunctionContext);
1186ea7c6c1SJed Brown   int (*OperatorCreate)(CeedOperator);
11952d6035fSJeremy L Thompson   int (*CompositeOperatorCreate)(CeedOperator);
120d1d35e2fSjeremylt   int ref_count;
1216ea7c6c1SJed Brown   void *data;
1223f21f6b1SJeremy L Thompson   bool is_debug;
1233f21f6b1SJeremy L Thompson   bool is_deterministic;
124d1d35e2fSjeremylt   char err_msg[CEED_MAX_RESOURCE_LEN];
125d1d35e2fSjeremylt   FOffset *f_offsets;
1266ea7c6c1SJed Brown };
1276ea7c6c1SJed Brown 
1286ea7c6c1SJed Brown struct CeedVector_private {
1296ea7c6c1SJed Brown   Ceed ceed;
1309c774eddSJeremy L Thompson   int (*HasValidArray)(CeedVector, bool *);
1319c774eddSJeremy L Thompson   int (*HasBorrowedArrayOfType)(CeedVector, CeedMemType, bool *);
1326ea7c6c1SJed Brown   int (*SetArray)(CeedVector, CeedMemType, CeedCopyMode, CeedScalar *);
1332a1ab385Sjeremylt   int (*SetValue)(CeedVector, CeedScalar);
13454540941SJeremy L Thompson   int (*SyncArray)(CeedVector, CeedMemType);
1356a6c615bSJeremy L Thompson   int (*TakeArray)(CeedVector, CeedMemType, CeedScalar **);
1366ea7c6c1SJed Brown   int (*GetArray)(CeedVector, CeedMemType, CeedScalar **);
1376ea7c6c1SJed Brown   int (*GetArrayRead)(CeedVector, CeedMemType, const CeedScalar **);
1389c774eddSJeremy L Thompson   int (*GetArrayWrite)(CeedVector, CeedMemType, CeedScalar **);
139f05116b9SJeremy L Thompson   int (*RestoreArray)(CeedVector);
140f05116b9SJeremy L Thompson   int (*RestoreArrayRead)(CeedVector);
141547d9b97Sjeremylt   int (*Norm)(CeedVector, CeedNormType, CeedScalar *);
142e0dd3b27Sjeremylt   int (*Scale)(CeedVector, CeedScalar);
1430f7fd0f8Sjeremylt   int (*AXPY)(CeedVector, CeedScalar, CeedVector);
1440f7fd0f8Sjeremylt   int (*PointwiseMult)(CeedVector, CeedVector, CeedVector);
145d99fa3c5SJeremy L Thompson   int (*Reciprocal)(CeedVector);
1466ea7c6c1SJed Brown   int (*Destroy)(CeedVector);
147d1d35e2fSjeremylt   int ref_count;
1486ea7c6c1SJed Brown   CeedInt length;
14936ac90ebSjeremylt   uint64_t state;
150d1d35e2fSjeremylt   uint64_t num_readers;
1516ea7c6c1SJed Brown   void *data;
1526ea7c6c1SJed Brown };
1536ea7c6c1SJed Brown 
1546ea7c6c1SJed Brown struct CeedElemRestriction_private {
1556ea7c6c1SJed Brown   Ceed ceed;
156074cb416Sjeremylt   int (*Apply)(CeedElemRestriction, CeedTransposeMode, CeedVector, CeedVector,
157074cb416Sjeremylt                CeedRequest *);
158074cb416Sjeremylt   int (*ApplyBlock)(CeedElemRestriction, CeedInt, CeedTransposeMode, CeedVector,
159074cb416Sjeremylt                     CeedVector, CeedRequest *);
160bd33150aSjeremylt   int (*GetOffsets)(CeedElemRestriction, CeedMemType, const CeedInt **);
1616ea7c6c1SJed Brown   int (*Destroy)(CeedElemRestriction);
162d1d35e2fSjeremylt   int ref_count;
163d1d35e2fSjeremylt   CeedInt num_elem;      /* number of elements */
164d1d35e2fSjeremylt   CeedInt elem_size;     /* number of nodes per element */
165d1d35e2fSjeremylt   CeedInt num_comp;      /* number of components */
166d1d35e2fSjeremylt   CeedInt comp_stride;   /* Component stride for L-vector ordering */
167e79b91d9SJeremy L Thompson   CeedSize l_size;       /* size of the L-vector, can be used for checking
168d979a051Sjeremylt                               for correct vector sizes */
169d1d35e2fSjeremylt   CeedInt blk_size;      /* number of elements in a batch */
170d1d35e2fSjeremylt   CeedInt num_blk;       /* number of blocks of elements */
1717509a596Sjeremylt   CeedInt *strides;      /* strides between [nodes, components, elements] */
17249fd234cSJeremy L Thompson   CeedInt layout[3];     /* E-vector layout [nodes, components, elements] */
173d1d35e2fSjeremylt   uint64_t num_readers;  /* number of instances of offset read only access */
174b435c5a6Srezgarshakeri   bool is_oriented;       /* flag for oriented restriction */
1756ea7c6c1SJed Brown   void *data;            /* place for the backend to store any data */
1766ea7c6c1SJed Brown };
1776ea7c6c1SJed Brown 
1786ea7c6c1SJed Brown struct CeedBasis_private {
1796ea7c6c1SJed Brown   Ceed ceed;
1804b8bea3bSJed Brown   int (*Apply)(CeedBasis, CeedInt, CeedTransposeMode, CeedEvalMode,
181aedaa0e5Sjeremylt                CeedVector, CeedVector);
1826ea7c6c1SJed Brown   int (*Destroy)(CeedBasis);
183d1d35e2fSjeremylt   int ref_count;
184d1d35e2fSjeremylt   bool tensor_basis;       /* flag for tensor basis */
1850f5de9e9Sjeremylt   CeedInt dim;             /* topological dimension */
186d99fa3c5SJeremy L Thompson   CeedElemTopology topo;   /* element topology */
187d1d35e2fSjeremylt   CeedInt num_comp;        /* number of field components (1 for scalar fields) */
18850c301a5SRezgar Shakeri   CeedInt Q_comp;        /* number of Q-vector components (1 for H^1, dim for H(div)) */
189d1d35e2fSjeremylt   CeedInt P_1d;            /* number of nodes in one dimension */
190d1d35e2fSjeremylt   CeedInt Q_1d;            /* number of quadrature points in one dimension */
191a8de75f0Sjeremylt   CeedInt P;               /* total number of nodes */
192a8de75f0Sjeremylt   CeedInt Q;               /* total number of quadrature points */
193d1d35e2fSjeremylt   CeedScalar *q_ref_1d;    /* Array of length Q1d holding the locations of
194a8d32208Sjeremylt                                 quadrature points on the 1D reference
195a8d32208Sjeremylt                                 element [-1, 1] */
196d1d35e2fSjeremylt   CeedScalar
197d1d35e2fSjeremylt   *q_weight_1d; /* array of length Q1d holding the quadrature weights on
1980f5de9e9Sjeremylt                                the reference element */
1994b8bea3bSJed Brown   CeedScalar
20050c301a5SRezgar Shakeri   *interp;    /* row-major matrix of shape [Q_comp*Q, P] expressing the values of
20100f91b2bSjeremylt                    nodal basis functions at quadrature points */
20200f91b2bSjeremylt   CeedScalar
203d1d35e2fSjeremylt   *interp_1d; /* row-major matrix of shape [Q1d, P1d] expressing the values of
2040f5de9e9Sjeremylt                    nodal basis functions at quadrature points */
2054b8bea3bSJed Brown   CeedScalar
20650c301a5SRezgar Shakeri   *grad;      /* row-major matrix of shape [dim*Q_comp*Q, P] matrix expressing
207a8d32208Sjeremylt                    derivatives of nodal basis functions at quadrature points */
20800f91b2bSjeremylt   CeedScalar
209d1d35e2fSjeremylt   *grad_1d;   /* row-major matrix of shape [Q1d, P1d] matrix expressing
210a8d32208Sjeremylt                    derivatives of nodal basis functions at quadrature points */
2112f86a920SJeremy L Thompson   CeedTensorContract contract; /* tensor contraction object */
21250c301a5SRezgar Shakeri   CeedInt basis_space;  /* Initialize in basis constructor
21350c301a5SRezgar Shakeri                         with 1,2 for H^1, H(div) FE space */
21450c301a5SRezgar Shakeri   CeedScalar *div;  /* row-major matrix of shape [Q, P] expressing
21550c301a5SRezgar Shakeri                         the divergence of nodal basis functions
21650c301a5SRezgar Shakeri                         at quadrature points for H(div) discretizations */
217c01dd730Scamierjs   void *data;                  /* place for the backend to store any data */
2186ea7c6c1SJed Brown };
2196ea7c6c1SJed Brown 
2202f86a920SJeremy L Thompson struct CeedTensorContract_private {
2212f86a920SJeremy L Thompson   Ceed ceed;
2222f86a920SJeremy L Thompson   int (*Apply)(CeedTensorContract, CeedInt, CeedInt, CeedInt, CeedInt,
2232f86a920SJeremy L Thompson                const CeedScalar *restrict, CeedTransposeMode, const CeedInt,
2242f86a920SJeremy L Thompson                const CeedScalar *restrict, CeedScalar *restrict);
2252f86a920SJeremy L Thompson   int (*Destroy)(CeedTensorContract);
226d1d35e2fSjeremylt   int ref_count;
2272f86a920SJeremy L Thompson   void *data;
2282f86a920SJeremy L Thompson };
2292f86a920SJeremy L Thompson 
230d1bcdac9Sjeremylt struct CeedQFunctionField_private {
231d1d35e2fSjeremylt   const char *field_name;
2324d537eeaSYohann   CeedInt size;
233d1d35e2fSjeremylt   CeedEvalMode eval_mode;
234ff8ca64bSJed Brown };
235ff8ca64bSJed Brown 
2366ea7c6c1SJed Brown struct CeedQFunction_private {
2376ea7c6c1SJed Brown   Ceed ceed;
2382f86a920SJeremy L Thompson   int (*Apply)(CeedQFunction, CeedInt, CeedVector *, CeedVector *);
2398c84ac63Sjeremylt   int (*SetCUDAUserFunction)(CeedQFunction, void *);
2408c84ac63Sjeremylt   int (*SetHIPUserFunction)(CeedQFunction, void *);
2416ea7c6c1SJed Brown   int (*Destroy)(CeedQFunction);
242d1d35e2fSjeremylt   int ref_count;
243d1d35e2fSjeremylt   CeedInt vec_length; /* Number of quadrature points must be padded to a
244d1d35e2fSjeremylt                            multiple of vec_length */
245d1d35e2fSjeremylt   CeedQFunctionField *input_fields;
246d1d35e2fSjeremylt   CeedQFunctionField *output_fields;
247d1d35e2fSjeremylt   CeedInt num_input_fields, num_output_fields;
2489f0427d9SYohann   CeedQFunctionUser function;
249d1d35e2fSjeremylt   const char *source_path;
25043e1b16fSJeremy L Thompson   const char *kernel_name;
25143e1b16fSJeremy L Thompson   const char *gallery_name;
25243e1b16fSJeremy L Thompson   bool is_gallery;
253f04ea552SJeremy L Thompson   bool is_identity;
254f04ea552SJeremy L Thompson   bool is_fortran;
255f04ea552SJeremy L Thompson   bool is_immutable;
256441428dfSJeremy L Thompson   bool is_context_writable;
257777ff853SJeremy L Thompson   CeedQFunctionContext ctx; /* user context for function */
258a8d32208Sjeremylt   void *data;          /* place for the backend to store any data */
2596ea7c6c1SJed Brown };
2606ea7c6c1SJed Brown 
261777ff853SJeremy L Thompson struct CeedQFunctionContext_private {
262777ff853SJeremy L Thompson   Ceed ceed;
263d1d35e2fSjeremylt   int ref_count;
2649c774eddSJeremy L Thompson   int (*HasValidData)(CeedQFunctionContext, bool *);
2659c774eddSJeremy L Thompson   int (*HasBorrowedDataOfType)(CeedQFunctionContext, CeedMemType, bool *);
266777ff853SJeremy L Thompson   int (*SetData)(CeedQFunctionContext, CeedMemType, CeedCopyMode, void *);
267891038deSjeremylt   int (*TakeData)(CeedQFunctionContext, CeedMemType, void *);
268777ff853SJeremy L Thompson   int (*GetData)(CeedQFunctionContext, CeedMemType, void *);
26928bfd0b7SJeremy L Thompson   int (*GetDataRead)(CeedQFunctionContext, CeedMemType, void *);
270777ff853SJeremy L Thompson   int (*RestoreData)(CeedQFunctionContext);
27128bfd0b7SJeremy L Thompson   int (*RestoreDataRead)(CeedQFunctionContext);
272777ff853SJeremy L Thompson   int (*Destroy)(CeedQFunctionContext);
273cdf32b93SJeremy L Thompson   CeedInt num_fields;
274cdf32b93SJeremy L Thompson   CeedInt max_fields;
2753668ca4bSJeremy L Thompson   CeedContextFieldLabel *field_labels;
276777ff853SJeremy L Thompson   uint64_t state;
27728bfd0b7SJeremy L Thompson   uint64_t num_readers;
278d1d35e2fSjeremylt   size_t ctx_size;
279777ff853SJeremy L Thompson   void *data;
280777ff853SJeremy L Thompson };
281777ff853SJeremy L Thompson 
2821e35832bSjeremylt /// Struct to handle the context data to use the Fortran QFunction stub
2831e35832bSjeremylt /// @ingroup CeedQFunction
284777ff853SJeremy L Thompson struct CeedFortranContext_private {
2858cb0412aSJeremy L Thompson   CeedQFunctionContext inner_ctx;
286069aeabaSjeremylt   void (*f)(void *ctx, int *nq,
287069aeabaSjeremylt             const CeedScalar *u,const CeedScalar *u1,
288069aeabaSjeremylt             const CeedScalar *u2,const CeedScalar *u3,
289069aeabaSjeremylt             const CeedScalar *u4,const CeedScalar *u5,
290069aeabaSjeremylt             const CeedScalar *u6,const CeedScalar *u7,
291069aeabaSjeremylt             const CeedScalar *u8,const CeedScalar *u9,
292069aeabaSjeremylt             const CeedScalar *u10,const CeedScalar *u11,
293069aeabaSjeremylt             const CeedScalar *u12,const CeedScalar *u13,
294069aeabaSjeremylt             const CeedScalar *u14,const CeedScalar *u15,
295069aeabaSjeremylt             CeedScalar *v,CeedScalar *v1,CeedScalar *v2,
296069aeabaSjeremylt             CeedScalar *v3,CeedScalar *v4,CeedScalar *v5,
297069aeabaSjeremylt             CeedScalar *v6,CeedScalar *v7,CeedScalar *v8,
298069aeabaSjeremylt             CeedScalar *v9, CeedScalar *v10,CeedScalar *v11,
299069aeabaSjeremylt             CeedScalar *v12,CeedScalar *v13,CeedScalar *v14,
300069aeabaSjeremylt             CeedScalar *v15, int *err);
301777ff853SJeremy L Thompson };
302777ff853SJeremy L Thompson typedef struct CeedFortranContext_private *CeedFortranContext;
303069aeabaSjeremylt 
3043668ca4bSJeremy L Thompson struct CeedContextFieldLabel_private {
3053668ca4bSJeremy L Thompson   const char *name;
3063668ca4bSJeremy L Thompson   const char *description;
3073668ca4bSJeremy L Thompson   CeedContextFieldType type;
3083668ca4bSJeremy L Thompson   size_t size;
3097bfe0f0eSJeremy L Thompson   size_t num_values;
3103668ca4bSJeremy L Thompson   size_t offset;
3113668ca4bSJeremy L Thompson   CeedInt num_sub_labels;
3123668ca4bSJeremy L Thompson   CeedContextFieldLabel *sub_labels;
3133668ca4bSJeremy L Thompson };
3143668ca4bSJeremy L Thompson 
315d1bcdac9Sjeremylt struct CeedOperatorField_private {
316d1d35e2fSjeremylt   CeedElemRestriction elem_restr; /* Restriction from L-vector */
317a8d32208Sjeremylt   CeedBasis basis;                /* Basis or CEED_BASIS_COLLOCATED for
318a8d32208Sjeremylt                                        collocated fields */
319a8d32208Sjeremylt   CeedVector vec;                 /* State vector for passive fields or
320a8d32208Sjeremylt                                        CEED_VECTOR_NONE for no vector */
321d1d35e2fSjeremylt   const char *field_name;          /* matching QFunction field name */
322ff8ca64bSJed Brown };
323ff8ca64bSJed Brown 
324480fae85SJeremy L Thompson struct CeedQFunctionAssemblyData_private {
325480fae85SJeremy L Thompson   Ceed ceed;
326480fae85SJeremy L Thompson   int ref_count;
327480fae85SJeremy L Thompson   bool is_setup;
328beecbf24SJeremy L Thompson   bool reuse_data;
329beecbf24SJeremy L Thompson   bool needs_data_update;
330480fae85SJeremy L Thompson   CeedVector vec;
331480fae85SJeremy L Thompson   CeedElemRestriction rstr;
332480fae85SJeremy L Thompson };
333480fae85SJeremy L Thompson 
3346ea7c6c1SJed Brown struct CeedOperator_private {
3356ea7c6c1SJed Brown   Ceed ceed;
336d1d35e2fSjeremylt   CeedOperator op_fallback;
337d1d35e2fSjeremylt   CeedQFunction qf_fallback;
338d1d35e2fSjeremylt   int ref_count;
33980ac2e43SJeremy L Thompson   int (*LinearAssembleQFunction)(CeedOperator, CeedVector *,
3401d102b48SJeremy L Thompson                                  CeedElemRestriction *, CeedRequest *);
34170a7ffb3SJeremy L Thompson   int (*LinearAssembleQFunctionUpdate)(CeedOperator, CeedVector,
34270a7ffb3SJeremy L Thompson                                        CeedElemRestriction, CeedRequest *);
3432bba3ffaSJeremy L Thompson   int (*LinearAssembleDiagonal)(CeedOperator, CeedVector, CeedRequest *);
3449e9210b8SJeremy L Thompson   int (*LinearAssembleAddDiagonal)(CeedOperator, CeedVector, CeedRequest *);
3452bba3ffaSJeremy L Thompson   int (*LinearAssemblePointBlockDiagonal)(CeedOperator, CeedVector,
346d965c7a7SJeremy L Thompson                                           CeedRequest *);
3479e9210b8SJeremy L Thompson   int (*LinearAssembleAddPointBlockDiagonal)(CeedOperator, CeedVector,
3489e9210b8SJeremy L Thompson       CeedRequest *);
349c30b7fbdSJeremy L Thompson   int (*LinearAssembleSymbolic)(CeedOperator, CeedSize *, CeedInt **,
3503047f789SJeremy L Thompson                                 CeedInt **);
351e2f04181SAndrew T. Barker   int (*LinearAssemble)(CeedOperator, CeedVector);
352713f43c3Sjeremylt   int (*CreateFDMElementInverse)(CeedOperator, CeedOperator *, CeedRequest *);
353ff8ca64bSJed Brown   int (*Apply)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
354250756a7Sjeremylt   int (*ApplyComposite)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
355cae8b89aSjeremylt   int (*ApplyAdd)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
356250756a7Sjeremylt   int (*ApplyAddComposite)(CeedOperator, CeedVector, CeedVector, CeedRequest *);
3576ea7c6c1SJed Brown   int (*ApplyJacobian)(CeedOperator, CeedVector, CeedVector, CeedVector,
3586ea7c6c1SJed Brown                        CeedVector, CeedRequest *);
3596ea7c6c1SJed Brown   int (*Destroy)(CeedOperator);
360d1d35e2fSjeremylt   CeedOperatorField *input_fields;
361d1d35e2fSjeremylt   CeedOperatorField *output_fields;
362d1d35e2fSjeremylt   CeedInt num_elem;   /* Number of elements */
363d1d35e2fSjeremylt   CeedInt num_qpts;   /* Number of quadrature points over all elements */
364d1d35e2fSjeremylt   CeedInt num_fields; /* Number of fields that have been set */
3656ea7c6c1SJed Brown   CeedQFunction qf;
3666ea7c6c1SJed Brown   CeedQFunction dqf;
3676ea7c6c1SJed Brown   CeedQFunction dqfT;
368f04ea552SJeremy L Thompson   bool is_immutable;
369f04ea552SJeremy L Thompson   bool is_interface_setup;
370f04ea552SJeremy L Thompson   bool is_backend_setup;
371f04ea552SJeremy L Thompson   bool is_composite;
372d1d35e2fSjeremylt   bool has_restriction;
373480fae85SJeremy L Thompson   CeedQFunctionAssemblyData qf_assembled;
374d1d35e2fSjeremylt   CeedOperator *sub_operators;
375d1d35e2fSjeremylt   CeedInt num_suboperators;
3766ea7c6c1SJed Brown   void *data;
3773668ca4bSJeremy L Thompson   CeedInt num_context_labels;
3783668ca4bSJeremy L Thompson   CeedInt max_context_labels;
3793668ca4bSJeremy L Thompson   CeedContextFieldLabel *context_labels;
3806ea7c6c1SJed Brown };
3816ea7c6c1SJed Brown 
3826ea7c6c1SJed Brown #endif
383