diff --git a/.gitattributes b/.gitattributes index 1d565d3..1855b9b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -77,6 +77,7 @@ test/h5b/H5BlockParTestScalarFieldF.f90 -text test/h5b/H5BlockTestAttributes.c -text test/h5b/H5BlockTestAttributesF.f90 -text test/h5b/Makefile.am -text +test/h5t/simple_tet.c -text test/h5u/Bench.c -text test/h5u/H5ParallelTest.cc -text test/h5u/H5PartAndreasTest.cc -text diff --git a/test/h5t/simple_tet.c b/test/h5t/simple_tet.c new file mode 100644 index 0000000..2a47d6d --- /dev/null +++ b/test/h5t/simple_tet.c @@ -0,0 +1,130 @@ +#include +#include +#include +#include "H5Part.h" +#include "H5Fed.h" + +#ifndef PARALLEL_IO +#ifndef MPI_COMM_WORLD +#define MPI_COMM_WORLD 0 +#endif +#endif + +struct vertex { + h5_float64_t P[3]; +}; + +typedef struct vertex vertex_t; + +struct tet { + h5_id_t global_id; + h5_id_t parent_id; + h5_id_t vids[4]; +}; +typedef struct tet tet_t; + + +vertex_t V0[5] = { + { {-1.0, 0.0, 0.0} }, + { { 1.0, 0.0, 0.0} }, + { { 0.0, 1.0, 0.0} }, + { { 0.0, 0.0, 1.0} }, + { { 0.0, -1.0, 0.0} } +}; + +vertex_t V1[1] = { + {{ 0.0, 0.0, 0.0 }} +}; + +tet_t T0[2] = { + { 1, -1, { 0, 1, 2, 3 } }, + { 0, -1, { 0, 1, 3, 4 } } +}; + +tet_t T1[2] = { + { 2, 0, { 0, 3, 4, 5 } }, + { 3, 0, { 1, 3, 4, 5 } } +}; + +h5_err_t +add_level ( + h5_file *f, + vertex_t V[], + int num_verts, + tet_t T[], + int num_tets + ) { + + h5_err_t h5err = H5FedAddLevel ( f ); + if ( h5err < 0 ) { + fprintf ( stderr, "!!! Can't add level.\n" ); + return -1; + } + h5err = H5FedSetAdditionalNumVerticesToStore ( f, num_verts ); + if ( h5err < 0 ) { + fprintf ( stderr, "!!! Can't set number of vertices.\n" ); + return -1; + } + + int i; + for ( i = 0; i