xref: /honee/include/honee.h (revision 00359db47665a79ecb0241f6ccbf886b649022df)
178c5b8e5SJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
278c5b8e5SJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
378c5b8e5SJames Wright #pragma once
4a8340a88SJames Wright #include <ceed.h>
51c58d510SJames Wright #include <petscdm.h>
61c58d510SJames Wright #include <petscsection.h>
71c58d510SJames Wright #include <petscts.h>
8a5677b81SMohi #include <stdbool.h>
978c5b8e5SJames Wright typedef struct Honee_private *Honee;
10a5677b81SMohi 
11a5677b81SMohi #define HONEE_VERSION_MAJOR 0
12a5677b81SMohi #define HONEE_VERSION_MINOR 0
13a5677b81SMohi #define HONEE_VERSION_PATCH 0
14a5677b81SMohi #define HONEE_VERSION_RELEASE false
15a5677b81SMohi /// Compile-time check that the the current library version is at least as
16a5677b81SMohi /// recent as the specified version. This macro is typically used in
17a5677b81SMohi /// @code
18a5677b81SMohi /// #if HONEE_VERSION_GE(0, 1, 0)
19a5677b81SMohi ///   code path that needs at least 0.1.0
20a5677b81SMohi /// #else
21a5677b81SMohi ///   fallback code for older versions
22a5677b81SMohi /// #endif
23a5677b81SMohi /// @endcode
24a5677b81SMohi ///
25a5677b81SMohi /// A non-release version always compares as positive infinity.
26a5677b81SMohi ///
27a5677b81SMohi #define HONEE_VERSION_GE(major, minor, patch) \
28a5677b81SMohi   (!HONEE_VERSION_RELEASE ||                  \
29a5677b81SMohi    (HONEE_VERSION_MAJOR > major ||            \
30a5677b81SMohi     (HONEE_VERSION_MAJOR == major && (HONEE_VERSION_MINOR > minor || (HONEE_VERSION_MINOR == minor && HONEE_VERSION_PATCH >= patch)))))
31a5677b81SMohi 
32a5677b81SMohi PetscErrorCode HoneeGetVersion(int *major, int *minor, int *patch, PetscBool *release);
33a5677b81SMohi PetscErrorCode HoneeGetGitVersion(const char **git_version);
34a5677b81SMohi PetscErrorCode HoneeGetBuildConfiguration(const char **build_config);
350c70a8bcSJames Wright 
360c70a8bcSJames Wright PetscErrorCode HoneeSetContainer(Honee honee, const char key[], void *container, PetscCtxDestroyFn *container_destroy);
370c70a8bcSJames Wright PetscErrorCode HoneeGetContainer(Honee honee, const char key[], void *container);
380c70a8bcSJames Wright PetscErrorCode HoneeHasContainer(Honee honee, const char key[], PetscBool *has_key);
39e3db12f8SJames Wright 
40e3db12f8SJames Wright extern const DMLabel  DMLABEL_DEFAULT;
41e3db12f8SJames Wright extern const PetscInt DMLABEL_DEFAULT_VALUE;
42*7e3656bdSJames Wright 
43*7e3656bdSJames Wright // Mesh Transformation
44*7e3656bdSJames Wright typedef enum {
45*7e3656bdSJames Wright   MESH_TRANSFORM_NONE      = 0,
46*7e3656bdSJames Wright   MESH_TRANSFORM_PLATEMESH = 1,
47*7e3656bdSJames Wright } MeshTransform;
48*7e3656bdSJames Wright static const char *const MeshTransforms[] = {"NONE", "PLATEMESH", "MeshTransform", "MESH_TRANSFORM_", NULL};
49*7e3656bdSJames Wright PetscErrorCode           HoneeMeshTransformFromOptions(DM dm);
50