[MOAB-dev] r5879 - in MOAB/trunk: src/io test/parallel

iulian at mcs.anl.gov iulian at mcs.anl.gov
Tue Nov 20 18:04:05 CST 2012


Author: iulian
Date: 2012-11-20 18:04:05 -0600 (Tue, 20 Nov 2012)
New Revision: 5879

Modified:
   MOAB/trunk/src/io/ReadNC.cpp
   MOAB/trunk/test/parallel/ucdtrvpart.cpp
Log:
add back the dummy tags. Right now, nbnd and ncol are candidates
they are created for the homme meshes only
these dimensions are added artificially to varInfo map, will have one
dimension (itself). all varInfo "variables" get a tag handle, eventually


Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp	2012-11-20 14:39:59 UTC (rev 5878)
+++ MOAB/trunk/src/io/ReadNC.cpp	2012-11-21 00:04:05 UTC (rev 5879)
@@ -1603,6 +1603,8 @@
   int success;
   std::vector<int> requests(vdatas.size() * tstep_nums.size()), statuss(vdatas.size() * tstep_nums.size());
   for (unsigned int i = 0; i < vdatas.size(); i++) {
+    if (vdatas[i].varName=="ncol" || vdatas[i].varName=="nbnd")
+       continue;// this is a dummy one, we don't have it; we created it for the dummy tag
     for (unsigned int t = 0; t < tstep_nums.size(); t++) {
       void *data = vdatas[i].varDatas[t];
 
@@ -3041,6 +3043,29 @@
   std::copy(gDims, gDims + 6, lDims);
 
   // don't read coordinates of columns until we actually create the mesh
+
+  // hack: look at all dimensions, and see if we have one that does not appear in the list of varInfo names
+  // right now, candidates are ncol and nbnd
+  // for them, create dummy tags
+  for (unsigned int i=0; i<dimNames.size(); i++)
+  {
+    // if there is a var with this name, skip, we are fine; if not, create a varInfo...
+    if ( varInfo.find(dimNames[i])!=varInfo.end())
+      continue; // we already have a variable with this dimension name
+
+    int sizeTotalVar = varInfo.size();
+    std::string var_name(dimNames[i]);
+    VarData &data = varInfo[var_name];
+    data.varName = std::string(var_name);
+    data.varId =sizeTotalVar;
+    data.varTags.resize(1, 0);
+    data.varDataType = NC_DOUBLE; // could be int, actually, but we do not really need the type
+    data.varDims.resize(1);
+    data.varDims[0]= (int)i;
+    data.numAtts=0;
+    dbgOut.tprintf(2, "Dummy varInfo created for dimension %s\n", dimNames[i].c_str());
+    std::cout<<"dummy varInfo created for dimension "<< dimNames[i] << "\n";
+  }
   return MB_SUCCESS;
 }
 

Modified: MOAB/trunk/test/parallel/ucdtrvpart.cpp
===================================================================
--- MOAB/trunk/test/parallel/ucdtrvpart.cpp	2012-11-20 14:39:59 UTC (rev 5878)
+++ MOAB/trunk/test/parallel/ucdtrvpart.cpp	2012-11-21 00:04:05 UTC (rev 5879)
@@ -24,6 +24,7 @@
   int result = 0;
   


More information about the moab-dev mailing list