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