[MOAB-dev] r3095 - in MOAB/trunk: . parallel test/obb test/perf tools tools/dagmc tools/iMesh
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Fri Aug 7 18:44:10 CDT 2009
Author: kraftche
Date: 2009-08-07 18:44:09 -0500 (Fri, 07 Aug 2009)
New Revision: 3095
Modified:
MOAB/trunk/DualTool.cpp
MOAB/trunk/MBAdaptiveKDTree.cpp
MOAB/trunk/MBCore.cpp
MOAB/trunk/MBTest.cpp
MOAB/trunk/MeshSetSequence.cpp
MOAB/trunk/ReadNCDF.cpp
MOAB/trunk/WriteHDF5.cpp
MOAB/trunk/kd_tree_test.cpp
MOAB/trunk/mbcn_test.cc
MOAB/trunk/parallel/tuple_list.h
MOAB/trunk/scdseq_test.cpp
MOAB/trunk/test/obb/obb_test.cpp
MOAB/trunk/test/perf/seqperf.cpp
MOAB/trunk/tools/dagmc/DagMC.cpp
MOAB/trunk/tools/dagmc/pt_vol_test.cc
MOAB/trunk/tools/dagmc/ray_fire_test.cc
MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
MOAB/trunk/tools/iMesh/testc_cbind.c
MOAB/trunk/tools/propagate_tags.cpp
Log:
fix warnings
Modified: MOAB/trunk/DualTool.cpp
===================================================================
--- MOAB/trunk/DualTool.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/DualTool.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -1973,6 +1973,7 @@
mb_range_inserter(tmp_addl_faces[i]));
tmp_addl_faces[new_side].insert(new_quads[i]);
}
+#ifndef NDEBUG
bool cond1 = ("split_quads on 1, new_quads on 0" &&
tmp_addl_faces[0].find(split_quads[0]) == tmp_addl_faces[0].end() &&
tmp_addl_faces[0].find(split_quads[1]) == tmp_addl_faces[0].end() &&
@@ -1993,6 +1994,7 @@
tmp_addl_faces[1].find(new_quads[1]) != tmp_addl_faces[1].end());
assert(cond1 || cond2);
+#endif
//=============== split edge(s)
for (int j = 0; j < 3; j++) {
@@ -2093,7 +2095,7 @@
std::vector<MBEntityHandle> *star_dp1,
std::vector<MBEntityHandle> *star_dp2)
{
- bool on_bdy, on_bdy_tmp;
+ bool on_bdy = false, on_bdy_tmp;
MBErrorCode result;
MeshTopoUtil mtu(mbImpl);
Modified: MOAB/trunk/MBAdaptiveKDTree.cpp
===================================================================
--- MOAB/trunk/MBAdaptiveKDTree.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/MBAdaptiveKDTree.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -1709,6 +1709,7 @@
* are found. The fisrt entry is maintaned as the closest of the
* list of triangles.
*/
+/*
static MBErrorCode closest_to_triangles( MBInterface* moab,
MBEntityHandle set_handle,
double tolerance,
@@ -1801,6 +1802,7 @@
return MB_SUCCESS;
}
+*/
MBErrorCode MBAdaptiveKDTree::closest_triangle( MBEntityHandle tree_root,
const double from_coords[3],
Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/MBCore.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -424,7 +424,7 @@
file_set = 0;
- MBErrorCode rval;
+ MBErrorCode rval = MB_FAILURE;
const MBReaderWriterSet* set = reader_writer_set();
// otherwise try using the file extension to select a reader
@@ -464,7 +464,7 @@
if (num_sets < 0)
return MB_INDEX_OUT_OF_RANGE;
- MBErrorCode rval;
+ MBErrorCode rval = MB_FAILURE;
const MBReaderWriterSet* set = reader_writer_set();
// otherwise try using the file extension to select a reader
Modified: MOAB/trunk/MBTest.cpp
===================================================================
--- MOAB/trunk/MBTest.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/MBTest.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -672,8 +672,8 @@
if (MB_SUCCESS != result)
return result;
- int num_adj = meshsets.size();
- assert(1 == num_adj);
+ if (1u != meshsets.size())
+ return MB_FAILURE;
return MB_SUCCESS;
}
Modified: MOAB/trunk/MeshSetSequence.cpp
===================================================================
--- MOAB/trunk/MeshSetSequence.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/MeshSetSequence.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -395,9 +395,9 @@
{
MBErrorCode result = MB_SUCCESS;
std::vector<MBEntityHandle>::iterator i;
- const MBEntityHandle *array, *end;
+ const MBEntityHandle *array = 0, *end;
MBEntityHandle s, e;
- int count;
+ int count = 0;
size_t n;
// Skip any meshsets already in input vector (yes, don't
Modified: MOAB/trunk/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/ReadNCDF.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/ReadNCDF.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -2024,8 +2024,11 @@
//2. check for the operations, currently support set.
const char* op;
- if(tokens.size() > 2 && !tokens[2].empty())
- op = tokens[2].c_str();
+ if (tokens.size() < 3 || (tokens[2] != "set" && tokens[2] != "add")) {
+ readMeshIface->report_error("ReadNCDF: invalid operation specified for update");
+ return MB_TYPE_OUT_OF_RANGE;
+ }
+ op = tokens[2].c_str();
//3. check for destination, current only not implemented
const char* des ;
@@ -2070,7 +2073,7 @@
NcVar *coordx = ncFile->get_var("vals_nod_var1");
NcVar *coordy = ncFile->get_var("vals_nod_var2");
- NcVar *coordz;
+ NcVar *coordz = 0;
if(numberDimensions_loading == 3)
coordz = ncFile->get_var("vals_nod_var3");
if (NULL == coordx || !coordx->is_valid() ||
@@ -2116,7 +2119,7 @@
NcVar *coord1 = ncFile->get_var("coordx");
NcVar *coord2 = ncFile->get_var("coordy");
- NcVar *coord3;
+ NcVar *coord3 = 0;
if(numberDimensions_loading == 3)
coord3 = ncFile->get_var("coordz");
if (NULL == coord1 || !coord1->is_valid() ||
Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/WriteHDF5.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -1165,6 +1165,7 @@
}
mhdf_closeData( filePtr, set_table, &status );
+ rval = MB_SUCCESS;
if (writeSetContents && parallelWrite)
rval = write_shared_set_contents( content_table );
if (writeSetContents)
Modified: MOAB/trunk/kd_tree_test.cpp
===================================================================
--- MOAB/trunk/kd_tree_test.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/kd_tree_test.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -9,6 +9,12 @@
#include "MBCartVect.hpp"
+#include <stdlib.h>
+#ifdef NDEBUG
+# undef assert
+# define assert(A) do { if (A) abort(); } while(false)
+#endif
+
const unsigned INTERVALS = 4;
const unsigned DEPTH = 7; // 3*log2(INTERVALS)+1
const char* TAG_NAME = "TEST_DATA";
@@ -71,7 +77,7 @@
double dims[] = { max[0] - min[0], max[1] - min[1], max[2] - min[2] };
double volume = dims[0] * dims[1] * dims[2];
assert( fabs(volume - 1.0) <= DBL_EPSILON );
-
+
// check depth of leaf
assert( iter.depth() == DEPTH );
}
Modified: MOAB/trunk/mbcn_test.cc
===================================================================
--- MOAB/trunk/mbcn_test.cc 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/mbcn_test.cc 2009-08-07 23:44:09 UTC (rev 3095)
@@ -565,14 +565,14 @@
for (int off = 0; off < side_size; ++off) {
int side_conn[4]; side_conn[3] = 0;
for (int i = 0; i < side_size; ++i)
- side_conn[(i+side_size-rev*off)%side_size] = elem_verts[side_idx[i]];
+ side_conn[(side_size+rev*i)%side_size] = elem_verts[side_idx[(i+off)%side_size]];
int result_side = -100, result_sense = -100, result_offset = -100;
int err = MBCN::SideNumber( type, elem_verts, side_conn, side_size, 2,
result_side, result_sense, result_offset );
CHECK_EQUAL( 0, err );
CHECK_EQUAL( idx, result_side );
- CHECK_EQUAL( 1-2*rev, result_sense );
+ CHECK_EQUAL( rev, result_sense );
CHECK_EQUAL( off, result_offset );
}
}
@@ -595,7 +595,7 @@
for (int edge = 0; edge < 6; ++edge)
do_test_side_number_1d( MBTET, edge );
for (int face = 0; face < 4; ++face)
- do_test_side_number_1d( MBTET, face );
+ do_test_side_number_2d( MBTET, face );
}
void test_side_number_pyr()
@@ -603,7 +603,7 @@
for (int edge = 0; edge < 8; ++edge)
do_test_side_number_1d( MBPYRAMID, edge );
for (int face = 0; face < 5; ++face)
- do_test_side_number_1d( MBPYRAMID, face );
+ do_test_side_number_2d( MBPYRAMID, face );
}
void test_side_number_pri()
@@ -611,7 +611,7 @@
for (int edge = 0; edge < 9; ++edge)
do_test_side_number_1d( MBPRISM, edge );
for (int face = 0; face < 5; ++face)
- do_test_side_number_1d( MBPRISM, face );
+ do_test_side_number_2d( MBPRISM, face );
}
void test_side_number_hex()
@@ -619,7 +619,7 @@
for (int edge = 0; edge < 12; ++edge)
do_test_side_number_1d( MBHEX, edge );
for (int face = 0; face < 8; ++face)
- do_test_side_number_1d( MBHEX, face );
+ do_test_side_number_2d( MBHEX, face );
}
Modified: MOAB/trunk/parallel/tuple_list.h
===================================================================
--- MOAB/trunk/parallel/tuple_list.h 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/parallel/tuple_list.h 2009-08-07 23:44:09 UTC (rev 3095)
@@ -36,10 +36,10 @@
{
tl->n=0; tl->max=max;
tl->mi=mi,tl->ml=ml,tl->mul=mul,tl->mr=mr;
- tl->vi=(max ? tmalloc(sint, max*mi) : 0);
- tl->vl=(max ? tmalloc(slong,max*ml) : 0);
- tl->vul=(max ? tmalloc(ulong,max*mul) : 0);
- tl->vr=(max ? tmalloc(real, max*mr) : 0);
+ tl->vi=(max*mi ? tmalloc(sint, max*mi) : 0);
+ tl->vl=(max*ml ? tmalloc(slong,max*ml) : 0);
+ tl->vul=(max*mul ? tmalloc(ulong,max*mul) : 0);
+ tl->vr=(max*mr ? tmalloc(real, max*mr) : 0);
}
static void tuple_list_free(tuple_list *tl) {
@@ -49,10 +49,14 @@
static void tuple_list_resize(tuple_list *tl, uint max)
{
tl->max = max;
- tl->vi=trealloc(sint, tl->vi,tl->max*tl->mi);
- tl->vl=trealloc(slong,tl->vl,tl->max*tl->ml);
- tl->vul=trealloc(ulong,tl->vul,tl->max*tl->mul);
- tl->vr=trealloc(real, tl->vr,tl->max*tl->mr);
+ if (tl->vi || (tl->max*tl->mi))
+ tl->vi=trealloc(sint, tl->vi,tl->max*tl->mi);
+ if (tl->vl || (tl->max*tl->ml))
+ tl->vl=trealloc(slong,tl->vl,tl->max*tl->ml);
+ if (tl->vul || (tl->max*tl->mul))
+ tl->vul=trealloc(ulong,tl->vul,tl->max*tl->mul);
+ if (tl->vr || (tl->max*tl->mr))
+ tl->vr=trealloc(real, tl->vr,tl->max*tl->mr);
}
static void tuple_list_grow(tuple_list *tl)
Modified: MOAB/trunk/scdseq_test.cpp
===================================================================
--- MOAB/trunk/scdseq_test.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/scdseq_test.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -182,6 +182,7 @@
result = MB_FAILURE;
}
+ itmp = jtmp = ktmp = 0xdeadbeef;
MBErrorCode tmp_result = this_seq->get_params(tmp_handle, itmp, jtmp, ktmp);
if (MB_SUCCESS != tmp_result || i != itmp || j != jtmp || k != ktmp) {
std::cout << "vertex seq: get_params didn't work, i, j, k = " << i << ", "
@@ -240,6 +241,7 @@
}
// get_params
+ itmp = jtmp = ktmp = 0xdeadbeef;
MBErrorCode tmp_result = this_seq->get_params(tmp_handle, itmp, jtmp, ktmp);
if (MB_SUCCESS != tmp_result || i != itmp || j != jtmp || k != ktmp) {
std::cout << "element seq: get_params didn't work, i, j, k = " << i << ", "
Modified: MOAB/trunk/test/obb/obb_test.cpp
===================================================================
--- MOAB/trunk/test/obb/obb_test.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/test/obb/obb_test.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -1283,7 +1283,7 @@
std::cout << "Evaluating closest point to " << points[i] << std::endl;
MBCartVect n_result, t_result;
- MBEntityHandle n_tri, t_tri;
+ MBEntityHandle n_tri = 0, t_tri;
// find closest point the slow way
rval = closest_point_in_triangles( moab, points[i], n_result, n_tri );
Modified: MOAB/trunk/test/perf/seqperf.cpp
===================================================================
--- MOAB/trunk/test/perf/seqperf.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/test/perf/seqperf.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -51,7 +51,7 @@
if (count > RAND_MAX) {
r += RAND_MAX * rand();
if (count > ((long)RAND_MAX*RAND_MAX))
- r += RAND_MAX*RAND_MAX*rand();
+ r += (long)RAND_MAX*(long)RAND_MAX*(long)rand();
}
std::swap( array[i], array[r%count] );
}
@@ -65,7 +65,10 @@
void* ptr;
MBErrorCode rval = mb.query_interface( "MBReadUtilIface", &ptr );
readTool = static_cast<MBReadUtilIface*>(ptr);
- assert( !rval && readTool );
+ if (rval || !readTool) {
+ assert(false);
+ abort();
+ }
queryVertPermutation = permutation( numVert );
queryElemPermutation = permutation( numElem );
@@ -436,7 +439,10 @@
{
std::vector<double*> arrays;
MBErrorCode rval = readTool->get_node_arrays( 3, numVert, 0, vertStart, arrays );
- assert(!rval && arrays.size() == 3);
+ if (rval || arrays.size() != 3) {
+ assert(false);
+ abort();
+ }
double *x = arrays[0], *y = arrays[1], *z = arrays[2];
assert( x && y && z );
@@ -449,7 +455,10 @@
MBEntityHandle conn[8];
element_conn( 0, conn );
MBErrorCode rval = mb.create_element( MBHEX, conn, 8, elemStart );
- assert(!rval);
+ if (rval) {
+ assert(false);
+ abort();
+ }
MBEntityHandle h;
for (long i = 1; i < numElem; ++i) {
@@ -465,7 +474,10 @@
{
MBEntityHandle* conn = 0;
MBErrorCode rval = readTool->get_element_array( numElem, 8, MBHEX, 0, elemStart, conn );
- assert(!rval && conn);
+ if (rval && !conn) {
+ assert(false);
+ abort();
+ }
for (long i = 0; i < numElem; ++i)
element_conn( i, conn + 8*i );
@@ -483,7 +495,10 @@
for (y = 0; y < vert_per_edge; ++y) {
for (x = 0; x < deleted_x; ++x, ++h) {
r = mb.get_coords( &h, 1, coords );
- assert(MB_SUCCESS == r);
+ if (MB_SUCCESS != r) {
+ assert(false);
+ abort();
+ }
}
h += (vert_per_edge - deleted_x);
}
@@ -724,7 +739,10 @@
if (deleted_elem( i, percent )) {
element_conn( i, conn );
rval = mb.create_element( MBHEX, conn, 8, h );
- assert(!rval);
+ if (rval) {
+ assert(false);
+ abort();
+ }
}
}
@@ -733,7 +751,10 @@
if (deleted_vert(index, percent)) {
MBEntityHandle h = index + vertStart;
MBErrorCode rval = mb.delete_entities( &h, 1 );
- assert(!rval);
+ if (rval) {
+ assert(false);
+ abort();
+ }
}
}
@@ -742,7 +763,10 @@
if (deleted_elem(index, percent)) {
MBEntityHandle h = index + elemStart;
MBErrorCode rval = mb.delete_entities( &h, 1 );
- assert(!rval);
+ if (rval) {
+ assert(false);
+ abort();
+ }
}
}
Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -1122,7 +1122,8 @@
MBEntityHandle group = group_handles()[*grp];
grp_names.clear();
bool success = get_group_names(group, grp_names);
- assert(success);
+ if (!success)
+ return MB_FAILURE;
if (grp_names.empty()) continue;
// get sets associated with this group
@@ -1248,7 +1249,8 @@
group = group_handles()[grp];
grp_names.clear();
bool success = get_group_names(group, grp_names);
- assert(success);
+ if (!success)
+ return MB_FAILURE;
if (grp_names.empty()) continue;
// get sets associated with this group
Modified: MOAB/trunk/tools/dagmc/pt_vol_test.cc
===================================================================
--- MOAB/trunk/tools/dagmc/pt_vol_test.cc 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/tools/dagmc/pt_vol_test.cc 2009-08-07 23:44:09 UTC (rev 3095)
@@ -20,6 +20,7 @@
MBEntityHandle vol = dagmc.entity_by_id(3,volID);
double u, v, w;
+ u=v=w=0;
rval = dagmc.point_in_volume( vol, xxx, yyy, zzz, inside, u, v, w);
CHKERR;
Modified: MOAB/trunk/tools/dagmc/ray_fire_test.cc
===================================================================
--- MOAB/trunk/tools/dagmc/ray_fire_test.cc 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/tools/dagmc/ray_fire_test.cc 2009-08-07 23:44:09 UTC (rev 3095)
@@ -64,7 +64,6 @@
}
const double PI = acos(-1.0);
- double denom = 1.0 / ((double) RAND_MAX);
double facet_tol;
int ncalls;
Modified: MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -2749,7 +2749,7 @@
}
MBEntityHandle handle = ENTITY_HANDLE(entity_set_handle);
- MBErrorCode result;
+ MBErrorCode result = MB_SUCCESS;
if (use_top) {
if (entity_topology == iMesh_SEPTAHEDRON)
Modified: MOAB/trunk/tools/iMesh/testc_cbind.c
===================================================================
--- MOAB/trunk/tools/iMesh/testc_cbind.c 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/tools/iMesh/testc_cbind.c 2009-08-07 23:44:09 UTC (rev 3095)
@@ -585,9 +585,9 @@
int hexes_alloc = 0, hexes_size;
iBase_EntitySetHandle hex_set;
iBase_EntityHandle *adj_faces1 = NULL;
- int adj_faces1_alloc = 0, adj_faces1_size;
+ int adj_faces1_alloc = 0; /*, adj_faces1_size; */
int *face_offsets1 = NULL;
- int face_offsets1_alloc = 0, face_offsets1_size;
+ int face_offsets1_alloc = 0; /*, face_offsets1_size; */
/* get the number of whole mesh */
int n_whole_mesh = 0;
Modified: MOAB/trunk/tools/propagate_tags.cpp
===================================================================
--- MOAB/trunk/tools/propagate_tags.cpp 2009-08-06 15:46:10 UTC (rev 3094)
+++ MOAB/trunk/tools/propagate_tags.cpp 2009-08-07 23:44:09 UTC (rev 3095)
@@ -190,7 +190,7 @@
bool have_data_tag = false;
const char* write_tag_name = 0;
MBTag write_tag = 0;
- TagSpec data_tag;
+ TagSpec data_tag = { 0, 0 };
typedef std::vector<TagSpec> TagVect;
TagVect ident_tags;
int data_size = 0;
More information about the moab-dev
mailing list