1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors. 2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause 3 #pragma once 4 5 #include <ceed.h> 6 #include <petsc.h> 7 8 typedef struct _p_BCDefinition *BCDefinition; 9 struct _p_BCDefinition { 10 char *name; 11 DM dm; 12 13 // Boundary ID information 14 PetscInt num_label_values, *label_values, dm_field; 15 16 // Essential Boundary information 17 PetscInt num_essential_comps, *essential_comps; 18 }; 19 20 /** 21 @brief Creates a `BCDefinition` from an array of integers in an option in the database 22 23 Must be between `PetscOptionsBegin()` and `PetscOptionsEnd()`. 24 25 @param[in] opt The option one is seeking 26 @param[in] text Short string describing option 27 @param[in] man Manual page for the option 28 @param[in] name String that sets the name of the `BCDefinition` 29 @param[out] bc_def Resulting `BCDefinition`, `NULL` if option is not set 30 @param[out] set `PETSC_TRUE` if found, else `PETSC_FALSE` 31 **/ 32 #define PetscOptionsBCDefinition(opt, text, man, name, bc_def, set) \ 33 PetscOptionsBCDefinition_Private(PetscOptionsObject, opt, text, man, name, bc_def, set) 34 PetscErrorCode PetscOptionsBCDefinition_Private(PetscOptionItems PetscOptionsObject, const char opt[], const char text[], const char man[], 35 const char name[], BCDefinition *bc_def, PetscBool *set); 36 37 PetscErrorCode BCDefinitionCreate(const char *name, PetscInt num_label_values, PetscInt label_values[], BCDefinition *bc_def); 38 PetscErrorCode BCDefinitionGetInfo(BCDefinition bc_def, const char *name[], PetscInt *num_label_values, const PetscInt *label_values[]); 39 PetscErrorCode BCDefinitionDestroy(BCDefinition *bc_def); 40 41 PetscErrorCode BCDefinitionSetEssential(BCDefinition bc_def, PetscInt num_essential_comps, PetscInt essential_comps[]); 42 PetscErrorCode BCDefinitionGetEssential(BCDefinition bc_def, PetscInt *num_essential_comps, const PetscInt *essential_comps[]); 43 44 PetscErrorCode BCDefinitionSetDM(BCDefinition bc_def, DM dm); 45 PetscErrorCode BCDefinitionGetDM(BCDefinition bc_def, DM *dm); 46