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

adds writeStateComponent method for abstract_particle_set

parent 69024276
No related branches found
No related tags found
No related merge requests found
......@@ -222,14 +222,15 @@ class abstract_particle_set
return EXIT_SUCCESS;
}
int writeStateTriplet(
int writeStateChunk(
const int i0,
const int contiguous_state_chunk,
particles_output_sampling_hdf5<partsize_t, particle_rnumber, 3> *particle_sample_writer,
const std::string species_name,
const std::string field_name,
const int iteration)
{
TIMEZONE("abstract_particle_set::writeStateTriplet");
TIMEZONE("abstract_particle_set::writeStateChunk");
assert(i0 >= 0);
assert(i0 <= this->getStateSize()-3);
// set file layout
......@@ -237,7 +238,7 @@ class abstract_particle_set
// allocate position array
std::unique_ptr<particle_rnumber[]> xx = this->extractFromParticleState(0, 3);
// allocate temporary array
std::unique_ptr<particle_rnumber[]> yy = this->extractFromParticleState(i0, i0+3);
std::unique_ptr<particle_rnumber[]> yy = this->extractFromParticleState(i0, i0+contiguous_state_chunk);
particle_sample_writer->template save_dataset<3>(
species_name,
field_name,
......@@ -252,6 +253,38 @@ class abstract_particle_set
delete[] xx.release();
return EXIT_SUCCESS;
}
int writeStateTriplet(
const int i0,
particles_output_sampling_hdf5<partsize_t, particle_rnumber, 3> *particle_sample_writer,
const std::string species_name,
const std::string field_name,
const int iteration)
{
TIMEZONE("abstract_particle_set::writeStateTriplet");
return this->writeStateChunk(
i0, 3,
particle_sample_writer,
species_name,
field_name,
iteration);
}
int writeStateComponent(
const int i0,
particles_output_sampling_hdf5<partsize_t, particle_rnumber, 3> *particle_sample_writer,
const std::string species_name,
const std::string field_name,
const int iteration)
{
TIMEZONE("abstract_particle_set::writeStateComponent");
return this->writeStateChunk(
i0, 1,
particle_sample_writer,
species_name,
field_name,
iteration);
}
};
#endif//ABSTRACT_PARTICLE_SET_HPP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment