Field3D
InputFile 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

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.
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.

Detailed Description

Namespace for file input specifics.


Function Documentation

herr_t InputFile::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 1110 of file Field3DFile.cpp.

References Field3DInputFile::parsePartition().

Referenced by Field3DInputFile::readPartitionAndLayerInfo().

{
  herr_t          status;
  H5O_info_t      infobuf;

  status = H5Oget_info_by_name(loc_id, itemName, &infobuf, H5P_DEFAULT);

  if (status < 0) {
    return -1;
  }
  
  if (infobuf.type == H5O_TYPE_GROUP) {

    // Check that we have a name 
    if (!itemName) {
      return -1;
    }

    // check that this group is not "groupMembership"
    if (string(itemName) != "field3d_group_membership" &&
        string(itemName) != "field3d_global_metadata")
    { 

      // Get a pointer to the file data structure
      Field3DInputFile* fileObject = static_cast<Field3DInputFile*>(opdata);
      if (!fileObject) {
        return -1;
      }
      
      return fileObject->parsePartition(loc_id, itemName);
    }
  }
  return 0;
}
herr_t InputFile::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 1148 of file Field3DFile.cpp.

References InputFile::ParseLayersInfo::file, Hdf5Util::H5Base::id(), Field3DInputFile::parseLayer(), InputFile::ParseLayersInfo::partitionName, and Hdf5Util::readAttribute().

Referenced by Field3DInputFile::readPartitionAndLayerInfo().

{
  herr_t          status;
  H5O_info_t      infobuf;
  
  status = H5Oget_info_by_name (loc_id, itemName, &infobuf, H5P_DEFAULT);

  if (infobuf.type == H5O_TYPE_GROUP) {

    // Check that we have a name 
    if (!itemName)
      return -1;

    // Get a pointer to the file data structure
    ParseLayersInfo* info = static_cast<ParseLayersInfo*>(opdata);
    if (!info) 
      return -1;

    // Open up the layer group
    H5ScopedGopen layerGroup(loc_id, itemName);

    // Check if it's a layer
    string classType;
    try {
      if (!readAttribute(layerGroup.id(), "class_type", classType)) {
        return 0;
      }
      if (classType == string("field3d_layer")) 
        return info->file->parseLayer(layerGroup.id(), info->partitionName,
                                      itemName);
                                   
    }
    catch (MissingAttributeException &e) {
      
    }
    return 0;

  }

  return 0;
}