aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorcott <>2004-03-08 08:43:00 +0000
committercott <>2004-03-08 08:43:00 +0000
commit53df5b7081780804b000d44035b569258c23ef97 (patch)
tree1976ddcdc8035c0563cf2c30a3e2144a122fba2d /Carpet
parentadfbe993de5b7887321d08eee9a8dc2954202228 (diff)
Some cleaning up: Moved auxiliary functions (Read/WriteAttribute and others) to their own file to keep iohdf5.cc short.
darcs-hash:20040308084341-19929-cd1956912296b38a265e12a59fb26cd02e5c48aa.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOHDF5/src/iohdf5.cc408
-rw-r--r--Carpet/CarpetIOHDF5/src/iohdf5.hh30
-rw-r--r--Carpet/CarpetIOHDF5/src/iohdf5utils.cc191
-rw-r--r--Carpet/CarpetIOHDF5/src/make.code.defn4
4 files changed, 78 insertions, 555 deletions
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5.cc b/Carpet/CarpetIOHDF5/src/iohdf5.cc
index c8ee21664..f8ba7a252 100644
--- a/Carpet/CarpetIOHDF5/src/iohdf5.cc
+++ b/Carpet/CarpetIOHDF5/src/iohdf5.cc
@@ -17,7 +17,7 @@
#include "cctk_Parameters.h"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.cc,v 1.3 2004/03/08 09:09:32 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.cc,v 1.4 2004/03/08 09:43:41 cott Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOHDF5_iohdf5_cc);
}
@@ -50,33 +50,6 @@ namespace CarpetIOHDF5 {
vector<vector<vector<int> > > last_output; // [ml][rl][var]
-
- const char* GetStringParameter (const char* const parametername,
- const char* const fallback);
- int GetIntParameter (const char* const parametername, int fallback);
-
- bool CheckForVariable (const cGH* const cctkGH,
- const char* const varlist, const int vindex);
- void SetFlag (int index, const char* optstring, void* arg);
-
- void WriteAttribute (const hid_t dataset, const char* name, int value);
- void WriteAttribute (const hid_t dataset, const char* name, const int* values, int nvalues);
- void WriteAttribute (const hid_t dataset, const char* name, double value);
- void WriteAttribute (const hid_t dataset, const char* name, const double* values, int nvalues);
- void WriteAttribute (const hid_t dataset, const char* name, char value);
- void WriteAttribute (const hid_t dataset, const char* name, const char* values);
- void WriteAttribute (const hid_t dataset, const char* name, const char* values, int nvalues);
-
- int ReadAttribute (const hid_t dataset, const char* name, int& value);
- int ReadAttribute (const hid_t dataset, const char* name, int* values, int nvalues);
- int ReadAttribute (const hid_t dataset, const char* name, double& value);
- int ReadAttribute (const hid_t dataset, const char* name, double* values, int nvalues);
- int ReadAttribute (const hid_t dataset, const char* name, char& value);
- int ReadAttribute (const hid_t dataset, const char* name, char*& values);
- int ReadAttribute (const hid_t dataset, const char* name, char* values, int nvalues);
-
-
-
int CarpetIOHDF5Startup ()
{
int ierr;
@@ -838,383 +811,4 @@ namespace CarpetIOHDF5 {
#endif
-
- const char* GetStringParameter (const char* const parametername,
- const char* const fallback)
- {
- if (CCTK_ParameterQueryTimesSet (parametername, CCTK_THORNSTRING) > 0) {
- int ptype;
- const char* const* const ppval = (const char* const*)CCTK_ParameterGet
- (parametername, CCTK_THORNSTRING, &ptype);
- assert (ppval);
- const char* const pval = *ppval;
- assert (ptype == PARAMETER_STRING);
- return pval;
- }
-
- return fallback;
- }
-
-
-
- int GetIntParameter (const char* const parametername, int fallback)
- {
- if (CCTK_ParameterQueryTimesSet (parametername, CCTK_THORNSTRING) > 0) {
- int ptype;
- const int* const ppval = (const int*)CCTK_ParameterGet
- (parametername, CCTK_THORNSTRING, &ptype);
- assert (ppval);
- const int pval = *ppval;
- assert (ptype == PARAMETER_INT);
- return pval;
- }
-
- return fallback;
- }
-
-
-
- bool CheckForVariable (const cGH* const cctkGH,
- const char* const varlist, const int vindex)
- {
- const int numvars = CCTK_NumVars();
- assert (vindex>=0 && vindex<numvars);
-
- vector<bool> flags(numvars);
-
- CCTK_TraverseString (varlist, SetFlag, &flags, CCTK_GROUP_OR_VAR);
-
- return flags.at(vindex);
- }
-
- void SetFlag (int index, const char* optstring, void* arg)
- {
- vector<bool>& flags = *(vector<bool>*)arg;
- flags.at(index) = true;
- }
-
-
-
- void WriteAttribute (const hid_t dataset, const char* const name, const int value)
- {
- WriteAttribute (dataset, name, &value, 1);
- }
-
- void WriteAttribute (const hid_t dataset, const char* const name, const int* const values, const int nvalues)
- {
- assert (dataset>=0);
- assert (name);
- assert (values);
- assert (nvalues>=0);
-
- herr_t herr;
-
- hsize_t shape[1];
- shape[0] = nvalues;
- const hid_t dataspace = nvalues==1 ? H5Screate (H5S_SCALAR) : H5Screate_simple (1, shape, NULL);
- assert (dataspace>=0);
-
- const hid_t datatype = H5T_NATIVE_INT;
-
- const hid_t attribute = H5Acreate (dataset, name, datatype, dataspace, H5P_DEFAULT);
- assert (attribute>=0);
- herr = H5Awrite (attribute, datatype, values);
- assert (!herr);
- herr = H5Aclose (attribute);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
- }
-
-
-
- void WriteAttribute (const hid_t dataset, const char* const name, const double value)
- {
- WriteAttribute (dataset, name, &value, 1);
- }
-
- void WriteAttribute (const hid_t dataset, const char* const name, const double* const values, const int nvalues)
- {
- assert (dataset>=0);
- assert (name);
- assert (values);
- assert (nvalues>=0);
-
- herr_t herr;
-
- hsize_t shape[1];
- shape[0] = nvalues;
- const hid_t dataspace = nvalues==1 ? H5Screate (H5S_SCALAR) : H5Screate_simple (1, shape, NULL);
- assert (dataspace>=0);
-
- const hid_t datatype = H5T_NATIVE_DOUBLE;
-
- const hid_t attribute = H5Acreate (dataset, name, datatype, dataspace, H5P_DEFAULT);
- assert (attribute>=0);
- herr = H5Awrite (attribute, datatype, values);
- assert (!herr);
- herr = H5Aclose (attribute);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
- }
-
-
-
- void WriteAttribute (const hid_t dataset, const char* const name, const char value)
- {
- WriteAttribute (dataset, name, &value, 1);
- }
-
- void WriteAttribute (const hid_t dataset, const char* const name, const char* const values)
- {
- WriteAttribute (dataset, name, values, strlen(values));
- }
-
- void WriteAttribute (const hid_t dataset, const char* const name, const char* const values, const int nvalues)
- {
- assert (dataset>=0);
- assert (name);
- assert (values);
- assert (nvalues>=0);
-
- herr_t herr;
-
- const hid_t dataspace = H5Screate (H5S_SCALAR);
- assert (dataspace>=0);
-
- const hid_t datatype = H5Tcopy (H5T_C_S1);
- assert (datatype>=0);
- herr = H5Tset_size (datatype, nvalues);
- assert (!herr);
-
- const hid_t attribute = H5Acreate (dataset, name, datatype, dataspace, H5P_DEFAULT);
- assert (attribute>=0);
- herr = H5Awrite (attribute, datatype, values);
- assert (!herr);
- herr = H5Aclose (attribute);
- assert (!herr);
-
- herr = H5Tclose (datatype);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
- }
-
-
-
- int ReadAttribute (const hid_t dataset, const char* const name, int& value)
- {
- return ReadAttribute (dataset, name, &value, 1);
- }
-
- int ReadAttribute (const hid_t dataset, const char* name, int* const values, const int nvalues)
- {
- assert (dataset>=0);
- assert (name);
- assert (values);
- assert (nvalues>=0);
-
- herr_t herr;
-
- const hid_t attribute = H5Aopen_name (dataset, name);
- if (attribute<0) return attribute;
-
- const hid_t dataspace = H5Aget_space (attribute);
- assert (dataspace>=0);
-
- hsize_t rank = H5Sget_simple_extent_ndims (dataspace);
- hsize_t shape[1];
- if (rank==0) {
- shape[0] = 1;
- } else if (rank==1) {
- herr = H5Sget_simple_extent_dims (dataspace, shape, NULL);
- assert (!herr);
- } else {
- assert (0);
- }
- const int length = shape[0];
-
- const hid_t datatype = H5Aget_type (attribute);
- assert (datatype>=0);
- if (datatype != H5T_NATIVE_INT) return -100;
-
- vector<int> values1(length);
-
- herr = H5Aread (attribute, datatype, &values1.at(0));
- assert (!herr);
-
- for (int i=0; i<min(length, nvalues); ++i) {
- values[i] = values1[i];
- }
-
- herr = H5Tclose (datatype);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
-
- herr = H5Aclose (attribute);
- assert (!herr);
-
- return length;
- }
-
-
-
- int ReadAttribute (const hid_t dataset, const char* const name, double& value)
- {
- return ReadAttribute (dataset, name, &value, 1);
- }
-
- int ReadAttribute (const hid_t dataset, const char* const name, double* const values, const int nvalues)
- {
- assert (dataset>=0);
- assert (name);
- assert (values);
- assert (nvalues>=0);
-
- herr_t herr;
-
- const hid_t attribute = H5Aopen_name (dataset, name);
- if (attribute<0) return attribute;
-
- const hid_t dataspace = H5Aget_space (attribute);
- assert (dataspace>=0);
-
- hsize_t rank = H5Sget_simple_extent_ndims (dataspace);
- hsize_t shape[1];
- if (rank==0) {
- shape[0] = 1;
- } else if (rank==1) {
- herr = H5Sget_simple_extent_dims (dataspace, shape, NULL);
- assert (!herr);
- } else {
- assert (0);
- }
- const int length = shape[0];
-
- const hid_t datatype = H5Aget_type (attribute);
- assert (datatype>=0);
- if (datatype != H5T_NATIVE_DOUBLE) return -100;
-
- vector<double> values1(length);
-
- herr = H5Aread (attribute, datatype, &values1.at(0));
- assert (!herr);
-
- for (int i=0; i<min(length, nvalues); ++i) {
- values[i] = values1[i];
- }
-
- herr = H5Tclose (datatype);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
-
- herr = H5Aclose (attribute);
- assert (!herr);
-
- return length;
- }
-
-
-
- int ReadAttribute (const hid_t dataset, const char* const name, char& value)
- {
- return ReadAttribute (dataset, name, &value, 1);
- }
-
- int ReadAttribute (const hid_t dataset, const char* const name, char*& values)
- {
- assert (dataset>=0);
- assert (name);
-
- herr_t herr;
-
- const hid_t attribute = H5Aopen_name (dataset, name);
- if (attribute<0) return attribute;
-
- const hid_t dataspace = H5Aget_space (attribute);
- assert (dataspace>=0);
-
- hsize_t rank = H5Sget_simple_extent_ndims (dataspace);
- assert (rank==0);
-
- const hid_t datatype = H5Aget_type (attribute);
- assert (datatype>=0);
- if (H5Tget_class (datatype) != H5T_STRING) return -100;
- const int length = H5Tget_size (datatype);
- assert (length>=0);
-
- values = (char*) malloc (length+1);
- assert (values);
-
- herr = H5Aread (attribute, datatype, values);
- assert (!herr);
- values[length] = '\0';
-
- herr = H5Tclose (datatype);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
-
- herr = H5Aclose (attribute);
- assert (!herr);
-
- return length;
- }
-
- int ReadAttribute (const hid_t dataset, const char* const name, char* const values, const int nvalues)
- {
- assert (dataset>=0);
- assert (name);
- assert (values);
- assert (nvalues>=0);
-
- herr_t herr;
-
- const hid_t attribute = H5Aopen_name (dataset, name);
- if (attribute<0) return attribute;
-
- const hid_t dataspace = H5Aget_space (attribute);
- assert (dataspace>=0);
-
- hsize_t rank = H5Sget_simple_extent_ndims (dataspace);
- assert (rank==0);
-
- const hid_t datatype = H5Aget_type (attribute);
- assert (datatype>=0);
- if (H5Tget_class (datatype) != H5T_STRING) return -100;
- const int length = H5Tget_size (datatype);
- assert (length>=0);
-
- vector<char> values1(length);
-
- herr = H5Aread (attribute, datatype, &values1.at(0));
- assert (!herr);
-
- for (int i=0; i<min(length, nvalues); ++i) {
- values[i] = values1[i];
- }
-
- herr = H5Tclose (datatype);
- assert (!herr);
-
- herr = H5Sclose (dataspace);
- assert (!herr);
-
- herr = H5Aclose (attribute);
- assert (!herr);
-
- return length;
- }
-
-
-
} // namespace CarpetIOHDF5
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5.hh b/Carpet/CarpetIOHDF5/src/iohdf5.hh
index d3a377346..2bbec776d 100644
--- a/Carpet/CarpetIOHDF5/src/iohdf5.hh
+++ b/Carpet/CarpetIOHDF5/src/iohdf5.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.hh,v 1.1 2004/03/03 09:44:26 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.hh,v 1.2 2004/03/08 09:43:41 cott Exp $
#ifndef CARPETIOHDF5_HH
#define CARPETIOHDF5_HH
@@ -34,6 +34,34 @@ namespace CarpetIOHDF5 {
int Recover (cGH* const cctkGH, const char *basefilename,
const int called_from);
+
+ // auxiliary functions defined in iohdf5utils.cc
+
+ const char* GetStringParameter (const char* const parametername,
+ const char* const fallback);
+ int GetIntParameter (const char* const parametername, int fallback);
+
+ bool CheckForVariable (const cGH* const cctkGH,
+ const char* const varlist, const int vindex);
+ void SetFlag (int index, const char* optstring, void* arg);
+
+ void WriteAttribute (const hid_t dataset, const char* name, int value);
+ void WriteAttribute (const hid_t dataset, const char* name, const int* values, int nvalues);
+ void WriteAttribute (const hid_t dataset, const char* name, double value);
+ void WriteAttribute (const hid_t dataset, const char* name, const double* values, int nvalues);
+ void WriteAttribute (const hid_t dataset, const char* name, char value);
+ void WriteAttribute (const hid_t dataset, const char* name, const char* values);
+ void WriteAttribute (const hid_t dataset, const char* name, const char* values, int nvalues);
+
+ int ReadAttribute (const hid_t dataset, const char* name, int& value);
+ int ReadAttribute (const hid_t dataset, const char* name, int* values, int nvalues);
+ int ReadAttribute (const hid_t dataset, const char* name, double& value);
+ int ReadAttribute (const hid_t dataset, const char* name, double* values, int nvalues);
+ int ReadAttribute (const hid_t dataset, const char* name, char& value);
+ int ReadAttribute (const hid_t dataset, const char* name, char*& values);
+ int ReadAttribute (const hid_t dataset, const char* name, char* values, int nvalues);
+
+
} // namespace CarpetIOHDF5
#endif // !defined(CARPETIOHDF5_HH)
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5utils.cc b/Carpet/CarpetIOHDF5/src/iohdf5utils.cc
index 5545a3563..d0e00266a 100644
--- a/Carpet/CarpetIOHDF5/src/iohdf5utils.cc
+++ b/Carpet/CarpetIOHDF5/src/iohdf5utils.cc
@@ -17,7 +17,7 @@
#include "cctk_Parameters.h"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5utils.cc,v 1.8 2004/07/07 17:09:17 tradke Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5utils.cc,v 1.1 2004/03/08 09:43:41 cott Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOHDF5_iohdf5utils_cc);
}
@@ -33,7 +33,6 @@ extern "C" {
#include "carpet.hh"
#include "iohdf5.hh"
-#include "iohdf5GH.h"
@@ -42,9 +41,43 @@ namespace CarpetIOHDF5 {
using namespace std;
using namespace Carpet;
+ const char* GetStringParameter (const char* const parametername,
+ const char* const fallback)
+ {
+ if (CCTK_ParameterQueryTimesSet (parametername, CCTK_THORNSTRING) > 0) {
+ int ptype;
+ const char* const* const ppval = (const char* const*)CCTK_ParameterGet
+ (parametername, CCTK_THORNSTRING, &ptype);
+ assert (ppval);
+ const char* const pval = *ppval;
+ assert (ptype == PARAMETER_STRING);
+ return pval;
+ }
+
+ return fallback;
+ }
+
+
+
+ int GetIntParameter (const char* const parametername, int fallback)
+ {
+ if (CCTK_ParameterQueryTimesSet (parametername, CCTK_THORNSTRING) > 0) {
+ int ptype;
+ const int* const ppval = (const int*)CCTK_ParameterGet
+ (parametername, CCTK_THORNSTRING, &ptype);
+ assert (ppval);
+ const int pval = *ppval;
+ assert (ptype == PARAMETER_INT);
+ return pval;
+ }
+
+ return fallback;
+ }
+
- bool CheckForVariable (const char* const varlist, const int vindex)
+ bool CheckForVariable (const cGH* const cctkGH,
+ const char* const varlist, const int vindex)
{
const int numvars = CCTK_NumVars();
assert (vindex>=0 && vindex<numvars);
@@ -56,18 +89,10 @@ namespace CarpetIOHDF5 {
return flags.at(vindex);
}
- void SetFlag (int vindex, const char* optstring, void* arg)
+ void SetFlag (int index, const char* optstring, void* arg)
{
- if (optstring)
- {
- char *fullname = CCTK_FullName (vindex);
- CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Option string '%s' will be ignored for HDF5 output of "
- "variable '%s'", optstring, fullname);
- free (fullname);
- }
vector<bool>& flags = *(vector<bool>*)arg;
- flags.at(vindex) = true;
+ flags.at(index) = true;
}
@@ -203,15 +228,13 @@ namespace CarpetIOHDF5 {
const hid_t dataspace = H5Aget_space (attribute);
assert (dataspace>=0);
- // cout << "reading int attribute " << name << endl;
-
hsize_t rank = H5Sget_simple_extent_ndims (dataspace);
hsize_t shape[1];
if (rank==0) {
shape[0] = 1;
} else if (rank==1) {
herr = H5Sget_simple_extent_dims (dataspace, shape, NULL);
- assert (herr >= 0);
+ assert (!herr);
} else {
assert (0);
}
@@ -219,8 +242,7 @@ namespace CarpetIOHDF5 {
const hid_t datatype = H5Aget_type (attribute);
assert (datatype>=0);
-
- assert(H5Tequal(datatype, H5T_NATIVE_INT));
+ if (datatype != H5T_NATIVE_INT) return -100;
vector<int> values1(length);
@@ -230,7 +252,7 @@ namespace CarpetIOHDF5 {
for (int i=0; i<min(length, nvalues); ++i) {
values[i] = values1[i];
}
-
+
herr = H5Tclose (datatype);
assert (!herr);
@@ -270,8 +292,8 @@ namespace CarpetIOHDF5 {
if (rank==0) {
shape[0] = 1;
} else if (rank==1) {
- rank = H5Sget_simple_extent_dims (dataspace, shape, NULL);
- assert (rank == 1);
+ herr = H5Sget_simple_extent_dims (dataspace, shape, NULL);
+ assert (!herr);
} else {
assert (0);
}
@@ -279,7 +301,7 @@ namespace CarpetIOHDF5 {
const hid_t datatype = H5Aget_type (attribute);
assert (datatype>=0);
- assert(H5Tequal(datatype, H5T_NATIVE_DOUBLE));
+ if (datatype != H5T_NATIVE_DOUBLE) return -100;
vector<double> values1(length);
@@ -327,7 +349,7 @@ namespace CarpetIOHDF5 {
const hid_t datatype = H5Aget_type (attribute);
assert (datatype>=0);
- assert (H5Tget_class (datatype) == H5T_STRING);
+ if (H5Tget_class (datatype) != H5T_STRING) return -100;
const int length = H5Tget_size (datatype);
assert (length>=0);
@@ -370,7 +392,7 @@ namespace CarpetIOHDF5 {
const hid_t datatype = H5Aget_type (attribute);
assert (datatype>=0);
- assert(H5Tget_class (datatype) == H5T_STRING);
+ if (H5Tget_class (datatype) != H5T_STRING) return -100;
const int length = H5Tget_size (datatype);
assert (length>=0);
@@ -394,128 +416,7 @@ namespace CarpetIOHDF5 {
return length;
}
-
- herr_t DatasetCounter(hid_t group_id, const char *member_name, void *operator_data)
- /* Counts datasets. Used by GetnDatasets; straight from John Shalf's FlexIO library */
- {
- int *count = (int*)operator_data;
- H5G_stat_t objinfo;
- // request info about the type of objects in root group
- if(H5Gget_objinfo(group_id,member_name,1 /* follow links */,&objinfo)<0) {
- return 0;
- }
- // only count objects that are datasets (not subgroups)
- if(objinfo.type==H5G_DATASET) {
- (*count)++;
- }
- return 0;
- }
-
-
- int GetnDatasets(const hid_t reader)
- {
- //this is straight from John Shalf's FlexIO library
-
- int count=0;
- int idx=0;
- while(H5Giterate(reader, /* hid_t loc_id, */
- "/", /*const char *name, */
- &idx, /* int *idx, */
- DatasetCounter,
- &count)<0){}
- return count;
- }
-
- struct H5IO_getname_t {
- //this is straight from John Shalf's FlexIO library
- int index,count;
- char *name;
- };
-
-
- herr_t GetName(hid_t group_id, const char *member_name, void *operator_data)
- {
- //this is straight from John Shalf's FlexIO library
- H5IO_getname_t *getn = (H5IO_getname_t*)operator_data;
- // check type first (only respond if it is a dataset)
- H5G_stat_t objinfo;
- // request info about the type of objects in root group
- if(H5Gget_objinfo(group_id,
- member_name,
- 1 /* follow links */,
- &objinfo)<0) return 0; // error (probably bad symlink)
- // only count objects that are datasets (not subgroups)
- if(objinfo.type!=H5G_DATASET)
- return 0; // do not increment count if it isn't a dataset.
- if(getn->index==getn->count){
- strcpy(getn->name,member_name);
- return 1; // success
- }
- getn->count++;
- return 0;
- }
-
-
- void GetDatasetName(const hid_t reader, const int _index, char *name) {
- //this is straight from John Shalf's FlexIO library
- H5IO_getname_t getn;
- int idx=_index;
- getn.index=_index; getn.name=name; getn.count=_index;
- while(H5Giterate(reader, /* hid_t loc_id, */
- "/", /*const char *name, */
- &idx, /* int *idx, */
- GetName,
- &getn)<0){}
- }
-
- hid_t h5DataType (const cGH* const cctkGH, int cctk_type) {
-
- hid_t retval;
-
- CarpetIOHDF5GH *myGH;
- myGH = (CarpetIOHDF5GH *) CCTK_GHExtension (cctkGH, "CarpetIOHDF5");
- // this is adapted from Thomas Radke's IOHDF5Util. Thanks, Thomas!
-
- switch (cctk_type)
- {
- case CCTK_VARIABLE_CHAR: retval = HDF5_CHAR; break;
- case CCTK_VARIABLE_INT: retval = HDF5_INT; break;
- case CCTK_VARIABLE_REAL: retval = HDF5_REAL; break;
- case CCTK_VARIABLE_COMPLEX: retval = myGH->HDF5_COMPLEX; break;
-#ifdef CCTK_INT1
- case CCTK_VARIABLE_INT1: retval = HDF5_INT1; break;
-#endif
-#ifdef CCTK_INT2
- case CCTK_VARIABLE_INT2: retval = HDF5_INT2; break;
-#endif
-#ifdef CCTK_INT4
- case CCTK_VARIABLE_INT4: retval = HDF5_INT4; break;
-#endif
-#ifdef CCTK_INT8
- case CCTK_VARIABLE_INT8: retval = HDF5_INT8; break;
-#endif
-#ifdef CCTK_REAL4
- case CCTK_VARIABLE_REAL4: retval = HDF5_REAL4; break;
- case CCTK_VARIABLE_COMPLEX8: retval = myGH->HDF5_COMPLEX8; break;
-#endif
-#ifdef CCTK_REAL8
- case CCTK_VARIABLE_REAL8: retval = HDF5_REAL8; break;
- case CCTK_VARIABLE_COMPLEX16: retval = myGH->HDF5_COMPLEX16; break;
-#endif
-#ifdef CCTK_REAL16
- case CCTK_VARIABLE_REAL16: retval = HDF5_REAL16; break;
- case CCTK_VARIABLE_COMPLEX32: retval = myGH->HDF5_COMPLEX32; break;
-#endif
-
- default: CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Unsupported CCTK variable datatype %d", cctk_type);
- retval = -1;
- }
- return (retval);
- }
-
-
} // namespace CarpetIOHDF5
diff --git a/Carpet/CarpetIOHDF5/src/make.code.defn b/Carpet/CarpetIOHDF5/src/make.code.defn
index 1b552a1d5..bec17dbf5 100644
--- a/Carpet/CarpetIOHDF5/src/make.code.defn
+++ b/Carpet/CarpetIOHDF5/src/make.code.defn
@@ -1,5 +1,5 @@
# Main make.code.defn file for thorn CarpetIOHDF5
-# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/make.code.defn,v 1.1 2004/03/03 09:44:26 schnetter Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/make.code.defn,v 1.2 2004/03/08 09:43:41 cott Exp $
# Source files in this directory
-SRCS = iohdf5.cc
+SRCS = iohdf5.cc iohdf5utils.cc