xref: /libCEED/examples/solids/include/setup-libceed.h (revision 24a65d3da2f623912f26b42c0b9ba6f37de25307)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33d8e8822SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
53d8e8822SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*24a65d3dSJeremy L Thompson #pragma once
85754ecacSJeremy L Thompson 
95754ecacSJeremy L Thompson #include <ceed.h>
1049aac155SJeremy L Thompson #include <petscdm.h>
112b730f8bSJeremy L Thompson 
125754ecacSJeremy L Thompson #include "../include/structs.h"
135754ecacSJeremy L Thompson 
145754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
155754ecacSJeremy L Thompson // libCEED Functions
165754ecacSJeremy L Thompson // -----------------------------------------------------------------------------
175754ecacSJeremy L Thompson // Destroy libCEED objects
185754ecacSJeremy L Thompson PetscErrorCode CeedDataDestroy(CeedInt level, CeedData data);
195754ecacSJeremy L Thompson 
205754ecacSJeremy L Thompson // Utility function - essential BC dofs are encoded in closure indices as -(i+1)
215754ecacSJeremy L Thompson PetscInt Involute(PetscInt i);
225754ecacSJeremy L Thompson 
235754ecacSJeremy L Thompson // Utility function to create local CEED restriction from DMPlex
242b730f8bSJeremy L Thompson PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, CeedInt value, CeedElemRestriction *elem_restr);
255754ecacSJeremy L Thompson 
265754ecacSJeremy L Thompson // Utility function to get Ceed Restriction for each domain
272b730f8bSJeremy L Thompson PetscErrorCode GetRestrictionForDomain(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, PetscInt value, CeedInt Q, CeedInt q_data_size,
282b730f8bSJeremy L Thompson                                        CeedElemRestriction *elem_restr_q, CeedElemRestriction *elem_restr_x, CeedElemRestriction *elem_restr_qd_i);
295754ecacSJeremy L Thompson 
305754ecacSJeremy L Thompson // Set up libCEED for a given degree
312b730f8bSJeremy L Thompson PetscErrorCode SetupLibceedFineLevel(DM dm, DM dm_energy, DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
322b730f8bSJeremy L Thompson                                      ProblemData problem_data, PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
332b730f8bSJeremy L Thompson                                      CeedVector force_ceed, CeedVector neumann_ceed, CeedData *data);
345754ecacSJeremy L Thompson 
355754ecacSJeremy L Thompson // Set up libCEED multigrid level for a given degree
362b730f8bSJeremy L Thompson PetscErrorCode SetupLibceedLevel(DM dm, Ceed ceed, AppCtx app_ctx, ProblemData problem_data, PetscInt level, PetscInt num_comp_u, PetscInt U_g_size,
372b730f8bSJeremy L Thompson                                  PetscInt U_loc_size, CeedVector fine_mult, CeedData *data);
38