@@ -470,6 +470,9 @@ namespace splash
470470 if (ndims < 1u || ndims > DSP_DIM_MAX)
471471 throw DCException (getExceptionString (" writeAttribute" , " maximum dimension `ndims` is invalid" ));
472472
473+ /* group_path: absolute path to the last inode
474+ * obj_name: last inode, can be a group or a dataset
475+ */
473476 std::string group_path, obj_name;
474477 std::string dataNameInternal = " " ;
475478 if (dataName)
@@ -479,6 +482,16 @@ namespace splash
479482 DCParallelGroup group;
480483 if (dataName)
481484 {
485+ /* if the specified inode (obj_name) does not exist
486+ * (as dataset or group), create all missing groups along group_path
487+ * and even create an empty group for obj_name itself
488+ *
489+ * group_path + "/" + obj_name is the absolute path of dataName
490+ */
491+ std::string pathAndName (group_path + " /" + obj_name);
492+ if (!DCParallelGroup::exists (handles.get (id), pathAndName))
493+ group.create (handles.get (id), pathAndName);
494+
482495 // attach attribute to the dataset or group
483496 group.open (handles.get (id), group_path);
484497 hid_t obj_id = H5Oopen (group.getHandle (), obj_name.c_str (), H5P_DEFAULT);
@@ -774,33 +787,6 @@ namespace splash
774787 src_dataset.close ();
775788 }
776789
777- void ParallelDataCollector::createReference (int32_t srcID,
778- const char *srcName,
779- int32_t dstID,
780- const char *dstName,
781- Dimensions /* count*/ ,
782- Dimensions /* offset*/ ,
783- Dimensions /* stride*/ )
784- throw (DCException)
785- {
786- if (srcName == NULL || dstName == NULL )
787- throw DCException (getExceptionString (" createReference" , " a parameter was NULL" ));
788-
789- if (fileStatus == FST_CLOSED || fileStatus == FST_READING)
790- throw DCException (getExceptionString (" createReference" , " this access is not permitted" ));
791-
792- if (srcID != dstID)
793- throw DCException (getExceptionString (" createReference" ,
794- " source and destination ID must be identical" , NULL ));
795-
796- if (srcName == dstName)
797- throw DCException (getExceptionString (" createReference" ,
798- " a reference must not be identical to the referenced data" , srcName));
799-
800- throw DCException (getExceptionString (" createReference" ,
801- " feature currently not supported by Parallel HDF5" , NULL ));
802- }
803-
804790 /* ******************************************************************************
805791 * PROTECTED FUNCTIONS
806792 *******************************************************************************/
@@ -1143,4 +1129,56 @@ namespace splash
11431129 dataset.close ();
11441130 }
11451131
1132+ /* UNIMPLEMENTED METHODS FROM DATACOLLECTOR. TODO: Unify interface to remove those */
1133+ void ParallelDataCollector::readGlobalAttribute (const char *, void *, Dimensions*)
1134+ throw (DCException)
1135+ {
1136+ throw DCException (getExceptionString (" readGlobalAttribute" ,
1137+ " feature currently not supported by Parallel HDF5" ));
1138+ }
1139+
1140+ void ParallelDataCollector::writeGlobalAttribute (const CollectionType& /* type*/ ,
1141+ const char * /* name*/ , const void * /* data*/ ) throw (DCException)
1142+ {
1143+ throw DCException (getExceptionString (" readGlobalAttribute" ,
1144+ " feature currently not supported by Parallel HDF5" ));
1145+ }
1146+
1147+ void ParallelDataCollector::writeGlobalAttribute (const CollectionType& /* type*/ ,
1148+ const char * /* name*/ , uint32_t /* ndims*/ , const Dimensions /* dims*/ ,
1149+ const void * /* data*/ ) throw (DCException)
1150+ {
1151+ throw DCException (getExceptionString (" readGlobalAttribute" ,
1152+ " feature currently not supported by Parallel HDF5" ));
1153+ }
1154+
1155+ void ParallelDataCollector::append (int32_t /* id*/ , const CollectionType& /* type*/ ,
1156+ size_t /* count*/ , const char * /* name*/ , const void * /* data*/ )
1157+ throw (DCException)
1158+ {
1159+ throw DCException (getExceptionString (" readGlobalAttribute" ,
1160+ " feature currently not supported by Parallel HDF5" ));
1161+ }
1162+
1163+ void ParallelDataCollector::append (int32_t /* id*/ , const CollectionType& /* type*/ ,
1164+ size_t /* count*/ , size_t /* offset*/ , size_t /* stride*/ , const char * /* name*/ ,
1165+ const void * /* data*/ ) throw (DCException)
1166+ {
1167+ throw DCException (getExceptionString (" readGlobalAttribute" ,
1168+ " feature currently not supported by Parallel HDF5" ));
1169+ }
1170+
1171+ void ParallelDataCollector::createReference (int32_t /* srcID*/ ,
1172+ const char */*srcName*/,
1173+ int32_t /* dstID*/ ,
1174+ const char */*dstName*/,
1175+ Dimensions /* count*/ ,
1176+ Dimensions /* offset*/ ,
1177+ Dimensions /* stride*/ )
1178+ throw (DCException)
1179+ {
1180+ throw DCException (getExceptionString (" readGlobalAttribute" ,
1181+ " feature currently not supported by Parallel HDF5" ));
1182+ }
1183+
11461184}
0 commit comments