[MOAB-dev] r4295 - MOAB/trunk/tools/dagmc
sjackson at cae.wisc.edu
sjackson at cae.wisc.edu
Mon Nov 22 13:21:34 CST 2010
Author: sjackson
Date: 2010-11-22 13:21:34 -0600 (Mon, 22 Nov 2010)
New Revision: 4295
Modified:
MOAB/trunk/tools/dagmc/cub2h5m.cc
Log:
Update DagMC's update_coords tool to compile under the new -pedantic regime.
Convert old variable-length arrays to vectors. In the function skin_hex_elems,
there is a multidimensional variable-length array for which this conversion
is not trivial (because the array participates in qsort calls). But it seems
that skin_hex_elems and its qsort comparator functions are not actually called
by anything, or exported in headers, so I have just wrapped them in an #if 0.
I'll plan to remove this dead code once I talk to its author.
Modified: MOAB/trunk/tools/dagmc/cub2h5m.cc
===================================================================
--- MOAB/trunk/tools/dagmc/cub2h5m.cc 2010-11-19 22:19:05 UTC (rev 4294)
+++ MOAB/trunk/tools/dagmc/cub2h5m.cc 2010-11-22 19:21:34 UTC (rev 4295)
@@ -364,6 +364,9 @@
return MB_SUCCESS;
}
+/* Isolate dead code in a preproc-killed block - sjackson 11/22/10 */
+#if 0
+
/* qsort int comparison function */
int handle_compare(const void *a, const void *b)
{
@@ -456,6 +459,8 @@
return MB_SUCCESS;
}
+#endif //dead code isolation
+
// Given a 1D array of data, axis labels, title, and number of bins, create a
// histogram.
void plot_histogram( const std::string title,
@@ -472,7 +477,7 @@
// make bins for histogram
double bin_width = (max-min)/n_bins;
- int bins[n_bins];
+ std::vector<int> bins(n_bins);
for(int i=0; i<n_bins; ++i) bins[i] = 0;
// fill the bins
@@ -489,7 +494,7 @@
for(int i=0; i<n_bins; ++i) if(max_bin < bins[i]) max_bin = bins[i];
int bar_height;
int max_bar_chars = 72;
- std::string bars[n_bins];
+ std::vector< std::string > bars(n_bins);
for(int i=0; i<n_bins; ++i) {
bar_height = (max_bar_chars*bins[i])/max_bin;
for(int j=0; j<bar_height; ++j) bars[i] += "*";
@@ -549,7 +554,7 @@
ErrorCode result = MBI->get_connectivity( element, conn, num_vertices );
if(MB_SUCCESS != result) return result;
- CartVect coords[num_vertices];
+ std::vector< CartVect > coords(num_vertices);
result = MBI->get_coords( conn, num_vertices, coords[0].array() );
if(MB_SUCCESS != result) return result;
More information about the moab-dev
mailing list