23 #include <H5Ppublic.h>
24 #include <H5Tpublic.h>
25 #include <H5Epublic.h>
29 #ifdef H5_HAVE_PARALLEL
31 const char filename[] =
"mhdf_ll.h5m";
32 const char proc_tag_name[] =
"proc_id";
33 const char elem_handle[] =
"Hex";
38 #define CHECK( A ) check( &( A ), __LINE__ )
43 fprintf( stderr,
"%d: ERROR at line %d: \"%s\"\n", RANK, line,
mhdf_message( status ) );
48 typedef int handle_id_t;
49 #define id_type H5T_NATIVE_INT
56 const int num_nodes = 4 + 4 * NUM_PROC;
57 const int num_hexes = NUM_PROC;
58 const int num_sets = 2 + NUM_PROC;
59 const int set_data_size = num_hexes + num_nodes + num_hexes + num_nodes;
60 const int num_tag_vals = num_hexes + num_nodes + num_sets - 2;
61 const char* history[] = { __FILE__, NULL };
62 const int history_size =
sizeof( history ) /
sizeof( history[0] );
63 int default_tag_val = NUM_PROC;
64 hid_t data, tagdata[2];
72 history[1] = ctime( &
t );
117 void write_file_data()
119 const int total_num_nodes = 4 + 4 * NUM_PROC;
120 const int total_num_hexes = NUM_PROC;
121 long first_node, first_elem, first_set, count, ntag;
122 unsigned long ucount;
124 hid_t handle, handles[2];
127 int num_node, offset,
dim;
128 double coords[3 * 8] = { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0,
129 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 };
130 handle_id_t list[10];
132 for( i = 0; i < 10; i++ )
136 handle = H5Pcreate( H5P_FILE_ACCESS );
147 coords[12] = coords[15] = coords[18] = coords[21] = 1.0;
152 offset = 4 + 4 * RANK;
153 coords[0] = coords[3] = coords[6] = coords[9] = 1.0 + RANK;
157 assert( count == total_num_nodes );
165 for( i = 0; i < 8; ++i )
166 list[i] = 4 * RANK + i + first_node;
169 assert( count == total_num_hexes );
179 assert( count == 2 + NUM_PROC );
182 set_desc[0] = total_num_nodes + total_num_hexes + 9 + 5 * RANK - 1;
189 set_desc[0] = total_num_nodes - 1;
192 set_desc[0] += total_num_hexes;
204 assert( 2 * total_num_nodes + 2 * total_num_hexes == count );
210 offset = total_num_nodes + total_num_hexes;
211 for( i = 0; i < 8; ++i )
212 list[i] = first_node + i;
213 list[8] = first_elem;
218 offset = total_num_nodes + total_num_hexes + 4 + 5 * RANK;
219 for( i = 0; i < 4; ++i )
220 list[i] = 4 + 4 * RANK + first_node + i;
221 list[4] = RANK + first_elem;
228 offset = ( 0 == RANK ) ? 0 : 4 + 4 * RANK;
232 offset = total_num_nodes + RANK;
240 offset = ( 0 == RANK ) ? 0 : 4 + 4 * RANK;
242 list[count++] = first_set + 2 + RANK;
245 assert( ntag == total_num_nodes + total_num_hexes + NUM_PROC );
267 #if defined( H5E_auto_t_vers ) && H5E_auto_t_vers > 1
268 herr_t ( *default_handler )( hid_t,
void* );
271 herr_t ( *default_handler )(
void* );
276 if( default_handler )
277 #if defined( H5E_auto_t_vers ) && H5E_auto_t_vers > 1
278 result = (default_handler)( stack, data );
280 result = (default_handler)( data );
288 int main(
int argc,
char* argv[] )
290 #ifdef H5_HAVE_PARALLEL
295 #if defined( H5Eget_auto_vers ) && H5Eget_auto_vers > 1
296 err = H5Eget_auto( H5E_DEFAULT, &default_handler, &data );
298 err = H5Eget_auto( &default_handler, &data );
302 #if defined( H5Eset_auto_vers ) && H5Eset_auto_vers > 1
309 rval = MPI_Init( &argc, &argv );
310 if( rval )
return rval;
312 if( rval )
return rval;
314 if( rval )
return rval;
316 if( RANK == 0 ) create_file();
320 if( rval )
return rval;