summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-19 20:21:09 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-19 20:21:09 (GMT)
commit5af701a32e57a90c8fad407b57486b4f08384047 (patch)
treeb0e11e715078f83e795dc9aaa470bd5f0d23b98b /tools/lib
parent6e2d2bc64104796cea9d9183ed4cb9e7695862f4 (diff)
downloadhdf5-5af701a32e57a90c8fad407b57486b4f08384047.zip
hdf5-5af701a32e57a90c8fad407b57486b4f08384047.tar.gz
hdf5-5af701a32e57a90c8fad407b57486b4f08384047.tar.bz2
[svn-r13334] Added a new function to print the dimensions sizes
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c48
-rw-r--r--tools/lib/h5diff.h8
-rw-r--r--tools/lib/h5diff_array.c14
-rw-r--r--tools/lib/h5diff_attr.c4
-rw-r--r--tools/lib/h5diff_dset.c137
5 files changed, 128 insertions, 83 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 24ec1b9..2f850a6 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -39,7 +39,7 @@
/*-------------------------------------------------------------------------
* Function: print_objname
*
- * Purpose: print object name only when:
+ * Purpose: check if object name is to be printed, only when:
* 1) verbose mode
* 2) when diff was found (normal mode)
*-------------------------------------------------------------------------
@@ -50,6 +50,22 @@ print_objname (diff_opt_t * options, hsize_t nfound)
return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
}
+/*-------------------------------------------------------------------------
+ * Function: do_print_objname
+ *
+ * Purpose: print object name
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+do_print_objname (const char *OBJ, const char *path1, const char *path2)
+{
+ parallel_print("%s:\n<%s> and <%s> ", OBJ, path1, path2);
+}
+
+
+
+
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
* Function: phdiff_dismiss_workers
@@ -893,10 +909,10 @@ hsize_t diff (hid_t file1_id,
hid_t type2_id=(-1);
hid_t grp1_id=(-1);
hid_t grp2_id=(-1);
- int ret;
- H5G_stat_t sb1;
- H5G_stat_t sb2;
- hsize_t nfound = 0;
+ int ret;
+ H5G_stat_t sb1;
+ H5G_stat_t sb2;
+ hsize_t nfound=0;
switch (type)
{
@@ -913,8 +929,8 @@ hsize_t diff (hid_t file1_id,
if (options->m_verbose)
{
if (print_objname (options, (hsize_t)1))
- parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
+ do_print_objname ("dataset", path1, path2);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 1);
/* always print the number of differences found */
print_found(nfound);
}
@@ -928,14 +944,14 @@ hsize_t diff (hid_t file1_id,
{
/* shut up temporarily */
options->m_quiet = 1;
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 0);
/* print again */
options->m_quiet = 0;
if (nfound)
{
if (print_objname (options, nfound))
- parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
+ do_print_objname ("dataset", path1, path2);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 1);
/* print the number of differences found only when found
this is valid for the default mode and report mode */
print_found(nfound);
@@ -948,7 +964,7 @@ hsize_t diff (hid_t file1_id,
*/
else
{
- nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
+ nfound = diff_dataset (file1_id, file2_id, path1, path2, options, 0);
}
} /*else verbose */
@@ -971,7 +987,7 @@ hsize_t diff (hid_t file1_id,
nfound = (ret > 0) ? 0 : 1;
if (print_objname (options, nfound))
- parallel_print("Datatype: <%s> and <%s>\n", path1, path2);
+ do_print_objname ("datatype", path1, path2);
/* always print the number of differences found in verbose mode */
if (options->m_verbose)
@@ -1008,7 +1024,7 @@ hsize_t diff (hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if (print_objname (options, nfound))
- parallel_print("Group: <%s> and <%s>\n", path1, path2);
+ do_print_objname ("group", path1, path2);
/* always print the number of differences found in verbose mode */
if (options->m_verbose)
@@ -1058,7 +1074,7 @@ hsize_t diff (hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if (print_objname (options, nfound))
- parallel_print("Soft Link: <%s> and <%s>\n", path1, path2);
+ do_print_objname ("soft link", path1, path2);
/* always print the number of differences found in verbose mode */
if (options->m_verbose)
@@ -1124,7 +1140,7 @@ hsize_t diff (hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if (print_objname (options, nfound))
- parallel_print("External Link: <%s> and <%s>\n", path1, path2);
+ do_print_objname ("external link", path1, path2);
}
else
{
@@ -1141,7 +1157,7 @@ hsize_t diff (hid_t file1_id,
nfound = 0;
if (print_objname (options, nfound))
- parallel_print("User-defined Link: <%s> and <%s>\n", path1, path2);
+ do_print_objname ("user defined link", path1, path2);
}
/* always print the number of differences found in verbose mode */
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 4722c82..95fc400 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -76,13 +76,15 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options );
+ diff_opt_t *options,
+ int print_dims);
hsize_t diff_datasetid( hid_t dset1_id,
hid_t dset2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options );
+ diff_opt_t *options,
+ int print_dims);
hsize_t diff( hid_t file1_id,
const char *path1,
@@ -160,6 +162,8 @@ const char* get_class(H5T_class_t tclass);
const char* get_sign(H5T_sign_t sign);
void print_dims( int r, hsize_t *d );
int print_objname(diff_opt_t *options, hsize_t nfound);
+void do_print_objname (const char *OBJ, const char *path1, const char *path2);
+
hsize_t diff_datum(void *_mem1,
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 1e0417c..bf26370 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -170,17 +170,6 @@ void print_pos( int *ph, /* print header */
{
*ph=0;
- /* print size of array */
- parallel_print("size [" );
- for ( i = 0; i < rank-1; i++)
- {
- parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]);
- parallel_print("x");
- }
- parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]);
- parallel_print("]\n" );
-
-
if (pp)
{
parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
@@ -800,7 +789,8 @@ hsize_t diff_datum(void *_mem1,
obj2_id,
NULL,
NULL,
- options);
+ options,
+ 0);
break;
default:
parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>",
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index e10a023..346d64f 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -200,7 +200,7 @@ int diff_attr(hid_t loc1_id,
/* always print name */
if (options->m_verbose)
{
- parallel_print( "Attribute: <%s> and <%s>\n",np1,np2);
+ do_print_objname ("attribute", np1, np2);
nfound = diff_array(buf1,
buf2,
nelmts1,
@@ -239,7 +239,7 @@ int diff_attr(hid_t loc1_id,
options->m_quiet=0;
if (nfound)
{
- parallel_print( "Attribute: <%s> and <%s>\n",np1,np2);
+ do_print_objname ("attribute", np1, np2);
nfound = diff_array(buf1,
buf2,
nelmts1,
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 8e23ff9..e913e79 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -18,60 +18,28 @@
#include "H5private.h"
#include "h5tools.h"
-
/*-------------------------------------------------------------------------
- * Function: print_sizes
+ * Function: print_size
*
- * Purpose: Print datatype sizes
+ * Purpose: print dimensions
*
*-------------------------------------------------------------------------
*/
-#if defined (H5DIFF_DEBUG)
-void print_sizes( const char *obj1,
- const char *obj2,
- hid_t f_tid1,
- hid_t f_tid2,
- hid_t m_tid1,
- hid_t m_tid2 )
+void
+print_size (int rank, hsize_t *dims)
{
- size_t f_size1, f_size2; /* size of type in file */
- size_t m_size1, m_size2; /* size of type in memory */
-
- f_size1 = H5Tget_size( f_tid1 );
- f_size2 = H5Tget_size( f_tid2 );
- m_size1 = H5Tget_size( m_tid1 );
- m_size2 = H5Tget_size( m_tid2 );
-
- printf("\n");
- printf("------------------\n");
- printf("sizeof(char) %u\n", sizeof(char) );
- printf("sizeof(short) %u\n", sizeof(short) );
- printf("sizeof(int) %u\n", sizeof(int) );
- printf("sizeof(long) %u\n", sizeof(long) );
- printf("<%s> ------------------\n", obj1);
- printf("type on file ");
- print_type(f_tid1);
- printf("\n");
- printf("size on file %u\n", f_size1 );
-
- printf("type on memory ");
- print_type(m_tid1);
- printf("\n");
- printf("size on memory %u\n", m_size1 );
+ int i;
- printf("<%s> ------------------\n", obj2);
- printf("type on file ");
- print_type(f_tid2);
- printf("\n");
- printf("size on file %u\n", f_size2 );
-
- printf("type on memory ");
- print_type(m_tid2);
- printf("\n");
- printf("size on memory %u\n", m_size2 );
- printf("\n");
+ parallel_print("[" );
+ for ( i = 0; i < rank-1; i++)
+ {
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]);
+ parallel_print("x");
+ }
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]);
+ parallel_print("]\n" );
+
}
-#endif /* H5DIFF_DEBUG */
@@ -93,7 +61,8 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options )
+ diff_opt_t *options,
+ int print_dims)
{
hid_t did1=-1;
hid_t did2=-1;
@@ -141,7 +110,8 @@ hsize_t diff_dataset( hid_t file1_id,
did2,
obj1_name,
obj2_name,
- options);
+ options,
+ print_dims);
}
/*-------------------------------------------------------------------------
* close
@@ -190,7 +160,8 @@ hsize_t diff_datasetid( hid_t did1,
hid_t did2,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options )
+ diff_opt_t *options,
+ int print_dims)
{
hid_t sid1=-1;
hid_t sid2=-1;
@@ -260,6 +231,13 @@ hsize_t diff_datasetid( hid_t did1,
if ( (f_tid2 = H5Dget_type(did2)) < 0 )
goto error;
+
+ /*-------------------------------------------------------------------------
+ * print dimensions
+ *-------------------------------------------------------------------------
+ */
+ if (print_dims)
+ print_size (rank1, dims1);
/*-------------------------------------------------------------------------
* check for empty datasets
@@ -730,7 +708,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name)
{
- printf("warning: different storage datatype\n");
+ printf("Warning: different storage datatype\n");
printf("<%s> has file datatype ", obj1_name);
print_type(f_tid1);
printf("\n");
@@ -807,7 +785,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name )
{
if (options->m_verbose) {
- printf( "warning: different maximum dimensions\n");
+ printf( "Warning: different maximum dimensions\n");
printf("<%s> has max dimensions ", obj1_name);
print_dims(rank1,maxdim1);
printf("\n");
@@ -819,3 +797,60 @@ int diff_can_type( hid_t f_tid1, /* file data type */
return 1;
}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_sizes
+ *
+ * Purpose: Print datatype sizes
+ *
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5DIFF_DEBUG)
+void print_sizes( const char *obj1,
+ const char *obj2,
+ hid_t f_tid1,
+ hid_t f_tid2,
+ hid_t m_tid1,
+ hid_t m_tid2 )
+{
+ size_t f_size1, f_size2; /* size of type in file */
+ size_t m_size1, m_size2; /* size of type in memory */
+
+ f_size1 = H5Tget_size( f_tid1 );
+ f_size2 = H5Tget_size( f_tid2 );
+ m_size1 = H5Tget_size( m_tid1 );
+ m_size2 = H5Tget_size( m_tid2 );
+
+ printf("\n");
+ printf("------------------\n");
+ printf("sizeof(char) %u\n", sizeof(char) );
+ printf("sizeof(short) %u\n", sizeof(short) );
+ printf("sizeof(int) %u\n", sizeof(int) );
+ printf("sizeof(long) %u\n", sizeof(long) );
+ printf("<%s> ------------------\n", obj1);
+ printf("type on file ");
+ print_type(f_tid1);
+ printf("\n");
+ printf("size on file %u\n", f_size1 );
+
+ printf("type on memory ");
+ print_type(m_tid1);
+ printf("\n");
+ printf("size on memory %u\n", m_size1 );
+
+ printf("<%s> ------------------\n", obj2);
+ printf("type on file ");
+ print_type(f_tid2);
+ printf("\n");
+ printf("size on file %u\n", f_size2 );
+
+ printf("type on memory ");
+ print_type(m_tid2);
+ printf("\n");
+ printf("size on memory %u\n", m_size2 );
+ printf("\n");
+}
+#endif /* H5DIFF_DEBUG */