Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e27bdb592e | |||
| 9becc99e02 | |||
| 556fe9b8a6 | |||
| bc84ce205a | |||
| c45c1e9bb9 | |||
| 4085a1c30c | |||
| ce8b6dae77 | |||
| 29888601b8 | |||
| d82e7143ed | |||
| 3569a12376 |
@@ -520,6 +520,7 @@ test/H5Fed/tetmesh_write.c -text
|
|||||||
test/H5Fed/tetmesh_write1.c -text
|
test/H5Fed/tetmesh_write1.c -text
|
||||||
test/H5Fed/tetmesh_write2.c -text
|
test/H5Fed/tetmesh_write2.c -text
|
||||||
test/H5Fed/tetmesh_write_tags.c -text
|
test/H5Fed/tetmesh_write_tags.c -text
|
||||||
|
test/H5Fed/trimesh_2gnuplot.c -text
|
||||||
test/H5Fed/trimesh_adjacencies.c -text
|
test/H5Fed/trimesh_adjacencies.c -text
|
||||||
test/H5Fed/trimesh_read.c -text
|
test/H5Fed/trimesh_read.c -text
|
||||||
test/H5Fed/trimesh_write.c -text
|
test/H5Fed/trimesh_write.c -text
|
||||||
|
|||||||
@@ -77,4 +77,6 @@ test/h5u_test
|
|||||||
tools/.deps
|
tools/.deps
|
||||||
tools/Makefile
|
tools/Makefile
|
||||||
tools/Makefile.in
|
tools/Makefile.in
|
||||||
|
tools/h5PartDcToVtk
|
||||||
|
tools/h5PartSurfaceToVtk
|
||||||
tools/h5hutcc
|
tools/h5hutcc
|
||||||
|
|||||||
+1
-1
@@ -199,7 +199,7 @@ if test "X$USE_C" = "Xyes"; then
|
|||||||
LIB_C="libH5hutC.la"
|
LIB_C="libH5hutC.la"
|
||||||
BUILD_LIBS="$BUILD_LIBS libH5hutC"
|
BUILD_LIBS="$BUILD_LIBS libH5hutC"
|
||||||
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
|
BUILD_TESTS="$BUILD_TESTS h5u_test h5b_test"
|
||||||
BUILD_TOOLS="$BUILD_TOOLS h5hutcc h5PartDcToVtk h5PartSurfaceToVtk"
|
BUILD_TOOLS="$BUILD_TOOLS h5hutcc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################ fortran enabled ##################################
|
############################ fortran enabled ##################################
|
||||||
|
|||||||
@@ -116,7 +116,9 @@ h5bl_3d_getview (
|
|||||||
k_start, k_end);
|
k_start, k_end);
|
||||||
H5_API_RETURN (h5b_3d_get_view (
|
H5_API_RETURN (h5b_3d_get_view (
|
||||||
fh,
|
fh,
|
||||||
i_start, i_end, j_start, j_end, k_start, k_end ));
|
(h5_size_t*)i_start, (h5_size_t*)i_end,
|
||||||
|
(h5_size_t*)j_start, (h5_size_t*)j_end,
|
||||||
|
(h5_size_t*)k_start, (h5_size_t*)k_end ));
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
@@ -142,7 +144,9 @@ h5bl_3d_getreducedview (
|
|||||||
k_start, k_end);
|
k_start, k_end);
|
||||||
H5_API_RETURN(h5b_3d_get_reduced_view (
|
H5_API_RETURN(h5b_3d_get_reduced_view (
|
||||||
fh,
|
fh,
|
||||||
i_start, i_end, j_start, j_end, k_start, k_end ));
|
(h5_size_t*)i_start, (h5_size_t*)i_end,
|
||||||
|
(h5_size_t*)j_start, (h5_size_t*)j_end,
|
||||||
|
(h5_size_t*)k_start, (h5_size_t*)k_end ));
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_int64_t
|
h5_int64_t
|
||||||
|
|||||||
@@ -155,14 +155,14 @@ h5pt_setview (
|
|||||||
h5_err_t
|
h5_err_t
|
||||||
h5pt_setview_indices (
|
h5pt_setview_indices (
|
||||||
const h5_int64_t *f,
|
const h5_int64_t *f,
|
||||||
const h5_int64_t *indices,
|
const h5_int64_t * const indices,
|
||||||
const h5_int64_t *nelem
|
const h5_int64_t *nelem
|
||||||
) {
|
) {
|
||||||
|
|
||||||
h5_file_t *fh = h5_filehandlefor2c(f);
|
h5_file_t *fh = h5_filehandlefor2c(f);
|
||||||
H5_API_ENTER (h5_err_t, "f=%p, indices=%p, nelem=%lld",
|
H5_API_ENTER (h5_err_t, "f=%p, indices=%p, nelem=%lld",
|
||||||
fh, indices, (long long)*nelem);
|
fh, indices, (long long)*nelem);
|
||||||
H5_API_RETURN(h5u_set_view_indices ( fh, indices, *nelem ));
|
H5_API_RETURN(h5u_set_view_indices ( fh, (const h5_size_t*const)indices, *nelem ));
|
||||||
}
|
}
|
||||||
|
|
||||||
h5_err_t
|
h5_err_t
|
||||||
|
|||||||
+3
-22
@@ -51,25 +51,6 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static h5_int32_t
|
|
||||||
_flagsfor2c (
|
|
||||||
char * flags
|
|
||||||
) {
|
|
||||||
|
|
||||||
h5_int32_t fbits = 0x00;
|
|
||||||
|
|
||||||
flags = strtok ( flags, "," );
|
|
||||||
while ( flags != NULL ) {
|
|
||||||
if ( strcmp ( flags, "vfd_mpiposix" ) == 0 )
|
|
||||||
fbits |= H5_VFD_MPIPOSIX;
|
|
||||||
else if ( strcmp ( flags, "vfd_independent" ) == 0 )
|
|
||||||
fbits |= H5_VFD_INDEPENDENT;
|
|
||||||
flags = strtok ( NULL, "," );
|
|
||||||
}
|
|
||||||
|
|
||||||
return fbits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open/close interface */
|
/* open/close interface */
|
||||||
h5_err_t
|
h5_err_t
|
||||||
h5_openr (
|
h5_openr (
|
||||||
@@ -79,7 +60,7 @@ h5_openr (
|
|||||||
|
|
||||||
H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name);
|
H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name);
|
||||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||||
h5_file_t* f = h5_open_file ( name2, H5_O_RDONLY, 0 );
|
h5_file_t* f = h5_open_file ( name2, H5_O_RDONLY, 0, 0 );
|
||||||
free ( name2 );
|
free ( name2 );
|
||||||
H5_API_RETURN((h5_int64_t)(size_t)f);
|
H5_API_RETURN((h5_int64_t)(size_t)f);
|
||||||
}
|
}
|
||||||
@@ -92,7 +73,7 @@ h5_openw (
|
|||||||
|
|
||||||
H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name);
|
H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name);
|
||||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||||
h5_file_t* f = h5_open_file ( name2, H5_O_WRONLY, 0 );
|
h5_file_t* f = h5_open_file ( name2, H5_O_WRONLY, 0, 0 );
|
||||||
free ( name2 );
|
free ( name2 );
|
||||||
H5_API_RETURN((h5_int64_t)(size_t)f);
|
H5_API_RETURN((h5_int64_t)(size_t)f);
|
||||||
}
|
}
|
||||||
@@ -105,7 +86,7 @@ h5pt_opena (
|
|||||||
|
|
||||||
H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name);
|
H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name);
|
||||||
char *name2 = h5_strdupfor2c ( name, l_name );
|
char *name2 = h5_strdupfor2c ( name, l_name );
|
||||||
h5_file_t* f = h5_open_file ( name2, H5_O_APPEND, 0 );
|
h5_file_t* f = h5_open_file ( name2, H5_O_APPEND, 0, 0 );
|
||||||
free ( name2 );
|
free ( name2 );
|
||||||
H5_API_RETURN((h5_int64_t)(size_t)f);
|
H5_API_RETURN((h5_int64_t)(size_t)f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ h5_get_attachment (
|
|||||||
// write file
|
// write file
|
||||||
if (f->myproc == 0) {
|
if (f->myproc == 0) {
|
||||||
int fd;
|
int fd;
|
||||||
if ((fd = open (fname, O_WRONLY|O_CREAT|O_TRUNC)) < 0) {
|
if ((fd = open (fname, O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0) {
|
||||||
H5_CORE_API_LEAVE (
|
H5_CORE_API_LEAVE (
|
||||||
h5_error (
|
h5_error (
|
||||||
H5_ERR_H5,
|
H5_ERR_H5,
|
||||||
|
|||||||
@@ -310,3 +310,22 @@ h5t_get_vertex_coords_by_id (
|
|||||||
H5_CORE_API_RETURN (H5_SUCCESS);
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
h5t_get_neighbor_indices (
|
||||||
|
h5t_mesh_t* const m,
|
||||||
|
h5_loc_id_t entity_id,
|
||||||
|
h5_loc_idx_t* neighbor_indices
|
||||||
|
) {
|
||||||
|
H5_CORE_API_ENTER (h5_err_t,
|
||||||
|
"m=%p, entity_id=%llu, neighbor_indices=%p",
|
||||||
|
m,
|
||||||
|
(long long unsigned)entity_id,
|
||||||
|
neighbor_indices);
|
||||||
|
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
|
||||||
|
h5_loc_idx_t* indices = h5tpriv_get_loc_elem_neighbor_indices (m, elem_idx);
|
||||||
|
int num_facets = h5tpriv_ref_elem_get_num_facets (m);
|
||||||
|
for (int i = 0; i < num_facets; i++) {
|
||||||
|
neighbor_indices[i] = indices[i];
|
||||||
|
}
|
||||||
|
H5_CORE_API_RETURN (H5_SUCCESS);
|
||||||
|
}
|
||||||
|
|||||||
@@ -173,6 +173,19 @@ H5FedGetVertexIndicesOfEntity (
|
|||||||
H5_API_RETURN (h5t_get_vertex_indices_of_entity (m, entity_id, vertex_indices));
|
H5_API_RETURN (h5t_get_vertex_indices_of_entity (m, entity_id, vertex_indices));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline h5_err_t
|
||||||
|
H5FedGetNeighborIndicesOfElement (
|
||||||
|
h5t_mesh_t* const m,
|
||||||
|
h5_loc_id_t entity_id,
|
||||||
|
h5_loc_idx_t* neighbor_indices
|
||||||
|
) {
|
||||||
|
H5_API_ENTER (h5_err_t,
|
||||||
|
"m=%p, entity_id=%lld, neighbor_indices=%p",
|
||||||
|
m, (long long)entity_id, neighbor_indices);
|
||||||
|
H5_API_RETURN (h5t_get_neighbor_indices (m, entity_id, neighbor_indices));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ h5t_get_vertex_coords_by_index (h5t_mesh_t* const, h5_loc_idx_t, h5_float64_t[3]
|
|||||||
h5_err_t
|
h5_err_t
|
||||||
h5t_get_vertex_coords_by_id (h5t_mesh_t* const, h5_loc_id_t, h5_float64_t[3]);
|
h5t_get_vertex_coords_by_id (h5t_mesh_t* const, h5_loc_id_t, h5_float64_t[3]);
|
||||||
|
|
||||||
|
h5_err_t
|
||||||
|
h5t_get_neighbor_indices (h5t_mesh_t* const, h5_loc_id_t, h5_loc_idx_t*);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ noinst_PROGRAMS = \
|
|||||||
tetmesh_read_tags \
|
tetmesh_read_tags \
|
||||||
trimesh_read \
|
trimesh_read \
|
||||||
trimesh_write \
|
trimesh_write \
|
||||||
|
trimesh_2gnuplot \
|
||||||
trimesh_adjacencies \
|
trimesh_adjacencies \
|
||||||
trimesh_write_dunetest
|
trimesh_write_dunetest
|
||||||
|
|
||||||
@@ -28,12 +29,13 @@ EXTRA_DIST = \
|
|||||||
tetmesh_read.c \
|
tetmesh_read.c \
|
||||||
tetmesh_read_tags.c \
|
tetmesh_read_tags.c \
|
||||||
tetmesh_write.c \
|
tetmesh_write.c \
|
||||||
tetmesh_write1.c \
|
tetmesh_write1.c \
|
||||||
tetmesh_write2.c \
|
tetmesh_write2.c \
|
||||||
tetmesh_write_tags.c \
|
tetmesh_write_tags.c \
|
||||||
trimesh_adjacencies.c \
|
trimesh_adjacencies.c \
|
||||||
trimesh_read.c \
|
trimesh_read.c \
|
||||||
trimesh_write.c \
|
trimesh_write.c \
|
||||||
|
trimesh_2gnuplot.c \
|
||||||
trimesh_write_dunetest.c
|
trimesh_write_dunetest.c
|
||||||
|
|
||||||
# map_tet2globalid.c \
|
# map_tet2globalid.c \
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "H5hut.h"
|
||||||
|
#if defined (PARALLEL_IO)
|
||||||
|
#include <mpi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define H5FedGetNumLeafElementsTotal H5FedGetNumElementsTotal
|
||||||
|
/*
|
||||||
|
Traverse elements and output coordinates
|
||||||
|
*/
|
||||||
|
static h5_err_t
|
||||||
|
traverse_elems (
|
||||||
|
h5t_mesh_t* const m
|
||||||
|
) {
|
||||||
|
/* get number of elements we have to expect */
|
||||||
|
h5_size_t num_elems_expect = H5FedGetNumLeafElementsTotal (m);
|
||||||
|
|
||||||
|
/* get iterator for co-dim 0 */
|
||||||
|
h5t_iterator_t* iter = H5FedBeginTraverseEntities (m, 0);
|
||||||
|
|
||||||
|
/* iterate over all co-dim 0 entities, i.e. elements */
|
||||||
|
h5_loc_id_t local_id;
|
||||||
|
h5_size_t num_elems = 0;
|
||||||
|
while ((local_id = H5FedTraverseEntities (iter)) >= 0) {
|
||||||
|
h5_loc_id_t local_vids[4];
|
||||||
|
H5FedGetVertexIndicesOfEntity (m, local_id, local_vids);
|
||||||
|
|
||||||
|
printf ("# cell %llx\n", (long long unsigned)local_id );
|
||||||
|
h5_float64_t P[3];
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
H5FedGetVertexCoordsByIndex (m, local_vids[i], P);
|
||||||
|
printf (" %8.6f %8.6f\n", P[0], P[1]);
|
||||||
|
}
|
||||||
|
H5FedGetVertexCoordsByIndex (m, local_vids[0], P);
|
||||||
|
printf (" %8.6f %8.6f\n", P[0], P[1]);
|
||||||
|
printf ("\n");
|
||||||
|
num_elems++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* done */
|
||||||
|
H5FedEndTraverseEntities (iter);
|
||||||
|
|
||||||
|
/* report error if we got a different number then expected */
|
||||||
|
if (num_elems != num_elems_expect) {
|
||||||
|
fprintf (stderr, "!!! Got %lld elements, but expected %lld.\n",
|
||||||
|
(long long)num_elems, (long long)num_elems_expect);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return H5_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (
|
||||||
|
int argc,
|
||||||
|
char* argv[]
|
||||||
|
) {
|
||||||
|
|
||||||
|
#if defined (PARALLEL_IO)
|
||||||
|
MPI_Comm comm = MPI_COMM_WORLD;
|
||||||
|
MPI_Init (&argc, &argv);
|
||||||
|
#else
|
||||||
|
MPI_Comm comm = 0;
|
||||||
|
#endif
|
||||||
|
if (argc < 2 || argc > 3) {
|
||||||
|
fprintf (stderr, "Usage: %s FILE [LEVEL]\n", argv[0]);
|
||||||
|
exit (42);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* abort program on error, so we don't have to handle them */
|
||||||
|
H5SetErrorHandler (H5AbortErrorhandler);
|
||||||
|
H5SetVerbosityLevel (0);
|
||||||
|
|
||||||
|
/* open file and get number of meshes */
|
||||||
|
h5_file_t* f = H5OpenFile (argv[1], H5_O_RDONLY, comm);
|
||||||
|
h5t_mesh_t* m;
|
||||||
|
H5FedOpenTriangleMeshByIndex (f, 0, &m);
|
||||||
|
int num_levels = H5FedGetNumLevels (m);
|
||||||
|
int level = num_levels-1;
|
||||||
|
if (argc >= 3) {
|
||||||
|
level = atoi (argv[2]);
|
||||||
|
}
|
||||||
|
if (level >= num_levels || level < 0) {
|
||||||
|
fprintf (stderr, "level %d out of range\n", level);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
H5FedSetLevel (m, level);
|
||||||
|
traverse_elems (m);
|
||||||
|
|
||||||
|
|
||||||
|
done:
|
||||||
|
H5FedCloseMesh (m);
|
||||||
|
H5CloseFile (f);
|
||||||
|
|
||||||
|
#if defined (PARALLEL_IO)
|
||||||
|
MPI_Finalize ();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+6
-6
@@ -23,8 +23,8 @@ h5u_test_SOURCES = \
|
|||||||
params.h
|
params.h
|
||||||
|
|
||||||
h5u_test_LDADD = \
|
h5u_test_LDADD = \
|
||||||
../src/h5core/libH5hut.la \
|
../src/C/libH5hutC.la \
|
||||||
../src/C/libH5hutC.la
|
../src/h5core/libH5hut.la
|
||||||
|
|
||||||
h5b_test_SOURCES = \
|
h5b_test_SOURCES = \
|
||||||
h5b_test.c \
|
h5b_test.c \
|
||||||
@@ -35,15 +35,15 @@ h5b_test_SOURCES = \
|
|||||||
params.h
|
params.h
|
||||||
|
|
||||||
h5b_test_LDADD = \
|
h5b_test_LDADD = \
|
||||||
../src/h5core/libH5hut.la \
|
../src/C/libH5hutC.la \
|
||||||
../src/C/libH5hutC.la
|
../src/h5core/libH5hut.la
|
||||||
|
|
||||||
h5_attach_test_SOURCES = \
|
h5_attach_test_SOURCES = \
|
||||||
h5_attach_test.c
|
h5_attach_test.c
|
||||||
|
|
||||||
h5_attach_test_LDADD = \
|
h5_attach_test_LDADD = \
|
||||||
../src/h5core/libH5hut.la \
|
../src/C/libH5hutC.la \
|
||||||
../src/C/libH5hutC.la
|
../src/h5core/libH5hut.la
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
${RM} -f *.h5
|
${RM} -f *.h5
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ int get_option(int argc, const char **argv, const char *opts, const struct long_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
register char *cp; /* pointer into current token */
|
register const char *cp; /* pointer into current token */
|
||||||
|
|
||||||
/* short command line option */
|
/* short command line option */
|
||||||
opt_opt = argv[opt_ind][sp];
|
opt_opt = argv[opt_ind][sp];
|
||||||
@@ -312,7 +312,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
string ifn = string(input_name) + string(".h5");
|
string ifn = string(input_name) + string(".h5");
|
||||||
|
|
||||||
h5file = H5OpenFile(ifn.c_str(), H5_O_WRONLY, NULL);
|
h5file = H5OpenFile(ifn.c_str(), H5_O_WRONLY, 0);
|
||||||
|
|
||||||
if( h5file == NULL ) {
|
if( h5file == NULL ) {
|
||||||
fprintf(stdout, "unable to open file %s\n", input_name);
|
fprintf(stdout, "unable to open file %s\n", input_name);
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ int get_option(int argc, const char **argv, const char *opts, const struct long_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
register char *cp; /* pointer into current token */
|
register const char *cp; /* pointer into current token */
|
||||||
|
|
||||||
/* short command line option */
|
/* short command line option */
|
||||||
opt_opt = argv[opt_ind][sp];
|
opt_opt = argv[opt_ind][sp];
|
||||||
@@ -336,7 +336,7 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
string ifn = string(input_name) + string(".h5");
|
string ifn = string(input_name) + string(".h5");
|
||||||
|
|
||||||
h5file = H5OpenFile(ifn.c_str(), H5_O_WRONLY, NULL);
|
h5file = H5OpenFile(ifn.c_str(), H5_O_WRONLY, 0);
|
||||||
|
|
||||||
if( h5file == NULL ) {
|
if( h5file == NULL ) {
|
||||||
fprintf(stdout, "unable to open file %s\n", input_name);
|
fprintf(stdout, "unable to open file %s\n", input_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user