MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
testNSDF.cpp
Go to the documentation of this file.
1 // testNSDF.cpp ---
2 //
3 // Filename: testNSDF.cpp
4 // Description:
5 // Author: subha
6 // Maintainer:
7 // Created: Tue Aug 25 22:36:07 2015 (-0400)
8 // Version:
9 // Last-Updated: Sat Aug 29 12:34:08 2015 (-0400)
10 // By: subha
11 // Update #: 43
12 // URL:
13 // Keywords:
14 // Compatibility:
15 //
16 //
17 
18 // Commentary:
19 //
20 //
21 //
22 //
23 
24 // Change log:
25 //
26 //
27 //
28 //
29 // This program is free software; you can redistribute it and/or
30 // modify it under the terms of the GNU General Public License as
31 // published by the Free Software Foundation; either version 3, or
32 // (at your option) any later version.
33 //
34 // This program is distributed in the hope that it will be useful,
35 // but WITHOUT ANY WARRANTY; without even the implied warranty of
36 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37 // General Public License for more details.
38 //
39 // You should have received a copy of the GNU General Public License
40 // along with this program; see the file COPYING. If not, write to
41 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth
42 // Floor, Boston, MA 02110-1301, USA.
43 //
44 //
45 
46 // Code:
47 
48 #ifdef USE_HDF5
49 
50 #include "hdf5.h"
51 #include "hdf5_hl.h"
52 
53 #include <ctime>
54 #include <deque>
55 #include <cstdio>
56 
57 #include "header.h"
58 #include "../utility/utility.h"
59 
60 #include "HDF5WriterBase.h"
61 #include "HDF5DataWriter.h"
62 
63 #include "NSDFWriter.h"
64 #include "InputVariable.h"
65 
66 #define STR_DSET_NAME "vlenstr_dset"
67 #define STR_DSET_LEN 4
68 
70 {
71  const char * data[STR_DSET_LEN] = {"You have to", "live", "life", "to the limit"};
72  hid_t file, memtype, dset;
73  hsize_t size = STR_DSET_LEN;
74  herr_t status;
75  HDF5WriterBase writer;
76  string h5Filename = moose::random_string( 10 );
77  file = H5Fcreate(h5Filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
78  dset = writer.createStringDataset(file, STR_DSET_NAME, size, size);
79  assert(dset >= 0);
80  memtype = H5Tcopy(H5T_C_S1);
81  status = H5Tset_size(memtype, H5T_VARIABLE);
82  assert(status >= 0);
83  status = H5Dwrite(dset, memtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
84  assert(status >= 0);
85  status = H5Dclose(dset);
86  H5Tclose(memtype);
87  H5Fclose(file);
88 }
89 
90 #else // dummy function
92 {
93  ;
94 }
95 #endif // USE_HDF5
96 
97 void testNSDF()
98 {
100 }
101 
102 //
103 // testNSDF.cpp ends here
void testNSDF()
Definition: testNSDF.cpp:97
void testCreateStringDataset()
Definition: testNSDF.cpp:91
string random_string(const unsigned len)
Definition: strutil.cpp:162