diff --git a/src/Diagnostic/DiagnosticParticleList.cpp b/src/Diagnostic/DiagnosticParticleList.cpp index 31daeed72..bdbf45ff2 100755 --- a/src/Diagnostic/DiagnosticParticleList.cpp +++ b/src/Diagnostic/DiagnosticParticleList.cpp @@ -449,33 +449,3 @@ void DiagnosticParticleList::run( SmileiMPI *smpi, VectorPatch &vecPatches, int #pragma omp barrier } -template -void DiagnosticParticleList::fill_buffer( VectorPatch &vecPatches, size_t iprop, vector &buffer ) -{ - unsigned int patch_nParticles, i, j, nPatches=vecPatches.size(); - vector *property = NULL; - - #pragma omp barrier - if( has_filter ) { - #pragma omp for schedule(runtime) - for( unsigned int ipatch=0 ; ipatchgetProperty( iprop, property ); - i=0; - j=patch_start[ipatch]; - while( inumberOfParticles(); - p->getProperty( iprop, property ); - copy( property->begin(), property->begin() + patch_nParticles, buffer.begin() + patch_start[ipatch] ); - } - } -} diff --git a/src/Diagnostic/DiagnosticParticleList.h b/src/Diagnostic/DiagnosticParticleList.h index acae40184..40b2f3387 100755 --- a/src/Diagnostic/DiagnosticParticleList.h +++ b/src/Diagnostic/DiagnosticParticleList.h @@ -52,8 +52,36 @@ public : virtual void writeOther( VectorPatch &, size_t, H5Space *, H5Space * ) {}; //! Fills a buffer with the required particle property - template void fill_buffer( VectorPatch &vecPatches, size_t iprop, std::vector &buffer ); - + template void fill_buffer( VectorPatch &vecPatches, size_t iprop, std::vector &buffer ) + { + const size_t nPatches = vecPatches.size(); + std::vector *property = NULL; + + #pragma omp barrier + if( has_filter ) { + #pragma omp for schedule(runtime) + for( unsigned int ipatch=0 ; ipatchgetProperty( iprop, property ); + size_t i=0; + size_t j=patch_start[ipatch]; + while( i < patch_nParticles ) { + buffer[j] = ( *property )[patch_selection[ipatch][i]]; + i++; + j++; + } + } + } else { + #pragma omp for schedule(runtime) + for( unsigned int ipatch=0 ; ipatchnumberOfParticles(); + p->getProperty( iprop, property ); + std::copy( property->begin(), property->begin() + patch_nParticles, buffer.begin() + patch_start[ipatch] ); + } + } + }; + //! Write a dataset virtual void write_scalar_uint64( H5Write * location, std::string name, uint64_t &, H5Space *file_space, H5Space *mem_space, unsigned int unit_type ) = 0; virtual void write_scalar_short ( H5Write * location, std::string name, short &, H5Space *file_space, H5Space *mem_space, unsigned int unit_type ) = 0;