[MOAB-dev] commit/MOAB: tautges: Fixing a bunch of warnings, mainly about narrowing conversions.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Feb 13 12:43:46 CST 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/601c43fbc6b0/
Changeset: 601c43fbc6b0
Branch: master
User: tautges
Date: 2014-02-13 19:43:36
Summary: Fixing a bunch of warnings, mainly about narrowing conversions.
Affected #: 16 files
diff --git a/itaps/imesh/MOAB_iMeshP_unit_tests.cpp b/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
index 96d659d..bc3d8e4 100644
--- a/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
+++ b/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
@@ -548,11 +548,11 @@ int create_mesh( const char* filename, int num_parts )
// create vertices
int vl_pos = 0;
for (int i = 0; i <= num_cols; ++i) {
- double coords[15] = { i, 0, 0,
- i, 1, 0,
- i, 2, 0,
- i, 3, 0,
- i, 4, 0 };
+ double coords[15] = { static_cast<double>(i), 0, 0,
+ static_cast<double>(i), 1, 0,
+ static_cast<double>(i), 2, 0,
+ static_cast<double>(i), 3, 0,
+ static_cast<double>(i), 4, 0 };
iBase_EntityHandle* ptr = vertices[i];
const int n = (num_full_cols == num_cols || i <= num_full_cols) ? 5 : 3;
int junk1 = n, junk2 = n;
diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index 684aa4d..9c70b80 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -301,7 +301,6 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
int& gatherSetRank = _readNC->gatherSetRank;
bool& noMixedElements = _readNC->noMixedElements;
bool& noEdges = _readNC->noEdges;
- DebugOutput& dbgOut = _readNC->dbgOut;
int rank = 0;
int procs = 1;
@@ -396,8 +395,10 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
MPI_Allreduce(&local_max_edges_per_cell, &global_max_edges_per_cell, 1, MPI_INTEGER, MPI_MAX, myPcomm->proc_config().proc_comm());
assert(local_max_edges_per_cell <= global_max_edges_per_cell);
maxEdgesPerCell = global_max_edges_per_cell;
- if (0 == rank)
+ if (0 == rank) {
+ DebugOutput& dbgOut = _readNC->dbgOut;
dbgOut.tprintf(1, " global_max_edges_per_cell = %d\n", global_max_edges_per_cell);
+ }
}
#endif
@@ -416,7 +417,8 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
EntityHandle starth = pair_iter->first;
EntityHandle endh = pair_iter->second;
NCDF_SIZE read_starts[2] = {static_cast<NCDF_SIZE>(starth - 1), 0};
- NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1), maxEdgesPerCell};
+ NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1),
+ static_cast<NCDF_SIZE>(maxEdgesPerCell)};
// Do a partial read in each subrange
#ifdef PNETCDF_FILE
diff --git a/test/Test_MBMeshSet.cpp b/test/Test_MBMeshSet.cpp
index c762aa9..b4afc2b 100644
--- a/test/Test_MBMeshSet.cpp
+++ b/test/Test_MBMeshSet.cpp
@@ -185,7 +185,8 @@ void make_mesh( Interface& iface )
for (int z = 0; z <= dim; ++z) {
for (int y = 0; y <= dim; ++y) {
for (int x = 0; x <= dim; ++x) {
- const double coords[] = {x, y, z};
+ const double coords[] = {static_cast<double>(x), static_cast<double>(y),
+ static_cast<double>(z)};
EntityHandle new_handle = 0;
ErrorCode rval = iface.create_vertex( coords, new_handle );
CHECK_ERR(rval);
diff --git a/test/h5file/h5file_test.cpp b/test/h5file/h5file_test.cpp
index 94dc218..ec200e2 100644
--- a/test/h5file/h5file_test.cpp
+++ b/test/h5file/h5file_test.cpp
@@ -352,7 +352,7 @@ void create()
Tag itag;
if (MB_SUCCESS != iface->tag_get_handle( intname, 2, MB_TYPE_INTEGER, itag, MB_TAG_SPARSE|MB_TAG_EXCL ))
moab_error( "tag_get_handle(MB_TYPE_INT)" );
- int idata[] = { 0xDEADBEEF, 0xDEFACED };
+ int idata[] = { static_cast<int>(0xDEADBEEF), static_cast<int>(0xDEFACED) };
if (MB_SUCCESS != iface->tag_set_data( itag, &dodec, 1, idata ))
moab_error( "tag_set_data(itag)" );
diff --git a/test/h5file/h5partial.cpp b/test/h5file/h5partial.cpp
index 17abc06..c87c935 100644
--- a/test/h5file/h5partial.cpp
+++ b/test/h5file/h5partial.cpp
@@ -416,7 +416,7 @@ void create_mesh( bool create_element_sets,
// create elements
EntityHandle verts[MBQUAD_INT+1][MBQUAD_INT+1], quads[MBQUAD_INT][MBQUAD_INT];
for (int i = 0; i <= MBQUAD_INT; ++i) for(int j = 0; j <= MBQUAD_INT; ++j) {
- double coords[3] = { i, j, 0 };
+ double coords[3] = { static_cast<double>(i), static_cast<double>(j), 0 };
rval = mb.create_vertex( coords, verts[j][i] );
CHECK_ERR(rval);
int logical[2] = { i, j };
@@ -1350,7 +1350,7 @@ void test_read_adjacencies()
for (int k = 0; k < 2; ++k) {
for (int j = 0; j < 3; ++j) {
for (int i = 0; i < 3; ++i) {
- double coords[] = { i, j, k };
+ double coords[] = { static_cast<double>(i), static_cast<double>(j), static_cast<double>(k) };
rval = mb.create_vertex( coords, verts[i][j][k] );
CHECK_ERR(rval);
}
@@ -1445,7 +1445,7 @@ void test_read_sides()
EntityHandle verts[INT+1][INT+1];
for (int j = 0; j <= INT; ++j) {
for (int i = 0; i <= INT; ++i) {
- double coords[3] = { i, j, 0 };
+ double coords[3] = { static_cast<double>(i), static_cast<double>(j), 0 };
rval = mb.create_vertex( coords, verts[INT-j][i] );
CHECK_ERR(rval);
}
diff --git a/test/h5file/h5portable.cpp b/test/h5file/h5portable.cpp
index 42dfd05..cbeac98 100644
--- a/test/h5file/h5portable.cpp
+++ b/test/h5file/h5portable.cpp
@@ -107,7 +107,7 @@ void create_mesh( const char* filename )
for (size_t i = 0; i < NUM_VERT; ++i) {
- double coords[] = { i % 9, i / 9, Z };
+ double coords[] = { static_cast<double>(i % 9), static_cast<double>(i / 9), static_cast<double>(Z) };
rval = mb.create_vertex( coords, verts[i] );
CHECK_ERR(rval);
}
diff --git a/test/h5file/h5varlen.cpp b/test/h5file/h5varlen.cpp
index 7b112b5..e525475 100644
--- a/test/h5file/h5varlen.cpp
+++ b/test/h5file/h5varlen.cpp
@@ -566,7 +566,7 @@ void create_structured_quad_mesh( Interface& mb, int x, int y )
std::vector<EntityHandle> verts((x+1)*(y+1));
for (int i = 0; i <= x; ++i) {
for (int j = 0; j<= y; ++j) {
- double coords[3] = { i, j, z };
+ double coords[3] = { static_cast<double>(i), static_cast<double>(j), static_cast<double>(z) };
rval = mb.create_vertex( coords, verts[i + (x+1)*j] );
CHECK_ERR( rval );
}
diff --git a/test/io/stl_test.cc b/test/io/stl_test.cc
index 8956b38..2a4ace0 100644
--- a/test/io/stl_test.cc
+++ b/test/io/stl_test.cc
@@ -229,9 +229,9 @@ void check_mesh_is_tet( Interface& moab )
CHECK_EQUAL( 3, len );
int conn_idx[3] = {
- std::find( vert_handles, vert_handles + 4, conn[0] ) - vert_handles,
- std::find( vert_handles, vert_handles + 4, conn[1] ) - vert_handles,
- std::find( vert_handles, vert_handles + 4, conn[2] ) - vert_handles };
+ static_cast<int>(std::find( vert_handles, vert_handles + 4, conn[0] ) - vert_handles),
+ static_cast<int>(std::find( vert_handles, vert_handles + 4, conn[1] ) - vert_handles),
+ static_cast<int>(std::find( vert_handles, vert_handles + 4, conn[2] ) - vert_handles) };
CHECK( conn_idx[0] != 4 );
CHECK( conn_idx[1] != 4 );
CHECK( conn_idx[2] != 4 );
diff --git a/test/mergemesh_test.cpp b/test/mergemesh_test.cpp
index fca5304..89c4702 100644
--- a/test/mergemesh_test.cpp
+++ b/test/mergemesh_test.cpp
@@ -11,7 +11,7 @@ using namespace moab;
const char* meshfile = STRINGIFY(MESHDIR) "/16_unmerged_hex.h5m";
-int main( int argc, char* argv[] )
+int main( int , char** )
{
Core moab_core;
ErrorCode rval;
diff --git a/test/parallel/mhdf_parallel.c b/test/parallel/mhdf_parallel.c
index 178d183..7436022 100644
--- a/test/parallel/mhdf_parallel.c
+++ b/test/parallel/mhdf_parallel.c
@@ -283,7 +283,7 @@ static herr_t handle_hdf5_error( void* data )
return result;
}
-#endif // #ifdef H5_HAVE_PARALLEL
+#endif /* #ifdef H5_HAVE_PARALLEL */
int main( int argc, char* argv[] )
{
diff --git a/test/parallel/parallel_hdf5_test.cc b/test/parallel/parallel_hdf5_test.cc
index 11224f2..efb9b86 100644
--- a/test/parallel/parallel_hdf5_test.cc
+++ b/test/parallel/parallel_hdf5_test.cc
@@ -790,7 +790,8 @@ void create_input_file( const char* file_name,
for (int j = 0; j < iv; ++j) {
int start = idx;
for (int k = 0; k < iv; ++k) {
- const double coords[3] = {i, j, k};
+ const double coords[3] = {static_cast<double>(i), static_cast<double>(j),
+ static_cast<double>(k)};
rval = mb.create_vertex( coords, verts[idx] );
CHECK_ERR(rval);
if (ijk_vert_tag) {
@@ -1279,7 +1280,7 @@ void test_write_different_element_types()
const int nvert = verts[rank%ntypes];
std::vector<EntityHandle> conn(nvert);
for (int i = 0; i < nvert; ++i) {
- const double coords[] = { rank, i, 0 };
+ const double coords[] = { static_cast<double>(rank), static_cast<double>(i), 0 };
rval = mb.create_vertex( coords, conn[i] );
CHECK_ERR(rval);
}
@@ -1323,8 +1324,10 @@ Tag get_tag( Interface& mb, int rank, bool create )
std::ostringstream name;
name << "TestTag" << rank;
const void* defval = 0;
- const int defint[] = { rank, rank/2, rank+1, rank-1 };
- const double defreal[] = { 0.1*rank, 1.0/rank, -rank, rank };
+ const int defint[] = { static_cast<int>(rank), static_cast<int>(rank/2),
+ static_cast<int>(rank+1), static_cast<int>(rank-1) };
+ const double defreal[] = { 0.1*rank, 1.0/rank,
+ static_cast<double>(-rank), static_cast<double>(rank) };
const int defhandle[] = { 0, 0, 0, 0 };
const unsigned char defbit = 0x1;
const char defopq[] = "Jason";
@@ -1384,14 +1387,14 @@ void test_write_polygons()
// create a polygon on each process
const double r = 0.70710678118654757;
- const double points[8][3] = { { 1, 0, rank },
- { r, r, rank },
- { 0, 1, rank },
- {-r, r, rank },
- {-1, 0, rank },
- {-r,-r, rank },
- { 0,-1, rank },
- { r,-r, rank } };
+ const double points[8][3] = { { 1, 0, static_cast<double>(rank) },
+ { static_cast<double>(r), static_cast<double>(r), static_cast<double>(rank) },
+ { 0, 1, static_cast<double>(rank) },
+ {static_cast<double>(-r), static_cast<double>(r), static_cast<double>(rank) },
+ {-1, 0, static_cast<double>(rank) },
+ {static_cast<double>(-r),static_cast<double>(-r), static_cast<double>(rank) },
+ { 0,-1, static_cast<double>(rank) },
+ { static_cast<double>(r),static_cast<double>(-r), static_cast<double>(rank) } };
const int nvtx = rank % 4 + 5;
std::vector<EntityHandle> conn(nvtx);
for (int i = 0; i < nvtx; ++i) {
@@ -1468,10 +1471,10 @@ void test_write_unbalanced()
// create a quad on every odd processor
if (rank % 2) {
- const double coords[4][3] = { { rank, 0, 0 },
- { rank+2, 0, 0 },
- { rank+2, 2, 0 },
- { rank, 2, 0 } };
+ const double coords[4][3] = { { static_cast<double>(rank), 0, 0 },
+ { static_cast<double>(rank+2), 0, 0 },
+ { static_cast<double>(rank+2), 2, 0 },
+ { static_cast<double>(rank), 2, 0 } };
EntityHandle conn[4], quad;
for (int i = 0; i < 4; ++i)
mb.create_vertex( coords[i], conn[i] );
diff --git a/test/parallel/pcomm_unit.cpp b/test/parallel/pcomm_unit.cpp
index bb6e57c..385784a 100644
--- a/test/parallel/pcomm_unit.cpp
+++ b/test/parallel/pcomm_unit.cpp
@@ -214,7 +214,8 @@ void create_simple_grid( Interface& moab, unsigned x, unsigned y, unsigned z )
for (unsigned k = 0; k < z; ++k)
for (unsigned j = 0; j < y; ++j)
for (unsigned i = 0; i < x; ++i) {
- const double coords[3] = { i, j, k };
+ const double coords[3] = { static_cast<double>(i), static_cast<double>(j),
+ static_cast<double>(k) };
rval = moab.create_vertex( coords, verts[x*y*k + x*j + i] );
CHECK_ERR(rval);
}
diff --git a/test/reorder_test.cpp b/test/reorder_test.cpp
index 8201add..daad73e 100644
--- a/test/reorder_test.cpp
+++ b/test/reorder_test.cpp
@@ -185,7 +185,8 @@ void build_mesh( )
rval = mb->tag_set_data( gid, &h, 1, &tagval );
CHECK_ERR(rval);
- int ids[4] = { n0, n1, n2, n3 };
+ int ids[4] = { static_cast<int>(n0), static_cast<int>(n1),
+ static_cast<int>(n2), static_cast<int>(n3) };
rval = mb->tag_set_data( conn_ids, &h, 1, ids );
CHECK_ERR(rval);
diff --git a/tools/mbcoupler/ElemUtilTest.cpp b/tools/mbcoupler/ElemUtilTest.cpp
index eae57c2..082a1eb 100644
--- a/tools/mbcoupler/ElemUtilTest.cpp
+++ b/tools/mbcoupler/ElemUtilTest.cpp
@@ -102,9 +102,6 @@ void test_hex_nat_coords()
result_xi = hex2.ievaluate(pt, EPS1/10);
double dum = EPS1/10;
valid = hex2.inside_nat_space(result_xi, dum);
- if (!valid) {
- double d1 = 0;
- }
CHECK(valid);
CHECK_REAL_EQUAL( xi[0], result_xi[0], EPS1 );
CHECK_REAL_EQUAL( xi[1], result_xi[1], EPS1 );
diff --git a/tools/mbzoltan/MBZoltan.cpp b/tools/mbzoltan/MBZoltan.cpp
index 7590ac9..5427cc8 100644
--- a/tools/mbzoltan/MBZoltan.cpp
+++ b/tools/mbzoltan/MBZoltan.cpp
@@ -362,8 +362,12 @@ ErrorCode MBZoltan::partition_mesh_geom(const double part_geom_mesh_size,
const int part_dim,
const int obj_weight,
const int edge_weight,
+#ifdef CGM
const bool part_surf,
const bool ghost,
+#else
+ const bool, const bool,
+#endif
const bool print_time,
const bool spherical_coords)
{
diff --git a/tools/mcnpmit/mcnpmit.cpp b/tools/mcnpmit/mcnpmit.cpp
index 81b9670..e6e2772 100644
--- a/tools/mcnpmit/mcnpmit.cpp
+++ b/tools/mcnpmit/mcnpmit.cpp
@@ -79,7 +79,6 @@ MCNPError McnpData::read_mcnpfile(bool skip_mesh) {
MCNPError result;
moab::ErrorCode MBresult;
- int nelems;
moab::CartVect tvect;
std::vector<double> xvec[3];
@@ -142,7 +141,6 @@ MCNPError McnpData::read_mcnpfile(bool skip_mesh) {
}
// Make the elements and vertices
- nelems = (nv[0] - 1) * (nv[1] - 1) * (nv[2] - 1);
result = make_elements(xvec, nv);
if (result == MCNP_FAILURE) return MCNP_FAILURE;
break;
@@ -266,8 +264,6 @@ MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
// double v[3];
// MBEntityHandle dumhandle;
// MBEntityHandle vstart, vijk;
- moab::ErrorCode MBresult;
-
unsigned int num_verts = n[0]*n[1]*n[2];
double *coords;
coords = new double [ 3 * num_verts ];
@@ -306,7 +302,7 @@ MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
}
}
- MBresult = MBI->create_vertices(coords, num_verts, vert_handles);
+ MBI->create_vertices(coords, num_verts, vert_handles);
delete coords;
@@ -315,10 +311,8 @@ MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
MCNPError McnpData::initialize_tags() {
- moab::ErrorCode rval;
-
- rval = MBI->tag_get_handle(TALLY_TAG, 1, moab::MB_TYPE_DOUBLE, tally_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
- rval = MBI->tag_get_handle(ERROR_TAG, 1, moab::MB_TYPE_DOUBLE, relerr_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
+ MBI->tag_get_handle(TALLY_TAG, 1, moab::MB_TYPE_DOUBLE, tally_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
+ MBI->tag_get_handle(ERROR_TAG, 1, moab::MB_TYPE_DOUBLE, relerr_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
return MCNP_SUCCESS;
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list