diff --git a/include/particle_generator.hh b/include/particle_generator.hh index 56c69f4..956ed28 100644 --- a/include/particle_generator.hh +++ b/include/particle_generator.hh @@ -37,7 +37,7 @@ const std::vector> second_lattice_shift = }; template -void initialize_lattice( container& particles, lattice lattice_type, const bool b64reals, const bool b64ids, const field_t& field ){ +void initialize_lattice( container& particles, lattice lattice_type, const bool b64reals, const bool b64ids, const size_t IDoffset, const field_t& field ){ // number of modes present in the field const size_t num_p_in_load = field.local_size(); // unless SC lattice is used, particle number is a multiple of the number of modes (=num_p_in_load): @@ -50,9 +50,9 @@ void initialize_lattice( container& particles, lattice lattice_type, const bool for( size_t k=0; kwrite_species_as(this_species) == output_type::particles) ? true : false; + // somewhat arbitrarily, start baryon particle IDs from 2**31 if we have 32bit and from 2**56 if we have 64 bits + size_t IDoffset = (this_species == cosmo_species::baryon)? ((the_output_plugin->has_64bit_ids())? 1ul<<56 : 1ul<<31): 0 ; + // if output plugin wants particles, then we need to store them, along with their IDs if( the_output_plugin->write_species_as( this_species ) == output_type::particles ) { // allocate particle structure and generate particle IDs - particle::initialize_lattice( particles, lattice_type, the_output_plugin->has_64bit_reals(), the_output_plugin->has_64bit_ids(), tmp ); + particle::initialize_lattice( particles, lattice_type, the_output_plugin->has_64bit_reals(), the_output_plugin->has_64bit_ids(), IDoffset, tmp ); } // write out positions