xref: /honee/include/honee.h (revision 1c58d5103542fa2ebd83297dfab28518c6a69bf4)
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>
5*1c58d510SJames Wright #include <petscdm.h>
6*1c58d510SJames Wright #include <petscsection.h>
7*1c58d510SJames 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);
39