1/*
2Copyright (c) 1994 - 2010, Lawrence Livermore National Security, LLC.
3LLNL-CODE-425250.
4All rights reserved.
5
6This file is part of Silo. For details, see silo.llnl.gov.
7
8Redistribution and use in source and binary forms, with or without
9modification, are permitted provided that the following conditions
10are met:
11
12   * Redistributions of source code must retain the above copyright
13     notice, this list of conditions and the disclaimer below.
14   * Redistributions in binary form must reproduce the above copyright
15     notice, this list of conditions and the disclaimer (as noted
16     below) in the documentation and/or other materials provided with
17     the distribution.
18   * Neither the name of the LLNS/LLNL nor the names of its
19     contributors may be used to endorse or promote products derived
20     from this software without specific prior written permission.
21
22THIS SOFTWARE  IS PROVIDED BY  THE COPYRIGHT HOLDERS  AND CONTRIBUTORS
23"AS  IS" AND  ANY EXPRESS  OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT
24LIMITED TO, THE IMPLIED  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25A  PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN  NO  EVENT SHALL  LAWRENCE
26LIVERMORE  NATIONAL SECURITY, LLC,  THE U.S.  DEPARTMENT OF  ENERGY OR
27CONTRIBUTORS BE LIABLE FOR  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28EXEMPLARY, OR  CONSEQUENTIAL DAMAGES  (INCLUDING, BUT NOT  LIMITED TO,
29PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS  OF USE,  DATA, OR
30PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31LIABILITY, WHETHER  IN CONTRACT, STRICT LIABILITY,  OR TORT (INCLUDING
32NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT  OF THE USE  OF THIS
33SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35This work was produced at Lawrence Livermore National Laboratory under
36Contract No.  DE-AC52-07NA27344 with the DOE.
37
38Neither the  United States Government nor  Lawrence Livermore National
39Security, LLC nor any of  their employees, makes any warranty, express
40or  implied,  or  assumes  any  liability or  responsibility  for  the
41accuracy, completeness,  or usefulness of  any information, apparatus,
42product, or  process disclosed, or  represents that its use  would not
43infringe privately-owned rights.
44
45Any reference herein to  any specific commercial products, process, or
46services by trade name,  trademark, manufacturer or otherwise does not
47necessarily  constitute or imply  its endorsement,  recommendation, or
48favoring  by  the  United  States  Government  or  Lawrence  Livermore
49National Security,  LLC. The views  and opinions of  authors expressed
50herein do not necessarily state  or reflect those of the United States
51Government or Lawrence Livermore National Security, LLC, and shall not
52be used for advertising or product endorsement purposes.
53*/
54
55/*
56 * SILO Public header file.
57 *
58 * This header file defines public constants and public prototypes.
59 * Before including this file, the application should define
60 * which file formats will be used.
61 *
62 * WARNING: The `#define' statements in this file are used when
63 *      generating the Fortran include file `silo.inc'.  Any
64 *     such symbol that should not be an integer parameter
65 *     in the Fortran include file should have the text
66 *     `NO_FORTRAN_DEFINE' on the same line.  #define statements
67 *     that define macros (or any value not beginning with
68 *     one of [a-zA-Z0-9_]) are ignored.
69 */
70#ifndef SILO_H
71#define SILO_H
72
73#include <stdio.h> /* for FILE* datatype for filters */
74
75#include <silo_exports.h>
76
77/* Why these Void Const Pointer (VCP) typedefs? (see below)... */
78typedef void const *                 DBVCP1_t; /* single level array */
79typedef void const *                 DBVCP2_t; /* double level array */
80typedef void const *                 DBVCP3_t; /* triple level array */
81
82/* And not these...
83typedef void const *                 DBVCP1_t;    single level array
84typedef void const * const *         DBVCP2_t;    double level array
85typedef void const * const * const * DBVCP3_t;    triple level array
86
87Ideally, the later typedefs would be used in the Silo API wherever a caller
88needs to pass a single, double or triple level array of arbitrary type.
89
90However, for multi-level arrays (e.g. more than a single star*), if the caller
91doesn't explicitly cast a non-void pointer to the exact type including the
92const qualifiers, the later definitions create obscure and non-intuitive compiler
93warnings for C callers and outright errors for C++ callers.
94
95Basically, as counter-intuitive as it sounds neither C nor C++ compilers can handle
96passing something like a 'double **' as an argument to a function expecting a
97'void const * const *'.
98
99A good reference on this issue for C is http://c-faq.com/ansi/constmismatch.html
100A good reference for C++ is
101http://www.embedded.com/electronics-blogs/programming-pointers/4025641/Qualifiers-in-multilevel-pointers
102
103Therefore, we introduce the DBVCPX_t typedefs, where 'X' is 1, 2 or 3, to
104indicate the number of levels in the array the Silo library is expecting the
105caller to pass. Even though the typedef resolves to a 'void const *' for all
106X, the underlying implementation will wind up treating it as a 'void const *' for
107X=1 (e.g. DBVCP1_t), a 'void const * const *' for X=2 (e.g. DBVCP2_t), etc.
108
109*/
110
111/* For the char-specific case of a constant array of strings, to facilitate explicit casts */
112typedef char const * const *         DBCAS_t;
113
114#ifndef FALSE
115#define FALSE   0
116#endif
117#ifndef TRUE
118#define TRUE    1
119#endif
120
121/* Major release number of silo library. */
122#define _SILO_VERS_MAJ_@SILO_VERS_MAJ@
123#ifdef _SILO_VERS_MAJ_
124#define SILO_VERS_MAJ 0 /* NO_FORTRAN_DEFINE */
125#else
126#define SILO_VERS_MAJ @SILO_VERS_MAJ@
127#endif
128
129/* Minor release number of silo library. Can be empty. */
130#define _SILO_VERS_MIN_@SILO_VERS_MIN@
131#ifdef _SILO_VERS_MIN_
132#define SILO_VERS_MIN 0 /* NO_FORTRAN_DEFINE */
133#else
134#define SILO_VERS_MIN @SILO_VERS_MIN@
135#endif
136
137/* Patch release number of silo library.  Can be empty. */
138#define _SILO_VERS_PAT_@SILO_VERS_PAT@
139#ifdef _SILO_VERS_PAT_
140#define SILO_VERS_PAT 0 /* NO_FORTRAN_DEFINE */
141#else
142#define SILO_VERS_PAT @SILO_VERS_PAT@
143#endif
144
145/* Pre-release release number of silo library.  Can be empty. */
146#define _SILO_VERS_PRE_@SILO_VERS_PRE@
147#ifdef _SILO_VERS_PRE_
148#define SILO_VERS_PRE 0 /* NO_FORTRAN_DEFINE */
149#else
150#define SILO_VERS_PRE @SILO_VERS_PRE@
151#endif
152
153/* The symbol Silo uses to enforce link-time
154   header/object version compatibility */
155#define SILO_VERS_TAG @SILO_VERS_TAG@
156
157/* Useful macro for comparing Silo versions (and DB_ alias) */
158#define SILO_VERSION_GE(Maj,Min,Pat)  \
159        (((SILO_VERS_MAJ==Maj) && (SILO_VERS_MIN==Min) && (SILO_VERS_PAT>=Pat)) || \
160         ((SILO_VERS_MAJ==Maj) && (SILO_VERS_MIN>Min)) || \
161         (SILO_VERS_MAJ>Maj))
162#define DB_VERSION_GE(Maj,Min,Pat) SILO_VERSION_GE(Maj,Min,Pat)
163
164/*-------------------------------------------------------------------------
165 * Drivers.  This is a list of every driver that a user could use.  Not all of
166 * them are necessarily compiled into the library.  However, users are free
167 * to try without getting compilation errors.  They are listed here so that
168 * silo.h doesn't have to be generated every time the library is recompiled.
169 *--------------------------------------------------------------------------*/
170#define DB_NETCDF 0
171#define DB_PDB 2 /* PDB Lite */
172#define DB_TAURUS 3
173#define DB_UNKNOWN 5
174#define DB_DEBUG 6
175#define DB_HDF5X 7
176#define DB_PDBP 1 /* PDB Proper */
177
178/* DO NOT USE. Obsoleted ways of specifying different HDF5 vfds */
179#define DB_HDF5_SEC2_OBSOLETE 0x100
180#define DB_HDF5_STDIO_OBSOLETE 0x200
181#define DB_HDF5_CORE_OBSOLETE 0x300
182#define DB_HDF5_MPIO_OBSOLETE 0x400
183#define DB_HDF5_MPIOP_OBSOLETE 0x500
184
185/* symbols for various HDF5 vfds */
186#define DB_H5VFD_DEFAULT 0
187#define DB_H5VFD_SEC2    1
188#define DB_H5VFD_STDIO   2
189#define DB_H5VFD_CORE    3
190#define DB_H5VFD_LOG     4
191#define DB_H5VFD_SPLIT   5
192#define DB_H5VFD_DIRECT  6
193#define DB_H5VFD_FAMILY  7
194#define DB_H5VFD_MPIO    8
195#define DB_H5VFD_MPIP    9
196#define DB_H5VFD_SILO    10
197#define DB_H5VFD_FIC     11 /* File Image in Core */
198
199/* Macro for defining various HDF5 vfds as 'type' arg in create/open.
200   The 11 bit shift is to avoid possible collision with older versions
201   of Silo header file where VFDs where specified in bits 8-11. Their
202   obsoleted values are listed above. */
203#define DB_HDF5_OPTS(OptsId) (DB_HDF5X|((OptsId&0x3F)<<11))
204
205/* Monikers for default file options sets */
206/* We just make the default options sets the same as the vfd is */
207#define DB_FILE_OPTS_H5_DEFAULT_DEFAULT DB_H5VFD_DEFAULT
208#define DB_FILE_OPTS_H5_DEFAULT_SEC2    DB_H5VFD_SEC2
209#define DB_FILE_OPTS_H5_DEFAULT_STDIO   DB_H5VFD_STDIO
210#define DB_FILE_OPTS_H5_DEFAULT_CORE    DB_H5VFD_CORE
211#define DB_FILE_OPTS_H5_DEFAULT_LOG     DB_H5VFD_LOG
212#define DB_FILE_OPTS_H5_DEFAULT_SPLIT   DB_H5VFD_SPLIT
213#define DB_FILE_OPTS_H5_DEFAULT_DIRECT  DB_H5VFD_DIRECT
214#define DB_FILE_OPTS_H5_DEFAULT_FAMILY  DB_H5VFD_FAMILY
215#define DB_FILE_OPTS_H5_DEFAULT_MPIO    DB_H5VFD_MPIO
216#define DB_FILE_OPTS_H5_DEFAULT_MPIP    DB_H5VFD_MPIP
217#define DB_FILE_OPTS_H5_DEFAULT_SILO    DB_H5VFD_SILO
218#define DB_FILE_OPTS_LAST DB_FILE_OPTS_H5_DEFAULT_SILO
219/* note: no possible *default* settings for DB_H5VFD_FIC */
220
221/* Various default HDF5 driver options. Users can define their own
222   sets of options using DBRegisterFileOptionsSets(). */
223#define DB_HDF5 DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_DEFAULT)
224#define DB_HDF5_SEC2 DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_SEC2)
225#define DB_HDF5_STDIO DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_STDIO)
226#define DB_HDF5_CORE DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_CORE)
227#define DB_HDF5_LOG DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_LOG)
228#define DB_HDF5_SPLIT DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_SPLIT)
229#define DB_HDF5_DIRECT DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_DIRECT)
230#define DB_HDF5_FAMILY DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_FAMILY)
231#define DB_HDF5_MPIO DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_MPIO)
232#define DB_HDF5_MPIOP DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_MPIP)
233#define DB_HDF5_MPIP DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_MPIP)
234#define DB_HDF5_SILO DB_HDF5_OPTS(DB_FILE_OPTS_H5_DEFAULT_SILO)
235
236/*-------------------------------------------------------------------------
237 * Other library-wide constants.
238 *-------------------------------------------------------------------------*/
239#define DB_NFILES       256         /*Max simultaneously open files */
240#define DB_NFILTERS     32          /*Number of filters defined */
241
242/*-------------------------------------------------------------------------
243 * Constants.  All of these constants are always defined in the application.
244 * Each group of constants defined here are small integers used as an index
245 * into an array.  Many of the groups have a total count of items in the
246 * group that will be used for array allocation and error checking--don't
247 * forget to increment the value when adding a new item to a constant group.
248 *-------------------------------------------------------------------------
249 */
250
251/* The following identifiers are for use with the DBDataReadMask() call.  They
252 * specify what portions of the data beyond the metadata is allocated
253 * and read.  Note that since these values are only necessary when reading
254 * and since the Fortran interface is primarily a write interface, it is not
255 * necessary for these symbols to appear in the silo.inc file. However, the
256 * reason they DO NOT APPEAR there inspite of the fact that DO NOT HAVE the
257 * 'NO_FORTRAN_DEFINE' text appearing on each line is that the mkinc script
258 * requires an underscore in the symbol name for it to appear in silo.inc. */
259#define DBAll                     0xffffffffffffffffULL
260#define DBNone                    0x0000000000000000ULL
261#define DBCalc                    0x0000000000000001ULL
262#define DBMatMatnos               0x0000000000000002ULL
263#define DBMatMatlist              0x0000000000000004ULL
264#define DBMatMixList              0x0000000000000008ULL
265#define DBCurveArrays             0x0000000000000010ULL
266#define DBPMCoords                0x0000000000000020ULL
267#define DBPVData                  0x0000000000000040ULL
268#define DBQMCoords                0x0000000000000080ULL
269#define DBQVData                  0x0000000000000100ULL
270#define DBUMCoords                0x0000000000000200ULL
271#define DBUMFacelist              0x0000000000000400ULL
272#define DBUMZonelist              0x0000000000000800ULL
273#define DBUVData                  0x0000000000001000ULL
274#define DBFacelistInfo            0x0000000000002000ULL
275#define DBZonelistInfo            0x0000000000004000ULL
276#define DBMatMatnames             0x0000000000008000ULL
277#define DBUMGlobNodeNo            0x0000000000010000ULL
278#define DBZonelistGlobZoneNo      0x0000000000020000ULL
279#define DBMatMatcolors            0x0000000000040000ULL
280#define DBCSGMBoundaryInfo        0x0000000000080000ULL
281#define DBCSGMZonelist            0x0000000000100000ULL
282#define DBCSGMBoundaryNames       0x0000000000200000ULL
283#define DBCSGVData                0x0000000000400000ULL
284#define DBCSGZonelistZoneNames    0x0000000000800000ULL
285#define DBCSGZonelistRegNames     0x0000000001000000ULL
286#define DBMMADJNodelists          0x0000000002000000ULL
287#define DBMMADJZonelists          0x0000000004000000ULL
288#define DBPMGlobNodeNo            0x0000000008000000ULL
289#define DBPMGhostNodeLabels       0x0000000010000000ULL
290#define DBQMGhostNodeLabels       0x0000000020000000ULL
291#define DBQMGhostZoneLabels       0x0000000040000000ULL
292#define DBUMGhostNodeLabels       0x0000000080000000ULL
293#define DBZonelistGhostZoneLabels 0x0000000100000000ULL
294
295/* Definitions for COORD_TYPE */
296/* Placed before DBObjectType enum because the
297   DB_QUAD_CURV and DB_QUAD_RECT symbols are
298   sometimes used as DBObjectType */
299
300#define  DB_COLLINEAR           130
301#define  DB_NONCOLLINEAR        131
302#define  DB_QUAD_RECT           DB_COLLINEAR
303#define  DB_QUAD_CURV           DB_NONCOLLINEAR
304
305#ifdef __cplusplus
306extern "C" {
307#endif
308
309/* Objects that can be stored in a data file */
310typedef enum {
311    DB_INVALID_OBJECT= -1,       /*causes enum to be signed, do not remove,
312                                   space before minus sign necessary for lint*/
313    DB_QUADRECT = DB_QUAD_RECT,
314    DB_QUADCURV = DB_QUAD_CURV,
315    DB_QUADMESH=500,
316    DB_QUADVAR=501,
317    DB_UCDMESH=510,
318    DB_UCDVAR=511,
319    DB_MULTIMESH=520,
320    DB_MULTIVAR=521,
321    DB_MULTIMAT=522,
322    DB_MULTIMATSPECIES=523,
323    DB_MULTIBLOCKMESH=DB_MULTIMESH,
324    DB_MULTIBLOCKVAR=DB_MULTIVAR,
325    DB_MULTIMESHADJ=524,
326    DB_MATERIAL=530,
327    DB_MATSPECIES=531,
328    DB_FACELIST=550,
329    DB_ZONELIST=551,
330    DB_EDGELIST=552,
331    DB_PHZONELIST=553,
332    DB_CSGZONELIST=554,
333    DB_CSGMESH=555,
334    DB_CSGVAR=556,
335    DB_CURVE=560,
336    DB_DEFVARS=565,
337    DB_POINTMESH=570,
338    DB_POINTVAR=571,
339    DB_ARRAY=580,
340    DB_DIR=600,
341    DB_VARIABLE=610,
342    DB_MRGTREE=611,
343    DB_GROUPELMAP=612,
344    DB_MRGVAR=613,
345    DB_USERDEF=700
346} DBObjectType;
347
348/* Data types */
349typedef enum {
350    DB_INT=16,
351    DB_SHORT=17,
352    DB_LONG=18,
353    DB_FLOAT=19,
354    DB_DOUBLE=20,
355    DB_CHAR=21,
356    DB_LONG_LONG=22,
357    DB_NOTYPE=25           /*unknown type */
358} DBdatatype;
359
360/* Flags for DBCreate */
361#define         DB_CLOBBER      0
362#define         DB_NOCLOBBER    1
363
364/* Flags for DBOpen */
365#define         DB_READ         1
366#define         DB_APPEND       2
367
368/* Target machine for DBCreate */
369#define         DB_LOCAL        0
370#define         DB_SUN3         10
371#define         DB_SUN4         11
372#define         DB_SGI          12
373#define         DB_RS6000       13
374#define         DB_CRAY         14
375#define         DB_INTEL        15
376
377/* Options */
378#define DBOPT_FIRST             260
379#define DBOPT_ALIGN             260
380#define DBOPT_COORDSYS          262
381#define DBOPT_CYCLE             263
382#define DBOPT_FACETYPE          264
383#define DBOPT_HI_OFFSET         265
384#define DBOPT_LO_OFFSET         266
385#define DBOPT_LABEL             267
386#define DBOPT_XLABEL            268
387#define DBOPT_YLABEL            269
388#define DBOPT_ZLABEL            270
389#define DBOPT_MAJORORDER        271
390#define DBOPT_NSPACE            272
391#define DBOPT_ORIGIN            273
392#define DBOPT_PLANAR            274
393#define DBOPT_TIME              275
394#define DBOPT_UNITS             276
395#define DBOPT_XUNITS            277
396#define DBOPT_YUNITS            278
397#define DBOPT_ZUNITS            279
398#define DBOPT_DTIME             280
399#define DBOPT_USESPECMF         281
400#define DBOPT_XVARNAME          282
401#define DBOPT_YVARNAME          283
402#define DBOPT_ZVARNAME          284
403#define DBOPT_ASCII_LABEL       285
404#define DBOPT_MATNOS            286
405#define DBOPT_NMATNOS           287
406#define DBOPT_MATNAME           288
407#define DBOPT_NMAT              289
408#define DBOPT_NMATSPEC          290
409#define DBOPT_BASEINDEX         291 /* quad meshes for node and zone */
410#define DBOPT_ZONENUM           292 /* ucd meshes for zone */
411#define DBOPT_NODENUM           293 /* ucd/point meshes for node */
412#define DBOPT_BLOCKORIGIN       294
413#define DBOPT_GROUPNUM          295
414#define DBOPT_GROUPORIGIN       296
415#define DBOPT_NGROUPS           297
416#define DBOPT_MATNAMES          298
417#define DBOPT_EXTENTS_SIZE      299
418#define DBOPT_EXTENTS           300
419#define DBOPT_MATCOUNTS         301
420#define DBOPT_MATLISTS          302
421#define DBOPT_MIXLENS           303
422#define DBOPT_ZONECOUNTS        304
423#define DBOPT_HAS_EXTERNAL_ZONES 305
424#define DBOPT_PHZONELIST        306
425#define DBOPT_MATCOLORS         307
426#define DBOPT_BNDNAMES          308
427#define DBOPT_REGNAMES          309
428#define DBOPT_ZONENAMES         310
429#define DBOPT_HIDE_FROM_GUI     311
430#define DBOPT_TOPO_DIM          312 /* TOPOlogical DIMension */
431#define DBOPT_REFERENCE         313 /* reference object */
432#define DBOPT_GROUPINGS_SIZE    314 /* size of grouping array */
433#define DBOPT_GROUPINGS         315 /* groupings array */
434#define DBOPT_GROUPINGNAMES     316 /* array of size determined by
435                                       number of groups of names of groups. */
436#define DBOPT_ALLOWMAT0         317 /* Turn off material numer "0" warnings*/
437#define DBOPT_MRGTREE_NAME      318
438#define DBOPT_REGION_PNAMES     319
439#define DBOPT_TENSOR_RANK       320
440#define DBOPT_MMESH_NAME        321
441#define DBOPT_TV_CONNECTIVITY   322
442#define DBOPT_DISJOINT_MODE     323
443#define DBOPT_MRGV_ONAMES       324
444#define DBOPT_MRGV_RNAMES       325
445#define DBOPT_SPECNAMES         326
446#define DBOPT_SPECCOLORS        327
447#define DBOPT_LLONGNZNUM        328
448#define DBOPT_CONSERVED         329
449#define DBOPT_EXTENSIVE         330
450#define DBOPT_MB_FILE_NS        331
451#define DBOPT_MB_BLOCK_NS       332
452#define DBOPT_MB_BLOCK_TYPE     333
453#define DBOPT_MB_EMPTY_LIST     334
454#define DBOPT_MB_EMPTY_COUNT    335
455#define DBOPT_MB_REPR_BLOCK_IDX 336
456#define DBOPT_MISSING_VALUE     337
457#define DBOPT_ALT_ZONENUM_VARS  338
458#define DBOPT_ALT_NODENUM_VARS  339
459#define DBOPT_GHOST_NODE_LABELS 340
460#define DBOPT_GHOST_ZONE_LABELS 341
461#define DBOPT_LAST              499
462
463/* Options relating to virtual file drivers */
464#define DBOPT_H5_FIRST              500
465#define DBOPT_H5_VFD                500
466#define DBOPT_H5_RAW_FILE_OPTS      501
467#define DBOPT_H5_RAW_EXTENSION      502
468#define DBOPT_H5_META_FILE_OPTS     503
469#define DBOPT_H5_META_EXTENSION     504
470#define DBOPT_H5_CORE_ALLOC_INC     505
471#define DBOPT_H5_CORE_NO_BACK_STORE 506
472#define DBOPT_H5_META_BLOCK_SIZE    507
473#define DBOPT_H5_SMALL_RAW_SIZE     508
474#define DBOPT_H5_ALIGN_MIN          509
475#define DBOPT_H5_ALIGN_VAL          510
476#define DBOPT_H5_DIRECT_MEM_ALIGN   511
477#define DBOPT_H5_DIRECT_BLOCK_SIZE  512
478#define DBOPT_H5_DIRECT_BUF_SIZE    513
479#define DBOPT_H5_LOG_NAME           514
480#define DBOPT_H5_LOG_BUF_SIZE       515
481#define DBOPT_H5_MPIO_COMM          516
482#define DBOPT_H5_MPIO_INFO          517
483#define DBOPT_H5_MPIP_NO_GPFS_HINTS 518
484#define DBOPT_H5_SIEVE_BUF_SIZE     519
485#define DBOPT_H5_CACHE_NELMTS       520
486#define DBOPT_H5_CACHE_NBYTES       521
487#define DBOPT_H5_CACHE_POLICY       522
488#define DBOPT_H5_FAM_SIZE           523
489#define DBOPT_H5_FAM_FILE_OPTS      524
490#define DBOPT_H5_USER_DRIVER_ID     525
491#define DBOPT_H5_USER_DRIVER_INFO   526
492#define DBOPT_H5_SILO_BLOCK_SIZE    527
493#define DBOPT_H5_SILO_BLOCK_COUNT   528
494#define DBOPT_H5_SILO_LOG_STATS     529
495#define DBOPT_H5_SILO_USE_DIRECT    530
496#define DBOPT_H5_FIC_SIZE           531
497#define DBOPT_H5_FIC_BUF            532
498#define DBOPT_H5_LAST               599
499
500/* Error trapping method */
501#define         DB_TOP          0 /*default--API traps  */
502#define         DB_NONE         1 /*no errors trapped  */
503#define         DB_ALL          2 /*all levels trap (traceback) */
504#define         DB_ABORT        3 /*abort() is called  */
505#define         DB_SUSPEND      4 /*suspend error reporting temporarily */
506#define         DB_RESUME       5 /*resume normal error reporting */
507#define         DB_ALL_AND_DRVR 6 /*DB_ALL + driver error reporting */
508
509/* Errors */
510#define     E_NOERROR   0       /*No error   */
511#define     E_BADFTYPE  1       /*Bad file type   */
512#define     E_NOTIMP    2       /*Callback not implemented */
513#define     E_NOFILE    3       /*No data file specified    */
514#define     E_INTERNAL  5       /*Internal error        */
515#define     E_NOMEM     6       /*Not enough memory     */
516#define     E_BADARGS   7       /*Bad argument to function  */
517#define     E_CALLFAIL  8       /*Low-level function failure    */
518#define     E_NOTFOUND  9       /*Object not found      */
519#define     E_TAURSTATE 10      /*Taurus: database state error  */
520#define     E_MSERVER   11      /*SDX: too many connections */
521#define     E_PROTO     12      /*SDX: protocol error       */
522#define     E_NOTDIR    13      /*Not a directory       */
523#define     E_MAXOPEN   14      /*Too many open files  */
524#define     E_NOTFILTER 15      /*Filter(s) not found  */
525#define     E_MAXFILTERS    16  /*Too many filters  */
526#define     E_FEXIST    17      /*File already exists  */
527#define     E_FILEISDIR 18      /*File is actually a directory */
528#define     E_FILENOREAD    19  /*File lacks read permission. */
529#define     E_SYSTEMERR 20      /*System level error occured. */
530#define     E_FILENOWRITE 21    /*File lacks write permission. */
531#define     E_INVALIDNAME 22    /* Variable name is invalid */
532#define     E_NOOVERWRITE 23    /*Overwrite not permitted */
533#define     E_CHECKSUM  24      /*Checksum failed */
534#define     E_COMPRESSION  25   /*Compression failed */
535#define     E_GRABBED   26      /*Low level driver enabled */
536#define     E_NOTREG    27      /*The dbfile pointer is not resitered. */
537#define     E_CONCURRENT 28     /*File is opened multiply and not all read-only. */
538#define     E_DRVRCANTOPEN 29   /*Driver cannot open the file. */
539#define     E_BADOPTCLASS 30    /*Optlist contains options for wrong class */
540#define     E_NOTENABLEDINBUILD 31 /*feature not enabled in this build */
541#define     E_MAXFILEOPTSETS 32 /*Too many file options sets */
542#define     E_NOHDF5 33         /*HDF5 driver not available */
543#define     E_EMPTYOBJECT 34    /*Empty object not currently permitted*/
544#define     E_OBJBUFFULL  35    /*No more temp. buffer space for object */
545#define     E_NERRORS   50
546
547/* Definitions for MAJOR_ORDER */
548#define  DB_ROWMAJOR            0
549#define  DB_COLMAJOR            1
550
551/* Definitions for CENTERING */
552#define  DB_NOTCENT             0
553#define  DB_NODECENT            110
554#define  DB_ZONECENT            111
555#define  DB_FACECENT            112
556#define  DB_BNDCENT             113 /* for CSG meshes only */
557#define  DB_EDGECENT            114
558#define  DB_BLOCKCENT           115 /* for 'block-centered' data on multimeshs */
559
560/* Definitions for COORD_SYSTEM */
561#define  DB_CARTESIAN           120
562#define  DB_CYLINDRICAL         121 /* x,r;  y,theta;  z,height; 2D variant is eqiv. to poloar */
563#define  DB_SPHERICAL           122 /* x,r;  y,theta;  z,phi;  2D variant is equiv. to polar */
564#define  DB_NUMERICAL           123
565#define  DB_OTHER               124
566
567/* Definitions for ZONE FACE_TYPE */
568#define  DB_RECTILINEAR         100
569#define  DB_CURVILINEAR         101
570
571/* Definitions for PLANAR */
572#define  DB_AREA                140
573#define  DB_VOLUME              141
574
575/* Definitions for flag values */
576#define DB_ON                    1000
577#define DB_OFF                  -1000
578
579/* Definitions for disjoint flag */
580#define DB_ABUTTING              142
581#define DB_FLOATING              143
582
583/* Definitions for derived variable types */
584#define DB_VARTYPE_SCALAR               200
585#define DB_VARTYPE_VECTOR               201
586#define DB_VARTYPE_TENSOR               202
587#define DB_VARTYPE_SYMTENSOR            203
588#define DB_VARTYPE_ARRAY                204
589#define DB_VARTYPE_MATERIAL             205
590#define DB_VARTYPE_SPECIES              206
591#define DB_VARTYPE_LABEL                207
592
593/* Definitions for ghost labels */
594#define DB_GHOSTTYPE_NOGHOST ((char)0x00)
595#define DB_GHOSTTYPE_INTDUP ((char)0x01)
596
597/* Definitions for CSG boundary types
598   Designed so low-order 16 bits are unused.
599
600   The last few characters of the symbol are intended
601   to indicate the representational form of the surface type
602
603   G = generalized form  (n values, depends on surface type)
604   P = point (3 values, x,y,z in 3D, 2 values in 2D x,y)
605   N = normal (3 values, Nx,Ny,Nz in 3D, 2 values in 2D Nx,Ny)
606   R = radius (1 value)
607   A = angle (1 value in degrees)
608   L = length (1 value)
609   X = x-intercept (1 value)
610   Y = y-intercept (1 value)
611   Z = z-intercept (1 value)
612   K = arbitrary integer
613   F = planar face defined by point-normal pair (6 values)
614   */
615#define DBCSG_QUADRIC_G         0x01000000
616#define DBCSG_SPHERE_PR         0x02010000
617#define DBCSG_ELLIPSOID_PRRR    0x02020000
618#define DBCSG_PLANE_G           0x03000000
619#define DBCSG_PLANE_X           0x03010000
620#define DBCSG_PLANE_Y           0x03020000
621#define DBCSG_PLANE_Z           0x03030000
622#define DBCSG_PLANE_PN          0x03040000
623#define DBCSG_PLANE_PPP         0x03050000
624#define DBCSG_CYLINDER_PNLR     0x04000000
625#define DBCSG_CYLINDER_PPR      0x04010000
626#define DBCSG_BOX_XYZXYZ        0x05000000
627#define DBCSG_CONE_PNLA         0x06000000
628#define DBCSG_CONE_PPA          0x06010000
629#define DBCSG_POLYHEDRON_KF     0x07000000
630#define DBCSG_HEX_6F            0x07010000
631#define DBCSG_TET_4F            0x07020000
632#define DBCSG_PYRAMID_5F        0x07030000
633#define DBCSG_PRISM_5F          0x07040000
634
635/* Definitions for 2D CSG boundary types */
636#define DBCSG_QUADRATIC_G       0x08000000
637#define DBCSG_CIRCLE_PR         0x09000000
638#define DBCSG_ELLIPSE_PRR       0x09010000
639#define DBCSG_LINE_G            0x0A000000
640#define DBCSG_LINE_X            0x0A010000
641#define DBCSG_LINE_Y            0x0A020000
642#define DBCSG_LINE_PN           0x0A030000
643#define DBCSG_LINE_PP           0x0A040000
644#define DBCSG_BOX_XYXY          0x0B000000
645#define DBCSG_ANGLE_PNLA        0x0C000000
646#define DBCSG_ANGLE_PPA         0x0C010000
647#define DBCSG_POLYGON_KP        0x0D000000
648#define DBCSG_TRI_3P            0x0D010000
649#define DBCSG_QUAD_4P           0x0D020000
650
651/* Definitions for CSG Region operators */
652#define DBCSG_INNER             0x7F000000
653#define DBCSG_OUTER             0x7F010000
654#define DBCSG_ON                0x7F020000
655#define DBCSG_UNION             0x7F030000
656#define DBCSG_INTERSECT         0x7F040000
657#define DBCSG_DIFF              0x7F050000
658#define DBCSG_COMPLIMENT        0x7F060000
659#define DBCSG_XFORM             0x7F070000
660#define DBCSG_SWEEP             0x7F080000
661
662/* definitions for MRG Tree traversal flags */
663#define DB_PREORDER             0x00000001
664#define DB_POSTORDER            0x00000002
665#define DB_FROMCWR              0x00000004
666
667/* Miscellaneous constants */
668#define     DB_F77NULL  (-99)   /*Fortran NULL pointer      */
669#define     DB_F77NULLSTRING  "NULLSTRING"  /* FORTRAN STRING */
670
671/*-------------------------------------------------------------------------
672 * Index selection macros
673 *-------------------------------------------------------------------------
674 */
675#define I4D(s,i,j,k,l) (l)*s[3]+(k)*s[2]+(j)*s[1]+(i)*s[0]
676#define I3D(s,i,j,k)   (k)*s[2]+(j)*s[1]+(i)*s[0]
677#define I2D(s,i,j)     (j)*s[1]+(i)*s[0]
678
679/* Note we should not use MAX_DOUBLE here as its definition could be different
680   from one machine to the next. We need something that is a constant across
681   all machines we will operate on. And, yes, it means this particular number
682   cannot be used for any real data values or for the missing data value. I
683   think the risk of problems is minimal. Also, we want a zero in the file
684   to represent the fact that a missing value is NOT SET. Nonetheless, we
685   want Silo clients to be able to specify that zero represents the missing
686   value. So, we adjust the interpretation of missing values on write and
687   on read to/from the file. On write, NOT_SET in mem gets mapped to zero in
688   the file and zero in mem gets mapped to NOT_SET in the file. On read, this
689   mapping is reversed. */
690#define DB_MISSING_VALUE_NOT_SET ((double)1.0e+308)
691
692/*-------------------------------------------------------------------------
693 * Structures (just the public parts).
694 *-------------------------------------------------------------------------
695 */
696
697/*
698 * Database table of contents for the current directory only.
699 */
700typedef struct DBtoc_ {
701
702    char         **curve_names;
703    int            ncurve;
704
705    char         **multimesh_names;
706    int            nmultimesh;
707
708    char         **multimeshadj_names;
709    int            nmultimeshadj;
710
711    char         **multivar_names;
712    int            nmultivar;
713
714    char         **multimat_names;
715    int            nmultimat;
716
717    char         **multimatspecies_names;
718    int            nmultimatspecies;
719
720    char         **csgmesh_names;
721    int            ncsgmesh;
722
723    char         **csgvar_names;
724    int            ncsgvar;
725
726    char         **defvars_names;
727    int            ndefvars;
728
729    char         **qmesh_names;
730    int            nqmesh;
731
732    char         **qvar_names;
733    int            nqvar;
734
735    char         **ucdmesh_names;
736    int            nucdmesh;
737
738    char         **ucdvar_names;
739    int            nucdvar;
740
741    char         **ptmesh_names;
742    int            nptmesh;
743
744    char         **ptvar_names;
745    int            nptvar;
746
747    char         **mat_names;
748    int            nmat;
749
750    char         **matspecies_names;
751    int            nmatspecies;
752
753    char         **var_names;
754    int            nvar;
755
756    char         **obj_names;
757    int            nobj;
758
759    char         **dir_names;
760    int            ndir;
761
762    char         **array_names;
763    int            narray;
764
765    char         **mrgtree_names;
766    int            nmrgtree;
767
768    char         **groupelmap_names;
769    int            ngroupelmap;
770
771    char         **mrgvar_names;
772    int            nmrgvar;
773
774} DBtoc;
775
776/*----------------------------------------------------------------------------
777 * Database Curve Object
778 *--------------------------------------------------------------------------
779 */
780typedef struct DBcurve_ {
781/*----------- X vs. Y (Curve) Data -----------*/
782    int            id;          /* Identifier for this object */
783    int            datatype;    /* Datatype for x and y (float, double) */
784    int            origin;      /* '0' or '1' */
785    char          *title;       /* Title for curve */
786    char          *xvarname;    /* Name of domain (x) variable */
787    char          *yvarname;    /* Name of range  (y) variable */
788    char          *xlabel;      /* Label for x-axis */
789    char          *ylabel;      /* Label for y-axis */
790    char          *xunits;      /* Units for domain */
791    char          *yunits;      /* Units for range  */
792    void          *x;           /* Domain values for curve */
793    void          *y;           /* Range  values for curve */
794    int            npts;        /* Number of points in curve */
795    int            guihide;     /* Flag to hide from post-processor's GUI */
796    char          *reference;   /* Label to reference object */
797    int            coord_sys;   /* To indicate other coordinate systems */
798    double         missing_value; /* Value to indicate var data is invalid/missing */
799} DBcurve;
800
801typedef struct DBdefvars_ {
802    int            ndefs;       /* number of definitions */
803    char         **names;       /* [ndefs] derived variable names */
804    int           *types;       /* [ndefs] derived variable types */
805    char         **defns;       /* [ndefs] derived variable definitions */
806    int        *guihides;       /* [ndefs] flags to hide from
807                                   post-processor's GUI */
808} DBdefvars;
809
810typedef struct DBpointmesh_ {
811/*----------- Point Mesh -----------*/
812    int            id;          /* Identifier for this object */
813    int            block_no;    /* Block number for this mesh */
814    int            group_no;    /* Block group number for this mesh */
815    char          *name;        /* Name associated with this mesh */
816    int            cycle;       /* Problem cycle number */
817    char          *units[3];    /* Units for each axis */
818    char          *labels[3];   /* Labels for each axis */
819    char          *title;       /* Title for curve */
820
821    void          *coords[3];   /* Coordinate values */
822    float          time;        /* Problem time */
823    double         dtime;       /* Problem time, double data type */
824   /*
825    * The following two fields really only contain 3 elements.  However, silo
826    * contains a bug in PJ_ReadVariable() as called by DBGetPointmesh() which
827    * can cause three doubles to be stored there instead of three floats.
828    */
829    float          min_extents[6];  /* Min mesh extents [ndims] */
830    float          max_extents[6];  /* Max mesh extents [ndims] */
831
832    int            datatype;    /* Datatype for coords (float, double) */
833    int            ndims;       /* Number of computational dimensions */
834    int            nels;        /* Number of elements in mesh */
835    int            origin;      /* '0' or '1' */
836    int            guihide;     /* Flag to hide from post-processor's GUI */
837    void          *gnodeno;     /* global node ids */
838    char          *mrgtree_name; /* optional name of assoc. mrgtree object */
839    int            gnznodtype;  /* datatype for global node/zone ids */
840    char          *ghost_node_labels;
841    char         **alt_nodenum_vars;
842} DBpointmesh;
843
844/*----------------------------------------------------------------------------
845 * Multi-Block Mesh Object
846 *--------------------------------------------------------------------------
847 */
848typedef struct DBmultimesh_ {
849/*----------- Multi-Block Mesh -----------*/
850    int            id;          /* Identifier for this object */
851    int            nblocks;     /* Number of blocks in mesh */
852    int            ngroups;     /* Number of block groups in mesh */
853    int           *meshids;     /* Array of mesh-ids which comprise mesh */
854    char         **meshnames;   /* Array of mesh-names for meshids */
855    int           *meshtypes;   /* Array of mesh-type indicators [nblocks] */
856    int           *dirids;      /* Array of directory ID's which contain blk */
857    int            blockorigin; /* Origin (0 or 1) of block numbers */
858    int            grouporigin; /* Origin (0 or 1) of group numbers */
859    int            extentssize; /* size of each extent tuple */
860    double        *extents;     /* min/max extents of coords of each block */
861    int           *zonecounts;  /* array of zone counts for each block */
862    int           *has_external_zones;  /* external flags for each block */
863    int            guihide;     /* Flag to hide from post-processor's GUI */
864    int            lgroupings;  /* size of groupings array */
865    int            *groupings;  /* Array of mesh-ids, group-ids, and counts */
866    char          **groupnames; /* Array of group-names for groupings  */
867    char          *mrgtree_name;/* optional name of assoc. mrgtree object */
868    int            tv_connectivity;
869    int            disjoint_mode;
870    int            topo_dim;    /* Topological dimension; max of all blocks. */
871    char          *file_ns;     /* namescheme for files (in lieu of meshnames) */
872    char          *block_ns;    /* namescheme for block objects (in lieu of meshnames) */
873    int            block_type;  /* constant block type for all blocks (in lieu of meshtypes) */
874    int           *empty_list;  /* list of empty block #'s (option for namescheme) */
875    int            empty_cnt;   /* size of empty list */
876    int            repr_block_idx; /* index of a 'representative' block */
877    char         **alt_nodenum_vars;
878    char         **alt_zonenum_vars;
879    char          *meshnames_alloc; /* original alloc of meshnames as string list */
880} DBmultimesh;
881
882/*----------------------------------------------------------------------------
883 * Multi-Block Mesh Adjacency Object
884 *--------------------------------------------------------------------------
885 */
886typedef struct DBmultimeshadj_ {
887/*----------- Multi-Block Mesh Adjacency -----------*/
888    int            nblocks;     /* Number of blocks in mesh */
889    int            blockorigin; /* Origin (0 or 1) of block numbers */
890    int           *meshtypes;   /* Array of mesh-type indicators [nblocks] */
891    int           *nneighbors;  /* Array [nblocks] neighbor counts */
892
893    int           lneighbors;
894    int           *neighbors;   /* Array [lneighbors] neighbor block numbers */
895    int           *back;        /* Array [lneighbors] neighbor block back */
896
897    int            totlnodelists;
898    int           *lnodelists;  /* Array [lneighbors] of node counts shared */
899    int          **nodelists;   /* Array [lneighbors] nodelists shared */
900
901    int            totlzonelists;
902    int           *lzonelists;  /* Array [lneighbors] of zone counts adjacent */
903    int          **zonelists;   /* Array [lneighbors] zonelists adjacent */
904} DBmultimeshadj;
905
906/*----------------------------------------------------------------------------
907 * Multi-Block Variable Object
908 *--------------------------------------------------------------------------
909 */
910typedef struct DBmultivar_ {
911/*----------- Multi-Block Variable -----------*/
912    int            id;          /* Identifier for this object  */
913    int            nvars;       /* Number of variables   */
914    int            ngroups;     /* Number of block groups in mesh */
915    char         **varnames;    /* Variable names   */
916    int           *vartypes;    /* variable types   */
917    int            blockorigin; /* Origin (0 or 1) of block numbers */
918    int            grouporigin; /* Origin (0 or 1) of group numbers */
919    int            extentssize; /* size of each extent tuple */
920    double        *extents;     /* min/max extents of each block */
921    int            guihide;     /* Flag to hide from post-processor's GUI */
922    char         **region_pnames;
923    char          *mmesh_name;
924    int            tensor_rank;    /* DB_VARTYPE_XXX */
925    int            conserved;   /* indicates if the variable should be conserved
926                                   under various operations such as interp. */
927    int            extensive;   /* indicates if the variable reprsents an extensiv
928                                   physical property (as opposed to intensive) */
929    char          *file_ns;     /* namescheme for files (in lieu of meshnames) */
930    char          *block_ns;    /* namescheme for block objects (in lieu of meshnames) */
931    int            block_type;  /* constant block type for all blocks (in lieu of meshtypes) */
932    int           *empty_list;  /* list of empty block #'s (option for namescheme) */
933    int            empty_cnt;   /* size of empty list */
934    int            repr_block_idx; /* index of a 'representative' block */
935    double         missing_value; /* Value to indicate var data is invalid/missing */
936    char          *varnames_alloc; /* original alloc of varnames as string list */
937} DBmultivar;
938
939/*-------------------------------------------------------------------------
940 * Multi-material
941 *-------------------------------------------------------------------------
942 */
943typedef struct DBmultimat_ {
944    int            id;          /* Identifier for this object  */
945    int            nmats;       /* Number of materials   */
946    int            ngroups;     /* Number of block groups in mesh */
947    char         **matnames;    /* names of constiuent DBmaterial objects */
948    int            blockorigin; /* Origin (0 or 1) of block numbers */
949    int            grouporigin; /* Origin (0 or 1) of group numbers */
950    int           *mixlens;     /* array of mixlen values in each mat */
951    int           *matcounts;   /* counts of unique materials in each block */
952    int           *matlists;    /* list of materials in each block */
953    int            guihide;     /* Flag to hide from post-processor's GUI */
954    int            nmatnos;     /* global number of materials over all pieces */
955    int           *matnos;      /* global list of material numbers */
956    char         **matcolors;   /* optional colors for materials */
957    char         **material_names; /* optional names of the materials */
958    int            allowmat0;   /* Flag to allow material "0" */
959    char          *mmesh_name;
960    char          *file_ns;     /* namescheme for files (in lieu of meshnames) */
961    char          *block_ns;    /* namescheme for block objects (in lieu of meshnames) */
962    int           *empty_list;  /* list of empty block #'s (option for namescheme) */
963    int            empty_cnt;   /* size of empty list */
964    int            repr_block_idx; /* index of a 'representative' block */
965    char          *matnames_alloc; /* original alloc of matnames as string list */
966} DBmultimat;
967
968/*-------------------------------------------------------------------------
969 * Multi-species
970 *-------------------------------------------------------------------------
971 */
972typedef struct DBmultimatspecies_ {
973    int            id;          /* Identifier for this object  */
974    int            nspec;       /* Number of species   */
975    int            ngroups;     /* Number of block groups in mesh */
976    char         **specnames;   /* Species object names   */
977    int            blockorigin; /* Origin (0 or 1) of block numbers */
978    int            grouporigin; /* Origin (0 or 1) of group numbers */
979    int            guihide;     /* Flag to hide from post-processor's GUI */
980    int            nmat;        /* equiv. to nmatnos of a DBmultimat */
981    int           *nmatspec;    /* equiv. to matnos of a DBmultimat */
982    char         **species_names; /* optional names of the species */
983    char         **speccolors;  /* optional colors for species */
984    char          *file_ns;     /* namescheme for files (in lieu of meshnames) */
985    char          *block_ns;    /* namescheme for block objects (in lieu of meshnames) */
986    int           *empty_list;  /* list of empty block #'s (option for namescheme) */
987    int            empty_cnt;   /* size of empty list */
988    int            repr_block_idx; /* index of a 'representative' block */
989    char          *specnames_alloc; /* original alloc of matnames as string list */
990} DBmultimatspecies;
991
992/*----------------------------------------------------------------------
993 *  Definitions for the FaceList, ZoneList, and EdgeList structures
994 *  used for describing UCD meshes.
995 *----------------------------------------------------------------------
996 */
997
998#define DB_ZONETYPE_BEAM        10
999
1000#define DB_ZONETYPE_POLYGON     20
1001#define DB_ZONETYPE_TRIANGLE    23
1002#define DB_ZONETYPE_QUAD        24
1003
1004#define DB_ZONETYPE_POLYHEDRON  30
1005#define DB_ZONETYPE_TET         34
1006#define DB_ZONETYPE_PYRAMID     35
1007#define DB_ZONETYPE_PRISM       36
1008#define DB_ZONETYPE_HEX         38
1009
1010typedef struct DBzonelist_ {
1011    int            ndims;       /* Number of dimensions (2,3) */
1012    int            nzones;      /* Number of zones in list */
1013    int            nshapes;     /* Number of zone shapes */
1014    int           *shapecnt;    /* [nshapes] occurences of each shape */
1015    int           *shapesize;   /* [nshapes] Number of nodes per shape */
1016    int           *shapetype;   /* [nshapes] Type of shape */
1017    int           *nodelist;    /* Sequent lst of nodes which comprise zones */
1018    int            lnodelist;   /* Number of nodes in nodelist */
1019    int            origin;      /* '0' or '1' */
1020    int            min_index;   /* Index of first real zone */
1021    int            max_index;   /* Index of last real zone */
1022
1023/*--------- Optional zone attributes ---------*/
1024    int           *zoneno;      /* [nzones] zone number of each zone */
1025    void          *gzoneno;     /* [nzones] global zone number of each zone */
1026    int            gnznodtype;  /* datatype for global node/zone ids */
1027    char          *ghost_zone_labels;
1028    char         **alt_zonenum_vars;
1029} DBzonelist;
1030
1031typedef struct DBphzonelist_ {
1032    int            nfaces;      /* Number of faces in facelist (aka "facetable") */
1033    int           *nodecnt;     /* Count of nodes in each face */
1034    int            lnodelist;   /* Length of nodelist used to construct faces */
1035    int           *nodelist;    /* List of nodes used in all faces */
1036    char          *extface;     /* boolean flag indicating if a face is external */
1037    int            nzones;      /* Number of zones in this zonelist */
1038    int           *facecnt;     /* Count of faces in each zone */
1039    int            lfacelist;   /* Length of facelist used to construct zones */
1040    int           *facelist;    /* List of faces used in all zones */
1041    int            origin;      /* '0' or '1' */
1042    int            lo_offset;   /* Index of first non-ghost zone */
1043    int            hi_offset;   /* Index of last non-ghost zone */
1044
1045/*--------- Optional zone attributes ---------*/
1046    int           *zoneno;      /* [nzones] zone number of each zone */
1047    void          *gzoneno;     /* [nzones] global zone number of each zone */
1048    int            gnznodtype;  /* datatype for global node/zone ids */
1049    char          *ghost_zone_labels;
1050    char         **alt_zonenum_vars;
1051} DBphzonelist;
1052
1053typedef struct DBfacelist_ {
1054/*----------- Required components ------------*/
1055    int            ndims;       /* Number of dimensions (2,3) */
1056    int            nfaces;      /* Number of faces in list */
1057    int            origin;      /* '0' or '1' */
1058    int           *nodelist;    /* Sequent list of nodes comprise faces */
1059    int            lnodelist;   /* Number of nodes in nodelist */
1060
1061/*----------- 3D components ------------------*/
1062    int            nshapes;     /* Number of face shapes */
1063    int           *shapecnt;    /* [nshapes] Num of occurences of each shape */
1064    int           *shapesize;   /* [nshapes] Number of nodes per shape */
1065
1066/*----------- Optional type component---------*/
1067    int            ntypes;      /* Number of face types */
1068    int           *typelist;    /* [ntypes] Type ID for each type */
1069    int           *types;       /* [nfaces] Type info for each face */
1070
1071/*--------- Optional node attributes ---------*/
1072    int           *nodeno;      /* [lnodelist] node number of each node */
1073
1074/*----------- Optional zone-reference component---------*/
1075    int           *zoneno;      /* [nfaces] Zone number for each face */
1076} DBfacelist;
1077
1078typedef struct DBedgelist_ {
1079    int            ndims;       /* Number of dimensions (2,3) */
1080    int            nedges;      /* Number of edges */
1081    int           *edge_beg;    /* [nedges] */
1082    int           *edge_end;    /* [nedges] */
1083    int            origin;      /* '0' or '1' */
1084} DBedgelist;
1085
1086typedef struct DBquadmesh_ {
1087/*----------- Quad Mesh -----------*/
1088    int            id;          /* Identifier for this object */
1089    int            block_no;    /* Block number for this mesh */
1090    int            group_no;    /* Block group number for this mesh */
1091    char          *name;        /* Name associated with mesh */
1092    int            cycle;       /* Problem cycle number */
1093    int            coord_sys;   /* Cartesian, cylindrical, spherical */
1094    int            major_order; /* 1 indicates row-major for multi-d arrays */
1095    int            stride[3];   /* Offsets to adjacent elements  */
1096    int            coordtype;   /* Coord array type: collinear,
1097                                 * non-collinear */
1098    int            facetype;    /* Zone face type: rect, curv */
1099    int            planar;      /* Sentinel: zones represent area or volume? */
1100
1101    void          *coords[3];   /* Mesh node coordinate ptrs [ndims] */
1102    int            datatype;    /* Type of coordinate arrays (double,float) */
1103    float          time;        /* Problem time */
1104    double         dtime;       /* Problem time, double data type */
1105   /*
1106    * The following two fields really only contain 3 elements.  However, silo
1107    * contains a bug in PJ_ReadVariable() as called by DBGetQuadmesh() which
1108    * can cause three doubles to be stored there instead of three floats.
1109    */
1110    float          min_extents[6];  /* Min mesh extents [ndims] */
1111    float          max_extents[6];  /* Max mesh extents [ndims] */
1112
1113    char          *labels[3];   /* Label associated with each dimension */
1114    char          *units[3];    /* Units for variable, e.g, 'mm/ms' */
1115    int            ndims;       /* Number of computational dimensions */
1116    int            nspace;      /* Number of physical dimensions */
1117    int            nnodes;      /* Total number of nodes */
1118
1119    int            dims[3];     /* Number of nodes per dimension */
1120    int            origin;      /* '0' or '1' */
1121    int            min_index[3];   /* Index in each dimension of 1st
1122                                    * non-phoney */
1123    int            max_index[3];   /* Index in each dimension of last
1124                                    * non-phoney */
1125    int            base_index[3];  /* Lowest real i,j,k value for this block */
1126    int            start_index[3]; /* i,j,k values corresponding to original
1127                                    * mesh */
1128    int            size_index[3];  /* Number of nodes per dimension for
1129                                    * original mesh */
1130    int            guihide;     /* Flag to hide from post-processor's GUI */
1131    char          *mrgtree_name; /* optional name of assoc. mrgtree object */
1132    char          *ghost_node_labels;
1133    char          *ghost_zone_labels;
1134    char         **alt_nodenum_vars;
1135    char         **alt_zonenum_vars;
1136} DBquadmesh;
1137
1138typedef struct DBucdmesh_ {
1139/*----------- Unstructured Cell Data (UCD) Mesh -----------*/
1140    int            id;          /* Identifier for this object */
1141    int            block_no;    /* Block number for this mesh */
1142    int            group_no;    /* Block group number for this mesh */
1143    char          *name;        /* Name associated with mesh */
1144    int            cycle;       /* Problem cycle number */
1145    int            coord_sys;   /* Coordinate system */
1146    int            topo_dim;    /* Topological dimension. */
1147    char          *units[3];    /* Units for variable, e.g, 'mm/ms' */
1148    char          *labels[3];   /* Label associated with each dimension */
1149
1150    void          *coords[3];   /* Mesh node coordinates */
1151    int            datatype;    /* Type of coordinate arrays (double,float) */
1152    float          time;        /* Problem time */
1153    double         dtime;       /* Problem time, double data type */
1154   /*
1155    * The following two fields really only contain 3 elements.  However, silo
1156    * contains a bug in PJ_ReadVariable() as called by DBGetUcdmesh() which
1157    * can cause three doubles to be stored there instead of three floats.
1158    */
1159    float          min_extents[6];  /* Min mesh extents [ndims] */
1160    float          max_extents[6];  /* Max mesh extents [ndims] */
1161
1162    int            ndims;       /* Number of computational dimensions */
1163    int            nnodes;      /* Total number of nodes */
1164    int            origin;      /* '0' or '1' */
1165
1166    DBfacelist    *faces;       /* Data structure describing mesh faces */
1167    DBzonelist    *zones;       /* Data structure describing mesh zones */
1168    DBedgelist    *edges;       /* Data struct describing mesh edges
1169                                 * (option) */
1170
1171/*--------- Optional node attributes ---------*/
1172    void          *gnodeno;     /* [nnodes] global node number of each node */
1173
1174/*--------- Optional zone attributes ---------*/
1175    int           *nodeno;      /* [nnodes] node number of each node */
1176
1177/*--------- Optional polyhedral zonelist ---------*/
1178    DBphzonelist  *phzones;     /* Data structure describing mesh zones */
1179
1180    int            guihide;     /* Flag to hide from post-processor's GUI */
1181    char          *mrgtree_name; /* optional name of assoc. mrgtree object */
1182    int            tv_connectivity;
1183    int            disjoint_mode;
1184    int            gnznodtype;  /* datatype for global node/zone ids */
1185    char          *ghost_node_labels;
1186    char         **alt_nodenum_vars;
1187} DBucdmesh;
1188
1189/*----------------------------------------------------------------------------
1190 * Database Mesh-Variable Object
1191 *---------------------------------------------------------------------------
1192 */
1193typedef struct DBquadvar_ {
1194/*----------- Quad Variable -----------*/
1195    int            id;          /* Identifier for this object */
1196    char          *name;        /* Name of variable */
1197    char          *units;       /* Units for variable, e.g, 'mm/ms' */
1198    char          *label;       /* Label (perhaps for editing purposes) */
1199    int            cycle;       /* Problem cycle number */
1200    int            meshid;      /* Identifier for associated mesh (Deprecated Sep2005) */
1201
1202    void         **vals;        /* Array of pointers to data arrays */
1203    int            datatype;    /* Type of data pointed to by 'val' */
1204    int            nels;        /* Number of elements in each array */
1205    int            nvals;       /* Number of arrays pointed to by 'vals' */
1206    int            ndims;       /* Rank of variable */
1207    int            dims[3];     /* Number of elements in each dimension */
1208
1209    int            major_order; /* 1 indicates row-major for multi-d arrays */
1210    int            stride[3];   /* Offsets to adjacent elements  */
1211    int            min_index[3];  /* Index in each dimension of 1st
1212                                   * non-phoney */
1213    int            max_index[3];  /* Index in each dimension of last
1214                                   * non-phoney */
1215    int            origin;      /* '0' or '1' */
1216    float          time;        /* Problem time */
1217    double         dtime;       /* Problem time, double data type */
1218   /*
1219    * The following field really only contains 3 elements.  However, silo
1220    * contains a bug in PJ_ReadVariable() as called by DBGetQuadvar() which
1221    * can cause three doubles to be stored there instead of three floats.
1222    */
1223    float          align[6];    /* Centering and alignment per dimension */
1224
1225    void         **mixvals;     /* nvals ptrs to data arrays for mixed zones */
1226    int            mixlen;      /* Num of elmts in each mixed zone data
1227                                 * array */
1228
1229    int            use_specmf;  /* Flag indicating whether to apply species
1230                                 * mass fractions to the variable. */
1231
1232    int            ascii_labels;/* Treat variable values as ASCII values
1233                                   by rounding to the nearest integer in
1234                                   the range [0, 255] */
1235    char          *meshname;    /* Name of associated mesh */
1236    int            guihide;     /* Flag to hide from post-processor's GUI */
1237    char         **region_pnames;
1238    int            conserved;   /* indicates if the variable should be conserved
1239                                   under various operations such as interp. */
1240    int            extensive;   /* indicates if the variable reprsents an extensiv
1241                                   physical property (as opposed to intensive) */
1242    int            centering;   /* explicit centering knowledge; should agree
1243                                   with alignment. */
1244    double         missing_value; /* Value to indicate var data is invalid/missing */
1245} DBquadvar;
1246
1247typedef struct DBucdvar_ {
1248/*----------- Unstructured Cell Data (UCD) Variable -----------*/
1249    int            id;          /* Identifier for this object */
1250    char          *name;        /* Name of variable */
1251    int            cycle;       /* Problem cycle number */
1252    char          *units;       /* Units for variable, e.g, 'mm/ms' */
1253    char          *label;       /* Label (perhaps for editing purposes) */
1254    float          time;        /* Problem time */
1255    double         dtime;       /* Problem time, double data type */
1256    int            meshid;      /* Identifier for associated mesh (Deprecated Sep2005) */
1257
1258    void         **vals;        /* Array of pointers to data arrays */
1259    int            datatype;    /* Type of data pointed to by 'vals' */
1260    int            nels;        /* Number of elements in each array */
1261    int            nvals;       /* Number of arrays pointed to by 'vals' */
1262    int            ndims;       /* Rank of variable */
1263    int            origin;      /* '0' or '1' */
1264
1265    int            centering;   /* Centering within mesh (nodal or zonal) */
1266    void         **mixvals;     /* nvals ptrs to data arrays for mixed zones */
1267    int            mixlen;      /* Num of elmts in each mixed zone data
1268                                 * array */
1269
1270    int            use_specmf;  /* Flag indicating whether to apply species
1271                                 * mass fractions to the variable. */
1272    int            ascii_labels;/* Treat variable values as ASCII values
1273                                   by rounding to the nearest integer in
1274                                   the range [0, 255] */
1275    char          *meshname;    /* Name of associated mesh */
1276    int            guihide;     /* Flag to hide from post-processor's GUI */
1277    char         **region_pnames;
1278    int            conserved;   /* indicates if the variable should be conserved
1279                                   under various operations such as interp. */
1280    int            extensive;   /* indicates if the variable reprsents an extensiv
1281                                   physical property (as opposed to intensive) */
1282    double         missing_value; /* Value to indicate var data is invalid/missing */
1283} DBucdvar;
1284
1285typedef struct DBmeshvar_ {
1286/*----------- Generic Mesh-Data Variable -----------*/
1287    int            id;          /* Identifier for this object */
1288    char          *name;        /* Name of variable */
1289    char          *units;       /* Units for variable, e.g, 'mm/ms' */
1290    char          *label;       /* Label (perhaps for editing purposes) */
1291    int            cycle;       /* Problem cycle number */
1292    int            meshid;      /* Identifier for associated mesh (Deprecated Sep2005) */
1293
1294    void         **vals;        /* Array of pointers to data arrays */
1295    int            datatype;    /* Type of data pointed to by 'val' */
1296    int            nels;        /* Number of elements in each array */
1297    int            nvals;       /* Number of arrays pointed to by 'vals' */
1298    int            nspace;      /* Spatial rank of variable */
1299    int            ndims;       /* Rank of 'vals' array(s) (computatnl rank) */
1300
1301    int            origin;      /* '0' or '1' */
1302    int            centering;   /* Centering within mesh (nodal,zonal,other) */
1303    float          time;        /* Problem time */
1304    double         dtime;       /* Problem time, double data type */
1305   /*
1306    * The following field really only contains 3 elements.  However, silo
1307    * contains a bug in PJ_ReadVariable() as called by DBGetPointvar() which
1308    * can cause three doubles to be stored there instead of three floats.
1309    */
1310    float          align[6];    /* Alignmnt per dimension if
1311                                 * centering==other */
1312
1313    /* Stuff for multi-dimensional arrays (ndims > 1) */
1314    int            dims[3];     /* Number of elements in each dimension */
1315    int            major_order; /* 1 indicates row-major for multi-d arrays */
1316    int            stride[3];   /* Offsets to adjacent elements  */
1317   /*
1318    * The following two fields really only contain 3 elements.  However, silo
1319    * contains a bug in PJ_ReadVariable() as called by DBGetUcdmesh() which
1320    * can cause three doubles to be stored there instead of three floats.
1321    */
1322    int            min_index[6];  /* Index in each dimension of 1st
1323                                   * non-phoney */
1324    int            max_index[6];  /* Index in each dimension of last
1325                                    non-phoney */
1326
1327    int            ascii_labels;/* Treat variable values as ASCII values
1328                                   by rounding to the nearest integer in
1329                                   the range [0, 255] */
1330    char          *meshname;      /* Name of associated mesh */
1331    int            guihide;     /* Flag to hide from post-processor's GUI */
1332    char         **region_pnames;
1333    int            conserved;   /* indicates if the variable should be conserved
1334                                   under various operations such as interp. */
1335    int            extensive;   /* indicates if the variable reprsents an extensiv
1336                                   physical property (as opposed to intensive) */
1337    double         missing_value; /* Value to indicate var data is invalid/missing */
1338} DBmeshvar;
1339typedef DBmeshvar DBpointvar; /* better named alias for pointvar */
1340
1341typedef struct DBmaterial_ {
1342/*----------- Material Information -----------*/
1343    int            id;          /* Identifier */
1344    char          *name;        /* Name of this material information block */
1345    int            ndims;       /* Rank of 'matlist' variable */
1346    int            origin;      /* '0' or '1' */
1347    int            dims[3];     /* Number of elements in each dimension */
1348    int            major_order; /* 1 indicates row-major for multi-d arrays */
1349    int            stride[3];   /* Offsets to adjacent elements in matlist */
1350
1351    int            nmat;        /* Number of materials */
1352    int           *matnos;      /* Array [nmat] of valid material numbers */
1353    char         **matnames;    /* Array of material names   */
1354    int           *matlist;     /* Array[nzone] w/ mat. number or mix index */
1355    int            mixlen;      /* Length of mixed data arrays (mix_xxx) */
1356    int            datatype;    /* Type of volume-fractions (double,float) */
1357    void          *mix_vf;      /* Array [mixlen] of volume fractions */
1358    int           *mix_next;    /* Array [mixlen] of mixed data indeces */
1359    int           *mix_mat;     /* Array [mixlen] of material numbers */
1360    int           *mix_zone;    /* Array [mixlen] of back pointers to mesh */
1361
1362    char         **matcolors;   /* Array of material colors */
1363    char          *meshname;    /* Name of associated mesh */
1364    int            allowmat0;   /* Flag to allow material "0" */
1365    int            guihide;     /* Flag to hide from post-processor's GUI */
1366} DBmaterial;
1367
1368typedef struct DBmatspecies_ {
1369/*----------- Species Information -----------*/
1370    int            id;          /* Identifier */
1371    char          *name;        /* Name of this matspecies information block */
1372    char          *matname;     /* Name of material object with which the
1373                                 * material species object is associated. */
1374    int            nmat;        /* Number of materials */
1375    int           *nmatspec;    /* Array of lngth nmat of the num of material
1376                                 * species associated with each material. */
1377    int            ndims;       /* Rank of 'speclist' variable */
1378    int            dims[3];     /* Number of elements in each dimension of the
1379                                 * 'speclist' variable. */
1380    int            major_order; /* 1 indicates row-major for multi-d arrays */
1381    int            stride[3];   /* Offsts to adjacent elmts in 'speclist'  */
1382
1383    int            nspecies_mf; /* Total number of species mass fractions. */
1384    void          *species_mf;  /* Array of length nspecies_mf of mass
1385                                 * frations of the material species. */
1386    int           *speclist;    /* Zone array of dimensions described by ndims
1387                                 * and dims.  Each element of the array is an
1388                                 * index into one of the species mass fraction
1389                                 * arrays.  A positive value is the index in
1390                                 * the species_mf array of the mass fractions
1391                                 * of the clean zone's material species:
1392                                 * species_mf[speclist[i]] is the mass fraction
1393                                 * of the first species of material matlist[i]
1394                                 * in zone i. A negative value means that the
1395                                 * zone is a mixed zone and that the array
1396                                 * mix_speclist contains the index to the
1397                                 * species mas fractions: -speclist[i] is the
1398                                 * index in the 'mix_speclist' array for zone
1399                                 * i. */
1400    int            mixlen;      /* Length of 'mix_speclist' array. */
1401    int           *mix_speclist;  /* Array of lgth mixlen of 1-orig indices
1402                                   * into the 'species_mf' array.
1403                                   * species_mf[mix_speclist[j]] is the index
1404                                   * in array species_mf' of the first of the
1405                                   * mass fractions for material
1406                                   * mix_mat[j]. */
1407
1408    int            datatype;    /* Datatype of mass fraction data. */
1409    int            guihide;     /* Flag to hide from post-processor's GUI */
1410    char         **specnames;   /* Array of species names; length is sum of nmatspec   */
1411    char         **speccolors;  /* Array of species colors; length is sum of nmatspec */
1412} DBmatspecies;
1413
1414typedef struct DBcsgzonelist_ {
1415/*----------- CSG Zonelist -----------*/
1416    int            nregs;       /* Number of regions in regionlist */
1417    int            origin;      /* '0' or '1' */
1418
1419    int           *typeflags;   /* [nregs] type info about each region */
1420    int           *leftids;     /* [nregs] left operand region refs */
1421    int           *rightids;    /* [nregs] right operand region refs */
1422    void          *xform;       /* [lxforms] transformation coefficients */
1423    int            lxform;      /* length of xforms array */
1424    int            datatype;    /* type of data in xforms array */
1425
1426    int            nzones;      /* number of zones */
1427    int           *zonelist;    /* [nzones] region ids (complete regions) */
1428    int            min_index;   /* Index of first real zone */
1429    int            max_index;   /* Index of last real zone */
1430
1431/*--------- Optional zone attributes ---------*/
1432    char         **regnames;   /* [nregs] names of each region */
1433    char         **zonenames;  /* [nzones] names of each zone */
1434    char         **alt_zonenum_vars;
1435} DBcsgzonelist;
1436
1437typedef struct DBcsgmesh_ {
1438/*----------- CSG Mesh -----------*/
1439    int            block_no;    /* Block number for this mesh */
1440    int            group_no;    /* Block group number for this mesh */
1441    char          *name;        /* Name associated with mesh */
1442    int            cycle;       /* Problem cycle number */
1443    char          *units[3];    /* Units for variable, e.g, 'mm/ms' */
1444    char          *labels[3];   /* Label associated with each dimension */
1445
1446    int            nbounds;     /* Total number of boundaries */
1447    int           *typeflags;   /* nbounds boundary type info flags */
1448    int           *bndids;      /* optional, nbounds explicit ids */
1449
1450    void          *coeffs;      /* coefficients in the representation of
1451                                   each boundary */
1452    int            lcoeffs;     /* length of coeffs array */
1453    int           *coeffidx;    /* array of nbounds offsets into coeffs
1454                                   for each boundary's coefficients */
1455    int            datatype;    /* data type of coeffs data */
1456
1457    float          time;        /* Problem time */
1458    double         dtime;       /* Problem time, double data type */
1459    double         min_extents[3];  /* Min mesh extents [ndims] */
1460    double         max_extents[3];  /* Max mesh extents [ndims] */
1461
1462    int            ndims;       /* Number of spatial & topological dimensions */
1463    int            origin;      /* '0' or '1' */
1464
1465    DBcsgzonelist *zones;       /* Data structure describing mesh zones */
1466
1467/*--------- Optional boundary attributes ---------*/
1468    char         **bndnames;     /* [nbounds] boundary names */
1469    int            guihide;     /* Flag to hide from post-processor's GUI */
1470    char          *mrgtree_name; /* optional name of assoc. mrgtree object */
1471    int            tv_connectivity;
1472    int            disjoint_mode;
1473    char         **alt_nodenum_vars;
1474} DBcsgmesh;
1475
1476typedef struct DBcsgvar_ {
1477/*----------- CSG Variable -----------*/
1478    char          *name;        /* Name of variable */
1479    int            cycle;       /* Problem cycle number */
1480    char          *units;       /* Units for variable, e.g, 'mm/ms' */
1481    char          *label;       /* Label (perhaps for editing purposes) */
1482    float          time;        /* Problem time */
1483    double         dtime;       /* Problem time, double data type */
1484
1485    void         **vals;        /* Array of pointers to data arrays */
1486    int            datatype;    /* Type of data pointed to by 'vals' */
1487    int            nels;        /* Number of elements in each array */
1488    int            nvals;       /* Number of arrays pointed to by 'vals' */
1489
1490    int            centering;   /* Centering within mesh (nodal or zonal) */
1491
1492    int            use_specmf;  /* Flag indicating whether to apply species
1493                                 * mass fractions to the variable. */
1494    int            ascii_labels;/* Treat variable values as ASCII values
1495                                   by rounding to the nearest integer in
1496                                   the range [0, 255] */
1497    char          *meshname;    /* Name of associated mesh */
1498    int            guihide;     /* Flag to hide from post-processor's GUI */
1499    char         **region_pnames;
1500    int            conserved;   /* indicates if the variable should be conserved
1501                                   under various operations such as interp. */
1502    int            extensive;   /* indicates if the variable reprsents an extensiv
1503                                   physical property (as opposed to intensive) */
1504    double         missing_value; /* Value to indicate var data is invalid/missing */
1505} DBcsgvar;
1506
1507/*-------------------------------------------------------------------------
1508 * A compound array is an array whose elements are simple arrays. A simple
1509 * array is an array whose elements are all of the same primitive data
1510 * type: float, double, integer, long...  All of the simple arrays of
1511 * a compound array have elements of the same data type.
1512 *-------------------------------------------------------------------------
1513 */
1514typedef struct DBcompoundarray_ {
1515    int            id;          /*identifier of the compound array */
1516    char          *name;        /*name of te compound array  */
1517    char         **elemnames;   /*names of the simple array elements */
1518    int           *elemlengths; /*lengths of the simple arrays  */
1519    int            nelems;      /*number of simple arrays  */
1520    void          *values;      /*simple array values   */
1521    int            nvalues;     /*sum reduction of `elemlengths' vector */
1522    int            datatype;    /*simple array element data type */
1523} DBcompoundarray;
1524
1525typedef struct DBoptlist_ {
1526
1527    int           *options;     /* Vector of option identifiers */
1528    void         **values;      /* Vector of pointers to option values */
1529    int            numopts;     /* Number of options defined */
1530    int            maxopts;     /* Total length of option/value arrays */
1531
1532} DBoptlist;
1533
1534#define DB_MAX_H5_OBJ_VALS 64
1535typedef struct DBobject_ {
1536
1537    char          *name;
1538    char          *type;        /* Type of group/object */
1539    char         **comp_names;  /* Array of component names */
1540    char         **pdb_names;   /* Array of internal (PDB) variable names */
1541    int            ncomponents; /* Number of components */
1542    int            maxcomponents;  /* Max number of components */
1543
1544    /* fields below are a hack for HDF5 driver to handle
1545       customization of 'standard' objects */
1546    char           h5_vals[DB_MAX_H5_OBJ_VALS*3*sizeof(double)];
1547    int            h5_offs[DB_MAX_H5_OBJ_VALS];
1548    int            h5_sizes[DB_MAX_H5_OBJ_VALS];
1549    int            h5_types[DB_MAX_H5_OBJ_VALS];
1550    char          *h5_names[DB_MAX_H5_OBJ_VALS];
1551} DBobject;
1552
1553typedef struct _DBmrgtnode {
1554    char *name;
1555    int  narray;
1556    char **names;
1557    int type_info_bits;
1558    int max_children;
1559    char *maps_name;
1560    int nsegs;
1561    int *seg_ids;
1562    int *seg_lens;
1563    int *seg_types;
1564    int num_children;
1565    struct _DBmrgtnode **children;
1566
1567    /* internal stuff to support updates, i/o, etc. */
1568    int walk_order;
1569    struct _DBmrgtnode  *parent;
1570} DBmrgtnode;
1571
1572typedef void (*DBmrgwalkcb)(DBmrgtnode const *tnode, int nat_node_num, void *data);
1573
1574typedef struct _DBmrgtree {
1575    char *name;
1576    char *src_mesh_name;
1577    int src_mesh_type;
1578    int type_info_bits;
1579    int num_nodes;
1580    DBmrgtnode *root;
1581    DBmrgtnode *cwr;
1582
1583    char **mrgvar_onames;
1584    char **mrgvar_rnames;
1585} DBmrgtree;
1586
1587typedef struct _DBmrgvar {
1588    char *name;
1589    char *mrgt_name;
1590    int ncomps;
1591    char **compnames;
1592    int nregns;
1593    char **reg_pnames;
1594    int datatype;
1595    void **data;
1596} DBmrgvar ;
1597
1598typedef struct _DBgroupelmap {
1599    char *name;
1600    int num_segments;
1601    int *groupel_types;
1602    int *segment_lengths;
1603    int *segment_ids;
1604    int **segment_data;
1605    void **segment_fracs;
1606    int fracs_data_type;
1607} DBgroupelmap;
1608
1609#if !defined(DB_MAX_EXPSTRS) /* NO_FORTRAN_DEFINE */
1610#define DB_MAX_EXPSTRS 8 /* NO_FORTRAN_DEFINE */
1611#endif
1612
1613typedef struct _DBnamescheme
1614{
1615    char *fmt;              /* orig. format string */
1616    char const **fmtptrs;   /* ptrs into first (printf) part of fmt for each conversion spec. */
1617    int fmtlen;             /* len of first part of fmt */
1618    int ncspecs;            /* # of conversion specs in first part of fmt */
1619    char delim;             /* delimiter char used for parts of fmt */
1620    int nembed;             /* number of last embedded string encountered (used in eval process) */
1621    char *embedstrs[DB_MAX_EXPSTRS]; /* ptrs to copies of embedded strings (used in eval process) */
1622    int arralloc;           /* flag indicating if Silo allocated the arrays or not */
1623    int narrefs;            /* number of array refs in conversion specs */
1624    char **arrnames;        /* array names used by array refs */
1625    void **arrvals;         /* pointer to actual array data assoc. with each name */
1626    int  *arrsizes;         /* size of each array (only needed for deallocating external arrays of strings) */
1627    char **exprstrs;        /* expressions to be evaluated for each conv. spec. */
1628} DBnamescheme;
1629
1630typedef struct DBfile *___DUMMY_TYPE;  /* Satisfy ANSI scope rules */
1631
1632/*
1633 * All file formats are now anonymous except for the public properties
1634 * and public methods.
1635 */
1636typedef struct DBfile_pub {
1637
1638    /* Public Properties */
1639    char          *name;        /*name of file    */
1640    int            type;        /*file type    */
1641    DBtoc         *toc;         /*table of contents   */
1642    int            dirid;       /*directory ID    */
1643    int            fileid;      /*unique file id [0,DB_NFILES-1] */
1644    int            pathok;      /*driver handles paths in names */
1645    int            Grab;        /*drive has access to low-level interface */
1646    void          *GrabId;      /*pointer to low-level driver descriptor */
1647    char          *file_lib_version; /* version of lib file was created with */
1648
1649    /* Public Methods */
1650    int            (*close)(struct DBfile *);
1651    int            (*exist)(struct DBfile *, char const *);
1652    int            (*newtoc)(struct DBfile *);
1653    DBObjectType   (*inqvartype)(struct DBfile *, char const *);
1654    int            (*uninstall)(struct DBfile *);
1655    DBobject      *(*g_obj)(struct DBfile *, char const *);
1656    int            (*c_obj)(struct DBfile *, DBobject const *, int);
1657    int            (*w_obj)(struct DBfile *, DBobject const *, int);
1658    void          *(*g_comp)(struct DBfile *, char const *, char const *);
1659    int            (*g_comptyp)(struct DBfile *, char const *, char const *);
1660    int            (*w_comp)(struct DBfile *, DBobject *, char const *, char const *,
1661                       char const *, void const *, int, long const *);
1662    int            (*write) (struct DBfile *, char const *, void const *, int const *, int, int);
1663    int            (*writeslice)(struct DBfile *, char const *array_name, void const *data,
1664                       int datatype, int const *offsets, int const *lens, int const *stides,
1665                       int const *dims, int ndim);
1666    int            (*g_dir)(struct DBfile *, char *);
1667    int            (*mkdir)(struct DBfile *, char const *);
1668    int            (*cd)(struct DBfile *, char const *);
1669    int            (*r_var)(struct DBfile *, char const *, void *);
1670    int            (*module)(struct DBfile *, FILE *);
1671    int            (*r_varslice)(struct DBfile *, char const *, int const *, int const *, int const *,
1672                       int, void *);
1673    int            (*g_compnames)(struct DBfile *, char const *, char ***, char ***);
1674    DBcompoundarray *(*g_ca)(struct DBfile *, char const *);
1675    DBcurve       *(*g_cu)(struct DBfile *, char const *);
1676    DBdefvars     *(*g_defv)(struct DBfile *, char const *);
1677    DBmaterial    *(*g_ma)(struct DBfile *, char const *);
1678    DBmatspecies  *(*g_ms)(struct DBfile *, char const *);
1679    DBmultimesh   *(*g_mm)(struct DBfile *, char const *);
1680    DBmultivar    *(*g_mv)(struct DBfile *, char const *);
1681    DBmultimat    *(*g_mt)(struct DBfile *, char const *);
1682    DBmultimatspecies *(*g_mms)(struct DBfile *, char const *);
1683    DBpointmesh   *(*g_pm)(struct DBfile *, char const *);
1684    DBmeshvar     *(*g_pv)(struct DBfile *, char const *);
1685    DBquadmesh    *(*g_qm)(struct DBfile *, char const *);
1686    DBquadvar     *(*g_qv)(struct DBfile *, char const *);
1687    DBucdmesh     *(*g_um)(struct DBfile *, char const *);
1688    DBucdvar      *(*g_uv)(struct DBfile *, char const *);
1689    DBfacelist    *(*g_fl)(struct DBfile *, char const *);
1690    DBzonelist    *(*g_zl)(struct DBfile *, char const *);
1691    void          *(*g_var)(struct DBfile *, char const *);
1692    int            (*g_varbl)(struct DBfile *, char const *);  /*byte length */
1693    int            (*g_varlen)(struct DBfile *, char const *);  /*nelems */
1694    int            (*g_vardims)(struct DBfile*, char const *, int, int *); /*dims*/
1695    int            (*g_vartype)(struct DBfile *, char const *);
1696    int            (*i_meshname)(struct DBfile *, char const *, char *);
1697    int            (*i_meshtype)(struct DBfile *, char const *);
1698    int            (*p_ca)(struct DBfile *dbfile, char const *name, char const * const *elemnames,
1699                       int const *elemlens, int nelems, void const *values, int nvalues,
1700                       int datatype, DBoptlist const *);
1701    int            (*p_cu)(struct DBfile *dbfile, char const *name, void const *xvals,
1702                       void const *yvals, int datatype, int npts, DBoptlist const *opts);
1703    int            (*p_defv)(struct DBfile *dbfile, char const *name, int ndefs,
1704                       char const * const *names, int const *types, char const * const *defns,
1705                       DBoptlist const * const *opts);
1706    int            (*p_fl)(struct DBfile *dbfile, char const *name, int nfaces, int ndims,
1707                       int const *nodelist, int lnodelist, int origin, int const *zoneno,
1708                       int const *shapesize, int const *shapecnt, int nshapes, int const *types,
1709                       int const *typelist, int ntypes);
1710    int            (*p_ma)(struct DBfile *dbfile, char const *name, char const *meshname,
1711                       int nmat, int const *matnos, int const *matlist, int const *dims,
1712                       int ndims, int const *mix_next, int const *mix_mat, int const *mix_zone,
1713                       DBVCP1_t mix_vf, int mixlen, int datatype, DBoptlist const *);
1714    int            (*p_ms)(struct DBfile *, char const *, char const *, int, int const *, int const *,
1715                       int const *, int, int, DBVCP1_t, int const *, int, int, DBoptlist const *);
1716    int            (*p_mm)(struct DBfile *, char const *, int, char const * const *, int const *,
1717                       DBoptlist const *);
1718    int            (*p_mv)(struct DBfile *, char const *, int, char const * const *, int const *,
1719                       DBoptlist const *);
1720    int            (*p_mt)(struct DBfile *, char const *, int, char const * const *, DBoptlist const *);
1721    int            (*p_mms)(struct DBfile *, char const *, int, char const * const *, DBoptlist const *);
1722    int            (*p_pm)(struct DBfile *, char const *, int, DBVCP2_t, int, int, DBoptlist const *);
1723    int            (*p_pv)(struct DBfile *, char const *, char const *, int, DBVCP2_t, int,
1724                       int, DBoptlist const *);
1725    int            (*p_qm)(struct DBfile *, char const *, char const * const *, DBVCP2_t, int const *,
1726                       int, int, int, DBoptlist const *);
1727    int            (*p_qv)(struct DBfile *, char const *, char const *, int, char const * const *, DBVCP2_t,
1728                       int const *, int, DBVCP2_t, int, int, int, DBoptlist const *);
1729    int            (*p_um)(struct DBfile *, char const *, int, char const * const *, DBVCP2_t,
1730                       int, int, char const *, char const *, int, DBoptlist const *);
1731    int            (*p_sm)(struct DBfile *, char const *, char const *,
1732                       int, char const *, char const *, DBoptlist const *);
1733    int            (*p_uv)(struct DBfile *, char const *, char const *, int, char const * const *,
1734                       DBVCP2_t, int, DBVCP2_t, int, int, int, DBoptlist const *);
1735    int            (*p_zl)(struct DBfile *, char const *, int, int, int const *, int, int,
1736                       int const *, int const *, int);
1737    int            (*p_zl2)(struct DBfile *, char const *, int, int, int const *, int, int,
1738                       int, int, int const *, int const *, int const *, int, DBoptlist const *);
1739    DBphzonelist  *(*g_phzl)(struct DBfile *, char const *);
1740    int            (*p_phzl)(struct DBfile *, char const *, int, int const *, int, int const *,
1741                       char const *, int, int const *, int, int const *, int, int, int, DBoptlist const *);
1742    int            (*p_csgzl)(struct DBfile *, char const *, int, int const *, int const *,
1743                       int const *, void const *, int, int, int, int const *, DBoptlist const *);
1744    DBcsgzonelist *(*g_csgzl)(struct DBfile *, char const *);
1745    int            (*p_csgm)(struct DBfile *, char const *, int, int, int const *, int const *,
1746                       void const *, int, int, double const *, char const *, DBoptlist const *);
1747    DBcsgmesh     *(*g_csgm)(struct DBfile *, char const *);
1748    int            (*p_csgv)(struct DBfile *, char const *, char const *, int,
1749                       char const * const *, void const * const *, int, int, int, DBoptlist const *);
1750    DBcsgvar      *(*g_csgv)(struct DBfile *, char const *);
1751    DBmultimeshadj *(*g_mmadj)(struct DBfile *, char const *, int, int const *);
1752    int            (*p_mmadj)(struct DBfile *, char const *, int, int const *, int const *,
1753                       int const *, int const *, int const *, int const * const *, int const *,
1754                       int const * const *, DBoptlist const *optlist);
1755    int            (*p_mrgt)(struct DBfile *dbfile, char const *name, char const *mesh_name,
1756                       DBmrgtree const *tree, DBoptlist const *opts);
1757    DBmrgtree     *(*g_mrgt)(struct DBfile *, char const *name);
1758    int            (*p_grplm)(struct DBfile *dbfile, char const *map_name, int num_segments,
1759                       int const *groupel_types, int const *segment_lengths, int const *segment_ids,
1760		       int const * const *segment_data, void const * const *segment_fracs,
1761                       int fracs_data_type, DBoptlist const *opts);
1762    DBgroupelmap  *(*g_grplm)(struct DBfile *dbfile, char const *name);
1763    int            (*p_mrgv)(struct DBfile *dbfile, char const *name, char const *mrgt_name,
1764                       int ncomps, char const * const *compnames, int nregns,
1765                       char const * const *reg_pnames, int datatype, void const * const *data,
1766                       DBoptlist const *opts);
1767    DBmrgvar      *(*g_mrgv)(struct DBfile *dbfile, char const *name);
1768    int            (*free_z)(struct DBfile *, char const *);
1769    int            (*cpdir)(struct DBfile *, char const *, struct DBfile *, char const *);
1770    int            (*sort_obo)(struct DBfile *dbfile, int nobjs, char const *const *obj_names, int *ranks);
1771} DBfile_pub;
1772
1773typedef struct DBfile {
1774    DBfile_pub     pub;
1775    /*private part follows per device driver */
1776} DBfile;
1777
1778typedef void (*DBErrFunc_t)(char *);
1779
1780/*-------------------------------------------------------------------------
1781 * Public global variables.
1782 *-------------------------------------------------------------------------
1783 */
1784SILO_API extern int     DBDebugAPI;      /*file desc for debug messages, or zero */
1785SILO_API extern int     db_errno;        /*error number of last error */
1786SILO_API extern char    db_errfunc[];    /*name of erring function */
1787
1788#ifndef DB_MAIN
1789SILO_API extern DBfile *(*DBOpenCB[])(char const *, int, int);
1790SILO_API extern DBfile *(*DBCreateCB[])(char const *, int, int, int, char const *);
1791SILO_API extern int     (*DBFSingleCB[])(int);
1792#endif
1793
1794#define SILO_VSTRING_NAME "_silolibinfo"
1795#define SILO_VSTRING PACKAGE_VERSION
1796SILO_API extern int SILO_VERS_TAG;
1797#define SiloCheckVersion SILO_VERS_TAG = 1
1798
1799/* define versions of Silo this version is backward ABI compatible with */
1800SILO_API extern int Silo_version_4_10;
1801
1802/*
1803 * SILO API FUNCTIONS
1804 */
1805
1806/* Error handling and other global library behavior */
1807SILO_API extern void                   DBShowErrors(int, DBErrFunc_t);
1808SILO_API extern char const *           DBErrString(void);
1809SILO_API extern char const *           DBErrFuncname(void);
1810SILO_API extern DBErrFunc_t            DBErrfunc(void);
1811SILO_API extern int                    DBErrno(void);
1812SILO_API extern int                    DBErrlvl(void);
1813/* Designed to prevent accidental use of old interface by forcing a human readable compile time error */
1814#define DBSetDataReadMask(A) ,DBSetDataReadMask_is_replaced_with_DBSetDataReadMask2_using_unsigned_long_long
1815#define DBGetDataReadMask() ,DBGetDataReadMask_is_replaced_with_DBGetDataReadMask2_using_unsigned_long_long
1816SILO_API extern unsigned long long     DBSetDataReadMask2(unsigned long long);
1817SILO_API extern unsigned long long     DBGetDataReadMask2(void);
1818SILO_API extern char *                 DBGetDatatypeString(int datatype);
1819SILO_API extern int                    DBSetAllowOverwrites(int allow);
1820SILO_API extern int                    DBGetAllowOverwrites(void);
1821SILO_API extern int                    DBSetAllowEmptyObjects(int allow);
1822SILO_API extern int                    DBGetAllowEmptyObjects(void);
1823SILO_API extern int                    DBSetEnableChecksums(int enable);
1824SILO_API extern int                    DBGetEnableChecksums(void);
1825SILO_API extern void                   DBSetCompression(char const *);
1826SILO_API extern char const *           DBGetCompression(void);
1827SILO_API extern int                    DBSetFriendlyHDF5Names(int enable);
1828SILO_API extern int                    DBGetFriendlyHDF5Names(void);
1829SILO_API extern int                    DBSetDeprecateWarnings(int max);
1830SILO_API extern int                    DBGetDeprecateWarnings();
1831SILO_API extern int const *            DBSetUnknownDriverPriorities(int const *);
1832SILO_API extern int const *            DBGetUnknownDriverPriorities();
1833SILO_API extern int                    DBRegisterFileOptionsSet(DBoptlist const *opts);
1834SILO_API extern int                    DBUnregisterFileOptionsSet(int opts_set_id);
1835SILO_API extern void                   DBUnregisterAllFileOptionsSets();
1836SILO_API extern char const *           DBVersion(void);
1837SILO_API extern int                    DBVersionDigits(int *Maj, int *Min, int *Pat, int *Pre);
1838SILO_API extern int                    DBVersionGE(int Maj, int Min, int Pat);
1839SILO_API extern int                    DBVariableNameValid(char const *s);
1840SILO_API extern int                    DBForceSingle(int);
1841
1842/* Functions involving files, file structure and file inquiries */
1843SILO_API extern DBfile *               DBOpenReal(char const *name, int dbtype, int mode);
1844SILO_API extern DBfile *               DBCreateReal(char const *name, int mode, int targ, char const *info, int dbtype);
1845SILO_API extern int                    DBInqFileReal(char const *name);
1846/*
1847 * The above functions are the 'Real' implementations of their macro counterparts (below).
1848 * These are the functions by which client code first gets into Silo. They are separated
1849 * out because they do a link-time header/library version check for us. It works because
1850 * we don't advertise the 'Real' functions and instead encourage clients to use the macro
1851 * counterparts (below). The macros wind up creating a reference to the Silo vesion tag
1852 * which is resolved only when the client is linked with a library that defines the
1853 * associated version symbol.
1854 */
1855#define DBOpen(NM, DR, MD)            (SiloCheckVersion, DBOpenReal(NM, DR, MD))
1856#define DBCreate(NM, MD, TG, NF, DR)  (SiloCheckVersion, DBCreateReal(NM, MD, TG, NF, DR))
1857#define DBInqFile(NM)                 (SiloCheckVersion, DBInqFileReal(NM))
1858SILO_API extern int                    DBClose(DBfile *);
1859SILO_API extern DBtoc *                DBGetToc(DBfile *);
1860SILO_API extern int                    DBNewToc(DBfile *);
1861SILO_API extern void *                 DBGrabDriver(DBfile *);
1862SILO_API extern int                    DBUngrabDriver(DBfile *, void const *);
1863SILO_API extern int                    DBGetDriverType(DBfile const *);
1864SILO_API extern int                    DBGetDriverTypeFromPath(char const *);
1865SILO_API extern int                    DBVersionGEFileVersion(DBfile const *dbfile);
1866SILO_API extern char const *           DBFileVersion(DBfile const *dbfile);
1867SILO_API extern int                    DBFileVersionDigits(DBfile const *dbfile, int *Maj, int *Min, int *Pat, int *Pre);
1868SILO_API extern int                    DBFileVersionGE(DBfile const *dbfile, int Maj, int Min, int Pat);
1869SILO_API extern int                    DBGetDir(DBfile *, char *);
1870SILO_API extern int                    DBSetDir(DBfile *, char const *);
1871#define DBMkdir DBMkDir
1872SILO_API extern int                    DBMkDir(DBfile *, char const *);
1873SILO_API extern int                    DBCpDir(DBfile *dbfile, char const *srcDir,
1874                                           DBfile *dstFile, char const *dstDir);
1875SILO_API extern int                    DBGuessHasFriendlyHDF5Names(DBfile *f);
1876SILO_API extern int                    DBInqVarExists(DBfile *, char const *);
1877SILO_API extern int                    DBUninstall(DBfile *);
1878SILO_API extern int                    DBFreeCompressionResources(DBfile *dbfile, char const *meshname);
1879SILO_API extern int                    DBSortObjectsByOffset(DBfile *, int nobjs, char const * const *obj_names, int *ranks);
1880SILO_API extern int                    DBFilters(DBfile *, FILE *);
1881SILO_API extern int                    DBFilterRegistration(char const *, int (*init) (DBfile *, char *),
1882                                           int (*open) (DBfile *, char *));
1883SILO_API extern int                    DBInqFileHasObjects(DBfile *);
1884
1885/* Object Allocation, Free and IsEmpty functions */
1886SILO_API extern DBcompoundarray *      DBAllocCompoundarray(void);
1887SILO_API extern DBcurve *              DBAllocCurve(void);
1888SILO_API extern DBdefvars *            DBAllocDefvars(int);
1889SILO_API extern DBmultimesh *          DBAllocMultimesh(int);
1890SILO_API extern DBmultimeshadj *       DBAllocMultimeshadj(int);
1891SILO_API extern DBmultivar *           DBAllocMultivar(int);
1892SILO_API extern DBmultimat *           DBAllocMultimat(int);
1893SILO_API extern DBmultimatspecies *    DBAllocMultimatspecies(int);
1894SILO_API extern DBcsgmesh *            DBAllocCsgmesh(void);
1895SILO_API extern DBquadmesh *           DBAllocQuadmesh(void);
1896SILO_API extern DBpointmesh *          DBAllocPointmesh(void);
1897SILO_API extern DBmeshvar *            DBAllocMeshvar(void);
1898SILO_API extern DBucdmesh *            DBAllocUcdmesh(void);
1899SILO_API extern DBcsgvar *             DBAllocCsgvar(void);
1900SILO_API extern DBquadvar *            DBAllocQuadvar(void);
1901SILO_API extern DBucdvar *             DBAllocUcdvar(void);
1902SILO_API extern DBzonelist *           DBAllocZonelist(void);
1903SILO_API extern DBphzonelist *         DBAllocPHZonelist(void);
1904SILO_API extern DBcsgzonelist *        DBAllocCSGZonelist(void);
1905SILO_API extern DBedgelist *           DBAllocEdgelist(void);
1906SILO_API extern DBfacelist *           DBAllocFacelist(void);
1907SILO_API extern DBmaterial *           DBAllocMaterial(void);
1908SILO_API extern DBmatspecies *         DBAllocMatspecies(void);
1909SILO_API extern DBnamescheme *         DBAllocNamescheme(void);
1910SILO_API extern DBgroupelmap *         DBAllocGroupelmap(int, DBdatatype);
1911
1912SILO_API extern void                   DBFreeMatspecies(DBmatspecies *);
1913SILO_API extern void                   DBFreeMaterial(DBmaterial *);
1914SILO_API extern void                   DBFreeFacelist(DBfacelist *);
1915SILO_API extern void                   DBFreeEdgelist(DBedgelist *);
1916SILO_API extern void                   DBFreeZonelist(DBzonelist *);
1917SILO_API extern void                   DBFreePHZonelist(DBphzonelist *);
1918SILO_API extern void                   DBFreeCSGZonelist(DBcsgzonelist *);
1919SILO_API extern void                   DBResetUcdvar(DBucdvar *);
1920SILO_API extern void                   DBFreeUcdvar(DBucdvar *);
1921SILO_API extern void                   DBResetQuadvar(DBquadvar *);
1922SILO_API extern void                   DBFreeCsgvar(DBcsgvar *);
1923SILO_API extern void                   DBFreeQuadvar(DBquadvar *);
1924SILO_API extern void                   DBFreeUcdmesh(DBucdmesh *);
1925SILO_API extern void                   DBFreeMeshvar(DBmeshvar *);
1926SILO_API extern void                   DBFreePointvar(DBpointvar *);
1927SILO_API extern void                   DBFreePointmesh(DBpointmesh *);
1928SILO_API extern void                   DBFreeQuadmesh(DBquadmesh *);
1929SILO_API extern void                   DBFreeCsgmesh(DBcsgmesh *);
1930SILO_API extern void                   DBFreeDefvars(DBdefvars*);
1931SILO_API extern void                   DBFreeMultimesh(DBmultimesh *);
1932SILO_API extern void                   DBFreeMultimeshadj(DBmultimeshadj *);
1933SILO_API extern void                   DBFreeMultivar(DBmultivar *);
1934SILO_API extern void                   DBFreeMultimat(DBmultimat *);
1935SILO_API extern void                   DBFreeMultimatspecies(DBmultimatspecies *);
1936SILO_API extern void                   DBFreeCompoundarray(DBcompoundarray *);
1937SILO_API extern void                   DBFreeCurve(DBcurve *);
1938SILO_API extern void                   DBFreeNamescheme(DBnamescheme *);
1939SILO_API extern void                   DBFreeMrgvar(DBmrgvar *mrgv);
1940SILO_API extern void                   DBFreeMrgtree(DBmrgtree *tree);
1941SILO_API extern void                   DBFreeGroupelmap(DBgroupelmap *map);
1942
1943SILO_API extern int                    DBIsEmptyCurve(DBcurve const *curve);
1944SILO_API extern int                    DBIsEmptyPointmesh(DBpointmesh const *msh);
1945SILO_API extern int                    DBIsEmptyPointvar(DBpointvar const *var);
1946SILO_API extern int                    DBIsEmptyMeshvar(DBmeshvar const *var);
1947SILO_API extern int                    DBIsEmptyQuadmesh(DBquadmesh const *msh);
1948SILO_API extern int                    DBIsEmptyQuadvar(DBquadvar const *var);
1949SILO_API extern int                    DBIsEmptyUcdmesh(DBucdmesh const *msh);
1950SILO_API extern int                    DBIsEmptyFacelist(DBfacelist const *fl);
1951SILO_API extern int                    DBIsEmptyZonelist(DBzonelist const *zl);
1952SILO_API extern int                    DBIsEmptyPHZonelist(DBphzonelist const *zl);
1953SILO_API extern int                    DBIsEmptyUcdvar(DBucdvar const *var);
1954SILO_API extern int                    DBIsEmptyCsgmesh(DBcsgmesh const *msh);
1955SILO_API extern int                    DBIsEmptyCSGZonelist(DBcsgzonelist const *zl);
1956SILO_API extern int                    DBIsEmptyCsgvar(DBcsgvar const *var);
1957SILO_API extern int                    DBIsEmptyMaterial(DBmaterial const *mat);
1958SILO_API extern int                    DBIsEmptyMatspecies(DBmatspecies const *spec);
1959
1960/* User-defined (generic) Data and Object functions */
1961SILO_API extern int                    DBGetObjtypeTag(char const *);
1962SILO_API extern DBobject *             DBMakeObject(char const *, int, int);
1963SILO_API extern int                    DBFreeObject(DBobject *);
1964SILO_API extern int                    DBClearObject(DBobject *);
1965SILO_API extern int                    DBAddVarComponent(DBobject *, char const *, char const *);
1966SILO_API extern int                    DBAddIntComponent(DBobject *, char const *, int);
1967SILO_API extern int                    DBAddFltComponent(DBobject *, char const *, double);
1968SILO_API extern int                    DBAddDblComponent(DBobject *, char const *, double);
1969SILO_API extern int                    DBAddStrComponent(DBobject *, char const *, char const *);
1970SILO_API extern int                    DBGetComponentNames(DBfile *, char const *, char ***, char ***);
1971SILO_API extern DBobject *             DBGetObject(DBfile *, char const *);
1972SILO_API extern int                    DBChangeObject(DBfile *, DBobject const *);
1973SILO_API extern int                    DBWriteObject(DBfile *, DBobject const *, int);
1974SILO_API extern void *                 DBGetComponent(DBfile *, char const *, char const *);
1975SILO_API extern int                    DBGetComponentType(DBfile *, char const *, char const *);
1976SILO_API extern int                    DBWriteComponent(DBfile *, DBobject *, char const *, char const *, char const *,
1977                                           void const *, int, long const *);
1978SILO_API extern int                    DBWrite(DBfile *, char const *, void const *, int const *, int, int);
1979SILO_API extern int                    DBWriteSlice(DBfile *dbfile, char const *array_name,
1980                                           void const * data, int datatype, int const *offsets,
1981                                           int const *lengths, int const *strides, int const *dims,
1982                                           int ndims);
1983SILO_API extern int                    DBRead(DBfile *, char const *, void *);
1984SILO_API extern int                    DBReadVar(DBfile *, char const *, void *);
1985SILO_API extern int                    DBReadVarSlice(DBfile *, char const *, int const *, int const *, int const *, int, void *);
1986SILO_API extern DBcompoundarray *      DBGetCompoundarray(DBfile *, char const *);
1987SILO_API extern int                    DBInqCompoundarray(DBfile *, char const *, char ***, int **, int *, int *, int *);
1988SILO_API extern void *                 DBGetVar(DBfile *, char const *);
1989SILO_API extern int                    DBGetVarByteLength(DBfile *, char const *);
1990SILO_API extern int                    DBGetVarLength(DBfile *, char const *);
1991SILO_API extern int                    DBGetVarDims(DBfile *, char const *, int, int *);
1992SILO_API extern int                    DBGetVarType(DBfile *, char const *);
1993SILO_API extern DBObjectType           DBInqVarType(DBfile *, char const *);
1994
1995/* Curve, Mesh, Variable and Material functions */
1996SILO_API extern DBcurve *              DBGetCurve(DBfile *, char const *);
1997SILO_API extern DBdefvars *            DBGetDefvars(DBfile *, char const *);
1998SILO_API extern DBmaterial *           DBGetMaterial(DBfile *, char const *);
1999SILO_API extern DBmatspecies *         DBGetMatspecies(DBfile *, char const *);
2000SILO_API extern DBpointmesh *          DBGetPointmesh(DBfile *, char const *);
2001SILO_API extern DBmeshvar *            DBGetPointvar(DBfile *, char const *);
2002SILO_API extern DBquadmesh *           DBGetQuadmesh(DBfile *, char const *);
2003SILO_API extern DBquadvar *            DBGetQuadvar(DBfile *, char const *);
2004SILO_API extern DBucdmesh *            DBGetUcdmesh(DBfile *, char const *);
2005SILO_API extern DBucdvar *             DBGetUcdvar(DBfile *, char const *);
2006SILO_API extern DBcsgmesh *            DBGetCsgmesh(DBfile *, char const *);
2007SILO_API extern DBcsgvar *             DBGetCsgvar(DBfile *, char const *);
2008SILO_API extern DBcsgzonelist *        DBGetCSGZonelist(DBfile *, char const *);
2009SILO_API extern DBfacelist *           DBGetFacelist(DBfile *, char const *);
2010SILO_API extern DBzonelist *           DBGetZonelist(DBfile *, char const *);
2011SILO_API extern DBphzonelist *         DBGetPHZonelist(DBfile *, char const *);
2012SILO_API extern int                    DBInqMeshname(DBfile *, char const *, char *);
2013SILO_API extern int                    DBInqMeshtype(DBfile *, char const *);
2014SILO_API extern int                    DBPutCompoundarray(DBfile *dbfile, char const *name, char const * const *elemnames,
2015                                           int const *elemlens, int nelems, void const *values, int nvalues, int datatype,
2016                                           DBoptlist const *);
2017SILO_API extern int                    DBPutCurve(DBfile *dbfile, char const * name, void const * xvals,
2018                                           void const * yvals, int datatype, int npts, DBoptlist const * opts);
2019SILO_API extern int                    DBPutDefvars(DBfile *dbfile, char const *name, int, char const * const *names,
2020                                           int const *types, char const * const *defns, DBoptlist const * const *opts);
2021SILO_API extern int                    DBPutFacelist(DBfile *dbfile, char const *, int nfaces, int ndims, int const *nodelist,
2022                                           int lnodelist, int origin, int const *zoneno, int const *shapesize,
2023                                           int const *shapecnt, int nshapes, int const *types, int const *typelist, int ntypes);
2024SILO_API extern int                    DBPutMaterial(DBfile *dbfile, char const *name, char const *meshname, int nmat,
2025                                           int const *matnos, int const *matlist, int const *dims, int ndims,
2026                                           int const *mix_next, int const *mix_mat, int const *mix_zone, DBVCP1_t mix_vf,
2027                                           int mixlen, int datatype, DBoptlist const *opts);
2028SILO_API extern int                    DBPutMatspecies(struct DBfile *dbfile, char const *name, char const *matnam,
2029                                           int nmat, int const *nmatspec, int const *speclist, int const *dims,
2030                                           int ndims, int nspecies_mf, DBVCP1_t species_mf, int const *mix_speclist,
2031                                           int mixlen, int datatype, DBoptlist const *optlist);
2032SILO_API extern int                    DBPutPointmesh(DBfile *, char const *, int, DBVCP2_t, int, int, DBoptlist const *);
2033SILO_API extern int                    DBPutPointvar(DBfile *, char const *, char const *, int, DBVCP2_t, int, int,
2034                                           DBoptlist const *);
2035SILO_API extern int                    DBPutPointvar1(DBfile *, char const *, char const *, DBVCP1_t, int, int,
2036                                           DBoptlist const *);
2037SILO_API extern int                    DBPutQuadmesh(DBfile *, char const *, char const * const *, DBVCP2_t, int const *, int,
2038                                           int, int, DBoptlist const *);
2039SILO_API extern int                    DBPutQuadvar(DBfile *, char const *, char const *, int, char const * const *, DBVCP2_t,
2040                                           int const *, int, DBVCP2_t, int, int, int, DBoptlist const *);
2041SILO_API extern int                    DBPutQuadvar1(DBfile *, char const *, char const *, DBVCP1_t, int const *, int,
2042                                           DBVCP1_t, int, int, int, DBoptlist const *);
2043SILO_API extern int                    DBPutUcdmesh(DBfile *, char const *, int, char const * const *, DBVCP2_t, int,
2044                                           int, char const *, char const *, int, DBoptlist const *);
2045SILO_API extern int                    DBPutUcdsubmesh(DBfile *, char const *, char const *, int,
2046                                           char const *, char const *, DBoptlist const *);
2047SILO_API extern int                    DBPutUcdvar(DBfile *, char const *, char const *, int, char const * const *, DBVCP2_t,
2048                                           int, DBVCP2_t, int, int, int, DBoptlist const *);
2049SILO_API extern int                    DBPutUcdvar1(DBfile *, char const *, char const *, DBVCP1_t, int, DBVCP1_t,
2050                                           int, int, int, DBoptlist const *);
2051SILO_API extern int                    DBPutZonelist(DBfile *, char const *, int, int, int const *, int, int,
2052                                           int const *, int const *, int);
2053SILO_API extern int                    DBPutZonelist2(DBfile *, char const *, int, int, int const *, int, int,
2054                                           int, int, int const *, int const *, int const *, int, DBoptlist const *);
2055SILO_API extern int                    DBPutPHZonelist(DBfile *, char const *, int, int const *, int, int const *, char const *,
2056                                           int, int const *, int, int const *, int, int, int, DBoptlist const *);
2057SILO_API extern int                    DBPutCsgmesh(DBfile *, char const *, int, int, int const *, int const *,
2058                                           void const *, int, int, double const *, char const *, DBoptlist const *);
2059SILO_API extern int                    DBPutCSGZonelist(DBfile *, char const *, int, int const *,
2060                                           int const *, int const *, void const *, int, int, int, int const *,
2061                                           DBoptlist const *);
2062SILO_API extern int                    DBPutCsgvar(DBfile *, char const *, char const *, int, char const * const *,
2063                                           DBVCP2_t, int, int, int, DBoptlist const *);
2064
2065/* Part Assemblies, AMR, Slide Surfaces, Nodesets and Other Arbitrary Mesh Subsets */
2066SILO_API extern void                   DBPrintMrgtree(DBmrgtnode *tnode, int walk_order, void *data);
2067SILO_API extern void                   DBLinearizeMrgtree(DBmrgtnode *tnode, int walk_order, void *data);
2068SILO_API extern void                   DBWalkMrgtree(DBmrgtree const *tree, DBmrgwalkcb cb, void *wdata, int traversal_order);
2069SILO_API extern DBmrgtree *            DBMakeMrgtree(int source_mesh_type, int mrgtree_info, int max_root_descendents,
2070                                           DBoptlist *opts);
2071SILO_API extern int                    DBAddRegion(DBmrgtree *tree, char const *region_name, int type_info_bits,
2072                                           int max_descendents, char const *maps_name, int nsegs, int const *seg_ids,
2073                                           int const *seg_sizes, int const *seg_types, DBoptlist const *opts);
2074SILO_API extern int                    DBAddRegionArray(DBmrgtree *tree, int nregn, char const * const *regn_names,
2075                                           int type_info_bits, char const *maps_name, int nsegs, int const *seg_ids,
2076                                           int const *seg_sizes, int const *seg_types, DBoptlist const *opts);
2077SILO_API extern int                    DBSetCwr(DBmrgtree *tree, char const *path);
2078SILO_API extern char const *           DBGetCwr(DBmrgtree *tree);
2079SILO_API extern int                    DBPutMrgtree(DBfile *dbfile, char const *mrg_tree_name, char const *mesh_name,
2080                                           DBmrgtree const *tree, DBoptlist const *opts);
2081SILO_API extern int                    DBPutMrgvar(DBfile *dbfile, char const *name, char const *mrgt_name,
2082			                   int ncomps, char const * const *compnames, int nregns,
2083                                           char const * const *reg_pnames, int datatype, DBVCP2_t data,
2084                                           DBoptlist const *opts);
2085SILO_API extern int                    DBPutGroupelmap(DBfile *dbfile, char const *map_name, int num_segments,
2086                                           int const *groupel_types, int const *segment_lengths, int const *segment_ids,
2087                                           int const * const *segment_data, DBVCP2_t segment_fracs,
2088                                           int fracs_data_type, DBoptlist const *opts);
2089SILO_API extern DBmrgtree *            DBGetMrgtree(DBfile *dbfile, char const *mrg_tree_name);
2090SILO_API extern DBgroupelmap *         DBGetGroupelmap(DBfile *dbfile, char const *name);
2091SILO_API extern DBmrgvar *             DBGetMrgvar(DBfile *dbfile, char const *name);
2092SILO_API extern DBnamescheme *         DBMakeNamescheme(char const *fmt, ...);
2093SILO_API extern char const *           DBGetName(DBnamescheme const *ns, int natnum);
2094
2095/* Multi-block objects and parallel I/O */
2096SILO_API extern DBmultimesh *          DBGetMultimesh(DBfile *, char const *);
2097SILO_API extern DBmultimeshadj *       DBGetMultimeshadj(DBfile *, char const *, int, int const *);
2098SILO_API extern DBmultivar *           DBGetMultivar(DBfile *, char const *);
2099SILO_API extern DBmultimat *           DBGetMultimat(DBfile *, char const *);
2100SILO_API extern DBmultimatspecies *    DBGetMultimatspecies(DBfile *, char const *);
2101SILO_API extern int                    DBPutMultimesh(DBfile *, char const *, int, char const * const *, int const *,
2102                                           DBoptlist const *);
2103SILO_API extern int                    DBPutMultimeshadj(DBfile *, char const *, int, int const *, int const *,
2104                                           int const *, int const *, int const *, int const * const *, int const *,
2105                                           int const * const *, DBoptlist const *optlist);
2106SILO_API extern int                    DBPutMultivar(DBfile *, char const *, int, char const * const *, int const *,
2107                                           DBoptlist const *);
2108SILO_API extern int                    DBPutMultimat(DBfile *, char const *, int, char const * const *, DBoptlist const *);
2109SILO_API extern int                    DBPutMultimatspecies(DBfile *, char const *, int, char const * const *, DBoptlist const *);
2110
2111/* Option lists */
2112SILO_API extern DBoptlist *            DBMakeOptlist(int);
2113SILO_API extern int                    DBClearOptlist(DBoptlist *);
2114SILO_API extern int                    DBFreeOptlist(DBoptlist *);
2115SILO_API extern int                    DBAddOption(DBoptlist *, int, void *);
2116SILO_API extern void *                 DBGetOption(DBoptlist const *, int);
2117SILO_API extern int                    DBClearOption(DBoptlist *, int);
2118
2119/* Calculational and Utility methods */
2120SILO_API extern int                    DBAnnotateUcdmesh(DBucdmesh *);
2121SILO_API extern DBfacelist *           DBCalcExternalFacelist(int *, int, int, int *, int *, int, int *, int);
2122SILO_API extern DBfacelist *           DBCalcExternalFacelist2(int *, int, int, int, int, int *, int *, int *, int, int *, int);
2123SILO_API extern char *                 DBJoinPath(char const *, char const *);
2124SILO_API extern void                   DBStringArrayToStringList(char const * const *strArray, int n, char **strList, int *m);
2125SILO_API extern char **                DBStringListToStringArray(char const *strList, int *n, int skipSemicolonAtIndexZero);
2126SILO_API extern int                    DBIsDifferentDouble(double a, double b, double abstol, double reltol, double reltol_eps);
2127SILO_API extern int                    DBIsDifferentLongLong(long long a, long long b, double abstol, double reltol, double reltol_eps);
2128
2129/* Fortran interface functions */
2130SILO_API extern void *                 DBFortranAccessPointer(int value);
2131SILO_API extern int                    DBFortranAllocPointer(void *pointer);
2132SILO_API extern void                   DBFortranRemovePointer(int value);
2133SILO_API extern char *                 _db_safe_strdup(const char *);
2134
2135#ifdef __cplusplus
2136}
2137#endif
2138
2139#undef NO_FORTRAN_DEFINE
2140#endif /* !SILO_H */
2141