summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff_util.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2005-01-26 23:03:29 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2005-01-26 23:03:29 (GMT)
commit42754e6246d6916d88720b32a4a2d2b6cbabb312 (patch)
treec6999853ed938b197eea6e40c1c9f9907e2a7a7a /tools/lib/h5diff_util.c
parent3cb812ae8a610f5e3801c89f915c680a3f1a4f5b (diff)
downloadhdf5-42754e6246d6916d88720b32a4a2d2b6cbabb312.zip
hdf5-42754e6246d6916d88720b32a4a2d2b6cbabb312.tar.gz
hdf5-42754e6246d6916d88720b32a4a2d2b6cbabb312.tar.bz2
[svn-r9872] Purpose:
New feature. Description: Added new tool ph5diff. (Code done by Leon Arber.) Code is changed but test is not working yet. For now, it skipped all tests. Platforms tested: Tested in heping, serial and parallel modes.
Diffstat (limited to 'tools/lib/h5diff_util.c')
-rw-r--r--tools/lib/h5diff_util.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index bbd1747..416e808 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -13,10 +13,37 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5diff.h"
+#include "ph5diff.h"
#include "H5private.h"
/*-------------------------------------------------------------------------
+ * Function: parallel_print
+ *
+ * Purpose: wrapper for printf for use in parallel mode.
+ *
+ * Programmer: Leon Arber
+ *
+ * Date: December 1, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void parallel_print(const char* format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ if(!PARALLEL)
+ vprintf(format, ap);
+ else
+ outBuffOffset += vsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
+
+ va_end(ap);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: print_pos
*
* Purpose: convert an array index position to matrix notation
@@ -46,22 +73,22 @@ void print_pos( int *ph,
*ph=0;
if (per)
{
- printf("%-15s %-15s %-15s %-15s %-15s\n",
+ parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
(obj2!=NULL) ? obj2 : " ",
"difference",
"relative");
- printf("------------------------------------------------------------------------\n");
+ parallel_print("------------------------------------------------------------------------\n");
}
else
{
- printf("%-15s %-15s %-15s %-20s\n",
+ parallel_print("%-15s %-15s %-15s %-20s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
(obj2!=NULL) ? obj2 : " ",
"difference");
- printf("------------------------------------------------------------\n");
+ parallel_print("------------------------------------------------------------\n");
}
}
@@ -72,12 +99,13 @@ void print_pos( int *ph,
}
assert( curr_pos == 0 );
- printf("[ " );
+ parallel_print("[ " );
for ( i = 0; i < rank; i++)
{
- HDfprintf(stdout,"%Hu ", pos[i] );
+ /* HDfprintf(stdout,"%Hu ", pos[i] ); */
+ parallel_print("%d ",(int) pos[i]);
}
- printf("]" );
+ parallel_print("]" );
}
/*-------------------------------------------------------------------------
@@ -94,13 +122,12 @@ void print_pos( int *ph,
void print_dims( int r, hsize_t *d )
{
int i;
- printf("[ " );
+ parallel_print("[ " );
for ( i=0; i<r; i++ )
- printf("%d ",(int)d[i] );
- printf("] " );
+ parallel_print("%d ",(int)d[i] );
+ parallel_print("] " );
}
-
/*-------------------------------------------------------------------------
* Function: print_type
*