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