xref: /libCEED/examples/fluids/include/bc_definition.h (revision a8edb68e24d5d8dacff667fece68d98dd14ae722)
1 // Copyright (c) 2017-2025, 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 <petsc.h>
11 
12 typedef struct _p_BCDefinition *BCDefinition;
13 struct _p_BCDefinition {
14   char *name;
15 
16   // Boundary ID information
17   PetscInt num_label_values, *label_values, dm_field;
18 
19   // Essential Boundary information
20   PetscInt num_essential_comps, *essential_comps;
21 };
22 
23 /**
24    @brief Creates a `BCDefinition` from an array of integers in an option in the database
25 
26    Must be between `PetscOptionsBegin()` and `PetscOptionsEnd()`.
27 
28    @param[in]  opt    The option one is seeking
29    @param[in]  text   Short string describing option
30    @param[in]  man    Manual page for the option
31    @param[in]  name   String that sets the name of the `BCDefinition`
32    @param[out] bc_def Resulting `BCDefinition`, `NULL` if option is not set
33    @param[out] set    `PETSC_TRUE` if found, else `PETSC_FALSE`
34 **/
35 #define PetscOptionsBCDefinition(opt, text, man, name, bc_def, set) \
36   PetscOptionsBCDefinition_Private(PetscOptionsObject, opt, text, man, name, bc_def, set)
37 PetscErrorCode PetscOptionsBCDefinition_Private(PetscOptionItems PetscOptionsObject, const char opt[], const char text[], const char man[],
38                                                 const char name[], BCDefinition *bc_def, PetscBool *set);
39 
40 PetscErrorCode BCDefinitionCreate(const char *name, PetscInt num_label_values, PetscInt label_values[], BCDefinition *bc_def);
41 PetscErrorCode BCDefinitionGetInfo(BCDefinition bc_def, const char *name[], PetscInt *num_label_values, const PetscInt *label_values[]);
42 PetscErrorCode BCDefinitionDestroy(BCDefinition *bc_def);
43 
44 PetscErrorCode BCDefinitionSetEssential(BCDefinition bc_def, PetscInt num_essential_comps, PetscInt essential_comps[]);
45 PetscErrorCode BCDefinitionGetEssential(BCDefinition bc_def, PetscInt *num_essential_comps, const PetscInt *essential_comps[]);
46