xref: /honee/include/bc_definition.h (revision ae2b091fac884a554e48acc4b4c187524c2a2818)
1*ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2*ae2b091fSJames 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;
11487a3b6eSJames Wright 
12487a3b6eSJames Wright   // Boundary ID information
13487a3b6eSJames Wright   PetscInt num_label_values, *label_values, dm_field;
14487a3b6eSJames Wright 
15487a3b6eSJames Wright   // Essential Boundary information
16487a3b6eSJames Wright   PetscInt num_essential_comps, *essential_comps;
17487a3b6eSJames Wright };
18487a3b6eSJames Wright 
19487a3b6eSJames Wright /**
20487a3b6eSJames Wright    @brief Creates a `BCDefinition` from an array of integers in an option in the database
21487a3b6eSJames Wright 
22487a3b6eSJames Wright    Must be between `PetscOptionsBegin()` and `PetscOptionsEnd()`.
23487a3b6eSJames Wright 
24487a3b6eSJames Wright    @param[in]  opt    The option one is seeking
25487a3b6eSJames Wright    @param[in]  text   Short string describing option
26487a3b6eSJames Wright    @param[in]  man    Manual page for the option
27487a3b6eSJames Wright    @param[in]  name   String that sets the name of the `BCDefinition`
28487a3b6eSJames Wright    @param[out] bc_def Resulting `BCDefinition`, `NULL` if option is not set
29487a3b6eSJames Wright    @param[out] set    `PETSC_TRUE` if found, else `PETSC_FALSE`
30487a3b6eSJames Wright **/
31487a3b6eSJames Wright #define PetscOptionsBCDefinition(opt, text, man, name, bc_def, set) \
32487a3b6eSJames Wright   PetscOptionsBCDefinition_Private(PetscOptionsObject, opt, text, man, name, bc_def, set)
33487a3b6eSJames Wright PetscErrorCode PetscOptionsBCDefinition_Private(PetscOptionItems *PetscOptionsObject, const char opt[], const char text[], const char man[],
34487a3b6eSJames Wright                                                 const char name[], BCDefinition *bc_def, PetscBool *set);
35487a3b6eSJames Wright 
36487a3b6eSJames Wright PetscErrorCode BCDefinitionCreate(const char *name, PetscInt num_label_values, PetscInt label_values[], BCDefinition *bc_def);
37487a3b6eSJames Wright PetscErrorCode BCDefinitionGetInfo(BCDefinition bc_def, const char *name[], PetscInt *num_label_values, const PetscInt *label_values[]);
38487a3b6eSJames Wright PetscErrorCode BCDefinitionDestroy(BCDefinition *bc_def);
39487a3b6eSJames Wright 
40487a3b6eSJames Wright PetscErrorCode BCDefinitionSetEssential(BCDefinition bc_def, PetscInt num_essential_comps, PetscInt essential_comps[]);
41487a3b6eSJames Wright PetscErrorCode BCDefinitionGetEssential(BCDefinition bc_def, PetscInt *num_essential_comps, const PetscInt *essential_comps[]);
42