[MOAB-dev] r4061 - in MOAB/trunk: src/io tools/dagmc

bmsmith6 at wisc.edu bmsmith6 at wisc.edu
Wed Jul 21 09:36:43 CDT 2010


Author: bmsmith
Date: 2010-07-21 09:36:42 -0500 (Wed, 21 Jul 2010)
New Revision: 4061

Modified:
   MOAB/trunk/src/io/ReadNCDF.cpp
   MOAB/trunk/tools/dagmc/cub2h5m.cc
Log:
ReadNCDF: Manually allocate exo_conn because it doesn't fit on stack.
          Get time of time step from file.
cub2h5m:  Summarize volume change for each material due to deformation.



Modified: MOAB/trunk/src/io/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNCDF.cpp	2010-07-20 20:05:47 UTC (rev 4060)
+++ MOAB/trunk/src/io/ReadNCDF.cpp	2010-07-21 14:36:42 UTC (rev 4061)
@@ -1720,6 +1720,21 @@
     return MB_FAILURE;
   }
   
+  // get the time
+  NcVar *times_ptr = ncFile->get_var("time_whole");
+  if(NULL==times_ptr || !times_ptr->is_valid()) {
+    std::cout << "ReadNCDF: unable to get time variable" << std::endl;
+  } else {
+    double times[max_time_steps];
+    NcBool status = times_ptr->get(&times[0], max_time_steps);
+    if(0==status) {
+      std::cout << "ReadNCDF: unable to get time array" << std::endl;
+    } else {
+      std::cout << "  Step " << time_step << " is at " << times[time_step-1] 
+                << " seconds" << std::endl;
+    }
+  }
+
   //read in the node_num_map .
   std::vector<int> ptr(numberNodes_loading);
 
@@ -1944,7 +1959,7 @@
   if(0 != lost) {
     std::cout << "Error:  " << lost << " nodes from the exodus file could not be matched." 
               << std::endl;
-    return MB_FAILURE;
+    //return MB_FAILURE;
   }
   std::cout << "  maximum node displacement magnitude: " << max_magnitude 
             << " cm" << std::endl;
@@ -2068,12 +2083,14 @@
     // Get the number of nodes per element
     unsigned int nodes_per_element = ExoIIUtil::VerticesPerElement[(*i).elemType];
     
-    // read the connectivity into that memory,  this will take only part of the array
-    // 1/2 if sizeof(EntityHandle) == 64 bits.
-    int exo_conn[i->numElements][nodes_per_element];
-    NcBool status = temp_var->get( &exo_conn[0][0], i->numElements, nodes_per_element);
+    // read the connectivity into that memory. 
+    //int exo_conn[i->numElements][nodes_per_element];
+    int *exo_conn = new int [i->numElements*nodes_per_element];
+    //NcBool status = temp_var->get( &exo_conn[0][0], i->numElements, nodes_per_element);
+    NcBool status = temp_var->get( &exo_conn[0], i->numElements, nodes_per_element);
     if (0 == status) {
       std::cout << "ReadNCDF: Problem getting connectivity." << std::endl;
+      delete[] exo_conn;


More information about the moab-dev mailing list