1 /* 2 Copyright (c) 1994 - 2010, Lawrence Livermore National Security, LLC. 3 LLNL-CODE-425250. 4 All rights reserved. 5 6 This file is part of Silo. For details, see silo.llnl.gov. 7 8 Redistribution and use in source and binary forms, with or without 9 modification, are permitted provided that the following conditions 10 are 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 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 26 LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 27 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 35 This work was produced at Lawrence Livermore National Laboratory under 36 Contract No. DE-AC52-07NA27344 with the DOE. 37 38 Neither the United States Government nor Lawrence Livermore National 39 Security, LLC nor any of their employees, makes any warranty, express 40 or implied, or assumes any liability or responsibility for the 41 accuracy, completeness, or usefulness of any information, apparatus, 42 product, or process disclosed, or represents that its use would not 43 infringe privately-owned rights. 44 45 Any reference herein to any specific commercial products, process, or 46 services by trade name, trademark, manufacturer or otherwise does not 47 necessarily constitute or imply its endorsement, recommendation, or 48 favoring by the United States Government or Lawrence Livermore 49 National Security, LLC. The views and opinions of authors expressed 50 herein do not necessarily state or reflect those of the United States 51 Government or Lawrence Livermore National Security, LLC, and shall not 52 be used for advertising or product endorsement purposes. 53 */ 54 /* 55 * Programmer: Robb Matzke <robb@arborea.spizella.com> 56 * Tuesday, February 9, 1999 57 */ 58 #ifndef SILO_DRIVERS_H 59 #define SILO_DRIVERS_H 60 61 62 /* 63 * SILO drivers header file. 64 * 65 * This file contains the definitions for SILO drivers and should be included 66 * by every SILO source file that defines DB_MAIN. 67 * 68 * Normally, programs cannot tell if a particular driver is defined by just 69 * including silo.h. To determine if a driver is defined, include this file. 70 */ 71 #include "config.h" /* Included for driver tests */ 72 #include "silo.h" 73 74 /* 75 * Get rid of the driver definitions from silo.h so that we can define the 76 * actual drivers. 77 */ 78 #undef DB_NETCDF 79 #undef DB_PDB 80 #undef DB_PDBP 81 #undef DB_TAURUS 82 #undef DB_UNKNOWN 83 #undef DB_DEBUG 84 #undef DB_HDF5X 85 86 /* Now set up the real driver definitions. */ 87 #ifdef HAVE_NETCDF_DRIVER 88 # define DB_NETCDF 89 #endif 90 #ifdef HAVE_PDB_DRIVER 91 # define DB_PDB 92 #endif 93 #ifdef HAVE_PDBP_DRIVER 94 # define DB_PDBP 95 #endif 96 #ifdef HAVE_TAURUS_DRIVER 97 # define DB_TAURUS 98 #endif 99 #define DB_UNKNOWN 100 #define DB_DEBUG 101 #ifdef HAVE_HDF5_DRIVER 102 # define DB_HDF5X 103 #endif 104 105 /*------------------------------------------------------------------------- 106 * Conditionally include definitions for the file formats that the application 107 * is about to use. As we include the format header files, we should make 108 * sure that the file format constant is properly defined. Each file format 109 * should be given a unique small integer that will be used as an index into 110 * an array. If a new file format is added, be sure to increment the value 111 * of DB_NFORMATS. 112 * 113 * Don't use slot `1' of these arrays as that reduces the error checking if 114 * the user doesn't spell the format name correctly. 115 * 116 * Anyone can change this info as long as the DB_NFORMATS constant doesn't 117 * change. If anything else changes, the silo library must be recompiled. 118 * 119 * Opening a database file of type DB_UNKNOWN will try to open the database 120 * file with each driver that is defined beginning with the lowest numbered 121 * driver. Therefore, the most specific drivers should be listed first. 122 *------------------------------------------------------------------------- 123 */ 124 #ifdef DB_NETCDF 125 #undef DB_NETCDF 126 #define DB_NETCDF 0 127 #define DB_NETCDF_OPEN db_cdf_Open 128 #define DB_NETCDF_CREATE NULL 129 #define DB_NETCDF_FSINGLE db_cdf_ForceSingle 130 131 extern DBfile *db_cdf_Open(char const *, int, int); 132 extern int db_cdf_ForceSingle(int); 133 134 #else 135 #define DB_NETCDF_OPEN NULL 136 #define DB_NETCDF_CREATE NULL 137 #define DB_NETCDF_FSINGLE NULL 138 #endif 139 140 /* Slot 1 is for PDB Proper */ 141 #ifdef DB_PDBP 142 #undef DB_PDBP 143 #define DB_PDBP 1 144 #define DB_PDBP_OPEN db_pdbp_Open 145 #define DB_PDBP_CREATE db_pdbp_Create 146 #define DB_PDBP_FSINGLE db_pdbp_ForceSingle 147 148 extern DBfile *db_pdbp_Open(char const *, int, int); 149 extern DBfile *db_pdbp_Create(char const *, int, int, int, char const *); 150 extern int db_pdbp_ForceSingle(int); 151 152 #else 153 #define DB_PDBP_OPEN NULL 154 #define DB_PDBP_CREATE NULL 155 #define DB_PDBP_FSINGLE NULL 156 #endif 157 158 /* Slot 2 is PDB Lite */ 159 #ifdef DB_PDB 160 #undef DB_PDB 161 #define DB_PDB 2 162 #define DB_PDB_OPEN db_pdb_Open 163 #define DB_PDB_CREATE db_pdb_Create 164 #define DB_PDB_FSINGLE db_pdb_ForceSingle 165 166 extern DBfile *db_pdb_Open(char const *, int, int); 167 extern DBfile *db_pdb_Create(char const *, int, int, int, char const *); 168 extern int db_pdb_ForceSingle(int); 169 170 #else 171 #define DB_PDB_OPEN NULL 172 #define DB_PDB_CREATE NULL 173 #define DB_PDB_FSINGLE NULL 174 #endif 175 176 #ifdef DB_TAURUS 177 #undef DB_TAURUS 178 #define DB_TAURUS 3 179 #define DB_TAURUS_OPEN db_taur_Open 180 #define DB_TAURUS_CREATE NULL 181 #define DB_TAURUS_FSINGLE NULL 182 183 extern DBfile *db_taur_Open(char const *, int, int); 184 185 #else 186 #define DB_TAURUS_OPEN NULL 187 #define DB_TAURUS_CREATE NULL 188 #define DB_TAURUS_FSINGLE NULL 189 #endif 190 191 #ifdef DB_UNKNOWN /*For opening files of unknown type */ 192 #undef DB_UNKNOWN 193 #define DB_UNKNOWN 5 194 #define DB_UNKNOWN_OPEN db_unk_Open 195 #define DB_UNKNOWN_CREATE NULL 196 #define DB_UNKNOWN_FSINGLE NULL 197 198 extern DBfile *db_unk_Open(char const *, int, int); 199 200 #else 201 #define DB_UNKNOWN_OPEN NULL 202 #define DB_UNKNOWN_CREATE NULL 203 #define DB_UNKNOWN_FSINGLE NULL 204 #endif 205 206 #ifdef DB_DEBUG /*A Demo */ 207 #undef DB_DEBUG 208 #define DB_DEBUG 6 209 #define DB_DEBUG_OPEN db_debug_open 210 #define DB_DEBUG_CREATE db_debug_create 211 #define DB_DEBUG_FSINGLE NULL 212 213 extern DBfile *db_debug_open(char const *, int, int); 214 extern DBfile *db_debug_create(char const *, int, int, int, char const *); 215 216 #else 217 #define DB_DEBUG_OPEN NULL 218 #define DB_DEBUG_CREATE NULL 219 #define DB_DEBUG_FSINGLE NULL 220 #endif 221 222 #ifdef DB_HDF5X 223 #undef DB_HDF5X 224 #define DB_HDF5X 7 225 #define DB_HDF5_OPEN db_hdf5_Open 226 #define DB_HDF5_CREATE db_hdf5_Create 227 #define DB_HDF5_FSINGLE db_hdf5_ForceSingle 228 229 extern DBfile *db_hdf5_Open(char const *, int, int); 230 extern DBfile *db_hdf5_Create(char const *, int, int, int, char const *); 231 extern int db_hdf5_ForceSingle(int); 232 233 #else 234 #define DB_HDF5_OPEN NULL 235 #define DB_HDF5_CREATE NULL 236 #define DB_HDF5_FSINGLE NULL 237 #endif 238 239 /* 240 * If DB_NFORMATS is changed, the silo library must be recompiled! 241 */ 242 #define DB_NFORMATS 10 /*Total number of file formats */ 243 244 #ifdef DB_MAIN 245 /*------------------------------------------------------------------------- 246 * The DBOpen and DBCreate functions/macros reference global variables 247 * DBOpenCB and DBCreateCB which are arrays of pointers to open and 248 * create functions for the various file types. 249 * 250 * The items in this array must be listed in order of file format type, 251 * since the file format type will be used to index the array. 252 *------------------------------------------------------------------------- 253 */ 254 #define DBOPENCB {DB_NETCDF_OPEN, \ 255 DB_PDBP_OPEN, \ 256 DB_PDB_OPEN, \ 257 DB_TAURUS_OPEN, \ 258 NULL, /*unused*/\ 259 DB_UNKNOWN_OPEN, \ 260 DB_DEBUG_OPEN, \ 261 DB_HDF5_OPEN, \ 262 NULL, /*unused*/\ 263 NULL} /*unused*/ 264 265 #define DBCREATECB {DB_NETCDF_CREATE, \ 266 DB_PDBP_CREATE, \ 267 DB_PDB_CREATE, \ 268 DB_TAURUS_CREATE, \ 269 NULL, /*unused*/\ 270 DB_UNKNOWN_CREATE, \ 271 DB_DEBUG_CREATE, \ 272 DB_HDF5_CREATE, \ 273 NULL, /*unused*/\ 274 NULL} /*unused*/ 275 276 #define DBFSINGLECB {DB_NETCDF_FSINGLE, \ 277 DB_PDBP_FSINGLE, \ 278 DB_PDB_FSINGLE, \ 279 DB_TAURUS_FSINGLE, \ 280 NULL, /*unused*/\ 281 DB_UNKNOWN_FSINGLE, \ 282 DB_DEBUG_FSINGLE, \ 283 DB_HDF5_FSINGLE, \ 284 NULL, /*unused*/\ 285 NULL} /*unused*/ 286 287 DBfile *(*DBOpenCB[DB_NFORMATS]) (char const *, int, int) = DBOPENCB; 288 DBfile *(*DBCreateCB[DB_NFORMATS]) (char const *, int, int, int, char const *) = DBCREATECB; 289 int (*DBFSingleCB[DB_NFORMATS]) (int) = DBFSINGLECB; 290 #endif /* DB_MAIN */ 291 292 #endif /* !SILO_DRIVERS_H */ 293