Commit 80523c6d authored by gsell's avatar gsell

examples fixed

parent f17f1d02
......@@ -364,6 +364,7 @@ doc/tetrahedron_refinements/6-edges/edge_01-12-20-23-30-31_refined/output_file.j
doc/tetrahedron_refinements/README -text
doc/tetrahedron_refinements/text2vtk.py -text
examples/H5/Makefile.am -text
examples/H5/file_attribs.c -text
examples/H5/openclose.c -text
examples/H5Block/H5BlockExample.pbs -text
examples/H5Block/H5BlockExampleF.f90 -text
......
......@@ -20,15 +20,17 @@ doc/tagfile
examples/H5/.deps
examples/H5/Makefile
examples/H5/Makefile.in
examples/H5/file_attribs
examples/H5/openclose
examples/H5/testfile.h5
examples/H5Block/*.h5
examples/H5Block/.deps
examples/H5Block/H5BlockExample
examples/H5Block/H5BlockExampleF
examples/H5Block/Makefile
examples/H5Block/Makefile.in
examples/H5Block/blockfile0.h5
examples/H5Block/blockfile1.h5
examples/H5Block/blockfile8.h5
examples/H5Block/fields
examples/H5Block/read_write
examples/H5Fed/.deps
examples/H5Fed/Makefile
examples/H5Fed/Makefile.in
......@@ -44,6 +46,7 @@ examples/H5Fed/trimesh_adjacencies
examples/H5Fed/trimesh_read
examples/H5Fed/trimesh_write
examples/H5Fed/trimesh_write_dunetest
examples/H5Part/*.h5
examples/H5Part/.deps
examples/H5Part/Bench
examples/H5Part/H5test
......
......@@ -13,7 +13,9 @@ LDADD += -lH5hut
noinst_PROGRAMS =
if ENABLE_C
noinst_PROGRAMS += openclose
noinst_PROGRAMS += \
openclose \
file_attribs
endif
if ENABLE_FORTRAN
......
#include "H5hut.h"
#if !defined (PARALLEL_IO)
#define MPI_Init(argc, argv)
#define MPI_Comm_size(comm, nprocs) { *nprocs = 1; }
#define MPI_Comm_rank(comm, myproc) { *myproc = 0; }
#define MPI_Finalize()
#define MPI_COMM_WORLD (0)
#endif
int
main (
int argc,
char** argv
) {
MPI_Comm comm = MPI_COMM_WORLD;
int myproc;
int nprocs;
MPI_Init (&argc, &argv);
MPI_Comm_size (comm, &nprocs);
MPI_Comm_rank (comm, &myproc);
h5_file_t f = H5OpenFile ("testfile.h5", H5_O_WRONLY, comm);
H5WriteFileAttribString (f, "FileAttrString", "This is a string attribute bound to the file.");
H5CloseFile (f);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileMPIO (prop, &comm);
f = H5OpenFile2 ("testfile.h5", H5_O_APPEND, prop);
H5CloseProp (prop);
int64_t id[] = {42, 43, 44, 45};
H5WriteFileAttribInt64 (f, "FileAttrInt64", id, sizeof(id)/sizeof(id[0]));
H5CloseFile (f);
MPI_Finalize ();
return 0;
}
......@@ -28,6 +28,7 @@ main (
H5SetPropFileMPIO (prop, &comm);
f = H5OpenFile2 ("testfile.h5", H5_O_WRONLY, prop);
H5CloseProp (prop);
H5CloseFile (f);
MPI_Finalize ();
return 0;
......
......@@ -7,7 +7,6 @@
#define PRINT_UPADJACENCIES 1
#define PRINT_DOWNADJACENCIES 0
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
const char* FNAME = "simple_tet.h5";
typedef struct timer {
......@@ -500,7 +499,7 @@ traverse_elems (
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5t_lvl_idx_t level_id,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
......@@ -529,7 +528,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, level_id, dumpit, timer);
}
......
......@@ -280,7 +280,7 @@ traverse_elems (
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5t_lvl_idx_t level_id,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
......@@ -313,7 +313,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, level_id, dumpit, timer);
}
......
......@@ -327,7 +327,7 @@ static h5_err_t
traverse_level (
h5t_mesh_t* const m,
h5t_tagset_t* tagset,
const h5t_lvl_idx_t level_id,
const h5_lvl_idx_t level_id,
int dumpit,
Timer* timer
) {
......@@ -362,7 +362,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (mesh, tagset, level_id, dumpit, timer);
}
......
......@@ -66,13 +66,11 @@ main (
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
/* add 2. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 2);
H5FedEndRefineElements (mesh);
......
......@@ -64,7 +64,6 @@ main (
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
......
......@@ -81,7 +81,6 @@ main (
H5FedEndStoreElements (mesh);
/* add 1. Level */
H5FedAddLevel(mesh);
H5FedBeginRefineElements (mesh);
H5FedRefineElement (mesh, 0);
H5FedEndRefineElements (mesh);
......@@ -92,7 +91,6 @@ main (
for (level_id = 2; level_id < num_levels; level_id++) {
/* refine 4 to the power of level_id-1 elems */
H5FedAddLevel(mesh);
h5_int32_t num_elems2refine = power (4, level_id-1);
H5FedBeginRefineElements (mesh);
for (i = num_elems_last_level;
......
......@@ -5,7 +5,6 @@
#include "H5hut.h"
const h5_oid_t MESH_TYPE = H5_TETRAHEDRAL_MESH;
const char* FNAME = "simple_tet.h5";
typedef struct timer {
......@@ -197,7 +196,7 @@ main (
h5_info (" Time to open mesh %fsec", timer->elapsed(timer));
/* open last level */
h5_size_t num_levels = H5FedGetNumLevels (mesh);
//h5_size_t num_levels = H5FedGetNumLevels (mesh);
//H5FedSetLevel (mesh, num_levels-1);
H5FedSetLevel (mesh, 0);
......
......@@ -7,7 +7,6 @@
#define PRINT_UPADJACENCIES 1
#define PRINT_DOWNADJACENCIES 0
const h5_oid_t MESH_TYPE = H5_TRIANGLE_MESH;
const char* FNAME = "simple_triangle.h5";
static h5_err_t
......@@ -267,7 +266,7 @@ traverse_elems (
static h5_err_t
traverse_level (
h5t_mesh_t* const m,
const h5t_lvl_idx_t level_id
const h5_lvl_idx_t level_id
) {
printf (" Setting level to %d\n", level_id);
H5FedSetLevel (m, level_id);
......@@ -290,7 +289,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (m, level_id);
}
......
......@@ -220,7 +220,7 @@ traverse_mesh (
printf (" Number of levels in mesh: %lld\n", (long long)num_levels);
/* loop over all levels */
h5t_lvl_idx_t level_id;
h5_lvl_idx_t level_id;
for (level_id = 0; level_id < num_levels; level_id++) {
traverse_level (m, level_id);
}
......
......@@ -58,7 +58,6 @@ main (
H5FedEndStoreElements (m);
/* add 1. Level */
H5FedAddLevel(m);
H5FedBeginRefineElements (m);
H5FedRefineElement (m, 0);
H5FedEndRefineElements (m);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment