[MOAB-dev] commit/MOAB: danwu: Eliminated compiler warnings (mostly [-Wunused-parameter]) in NCHelper classes.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Aug 13 12:34:24 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/352dc6bb09d5/
Changeset:   352dc6bb09d5
Branch:      master
User:        danwu
Date:        2013-08-13 19:34:06
Summary:     Eliminated compiler warnings (mostly [-Wunused-parameter]) in NCHelper classes.

Affected #:  12 files

diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 851d9b1..ebe88b6 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -17,7 +17,7 @@
 
 namespace moab {
 
-NCHelper* NCHelper::get_nc_helper(ReadNC* readNC, int fileId, const FileOptions& opts)
+NCHelper* NCHelper::get_nc_helper(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
 {
   // Check if CF convention is being followed
   bool is_CF = false;
@@ -39,22 +39,22 @@ NCHelper* NCHelper::get_nc_helper(ReadNC* readNC, int fileId, const FileOptions&
 
   if (is_CF) {
     if (NCHelperEuler::can_read_file(readNC, fileId))
-      return new (std::nothrow) NCHelperEuler(readNC, fileId);
+      return new (std::nothrow) NCHelperEuler(readNC, fileId, opts, fileSet);
     else if (NCHelperFV::can_read_file(readNC, fileId))
-      return new (std::nothrow) NCHelperFV(readNC, fileId);
+      return new (std::nothrow) NCHelperFV(readNC, fileId, opts, fileSet);
     else if (NCHelperHOMME::can_read_file(readNC, fileId))
-      return new (std::nothrow) NCHelperHOMME(readNC, fileId, opts);
+      return new (std::nothrow) NCHelperHOMME(readNC, fileId, opts, fileSet);
   }
   else {
-    if (NCHelperMPAS::can_read_file(readNC, fileId))
-      return new (std::nothrow) NCHelperMPAS(readNC, fileId, opts);
+    if (NCHelperMPAS::can_read_file(readNC))
+      return new (std::nothrow) NCHelperMPAS(readNC, fileId, opts, fileSet);
   }
 
   // Unknown NetCDF grid (will fill this in later for POP, CICE and CLM)
   return NULL;
 }
 
-ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle file_set, const std::vector<int>& tstep_nums) {
+ErrorCode NCHelper::create_conventional_tags(const std::vector<int>& tstep_nums) {
   Interface*& mbImpl = _readNC->mbImpl;
   std::vector<std::string>& dimNames = _readNC->dimNames;
   std::vector<int>& dimVals = _readNC->dimVals;
@@ -62,6 +62,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   std::map<std::string, ReadNC::VarData>& varInfo = _readNC->varInfo;
   DebugOutput& dbgOut = _readNC->dbgOut;
   int& partMethod = _readNC->partMethod;
+  ScdInterface* scdi = _readNC->scdi;
 
   ErrorCode rval;
   std::string tag_name;
@@ -72,7 +73,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   int numDims = dimNames.size();
   rval = mbImpl->tag_get_handle(tag_name.c_str(), 1, MB_TYPE_INTEGER, numDimsTag, MB_TAG_SPARSE | MB_TAG_CREAT);
   ERRORR(rval, "Trouble creating __NUM_DIMS tag.");
-  rval = mbImpl->tag_set_data(numDimsTag, &file_set, 1, &numDims);
+  rval = mbImpl->tag_set_data(numDimsTag, &_fileSet, 1, &numDims);
   ERRORR(rval, "Trouble setting data for __NUM_DIMS tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -83,7 +84,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   int numVars = varInfo.size();
   rval = mbImpl->tag_get_handle(tag_name.c_str(), 1, MB_TYPE_INTEGER, numVarsTag, MB_TAG_SPARSE | MB_TAG_CREAT);
   ERRORR(rval, "Trouble creating __NUM_VARS tag.");
-  rval = mbImpl->tag_set_data(numVarsTag, &file_set, 1, &numVars);
+  rval = mbImpl->tag_set_data(numVarsTag, &_fileSet, 1, &numVars);
   ERRORR(rval, "Trouble setting data for __NUM_VARS tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -101,7 +102,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   rval = mbImpl->tag_get_handle(tag_name.c_str(), 0, MB_TYPE_OPAQUE, dimNamesTag, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
   ERRORR(rval, "Trouble creating __DIM_NAMES tag.");
   const void* ptr = dimnames.c_str();
-  rval = mbImpl->tag_set_by_ptr(dimNamesTag, &file_set, 1, &ptr, &dimnamesSz);
+  rval = mbImpl->tag_set_by_ptr(dimNamesTag, &_fileSet, 1, &ptr, &dimnamesSz);
   ERRORR(rval, "Trouble setting data for __DIM_NAMES tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -114,7 +115,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   rval = mbImpl->tag_get_handle(tag_name.c_str(), 0, MB_TYPE_INTEGER, dimValsTag, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
   ERRORR(rval, "Trouble creating __DIM_VALUES tag.");
   ptr = &(dimVals[0]);
-  rval = mbImpl->tag_set_by_ptr(dimValsTag, &file_set, 1, &ptr, &dimValsSz);
+  rval = mbImpl->tag_set_by_ptr(dimValsTag, &_fileSet, 1, &ptr, &dimValsSz);
   ERRORR(rval, "Trouble setting data for __DIM_VALUES tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -132,7 +133,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   rval = mbImpl->tag_get_handle(tag_name.c_str(), 0, MB_TYPE_OPAQUE, varNamesTag, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
   ERRORR(rval, "Trouble creating __VAR_NAMES tag.");
   ptr = varnames.c_str();
-  rval = mbImpl->tag_set_by_ptr(varNamesTag, &file_set, 1, &ptr, &varnamesSz);
+  rval = mbImpl->tag_set_by_ptr(varNamesTag, &_fileSet, 1, &ptr, &varnamesSz);
   ERRORR(rval, "Trouble setting data for __VAR_NAMES tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -149,7 +150,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
       val[1] = nTimeSteps - 1;
       rval = mbImpl->tag_get_handle(tag_name.c_str(), 2, MB_TYPE_INTEGER, tagh, MB_TAG_SPARSE | MB_TAG_CREAT);
       ERRORR(rval, "Trouble creating __<dim_name>_LOC_MINMAX tag.");
-      rval = mbImpl->tag_set_data(tagh, &file_set, 1, &val[0]);
+      rval = mbImpl->tag_set_data(tagh, &_fileSet, 1, &val[0]);
       ERRORR(rval, "Trouble setting data for __<dim_name>_LOC_MINMAX tag.");
       if (MB_SUCCESS == rval)
         dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -174,7 +175,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
     tag_name = ss_tag_name.str();
     rval = mbImpl->tag_get_handle(tag_name.c_str(), val.size(), MB_TYPE_INTEGER, tagh, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<dim_name>_LOC_VALS tag.");
-    rval = mbImpl->tag_set_data(tagh, &file_set, 1, &val[0]);
+    rval = mbImpl->tag_set_data(tagh, &_fileSet, 1, &val[0]);
     ERRORR(rval, "Trouble setting data for __<dim_name>_LOC_VALS tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -198,7 +199,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), varDimSz, MB_TYPE_HANDLE, varNamesDimsTag, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<var_name>_DIMS tag.");
-    rval = mbImpl->tag_set_data(varNamesDimsTag, &file_set, 1, &(varInfo[mapIter->first].varTags[0]));
+    rval = mbImpl->tag_set_data(varNamesDimsTag, &_fileSet, 1, &(varInfo[mapIter->first].varTags[0]));
     ERRORR(rval, "Trouble setting data for __<var_name>_DIMS tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -208,7 +209,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   Tag part_tag = scdi->part_method_tag();
   if (!part_tag)
     ERRORR(MB_FAILURE, "Trouble getting partition method tag.");
-  rval = mbImpl->tag_set_data(part_tag, &file_set, 1, &partMethod);
+  rval = mbImpl->tag_set_data(part_tag, &_fileSet, 1, &partMethod);
   ERRORR(rval, "Trouble setting data for PARTITION_METHOD tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -224,7 +225,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   ERRORR(rval, "Trouble creating attribute strings.");
   const void* gattptr = gattVal.c_str();
   int globalAttSz = gattVal.size();
-  rval = mbImpl->tag_set_by_ptr(globalAttTag, &file_set, 1, &gattptr, &globalAttSz);
+  rval = mbImpl->tag_set_by_ptr(globalAttTag, &_fileSet, 1, &gattptr, &globalAttSz);
   ERRORR(rval, "Trouble setting data for __GLOBAL_ATTRIBS tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -236,7 +237,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
     gattLen.push_back(0);
   rval = mbImpl->tag_get_handle(tag_name.c_str(), gattLen.size(), MB_TYPE_INTEGER, globalAttLenTag, MB_TAG_SPARSE | MB_TAG_CREAT);
   ERRORR(rval, "Trouble creating __GLOBAL_ATTRIBS_LEN tag.");
-  rval = mbImpl->tag_set_data(globalAttLenTag, &file_set, 1, &gattLen[0]);
+  rval = mbImpl->tag_set_data(globalAttLenTag, &_fileSet, 1, &gattLen[0]);
   ERRORR(rval, "Trouble setting data for __GLOBAL_ATTRIBS_LEN tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -255,7 +256,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
     ERRORR(rval, "Trouble creating attribute strings.");
     const void* varAttPtr = varAttVal.c_str();
     int varAttSz = varAttVal.size();
-    rval = mbImpl->tag_set_by_ptr(varAttTag, &file_set, 1, &varAttPtr, &varAttSz);
+    rval = mbImpl->tag_set_by_ptr(varAttTag, &_fileSet, 1, &varAttPtr, &varAttSz);
     ERRORR(rval, "Trouble setting data for __<var_name>_ATTRIBS tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -266,7 +267,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
     Tag varAttLenTag = 0;
     rval = mbImpl->tag_get_handle(tag_name.c_str(), varAttLen.size(), MB_TYPE_INTEGER, varAttLenTag, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<var_name>_ATTRIBS_LEN tag.");
-    rval = mbImpl->tag_set_data(varAttLenTag, &file_set, 1, &varAttLen[0]);
+    rval = mbImpl->tag_set_data(varAttLenTag, &_fileSet, 1, &varAttLen[0]);
     ERRORR(rval, "Trouble setting data for __<var_name>_ATTRIBS_LEN tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -282,7 +283,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   for (mapIter = varInfo.begin(); mapIter != varInfo.end(); ++mapIter) {
     varNamesLocs[std::distance(varInfo.begin(), mapIter)] = mapIter->second.entLoc;
   }
-  rval = mbImpl->tag_set_data(varNamesLocsTag, &file_set, 1, &varNamesLocs[0]);
+  rval = mbImpl->tag_set_data(varNamesLocsTag, &_fileSet, 1, &varNamesLocs[0]);
   ERRORR(rval, "Trouble setting data for __VAR_NAMES_LOCATIONS tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -296,7 +297,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   ERRORR(rval, "Trouble creating __MESH_TYPE tag.");
   ptr = meshTypeName.c_str();
   int leng= meshTypeName.size();
-  rval = mbImpl->tag_set_by_ptr(meshTypeTag, &file_set, 1, &ptr, &leng);
+  rval = mbImpl->tag_set_by_ptr(meshTypeTag, &_fileSet, 1, &ptr, &leng);
   ERRORR(rval, "Trouble setting data for __MESH_TYPE tag.");
   if (MB_SUCCESS == rval)
     dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -304,7 +305,7 @@ ErrorCode NCHelper::create_conventional_tags(ScdInterface* scdi, EntityHandle fi
   return MB_SUCCESS;
 }
 
-ErrorCode NCHelper::read_variable_to_set(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelper::read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   std::set<std::string>& dummyVarNames = _readNC->dummyVarNames;;
   Interface*& mbImpl = _readNC->mbImpl;
@@ -387,7 +388,7 @@ ErrorCode NCHelper::read_variable_to_set(EntityHandle file_set, std::vector<Read
   for (unsigned int i = 0; i < vdatas.size(); i++) {
     for (unsigned int t = 0; t < tstep_nums.size(); t++) {
       dbgOut.tprintf(2, "Setting data for variable %s, time step %d\n", vdatas[i].varName.c_str(), tstep_nums[t]);
-      ErrorCode tmp_rval = mbImpl->tag_set_by_ptr(vdatas[i].varTags[t], &file_set, 1, &(vdatas[i].varDatas[t]), &vdatas[i].sz);
+      ErrorCode tmp_rval = mbImpl->tag_set_by_ptr(vdatas[i].varTags[t], &_fileSet, 1, &(vdatas[i].varDatas[t]), &vdatas[i].sz);
       if (MB_SUCCESS != tmp_rval)
         rval = tmp_rval;
       if (vdatas[i].varDims.size() <= 1)
@@ -495,7 +496,7 @@ ErrorCode NCHelper::read_coordinate(const char* var_name, int lmin, int lmax, st
   int fail;
 
   // Check size
-  if (tcount != cvals.size())
+  if ((std::size_t)tcount != cvals.size())
     cvals.resize(tcount);
 
   // Check to make sure it's a float or double
@@ -774,12 +775,12 @@ ErrorCode NCHelper::read_variable_to_set_allocate(std::vector<ReadNC::VarData>&
   return rval;
 }
 
-ErrorCode ScdNCHelper::check_existing_mesh(EntityHandle file_set) {
+ErrorCode ScdNCHelper::check_existing_mesh() {
   Interface*& mbImpl = _readNC->mbImpl;
 
   // Get the number of vertices
   int num_verts;
-  ErrorCode rval = mbImpl->get_number_entities_by_dimension(file_set, 0, num_verts);
+  ErrorCode rval = mbImpl->get_number_entities_by_dimension(_fileSet, 0, num_verts);
   ERRORR(rval, "Trouble getting number of vertices.");
 
   /*
@@ -796,7 +797,7 @@ ErrorCode ScdNCHelper::check_existing_mesh(EntityHandle file_set) {
 
   // Check the number of elements too
   int num_elems;
-  rval = mbImpl->get_number_entities_by_dimension(file_set, (-1 == lDims[2] ? 2 : 3), num_elems);
+  rval = mbImpl->get_number_entities_by_dimension(_fileSet, (-1 == lDims[2] ? 2 : 3), num_elems);
   ERRORR(rval, "Trouble getting number of elements.");
 
   /*
@@ -814,11 +815,12 @@ ErrorCode ScdNCHelper::check_existing_mesh(EntityHandle file_set) {
   return MB_SUCCESS;
 }
 
-ErrorCode ScdNCHelper::create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& faces)
+ErrorCode ScdNCHelper::create_mesh(Range& faces)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   Tag& mGlobalIdTag = _readNC->mGlobalIdTag;
   DebugOutput& dbgOut = _readNC->dbgOut;
+  ScdInterface* scdi = _readNC->scdi;
   ScdParData& parData = _readNC->parData;
 
   Range tmp_range;
@@ -832,7 +834,7 @@ ErrorCode ScdNCHelper::create_mesh(ScdInterface* scdi, const FileOptions& opts,
   tmp_range.insert(scd_box->start_vertex(), scd_box->start_vertex() + scd_box->num_vertices() - 1);
   tmp_range.insert(scd_box->start_element(), scd_box->start_element() + scd_box->num_elements() - 1);
   tmp_range.insert(scd_box->box_set());
-  rval = mbImpl->add_entities(file_set, tmp_range);
+  rval = mbImpl->add_entities(_fileSet, tmp_range);
   ERRORR(rval, "Couldn't add new vertices to file set.");
 
   dbgOut.tprintf(1, "scdbox %d quads, %d vertices\n", scd_box->num_elements(), scd_box->num_vertices());
@@ -911,7 +913,7 @@ ErrorCode ScdNCHelper::create_mesh(ScdInterface* scdi, const FileOptions& opts,
   return MB_SUCCESS;
 }
 
-ErrorCode ScdNCHelper::read_variables(EntityHandle file_set, std::vector<std::string>& var_names, std::vector<int>& tstep_nums)
+ErrorCode ScdNCHelper::read_variables(std::vector<std::string>& var_names, std::vector<int>& tstep_nums)
 {
   std::vector<ReadNC::VarData> vdatas;
   std::vector<ReadNC::VarData> vsetdatas;
@@ -920,16 +922,16 @@ ErrorCode ScdNCHelper::read_variables(EntityHandle file_set, std::vector<std::st
   ERRORR(rval, "Trouble setting up read variable.");
 
   // Create COORDS tag for quads
-  rval = create_quad_coordinate_tag(file_set);
+  rval = create_quad_coordinate_tag();
   ERRORR(rval, "Trouble creating coordinate tags to entities quads");
 
   if (!vsetdatas.empty()) {
-    rval = read_variable_to_set(file_set, vsetdatas, tstep_nums);
+    rval = read_variable_to_set(vsetdatas, tstep_nums);
     ERRORR(rval, "Trouble read variables to set.");
   }
 
   if (!vdatas.empty()) {
-    rval = read_scd_variable_to_nonset(file_set, vdatas, tstep_nums);
+    rval = read_scd_variable_to_nonset(vdatas, tstep_nums);
     ERRORR(rval, "Trouble read variables to entities verts/edges/faces.");
   }
 
@@ -1012,7 +1014,7 @@ ErrorCode ScdNCHelper::read_scd_variable_setup(std::vector<std::string>& var_nam
   return MB_SUCCESS;
 }
 
-ErrorCode ScdNCHelper::read_scd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode ScdNCHelper::read_scd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   std::vector<int>& dimVals = _readNC->dimVals;
@@ -1025,18 +1027,18 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset_allocate(EntityHandle file_se
 
   // Get vertices in set
   Range verts;
-  rval = mbImpl->get_entities_by_dimension(file_set, 0, verts);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
   ERRORR(rval, "Trouble getting vertices in set.");
   assert("Should only have a single vertex subrange, since they were read in one shot" &&
       verts.psize() == 1);
 
   Range edges;
-  rval = mbImpl->get_entities_by_dimension(file_set, 1, edges);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 1, edges);
   ERRORR(rval, "Trouble getting edges in set.");
 
   // Get faces in set
   Range faces;
-  rval = mbImpl->get_entities_by_dimension(file_set, 2, faces);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 2, faces);
   ERRORR(rval, "Trouble getting faces in set.");
   assert("Should only have a single face subrange, since they were read in one shot" &&
       faces.psize() == 1);
@@ -1141,11 +1143,11 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset_allocate(EntityHandle file_se
   return rval;
 }
 
-ErrorCode ScdNCHelper::read_scd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode ScdNCHelper::read_scd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   DebugOutput& dbgOut = _readNC->dbgOut;
 
-  ErrorCode rval = read_scd_variable_to_nonset_allocate(file_set, vdatas, tstep_nums);
+  ErrorCode rval = read_scd_variable_to_nonset_allocate(vdatas, tstep_nums);
   ERRORR(rval, "Trouble allocating read variables.");
 
   // Finally, read into that space
@@ -1265,12 +1267,12 @@ ErrorCode ScdNCHelper::read_scd_variable_to_nonset(EntityHandle file_set, std::v
   return rval;
 }
 
-ErrorCode ScdNCHelper::create_quad_coordinate_tag(EntityHandle file_set) {
+ErrorCode ScdNCHelper::create_quad_coordinate_tag() {
   Interface*& mbImpl = _readNC->mbImpl;
   bool& isParallel = _readNC->isParallel;
 
   Range ents;
-  ErrorCode rval = mbImpl->get_entities_by_type(file_set, moab::MBQUAD, ents);
+  ErrorCode rval = mbImpl->get_entities_by_type(_fileSet, moab::MBQUAD, ents);
   ERRORR(rval, "Trouble getting QUAD entity.");
 
   std::size_t numOwnedEnts = 0;
@@ -1325,7 +1327,7 @@ ErrorCode ScdNCHelper::create_quad_coordinate_tag(EntityHandle file_set) {
   return MB_SUCCESS;
 }
 
-ErrorCode UcdNCHelper::read_variables(EntityHandle file_set, std::vector<std::string>& var_names, std::vector<int>& tstep_nums)
+ErrorCode UcdNCHelper::read_variables(std::vector<std::string>& var_names, std::vector<int>& tstep_nums)
 {
   std::vector<ReadNC::VarData> vdatas;
   std::vector<ReadNC::VarData> vsetdatas;
@@ -1334,17 +1336,17 @@ ErrorCode UcdNCHelper::read_variables(EntityHandle file_set, std::vector<std::st
   ERRORR(rval, "Trouble setting up read variable.");
 
   if (!vsetdatas.empty()) {
-    rval = read_variable_to_set(file_set, vsetdatas, tstep_nums);
+    rval = read_variable_to_set(vsetdatas, tstep_nums);
     ERRORR(rval, "Trouble read variables to set.");
   }
 
   if (!vdatas.empty()) {
 #ifdef PNETCDF_FILE
     // With pnetcdf support, we will use async read
-    rval = read_ucd_variable_to_nonset_async(file_set, vdatas, tstep_nums);
+    rval = read_ucd_variable_to_nonset_async(vdatas, tstep_nums);
 #else
     // Without pnetcdf support, we will use old read
-    rval = read_ucd_variable_to_nonset(file_set, vdatas, tstep_nums);
+    rval = read_ucd_variable_to_nonset(vdatas, tstep_nums);
 #endif
     ERRORR(rval, "Trouble read variables to entities verts/edges/faces.");
   }

diff --git a/src/io/NCHelper.hpp b/src/io/NCHelper.hpp
index 4a8f556..6355141 100644
--- a/src/io/NCHelper.hpp
+++ b/src/io/NCHelper.hpp
@@ -17,27 +17,27 @@ namespace moab {
 class NCHelper
 {
 public:
-  NCHelper(ReadNC* readNC, int fileId) :_readNC(readNC), _fileId(fileId),
+  NCHelper(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+:_readNC(readNC), _fileId(fileId), _opts(opts), _fileSet(fileSet),
   nTimeSteps(0), nLevels(1), tDim(-1), levDim(-1) {}
   virtual ~NCHelper() {}
 
   //! Get appropriate helper instance for ReadNC class
-  static NCHelper* get_nc_helper(ReadNC* readNC, int fileId, const FileOptions& opts);
+  static NCHelper* get_nc_helper(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet);
 
   //! Interfaces to be implemented in child classes
-  virtual ErrorCode init_mesh_vals(const FileOptions& opts, EntityHandle file_set) = 0;
-  virtual ErrorCode check_existing_mesh(EntityHandle file_set) = 0;
-  virtual ErrorCode create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& faces) = 0;
-  virtual ErrorCode read_variables(EntityHandle file_set, std::vector<std::string>& var_names, std::vector<int>& tstep_nums) = 0;
+  virtual ErrorCode init_mesh_vals() = 0;
+  virtual ErrorCode check_existing_mesh() = 0;
+  virtual ErrorCode create_mesh(Range& faces) = 0;
+  virtual ErrorCode read_variables(std::vector<std::string>& var_names, std::vector<int>& tstep_nums) = 0;
   virtual std::string get_mesh_type_name() = 0;
 
   //! Create NC conventional tags
-  ErrorCode create_conventional_tags(ScdInterface* scdi, EntityHandle file_set,
-                                     const std::vector<int>& tstep_nums);
+  ErrorCode create_conventional_tags(const std::vector<int>& tstep_nums);
 
 protected:
   //! Read set variables, common to scd mesh and ucd mesh
-  ErrorCode read_variable_to_set(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums);
+  ErrorCode read_variable_to_set(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums);
 
   //! Convert variables in place
   ErrorCode convert_variable(ReadNC::VarData& var_data, int tstep_num);
@@ -67,9 +67,13 @@ private:
   ErrorCode read_variable_to_set_allocate(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums);
 
 protected:
+  //! Allow NCHelper to directly access members of ReadNC
   ReadNC* _readNC;
 
+  //! Cache some information from ReadNC
   int _fileId;
+  const FileOptions& _opts;
+  EntityHandle _fileSet;
 
   //! Dimensions of time and level
   int nTimeSteps, nLevels;
@@ -85,7 +89,8 @@ protected:
 class ScdNCHelper : public NCHelper
 {
 public:
-  ScdNCHelper(ReadNC* readNC, int fileId) : NCHelper(readNC, fileId),
+  ScdNCHelper(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+: NCHelper(readNC, fileId, opts, fileSet),
   iDim(-1), jDim(-1), iCDim(-1), jCDim(-1)
   {
     for (unsigned int i = 0; i < 6; i++) {
@@ -102,11 +107,11 @@ public:
 
 private:
   //! Implementation of NCHelper::check_existing_mesh()
-  virtual ErrorCode check_existing_mesh(EntityHandle file_set);
+  virtual ErrorCode check_existing_mesh();
   //! Implementation of NCHelper::create_mesh()
-  virtual ErrorCode create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& faces);
+  virtual ErrorCode create_mesh(Range& faces);
   //! Implementation of NCHelper::read_variables()
-  virtual ErrorCode read_variables(EntityHandle file_set, std::vector<std::string>& var_names, std::vector<int>& tstep_nums);
+  virtual ErrorCode read_variables(std::vector<std::string>& var_names, std::vector<int>& tstep_nums);
 
   //! Separate set and non-set variables for scd mesh
   ErrorCode read_scd_variable_setup(std::vector<std::string>& var_names,
@@ -115,13 +120,13 @@ private:
                                     std::vector<ReadNC::VarData>& vsetdatas);
 
   //! Read non-set variables for scd mesh
-  ErrorCode read_scd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  ErrorCode read_scd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas,
                                                  std::vector<int>& tstep_nums);
-  ErrorCode read_scd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  ErrorCode read_scd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas,
                                         std::vector<int>& tstep_nums);
 
   //! Create COORDS tag for quads coordinate
-  ErrorCode create_quad_coordinate_tag(EntityHandle file_set);
+  ErrorCode create_quad_coordinate_tag();
 
   template <typename T> ErrorCode kji_to_jik(size_t ni, size_t nj, size_t nk, void* dest, T* source)
   {
@@ -170,7 +175,8 @@ protected:
 class UcdNCHelper : public NCHelper
 {
 public:
-  UcdNCHelper(ReadNC* readNC, int fileId) : NCHelper(readNC, fileId),
+  UcdNCHelper(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+: NCHelper(readNC, fileId, opts, fileSet),
   nCells(0), nEdges(0), nVertices(0),
   nLocalCells(0), nLocalEdges(0), nLocalVertices(0),
   cDim(-1), eDim(-1), vDim(-1) {}
@@ -178,7 +184,7 @@ public:
 
 private:
   //! Implementation of NCHelper::read_variables()
-  virtual ErrorCode read_variables(EntityHandle file_set, std::vector<std::string>& var_names,
+  virtual ErrorCode read_variables(std::vector<std::string>& var_names,
                                    std::vector<int> &tstep_nums);
 
   //! Separate set and non-set variables for ucd mesh (implemented differently in child classes)
@@ -188,13 +194,13 @@ private:
                                             std::vector<ReadNC::VarData>& vsetdatas) = 0;
 
   //! Read non-set variables for ucd mesh (implemented differently in child classes)
-  virtual ErrorCode read_ucd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas,
                                                          std::vector<int>& tstep_nums) = 0;
 #ifdef PNETCDF_FILE
-  virtual ErrorCode read_ucd_variable_to_nonset_async(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas,
                                                       std::vector<int>& tstep_nums) = 0;
 #else
-  virtual ErrorCode read_ucd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas,
                                                 std::vector<int>& tstep_nums) = 0;
 #endif
 

diff --git a/src/io/NCHelperEuler.cpp b/src/io/NCHelperEuler.cpp
index 51094dd..7c80dc7 100644
--- a/src/io/NCHelperEuler.cpp
+++ b/src/io/NCHelperEuler.cpp
@@ -49,7 +49,7 @@ bool NCHelperEuler::can_read_file(ReadNC* readNC, int fileId)
   return false;
 }
 
-ErrorCode NCHelperEuler::init_mesh_vals(const FileOptions& opts, EntityHandle file_set)
+ErrorCode NCHelperEuler::init_mesh_vals()
 {
   Interface*& mbImpl = _readNC->mbImpl;
   std::vector<std::string>& dimNames = _readNC->dimNames;
@@ -159,10 +159,10 @@ ErrorCode NCHelperEuler::init_mesh_vals(const FileOptions& opts, EntityHandle fi
     locallyPeriodic[0] = globallyPeriodic[0];
   }
 
-  opts.get_int_option("IMIN", lDims[0]);
-  opts.get_int_option("IMAX", lDims[3]);
-  opts.get_int_option("JMIN", lDims[1]);
-  opts.get_int_option("JMAX", lDims[4]);
+  _opts.get_int_option("IMIN", lDims[0]);
+  _opts.get_int_option("IMAX", lDims[3]);
+  _opts.get_int_option("JMIN", lDims[1]);
+  _opts.get_int_option("JMAX", lDims[4]);
 
   // Now get actual coordinate values for vertices and cell centers
   lCDims[0] = lDims[0];
@@ -380,7 +380,7 @@ ErrorCode NCHelperEuler::init_mesh_vals(const FileOptions& opts, EntityHandle fi
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), 0, data_type, tagh, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
     ERRORR(rval, "Trouble creating <coordinate_dim_name> tag.");
-    rval = mbImpl->tag_set_by_ptr(tagh, &file_set, 1, &val, &val_len);
+    rval = mbImpl->tag_set_by_ptr(tagh, &_fileSet, 1, &val, &val_len);
     ERRORR(rval, "Trouble setting data for <coordinate_dim_name> tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -411,7 +411,7 @@ ErrorCode NCHelperEuler::init_mesh_vals(const FileOptions& opts, EntityHandle fi
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), 2, MB_TYPE_INTEGER, tagh, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<coordinate_dim_name>_LOC_MINMAX tag.");
-    rval = mbImpl->tag_set_data(tagh, &file_set, 1, &val[0]);
+    rval = mbImpl->tag_set_data(tagh, &_fileSet, 1, &val[0]);
     ERRORR(rval, "Trouble setting data for __<coordinate_dim_name>_LOC_MINMAX tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -442,7 +442,7 @@ ErrorCode NCHelperEuler::init_mesh_vals(const FileOptions& opts, EntityHandle fi
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), 2, MB_TYPE_INTEGER, tagh, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<coordinate_dim_name>_GLOBAL_MINMAX tag.");
-    rval = mbImpl->tag_set_data(tagh, &file_set, 1, &val[0]);
+    rval = mbImpl->tag_set_data(tagh, &_fileSet, 1, &val[0]);
     ERRORR(rval, "Trouble setting data for __<coordinate_dim_name>_GLOBAL_MINMAX tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());

diff --git a/src/io/NCHelperEuler.hpp b/src/io/NCHelperEuler.hpp
index a0d6aef..cae413a 100644
--- a/src/io/NCHelperEuler.hpp
+++ b/src/io/NCHelperEuler.hpp
@@ -17,12 +17,13 @@ namespace moab {
 class NCHelperEuler : public ScdNCHelper
 {
 public:
-  NCHelperEuler(ReadNC* readNC, int fileId) : ScdNCHelper(readNC, fileId) {}
+  NCHelperEuler(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+: ScdNCHelper(readNC, fileId, opts, fileSet) {}
 
   static bool can_read_file(ReadNC* readNC, int fileId);
 
 private:
-  virtual ErrorCode init_mesh_vals(const FileOptions& opts, EntityHandle file_set);
+  virtual ErrorCode init_mesh_vals();
   virtual std::string get_mesh_type_name() { return "CAM_EUL"; }
 };
 

diff --git a/src/io/NCHelperFV.cpp b/src/io/NCHelperFV.cpp
index ccae4e3..8b21e36 100644
--- a/src/io/NCHelperFV.cpp
+++ b/src/io/NCHelperFV.cpp
@@ -42,7 +42,7 @@ bool NCHelperFV::can_read_file(ReadNC* readNC, int fileId)
   return false;
 }
 
-ErrorCode NCHelperFV::init_mesh_vals(const FileOptions& opts, EntityHandle file_set)
+ErrorCode NCHelperFV::init_mesh_vals()
 {
   Interface*& mbImpl = _readNC->mbImpl;
   std::vector<std::string>& dimNames = _readNC->dimNames;
@@ -172,10 +172,10 @@ ErrorCode NCHelperFV::init_mesh_vals(const FileOptions& opts, EntityHandle file_
     locallyPeriodic[0] = globallyPeriodic[0];
   }
 
-  opts.get_int_option("IMIN", lDims[0]);
-  opts.get_int_option("IMAX", lDims[3]);
-  opts.get_int_option("JMIN", lDims[1]);
-  opts.get_int_option("JMAX", lDims[4]);
+  _opts.get_int_option("IMIN", lDims[0]);
+  _opts.get_int_option("IMAX", lDims[3]);
+  _opts.get_int_option("JMIN", lDims[1]);
+  _opts.get_int_option("JMAX", lDims[4]);
 
   // Now get actual coordinate values for vertices and cell centers
   lCDims[0] = lDims[0];
@@ -382,7 +382,7 @@ ErrorCode NCHelperFV::init_mesh_vals(const FileOptions& opts, EntityHandle file_
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), 0, data_type, tagh, MB_TAG_CREAT | MB_TAG_SPARSE | MB_TAG_VARLEN);
     ERRORR(rval, "Trouble creating <coordinate_dim_name> tag.");
-    rval = mbImpl->tag_set_by_ptr(tagh, &file_set, 1, &val, &val_len);
+    rval = mbImpl->tag_set_by_ptr(tagh, &_fileSet, 1, &val, &val_len);
     ERRORR(rval, "Trouble setting data for <coordinate_dim_name> tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -413,7 +413,7 @@ ErrorCode NCHelperFV::init_mesh_vals(const FileOptions& opts, EntityHandle file_
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), 2, MB_TYPE_INTEGER, tagh, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<coordinate_dim_name>_LOC_MINMAX tag.");
-    rval = mbImpl->tag_set_data(tagh, &file_set, 1, &val[0]);
+    rval = mbImpl->tag_set_data(tagh, &_fileSet, 1, &val[0]);
     ERRORR(rval, "Trouble setting data for __<coordinate_dim_name>_LOC_MINMAX tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());
@@ -444,7 +444,7 @@ ErrorCode NCHelperFV::init_mesh_vals(const FileOptions& opts, EntityHandle file_
     }
     rval = mbImpl->tag_get_handle(tag_name.c_str(), 2, MB_TYPE_INTEGER, tagh, MB_TAG_SPARSE | MB_TAG_CREAT);
     ERRORR(rval, "Trouble creating __<coordinate_dim_name>_GLOBAL_MINMAX tag.");
-    rval = mbImpl->tag_set_data(tagh, &file_set, 1, &val[0]);
+    rval = mbImpl->tag_set_data(tagh, &_fileSet, 1, &val[0]);
     ERRORR(rval, "Trouble setting data for __<coordinate_dim_name>_GLOBAL_MINMAX tag.");
     if (MB_SUCCESS == rval)
       dbgOut.tprintf(2, "Tag created for variable %s\n", tag_name.c_str());

diff --git a/src/io/NCHelperFV.hpp b/src/io/NCHelperFV.hpp
index 7dde6dc..7dd141e 100644
--- a/src/io/NCHelperFV.hpp
+++ b/src/io/NCHelperFV.hpp
@@ -17,11 +17,12 @@ namespace moab {
 class NCHelperFV : public ScdNCHelper
 {
 public:
-  NCHelperFV(ReadNC* readNC, int fileId) : ScdNCHelper(readNC, fileId) {}
+  NCHelperFV(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+: ScdNCHelper(readNC, fileId, opts, fileSet) {}
   static bool can_read_file(ReadNC* readNC, int fileId);
 
 private:
-  virtual ErrorCode init_mesh_vals(const FileOptions& opts, EntityHandle file_set);
+  virtual ErrorCode init_mesh_vals();
   virtual std::string get_mesh_type_name() { return "CAM_FV"; }
 };
 

diff --git a/src/io/NCHelperHOMME.cpp b/src/io/NCHelperHOMME.cpp
index 8b329be..acee3a5 100644
--- a/src/io/NCHelperHOMME.cpp
+++ b/src/io/NCHelperHOMME.cpp
@@ -13,7 +13,8 @@
 
 namespace moab {
 
-NCHelperHOMME::NCHelperHOMME(ReadNC* readNC, int fileId, const FileOptions& opts) : UcdNCHelper(readNC, fileId),
+NCHelperHOMME::NCHelperHOMME(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+: UcdNCHelper(readNC, fileId, opts, fileSet),
 _spectralOrder(-1), connectId(-1)
 {
   // Calculate spectral order
@@ -58,7 +59,7 @@ bool NCHelperHOMME::can_read_file(ReadNC* readNC, int fileId)
   return false;
 }
 
-ErrorCode NCHelperHOMME::init_mesh_vals(const FileOptions& opts, EntityHandle file_set)
+ErrorCode NCHelperHOMME::init_mesh_vals()
 {
   std::vector<std::string>& dimNames = _readNC->dimNames;
   std::vector<int>& dimVals = _readNC->dimVals;
@@ -172,7 +173,7 @@ ErrorCode NCHelperHOMME::init_mesh_vals(const FileOptions& opts, EntityHandle fi
 // of scope (and deleted). The old instance initialized localGidVerts properly when the mesh was
 // created, but it is now lost. The new instance (will not create the mesh with noMesh option) has
 // to restore it based on the existing mesh from last read
-ErrorCode NCHelperHOMME::check_existing_mesh(EntityHandle tmp_set)
+ErrorCode NCHelperHOMME::check_existing_mesh()
 {
   Interface*& mbImpl = _readNC->mbImpl;
   Tag& mGlobalIdTag = _readNC->mGlobalIdTag;
@@ -188,7 +189,7 @@ ErrorCode NCHelperHOMME::check_existing_mesh(EntityHandle tmp_set)
 
     // We need to get all vertices from tmp_set (it is the input set in no_mesh scenario)
     Range local_verts;
-    ErrorCode rval = mbImpl->get_entities_by_dimension(tmp_set, 0, local_verts);
+    ErrorCode rval = mbImpl->get_entities_by_dimension(_fileSet, 0, local_verts);
     if (MB_FAILURE == rval)
       return rval;
 
@@ -208,7 +209,7 @@ ErrorCode NCHelperHOMME::check_existing_mesh(EntityHandle tmp_set)
   return MB_SUCCESS;
 }
 
-ErrorCode NCHelperHOMME::create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& faces)
+ErrorCode NCHelperHOMME::create_mesh(Range& faces)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   std::string& fileName = _readNC->fileName;
@@ -223,7 +224,7 @@ ErrorCode NCHelperHOMME::create_mesh(ScdInterface* scdi, const FileOptions& opts
   std::string conn_fname;
 
   // Try to open the connectivity file through CONN option, if used
-  ErrorCode rval = opts.get_str_option("CONN", conn_fname);
+  ErrorCode rval = _opts.get_str_option("CONN", conn_fname);
   if (MB_SUCCESS != rval) {
     // Default convention for reading HOMME is a file HommeMapping.nc in same dir as data file
     conn_fname = std::string(fileName);
@@ -422,14 +423,14 @@ ErrorCode NCHelperHOMME::create_mesh(ScdInterface* scdi, const FileOptions& opts
   // Add new vertices and elements to the set
   faces.merge(tmp_range);
   tmp_range.insert(start_vertex, start_vertex + num_local_verts - 1);
-  rval = mbImpl->add_entities(file_set, tmp_range);
+  rval = mbImpl->add_entities(_fileSet, tmp_range);
   ERRORR(rval, "Couldn't add new vertices and quads/hexes to file set.");
 
   // Mark the set with the spectral order
   Tag sporder;
   rval = mbImpl->tag_get_handle("SPECTRAL_ORDER", 1, MB_TYPE_INTEGER, sporder, MB_TAG_CREAT | MB_TAG_SPARSE);
   ERRORR(rval, "Couldn't create spectral order tag.");
-  rval = mbImpl->tag_set_data(sporder, &file_set, 1, &_spectralOrder);
+  rval = mbImpl->tag_set_data(sporder, &_fileSet, 1, &_spectralOrder);
   ERRORR(rval, "Couldn't set value for spectral order tag.");
 
   if (create_gathers) {
@@ -562,7 +563,7 @@ ErrorCode NCHelperHOMME::read_ucd_variable_setup(std::vector<std::string>& var_n
   return MB_SUCCESS;
 }
 
-ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   std::vector<int>& dimVals = _readNC->dimVals;
@@ -574,7 +575,7 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_allocate(EntityHandle file_
 
   // Get vertices in set
   Range verts;
-  rval = mbImpl->get_entities_by_dimension(file_set, 0, verts);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
   ERRORR(rval, "Trouble getting vertices in set.");
   assert("Should only have a single vertex subrange, since they were read in one shot" &&
       verts.psize() == 1);
@@ -645,11 +646,11 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_allocate(EntityHandle file_
 }
 
 #ifdef PNETCDF_FILE
-ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_async(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   DebugOutput& dbgOut = _readNC->dbgOut;
 
-  ErrorCode rval = read_ucd_variable_to_nonset_allocate(file_set, vdatas, tstep_nums);
+  ErrorCode rval = read_ucd_variable_to_nonset_allocate(vdatas, tstep_nums);
   ERRORR(rval, "Trouble allocating read variables.");
 
   // Finally, read into that space
@@ -805,11 +806,11 @@ ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset_async(EntityHandle file_set
   return rval;
 }
 #else
-ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelperHOMME::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   DebugOutput& dbgOut = _readNC->dbgOut;
 
-  ErrorCode rval = read_ucd_variable_to_nonset_allocate(file_set, vdatas, tstep_nums);
+  ErrorCode rval = read_ucd_variable_to_nonset_allocate(vdatas, tstep_nums);
   ERRORR(rval, "Trouble allocating read variables.");
 
   // Finally, read into that space

diff --git a/src/io/NCHelperHOMME.hpp b/src/io/NCHelperHOMME.hpp
index d6b2e79..d064469 100644
--- a/src/io/NCHelperHOMME.hpp
+++ b/src/io/NCHelperHOMME.hpp
@@ -17,21 +17,21 @@ namespace moab {
 class NCHelperHOMME : public UcdNCHelper
 {
 public:
-  NCHelperHOMME(ReadNC* readNC, int fileId, const FileOptions& opts);
+  NCHelperHOMME(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet);
   static bool can_read_file(ReadNC* readNC, int fileId);
 
 private:
   //! Implementation of NCHelper::init_mesh_vals()
-  virtual ErrorCode init_mesh_vals(const FileOptions& opts, EntityHandle file_set);
+  virtual ErrorCode init_mesh_vals();
   //! Implementation of NCHelper::check_existing_mesh()
-  virtual ErrorCode check_existing_mesh(EntityHandle file_set);
+  virtual ErrorCode check_existing_mesh();
   //! Implementation of NCHelper::create_mesh()
-  virtual ErrorCode create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& faces);
+  virtual ErrorCode create_mesh(Range& faces);
   //! Implementation of NCHelper::get_mesh_type_name()
   virtual std::string get_mesh_type_name() { return "CAM_SE"; }
 
   //! Implementation of UcdNCHelper::read_ucd_variable_to_nonset_allocate()
-  virtual ErrorCode read_ucd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas,
                                                          std::vector<int>& tstep_nums);
   //! Implementation of UcdNCHelper::read_ucd_variable_setup()
   virtual ErrorCode read_ucd_variable_setup(std::vector<std::string>& var_names,
@@ -40,11 +40,11 @@ private:
                                             std::vector<ReadNC::VarData>& vsetdatas);
 #ifdef PNETCDF_FILE
   //! Implementation of UcdNCHelper::read_ucd_variable_to_nonset_async()
-  virtual ErrorCode read_ucd_variable_to_nonset_async(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas,
                                                       std::vector<int>& tstep_nums);
 #else
   //! Implementation of UcdNCHelper::read_ucd_variable_to_nonset()
-  virtual ErrorCode read_ucd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas,
                                                 std::vector<int>& tstep_nums);
 #endif
 

diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index f01b8dc..042b1f5 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -16,8 +16,8 @@ namespace moab {
 
 const int MAX_EDGES_PER_CELL = 10;
 
-NCHelperMPAS::NCHelperMPAS(ReadNC* readNC, int fileId, const FileOptions& opts)
-: UcdNCHelper(readNC, fileId)
+NCHelperMPAS::NCHelperMPAS(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet)
+: UcdNCHelper(readNC, fileId, opts, fileSet)
 , maxCellEdges(MAX_EDGES_PER_CELL)
 , numCellGroups(0)
 {
@@ -25,7 +25,7 @@ NCHelperMPAS::NCHelperMPAS(ReadNC* readNC, int fileId, const FileOptions& opts)
     readNC->partMethod = -1;
 }
 
-bool NCHelperMPAS::can_read_file(ReadNC* readNC, int fileId)
+bool NCHelperMPAS::can_read_file(ReadNC* readNC)
 {
   std::vector<std::string>& dimNames = readNC->dimNames;
 
@@ -36,7 +36,7 @@ bool NCHelperMPAS::can_read_file(ReadNC* readNC, int fileId)
   return false;
 }
 
-ErrorCode NCHelperMPAS::init_mesh_vals(const FileOptions& opts, EntityHandle file_set)
+ErrorCode NCHelperMPAS::init_mesh_vals()
 {
   std::vector<std::string>& dimNames = _readNC->dimNames;
   std::vector<int>& dimVals = _readNC->dimVals;
@@ -175,7 +175,7 @@ ErrorCode NCHelperMPAS::init_mesh_vals(const FileOptions& opts, EntityHandle fil
 // of scope (and deleted). The old instance initialized some variables properly when the mesh was
 // created, but they are now lost. The new instance (will not create the mesh with noMesh option)
 // has to restore them based on the existing mesh from last read
-ErrorCode NCHelperMPAS::check_existing_mesh(EntityHandle tmp_set)
+ErrorCode NCHelperMPAS::check_existing_mesh()
 {
   Interface*& mbImpl = _readNC->mbImpl;
   Tag& mGlobalIdTag = _readNC->mGlobalIdTag;
@@ -187,7 +187,7 @@ ErrorCode NCHelperMPAS::check_existing_mesh(EntityHandle tmp_set)
     if (localGidVerts.empty()) {
       // Get all vertices from tmp_set (it is the input set in no_mesh scenario)
       Range local_verts;
-      rval = mbImpl->get_entities_by_dimension(tmp_set, 0, local_verts);
+      rval = mbImpl->get_entities_by_dimension(_fileSet, 0, local_verts);
       if (MB_FAILURE == rval)
         return rval;
 
@@ -206,9 +206,9 @@ ErrorCode NCHelperMPAS::check_existing_mesh(EntityHandle tmp_set)
     }
 
     if (localGidEdges.empty()) {
-      // Get all edges from tmp_set (it is the input set in no_mesh scenario)
+      // Get all edges from _fileSet (it is the input set in no_mesh scenario)
       Range local_edges;
-      rval = mbImpl->get_entities_by_dimension(tmp_set, 1, local_edges);
+      rval = mbImpl->get_entities_by_dimension(_fileSet, 1, local_edges);
       if (MB_FAILURE == rval)
         return rval;
 
@@ -229,7 +229,7 @@ ErrorCode NCHelperMPAS::check_existing_mesh(EntityHandle tmp_set)
     if (localGidCells.empty()) {
       // Get all cells from tmp_set (it is the input set in no_mesh scenario)
       Range local_cells;
-      rval = mbImpl->get_entities_by_dimension(tmp_set, 2, local_cells);
+      rval = mbImpl->get_entities_by_dimension(_fileSet, 2, local_cells);
       if (MB_FAILURE == rval)
         return rval;
 
@@ -257,14 +257,14 @@ ErrorCode NCHelperMPAS::check_existing_mesh(EntityHandle tmp_set)
     if (0 == numCellGroups) {
       Tag numCellGroupsTag;
       rval = mbImpl->tag_get_handle("__NUM_CELL_GROUPS", 1, MB_TYPE_INTEGER, numCellGroupsTag);
-      rval = mbImpl->tag_get_data(numCellGroupsTag, &tmp_set, 1, &numCellGroups);
+      rval = mbImpl->tag_get_data(numCellGroupsTag, &_fileSet, 1, &numCellGroups);
     }
   }
 
   return MB_SUCCESS;
 }
 
-ErrorCode NCHelperMPAS::create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& faces)
+ErrorCode NCHelperMPAS::create_mesh(Range& faces)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   Tag& mGlobalIdTag = _readNC->mGlobalIdTag;
@@ -377,7 +377,7 @@ ErrorCode NCHelperMPAS::create_mesh(ScdInterface* scdi, const FileOptions& opts,
   Tag numCellGroupsTag = 0;
   rval = mbImpl->tag_get_handle("__NUM_CELL_GROUPS", 1, MB_TYPE_INTEGER, numCellGroupsTag, MB_TAG_SPARSE | MB_TAG_CREAT);
   ERRORR(rval, "Trouble creating __NUM_CELL_GROUPS tag.");
-  rval = mbImpl->tag_set_data(numCellGroupsTag, &file_set, 1, &numCellGroups);
+  rval = mbImpl->tag_set_data(numCellGroupsTag, &_fileSet, 1, &numCellGroups);
   ERRORR(rval, "Trouble setting data for __NUM_CELL_GROUPS tag.");
 
   // Collect localGid for vertices
@@ -467,7 +467,7 @@ ErrorCode NCHelperMPAS::create_mesh(ScdInterface* scdi, const FileOptions& opts,
   std::copy(localGidEdges.begin(), localGidEdges.end(), gid_data);
 
   // Add new vertices, elements and edges to the file set
-  rval = _readNC->mbImpl->add_entities(file_set, tmp_range);
+  rval = _readNC->mbImpl->add_entities(_fileSet, tmp_range);
   ERRORR(rval, "Couldn't add new vertices/faces/edges to file set.");
 
   return MB_SUCCESS;
@@ -562,7 +562,7 @@ ErrorCode NCHelperMPAS::read_ucd_variable_setup(std::vector<std::string>& var_na
   return MB_SUCCESS;
 }
 
-ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   std::vector<int>& dimVals = _readNC->dimVals;
@@ -575,19 +575,19 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_allocate(EntityHandle file_s
 
   // Get vertices in set
   Range verts;
-  rval = mbImpl->get_entities_by_dimension(file_set, 0, verts);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 0, verts);
   ERRORR(rval, "Trouble getting vertices in set.");
   assert("Should only have a single vertex subrange, since they were read in one shot" &&
       verts.psize() == 1);
 
   // Get edges in set
   Range edges;
-  rval = mbImpl->get_entities_by_dimension(file_set, 1, edges);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 1, edges);
   ERRORR(rval, "Trouble getting edges in set.");
 
   // Get faces in set
   Range faces;
-  rval = mbImpl->get_entities_by_dimension(file_set, 2, faces);
+  rval = mbImpl->get_entities_by_dimension(_fileSet, 2, faces);
   ERRORR(rval, "Trouble getting faces in set.");
   // Note, for MPAS faces.psize() can be more than 1
 
@@ -682,12 +682,12 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_allocate(EntityHandle file_s
 }
 
 #ifdef PNETCDF_FILE
-ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_async(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   DebugOutput& dbgOut = _readNC->dbgOut;
 
-  ErrorCode rval = read_ucd_variable_to_nonset_allocate(file_set, vdatas, tstep_nums);
+  ErrorCode rval = read_ucd_variable_to_nonset_allocate(vdatas, tstep_nums);
   ERRORR(rval, "Trouble allocating read variables.");
 
   // Finally, read into that space
@@ -829,12 +829,12 @@ ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset_async(EntityHandle file_set,
   return rval;
 }
 #else
-ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
+ErrorCode NCHelperMPAS::read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas, std::vector<int>& tstep_nums)
 {
   Interface*& mbImpl = _readNC->mbImpl;
   DebugOutput& dbgOut = _readNC->dbgOut;
 
-  ErrorCode rval = read_ucd_variable_to_nonset_allocate(file_set, vdatas, tstep_nums);
+  ErrorCode rval = read_ucd_variable_to_nonset_allocate(vdatas, tstep_nums);
   ERRORR(rval, "Trouble allocating read variables.");
 
   // Finally, read into that space

diff --git a/src/io/NCHelperMPAS.hpp b/src/io/NCHelperMPAS.hpp
index 70deab0..789a0fb 100644
--- a/src/io/NCHelperMPAS.hpp
+++ b/src/io/NCHelperMPAS.hpp
@@ -17,21 +17,21 @@ namespace moab {
 class NCHelperMPAS : public UcdNCHelper
 {
 public:
-  NCHelperMPAS(ReadNC* readNC, int fileId, const FileOptions& opts);
-  static bool can_read_file(ReadNC* readNC, int fileId);
+  NCHelperMPAS(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet);
+  static bool can_read_file(ReadNC* readNC);
 
 private:
   //! Implementation of NCHelper::init_mesh_vals()
-  virtual ErrorCode init_mesh_vals(const FileOptions& opts, EntityHandle file_set);
+  virtual ErrorCode init_mesh_vals();
   //! Implementation of NCHelper::check_existing_mesh()
-  virtual ErrorCode check_existing_mesh(EntityHandle file_set);
+  virtual ErrorCode check_existing_mesh();
   //! Implementation of NCHelper::create_mesh()
-  virtual ErrorCode create_mesh(ScdInterface* scdi, const FileOptions& opts, EntityHandle file_set, Range& quads);
+  virtual ErrorCode create_mesh(Range& quads);
   //! Implementation of NCHelper::get_mesh_type_name()
   virtual std::string get_mesh_type_name() { return "MPAS"; }
 
   //! Implementation of UcdNCHelper::read_ucd_variable_to_nonset_allocate()
-  virtual ErrorCode read_ucd_variable_to_nonset_allocate(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas,
                                                          std::vector<int>& tstep_nums);
   //! Implementation of UcdNCHelper::read_ucd_variable_setup()
   virtual ErrorCode read_ucd_variable_setup(std::vector<std::string>& var_names,
@@ -40,11 +40,11 @@ private:
                                             std::vector<ReadNC::VarData>& vsetdatas);
 #ifdef PNETCDF_FILE
   //! Implementation of UcdNCHelper::read_ucd_variable_to_nonset_async()
-  virtual ErrorCode read_ucd_variable_to_nonset_async(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas,
                                                       std::vector<int>& tstep_nums);
 #else
   //! Implementation of UcdNCHelper::read_ucd_variable_to_nonset()
-  virtual ErrorCode read_ucd_variable_to_nonset(EntityHandle file_set, std::vector<ReadNC::VarData>& vdatas,
+  virtual ErrorCode read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas,
                                                 std::vector<int>& tstep_nums);
 #endif
 

diff --git a/src/io/ReadNC.cpp b/src/io/ReadNC.cpp
index a7903c2..5adc52d 100644
--- a/src/io/ReadNC.cpp
+++ b/src/io/ReadNC.cpp
@@ -20,7 +20,7 @@ ReaderIface* ReadNC::factory(Interface* iface)
 
 ReadNC::ReadNC(Interface* impl) :
         mbImpl(impl), fileId(-1), mGlobalIdTag(0), mpFileIdTag(NULL), dbgOut(stderr), isParallel(false), 
-        partMethod(ScdParData::ALLJORKORI),
+        partMethod(ScdParData::ALLJORKORI), scdi(NULL),
 #ifdef USE_MPI
   myPcomm(NULL),
 #endif
@@ -94,40 +94,40 @@ ErrorCode ReadNC::load_file(const char* file_name, const EntityHandle* file_set,
     tmp_set = *file_set;
 
   // Get the scd interface
-  ScdInterface *scdi = NULL;
+  scdi = NULL;
   rval = mbImpl->query_interface(scdi);
-  if (!scdi)
+  if (NULL == scdi)
     return MB_FAILURE;
 
-  if (myHelper != NULL)
+  if (NULL != myHelper)
     delete myHelper;
 
   // Get appropriate NC helper instance based on information read from the header
-  myHelper = NCHelper::get_nc_helper(this, fileId, opts);
-  if (myHelper == NULL) {
+  myHelper = NCHelper::get_nc_helper(this, fileId, opts, tmp_set);
+  if (NULL == myHelper) {
     ERRORR(MB_FAILURE, "Failed to get NCHelper class instance.");
   }
 
   // Initialize mesh values
-  rval = myHelper->init_mesh_vals(opts, tmp_set);
+  rval = myHelper->init_mesh_vals();
   ERRORR(rval, "Trouble initializing mesh values.");
 
   // Check existing mesh from last read
   if (noMesh && !noVars) {
-    rval = myHelper->check_existing_mesh(tmp_set);
+    rval = myHelper->check_existing_mesh();
     ERRORR(rval, "Trouble checking mesh from last read.\n");
   }
 
   // Create mesh vertex/edge/face sequences
   Range faces;
   if (!noMesh) {
-    rval = myHelper->create_mesh(scdi, opts, tmp_set, faces);
+    rval = myHelper->create_mesh(faces);
     ERRORR(rval, "Trouble creating mesh.");
   }
 
   // Read variables onto grid
   if (!noVars) {
-    rval = myHelper->read_variables(tmp_set, var_names, tstep_nums);
+    rval = myHelper->read_variables(var_names, tstep_nums);
     if (MB_FAILURE == rval)
       return rval;
   }
@@ -141,7 +141,7 @@ ErrorCode ReadNC::load_file(const char* file_name, const EntityHandle* file_set,
     }
 
     if (!filteredDimNames.empty()) {
-      rval = myHelper->read_variables(tmp_set, filteredDimNames, tstep_nums);
+      rval = myHelper->read_variables(filteredDimNames, tstep_nums);
       if (MB_FAILURE == rval)
         return rval;
     }
@@ -183,11 +183,12 @@ ErrorCode ReadNC::load_file(const char* file_name, const EntityHandle* file_set,
 
   // Create NC conventional tags when loading header info only
   if (noMesh && noVars) {
-    rval = myHelper->create_conventional_tags(scdi, tmp_set, tstep_nums);
+    rval = myHelper->create_conventional_tags(tstep_nums);
     ERRORR(rval, "Trouble creating NC conventional tags.");
   }
 
   mbImpl->release_interface(scdi);
+  scdi = NULL;
 
   // Close the file
   success = NCFUNC(close)(fileId);

diff --git a/src/io/ReadNC.hpp b/src/io/ReadNC.hpp
index efcfd7d..ab91ded 100644
--- a/src/io/ReadNC.hpp
+++ b/src/io/ReadNC.hpp
@@ -198,6 +198,9 @@ private:
   //! Partitioning method
   int partMethod;
 
+  //! Scd interface
+  ScdInterface* scdi;
+
   //! Parallel data object, to be cached with ScdBox
   ScdParData parData;

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list