89 for (
hsize_t i = 0; i < parentGroup.getNumObjs(); ++i) {
90 if (parentGroup.getObjTypeByIdx(i) == GROUP_TYPE) {
91 H5std_string childPath = parentGroup.getObjnameByIdx(i);
93 auto childGroup = parentGroup.openGroup(childPath);
95 for (uint32_t attribute_index = 0; attribute_index < static_cast<uint32_t>(childGroup.getNumAttrs());
98 H5::Attribute attribute = childGroup.openAttribute(attribute_index);
99 if (attribute.getName() == NX_CLASS) {
101 H5::DataType dataType = attribute.getDataType();
103 H5std_string classType;
104 attribute.read(dataType, classType);
106 if (classType == nxClass) {
120 std::vector<T> dataInFile;
124 H5::DataSet dataset = parentGroup.openDataSet(dataSetName);
126 validateStorageType<T>(dataset);
127 auto space = dataset.getSpace();
129 dataInFile.resize(space.getSelectNpoints());
130 dataset.read(dataInFile.data(), dataset.getDataType(), space);
154 H5::Group rootGroup =
m_file.openGroup(DEFAULT_ROOT_ENTRY_NAME);
158 if (parentNX_CLASS_TYPE == NX_ENTRY) {
160 for (
size_t i = 0; i < rootGroup.getNumObjs(); ++i) {
161 if (rootGroup.getObjTypeByIdx(i) == GROUP_TYPE) {
162 std::string childPath = rootGroup.getObjnameByIdx(i);
164 H5::Group childGroup = rootGroup.openGroup(childPath);
166 H5::Attribute attribute = childGroup.openAttribute(NX_CLASS);
168 attribute.read(attribute.getDataType(), attrVal);
169 if (attrVal == childNX_CLASS_TYPE) {
177 for (
size_t i = 0; i < rootGroup.getNumObjs(); ++i) {
178 if (rootGroup.getObjTypeByIdx(i) == GROUP_TYPE) {
179 std::string childPath = rootGroup.getObjnameByIdx(i);
181 H5::Group childGroup = rootGroup.openGroup(childPath);
184 H5::Attribute parentAttribute = childGroup.openAttribute(NX_CLASS);
185 std::string parentAttrVal;
186 parentAttribute.read(parentAttribute.getDataType(), parentAttrVal);
187 if (parentAttrVal == parentNX_CLASS_TYPE) {
188 for (
size_t i = 0; i < childGroup.getNumObjs(); ++i) {
189 if (childGroup.getObjTypeByIdx(i) == GROUP_TYPE) {
190 std::string grandchildPath = childGroup.getObjnameByIdx(i);
192 H5::Group grandchildGroup = childGroup.openGroup(grandchildPath);
194 H5::Attribute grandchildAttribute = grandchildGroup.openAttribute(NX_CLASS);
195 std::string grandchildAttrVal;
196 grandchildAttribute.read(grandchildAttribute.getDataType(), grandchildAttrVal);
197 if (childNX_CLASS_TYPE == grandchildAttrVal) {
213 dims[0] =
static_cast<hsize_t>(1);
215 H5::DataSpace space = H5Screate_simple(rank, dims,
nullptr);
219 H5::DataSet dataset = parentGroup.openDataSet(datasetName);
220 dataset.read(&
value, H5::PredType::NATIVE_DOUBLE, space);
230 H5::DataSet dataset = parentGroup.openDataSet(datasetName);
232 H5::Attribute attribute = dataset.openAttribute(attrName);
234 H5::DataType dataType = attribute.getDataType();
235 H5::DataSpace dataSpace = attribute.getSpace();
237 std::vector<double>
value;
238 value.resize(dataSpace.getSelectNpoints());
240 attribute.read(dataType,
value.data());
248 H5::Group parentGroup =
m_file.openGroup(pathToGroup);
249 auto numOfChildren = parentGroup.getNumObjs();
250 for (
size_t i = 0; i < numOfChildren; i++) {
251 if (parentGroup.getObjTypeByIdx(i) == DATASET_TYPE) {
252 std::string dSetName = parentGroup.getObjnameByIdx(i);
253 H5::DataSet dSet = parentGroup.openDataSet(dSetName);
254 if (dSet.attrExists(NX_CLASS)) {
255 H5::Attribute attribute = dSet.openAttribute(NX_CLASS);
256 std::string attributeValue;
257 attribute.read(attribute.getDataType(), attributeValue);
258 if (attributeValue == nx_attributeVal)
268 const std::string &attrName) {
270 H5::Group parentGroup =
m_file.openGroup(pathToGroup);
271 auto numOfChildren = parentGroup.getNumObjs();
272 for (
size_t i = 0; i < numOfChildren; i++) {
273 if (parentGroup.getObjTypeByIdx(i) == DATASET_TYPE) {
274 std::string dSetName = parentGroup.getObjnameByIdx(i);
275 H5::DataSet dSet = parentGroup.openDataSet(dSetName);
276 if (dSet.attrExists(NX_CLASS)) {
277 H5::Attribute attribute = dSet.openAttribute(attrName);
278 std::string attributeValue;
279 attribute.read(attribute.getDataType(), attributeValue);
280 if (attributeValue == attributeVal)
292 auto numOfChildren = parentGroup.getNumObjs();
293 for (
size_t i = 0; i < numOfChildren; i++) {
294 if (parentGroup.getObjTypeByIdx(i) == DATASET_TYPE) {
295 std::string dataSetName = parentGroup.getObjnameByIdx(i);
296 if (dsetName == dataSetName) {
304 bool groupHasNxClass(
const std::string &attrVal,
const std::string &pathToGroup)
const {
306 H5::Attribute attribute;
307 H5::Group parentGroup =
m_file.openGroup(pathToGroup);
308 attribute = parentGroup.openAttribute(NX_CLASS);
309 std::string attributeValue;
310 attribute.read(attribute.getDataType(), attributeValue);
312 return attributeValue == attrVal;
321 H5::DataSet dataSet = parentGroup.openDataSet(dataSetName);
322 std::string dataSetVal;
323 auto type = dataSet.getDataType();
324 dataSet.read(dataSetVal, type);
325 dataSetVal.resize(type.getSize());
326 return dataSetVal == dataSetValue;
327 }
catch (H5::DataSetIException &) {
337 H5::Attribute attribute = parentGroup.openAttribute(attrName);
338 std::string attributeValue;
339 auto type = attribute.getDataType();
340 attribute.read(type, attributeValue);
341 attributeValue.resize(type.getSize());
342 return attributeValue == attrVal;
359 H5::Attribute attribute;
361 H5::DataSet dataSet = parentGroup.openDataSet(dataSetName);
362 attribute = dataSet.openAttribute(attrName);
363 std::string attributeValue;
364 attribute.read(attribute.getDataType(), attributeValue);
366 return attributeValue == attrVal;
371 H5::Attribute attribute;
373 H5::DataSet dataSet = parentGroup.openDataSet(dataSetName);
374 attribute = dataSet.openAttribute(NX_CLASS);
375 std::string attributeValue;
376 attribute.read(attribute.getDataType(), attributeValue);
378 return attributeValue == attrVal;