xref: /libCEED/examples/solids/include/setup-libceed.h (revision 255dad3207f061d22701e91ddb8337d8c6809493)
1 // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause
5 //
6 // This file is part of CEED:  http://github.com/ceed
7 #pragma once
8 
9 #include <ceed.h>
10 #include <petscdm.h>
11 
12 #include "../include/structs.h"
13 
14 // -----------------------------------------------------------------------------
15 // libCEED Functions
16 // -----------------------------------------------------------------------------
17 // Destroy libCEED objects
18 PetscErrorCode CeedDataDestroy(CeedInt level, CeedData data);
19 
20 // Utility function - essential BC dofs are encoded in closure indices as -(i+1)
21 PetscInt Involute(PetscInt i);
22 
23 // Utility function to create local CEED restriction from DMPlex
24 PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, CeedInt value, CeedElemRestriction *elem_restr);
25 
26 // Utility function to get Ceed Restriction for each domain
27 PetscErrorCode GetRestrictionForDomain(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, PetscInt value, CeedInt Q, CeedInt q_data_size,
28                                        CeedElemRestriction *elem_restr_q, CeedElemRestriction *elem_restr_x, CeedElemRestriction *elem_restr_qd_i);
29 
30 // Set up libCEED for a given degree
31 PetscErrorCode SetupLibceedFineLevel(DM dm, DM dm_energy, DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
32                                      ProblemData problem_data, PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
33                                      CeedVector force_ceed, CeedVector neumann_ceed, CeedData *data);
34 
35 // Set up libCEED multigrid level for a given degree
36 PetscErrorCode SetupLibceedLevel(DM dm, Ceed ceed, AppCtx app_ctx, ProblemData problem_data, PetscInt level, PetscInt num_comp_u, PetscInt U_g_size,
37                                  PetscInt U_loc_size, CeedVector fine_mult, CeedData *data);
38