diff --git a/src/h5core/h5_init.c b/src/h5core/h5_init.c index 17992ab..19d8f76 100644 --- a/src/h5core/h5_init.c +++ b/src/h5core/h5_init.c @@ -237,10 +237,12 @@ create_tet_type ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } +#if defined(WITH_PARALLEL_H5GRID) + static inline h5_err_t create_chunk_type ( - void - ) { + void + ) { H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); TRY( h5_dta_types.h5_chunk_t = hdf5_create_type ( @@ -339,6 +341,7 @@ create_octree_type ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } + static inline h5_err_t create_userdata_type ( void @@ -357,7 +360,7 @@ create_userdata_type ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } -#if defined(PARALLEL_IO) + static inline h5_err_t create_mpi_type_glb_tet ( void @@ -674,11 +677,12 @@ h5_initialize ( TRY (create_triangle_type ()); TRY (create_tet_type ()); TRY (create_tag_types ()); + +#if defined(WITH_PARALLEL_H5GRID) TRY (create_chunk_type ()); TRY (create_octree_type ()); TRY (create_userdata_type ()); -#if defined(PARALLEL_IO) TRY (create_mpi_type_glb_tri ()); TRY (create_mpi_type_glb_tet ()); TRY (create_mpi_type_glb_vtx ()); diff --git a/src/h5core/h5b_readwrite.c b/src/h5core/h5b_readwrite.c index 2fc5c1d..e59f6b9 100644 --- a/src/h5core/h5b_readwrite.c +++ b/src/h5core/h5b_readwrite.c @@ -7,6 +7,7 @@ License: see file COPYING in top level of source distribution. */ +#include "h5core/h5.h" #include "h5_types_private.h" #include "h5_hdf5_private.h" diff --git a/src/h5core/h5t_access_private.h b/src/h5core/h5t_access_private.h index 0d251f3..68b80b2 100644 --- a/src/h5core/h5t_access_private.h +++ b/src/h5core/h5t_access_private.h @@ -14,7 +14,7 @@ #include "h5t_types_private.h" struct h5t_access_methods { -#if defined(PARALLEL_IO) +#if defined(WITH_PARALLEL_H5GRID) MPI_Datatype (*get_mpi_type_of_glb_elem)( h5t_mesh_t* const m); #endif @@ -75,7 +75,7 @@ struct h5t_access_methods { extern struct h5t_access_methods h5tpriv_access_trim_methods; extern struct h5t_access_methods h5tpriv_access_tetm_methods; -#if defined(PARALLEL_IO) +#if defined(WITH_PARALLEL_H5GRID) static inline MPI_Datatype h5tpriv_get_mpi_type_of_glb_elem ( h5t_mesh_t* const m diff --git a/src/h5core/h5t_access_tetm.c b/src/h5core/h5t_access_tetm.c index 9638868..40419f6 100644 --- a/src/h5core/h5t_access_tetm.c +++ b/src/h5core/h5t_access_tetm.c @@ -8,6 +8,7 @@ */ #include "h5core/h5.h" +#include "h5_private.h" #include "h5_types_private.h" #include "h5_init_private.h" #include "h5t_types_private.h" @@ -16,7 +17,7 @@ /*** op's on local elements ***/ -#if defined(PARALLEL_IO) +#if defined(WITH_PARALLEL_H5GRID) static MPI_Datatype get_mpi_type_of_glb_elem ( h5t_mesh_t* const m @@ -685,7 +686,7 @@ get_loc_entity_children ( } struct h5t_access_methods h5tpriv_access_tetm_methods = { -#if defined(PARALLEL_IO) +#if defined(WITH_PARALLEL_H5GRID) get_mpi_type_of_glb_elem, #endif get_loc_elem, diff --git a/src/h5core/h5t_access_trim.c b/src/h5core/h5t_access_trim.c index 377e85b..ba27cba 100644 --- a/src/h5core/h5t_access_trim.c +++ b/src/h5core/h5t_access_trim.c @@ -8,12 +8,13 @@ */ #include "h5core/h5.h" +#include "h5_private.h" #include "h5_init_private.h" #include "h5t_types_private.h" #include "h5t_model_private.h" #include "h5t_access_private.h" -#if defined(PARALLEL_IO) +#if defined(WITH_PARALLEL_H5GRID) static MPI_Datatype get_mpi_type_of_glb_elem ( h5t_mesh_t* const m @@ -385,7 +386,7 @@ get_loc_entity_children ( } struct h5t_access_methods h5tpriv_access_trim_methods = { -#if defined(PARALLEL_IO) +#if defined(WITH_PARALLEL_H5GRID) get_mpi_type_of_glb_elem, #endif get_loc_elem, diff --git a/src/h5core/h5t_adjacencies.c b/src/h5core/h5t_adjacencies.c index 7b62a96..fe730c1 100644 --- a/src/h5core/h5t_adjacencies.c +++ b/src/h5core/h5t_adjacencies.c @@ -8,7 +8,7 @@ */ #include "h5core/h5.h" - +#include "h5_private.h" #include "h5t_types_private.h" #include "h5t_adjacencies_private.h" #include "h5t_map_private.h" diff --git a/src/h5core/h5t_map.c b/src/h5core/h5t_map.c index 86d51af..497bd6e 100644 --- a/src/h5core/h5t_map.c +++ b/src/h5core/h5t_map.c @@ -456,7 +456,7 @@ h5t_get_loc_vertex_indices_of_tet ( H5_CORE_API_RETURN (H5_SUCCESS); } -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID int compare_glb_idx_oct (const void * p_a,const void* p_b) { return *(h5_glb_idx_t*) p_a - *(h5_glb_idx_t*) p_b; diff --git a/src/h5core/h5t_model.c b/src/h5core/h5t_model.c index 5f47c5b..28df658 100644 --- a/src/h5core/h5t_model.c +++ b/src/h5core/h5t_model.c @@ -8,6 +8,7 @@ */ #include "h5core/h5.h" +#include "h5_private.h" #include "h5_mpi_private.h" #include "h5_errorhandling_private.h" @@ -72,10 +73,12 @@ h5tpriv_init_mesh ( m->timing.next_time = 0; m->timing.f = NULL; m->is_chunked = 0; +#if defined(WITH_PARALLEL_H5GRID) /* initialize pointers */ m->octree = NULL; m->chunks = NULL; +#endif m->loc_elems = NULL; m->num_interior_elems = NULL; m->num_glb_elems = NULL; @@ -89,6 +92,7 @@ h5tpriv_init_mesh ( m->first_b_vtx = NULL; // m->weights = NULL; +#if defined(WITH_PARALLEL_H5GRID) /* chunks */ strcpy (m->dsinfo_chunks.name, "Chunks"); m->dsinfo_chunks.rank = 1; @@ -133,7 +137,8 @@ h5tpriv_init_mesh ( m->dsinfo_userdata.rank, m->dsinfo_userdata.chunk_dims) ); m->dsinfo_userdata.access_prop = H5P_DEFAULT; - +#endif + /* vertices */ strcpy (m->dsinfo_vertices.name, "Vertices"); m->dsinfo_vertices.rank = 1; @@ -302,7 +307,7 @@ release_memory ( TRY (h5tpriv_release_adjacency_structs (m)); TRY (release_elems (m)); TRY (release_vertices (m)); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID if (m->is_chunked) { TRY (h5tpriv_free_chunks (m)); TRY (H5t_free_octree (m->octree)); @@ -374,7 +379,7 @@ h5t_close_mesh ( h5t_mesh_t* const m ) { H5_CORE_API_ENTER (h5_err_t, "m=%p", m); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID TRY (h5priv_mpi_barrier (m->f->props->comm)); m->timing.measure[m->timing.next_time++] = MPI_Wtime(); #endif @@ -389,9 +394,9 @@ h5t_close_mesh ( TRY (h5tpriv_write_mesh (m)); } TRY (hdf5_close_group (m->mesh_gid)); - +#ifdef WITH_PARALLEL_H5GRID TRY (write_timing (m)); - +#endif TRY (release_memory (m)); H5_CORE_API_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5t_model_tetm.c b/src/h5core/h5t_model_tetm.c index c98194f..213b7a0 100644 --- a/src/h5core/h5t_model_tetm.c +++ b/src/h5core/h5t_model_tetm.c @@ -85,7 +85,7 @@ h5t_open_tetrahedral_mesh ( &h5t_tet_ref_elem, &tet_funcs, 0)); -#ifdef PARALLEL_IO // reason: even if we have a chunked mesh, if h5hut is not parallel +#ifdef WITH_PARALLEL_H5GRID // reason: even if we have a chunked mesh, if h5hut is not parallel // it does not support reading chunked meshes TRY (m->is_chunked ? h5tpriv_read_chunked_mesh (m) :h5tpriv_read_mesh (m)); #else @@ -199,7 +199,7 @@ h5t_add_chunked_tetrahedral_mesh ( ) { h5_file_p f = (h5_file_p)fh; H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID CHECK_WRITABLE_MODE (f); h5_err_t exists; TRY (exists = h5priv_link_exists ( diff --git a/src/h5core/h5t_model_trim.c b/src/h5core/h5t_model_trim.c index 3a6e876..b774dc1 100644 --- a/src/h5core/h5t_model_trim.c +++ b/src/h5core/h5t_model_trim.c @@ -67,7 +67,7 @@ h5t_open_triangle_mesh ( h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID MPI_Barrier (f->props->comm); double start = MPI_Wtime(); #endif @@ -90,7 +90,7 @@ h5t_open_triangle_mesh ( &h5t_tri_ref_elem, &tri_funcs, 0)); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID MPI_Barrier (m->f->props->comm); m->timing.measure[m->timing.next_time++] = start; m->timing.measure[m->timing.next_time++] = MPI_Wtime(); @@ -114,7 +114,7 @@ h5t_open_triangle_mesh_part ( h5_file_p f = (h5_file_p)fh; H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh); hid_t mesh_hid; -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID MPI_Barrier (f->props->comm); double start = MPI_Wtime(); #endif @@ -136,7 +136,7 @@ h5t_open_triangle_mesh_part ( &h5t_tri_ref_elem, &tri_funcs, 0)); -#ifdef PARALLEL_IO // reason: even if we have a chunked mesh, if h5hut is not parallel +#ifdef WITH_PARALLEL_H5GRID // reason: even if we have a chunked mesh, if h5hut is not parallel MPI_Barrier (m->f->props->comm); m->timing.measure[m->timing.next_time++] = start; m->timing.measure[m->timing.next_time++] = MPI_Wtime(); @@ -216,7 +216,7 @@ h5t_add_chunked_triangle_mesh( ) { h5_file_p f = (h5_file_p)fh; H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID int size = -1; TRY (h5priv_mpi_comm_size (f->props->comm, &size)); if (size != 1) { diff --git a/src/h5core/h5t_octree.c b/src/h5core/h5t_octree.c index 0ae228c..21e11d9 100644 --- a/src/h5core/h5t_octree.c +++ b/src/h5core/h5t_octree.c @@ -1,7 +1,7 @@ #include "h5t_octree_private.h" #include "h5t_core_private.h" -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID #include #include diff --git a/src/h5core/h5t_octree_private.h b/src/h5core/h5t_octree_private.h index 2fe781c..e8ce92c 100644 --- a/src/h5core/h5t_octree_private.h +++ b/src/h5core/h5t_octree_private.h @@ -10,14 +10,10 @@ #ifndef __H5T_OCTREE_PRIVATE_H #define __H5T_OCTREE_PRIVATE_H + #include "h5core/h5_types.h" #include "h5core/h5t_octree.h" -// iterators -#if defined(PARALLEL_IO) -#include -#endif - #define OCT_MAX_NEIGHBORS 1000 struct h5_oct_point { @@ -174,7 +170,5 @@ h5_err_t plot_octant_anc (h5t_octree_t* octree, h5_oct_idx_t oct_idx); h5_err_t plot_leaf_octants (h5t_octree_t* octree); void print_array (h5_int32_t* neigh, h5_oct_idx_t nbr_neigh, int rank); + #endif - - - diff --git a/src/h5core/h5t_readwrite.c b/src/h5core/h5t_readwrite.c index c9bd6cc..d555bb5 100644 --- a/src/h5core/h5t_readwrite.c +++ b/src/h5core/h5t_readwrite.c @@ -7,17 +7,15 @@ License: see file COPYING in top level of source distribution. */ -#include // for the use of sleep -#if defined (PARALLEL_IO) -//#define WITH_PARALLEL_H5FED -#endif +#include "h5core/h5.h" +#include "h5_types_private.h" -//#if defined (WITH_PARALLEL_H5FED) // WARNING just used for eclipse to index all code... -#ifdef PARALLEL_IO +#include +#include // for the use of sleep + +#ifdef WITH_PARALLEL_H5GRID #include #endif -#include -//#endif #include "h5_attribs_private.h" #include "h5_hdf5_private.h" @@ -153,7 +151,7 @@ write_vertices ( 1)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID h5_err_t add_chunk_to_list ( @@ -211,7 +209,7 @@ h5tpriv_get_list_of_chunks_to_write ( } H5_PRIV_FUNC_RETURN (H5_SUCCESS); } -#endif + static h5_err_t exchange_g2l_vtx_map ( h5t_mesh_t* const m, @@ -220,7 +218,6 @@ exchange_g2l_vtx_map ( h5_glb_idx_t** glb_vtx ) { H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p map=%p, range=%p, glb_vtx=%p", m, map, range, glb_vtx); -#ifdef PARALLEL_IO // alloc/get range TRY (*range = h5_calloc (m->f->nprocs + 1, sizeof (**range))); TRY (h5tpriv_get_ranges (m,*range, map->num_items, 0)); @@ -250,9 +247,9 @@ exchange_g2l_vtx_map ( recvdisp, MPI_LONG, m->f->props->comm)); -#endif H5_PRIV_FUNC_RETURN (H5_SUCCESS); } +#endif int sort_glb_idx(const void *p_a, const void *p_b) { @@ -288,6 +285,8 @@ remove_item_from_idxmap ( map->num_items--; H5_PRIV_FUNC_RETURN (H5_SUCCESS); } + +#if defined(WITH_PARALLEL_H5GRID) /* * Check if any proc with lower rank already writes a vtx that this proc has planed to write * if so remove it from the map. Only the proc with the lowest rank writes the vertex @@ -323,6 +322,7 @@ check_multiple_vtx_writes ( } H5_PRIV_FUNC_RETURN (H5_SUCCESS); } +#endif h5_int32_t find_proc_to_write ( @@ -330,7 +330,7 @@ find_proc_to_write ( h5_loc_idx_t elem_idx ) { H5_PRIV_FUNC_ENTER (int, "m=%p ", m); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID h5_glb_idx_t glb_idx = h5tpriv_get_loc_elem_glb_idx (m, elem_idx); for (int i = 0; i < m->chunks->num_alloc; i++) { if ( glb_idx >= m->chunks->chunks[i].elem && @@ -341,6 +341,8 @@ find_proc_to_write ( #endif H5_PRIV_FUNC_RETURN (H5_SUCCESS); } + +#ifdef WITH_PARALLEL_H5GRID /* * function returns a map with all the vtx that should be written by this proc * @@ -354,7 +356,6 @@ get_map_vertices_write ( h5_idxmap_t* map ) { H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p, map=%p", m, map); -#ifdef PARALLEL_IO h5_chk_idx_t* list_of_chunks; int num_chunks = 0; TRY (h5tpriv_get_list_of_chunks_to_write (m, &list_of_chunks, &num_chunks)); @@ -409,7 +410,7 @@ get_map_vertices_write ( h5priv_sort_idxmap (map); TRY (h5_free (range)); TRY (h5_free (glb_vtx)); -#endif + H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -420,7 +421,6 @@ write_vertices_chk ( ) { H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m); assert (m->num_leaf_levels > 0); -#ifdef PARALLEL_IO hid_t dset_id; TRY (dset_id = hdf5_open_dataset (m->mesh_gid, m->dsinfo_vertices.name)); hid_t mspace_id; @@ -518,10 +518,10 @@ write_vertices_chk ( TRY (hdf5_close_dataspace (mspace_id)); TRY (hdf5_close_dataset (dset_id)); m->f->empty = 0; -#endif + H5_PRIV_FUNC_RETURN (H5_SUCCESS); } -#if defined(WITH_PARALLEL_H5FED) + static h5_err_t write_elems ( h5t_mesh_t* const m @@ -599,7 +599,7 @@ write_elems ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } #endif -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID //TODO maybe use ifdef to have name without _chk static h5_err_t write_elems_chk ( @@ -1042,7 +1042,7 @@ h5tpriv_write_mesh ( H5_PRIV_API_ENTER (h5_err_t, "m=%p", m); if (m->mesh_changed) { if (m->is_chunked) { -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID if (m->num_weights > 0) { TRY (write_weights (m)); } @@ -2847,7 +2847,7 @@ h5tpriv_read_mesh_part ( h5_glb_idx_t num_elems ) { H5_PRIV_API_ENTER (h5_err_t, "m=%p", m); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID TRY (h5priv_mpi_barrier (m->f->props->comm)); // octree m->timing.measure[m->timing.next_time++] = MPI_Wtime(); TRY (h5priv_mpi_barrier (m->f->props->comm)); // chunks @@ -2857,11 +2857,11 @@ h5tpriv_read_mesh_part ( TRY (h5priv_mpi_barrier (m->f->props->comm)); // distribute chunks m->timing.measure[m->timing.next_time++] = MPI_Wtime(); #endif - h5_glb_elem_t* glb_elems; + h5_glb_elem_t* glb_elems = NULL; TRY (read_elems_part (m, &glb_elems, elem_indices, num_elems)); h5_loc_idx_t num_interior_elems = m->num_interior_elems[0]; h5_loc_idx_t num_ghost_elems = m->num_ghost_elems[0] = 0; -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID TRY (h5priv_mpi_barrier (m->f->props->comm)); // read elems m->timing.measure[m->timing.next_time++] = MPI_Wtime(); #endif @@ -2904,7 +2904,7 @@ h5tpriv_read_mesh_part ( TRY (read_vertices (m, map)); TRY (h5tpriv_alloc_loc_elems (m, 0, num_interior_elems+num_ghost_elems)); m->num_loaded_levels = 1; -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID TRY (h5priv_mpi_barrier (m->f->props->comm)); // read vtx m->timing.measure[m->timing.next_time++] = MPI_Wtime(); #endif @@ -2913,7 +2913,7 @@ h5tpriv_read_mesh_part ( TRY (h5tpriv_update_internal_structs (m, 0)); TRY (h5_free (glb_elems)); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID TRY (h5priv_mpi_barrier (m->f->props->comm)); // init update m->timing.measure[m->timing.next_time++] = MPI_Wtime(); #endif diff --git a/src/h5core/h5t_readwrite_tetm.c b/src/h5core/h5t_readwrite_tetm.c index 9acbeb6..5af6e76 100644 --- a/src/h5core/h5t_readwrite_tetm.c +++ b/src/h5core/h5t_readwrite_tetm.c @@ -116,7 +116,7 @@ init_elem_flags ( // elem is not ghost so it must be interior (for the time // being we have no overlap elem->flags |= H5_INTERIOR_ENTITY; - if (elem->neighbor_indices[i] < -1 || + if (elem->neighbor_indices[i] <= -1 || (elems[elem->neighbor_indices[i]].flags & H5_GHOST_ENTITY)) { // if neighbor is < -1 we do not have ghost cells and cell // is border cell diff --git a/src/h5core/h5t_readwrite_trim.c b/src/h5core/h5t_readwrite_trim.c index 83453d8..e33a071 100644 --- a/src/h5core/h5t_readwrite_trim.c +++ b/src/h5core/h5t_readwrite_trim.c @@ -196,7 +196,7 @@ init_glb_elems_struct_chk ( int num_chk ) { H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m); - +#if defined(WITH_PARALLEL_H5GRID) h5_chk_idx_t chk_idx = -1; h5_chk_size_t num_elems = -1; h5_size_t counter = 0; @@ -224,8 +224,10 @@ init_glb_elems_struct_chk ( if (loc_elem->neighbor_indices[i] > -1) { glb_elem->neighbor_indices[i] = ((H5_LOC_ELEM_T*)m->loc_elems)[loc_elem->neighbor_indices[i]].glb_idx; } else { - if (loc_elem->neighbor_indices[i] < -1) {// if elem not locally available we store the - (glb_idx + 2) - glb_elem->neighbor_indices[i] = -( loc_elem->neighbor_indices[i] + 2); //TODO is there a func or makro that does that? + if (loc_elem->neighbor_indices[i] < -1) { + // if elem not locally available we store the - (glb_idx + 2) + //TODO is there a func or makro that does that? + glb_elem->neighbor_indices[i] = -( loc_elem->neighbor_indices[i] + 2); } else { glb_elem->neighbor_indices[i] = loc_elem->neighbor_indices[i]; // geometrical border } @@ -236,7 +238,7 @@ init_glb_elems_struct_chk ( } } - +#endif H5_PRIV_FUNC_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5t_retrieve.c b/src/h5core/h5t_retrieve.c index 5b7d6b5..0bb0a7c 100644 --- a/src/h5core/h5t_retrieve.c +++ b/src/h5core/h5t_retrieve.c @@ -7,6 +7,9 @@ License: see file COPYING in top level of source distribution. */ +#include "h5core/h5.h" +#include "h5_private.h" + #include "h5t_types_private.h" #include "h5t_errorhandling_private.h" #include "h5t_map_private.h" @@ -15,7 +18,6 @@ #include "h5t_tags_private.h" #include "h5t_retrieve_private.h" -#include "h5core/h5.h" #include "h5core/h5t_map.h" /* diff --git a/src/h5core/h5t_store.c b/src/h5core/h5t_store.c index 54d7794..f091df5 100644 --- a/src/h5core/h5t_store.c +++ b/src/h5core/h5t_store.c @@ -31,7 +31,7 @@ */ int max_num_elems_p_chunk = 120; -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID // that probably doesn't belong here... //TODO put in right place + print variables h5_edge_list_t* h5tpriv_init_edge_list ( @@ -294,7 +294,7 @@ assign_global_vertex_indices ( H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m); h5_loc_idx_t local_idx = (m->leaf_level == 0) ? 0 : m->num_loc_vertices[m->leaf_level-1]; - +#if defined(WITH_PARALLEL_H5GRID) if (m->is_chunked && m->f->nprocs > 1) { // exchange num vertices and calc range h5_glb_idx_t* range = NULL; @@ -311,7 +311,9 @@ assign_global_vertex_indices ( H5_PRIV_FUNC_LEAVE (H5_ERR_INTERNAL); } TRY (h5_free (range)); - } else { + } else +#endif + { // simple in serial runs: global_id = local_id for ( ; @@ -322,6 +324,8 @@ assign_global_vertex_indices ( } H5_PRIV_FUNC_RETURN (H5_SUCCESS); } + +#if defined(WITH_PARALLEL_H5GRID) /* * there is a different version needed for after the refinement because * not all vertices need to get a glb_idx from this proc @@ -355,25 +359,6 @@ assign_global_vertex_indices_chk ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } -/*! - Assign unique global indices to new elements. - */ -static h5_err_t -assign_glb_elem_indices ( - h5t_mesh_t* const m - ) { - /* - simple in serial runs: global index = local index - */ - h5_loc_idx_t loc_idx = (m->leaf_level == 0) ? 0 : m->num_interior_elems[m->leaf_level-1]; - - for (; loc_idx < m->num_interior_elems[m->leaf_level]; loc_idx++) { - h5tpriv_set_loc_elem_glb_idx (m, loc_idx, loc_idx); - } - - return H5_SUCCESS; -} - /*! Assign unique global indices to new elements. */ @@ -399,6 +384,27 @@ assign_glb_elem_indices_chk ( //TODO use ifdef instead of new func name } +#endif + +/*! + Assign unique global indices to new elements. + */ +static h5_err_t +assign_glb_elem_indices ( + h5t_mesh_t* const m + ) { + /* + simple in serial runs: global index = local index + */ + h5_loc_idx_t loc_idx = (m->leaf_level == 0) ? 0 : m->num_interior_elems[m->leaf_level-1]; + + for (; loc_idx < m->num_interior_elems[m->leaf_level]; loc_idx++) { + h5tpriv_set_loc_elem_glb_idx (m, loc_idx, loc_idx); + } + + return H5_SUCCESS; +} + h5_lvl_idx_t h5tpriv_add_level ( h5t_mesh_t* const m @@ -714,6 +720,8 @@ h5t_end_store_elems ( H5_CORE_API_RETURN (H5_SUCCESS); } + +#if defined(WITH_PARALLEL_H5GRID) /* * linear search trough chunks to find chk_idx which contains element */ @@ -824,7 +832,7 @@ h5tpriv_calc_vtx_revpermutation ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } #endif // CHUNKING_OF_VTX - +#endif // WITH_PARALLEL_H5GRID // used to chunk vtx //static h5_err_t //h5tpriv_store_vtx_range_to_chk ( @@ -852,14 +860,13 @@ h5tpriv_calc_vtx_revpermutation ( // H5_PRIV_FUNC_RETURN (H5_SUCCESS); //} - h5_err_t h5t_end_store_ckd_elems ( h5t_mesh_t* const m ) { H5_CORE_API_ENTER (h5_err_t, "m=%p", m); h5_debug ("end storing elements"); -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID m->num_interior_elems[m->leaf_level] = m->last_stored_eid+1; m->num_glb_elems[m->leaf_level] = m->last_stored_eid+1;// only works for serial case m->num_glb_leaf_elems[m->leaf_level] = m->num_interior_leaf_elems[m->leaf_level]; @@ -1106,7 +1113,7 @@ h5t_end_store_ckd_elems ( H5_CORE_API_RETURN (H5_SUCCESS); } -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID h5_err_t h5tpriv_find_oct_proc_of_point ( h5t_mesh_t* m, @@ -1212,7 +1219,7 @@ h5t_pre_refine ( H5_CORE_API_ENTER (h5_err_t, "m=%p", m); H5_CORE_API_RETURN (m->methods->store->pre_refine (m)); } -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID //TODO maybe use ifdef to have name without _chk h5_err_t h5t_pre_refine_chk ( @@ -1256,7 +1263,7 @@ h5t_refine_marked_elems ( H5_CORE_API_RETURN (H5_SUCCESS); } -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID /* * Calculate the global entity range * range[i] = first glb entity of proc i @@ -1401,6 +1408,7 @@ get_new_vtx_of_edge( } H5_PRIV_FUNC_RETURN (H5_ERR_INTERNAL); //edge that should be refined in not refined } + /* * Go through elements and find boundary edges that were refined on this proc. * we try to find edges that are shared with non-local elements (they could have @@ -2241,8 +2249,7 @@ h5t_post_refine ( } -#ifdef PARALLEL_IO - +#ifdef WITH_PARALLEL_H5GRID h5_err_t h5t_post_refine_chk ( h5t_mesh_t* const m, @@ -2251,7 +2258,8 @@ h5t_post_refine_chk ( H5_CORE_API_ENTER (h5_err_t, "m=%p", m); h5_debug("post_refine_chk"); // get boundary edges - h5_edge_list_t* b_edges = h5tpriv_init_edge_list(h5tpriv_ref_elem_get_num_edges(m) * m->marked_entities->num_items); + h5_edge_list_t* b_edges = h5tpriv_init_edge_list ( + h5tpriv_ref_elem_get_num_edges(m) * m->marked_entities->num_items); TRY (h5tpriv_find_boundary_edges (m, marked_glb_elems, b_edges)); // exchange boundary edges @@ -2482,7 +2490,7 @@ h5t_end_refine_elems ( ) { H5_CORE_API_ENTER (h5_err_t, "m=%p", m); if (m->is_chunked) { -#ifdef PARALLEL_IO +#ifdef WITH_PARALLEL_H5GRID TRY (h5priv_mpi_barrier (m->f->props->comm)); m->timing.measure[m->timing.next_time++] = MPI_Wtime(); h5_glb_idxlist_t* glb_list = NULL; @@ -2510,7 +2518,7 @@ h5t_end_refine_elems ( H5_CORE_API_RETURN (H5_SUCCESS); } - +#if defined(WITH_PARALLEL_H5GRID) h5_err_t h5tpriv_init_chunks ( h5t_mesh_t* const m @@ -2639,7 +2647,6 @@ h5tpriv_create_chunk ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } -#ifdef PARALLEL_IO /* * exchange newly created chunks */ diff --git a/src/h5core/h5t_store_private.h b/src/h5core/h5t_store_private.h index 912029f..9a2c5c0 100644 --- a/src/h5core/h5t_store_private.h +++ b/src/h5core/h5t_store_private.h @@ -57,6 +57,7 @@ h5tpriv_get_num_new_elems ( return m->methods->store->get_num_new_elems (); } +#if defined(WITH_PARALLEL_H5GRID) h5_err_t h5tpriv_init_chunks (h5t_mesh_t* const); @@ -86,5 +87,6 @@ h5tpriv_octant_is_full (h5t_octree_t* octree, h5_oct_idx_t oct_idx); h5_err_t h5tpriv_get_ranges (h5t_mesh_t* const m, h5_glb_idx_t* range, h5_glb_idx_t mycount, h5_glb_idx_t glb_start); +#endif #endif diff --git a/src/h5core/h5t_types_private.h b/src/h5core/h5t_types_private.h index 9edefd4..fb263da 100644 --- a/src/h5core/h5t_types_private.h +++ b/src/h5core/h5t_types_private.h @@ -259,11 +259,13 @@ struct h5t_mesh { /*** chunking ***/ h5_lvl_idx_t is_chunked; /* == 1 if mesh is chunked */ +#if defined(WITH_PARALLEL_H5GRID) h5t_octree_t* octree; h5t_chunks_t* chunks; h5_dsinfo_t dsinfo_chunks; h5_dsinfo_t dsinfo_octree; h5_dsinfo_t dsinfo_userdata; +#endif h5t_timing_t timing; h5_strlist_t* mtagsets; diff --git a/src/include/h5core/h5t_octree.h b/src/include/h5core/h5t_octree.h index a6c3c26..3cd758f 100644 --- a/src/include/h5core/h5t_octree.h +++ b/src/include/h5core/h5t_octree.h @@ -19,18 +19,18 @@ extern "C" { // it is very unlikely that there are more than 2^32 octants needed. since there is no id // we dont need that... //#if defined(USE_LARGE_INDICES) -//typedef int64_t h5_oct_idx_t; // type for a octant -//typedef h5_uint64_t h5_oct_userlev_t; // type for user defined levels +//typedef int64_t h5_oct_idx_t; // type for a octant +//typedef h5_uint64_t h5_oct_userlev_t; // type for user defined levels //#define OCT_USERLEV_LENGTH 64 //#else -typedef h5_int32_t h5_oct_idx_t; // type for a octant -typedef h5_uint32_t h5_oct_userlev_t; // type for user defined levels +typedef h5_int32_t h5_oct_idx_t; // type for a octant +typedef h5_uint32_t h5_oct_userlev_t; // type for user defined levels #define OCT_USERLEV_LENGTH 32 //#endif typedef h5_int32_t h5_oct_level_t; -typedef int16_t h5_oct_orient_t; // orientation of an octant -typedef int16_t h5_oct_dir_t; // direction to look for neighboring octants +typedef int16_t h5_oct_orient_t; // orientation of an octant +typedef int16_t h5_oct_dir_t; // direction to look for neighboring octants #define OCT_CHG_INTERNAL 11