added
This commit is contained in:
@@ -423,8 +423,10 @@ test/H5Block/H5BlockTestAttributesF.f90 -text
|
||||
test/H5Block/Makefile.am -text
|
||||
test/H5Fed/Makefile.am -text
|
||||
test/H5Fed/map_tet2globalid.c -text
|
||||
test/H5Fed/map_triangle2globalid.c -text
|
||||
test/H5Fed/read_tetmesh.c -text
|
||||
test/H5Fed/read_trianglemesh.c -text
|
||||
test/H5Fed/write_boundary.c -text
|
||||
test/H5Fed/write_tetmesh.c -text
|
||||
test/H5Fed/write_trianglemesh.c -text
|
||||
test/H5Part/Bench.c -text
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <hdf5.h>
|
||||
#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;
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char *argv[]
|
||||
) {
|
||||
|
||||
H5PartSetVerbosityLevel ( 4 );
|
||||
|
||||
h5_file *f = H5OpenFile ( "simple_tet.h5", 0 );
|
||||
if ( f == NULL ) {
|
||||
fprintf ( stderr, "!!! Can't open file.\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
h5_size_t num_meshes = H5FedGetNumMeshes ( f, TETRAHEDRAL_MESH );
|
||||
printf ( " Number of meshes: %d\n", num_meshes );
|
||||
|
||||
h5_id_t mesh_id = 0;
|
||||
|
||||
h5_err_t h5err = H5FedOpenMesh ( f, mesh_id, TETRAHEDRAL_MESH );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't open mesh %d\n", mesh_id );
|
||||
return -1;
|
||||
}
|
||||
h5_id_t global_vids[3] = { 3, 4, 5 }; // sorted 4, 5, 3
|
||||
h5_id_t global_tid = H5FedMapTriangle2GlobalID ( f, global_vids );
|
||||
if ( global_tid < 0 ) {
|
||||
fprintf ( stderr, "!!! Oops ...\n" );
|
||||
return 1;
|
||||
}
|
||||
printf ( " Global triangle ID: 0x%08x\n", (unsigned int)global_tid );
|
||||
|
||||
h5err = H5CloseFile ( f );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't close file.\n" );
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <hdf5.h>
|
||||
#include "H5Part.h"
|
||||
#include "H5Fed.h"
|
||||
|
||||
#ifndef PARALLEL_IO
|
||||
#ifndef MPI_COMM_WORLD
|
||||
#define MPI_COMM_WORLD 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct vertex {
|
||||
h5_id_t global_id;
|
||||
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;
|
||||
|
||||
struct boundary {
|
||||
h5_id_t vids[3];
|
||||
};
|
||||
typedef struct boundary boundary_t;
|
||||
|
||||
vertex_t V0[5] = {
|
||||
{ 0, {-1.0, 0.0, 0.0} },
|
||||
{ 1, { 1.0, 0.0, 0.0} },
|
||||
{ 2, { 0.0, 1.0, 0.0} },
|
||||
{ 3, { 0.0, 0.0, 1.0} },
|
||||
{ 4, { 0.0, -1.0, 0.0} }
|
||||
};
|
||||
|
||||
vertex_t V1[1] = {
|
||||
{ 5, {0.0, 0.0, 0.0 } }
|
||||
};
|
||||
|
||||
// sorted vertices: 0, 4, 5, 3, 2, 1
|
||||
|
||||
tet_t T0[2] = {
|
||||
{ 1, -1, { 0, 1, 2, 3 } }, // 0, 3, 2, 1
|
||||
{ 0, -1, { 0, 1, 3, 4 } } // 0, 4, 3, 1
|
||||
};
|
||||
|
||||
tet_t T1[2] = {
|
||||
{ 2, 0, { 0, 3, 4, 5 } }, // 0, 4, 5, 3
|
||||
{ 3, 0, { 1, 3, 4, 5 } } // 4, 5, 3, 1
|
||||
};
|
||||
|
||||
boundary_t boundary[2] = {
|
||||
{{ 0, 1, 2 }},
|
||||
{{ 2, 3, 4 }}
|
||||
};
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char *argv[]
|
||||
) {
|
||||
H5PartSetVerbosityLevel ( 4 );
|
||||
|
||||
h5_file *f = H5OpenFile ( "simple_tet.h5", 0 );
|
||||
if ( f == NULL ) {
|
||||
fprintf ( stderr, "!!! Can't open file.\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
h5_err_t h5err = H5FedOpenMesh ( f, 0, TETRAHEDRAL_MESH );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't open mesh %d\n", 0 );
|
||||
return -1;
|
||||
}
|
||||
h5err = H5FedAddBoundary ( f );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't add boundary.\n" );
|
||||
return -1;
|
||||
}
|
||||
h5err = H5FedAddNumBoundaryfaces ( f, 1 );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't add boundary.\n" );
|
||||
return -1;
|
||||
}
|
||||
h5err = H5FedStoreBoundaryface ( f, boundary[0].vids );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't write boundary.\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
h5err = H5CloseFile ( f );
|
||||
if ( h5err < 0 ) {
|
||||
fprintf ( stderr, "!!! Can't close file.\n" );
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user