Skip to Content.
Sympa Menu

h5part - Re: [H5part] Question on appending particle file

h5part AT

Subject: H5Part development and discussion

List archive

Re: [H5part] Question on appending particle file

Chronological Thread 
  • From: Achim Gsell <achim.gsell AT>
  • To: Jozsef Bakosi <jbakosi AT>
  • Cc: h5part AT
  • Subject: Re: [H5part] Question on appending particle file
  • Date: Thu, 11 Aug 2016 23:51:58 +0200

Hi Jozsef

> On 11 Aug 2016, at 23:23, Jozsef Bakosi <jbakosi AT> wrote:
> Hello,
> I have successfully been using H5Part to write particle data to several
> time steps.
> Now I would like to do the same but without keeping the file open during
> time
> stepping, so I'm attempting to open the file using APPEND, but get the
> following
> error message when I try to call H5PartWriteDataFloat64() with a nonzero
> error
> code:
> E: H5PartWriteDataFloat64: Timegroup <= 0.
> Here is the sequence that I follow:
> I create the file once during initialization:
> f = H5PartOpenFileParallel( filename, H5PART_WRITE, MPI_COMM_WORLD);
> H5PartWriteFileAttribString( f, "Origin", "somestring" );
> H5PartCloseFile( f );
> Then every iteration I repeat:
> 1. Write Time stamp:
> f = H5PartOpenFileParallel( filename, H5PART_APPEND, MPI_COMM_WORLD);
> H5PartSetStep( f, it );
> H5PartSetNumParticles( f, npar );
> H5PartCloseFile( f );

In 1. you create a new step, but that’s it. The H5PartSetNumParticles() call
creates a view on the data, but does not create any dataset. The view will be
reseted while closing the file.

> 2. Write particle coordinates:
> f = H5PartOpenFileParallel( filename, H5PART_APPEND, MPI_COMM_WORLD);
> H5PartWriteDataFloat64( f, "x", xdata );
> H5PartWriteDataFloat64( f, "y", ydata );
> H5PartWriteDataFloat64( f, "z", zdata );
> H5PartCloseFile( f );

This doesn’t work. H5PartOpenFileParallel() does *not* set the time-step to
the latest (but empty in your case) step in append mode. Append mode does not
mean, you can append new steps only! In append mode you cannot overwrite
existing datasets or attributes. But you can add datasets or attributes to
existing steps *and* you can add new steps.

Best regards


Archive powered by MHonArc 2.6.19.

Top of Page