Field3D
InputFileHDF5 Namespace Reference

Namespace for file input specifics. More...

Classes

struct  ParseLayersInfo
 struct used to pass the class and partition info back to the parseLayers() callback More...
 

Functions

FIELD3D_API herr_t parseLayers (hid_t loc_id, const char *partitionName, const H5L_info_t *linfo, void *opdata)
 Gets called from readPartitionAndLayerInfo to check each group found under the root of the file. It checks to see if it can find a "partition" and then passes that to writePartition. More...
 
FIELD3D_API herr_t parsePartitions (hid_t loc_id, const char *partitionName, const H5L_info_t *linfo, void *opdata)
 Gets called from readPartitionAndLayerInfo to check each group found under the root of the file. It checks to see if it can find a "partition" and then passes that to writePartition. More...
 

Detailed Description

Namespace for file input specifics.

Function Documentation

◆ parsePartitions()

herr_t InputFileHDF5::parsePartitions ( hid_t  loc_id,
const char *  partitionName,
const H5L_info_t *  linfo,
void *  opdata 
)

Gets called from readPartitionAndLayerInfo to check each group found under the root of the file. It checks to see if it can find a "partition" and then passes that to writePartition.

Definition at line 1130 of file Field3DFileHDF5.cpp.

1132 {
1133  GlobalLock lock(g_hdf5Mutex);
1134 
1135  herr_t status;
1136  H5O_info_t infobuf;
1137 
1138  status = H5Oget_info_by_name(loc_id, itemName, &infobuf, H5P_DEFAULT);
1139 
1140  if (status < 0) {
1141  return -1;
1142  }
1143 
1144  if (infobuf.type == H5O_TYPE_GROUP) {
1145 
1146  // Check that we have a name
1147  if (!itemName) {
1148  return -1;
1149  }
1150 
1151  // check that this group is not "groupMembership"
1152  if (string(itemName) != "field3d_group_membership" &&
1153  string(itemName) != "field3d_global_metadata")
1154  {
1155 
1156  // Get a pointer to the file data structure
1157  Field3DInputFileHDF5* fileObject = static_cast<Field3DInputFileHDF5*>(opdata);
1158  if (!fileObject) {
1159  return -1;
1160  }
1161 
1162  return fileObject->parsePartition(loc_id, itemName);
1163  }
1164  }
1165  return 0;
1166 }

References g_hdf5Mutex, and Field3DInputFileHDF5::parsePartition().

Referenced by Field3DInputFileHDF5::readPartitionAndLayerInfo().

◆ parseLayers()

herr_t InputFileHDF5::parseLayers ( hid_t  loc_id,
const char *  partitionName,
const H5L_info_t *  linfo,
void *  opdata 
)

Gets called from readPartitionAndLayerInfo to check each group found under the root of the file. It checks to see if it can find a "partition" and then passes that to writePartition.

Definition at line 1170 of file Field3DFileHDF5.cpp.

1172 {
1173  GlobalLock lock(g_hdf5Mutex);
1174 
1175  herr_t status;
1176  H5O_info_t infobuf;
1177 
1178  status = H5Oget_info_by_name (loc_id, itemName, &infobuf, H5P_DEFAULT);
1179 
1180  if (infobuf.type == H5O_TYPE_GROUP) {
1181 
1182  // Check that we have a name
1183  if (!itemName)
1184  return -1;
1185 
1186  // Get a pointer to the file data structure
1187  ParseLayersInfo* info = static_cast<ParseLayersInfo*>(opdata);
1188  if (!info)
1189  return -1;
1190 
1191  // Open up the layer group
1192  H5ScopedGopen layerGroup(loc_id, itemName);
1193 
1194  // Check if it's a layer
1195  string classType;
1196  try {
1197  if (!readAttribute(layerGroup.id(), "class_type", classType)) {
1198  return 0;
1199  }
1200  if (classType == string("field3d_layer"))
1201  return info->file->parseLayer(layerGroup.id(), info->partitionName,
1202  itemName);
1203 
1204  }
1205  catch (MissingAttributeException &) {
1206 
1207  }
1208  return 0;
1209 
1210  }
1211 
1212  return 0;
1213 }

References InputFileHDF5::ParseLayersInfo::file, g_hdf5Mutex, Hdf5Util::H5Base::id(), Field3DInputFileHDF5::parseLayer(), InputFileHDF5::ParseLayersInfo::partitionName, and Hdf5Util::readAttribute().

Referenced by Field3DInputFileHDF5::readPartitionAndLayerInfo().

InputFileHDF5::ParseLayersInfo::file
Field3DInputFileHDF5 * file
Definition: Field3DFileHDF5.h:886
InputFileHDF5::ParseLayersInfo
struct used to pass the class and partition info back to the parseLayers() callback
Definition: Field3DFileHDF5.h:884
Field3DInputFileHDF5::parseLayer
herr_t parseLayer(hid_t loc_id, const std::string &partitionName, const std::string &layerName)
Gets called from parsePartitions. Not intended for any other use.
Definition: Field3DFileHDF5.cpp:814
Field3DInputFileHDF5::parsePartition
herr_t parsePartition(hid_t loc_id, const std::string partitionName)
Gets called from parsePartitions. Not intended for any other use.
Definition: Field3DFileHDF5.cpp:800
Hdf5Util::H5ScopedGopen
Scoped object - opens a group on creation and closes it on destruction.
Definition: Hdf5Util.h:194
g_hdf5Mutex
FIELD3D_NAMESPACE_OPEN FIELD3D_API boost::recursive_mutex g_hdf5Mutex
Definition: Hdf5Util.cpp:67
InputFileHDF5::ParseLayersInfo::partitionName
std::string partitionName
Definition: Field3DFileHDF5.h:887
GlobalLock
boost::recursive_mutex::scoped_lock GlobalLock
Definition: Hdf5Util.h:78
Hdf5Util::readAttribute
FIELD3D_API bool readAttribute(hid_t location, const std::string &attrName, std::string &value)
Reads a string attribute.
Field3DInputFileHDF5
Provides reading of .f3d (internally, hdf5) files.
Definition: Field3DFileHDF5.h:437