xref: /libCEED/examples/petsc/include/structs.h (revision de1229c50b0fa287ef0d97965becc5ec55ca5a76) !
1 #ifndef libceed_petsc_examples_structs_h
2 #define libceed_petsc_examples_structs_h
3 
4 #include <ceed.h>
5 #include <petsc.h>
6 
7 // -----------------------------------------------------------------------------
8 // PETSc Operator Structs
9 // -----------------------------------------------------------------------------
10 
11 // Data for PETSc Matshell
12 typedef struct UserO_ *UserO;
13 struct UserO_ {
14   MPI_Comm comm;
15   DM dm;
16   Vec X_loc, Y_loc, diag;
17   CeedVector x_ceed, y_ceed;
18   CeedOperator op;
19   Ceed ceed;
20 };
21 
22 // Data for PETSc Prolong/Restrict Matshells
23 typedef struct UserProlongRestr_ *UserProlongRestr;
24 struct UserProlongRestr_ {
25   MPI_Comm comm;
26   DM dmc, dmf;
27   Vec loc_vec_c, loc_vec_f, mult_vec;
28   CeedVector ceed_vec_c, ceed_vec_f;
29   CeedOperator op_prolong, op_restrict;
30   Ceed ceed;
31 };
32 
33 // -----------------------------------------------------------------------------
34 // libCEED Data Structs
35 // -----------------------------------------------------------------------------
36 
37 // libCEED data struct for level
38 typedef struct CeedData_ *CeedData;
39 struct CeedData_ {
40   Ceed ceed;
41   CeedBasis basis_x, basis_u, basis_c_to_f;
42   CeedElemRestriction elem_restr_x, elem_restr_u, elem_restr_u_i, elem_restr_qd_i;
43   CeedQFunction qf_apply;
44   CeedOperator op_apply, op_restrict, op_prolong;
45   CeedVector q_data, x_ceed, y_ceed;
46 };
47 
48 // BP specific data
49 typedef struct {
50   CeedInt num_comp_x, num_comp_u, topo_dim, q_data_size, q_extra;
51   CeedQFunctionUser setup_geo, setup_rhs, apply, error;
52   const char *setup_geo_loc, *setup_rhs_loc, *apply_loc, *error_loc;
53   CeedEvalMode in_mode, out_mode;
54   CeedQuadMode q_mode;
55   PetscBool enforce_bc;
56   PetscErrorCode (*bc_func)(PetscInt, PetscReal, const PetscReal *,
57                             PetscInt, PetscScalar *, void *);
58 } BPData;
59 
60 // BP options
61 typedef enum {
62   CEED_BP1 = 0, CEED_BP2 = 1, CEED_BP3 = 2,
63   CEED_BP4 = 3, CEED_BP5 = 4, CEED_BP6 = 5
64 } BPType;
65 
66 // -----------------------------------------------------------------------------
67 // Parameter structure for running problems
68 // -----------------------------------------------------------------------------
69 typedef struct RunParams_ *RunParams;
70 struct RunParams_ {
71   MPI_Comm comm;
72   PetscBool test_mode, read_mesh, user_l_nodes, write_solution, simplex;
73   char *filename, *hostname;
74   PetscInt local_nodes, degree, q_extra, dim, num_comp_u, *mesh_elem;
75   PetscInt ksp_max_it_clip[2];
76   PetscMPIInt ranks_per_node;
77   BPType bp_choice;
78   PetscLogStage solve_stage;
79 };
80 
81 #endif // libceed_petsc_examples_structs_h
82