Skip to content
Snippets Groups Projects
Commit 9180c2f2 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

prepare particle io for using .h5

parent 54423959
Branches
Tags 1.2.0
No related merge requests found
...@@ -634,7 +634,7 @@ void slab_field_particles<rnumber>::read(H5::H5File *dfile) ...@@ -634,7 +634,7 @@ void slab_field_particles<rnumber>::read(H5::H5File *dfile)
} }
template <class rnumber> template <class rnumber>
void slab_field_particles<rnumber>::write(H5::H5File *dfile) void slab_field_particles<rnumber>::write(H5::H5File *dfile, bool write_rhs)
{ {
this->synchronize(); this->synchronize();
if (this->fs->rd->myrank == 0) if (this->fs->rd->myrank == 0)
...@@ -645,6 +645,8 @@ void slab_field_particles<rnumber>::write(H5::H5File *dfile) ...@@ -645,6 +645,8 @@ void slab_field_particles<rnumber>::write(H5::H5File *dfile)
ofile0 = fopen(full_name, "wb"); ofile0 = fopen(full_name, "wb");
fwrite((void*)this->state, sizeof(double), this->array_size, ofile0); fwrite((void*)this->state, sizeof(double), this->array_size, ofile0);
fclose(ofile0); fclose(ofile0);
if (write_rhs)
{
sprintf(full_name, "%s_rhs_i%.5x", this->name, this->iteration); sprintf(full_name, "%s_rhs_i%.5x", this->name, this->iteration);
ofile1 = fopen(full_name, "wb"); ofile1 = fopen(full_name, "wb");
for (int i=0; i<this->integration_steps; i++) for (int i=0; i<this->integration_steps; i++)
...@@ -654,6 +656,7 @@ void slab_field_particles<rnumber>::write(H5::H5File *dfile) ...@@ -654,6 +656,7 @@ void slab_field_particles<rnumber>::write(H5::H5File *dfile)
fclose(ofile1); fclose(ofile1);
} }
} }
}
template <class rnumber> template <class rnumber>
void slab_field_particles<rnumber>::rFFTW_to_buffered(rnumber *src, rnumber *dst) void slab_field_particles<rnumber>::rFFTW_to_buffered(rnumber *src, rnumber *dst)
......
...@@ -133,8 +133,8 @@ class slab_field_particles ...@@ -133,8 +133,8 @@ class slab_field_particles
void rFFTW_to_buffered(rnumber *src, rnumber *dst); void rFFTW_to_buffered(rnumber *src, rnumber *dst);
/* generic methods, should work for all children of this class */ /* generic methods, should work for all children of this class */
void read(H5::H5File *dfile); void read(H5::H5File *dfile = NULL);
void write(H5::H5File *dfile); void write(H5::H5File *dfile = NULL, bool write_rhs = true);
/* solver stuff */ /* solver stuff */
void step(); void step();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment