这篇教程C++ H5_FAILED函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中H5_FAILED函数的典型用法代码示例。如果您正苦于以下问题:C++ H5_FAILED函数的具体用法?C++ H5_FAILED怎么用?C++ H5_FAILED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了H5_FAILED函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: test_1g/*------------------------------------------------------------------------- * Function: test_1g * * Purpose: It should be impossible to define an unlimited external file * and then follow it with another external file. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Monday, November 23, 1998 * * Modifications: * *------------------------------------------------------------------------- */static inttest_1g(void){ hid_t dcpl=-1; /*dataset creation properties */ herr_t status; /*function return status */ int n; /*number of external files */ TESTING("external file following unlimited file"); if ((dcpl=H5Pcreate (H5P_DATASET_CREATE)) < 0) goto error; if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; H5E_BEGIN_TRY { status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; if (status>=0) { H5_FAILED(); puts (" H5Pset_external() succeeded when it should have failed."); goto error; } if ((n = H5Pget_external_count(dcpl)) < 0) goto error; if (1!=n) { H5_FAILED(); puts(" Wrong external file count returned."); goto error; } if (H5Pclose(dcpl) < 0) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(dcpl); } H5E_END_TRY; return 1;}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:51,
示例2: test_3/*------------------------------------------------------------------------- * Function: test_3 * * Purpose: Creates a few global heap objects and then removes them all. * The collection should also be removed. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, March 31, 1998 * * Modifications: * *------------------------------------------------------------------------- */static inttest_3 (hid_t fapl){ hid_t file = -1; H5F_t *f = NULL; H5HG_t obj[1024]; uint8_t out[1024]; int i; size_t size; herr_t status; int nerrors = 0; char filename[1024]; TESTING("complete object removal"); /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); puts(" Unable to create file"); goto error; } /* Create some stuff */ for (i=0; i<1024; i++) { size = i%30+100; memset (out, 'A'+i%26, size); H5Eclear2(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; } } /* Remove everything */ for (i=0; i<1024; i++) { status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); nerrors++; } } if (H5Fclose(file)<0) goto error; if (nerrors) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; return MAX(1, nerrors);}
开发者ID:worst-nick-ever,项目名称:hdf5,代码行数:76,
示例3: test_decrement/*------------------------------------------------------------------------- * Function: test_decrement * * Purpose: Test operation to decrement bit vector by 1. * * Return: Success: 0 * * Failure: -1 * * Programmer: Raymond Lu * Monday, April 12, 2004 * * Modifications: * *------------------------------------------------------------------------- */static herr_ttest_decrement (void){ uint8_t vector[8]; size_t offset, size; int i, j; ssize_t n; TESTING("bit decrement operations"); for (i=0; i<NTESTS; i++) { offset = HDrand() % (8*sizeof vector); size = (unsigned)HDrand() % (8*sizeof(vector)-offset); /* Don't want size to be 0 */ if(size == 0) continue; /* All-zero sequence will become 111111(size=6) after decrement */ memset (vector, 0x00, sizeof vector); /* decrement the sequence by one */ H5T_bit_dec (vector, offset, size); /* Look for the ones */ n = H5T_bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)/n", (int)n); goto failed; } /* * Look for zeros and ones in reverse order. This is only to test * that reverse searches work as expected. */ n = H5T_bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); printf (" Unable to find last bit in destination " "(reverse, n=%d)/n", (int)n); goto failed; } } PASSED(); return 0; failed: printf (" i=%d, offset=%lu, size=%lu/n", i, (unsigned long)offset, (unsigned long)size); for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); printf ("/n"); return -1;}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:70,
示例4: test_create_closestatic int test_create_close(hid_t fid){ herr_t err; hid_t table; hid_t part_t; TESTING("H5PTcreate_fl and H5PTclose"); /* Create a datatype for the particle struct */ part_t = make_particle_type(); HDassert(part_t != -1); /* Create the table */ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); H5Tclose(part_t); if( H5PTis_valid(table) < 0) goto error; if( H5PTis_varlen(table) != 0) goto error; /* Close the table */ err = H5PTclose(table); if( err < 0) goto error; PASSED(); return SUCCEED;error: H5_FAILED(); return FAIL;}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:33,
示例5: test_1h/*------------------------------------------------------------------------- * Function: test_1h * * Purpose: It should be impossible to create a set of external files * whose total size overflows a size_t integer. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Monday, November 23, 1998 * * Modifications: * *------------------------------------------------------------------------- */static inttest_1h(void){ hid_t dcpl=-1; /*dataset creation properties */ herr_t status; /*return status */ TESTING("address overflow in external files"); if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) goto error; H5E_BEGIN_TRY { status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; if (status>=0) { H5_FAILED(); puts(" H5Pset_external() succeeded when it should have failed."); goto error; } if (H5Pclose(dcpl) < 0) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(dcpl); } H5E_END_TRY; return 1;}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:44,
示例6: test_open/*------------------------------------------------------------------------- * test_open * * Tests opening and closing a FL packet table * *------------------------------------------------------------------------- */static int test_open(hid_t fid){ herr_t err; hid_t table; TESTING("H5PTopen"); /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) goto error; if( H5PTis_varlen(table) != 0) goto error; /* Close the table */ err = H5PTclose(table); if( err < 0) goto error; PASSED(); return SUCCEED;error: if (table > 0) H5PTclose(table); H5_FAILED(); return FAIL;}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:34,
示例7: test_create_closestatic int test_create_close(hid_t fid){ herr_t err; hid_t table; hid_t part_t; TESTING("H5PTcreate_fl and H5PTclose"); /* Create a datatype for the particle struct */ part_t = make_particle_type(); HDassert(part_t != -1); /* Create the table */ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); H5Tclose(part_t); if( H5PTis_valid(table) < 0) goto out;#ifdef VLPT_REMOVED if( H5PTis_varlen(table) != 0) goto out;#endif /* VLPT_REMOVED */ /* Close the table */ err = H5PTclose(table); if( err < 0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:35,
示例8: test_open/*------------------------------------------------------------------------- * test_open * * Tests opening and closing a FL packet table * *------------------------------------------------------------------------- */static int test_open(hid_t fid){ herr_t err; hid_t table; TESTING("H5PTopen"); /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) goto out;#ifdef VLPT_REMOVED if( H5PTis_varlen(table) != 0) goto out;#endif /* VLPT_REMOVED */ /* Close the table */ err = H5PTclose(table); if( err < 0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:35,
示例9: test_compounds/*-------------------------------------------------------------------------* subroutine for test_text_dtype(): test_compounds().*-------------------------------------------------------------------------*/static int test_compounds(void){ hid_t dtype; int nmembs; char *memb_name = NULL; H5T_class_t memb_class; H5T_class_t type_class; char* dt_str; size_t str_len; TESTING3(" text for compound types"); if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE /"one_field/" : 2; H5T_STD_U8LE /"two_field/" : 6; }", H5LT_DDL))<0) goto out; if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_COMPOUND) goto out; if((nmembs = H5Tget_nmembers(dtype))<0) goto out; if(nmembs != 2) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; if(strcmp(dt_str, "H5T_COMPOUND {/n H5T_STD_I16BE /"one_field/" : 2;/n H5T_STD_U8LE /"two_field/" : 6;/n }")) { printf("dt=/n%s/n", dt_str); goto out; } free(dt_str); if(H5Tclose(dtype)<0) goto out; if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I32BE /"i32_field/"; H5T_STD_I16BE /"i16_field/"; H5T_COMPOUND { H5T_STD_I16BE /"sec_field/"; H5T_COMPOUND { H5T_STD_I32BE /"thd_field/"; } /"grandchild/"; } /"child_compound/"; H5T_STD_I8BE /"i8_field/"; }", H5LT_DDL))<0) goto out; if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; if(strcmp(memb_name, "i16_field")) goto out; free(memb_name); if((memb_class = H5Tget_member_class(dtype, 2))<0) goto out; if(memb_class != H5T_COMPOUND) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:chaako,项目名称:sceptic3D,代码行数:64,
示例10: test_duplicatelong_attachscalesstatic int test_duplicatelong_attachscales(const char *filename){ hid_t fid = -1; hid_t did = -1; char dsname[32]; char scalename[32]; strcpy(dsname, DATASET_NAME); strcat(dsname, "al2"); TESTING2("test_duplicatelong_attachscales"); if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; /* make a dataset 2 */ if(create_long_dataset(fid, dsname, "al2") < 0) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { strcpy(scalename, DS_1_NAME); strcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; strcpy(scalename, DS_2_NAME); strcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; strcpy(scalename, DS_3_NAME); strcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; strcpy(scalename, DS_4_NAME); strcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM3) < 0) goto out; if(H5Dclose(did) < 0) goto out; } else goto out; PASSED(); H5Fclose(fid); return SUCCEED;out: H5E_BEGIN_TRY { H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; H5_FAILED(); return FAIL;}
开发者ID:herr-biber,项目名称:hdf5,代码行数:60,
示例11: test_read_data/*------------------------------------------------------------------------- * Function: test_read_data * * Purpose: Tests reading data and compares values * * Return: Success: 0 * Failure: -1 * * Programmer: Raymond Lu * 14 March 2013 * *------------------------------------------------------------------------- */static herr_ttest_read_data(hid_t dataset, int *origin_data){ int check[DSET_DIM1][DSET_DIM2]; const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ int *data_p = origin_data; size_t i, j; /* Local index variables */ /* Read the dataset back */ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for(i=0; i<size[0]; i++) { for(j=0; j<size[1]; j++) { if(*data_p != check[i][j]) { H5_FAILED(); fprintf(stderr," Read different values than written./n"); fprintf(stderr," At index %lu,%lu/n", (unsigned long)i, (unsigned long)j); fprintf(stderr," At original: %d/n", *data_p); fprintf(stderr," At returned: %d/n", (int)check[i][j]); goto error; } data_p++; } } PASSED(); return 0;error: return -1;}
开发者ID:schwehr,项目名称:hdf5,代码行数:46,
示例12: h5_errors/*------------------------------------------------------------------------- * Function: h5_errors * * Purpose: Displays the error stack after printing "*FAILED*". * * Return: Success: 0 * * Failure: -1 * * Programmer: Robb Matzke * Wednesday, March 4, 1998 * * Modifications: * *------------------------------------------------------------------------- */static herr_th5_errors(hid_t estack, void UNUSED *client_data){ H5_FAILED(); H5Eprint2(estack, stdout); return 0;}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:23,
示例13: test_append/*------------------------------------------------------------------------- * test_append * * Tests appending packets to a FL packet table * *------------------------------------------------------------------------- */static int test_append(hid_t fid){ herr_t err; hid_t table; hsize_t count; TESTING("H5PTappend"); /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) goto out; /* Count the number of packets in the table */ err = H5PTget_num_packets(table, &count); if( err < 0) goto out; /* There should be 0 records in the table */ if( count != 0 ) goto out; /* Append one particle */ err = H5PTappend(table, (size_t)1, &(testPart[0])); if( err < 0) goto out; /* Append several particles */ err = H5PTappend(table, (size_t)6, &(testPart[1])); if( err < 0) goto out; /* Append one more particle */ err = H5PTappend(table, (size_t)1, &(testPart[7])); if( err < 0) goto out; /* Count the number of packets in the table */ err = H5PTget_num_packets(table, &count); if( err < 0) goto out; /* There should be 8 records in the table now */ if( count != 8 ) goto out; /* Close the table */ err = H5PTclose(table); if( err < 0) goto out; PASSED(); return 0;out: H5_FAILED(); if( H5PTis_valid(table) < 0) H5PTclose(table); return -1;}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:65,
示例14: test_opaque/*------------------------------------------------------------------------- * test_opaque * * Tests that the packet table works with an opaque datatype. * *------------------------------------------------------------------------- */static int test_opaque(hid_t fid){ herr_t err; hid_t table; hid_t part_t; size_t c; particle_t readBuf[NRECORDS]; TESTING("opaque data"); /* Create an opaque datatype for the particle struct */ if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 ) return -1; HDassert(part_t != -1); /* Tag the opaque datatype */ if ( H5Tset_tag(part_t, "Opaque Particle" ) < 0) return -1; /* Create a new table */ table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, (hsize_t)100, -1); H5Tclose(part_t); if( H5PTis_valid(table) < 0) goto out; /* Append several particles, starting at particle 1 */ err = H5PTappend(table, (size_t)(NRECORDS - 1), &(testPart[1])); if( err < 0) goto out; /* Read the particles back */ err = H5PTread_packets(table, (hsize_t)0, 7, &(readBuf[0])); if( err < 0) goto out; /* Ensure that particles were read correctly */ for(c=0; c<NRECORDS - 1; c++) { if( cmp_par(c+1, c, testPart, readBuf) != 0) goto out; } /* Close the table */ err = H5PTclose(table); if( err < 0) goto out; PASSED(); return 0;out: H5_FAILED(); if( H5PTis_valid(table) < 0) H5PTclose(table); return -1;}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:64,
示例15: test_noconv/*------------------------------------------------------------------------- * Function: test_noconv * * Purpose: Tests creation of datasets when no conversion is present. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Monday, January 4, 1999 * * Modifications: * *------------------------------------------------------------------------- */static inttest_noconv(hid_t file){ hid_t cwg=-1, type=-1, space=-1, dset=-1; c_e1 val; static c_e1 data1[]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED, E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE, E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE}; c_e1 data2[NELMTS(data1)]; hsize_t ds_size[1]={NELMTS(data1)}; size_t i; TESTING("no-conversion datasets"); if ((cwg=H5Gcreate(file, "test_noconv", 0))<0) goto error; if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1)))<0) goto error; if (H5Tenum_insert(type, "RED", CPTR(val, E1_RED ))<0) goto error; if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN))<0) goto error; if (H5Tenum_insert(type, "BLUE", CPTR(val, E1_BLUE ))<0) goto error; if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE))<0) goto error; if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK))<0) goto error; if ((space=H5Screate_simple(1, ds_size, NULL))<0) goto error; if ((dset=H5Dcreate(cwg, "color_table", type, space, H5P_DEFAULT))<0) goto error; if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1)<0) goto error; if (H5Dread(dset, type, space, space, H5P_DEFAULT, data2)<0) goto error; for (i=0; i<ds_size[0]; i++) { if (data1[i]!=data2[i]) { H5_FAILED(); printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)/n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; } } if (H5Dclose(dset)<0) goto error; if (H5Sclose(space)<0) goto error; if (H5Tclose(type)<0) goto error; if (H5Gclose(cwg)<0) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { H5Dclose(dset); H5Sclose(space); H5Tclose(type); H5Gclose(cwg); } H5E_END_TRY; return 1;}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:71,
示例16: test_misc/*------------------------------------------------------------------------- * Function: test_misc * * Purpose: Test miscellaneous group stuff. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, November 24, 1998 * * Modifications: * Robb Matzke, 2002-03-28 * File is opened by parent instead of here. *------------------------------------------------------------------------- */static inttest_misc(hid_t file){ hid_t g1=-1, g2=-1, g3=-1; char comment[64]; /* Test current working groups */ TESTING("miscellaneous group tests"); /* Create initial groups for testing, then close */ if ((g1=H5Gcreate(file, "test_1a", 0))<0) goto error; if ((g2=H5Gcreate(g1, "sub_1", 0))<0) goto error; if ((g3=H5Gcreate(file, "test_1b", 0))<0) goto error; if (H5Gset_comment(g3, ".", "hello world")<0) goto error; if (H5Gclose(g1)<0) goto error; if (H5Gclose(g2)<0) goto error; if (H5Gclose(g3)<0) goto error; /* Open all groups with absolute names to check for exsistence */ if ((g1=H5Gopen(file, "/test_1a"))<0) goto error; if ((g2=H5Gopen(file, "/test_1a/sub_1"))<0) goto error; if ((g3=H5Gopen(file, "/test_1b"))<0) goto error; if (H5Gget_comment(g3, "././.", sizeof comment, comment)<0) goto error; if (strcmp(comment, "hello world")) { H5_FAILED(); puts(" Read the wrong comment string from the group."); printf(" got: /"%s/"/n ans: /"hello world/"/n", comment); goto error; } if (H5Gclose(g1)<0) goto error; if (H5Gclose(g2)<0) goto error; if (H5Gclose(g3)<0) goto error; /* Check that creating groups with no-op names isn't allowed */ H5E_BEGIN_TRY { g1=H5Gcreate(file, "/", 0); } H5E_END_TRY if(g1 >= 0) goto error; H5E_BEGIN_TRY { g1=H5Gcreate(file, "./././", 0); } H5E_END_TRY if(g1 >= 0) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { H5Gclose(g1); H5Gclose(g2); H5Gclose(g3); } H5E_END_TRY; return 1;}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:72,
示例17: test_arrays/*-------------------------------------------------------------------------* subroutine for test_text_dtype(): test_arrays().*-------------------------------------------------------------------------*/static int test_arrays(void){ hid_t dtype; int ndims; hsize_t dims[3]; H5T_class_t type_class; char* dt_str; size_t str_len; TESTING3(" text for array types"); if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE /"arr_compound_1/"; H5T_STD_I32BE /"arr_compound_2/"; } } }", H5LT_DDL))<0) goto out; if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_ARRAY) goto out; if((ndims = H5Tget_array_ndims(dtype))<0) goto out; if(ndims != 3) goto out; if(H5Tget_array_dims2(dtype, dims) < 0) goto out; if(dims[0] != 5 || dims[1] != 7 || dims[2] != 13) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; if(strcmp(dt_str, "H5T_ARRAY {/n [5][7][13] H5T_ARRAY {/n [17][19] H5T_COMPOUND {/n H5T_STD_I8BE /"arr_compound_1/" : 0;/n H5T_STD_I32BE /"arr_compound_2/" : 1;/n }/n }/n }")) { printf("dt=/n%s/n", dt_str); goto out; } free(dt_str); if(H5Tclose(dtype)<0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:chaako,项目名称:sceptic3D,代码行数:55,
示例18: test_read/*------------------------------------------------------------------------- * test_read * * Tests that the packets appended by test_append can be read back. * *------------------------------------------------------------------------- */static int test_read(hid_t fid){ herr_t err; hid_t table; particle_t readBuf[NRECORDS]; size_t c; TESTING("H5PTread_packets"); /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) goto out; /* Read several particles */ err = H5PTread_packets(table, (hsize_t)0, 3, &(readBuf[0])); if( err < 0) goto out; /* Read one particle */ err = H5PTread_packets(table, (hsize_t)3, 1, &(readBuf[3])); if( err < 0) goto out; /* Read several particles */ err = H5PTread_packets(table, (hsize_t)4, (NRECORDS - 4 ), &(readBuf[4])); if( err < 0) goto out; /* Ensure that particles were read correctly */ for(c=0; c<NRECORDS; c++) { if( cmp_par(c%8, c, testPart, readBuf) != 0) goto out; } /* Close the table */ err = H5PTclose(table); if( err < 0) goto out; PASSED(); return 0;out: H5_FAILED(); if( H5PTis_valid(table) < 0) H5PTclose(table); return -1;}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:58,
示例19: test_variables/*-------------------------------------------------------------------------* subroutine for test_text_dtype(): test_variables().*-------------------------------------------------------------------------*/static int test_variables(void){ hid_t dtype; H5T_class_t type_class; char* dt_str; size_t str_len; TESTING3(" text for variable types"); if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }/n", H5LT_DDL))<0) goto out; if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_VLEN) goto out; if(H5Tis_variable_str(dtype)) goto out; if(H5Tclose(dtype)<0) goto out; if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0) goto out; if(H5Tis_variable_str(dtype)) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; if(strcmp(dt_str, "H5T_VLEN {/n H5T_VLEN {/n H5T_STD_I32BE/n }/n }")) { printf("dt=/n%s/n", dt_str); goto out; } free(dt_str); if(H5Tclose(dtype)<0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:chaako,项目名称:sceptic3D,代码行数:54,
示例20: test_integers/*-------------------------------------------------------------------------* subroutine for test_text_dtype(): test_integers().*-------------------------------------------------------------------------*/static int test_integers(void){ hid_t dtype; char* dt_str; size_t str_len; TESTING3("/n text for integer types"); if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT/n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_NATIVE_INT)) goto out; if(H5Tclose(dtype)<0) goto out; if((dtype = H5LTtext_to_dtype("H5T_STD_I8BE/n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_STD_I8BE)) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; if(strcmp(dt_str, "H5T_STD_I8BE")) goto out; free(dt_str); if(H5Tclose(dtype)<0) goto out; if((dtype = H5LTtext_to_dtype("H5T_STD_U16LE/n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_STD_U16LE)) goto out; if(H5Tclose(dtype)<0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:chaako,项目名称:sceptic3D,代码行数:50,
示例21: test_fps/*-------------------------------------------------------------------------* subroutine for test_text_dtype(): test_fps().*-------------------------------------------------------------------------*/static int test_fps(void){ hid_t dtype; char* dt_str; size_t str_len; TESTING3(" text for floating-point types"); if((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE/n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) goto out; if(H5Tclose(dtype)<0) goto out; if((dtype = H5LTtext_to_dtype("H5T_IEEE_F32BE/n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_IEEE_F32BE)) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; if(strcmp(dt_str, "H5T_IEEE_F32BE")) goto out; free(dt_str); if(H5Tclose(dtype)<0) goto out; if((dtype = H5LTtext_to_dtype("H5T_IEEE_F64LE/n", H5LT_DDL))<0) goto out; if(!H5Tequal(dtype, H5T_IEEE_F64LE)) goto out; if(H5Tclose(dtype)<0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:chaako,项目名称:sceptic3D,代码行数:50,
示例22: test_opaques/*-------------------------------------------------------------------------* subroutine for test_text_dtype(): test_opaques().*-------------------------------------------------------------------------*/static int test_opaques(void){ hid_t dtype; size_t opq_size; H5T_class_t type_class; char* dt_str; size_t str_len; TESTING3(" text for opaque types"); if((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG /"This is a tag for opaque type/"; }", H5LT_DDL))<0) goto out; if((type_class = H5Tget_class(dtype))<0) goto out; if(type_class != H5T_OPAQUE) goto out; if((opq_size = H5Tget_size(dtype)) == 0) goto out; if(opq_size != 19) goto out; if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; dt_str = (char*)calloc(str_len, sizeof(char)); if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) goto out; if(strcmp(dt_str, "H5T_OPAQUE {/n OPQ_SIZE 19;/n OPQ_TAG /"This is a tag for opaque type/";/n }")) { printf("dt=/n%s/n", dt_str); goto out; } free(dt_str); if(H5Tclose(dtype)<0) goto out; PASSED(); return 0;out: H5_FAILED(); return -1;}
开发者ID:chaako,项目名称:sceptic3D,代码行数:48,
示例23: test_foreign_scaleattachedstatic int test_foreign_scaleattached(const char *filename){ herr_t ret_value = FAIL; hid_t fid = -1; hid_t did = -1; hid_t dsid = -1; TESTING2("test_foreign_scaleattached"); if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto out; if((did = H5Dopen2(fid, "/dset_al", H5P_DEFAULT)) >= 0) { if((dsid = H5Dopen2(fid, "/ds_4_al", H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, 3) == 1) { ret_value = SUCCEED; } if(H5Dclose(dsid) < 0) goto out; } if(H5Dclose(did) < 0) goto out; } else goto out; if(ret_value == FAIL) goto out; PASSED(); H5Fclose(fid); return 0;out: H5E_BEGIN_TRY { H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; H5_FAILED(); return FAIL;}
开发者ID:herr-biber,项目名称:hdf5,代码行数:44,
示例24: check_dset/*------------------------------------------------------------------------- * Function: check_dset * * Purpose: Part 2 of a two-part H5Fflush() test, checks if the data in a dataset * is what it is supposed to be. * * Return: Success: 0 * * Failure: 1 * * Programmer: Leon Arber * Oct. 4, 2006. * *------------------------------------------------------------------------- */static intcheck_dset(hid_t file, const char* name){ hid_t space, dset; hsize_t ds_size[2] = {100, 100}; double error; size_t i, j; /* Open the dataset */ if((dset = H5Dopen2(file, name, H5P_DEFAULT)) < 0) goto error; if((space = H5Dget_space(dset)) < 0) goto error; if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error; assert(100 == ds_size[0] && 100 == ds_size[1]); /* Read some data */ if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error; for(i = 0; i < (size_t)ds_size[0]; i++) for(j = 0; j < (size_t)ds_size[1]; j++) { /* * The extra cast in the following statement is a bug workaround * for the Win32 version 5.0 compiler. * 1998-11-06 ptl */ error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); if(error > 0.0001F) { H5_FAILED(); printf(" dset[%lu][%lu] = %g/n", (unsigned long)i, (unsigned long)j, the_data[i][j]); printf(" should be %g/n", (double)(hssize_t)i/(hssize_t)(j+1)); goto error; } /* end if */ } /* end for */ if(H5Dclose(dset) < 0) goto error; return 0;error: return 1;}
开发者ID:CommonLibrary,项目名称:hdf5,代码行数:56,
示例25: test_1d/*------------------------------------------------------------------------- * Function: test_1d * * Purpose: Test a single external file which is large enough for the * current data size but not large enough for the eventual size. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Monday, November 23, 1998 * * Modifications: * *------------------------------------------------------------------------- */static inttest_1d(hid_t file){ hid_t dcpl=-1; /*dataset creation properties */ hid_t space=-1; /*data space */ hid_t dset=-1; /*dataset */ hsize_t cur_size[1]; /*current data space size */ hsize_t max_size[1]; /*maximum data space size */ TESTING("extendible dataspace, external storage is too small"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; cur_size[0] = 100; max_size[0] = 200; if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) goto error; if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; H5E_BEGIN_TRY { dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; if(dset >= 0) { H5_FAILED(); puts(" Small external file succeeded instead of failing."); goto error; } if(H5Sclose(space) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { H5Dclose(dset); H5Pclose(dcpl); H5Sclose(space); } H5E_END_TRY; return 1;}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:56,
示例26: test_misc/*------------------------------------------------------------------------- * Function: test_misc * * Purpose: Test miscellaneous group stuff. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, November 24, 1998 * *------------------------------------------------------------------------- */static inttest_misc(hid_t fapl, hbool_t new_format){ hid_t fid = (-1); /* File ID */ hid_t g1 = (-1), g2 = (-1), g3 = (-1); char filename[NAME_BUF_SIZE]; char comment[64]; if(new_format) TESTING("miscellaneous group tests (w/new group format)") else TESTING("miscellaneous group tests") /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create initial groups for testing, then close */ if((g1 = H5Gcreate2(fid, "test_1a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((g2 = H5Gcreate2(g1, "sub_1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((g3 = H5Gcreate2(fid, "test_1b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Oset_comment(g3, "hello world") < 0) TEST_ERROR if(H5Gclose(g1) < 0) TEST_ERROR if(H5Gclose(g2) < 0) TEST_ERROR if(H5Gclose(g3) < 0) TEST_ERROR /* Open all groups with absolute names to check for exsistence */ if((g1 = H5Gopen2(fid, "/test_1a", H5P_DEFAULT)) < 0) TEST_ERROR if((g2 = H5Gopen2(fid, "/test_1a/sub_1", H5P_DEFAULT)) < 0) TEST_ERROR if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR if(HDstrcmp(comment, "hello world")) { H5_FAILED(); puts(" Read the wrong comment string from the group."); printf(" got: /"%s/"/n ans: /"hello world/"/n", comment); TEST_ERROR }
开发者ID:FilipeMaia,项目名称:hdf5,代码行数:51,
示例27: test_cont/* * Verify that messages are moved forward into a "continuation message": * Create an object header with several continuation chunks * Remove a message in the last chunk * The remaining message(s) in the last chunk should be moved forward into the continuation message * The process will repeat when the continuation message is big enough to hold all the * messages in the last chunk. * Result: the number of chunks should be reduced */static herr_ttest_cont(char *filename, hid_t fapl){ hid_t file=-1; H5F_t *f = NULL; H5O_hdr_info_t hdr_info; H5O_loc_t oh_locA, oh_locB; time_t time_new; const char *short_name = "T"; const char *long_name = "This is the message"; size_t nchunks; TESTING("object header continuation block"); HDmemset(&oh_locA, 0, sizeof(oh_locA)); HDmemset(&oh_locB, 0, sizeof(oh_locB)); /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) FAIL_STACK_ERROR if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) FAIL_STACK_ERROR time_new = 11111111; if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(1 != H5O_link(&oh_locA, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR if(1 != H5O_link(&oh_locB, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_expunge_chunks_test(&oh_locA, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) FAIL_STACK_ERROR nchunks = hdr_info.nchunks; /* remove the 1st H5O_NAME_ID message */ if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) FAIL_STACK_ERROR if(hdr_info.nchunks >= nchunks) TEST_ERROR if(H5O_close(&oh_locA) < 0) FAIL_STACK_ERROR if(H5O_close(&oh_locB) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) FAIL_STACK_ERROR PASSED(); return 0;error: H5E_BEGIN_TRY { H5O_close(&oh_locA);//.........这里部分代码省略.........
开发者ID:MichaelToal,项目名称:hdf5,代码行数:101,
示例28: main/*------------------------------------------------------------------------- * Function: main * * Purpose: Exercise private object header behavior and routines * * Return: Success: 0 * Failure: 1 * * Programmer: Robb Matzke * Tuesday, November 24, 1998 * *------------------------------------------------------------------------- */intmain(void){ hid_t fapl = -1, file = -1; hid_t dset = -1; H5F_t *f = NULL; char filename[1024]; H5O_hdr_info_t hdr_info; /* Object info */ H5O_loc_t oh_loc, oh_loc2; /* Object header locations */ time_t time_new, ro; int chunkno; /* Chunk index for message */ int i; /* Local index variable */ hbool_t b; /* Index for "new format" loop */ herr_t ret; /* Generic return value */ /* Reset library */ h5_reset(); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Loop over old & new formats */ for(b = FALSE; b <= TRUE; b++) { /* Display info about testing */ if(b) HDputs("Using new file format:"); else HDputs("Using default file format:"); /* Set the format to use for the file */ if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR /* test on object continuation block */ if(test_cont(filename, fapl) < 0) FAIL_STACK_ERROR /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } /* * Test object header creation * (using default group creation property list only because it's convenient) */ TESTING("object header creation"); HDmemset(&oh_loc, 0, sizeof(oh_loc)); if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) FAIL_STACK_ERROR PASSED(); /* create a new message */ TESTING("message creation"); time_new = 11111111; if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) FAIL_STACK_ERROR if(ro != time_new) TEST_ERROR PASSED(); /* * Test modification of an existing message. */ TESTING("message modification"); time_new = 33333333; if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)//.........这里部分代码省略.........
开发者ID:MichaelToal,项目名称:hdf5,代码行数:101,
示例29: test_core//.........这里部分代码省略......... for(j = 0; j < DSET1_DIM2; j++) *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; dims1[1] = DSET1_DIM2; if((space1 = H5Screate_simple(2, dims1, NULL)) < 0) TEST_ERROR; /* Create the dset1 */ if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1./n"); printf(" At index %d,%d/n", i, j); TEST_ERROR; } /* end if */ if(H5Dclose(dset1) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; /* Open the file with backing store on for read and write. * Changes will be saved in file. */ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Create the dset1 */ if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
开发者ID:chaako,项目名称:sceptic3D,代码行数:67,
示例30: test_direct//.........这里部分代码省略......... for(j = 0; j < DSET1_DIM2; j++) *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; dims1[1] = DSET1_DIM2; if((space1 = H5Screate_simple(2, dims1, NULL)) < 0) TEST_ERROR; /* Create the dset1 */ if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); printf(" Read different values than written in data set 1./n"); printf(" At index %d,%d/n", i, j); TEST_ERROR; } /* end if */ /* Create the data space2. For data set 2, memory address and data size are not aligned. */ dims2[0] = DSET2_DIM; if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) TEST_ERROR; /* Create the dset2 */ if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; if(H5Dclose(dset2) < 0) TEST_ERROR; if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ for(i = 0; i < DSET2_DIM; i++) if(wdata2[i] != rdata2[i]) { H5_FAILED();
开发者ID:chaako,项目名称:sceptic3D,代码行数:67,
注:本文中的H5_FAILED函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ HAGGLE_DBG函数代码示例 C++ H5Tinsert函数代码示例 |