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

tautges at mcs.anl.gov tautges at mcs.anl.gov
Tue Sep 4 13:41:06 CDT 2012


Author: tautges
Date: 2012-09-04 13:41:06 -0500 (Tue, 04 Sep 2012)
New Revision: 5726

Modified:
   MOAB/trunk/src/io/ReadNC.cpp
   MOAB/trunk/test/io/read_ucd_nc.cpp
Log:
Small fix to NC HOMME reader in cases where input filename doesn't have
absolute path.



Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp	2012-08-30 23:34:50 UTC (rev 5725)
+++ MOAB/trunk/src/io/ReadNC.cpp	2012-09-04 18:41:06 UTC (rev 5726)
@@ -615,17 +615,20 @@
                                          EntityHandle tmp_set, Range &quads) 
 {
     // need to get/read connectivity data before creating elements
-  std::string conn_fname, default_fname;
+  std::string conn_fname;
 
-    // default convention for reading HOMME is a file HommeMapping.nc in same dir as data file
-  default_fname = std::string(fileName);
-  int idx = default_fname.find_last_of("/");
-  default_fname = default_fname.substr(0,idx).append("/HommeMapping.nc");
-
     // try to open the connectivity file through CONN option, if used
   ErrorCode rval = opts.get_str_option("CONN", conn_fname);
-  if (MB_SUCCESS != rval) conn_fname = default_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);
+    size_t idx = conn_fname.find_last_of("/");
+    if (idx != std::string::npos)
+      conn_fname = conn_fname.substr(0,idx).append("/HommeMapping.nc");
+    else
+      conn_fname = "HommeMapping.nc";
+  }
+  
   int success;
   int rank, procs;
 
@@ -728,6 +731,7 @@
   Range::iterator rit;
   double *xptr = arrays[0], *yptr = arrays[1], *zptr = arrays[2];
   for (i = 0, rit = tmp_range.begin(); i < num_local_verts; i++, rit++) {
+    assert(*rit < ilVals.size()+1);
     xptr[i] = ilVals[(*rit)-1];
     yptr[i] = jlVals[(*rit)-1];
     zptr[i] = klVals[lDims[2]];
@@ -2567,7 +2571,6 @@
   for (mit = varInfo.begin(); mit != varInfo.end(); ++mit) {
     VarData& vd = (*mit).second;
     if ((std::find(vd.varDims.begin(), vd.varDims.end(), iDim) != vd.varDims.end()) &&
-        (std::find(vd.varDims.begin(), vd.varDims.end(), kDim) != vd.varDims.end()) &&
         (std::find(vd.varDims.begin(), vd.varDims.end(), kDim) != vd.varDims.end())) 
       vd.entLoc = ENTLOCNODE;
   }

Modified: MOAB/trunk/test/io/read_ucd_nc.cpp


More information about the moab-dev mailing list