- adapt to new API
This commit is contained in:
+14
-14
@@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <hdf5.h>
|
||||
|
||||
#include "H5Part.h"
|
||||
|
||||
/*
|
||||
@@ -104,19 +104,19 @@ int main(int argc,char *argv[]){
|
||||
int main(int argc,char *argv[]){
|
||||
int sz=10;
|
||||
double *x,*y,*z;
|
||||
h5part_int64_t *id;
|
||||
H5PartFile *file;
|
||||
h5_int64_t *id;
|
||||
h5_file_t *file;
|
||||
int i,t,nt,nds,np;
|
||||
h5part_int64_t idStart = 0;
|
||||
h5part_int64_t idEnd = 0;
|
||||
h5_int64_t idStart = 0;
|
||||
h5_int64_t idEnd = 0;
|
||||
|
||||
|
||||
x=(double*)malloc(sz*sizeof(double));
|
||||
y=(double*)malloc(sz*sizeof(double));
|
||||
z=(double*)malloc(sz*sizeof(double));
|
||||
id=(h5part_int64_t*)malloc(sz*sizeof(h5part_int64_t));
|
||||
id=(h5_int64_t*)malloc(sz*sizeof(h5_int64_t));
|
||||
/* parallel file creation */
|
||||
file=H5PartOpenFile("parttest.h5",H5PART_WRITE);
|
||||
file=H5PartOpenFile("parttest.h5",H5_O_WRONLY);
|
||||
if(!file) {
|
||||
perror("File open failed: exiting!");
|
||||
exit(0);
|
||||
@@ -161,7 +161,7 @@ int main(int argc,char *argv[]){
|
||||
|
||||
|
||||
/*+++++++++++++ Reopen File for Reading +++H5PartSetStep(h5partFile,0)++++++++*/
|
||||
file=H5PartOpenFile("parttest.h5",H5PART_READ);
|
||||
file=H5PartOpenFile("parttest.h5",H5_O_RDONLY);
|
||||
|
||||
|
||||
/********************************************/
|
||||
@@ -252,14 +252,14 @@ int main(int argc,char *argv[]){
|
||||
}
|
||||
|
||||
// read dataset names
|
||||
h5part_int64_t status = H5_SUCCESS;
|
||||
const h5part_int64_t lenName = 64;
|
||||
h5_int64_t status = H5_SUCCESS;
|
||||
const h5_int64_t lenName = 64;
|
||||
char datasetName[lenName];
|
||||
h5part_int64_t datasetType;
|
||||
h5part_int64_t datasetNElems;
|
||||
h5_int64_t datasetType;
|
||||
h5_int64_t datasetNElems;
|
||||
|
||||
H5PartSetStep(file,0);
|
||||
for (h5part_int64_t i=0; i < nds; i++) {
|
||||
for (h5_int64_t i=0; i < nds; i++) {
|
||||
status = H5PartGetDatasetInfo(file, i, datasetName, lenName,
|
||||
&datasetType, &datasetNElems);
|
||||
|
||||
@@ -269,7 +269,7 @@ int main(int argc,char *argv[]){
|
||||
else {
|
||||
printf("datasetName: %s, type: %lld, nElements: %lld ",
|
||||
datasetName, datasetType, datasetNElems);
|
||||
if (datasetType == H5PART_INT64) {
|
||||
if (datasetType == H5_INT64_T) {
|
||||
printf("H5PPART_INT64 \n");
|
||||
}
|
||||
else {
|
||||
|
||||
+10
-10
@@ -17,11 +17,11 @@ using namespace std;
|
||||
|
||||
int ReadFile(const string fn){
|
||||
char name[64];
|
||||
H5PartFile *file;
|
||||
h5_file_t *file;
|
||||
int i,nt,nds;
|
||||
cout << "Open " << fn << endl;
|
||||
|
||||
file= H5PartOpenFile(fn.c_str(),H5PART_READ);
|
||||
file= H5PartOpenFile(fn.c_str(),H5_O_RDONLY);
|
||||
|
||||
nt=H5PartGetNumSteps(file);
|
||||
H5PartSetStep(file,0);
|
||||
@@ -39,7 +39,7 @@ int ReadFile(const string fn){
|
||||
|
||||
for (int steps=0; steps<nt; steps++) {
|
||||
H5PartSetStep(file,steps);
|
||||
h5part_int64_t n = H5PartGetNumParticles(file);
|
||||
h5_int64_t n = H5PartGetNumParticles(file);
|
||||
cout << "number of particles this step =" << n << endl;
|
||||
double *x=new double[n];
|
||||
double *y=new double[n];
|
||||
@@ -47,13 +47,13 @@ int ReadFile(const string fn){
|
||||
double *px=new double[n];
|
||||
double *py=new double[n];
|
||||
double *pz=new double[n];
|
||||
h5part_int64_t *id=new h5part_int64_t[n];
|
||||
h5_int64_t *id=new h5_int64_t[n];
|
||||
|
||||
H5PartReadParticleStep(file,steps,x,y,z,px,py,pz,id);
|
||||
|
||||
double sumx = 0.0;
|
||||
double sumpz = 0.0;
|
||||
for (h5part_int64_t i=0; i<n; i++) {
|
||||
for (h5_int64_t i=0; i<n; i++) {
|
||||
sumx += x[i];
|
||||
sumpz += pz[i];
|
||||
}
|
||||
@@ -74,14 +74,14 @@ int ReadFile(const string fn){
|
||||
}
|
||||
|
||||
int WriteFile(const string fn){
|
||||
H5PartFile *file;
|
||||
h5_file_t *file;
|
||||
int i,t;
|
||||
h5part_int64_t n;
|
||||
h5_int64_t n;
|
||||
const int nt = 5;
|
||||
const h5part_int64_t np = 1024*1024;
|
||||
const h5_int64_t np = 1024*1024;
|
||||
cout << "Open " << fn << endl;
|
||||
|
||||
file= H5PartOpenFile(fn.c_str(),H5PART_WRITE);
|
||||
file= H5PartOpenFile(fn.c_str(),H5_O_WRONLY);
|
||||
|
||||
double *x=new double[np];
|
||||
double *y=new double[np];
|
||||
@@ -89,7 +89,7 @@ int WriteFile(const string fn){
|
||||
double *px=new double[np];
|
||||
double *py=new double[np];
|
||||
double *pz=new double[np];
|
||||
h5part_int64_t *id=new h5part_int64_t[np];
|
||||
h5_int64_t *id=new h5_int64_t[np];
|
||||
|
||||
H5PartSetNumParticles(file,np); // sets number of particles in simulation
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ INC = $(HDFINC) $(MPIINC) $(H5INC)
|
||||
|
||||
|
||||
# What to build... make install will place these files in the $(prefix)/bin directory.
|
||||
bin_PROGRAMS = @TUTARGET@
|
||||
bin_PROGRAMS = @TPTARGET@
|
||||
|
||||
# Some useful scripts that I wish to place in the $(prefix)/bin directory.
|
||||
bin_SCRIPTS =
|
||||
|
||||
Reference in New Issue
Block a user