![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006-2012, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 #ifndef O2SCL_HDF_IO_H 00024 #define O2SCL_HDF_IO_H 00025 00026 /** \file hdf_io.h 00027 \brief File for HDF I/O for \ref table and \ref table3d 00028 */ 00029 00030 #include <hdf5.h> 00031 00032 #include <o2scl/table.h> 00033 #include <o2scl/table_units.h> 00034 #include <o2scl/table3d.h> 00035 #include <o2scl/constants.h> 00036 #include <o2scl/hist.h> 00037 #include <o2scl/hist_2d.h> 00038 #include <o2scl/tensor.h> 00039 00040 #include <o2scl/hdf_file.h> 00041 00042 #ifndef DOXYGENP 00043 namespace o2scl_hdf { 00044 #endif 00045 00046 /// Output a \ref table to a HDF file 00047 int hdf_output(hdf_file &hf, const o2scl::table &t, std::string name); 00048 00049 /// Input a \ref table from a HDF file 00050 int hdf_input(hdf_file &hf, o2scl::table &t, std::string name=""); 00051 00052 /** \brief Output a \ref table_units to a HDF file 00053 00054 The unit conversion object, as specified in \ref 00055 table_units::set_convert() is not written to the HDF file. Thus 00056 when a \ref table_units object is read from a file, it always 00057 uses the default unit conversion object. 00058 */ 00059 int hdf_output(hdf_file &hf, const o2scl::table_units &t, std::string name); 00060 00061 /** \brief Input a \ref table_units from a HDF file 00062 00063 The unit conversion object, as specified in \ref 00064 table_units::set_convert() is not written to the HDF file. Thus 00065 when a \ref table_units object is read from a file, it always 00066 uses the default unit conversion object. 00067 */ 00068 int hdf_input(hdf_file &hf, o2scl::table_units &t, std::string name=""); 00069 00070 /// Output a \ref table3d to a HDF file 00071 int hdf_output(hdf_file &hf, const o2scl::table3d &t, std::string name); 00072 00073 /// Input a \ref table3d from a HDF file 00074 int hdf_input(hdf_file &hf, o2scl::table3d &t, std::string name=""); 00075 00076 /// Output a \ref hist to a HDF file 00077 int hdf_output(hdf_file &hf, const o2scl::hist &t, std::string name); 00078 00079 /// Input a \ref hist from a HDF file 00080 int hdf_input(hdf_file &hf, o2scl::hist &t, std::string name=""); 00081 00082 /// Output a \ref hist_2d to a HDF file 00083 int hdf_output(hdf_file &hf, const o2scl::hist_2d &t, std::string name); 00084 00085 /// Input a \ref hist_2d from a HDF file 00086 int hdf_input(hdf_file &hf, o2scl::hist_2d &t, std::string name=""); 00087 00088 /// Output a \ref tensor to a HDF file 00089 int hdf_output(hdf_file &hf, const o2scl::tensor &t, std::string name); 00090 00091 /// Input a \ref tensor from a HDF file 00092 int hdf_input(hdf_file &hf, o2scl::tensor &t, std::string name=""); 00093 00094 /// Output a \ref tensor to a HDF file 00095 int hdf_output(hdf_file &hf, const o2scl::tensor_grid &t, std::string name); 00096 00097 /// Input a \ref tensor from a HDF file 00098 int hdf_input(hdf_file &hf, o2scl::tensor_grid &t, std::string name=""); 00099 00100 /// \name Helper struct and functions 00101 //@{ 00102 /// A structure to pass information to and from \ref iterate_func() 00103 typedef struct { 00104 hdf_file *hf; 00105 std::string type; 00106 std::string group_name; 00107 bool found; 00108 int verbose; 00109 } iterate_parms; 00110 00111 /** \brief Look at location \c loc in an HDF file for an \o2 object 00112 00113 This is used by \ref find_group_by_type() where \c op_data 00114 is a pointer to an object of type \ref iterate_parms to 00115 look for \o2 objects of a specified type without knowing 00116 the group name. 00117 */ 00118 int iterate_func(hid_t loc, const char *name, 00119 const H5L_info_t *inf, void *op_data); 00120 00121 /** \brief Look in hdf_file \c hf for an \o2 object of type \c type and 00122 if found, set \c group_name to the associated object name 00123 00124 This function returns 1 if an object of type \c type is found 00125 and 0 if it fails. 00126 */ 00127 int find_group_by_type(hdf_file &hf, std::string type, 00128 std::string &group_name, int verbose=0); 00129 //@} 00130 00131 00132 #ifndef DOXYGENP 00133 } 00134 #endif 00135 00136 #endif 00137 00138
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).