[MOAB-dev] r3090 - in MOAB/trunk: . parallel
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Mon Aug 3 16:47:41 CDT 2009
Author: kraftche
Date: 2009-08-03 16:47:41 -0500 (Mon, 03 Aug 2009)
New Revision: 3090
Modified:
MOAB/trunk/WriteHDF5.cpp
MOAB/trunk/parallel/WriteHDF5Parallel.cpp
Log:
fix debug message formatting
Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp 2009-08-03 20:52:53 UTC (rev 3089)
+++ MOAB/trunk/WriteHDF5.cpp 2009-08-03 21:47:41 UTC (rev 3090)
@@ -347,9 +347,12 @@
va_list args;
va_start(args, fmt);
char buffer[128];
- size_t n = snprintf( buffer, sizeof(buffer), "%6.2f: \n", (double)(clock()-t0)/CLOCKS_PER_SEC );
+ size_t n = snprintf( buffer, sizeof(buffer), "%6.2f: ", (double)(clock()-t0)/CLOCKS_PER_SEC );
vsnprintf( buffer+n, sizeof(buffer)-n, fmt, args );
fputs( buffer, stderr );
+ if (n > sizeof(buffer) - 2)
+ n = sizeof(buffer)-2;
+ strcpy( buffer+n, "\n" );
va_end(args);
#endif
}
@@ -788,7 +791,7 @@
}
tprint(" writing %c node chunk %ld of %ld, %ld values at %ld ",
- (char)('x'+d), num_writes - remaining_writes, num_writes, offset, count );
+ (char)('x'+d), num_writes - remaining_writes + 1, num_writes, offset, count );
mhdf_writeNodeCoordWithOpt( node_table, offset, count, d, buffer, writeProp, &status );
CHK_MHDF_ERR_1(status, node_table);
}
@@ -803,7 +806,7 @@
assert(writeProp != H5P_DEFAULT);
for (int d = 0; d < dim; ++d) {
tprint(" writing (empty) %d node chunk %ld of %ld.",
- (char)('x'+d), num_writes - remaining_writes, num_writes );
+ (char)('x'+d), num_writes - remaining_writes + 1, num_writes );
mhdf_writeNodeCoordWithOpt( node_table, offset, 0, d, 0, writeProp, &status );
CHK_MHDF_ERR_1(status, node_table);
}
@@ -865,7 +868,7 @@
return MB_FAILURE;
tprint(" writing node connectivity %ld of %ld, %ld values at %ld ",
- num_writes - remaining_writes, num_writes, offset, count );
+ num_writes - remaining_writes + 1, num_writes, offset, count );
mhdf_writeConnectivityWithOpt( elem_table, offset, count,
id_type, buffer, writeProp, &status );
CHK_MHDF_ERR_1(status, elem_table);
@@ -878,7 +881,7 @@
while (remaining_writes--) {
assert(writeProp != H5P_DEFAULT);
tprint(" writing (empty) connectivity chunk %ld of %ld.",
- num_writes - remaining_writes, num_writes );
+ num_writes - remaining_writes + 1, num_writes );
mhdf_writeConnectivityWithOpt( elem_table, offset, 0, id_type, 0, writeProp, &status );
CHK_MHDF_ERR_1(status, elem_table);
}
Modified: MOAB/trunk/parallel/WriteHDF5Parallel.cpp
===================================================================
--- MOAB/trunk/parallel/WriteHDF5Parallel.cpp 2009-08-03 20:52:53 UTC (rev 3089)
+++ MOAB/trunk/parallel/WriteHDF5Parallel.cpp 2009-08-03 21:47:41 UTC (rev 3090)
@@ -2048,8 +2048,11 @@
int rank;
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
char buffer[128];
- size_t n = snprintf( buffer, sizeof(buffer), "%02d: %6.2f: \n", rank, MPI_Wtime()-t0 );
- vsnprintf( buffer+n, sizeof(buffer)-n, fmt, args );
+ size_t n = snprintf( buffer, sizeof(buffer), "%02d: %6.2f: ", rank, MPI_Wtime()-t0 );
+ n += vsnprintf( buffer+n, sizeof(buffer)-n, fmt, args );
+ if (n > sizeof(buffer) - 2)
+ n = sizeof(buffer)-2;
+ strcpy( buffer+n, "\n" );
fputs( buffer, stderr );
va_end(args);
#endif
More information about the moab-dev
mailing list