1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
// /* -----------------------------------------------------------------
// * Programmer(s): Scott Cohen, Alan Hindmarsh, Radu Serban,
// * Aaron Collier, and Slaven Peles @ LLNL
// * -----------------------------------------------------------------
// * SUNDIALS Copyright Start
// * Copyright (c) 2025-2026, Lawrence Livermore National Security,
// * University of Maryland Baltimore County, and the SUNDIALS contributors.
// * Copyright (c) 2013-2025, Lawrence Livermore National Security
// * and Southern Methodist University.
// * Copyright (c) 2002-2013, Lawrence Livermore National Security.
// * All rights reserved.
// *
// * See the top-level LICENSE and NOTICE files for details.
// *
// * SPDX-License-Identifier: BSD-3-Clause
// * SUNDIALS Copyright End
// * -----------------------------------------------------------------
// * This header file exports three types: sunrealtype, sunindextype,
// * and sunbooleantype, as well as the constants SUNTRUE and SUNFALSE.
// *
// * Users should include the header file sundials_types.h in every
// * program file and use the exported name sunrealtype instead of
// * float, double or long double.
// *
// * The constants SUNDIALS_SINGLE_PRECISION, SUNDIALS_DOUBLE_PRECISION
// * and SUNDIALS_LONG_DOUBLE_PRECISION indicate the underlying data
// * type of sunrealtype.
// *
// * The legal types for sunrealtype are float, double and long double.
// *
// * The constants SUNDIALS_INT64_T and SUNDIALS_INT32_T indicate
// * the underlying data type of sunindextype -- the integer data type
// * used for vector and matrix indices.
// *
// * Data types are set at the configuration stage.
// *
// * The macro SUN_RCONST gives the user a convenient way to define
// * real-valued literal constants. To use the constant 1.0, for example,
// * the user should write the following:
// *
// * #define ONE SUN_RCONST(1.0)
// *
// * If sunrealtype is defined as a double, then SUN_RCONST(1.0) expands
// * to 1.0. If sunrealtype is defined as a float, then SUN_RCONST(1.0)
// * expands to 1.0F. If sunrealtype is defined as a long double,
// * then SUN_RCONST(1.0) expands to 1.0L. There is never a need to
// * explicitly cast 1.0 to (sunrealtype). The macro can be used for
// * literal constants only. It cannot be used for expressions.
// * -----------------------------------------------------------------*/
// #ifndef _SUNDIALS_TYPES_H
// #define _SUNDIALS_TYPES_H
// #include <float.h>
// #include <stddef.h>
// #include <stdint.h>
// #include <sundials/sundials_config.h>
// #if SUNDIALS_MPI_ENABLED
// #include <mpi.h>
// #endif
// #ifdef __cplusplus /* wrapper to enable C++ usage */
// extern "C" {
// #endif
// /*
// *------------------------------------------------------------------
// * Macro _SUNDIALS_STRUCT_
// * The _SUNDIALS_STRUCT_ macro is defined as a `struct` unless
// * generating the SWIG interfaces - in that case it is defined as
// * nothing. This is needed to work around a bug in SWIG which prevents
// * it from properly parsing our generic module structures.
// *------------------------------------------------------------------
// */
// #ifdef SWIG
// #define _SUNDIALS_STRUCT_
// #else
// #define _SUNDIALS_STRUCT_ struct
// #endif
// /*
// *------------------------------------------------------------------
// * Type sunrealtype
// * Macro SUN_RCONST
// * Constants SUN_SMALL_REAL, SUN_BIG_REAL, and SUN_UNIT_ROUNDOFF
// *------------------------------------------------------------------
// */
// #define SUN_STRING_HELPER(x) #x
// #define SUN_STRING(x) SUN_STRING_HELPER(x)
// #if defined(SUNDIALS_SINGLE_PRECISION)
// typedef float sunrealtype;
// #define SUN_RCONST(x) x##F
// #define SUN_BIG_REAL FLT_MAX
// #define SUN_SMALL_REAL FLT_MIN
// #define SUN_UNIT_ROUNDOFF FLT_EPSILON
// // TODO(SBR): In C11, FLT_DECIMAL_DIG may be a better choice
// #define SUN_FORMAT_E "% ." SUN_STRING(FLT_DIG) "e"
// #define SUN_FORMAT_G "%." SUN_STRING(FLT_DIG) "g"
// // TODO(SBR): This can probably be removed once a complex format macro is added
// #define SUN_FORMAT_SG "%+." SUN_STRING(FLT_DIG) "g"
// #elif defined(SUNDIALS_DOUBLE_PRECISION)
// typedef double sunrealtype;
pub type sunrealtype = f64;
// #define SUN_RCONST(x) x
// #define SUN_BIG_REAL DBL_MAX
// #define SUN_SMALL_REAL DBL_MIN
// #define SUN_UNIT_ROUNDOFF DBL_EPSILON
// #define SUN_FORMAT_E "% ." SUN_STRING(DBL_DIG) "e"
// #define SUN_FORMAT_G "%." SUN_STRING(DBL_DIG) "g"
// #define SUN_FORMAT_SG "%+." SUN_STRING(DBL_DIG) "g"
// #elif defined(SUNDIALS_EXTENDED_PRECISION)
// typedef long double sunrealtype;
// #define SUN_RCONST(x) x##L
// #define SUN_BIG_REAL LDBL_MAX
// #define SUN_SMALL_REAL LDBL_MIN
// #define SUN_UNIT_ROUNDOFF LDBL_EPSILON
// #define SUN_FORMAT_E "% ." SUN_STRING(LDBL_DIG) "Le"
// #define SUN_FORMAT_G "%." SUN_STRING(LDBL_DIG) "Lg"
// #define SUN_FORMAT_SG "%+." SUN_STRING(LDBL_DIG) "Lg"
// #endif
// /*
// *------------------------------------------------------------------
// * Type : sunindextype
// *------------------------------------------------------------------
// * Defines integer type to be used for vector and matrix indices.
// * User can build sundials to use 32- or 64-bit signed integers.
// * If compiler does not support portable data types, the SUNDIALS
// * CMake build system tries to find a type of the desired size.
// *------------------------------------------------------------------
// */
// typedef SUNDIALS_INDEX_TYPE sunindextype;
pub type sunindextype = i64;
// /*
// *------------------------------------------------------------------
// * Type : suncountertype
// *------------------------------------------------------------------
// * Defines integer type to be used for counters within sundials.
// *------------------------------------------------------------------
// */
// typedef SUNDIALS_COUNTER_TYPE suncountertype;
// /*
// *------------------------------------------------------------------
// * Type : sunbooleantype
// *------------------------------------------------------------------
// * Constants : SUNFALSE and SUNTRUE
// *------------------------------------------------------------------
// * ANSI C does not have a built-in boolean data type. Below is the
// * definition for a new type called sunbooleantype. The advantage of
// * using the name sunbooleantype (instead of int) is an increase in
// * code readability. It also allows the programmer to make a
// * distinction between int and boolean data. Variables of type
// * sunbooleantype are intended to have only the two values SUNFALSE and
// * SUNTRUE which are defined below to be equal to 0 and 1,
// * respectively.
// *------------------------------------------------------------------
// */
// #ifndef sunbooleantype
// #define sunbooleantype int
// #endif
pub type sunbooleantype = i32;
// #ifndef SUNFALSE
// #define SUNFALSE 0
// #endif
pub const SUNFALSE: sunbooleantype = 0;
// #ifndef SUNTRUE
// #define SUNTRUE 1
// #endif
pub const SUNTRUE: sunbooleantype = 1;
// /*
// *------------------------------------------------------------------
// * Type : SUNOutputFormat
// *------------------------------------------------------------------
// * Constants for different output formats
// *------------------------------------------------------------------
// */
// enum SUNOutputFormat
// {
// SUN_OUTPUTFORMAT_TABLE,
// SUN_OUTPUTFORMAT_CSV
// };
// #ifndef SWIG
// typedef enum SUNOutputFormat SUNOutputFormat;
// #endif
// /*
// *------------------------------------------------------------------
// * Type : SUNErrCode
// *------------------------------------------------------------------
// * Error code type
// *------------------------------------------------------------------
// */
// typedef int SUNErrCode;
pub type SUNErrCode = i32;
// /* -----------------------------------------------------------------------------
// * Forward declarations of SUNDIALS objects
// * ---------------------------------------------------------------------------*/
// /* SUNDIALS context -- see sundials_context_impl.h */
// typedef struct SUNContext_* SUNContext;
pub type SUNContext = *mut c_void;
// /* SUNDIALS error handler -- see sundials_errors.h */
// typedef struct SUNErrHandler_* SUNErrHandler;
// /* SUNDIALS profiler */
// typedef struct SUNProfiler_* SUNProfiler;
// /* SUNDIALS logger */
// typedef struct SUNLogger_* SUNLogger;
// /* -----------------------------------------------------------------------------
// * SUNDIALS function types
// * ---------------------------------------------------------------------------*/
// /* Error handler function */
// typedef void (*SUNErrHandlerFn)(int line, const char* func, const char* file,
// const char* msg, SUNErrCode err_code,
// void* err_user_data, SUNContext sunctx);
// /*
// *------------------------------------------------------------------
// * Type : SUNComm
// *------------------------------------------------------------------
// * SUNComm replaces MPI_Comm use in SUNDIALS code. It maps to
// * MPI_Comm when MPI is enabled.
// *------------------------------------------------------------------
// */
// /* We don't define SUN_COMM_NULL when SWIG is processing the header
// because we manually insert the wrapper code for SUN_COMM_NULL
// (and %ignoring it in the SWIG code doesn't seem to work). */
// #ifndef SWIG
// #define SUN_COMM_NULL 0
// #endif
pub const SUN_COMM_NULL: SUNComm = 0;
// #if SUNDIALS_MPI_ENABLED
// #ifndef SWIG
// #undef SUN_COMM_NULL
// #define SUN_COMM_NULL MPI_COMM_NULL
// #endif
// typedef MPI_Comm SUNComm;
// #else
// typedef int SUNComm;
// #endif
pub type SUNComm = i32;
// #ifdef __cplusplus
// }
// #endif
// /*
// *------------------------------------------------------------------
// * Type : SUNDataIOMode
// *------------------------------------------------------------------
// * Type that controls IO modes for certain data operations, notably
// * checkpoints for adjoints.
// *------------------------------------------------------------------
// */
// enum SUNDataIOMode
// {
// SUNDATAIOMODE_INMEM,
// };
// #ifndef SWIG
// typedef enum SUNDataIOMode SUNDataIOMode;
// #endif
// #endif /* _SUNDIALS_TYPES_H */