From a2117ee534d7d03e722bd4a8a7deb7caa1c4d43f Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Mon, 29 Mar 2021 22:24:50 -0700 Subject: [PATCH 1/9] add attributes example to Tests --- Tests/classy_hdf5_interface/Makefile | 2 + Tests/classy_hdf5_interface/attributes.cpp | 91 ++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 Tests/classy_hdf5_interface/attributes.cpp diff --git a/Tests/classy_hdf5_interface/Makefile b/Tests/classy_hdf5_interface/Makefile index e490238..0ea4a9a 100644 --- a/Tests/classy_hdf5_interface/Makefile +++ b/Tests/classy_hdf5_interface/Makefile @@ -3,12 +3,14 @@ EXTRA_LIBS ?= -lsz -lz -lm all: g++ -o append.exe append.cpp -I../../Source -I$(HDF5_HOME)/include -L$(HDF5_HOME)/lib -lhdf5 $(EXTRA_LIBS) + g++ -o attributes.exe attributes.cpp -I../../Source -I$(HDF5_HOME)/include -L$(HDF5_HOME)/lib -lhdf5 -lhdf5_hl $(EXTRA_LIBS) g++ -o get_last_N.exe get_last_N.cpp -I../../Source -I$(HDF5_HOME)/include -L$(HDF5_HOME)/lib -lhdf5 $(EXTRA_LIBS) g++ -o resize.exe resize.cpp -I../../Source -I$(HDF5_HOME)/include -L$(HDF5_HOME)/lib -lhdf5 $(EXTRA_LIBS) g++ -o search.exe search.cpp -I../../Source -I$(HDF5_HOME)/include -L$(HDF5_HOME)/lib -lhdf5 $(EXTRA_LIBS) test: all ./append.exe + ./attributes.exe ./get_last_N.exe ./resize.exe ./search.exe diff --git a/Tests/classy_hdf5_interface/attributes.cpp b/Tests/classy_hdf5_interface/attributes.cpp new file mode 100644 index 0000000..62b5cfb --- /dev/null +++ b/Tests/classy_hdf5_interface/attributes.cpp @@ -0,0 +1,91 @@ +#include +#include +#include +#include "ClassyHDF.H" +#include "hdf5_hl.h" + +using namespace ClassyHDF; + +/* + * We're going to create a "file.h5" HDF5 file + * and work with an "Indices" data array in it. + */ + +void write_test_file(const std::string& filename) { + File file(filename, FileMode::trunc); + Group group1 = file.get_group("Data"); + Group group2 = group1.get_group("GroupA"); + + // put some attributes into the "GroupA" group + herr_t status = H5LTset_attribute_string(group1.id(), "GroupA", "TestAttribute", "Hello World!"); + assert(status >= 0); + + int* ibuf = new int[1]; + ibuf[0] = 5; + status = H5LTset_attribute_int(group1.id(), "GroupA", "TestAttInt", ibuf, 1); + delete ibuf; + + float* fbuf = new float[1]; + fbuf[0] = -1.0; + status = H5LTset_attribute_float(group1.id(), "GroupA", "TestAttFloat", fbuf, 1); + delete fbuf; + + double* dbuf = new double[1]; + dbuf[0] = -2.0; + status = H5LTset_attribute_double(group1.id(), "GroupA", "TestAttDouble", dbuf, 1); + delete dbuf; +} + +bool do_test(const std::string& filename) { + File file(filename); + Group group1 = file.get_group("Data"); + Group group2 = group1.get_group("GroupA"); + + bool success = true; + + // get some attributes from the "GroupA" group + herr_t status; + + char* buffer; + int size_buffer; + status = H5LTget_attribute_ndims(group1.id(), "GroupA", "TestAttribute", &size_buffer); + buffer = new char[size_buffer]; + status = H5LTget_attribute_string(group1.id(), "GroupA", "TestAttribute", buffer); + std::string sbuffer = buffer; + success = success && (sbuffer == "Hello World!"); + delete buffer; + + int* ibuf = new int[1]; + ibuf[0] = 0; + status = H5LTget_attribute_int(group1.id(), "GroupA", "TestAttInt", ibuf); + success = success && (ibuf[0] == 5); + delete ibuf; + + float* fbuf = new float[1]; + fbuf[0] = 0.0; + status = H5LTget_attribute_float(group1.id(), "GroupA", "TestAttFloat", fbuf); + success = success && (fbuf[0] == -1.0); + delete fbuf; + + double* dbuf = new double[1]; + dbuf[0] = 0.0; + status = H5LTget_attribute_double(group1.id(), "GroupA", "TestAttDouble", dbuf); + success = success && (dbuf[0] == -2.0); + delete dbuf; + + return success; +} + +int main() { + const std::string filename = "file_attributes.h5"; + + write_test_file(filename); + + if (do_test(filename)) { + std::cout << "success" << std::endl; + return 0; + } else { + std::cout << "failure" << std::endl; + return -1; + } +} \ No newline at end of file From 252fe86b954129a55d1a363f7b1ef1429e22cc4f Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Mon, 29 Mar 2021 22:55:54 -0700 Subject: [PATCH 2/9] WIP template the attributes --- Source/ClassyHDF_Location.H | 116 +++++++++++++++++++++ Tests/classy_hdf5_interface/attributes.cpp | 54 +++------- 2 files changed, 128 insertions(+), 42 deletions(-) diff --git a/Source/ClassyHDF_Location.H b/Source/ClassyHDF_Location.H index d39008d..792449d 100644 --- a/Source/ClassyHDF_Location.H +++ b/Source/ClassyHDF_Location.H @@ -4,6 +4,7 @@ #include #include #include "hdf5.h" +#include "hdf5_hl.h" #include "ClassyHDF_Identity.H" #include "ClassyHDF_Data.H" @@ -178,6 +179,121 @@ class Location : public NamedIdentity { dataset.append(data); return dataset; } + + template + void attr(const std::string& attr_name, const T& attr_value) + { + // Calling the default template means no attr function + // is implemented for the requested type + assert(false); + } + + template<> + void attr(const std::string& attr_name, const std::string& attr_value) + { + TGroup gattr = get_group("Attributes"); + + herr_t status = H5LTset_attribute_string(id(), "Attributes", + attr_name.c_str(), + attr_value.c_str()); + assert(status >= 0); + } + + template<> + void attr(const std::string& attr_name, const int& attr_value) + { + TGroup gattr = get_group("Attributes"); + + herr_t status = H5LTset_attribute_int(id(), "Attributes", + attr_name.c_str(), + &attr_value, 1); + assert(status >= 0); + } + + template<> + void attr(const std::string& attr_name, const float& attr_value) + { + TGroup gattr = get_group("Attributes"); + + herr_t status = H5LTset_attribute_float(id(), "Attributes", + attr_name.c_str(), + &attr_value, 1); + assert(status >= 0); + } + + template<> + void attr(const std::string& attr_name, const double& attr_value) + { + TGroup gattr = get_group("Attributes"); + + herr_t status = H5LTset_attribute_double(id(), "Attributes", + attr_name.c_str(), + &attr_value, 1); + assert(status >= 0); + } + + template + T attr(const std::string& attr_name) + { + // Calling the default template means no attr function + // is implemented for the requested type + assert(false); + } + + template<> + std::string attr(const std::string& attr_name) + { + char* buffer; + int size_buffer; + herr_t status = H5LTget_attribute_ndims(id(), "Attributes", + attr_name.c_str(), &size_buffer); + assert(status >= 0); + + buffer = new char[size_buffer]; + status = H5LTget_attribute_string(id(), "Attributes", + attr_name.c_str(), buffer); + std::string sattr = buffer; + delete buffer; + assert(status >= 0); + + return sattr; + } + + template<> + int attr(const std::string& attr_name) + { + int attr_value = 0; + + herr_t status = H5LTget_attribute_int(id(), "Attributes", + attr_name.c_str(), &attr_value); + assert(status >= 0); + + return attr_value; + } + + template<> + float attr(const std::string& attr_name) + { + float attr_value = 0; + + herr_t status = H5LTget_attribute_float(id(), "Attributes", + attr_name.c_str(), &attr_value); + assert(status >= 0); + + return attr_value; + } + + template<> + double attr(const std::string& attr_name) + { + double attr_value = 0; + + herr_t status = H5LTget_attribute_double(id(), "Attributes", + attr_name.c_str(), &attr_value); + assert(status >= 0); + + return attr_value; + } }; } diff --git a/Tests/classy_hdf5_interface/attributes.cpp b/Tests/classy_hdf5_interface/attributes.cpp index 62b5cfb..5451f7c 100644 --- a/Tests/classy_hdf5_interface/attributes.cpp +++ b/Tests/classy_hdf5_interface/attributes.cpp @@ -17,23 +17,10 @@ void write_test_file(const std::string& filename) { Group group2 = group1.get_group("GroupA"); // put some attributes into the "GroupA" group - herr_t status = H5LTset_attribute_string(group1.id(), "GroupA", "TestAttribute", "Hello World!"); - assert(status >= 0); - - int* ibuf = new int[1]; - ibuf[0] = 5; - status = H5LTset_attribute_int(group1.id(), "GroupA", "TestAttInt", ibuf, 1); - delete ibuf; - - float* fbuf = new float[1]; - fbuf[0] = -1.0; - status = H5LTset_attribute_float(group1.id(), "GroupA", "TestAttFloat", fbuf, 1); - delete fbuf; - - double* dbuf = new double[1]; - dbuf[0] = -2.0; - status = H5LTset_attribute_double(group1.id(), "GroupA", "TestAttDouble", dbuf, 1); - delete dbuf; + group2.attr("TestAttribute", "Hello World!"); + group2.attr("TestAttInt", 5); + group2.attr("TestAttFloat", -1.0); + group2.attr("TestAttDouble", -2.0); } bool do_test(const std::string& filename) { @@ -44,34 +31,17 @@ bool do_test(const std::string& filename) { bool success = true; // get some attributes from the "GroupA" group - herr_t status; - - char* buffer; - int size_buffer; - status = H5LTget_attribute_ndims(group1.id(), "GroupA", "TestAttribute", &size_buffer); - buffer = new char[size_buffer]; - status = H5LTget_attribute_string(group1.id(), "GroupA", "TestAttribute", buffer); - std::string sbuffer = buffer; - success = success && (sbuffer == "Hello World!"); - delete buffer; + std::string stest = group2.attr("TestAttribute"); + success = success && (stest == "Hello World!"); - int* ibuf = new int[1]; - ibuf[0] = 0; - status = H5LTget_attribute_int(group1.id(), "GroupA", "TestAttInt", ibuf); - success = success && (ibuf[0] == 5); - delete ibuf; + int itest = group2.attr("TestAttInt"); + success = success && (itest == 5); - float* fbuf = new float[1]; - fbuf[0] = 0.0; - status = H5LTget_attribute_float(group1.id(), "GroupA", "TestAttFloat", fbuf); - success = success && (fbuf[0] == -1.0); - delete fbuf; + float ftest = group2.attr("TestAttFloat"); + success = success && (ftest == -1.0); - double* dbuf = new double[1]; - dbuf[0] = 0.0; - status = H5LTget_attribute_double(group1.id(), "GroupA", "TestAttDouble", dbuf); - success = success && (dbuf[0] == -2.0); - delete dbuf; + double dtest = group2.attr("TestAttDouble"); + success = success && (dtest == -2.0); return success; } From 65b32b43bcf5d1429e1f3f338d7b720fafb70568 Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Mon, 5 Apr 2021 12:32:24 -0700 Subject: [PATCH 3/9] fixed compilation for attributes interface --- Source/ClassyHDF_Location.H | 224 ++++++++++++++++++------------------ 1 file changed, 115 insertions(+), 109 deletions(-) diff --git a/Source/ClassyHDF_Location.H b/Source/ClassyHDF_Location.H index 792449d..c0db65d 100644 --- a/Source/ClassyHDF_Location.H +++ b/Source/ClassyHDF_Location.H @@ -12,6 +12,117 @@ namespace ClassyHDF { +namespace { + template + struct Attribute { + static void set(const Tloc& loc, const std::string& attr_name, const T& attr_value) { assert(false); } + static T get(const Tloc& loc, const std::string& attr_name) { assert(false); return static_cast(0); } + }; + + template + struct Attribute { + static void set(const Tloc& loc, const std::string& attr_name, const std::string& attr_value) + { + auto gattr = loc.get_group("Attributes"); + + herr_t status = H5LTset_attribute_string(loc.id(), "Attributes", + attr_name.c_str(), + attr_value.c_str()); + assert(status >= 0); + } + + static std::string get(const Tloc& loc, const std::string& attr_name) + { + char* buffer; + int size_buffer; + herr_t status = H5LTget_attribute_ndims(loc.id(), "Attributes", + attr_name.c_str(), &size_buffer); + assert(status >= 0); + + buffer = new char[size_buffer]; + status = H5LTget_attribute_string(loc.id(), "Attributes", + attr_name.c_str(), buffer); + std::string sattr = buffer; + delete buffer; + assert(status >= 0); + + return sattr; + } + }; + + template + struct Attribute { + static void set(const Tloc& loc, const std::string& attr_name, const int& attr_value) + { + auto gattr = loc.get_group("Attributes"); + + herr_t status = H5LTset_attribute_int(loc.id(), "Attributes", + attr_name.c_str(), + &attr_value, 1); + assert(status >= 0); + } + + static int get(const Tloc& loc, const std::string& attr_name) + { + int attr_value = 0; + + herr_t status = H5LTget_attribute_int(loc.id(), "Attributes", + attr_name.c_str(), &attr_value); + assert(status >= 0); + + return attr_value; + } + }; + + template + struct Attribute { + static void set(const Tloc& loc, const std::string& attr_name, const float& attr_value) + { + auto gattr = loc.get_group("Attributes"); + + herr_t status = H5LTset_attribute_float(loc.id(), "Attributes", + attr_name.c_str(), + &attr_value, 1); + assert(status >= 0); + } + + static float get(const Tloc& loc, const std::string& attr_name) + { + float attr_value = 0; + + herr_t status = H5LTget_attribute_float(loc.id(), "Attributes", + attr_name.c_str(), &attr_value); + assert(status >= 0); + + return attr_value; + } + }; + + template + struct Attribute { + static void set(const Tloc& loc, const std::string& attr_name, const double& attr_value) + { + auto gattr = loc.get_group("Attributes"); + + herr_t status = H5LTset_attribute_double(loc.id(), "Attributes", + attr_name.c_str(), + &attr_value, 1); + assert(status >= 0); + } + + static double get(const Tloc& loc, const std::string& attr_name) + { + double attr_value = 0; + + herr_t status = H5LTget_attribute_double(loc.id(), "Attributes", + attr_name.c_str(), &attr_value); + assert(status >= 0); + + return attr_value; + } + }; +} + // We're going to use the Curiously Recurring Template Pattern to // allow any derived class from Location to create Group objects, // even though Group derives from Location. @@ -181,118 +292,13 @@ class Location : public NamedIdentity { } template - void attr(const std::string& attr_name, const T& attr_value) - { - // Calling the default template means no attr function - // is implemented for the requested type - assert(false); - } - - template<> - void attr(const std::string& attr_name, const std::string& attr_value) - { - TGroup gattr = get_group("Attributes"); - - herr_t status = H5LTset_attribute_string(id(), "Attributes", - attr_name.c_str(), - attr_value.c_str()); - assert(status >= 0); - } - - template<> - void attr(const std::string& attr_name, const int& attr_value) - { - TGroup gattr = get_group("Attributes"); - - herr_t status = H5LTset_attribute_int(id(), "Attributes", - attr_name.c_str(), - &attr_value, 1); - assert(status >= 0); - } - - template<> - void attr(const std::string& attr_name, const float& attr_value) - { - TGroup gattr = get_group("Attributes"); - - herr_t status = H5LTset_attribute_float(id(), "Attributes", - attr_name.c_str(), - &attr_value, 1); - assert(status >= 0); - } - - template<> - void attr(const std::string& attr_name, const double& attr_value) - { - TGroup gattr = get_group("Attributes"); - - herr_t status = H5LTset_attribute_double(id(), "Attributes", - attr_name.c_str(), - &attr_value, 1); - assert(status >= 0); + void attr(const std::string& attr_name, const T& attr_value) { + Attribute::set(*this, attr_name, attr_value); } template - T attr(const std::string& attr_name) - { - // Calling the default template means no attr function - // is implemented for the requested type - assert(false); - } - - template<> - std::string attr(const std::string& attr_name) - { - char* buffer; - int size_buffer; - herr_t status = H5LTget_attribute_ndims(id(), "Attributes", - attr_name.c_str(), &size_buffer); - assert(status >= 0); - - buffer = new char[size_buffer]; - status = H5LTget_attribute_string(id(), "Attributes", - attr_name.c_str(), buffer); - std::string sattr = buffer; - delete buffer; - assert(status >= 0); - - return sattr; - } - - template<> - int attr(const std::string& attr_name) - { - int attr_value = 0; - - herr_t status = H5LTget_attribute_int(id(), "Attributes", - attr_name.c_str(), &attr_value); - assert(status >= 0); - - return attr_value; - } - - template<> - float attr(const std::string& attr_name) - { - float attr_value = 0; - - herr_t status = H5LTget_attribute_float(id(), "Attributes", - attr_name.c_str(), &attr_value); - assert(status >= 0); - - return attr_value; - } - - template<> - double attr(const std::string& attr_name) - { - double attr_value = 0; - - herr_t status = H5LTget_attribute_double(id(), "Attributes", - attr_name.c_str(), &attr_value); - assert(status >= 0); - - return attr_value; + T attr(const std::string& attr_name) { + return Attribute::get(*this, attr_name); } }; From 9c86ec9812b8daab373fad37ea2db74274593862 Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Mon, 5 Apr 2021 12:52:03 -0700 Subject: [PATCH 4/9] have amrex codes link against hdf5_hl as well as hdf5 --- Source/Make.package | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Make.package b/Source/Make.package index 47f23f0..123f3ef 100644 --- a/Source/Make.package +++ b/Source/Make.package @@ -7,4 +7,6 @@ CEXE_headers += ClassyHDF_Dataset.H CEXE_headers += ClassyHDF_Location.H CEXE_headers += ClassyHDF_Group.H CEXE_headers += ClassyHDF_File.H -CEXE_headers += ClassyHDF.H \ No newline at end of file +CEXE_headers += ClassyHDF.H + +LIBRARIES += -lhdf5_hl From ff0b4b9e448cf944304136e05701f89e2a8cfd7d Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Thu, 15 Apr 2021 17:53:09 -0700 Subject: [PATCH 5/9] add FileMode::exists_is_error which creates the file only if it does not exist, otherwise raises an error --- Source/ClassyHDF_File.H | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/ClassyHDF_File.H b/Source/ClassyHDF_File.H index b18d2b6..1b4ab7e 100644 --- a/Source/ClassyHDF_File.H +++ b/Source/ClassyHDF_File.H @@ -10,7 +10,7 @@ namespace ClassyHDF { namespace FileMode { - enum {rw=0, trunc}; + enum {rw=0, trunc, exists_is_error}; } class File : public Location { @@ -22,14 +22,18 @@ class File : public Location { set_name(file_name); // try to open the file in read/write mode, otherwise create it - if (access_type == FileMode::rw) { + if (access_type == FileMode::rw || access_type == FileMode::exists_is_error) { set_existed(true); H5E_BEGIN_TRY set_id(H5Fopen(name().c_str(), H5F_ACC_RDWR, H5P_DEFAULT)); H5E_END_TRY + + if (access_type == FileMode::exists_is_error) { + assert(id() < 0); + } } - if (access_type == FileMode::trunc || + if (access_type == FileMode::trunc || access_type == FileMode::exists_is_error || (access_type == FileMode::rw && id() < 0)) { set_existed(false); set_id(H5Fcreate(name().c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)); From 09f8ad6ba2c73e7ae97334dcf32609db13a4933c Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Thu, 15 Apr 2021 18:33:31 -0700 Subject: [PATCH 6/9] add Errors namespace and throw an error if FileMode::exists_is_error and the file was already present --- Source/ClassyHDF.H | 1 + Source/ClassyHDF_Errors.H | 12 ++++++++++++ Source/ClassyHDF_File.H | 5 +++-- Source/Make.package | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 Source/ClassyHDF_Errors.H diff --git a/Source/ClassyHDF.H b/Source/ClassyHDF.H index 9335945..fb6177d 100644 --- a/Source/ClassyHDF.H +++ b/Source/ClassyHDF.H @@ -10,5 +10,6 @@ #include "ClassyHDF_Location.H" #include "ClassyHDF_Group.H" #include "ClassyHDF_File.H" +#include "ClassyHDF_Errors.H" #endif \ No newline at end of file diff --git a/Source/ClassyHDF_Errors.H b/Source/ClassyHDF_Errors.H new file mode 100644 index 0000000..bf4bb59 --- /dev/null +++ b/Source/ClassyHDF_Errors.H @@ -0,0 +1,12 @@ +#ifndef CLASSY_HDF_ERRORS_H_ +#define CLASSY_HDF_ERRORS_H_ + +namespace ClassyHDF { + +namespace Errors { + enum {file_exists=1}; +} + +} + +#endif \ No newline at end of file diff --git a/Source/ClassyHDF_File.H b/Source/ClassyHDF_File.H index 1b4ab7e..00cbb0a 100644 --- a/Source/ClassyHDF_File.H +++ b/Source/ClassyHDF_File.H @@ -6,6 +6,7 @@ #include "hdf5.h" #include "ClassyHDF_Group.H" +#include "ClassyHDF_Errors.H" namespace ClassyHDF { @@ -28,8 +29,8 @@ class File : public Location { set_id(H5Fopen(name().c_str(), H5F_ACC_RDWR, H5P_DEFAULT)); H5E_END_TRY - if (access_type == FileMode::exists_is_error) { - assert(id() < 0); + if (access_type == FileMode::exists_is_error && id() >= 0) { + throw Errors::file_exists; } } diff --git a/Source/Make.package b/Source/Make.package index 123f3ef..72bcde6 100644 --- a/Source/Make.package +++ b/Source/Make.package @@ -7,6 +7,7 @@ CEXE_headers += ClassyHDF_Dataset.H CEXE_headers += ClassyHDF_Location.H CEXE_headers += ClassyHDF_Group.H CEXE_headers += ClassyHDF_File.H +CEXE_headers += ClassyHDF_Errors.H CEXE_headers += ClassyHDF.H LIBRARIES += -lhdf5_hl From 7cc0b90eb61eae2085cc19ecb074957a42075d27 Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Fri, 23 Apr 2021 23:15:28 -0700 Subject: [PATCH 7/9] added newlines --- Source/ClassyHDF.H | 3 ++- Source/ClassyHDF_Errors.H | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/ClassyHDF.H b/Source/ClassyHDF.H index fb6177d..5da8de4 100644 --- a/Source/ClassyHDF.H +++ b/Source/ClassyHDF.H @@ -12,4 +12,5 @@ #include "ClassyHDF_File.H" #include "ClassyHDF_Errors.H" -#endif \ No newline at end of file +#endif + diff --git a/Source/ClassyHDF_Errors.H b/Source/ClassyHDF_Errors.H index bf4bb59..8293f10 100644 --- a/Source/ClassyHDF_Errors.H +++ b/Source/ClassyHDF_Errors.H @@ -9,4 +9,5 @@ namespace Errors { } -#endif \ No newline at end of file +#endif + From 833e56d577e66fdb1223954cd31978eabf472241 Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Fri, 23 Apr 2021 23:16:45 -0700 Subject: [PATCH 8/9] cleaned up attributes test --- Tests/classy_hdf5_interface/attributes.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Tests/classy_hdf5_interface/attributes.cpp b/Tests/classy_hdf5_interface/attributes.cpp index 5451f7c..e284bce 100644 --- a/Tests/classy_hdf5_interface/attributes.cpp +++ b/Tests/classy_hdf5_interface/attributes.cpp @@ -6,11 +6,6 @@ using namespace ClassyHDF; -/* - * We're going to create a "file.h5" HDF5 file - * and work with an "Indices" data array in it. - */ - void write_test_file(const std::string& filename) { File file(filename, FileMode::trunc); Group group1 = file.get_group("Data"); @@ -58,4 +53,5 @@ int main() { std::cout << "failure" << std::endl; return -1; } -} \ No newline at end of file +} + From 14c7c89b8dc5afd0f8ccf2c378e44c38d024df53 Mon Sep 17 00:00:00 2001 From: "Donald E. Willcox" Date: Fri, 23 Apr 2021 23:18:23 -0700 Subject: [PATCH 9/9] Added attributes unit test to automated testing --- .github/workflows/classy-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/classy-tests.yml b/.github/workflows/classy-tests.yml index 976e90a..b58b878 100644 --- a/.github/workflows/classy-tests.yml +++ b/.github/workflows/classy-tests.yml @@ -53,3 +53,9 @@ jobs: cd Tests/classy_hdf5_interface export LD_LIBRARY_PATH="../../hdf5-1.12.0-install/lib:$LD_LIBRARY_PATH" ./search.exe + + - name: Run ClassyHDF Test - Attributes + run: | + cd Tests/classy_hdf5_interface + export LD_LIBRARY_PATH="../../hdf5-1.12.0-install/lib:$LD_LIBRARY_PATH" + ./attributes.exe