[MOAB-dev] r5003 - MOAB/trunk/src/io

xbxu at mcs.anl.gov xbxu at mcs.anl.gov
Tue Jun 14 15:56:50 CDT 2011


Author: xbxu
Date: 2011-06-14 15:56:49 -0500 (Tue, 14 Jun 2011)
New Revision: 5003

Modified:
   MOAB/trunk/src/io/ReadNC.cpp
   MOAB/trunk/src/io/ReadNC.hpp
Log:
set tag value on the specified file set

Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp	2011-06-14 17:37:45 UTC (rev 5002)
+++ MOAB/trunk/src/io/ReadNC.cpp	2011-06-14 20:56:49 UTC (rev 5003)
@@ -182,7 +182,7 @@
 #endif
   
     // create nc conventional tags
-//  rval = create_tags(tstep_nums);
+//  rval = create_tags(tmp_set, tstep_nums);
 //  ERRORR(rval, "Trouble creating nc conventional tags.");
   
   return MB_SUCCESS;
@@ -1213,7 +1213,7 @@
   return MB_FAILURE;
 }
 
-ErrorCode ReadNC::create_tags(const std::vector<int>& tstep_nums)
+ErrorCode ReadNC::create_tags(EntityHandle file_set, const std::vector<int>& tstep_nums)
 {
   ErrorCode rval;
   std::string tag_name;
@@ -1222,16 +1222,20 @@
   Tag numDimsTag = 0;  
   tag_name = "__NUM_DIMS";
   int numDims = dimNames.size();
-  rval = mbImpl->tag_get_handle(tag_name.c_str(), 1, MB_TYPE_INTEGER, numDimsTag, MB_TAG_SPARSE|MB_TAG_CREAT, &numDims);
+  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);
+  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());    
   
   // <__NUM_VARS>
   Tag numVarsTag = 0;
   tag_name = "__NUM_VARS";
   int numVars = varInfo.size();
-  rval = mbImpl->tag_get_handle(tag_name.c_str(), 1, MB_TYPE_INTEGER, numVarsTag, MB_TAG_SPARSE|MB_TAG_CREAT, &numVars);
+  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);
+  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());    
   
   // <__DIM_NAMES>
@@ -1243,12 +1247,14 @@
     dimnames.append(dimNames[i]);
     dimnames.push_back('\0');
   }
-  unsigned int dimnamesSz = dimnames.size();
-  rval = mbImpl->tag_get_handle(tag_name.c_str(), dimnamesSz, MB_TYPE_OPAQUE, dimNamesTag, MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_VARLEN, 


More information about the moab-dev mailing list