xref: /libCEED/examples/solids/include/setup-libceed.h (revision 5754ecac3b7d1ff97b39b25dc78c06350f2c900d)
1*5754ecacSJeremy L Thompson #ifndef setuplibceed_h
2*5754ecacSJeremy L Thompson #define setuplibceed_h
3*5754ecacSJeremy L Thompson 
4*5754ecacSJeremy L Thompson #include <ceed.h>
5*5754ecacSJeremy L Thompson #include <petsc.h>
6*5754ecacSJeremy L Thompson #include "../include/structs.h"
7*5754ecacSJeremy L Thompson 
8*5754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
9*5754ecacSJeremy L Thompson // libCEED Functions
10*5754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
11*5754ecacSJeremy L Thompson // Destroy libCEED objects
12*5754ecacSJeremy L Thompson PetscErrorCode CeedDataDestroy(CeedInt level, CeedData data);
13*5754ecacSJeremy L Thompson 
14*5754ecacSJeremy L Thompson // Utility function - essential BC dofs are encoded in closure indices as -(i+1)
15*5754ecacSJeremy L Thompson PetscInt Involute(PetscInt i);
16*5754ecacSJeremy L Thompson 
17*5754ecacSJeremy L Thompson // Utility function to create local CEED restriction from DMPlex
18*5754ecacSJeremy L Thompson PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm, CeedInt P,
19*5754ecacSJeremy L Thompson     CeedInt height, DMLabel domain_label, CeedInt value,
20*5754ecacSJeremy L Thompson     CeedElemRestriction *elem_restr);
21*5754ecacSJeremy L Thompson 
22*5754ecacSJeremy L Thompson // Utility function to get Ceed Restriction for each domain
23*5754ecacSJeremy L Thompson PetscErrorCode GetRestrictionForDomain(Ceed ceed, DM dm, CeedInt height,
24*5754ecacSJeremy L Thompson                                        DMLabel domain_label, PetscInt value, CeedInt P,
25*5754ecacSJeremy L Thompson                                        CeedInt Q, CeedInt q_data_size,
26*5754ecacSJeremy L Thompson                                        CeedElemRestriction *elem_restr_q,
27*5754ecacSJeremy L Thompson                                        CeedElemRestriction *elem_restr_x,
28*5754ecacSJeremy L Thompson                                        CeedElemRestriction *elem_restr_qd_i);
29*5754ecacSJeremy L Thompson 
30*5754ecacSJeremy L Thompson // Set up libCEED for a given degree
31*5754ecacSJeremy L Thompson PetscErrorCode SetupLibceedFineLevel(DM dm, DM dm_energy, DM dm_diagnostic,
32*5754ecacSJeremy L Thompson                                      Ceed ceed, AppCtx app_ctx,
33*5754ecacSJeremy L Thompson                                      CeedQFunctionContext phys_ctx,
34*5754ecacSJeremy L Thompson                                      ProblemData problem_data,
35*5754ecacSJeremy L Thompson                                      PetscInt fine_level, PetscInt num_comp_u,
36*5754ecacSJeremy L Thompson                                      PetscInt U_g_size, PetscInt U_loc_size,
37*5754ecacSJeremy L Thompson                                      CeedVector force_ceed,
38*5754ecacSJeremy L Thompson                                      CeedVector neumann_ceed, CeedData *data);
39*5754ecacSJeremy L Thompson 
40*5754ecacSJeremy L Thompson // Set up libCEED multigrid level for a given degree
41*5754ecacSJeremy L Thompson PetscErrorCode SetupLibceedLevel(DM dm, Ceed ceed, AppCtx app_ctx,
42*5754ecacSJeremy L Thompson                                  ProblemData problem_data, PetscInt level,
43*5754ecacSJeremy L Thompson                                  PetscInt num_comp_u, PetscInt U_g_size,
44*5754ecacSJeremy L Thompson                                  PetscInt U_loc_size, CeedVector fine_mult,
45*5754ecacSJeremy L Thompson                                  CeedData *data);
46*5754ecacSJeremy L Thompson 
47*5754ecacSJeremy L Thompson #endif // setuplibceed_h
48