commit c0e7ef42569d34d9b100cd7f6f0a42c8a9aa3837
parent c53f6bdc0173f9b6854d23c9bdeaea844e0f7502
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 14 Jun 2022 14:33:10 +0200
Define the library API
Diffstat:
| A | src/sars.h | | | 107 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 107 insertions(+), 0 deletions(-)
diff --git a/src/sars.h b/src/sars.h
@@ -0,0 +1,107 @@
+/* Copyright (C) 2022 |Meso|Star> (contact@meso-star.com)
+ *
+ * This program is free software: you can redismshbute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is dismshbuted in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef SARS_H
+#define SARS_H
+
+#include <rsys/rsys.h>
+
+/* Library symbol management */
+#if defined(SARS_SHARED_BUILD) /* Build shared library */
+ #define SARS_API extern EXPORT_SYM
+#elif defined(SARS_STATIC) /* Use/build static library */
+ #define SARS_API extern LOCAL_SYM
+#else /* Use shared library */
+ #define SARS_API extern IMPORT_SYM
+#endif
+
+/* Helper macro that asserts if the invocation of the smsh function `Func'
+ * returns an error. One should use this macro on smsh function calls for
+ * which no explicit error checking is performed */
+#ifndef NDEBUG
+ #define SARS(Func) ASSERT(sars_ ## Func == RES_OK)
+#else
+ #define SARS(Func) sars_ ## Func
+#endif
+
+/* Forward declaration of external data types */
+struct logger;
+struct mem_allocator;
+
+struct sars_create_args {
+ struct logger* logger; /* May be NULL <=> default logger */
+ struct mem_allocator* allocator; /* NULL <=> use default allocator */
+ int verbose; /* Verbosity level */
+};
+#define SARS_CREATE_ARGS_DEFAULT__ {NULL, NULL, 0}
+static const struct sars_create_args SARS_CREATE_ARGS_DEFAULT =
+ SARS_CREATE_ARGS_DEFAULT__;
+
+struct sars_band {
+ double lower; /* Lower band wavenumber in cm^-1 */
+ double upper; /* Upper band wavenumber in cm^-1 */
+ size_t id;
+
+ float* ks_list; /* Per node ks */
+ float* ka_list; /* Per node ka */
+};
+#define SARS_BAND_NULL__ {0, 0, 0, NULL, NULL}
+static const struct sars_band SARS_BAND_NULL = SARS_BAND_NULL__;
+
+/* Forward declaration of opaque data types */
+struct sars;
+
+/*******************************************************************************
+ * Star-AeRoSol API
+ ******************************************************************************/
+SARS_API res_T
+sars_create
+ (const struct sars_create_args* args,
+ struct sars** sars);
+
+SARS_API res_T
+sars_ref_get
+ (struct sars* sars);
+
+SARS_API res_T
+sars_ref_put
+ (struct sars* sars);
+
+SARS_API res_T
+sars_load
+ (struct sars* sars,
+ const char* path);
+
+SARS_API res_T
+sars_load_stream
+ (struct sars* sars,
+ FILE* stream,
+ const char* stream_name); /* Can be NULL */
+
+SARS_API size_t
+sars_get_bands_count
+ (const struct sars* sars);
+
+SARS_API size_t
+sars_get_nodes_count
+ (const struct sars* sars);
+
+SARS_API res_T
+sars_get_band
+ (const struct sars* sars,
+ const size_t iband,
+ struct sars_band* band);
+
+#endif /* SARS_H */