xref: /honee/include/honee.h (revision 0c608af58d6c66f4fcbe6fff5e0f907584234584)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 #pragma once
4 #include <ceed.h>
5 #include <petsc.h>
6 #include <stdbool.h>
7 typedef struct Honee_private *Honee;
8 
9 #define HONEE_VERSION_MAJOR 0
10 #define HONEE_VERSION_MINOR 0
11 #define HONEE_VERSION_PATCH 0
12 #define HONEE_VERSION_RELEASE false
13 /// Compile-time check that the the current library version is at least as
14 /// recent as the specified version. This macro is typically used in
15 /// @code
16 /// #if HONEE_VERSION_GE(0, 1, 0)
17 ///   code path that needs at least 0.1.0
18 /// #else
19 ///   fallback code for older versions
20 /// #endif
21 /// @endcode
22 ///
23 /// A non-release version always compares as positive infinity.
24 ///
25 #define HONEE_VERSION_GE(major, minor, patch) \
26   (!HONEE_VERSION_RELEASE ||                  \
27    (HONEE_VERSION_MAJOR > major ||            \
28     (HONEE_VERSION_MAJOR == major && (HONEE_VERSION_MINOR > minor || (HONEE_VERSION_MINOR == minor && HONEE_VERSION_PATCH >= patch)))))
29 
30 PetscErrorCode HoneeGetVersion(int *major, int *minor, int *patch, PetscBool *release);
31 PetscErrorCode HoneeGetGitVersion(const char **git_version);
32 PetscErrorCode HoneeGetBuildConfiguration(const char **build_config);
33 
34 PetscErrorCode HoneeSetContainer(Honee honee, const char key[], void *container, PetscCtxDestroyFn *container_destroy);
35 PetscErrorCode HoneeGetContainer(Honee honee, const char key[], void *container);
36 PetscErrorCode HoneeHasContainer(Honee honee, const char key[], PetscBool *has_key);
37