xref: /honee/include/bc_definition.h (revision 09240e0a7b1ed022a0b5d6f639eacef49a47bbbd)
1ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2ae2b091fSJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3487a3b6eSJames Wright #pragma once
4487a3b6eSJames Wright 
5487a3b6eSJames Wright #include <ceed.h>
6487a3b6eSJames Wright #include <petsc.h>
7487a3b6eSJames Wright 
8487a3b6eSJames Wright typedef struct _p_BCDefinition *BCDefinition;
9487a3b6eSJames Wright struct _p_BCDefinition {
10487a3b6eSJames Wright   char *name;
11*09240e0aSJames Wright   DM    dm;
12487a3b6eSJames Wright 
13487a3b6eSJames Wright   // Boundary ID information
14487a3b6eSJames Wright   PetscInt num_label_values, *label_values, dm_field;
15487a3b6eSJames Wright 
16487a3b6eSJames Wright   // Essential Boundary information
17487a3b6eSJames Wright   PetscInt num_essential_comps, *essential_comps;
18487a3b6eSJames Wright };
19487a3b6eSJames Wright 
20487a3b6eSJames Wright /**
21487a3b6eSJames Wright    @brief Creates a `BCDefinition` from an array of integers in an option in the database
22487a3b6eSJames Wright 
23487a3b6eSJames Wright    Must be between `PetscOptionsBegin()` and `PetscOptionsEnd()`.
24487a3b6eSJames Wright 
25487a3b6eSJames Wright    @param[in]  opt    The option one is seeking
26487a3b6eSJames Wright    @param[in]  text   Short string describing option
27487a3b6eSJames Wright    @param[in]  man    Manual page for the option
28487a3b6eSJames Wright    @param[in]  name   String that sets the name of the `BCDefinition`
29487a3b6eSJames Wright    @param[out] bc_def Resulting `BCDefinition`, `NULL` if option is not set
30487a3b6eSJames Wright    @param[out] set    `PETSC_TRUE` if found, else `PETSC_FALSE`
31487a3b6eSJames Wright **/
32487a3b6eSJames Wright #define PetscOptionsBCDefinition(opt, text, man, name, bc_def, set) \
33487a3b6eSJames Wright   PetscOptionsBCDefinition_Private(PetscOptionsObject, opt, text, man, name, bc_def, set)
34ddf6e248SJames Wright PetscErrorCode PetscOptionsBCDefinition_Private(PetscOptionItems PetscOptionsObject, const char opt[], const char text[], const char man[],
35487a3b6eSJames Wright                                                 const char name[], BCDefinition *bc_def, PetscBool *set);
36487a3b6eSJames Wright 
37487a3b6eSJames Wright PetscErrorCode BCDefinitionCreate(const char *name, PetscInt num_label_values, PetscInt label_values[], BCDefinition *bc_def);
38487a3b6eSJames Wright PetscErrorCode BCDefinitionGetInfo(BCDefinition bc_def, const char *name[], PetscInt *num_label_values, const PetscInt *label_values[]);
39487a3b6eSJames Wright PetscErrorCode BCDefinitionDestroy(BCDefinition *bc_def);
40487a3b6eSJames Wright 
41487a3b6eSJames Wright PetscErrorCode BCDefinitionSetEssential(BCDefinition bc_def, PetscInt num_essential_comps, PetscInt essential_comps[]);
42487a3b6eSJames Wright PetscErrorCode BCDefinitionGetEssential(BCDefinition bc_def, PetscInt *num_essential_comps, const PetscInt *essential_comps[]);
43*09240e0aSJames Wright 
44*09240e0aSJames Wright PetscErrorCode BCDefinitionSetDM(BCDefinition bc_def, DM dm);
45*09240e0aSJames Wright PetscErrorCode BCDefinitionGetDM(BCDefinition bc_def, DM *dm);
46