Commit 82c594c1 authored by Christina Siegerist's avatar Christina Siegerist

Made the new api changes again. They were probably lost in overlapping

commits.
parent c96b859f
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
//h5part specific //h5part specific
#include <H5Part.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -82,11 +81,11 @@ avth5partFileFormat::avth5partFileFormat(const char *filename) ...@@ -82,11 +81,11 @@ avth5partFileFormat::avth5partFileFormat(const char *filename)
pointvarnames.resize(npointvars); pointvarnames.resize(npointvars);
cout << "constructor: nvariables: " << npointvars << "\n"; cout << "constructor: nvariables: " << npointvars << "\n";
char name[64]; char name[128];
int status; h5part_int64_t status;
for (j=0; j < npointvars; j++){ for (j=0; j < npointvars; j++){
status = H5PartGetDatasetName(file,j, name,64); status = H5PartGetDatasetName(file,j, name,128);
if (status != 1){ if (status != H5PART_SUCCESS){
EXCEPTION1(VisItException, "could not read a variable name"); EXCEPTION1(VisItException, "could not read a variable name");
} }
pointvarnames[j] = name; pointvarnames[j] = name;
...@@ -110,13 +109,13 @@ avth5partFileFormat::avth5partFileFormat(const char *filename) ...@@ -110,13 +109,13 @@ avth5partFileFormat::avth5partFileFormat(const char *filename)
int int
avth5partFileFormat::GetNTimesteps(void) avth5partFileFormat::GetNTimesteps(void)
{ {
int nt; h5part_int64_t nt;
H5PartFile *file; H5PartFile *file;
file = H5PartOpenFile(fname.c_str(),H5PART_READ); file = H5PartOpenFile(fname.c_str(),H5PART_READ);
H5PartSetStep(file,0); H5PartSetStep(file,0);
nt=H5PartGetNumSteps(file); /* get number of steps in file */ nt=H5PartGetNumSteps(file); /* get number of steps in file */
H5PartCloseFile(file); H5PartCloseFile(file);
return nt; return (int) nt;
} }
...@@ -333,14 +332,15 @@ avth5partFileFormat::GetMesh(int timestate, int domain, const char *meshname) ...@@ -333,14 +332,15 @@ avth5partFileFormat::GetMesh(int timestate, int domain, const char *meshname)
#ifdef PARALLEL_IO #ifdef PARALLEL_IO
nprocs = PAR_Size(); nprocs = PAR_Size();
#endif #endif
H5PartSetStep(file,timestate); H5PartSetStep(file,timestate);
//points //points
tnpoints= (int) H5PartGetNumParticles(file); tnpoints= (int) H5PartGetNumParticles(file);
unsigned long long idStart = ((int)(tnpoints/nprocs))*domain; h5part_int64_t idStart = (( h5part_int64_t)(tnpoints/nprocs))*domain;
unsigned long long idEnd; h5part_int64_t idEnd;
if (domain < nprocs-1) if (domain < nprocs-1)
idEnd = ((unsigned long int)(tnpoints/nprocs))*(domain+1); idEnd = ((h5part_int64_t)(tnpoints/nprocs))*(domain+1);
else if (domain == nprocs - 1) else if (domain == nprocs - 1)
idEnd = tnpoints; idEnd = tnpoints;
...@@ -358,21 +358,21 @@ avth5partFileFormat::GetMesh(int timestate, int domain, const char *meshname) ...@@ -358,21 +358,21 @@ avth5partFileFormat::GetMesh(int timestate, int domain, const char *meshname)
EXCEPTION1(VisItException, "npoints is zero"); EXCEPTION1(VisItException, "npoints is zero");
points.resize(npoints*nspace); points.resize(npoints*nspace);
double *x, *y, *z; h5part_float64_t *x, *y, *z;
x = (double *) malloc(sizeof(double)*npoints); x = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
y = (double *) malloc(sizeof(double)*npoints); y = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
z = (double *) malloc(sizeof(double)*npoints); z = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
int status = 0; h5part_int64_t status = H5PART_SUCCESS;
status = H5PartReadDataFloat64(file, "x", x); status = H5PartReadDataFloat64(file, "x", x);
if (status != 1) if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read x coordinates"); EXCEPTION1(VisItException, "Could not read x coordinates");
status = H5PartReadDataFloat64(file, "y", y); status = H5PartReadDataFloat64(file, "y", y);
if (status != 1) if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read y coordinates"); EXCEPTION1(VisItException, "Could not read y coordinates");
status = H5PartReadDataFloat64(file, "z", z); status = H5PartReadDataFloat64(file, "z", z);
if (status != 1) if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read z coordinates"); EXCEPTION1(VisItException, "Could not read z coordinates");
for (long int i = 0; i < npoints; i++){ for (long int i = 0; i < npoints; i++){
points[nspace*i] = (float) x[i]; points[nspace*i] = (float) x[i];
...@@ -464,8 +464,8 @@ avth5partFileFormat::GetVar(int timestate, int domain, const char *varname) ...@@ -464,8 +464,8 @@ avth5partFileFormat::GetVar(int timestate, int domain, const char *varname)
if (!file) if (!file)
EXCEPTION1(InvalidFilesException, fname.c_str()); EXCEPTION1(InvalidFilesException, fname.c_str());
int status; h5part_int64_t status;
long int tnpoints, npoints; h5part_int64_t tnpoints, npoints;
int npointvars; int npointvars;
int nspace = 3; int nspace = 3;
int nprocs = 1; int nprocs = 1;
...@@ -475,44 +475,44 @@ avth5partFileFormat::GetVar(int timestate, int domain, const char *varname) ...@@ -475,44 +475,44 @@ avth5partFileFormat::GetVar(int timestate, int domain, const char *varname)
H5PartSetStep(file,timestate); H5PartSetStep(file,timestate);
//points //points
tnpoints= (long int) H5PartGetNumParticles(file); tnpoints= H5PartGetNumParticles(file);
//point vars //point vars
char name[64]; char name[64];
long long *idvar; h5part_int64_t *idvar;
double *data; double *data;
unsigned long long idStart = ((int)(tnpoints/nprocs))*domain; h5part_int64_t idStart = ((h5part_int64_t)(tnpoints/nprocs))*domain;
unsigned long long idEnd; h5part_int64_t idEnd;
if (domain < nprocs-1) if (domain < nprocs-1)
idEnd = ((unsigned long int)(tnpoints/nprocs))*(domain+1); idEnd = ((h5part_int64_t)(tnpoints/nprocs))*(domain+1);
else if (domain == nprocs - 1) else if (domain == nprocs - 1)
idEnd = tnpoints; idEnd = (h5part_int64_t)tnpoints;
H5PartSetView(file,idStart,idEnd); H5PartSetView(file,idStart,idEnd);
npoints= (int) H5PartGetNumParticles(file); npoints= H5PartGetNumParticles(file);
cout << "GetVar: npoints for domain " << domain << ": " << npoints << "\n"; cout << "GetVar: npoints for domain " << domain << ": " << npoints << "\n";
for (int j=0; j < pointvarnames.size(); j++){ for (size_t j=0; j < (size_t)(pointvarnames.size()); j++){
status = H5PartGetDatasetName(file,j, name,64); status = H5PartGetDatasetName(file,j, name,64);
if (pointvarnames[j] == name) { if (pointvarnames[j] == name) {
if (strstr(name, "id") != NULL){ if (strstr(name, "id") != NULL){
idvar = (long long *) malloc(sizeof(long long)*npoints); idvar = (h5part_int64_t *) malloc(sizeof(h5part_int64_t)*npoints);
status = H5PartReadDataInt64(file, name, idvar); status = H5PartReadDataInt64(file, name, idvar);
if (status != 1) if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read dataset"); EXCEPTION1(VisItException, "Could not read dataset");
pointvars[j].resize(npoints); pointvars[j].resize(npoints);
for (long int i=0; i < npoints; i++){ for (size_t i=0; i < (size_t) npoints; i++){
pointvars[j][i] = (float) idvar[i]; pointvars[j][i] = (float) idvar[i];
} }
if (idvar != NULL) if (idvar != NULL)
free(idvar); free(idvar);
} else { } else {
data = (double *) malloc(sizeof(double)*npoints); data = (h5part_float64_t *) malloc(sizeof(h5part_float64_t)*npoints);
status = H5PartReadDataFloat64(file, name, data); status = H5PartReadDataFloat64(file, name, data);
if (status != 1) if (status != H5PART_SUCCESS)
EXCEPTION1(VisItException, "Could not read dataset"); EXCEPTION1(VisItException, "Could not read dataset");
pointvars[j].resize(npoints); pointvars[j].resize(npoints);
for (long int i=0; i < npoints; i++){ for (size_t i=0; i < (size_t)(npoints); i++){
pointvars[j][i] = (float) data[i]; pointvars[j][i] = (float) data[i];
} }
if (data != NULL) if (data != NULL)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define AVT_h5part_FILE_FORMAT_H #define AVT_h5part_FILE_FORMAT_H
#include <avtMTMDFileFormat.h> #include <avtMTMDFileFormat.h>
#include <H5Part.hh> #include <H5Part.h>
#include <vector> #include <vector>
#include <string> #include <string>
......
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