[MOAB-dev] r3723 - MOAB/trunk/tools/dagmc

bmsmith6 at wisc.edu bmsmith6 at wisc.edu
Mon Mar 29 11:17:13 CDT 2010


Author: bmsmith
Date: 2010-03-29 11:17:13 -0500 (Mon, 29 Mar 2010)
New Revision: 3723

Modified:
   MOAB/trunk/tools/dagmc/cub2h5m.cc
Log:
ReadNCDF::update needs the cub file set.
Use new/delete to allow larger arrays when comparing element volume.


Modified: MOAB/trunk/tools/dagmc/cub2h5m.cc
===================================================================
--- MOAB/trunk/tools/dagmc/cub2h5m.cc	2010-03-29 13:16:14 UTC (rev 3722)
+++ MOAB/trunk/tools/dagmc/cub2h5m.cc	2010-03-29 16:17:13 UTC (rev 3723)
@@ -386,13 +386,13 @@
                      const int n_elems, const std::string time_step ) {
 
   // find volume ratio then max and min
-  double ratio[n_elems];
+  double *ratio = new double[n_elems];
   for(int i=0; i<n_elems; ++i) ratio[i] = (defo[i]-orig[i])/orig[i];
 
   plot_histogram( "Predeformed Element Volume", "Num_Elems", "Volume [cc]", 10, orig, n_elems );
   std::string title = "Element Volume Change Ratio at Time Step " + time_step;
   plot_histogram( title, "Num_Elems", "Volume Ratio", 10, ratio, n_elems );
-
+  delete[] ratio;
 }
 
 // Given four nodes, calculate the tet volume.
@@ -1096,7 +1096,7 @@
     //result =  my_ex_reader.load_file(exo_name, cgm_file_set, exo_opts, NULL, 0 , 0);
     //result =  my_ex_reader.load_file(exo_name, cub_file_set, exo_opts, NULL, 0 , 0);
     //result = my_ex_reader.load_file(exo_name, &cub_file_set, exo_opts, NULL, 0 , 0);
-    MBI->load_file( exo_name, 0, exo_options );
+    MBI->load_file( exo_name, &cub_file_set, exo_options );
     if(MB_SUCCESS != result) {
       std::string last_error;
       MBI->get_last_error(last_error); 
@@ -1115,8 +1115,8 @@
     
     // Determine the volume of the elements now that a deformation has been
     // applied. Condense the original array by removing dead elements.
-    double orig_size_condensed[defo_elems.size()];
-    double defo_size_condensed[defo_elems.size()];
+    double *orig_size_condensed = new double[defo_elems.size()];
+    double *defo_size_condensed = new double[defo_elems.size()];
     int j=0;
     for(unsigned int i=0; i<orig_elems.size(); ++i) {
       if(orig_elems[i] == defo_elems[j]) {
@@ -1127,6 +1127,8 @@
     }
     generate_plots( orig_size_condensed, defo_size_condensed, 
 		    defo_elems.size(), std::string(time_step) );
+    delete[] orig_size_condensed; // can't use the same delete[] for both
+    delete[] defo_size_condensed;
   }
 
   // Deal with dead elements. For now, add them to the impl_compl volume.



More information about the moab-dev mailing list