xref: /honee/include/bc_definition.h (revision 78c5b8e539f43a7556c7bb4c279ec797b7ffab65)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 #pragma once
4 
5 #include <ceed.h>
6 #include <petsc.h>
7 
8 typedef struct _p_BCDefinition *BCDefinition;
9 struct _p_BCDefinition {
10   char *name;
11 
12   // Boundary ID information
13   PetscInt num_label_values, *label_values, dm_field;
14 
15   // Essential Boundary information
16   PetscInt num_essential_comps, *essential_comps;
17 };
18 
19 /**
20    @brief Creates a `BCDefinition` from an array of integers in an option in the database
21 
22    Must be between `PetscOptionsBegin()` and `PetscOptionsEnd()`.
23 
24    @param[in]  opt    The option one is seeking
25    @param[in]  text   Short string describing option
26    @param[in]  man    Manual page for the option
27    @param[in]  name   String that sets the name of the `BCDefinition`
28    @param[out] bc_def Resulting `BCDefinition`, `NULL` if option is not set
29    @param[out] set    `PETSC_TRUE` if found, else `PETSC_FALSE`
30 **/
31 #define PetscOptionsBCDefinition(opt, text, man, name, bc_def, set) \
32   PetscOptionsBCDefinition_Private(PetscOptionsObject, opt, text, man, name, bc_def, set)
33 PetscErrorCode PetscOptionsBCDefinition_Private(PetscOptionItems PetscOptionsObject, const char opt[], const char text[], const char man[],
34                                                 const char name[], BCDefinition *bc_def, PetscBool *set);
35 
36 PetscErrorCode BCDefinitionCreate(const char *name, PetscInt num_label_values, PetscInt label_values[], BCDefinition *bc_def);
37 PetscErrorCode BCDefinitionGetInfo(BCDefinition bc_def, const char *name[], PetscInt *num_label_values, const PetscInt *label_values[]);
38 PetscErrorCode BCDefinitionDestroy(BCDefinition *bc_def);
39 
40 PetscErrorCode BCDefinitionSetEssential(BCDefinition bc_def, PetscInt num_essential_comps, PetscInt essential_comps[]);
41 PetscErrorCode BCDefinitionGetEssential(BCDefinition bc_def, PetscInt *num_essential_comps, const PetscInt *essential_comps[]);
42