11 std::vector<std::string> ret;
13 std::string remainder = groupName;
14 size_t delimiter_pos = 0;
16 while ((delimiter_pos = remainder.find(
'/', delimiter_pos)) != std::string::npos)
18 if (delimiter_pos > 0)
20 ret.push_back(remainder.substr(0, delimiter_pos));
23 remainder = remainder.substr(delimiter_pos + 1);
28 if (remainder.size() > 0)
30 ret.push_back(remainder);
43 std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
44 std::time_t t_now = std::chrono::system_clock::to_time_t(now);
45 std::string time(ctime(&t_now));
59 const std::string& groupName,
69 for (
size_t i = 0; i < groupNames.size(); i++)
71 if (cur_grp.
exist(groupNames[i]))
73 cur_grp = cur_grp.
getGroup(groupNames[i]);
83 throw std::runtime_error(
"HDF5IO - getGroup(): Groupname '" + groupNames[i] +
84 "' doesn't exist and create flag is false");
90 std::cout <<
"Error in getGroup (with group name '" << groupName <<
"': " << std::endl;
91 std::cout << e.
what() << std::endl;
106 for (
size_t i = 0; i < groupNames.size(); i++)
109 if (cur_grp.
exist(groupNames[i]))
111 cur_grp = cur_grp.
getGroup(groupNames[i]);
121 throw std::runtime_error(
"HDF5IO - getGroup(): Groupname '" + groupNames[i] +
122 "' doesn't exist and create flag is false");
128 std::cout <<
timestamp <<
"Error in HDF5Util::getGroup '" << groupName <<
"': " << std::endl;
136 bool exist(std::shared_ptr<HighFive::File> hdf5_file,
const std::string& groupName)
145 for (
size_t i = 0; i < groupNames.size(); i++)
147 if (cur_grp.
exist(groupNames[i]))
149 if (i < groupNames.size() - 1)
151 cur_grp = cur_grp.
getGroup(groupNames[i]);
162 std::cout <<
"Error in exist (with group name '" << groupName <<
"': " << std::endl;
163 std::cout << e.
what() << std::endl;
177 for (
size_t i = 0; i < groupNames.size(); i++)
179 if (cur_grp.
exist(groupNames[i]))
181 if (i < groupNames.size() - 1)
183 cur_grp = cur_grp.
getGroup(groupNames[i]);
194 std::cout <<
"Error in exist (with group name '" << groupName <<
"': " << std::endl;
195 std::cout << e.
what() << std::endl;
204 std::shared_ptr<HighFive::File> hdf5_file;
205 boost::filesystem::path path(filename);
207 if (!boost::filesystem::exists(path))
A 4x4 matrix class implementation for use with the provided vertex types.
static DataSpace From(const ScalarValue &scalar_value)
static Timestamp timestamp
A global time stamp object for program runtime measurement.
static const int ReadWrite
Open flag: Read Write access.
bool exist(const std::string &node_name) const
check a dataset or group exists in the current node / group
const char * what() const override
get the current exception error message
Group getGroup(const std::string &group_name) const
open an existing group with the name group_name
Basic HighFive Exception class.
void writeBaseStructure(std::shared_ptr< HighFive::File > hdf5_file)
std::shared_ptr< HighFive::File > open(const std::string &filename)
Group createGroup(const std::string &group_name)
create a new group with the name group_name
DataSet createDataSet(const std::string &dataset_name, const DataSpace &space, const DataType &type, const DataSetCreateProps &createProps=DataSetCreateProps(), const DataSetAccessProps &accessProps=DataSetAccessProps())
createDataSet Create a new dataset in the current file of datatype type and of size space ...
HighFive::Group getGroup(std::shared_ptr< HighFive::File > hdf5_file, const std::string &groupName, bool create=true)
bool exist(std::shared_ptr< HighFive::File > hdf5_file, const std::string &groupName)
std::vector< std::string > splitGroupNames(const std::string &groupName)
static const int Create
Open flag: Create non existing file.