@@ -32,6 +32,14 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
3232 }
3333}
3434
35+ struct FilterPositiveID {
36+ template <typename P>
37+ AMREX_GPU_HOST_DEVICE
38+ int operator () (const P& p) const {
39+ return p.id () > 0 ;
40+ }
41+ };
42+
3543template <typename ParticleType, int NArrayReal, int NArrayInt,
3644 template <class > class Allocator , class CellAssignor >
3745void
@@ -77,10 +85,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
7785
7886 WriteBinaryParticleData (dir, name, write_real_comp, write_int_comp,
7987 tmp_real_comp_names, tmp_int_comp_names,
80- [=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p) -> int
81- {
82- return p.id () > 0 ;
83- }, true );
88+ FilterPositiveID{}, true );
8489}
8590
8691template <typename ParticleType, int NArrayReal, int NArrayInt,
@@ -111,10 +116,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
111116
112117 WriteBinaryParticleData (dir, name, write_real_comp, write_int_comp,
113118 real_comp_names, int_comp_names,
114- [=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
115- {
116- return p.id () > 0 ;
117- });
119+ FilterPositiveID{});
118120}
119121
120122template <typename ParticleType, int NArrayReal, int NArrayInt,
@@ -141,10 +143,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
141143 WriteBinaryParticleData (dir, name,
142144 write_real_comp, write_int_comp,
143145 real_comp_names, int_comp_names,
144- [=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
145- {
146- return p.id () > 0 ;
147- });
146+ FilterPositiveID{});
148147}
149148
150149template <typename ParticleType, int NArrayReal, int NArrayInt,
@@ -177,10 +176,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
177176 WriteBinaryParticleData (dir, name,
178177 write_real_comp, write_int_comp,
179178 real_comp_names, int_comp_names,
180- [=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
181- {
182- return p.id () > 0 ;
183- });
179+ FilterPositiveID{});
184180}
185181
186182template <typename ParticleType, int NArrayReal, int NArrayInt,
@@ -213,10 +209,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
213209
214210 WriteBinaryParticleData (dir, name, write_real_comp, write_int_comp,
215211 real_comp_names, int_comp_names,
216- [=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
217- {
218- return p.id () > 0 ;
219- });
212+ FilterPositiveID{});
220213}
221214
222215template <typename ParticleType, int NArrayReal, int NArrayInt,
@@ -234,10 +227,7 @@ WritePlotFile (const std::string& dir, const std::string& name,
234227 WriteBinaryParticleData (dir, name,
235228 write_real_comp, write_int_comp,
236229 real_comp_names, int_comp_names,
237- [=] AMREX_GPU_HOST_DEVICE (const SuperParticleType& p)
238- {
239- return p.id () > 0 ;
240- });
230+ FilterPositiveID{});
241231}
242232
243233template <typename ParticleType, int NArrayReal, int NArrayInt,
0 commit comments