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