@@ -49,10 +49,16 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
4949 TH3D* h3=NULL ;
5050
5151 VecDev_t<double > _xvec, _yvec, _zvec;
52+ hydra::multiarray<double ,8 ,hydra::host::sys_t > _vec_map;
53+
5254 // efield vecs
5355 VecDev_t<double > _xvec_ef, _yvec_ef, _zvec_ef;
56+
57+ hydra::multiarray<double ,3 ,hydra::host::sys_t > _vec_ef;
5458 VecDev_t<double > efieldvecx, efieldvecy, efieldvecz;
5559 // wfield vecs
60+
61+ hydra::multiarray<double ,3 ,hydra::host::sys_t > _vec_wf;
5662 VecDev_t<double > _xvec_wf, _yvec_wf, _zvec_wf;
5763 VecDev_t<double > wfieldvecx, wfieldvecy, wfieldvecz;
5864
@@ -67,7 +73,6 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
6773 double _xmin=0 , _xmax=0 , _ymin=0 , _ymax=0 , _zmin=0 , _zmax=0 ;
6874 // load physics maps
6975
70-
7176 bool multimap=true ;
7277 // get physicsmap path
7378 if (root[" PhysicsMaps" ].exists (" map" )){
@@ -81,6 +86,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
8186
8287 pm.fillspacepoints <VecDev_t<double > >(_xvec,_yvec,_zvec);
8388 pm.fillallquantities <VecDev_t<double > >(efieldvecx,efieldvecy,efieldvecz,emobvec,hmobvec,wfieldvecx,wfieldvecy,wfieldvecz);
89+ pm.fillallquantities <hydra::multiarray<double ,8 ,hydra::host::sys_t > >(_vec_map);
8490
8591 _xmin = *(pm.getx ().begin ());
8692 _xmax = *(pm.getx ().rbegin ());
@@ -110,6 +116,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
110116
111117 efieldm.fillspacepoints <VecDev_t<double > >(_xvec_ef,_yvec_ef,_zvec_ef);
112118 efieldm.fillvector <VecDev_t<double > >(efieldvecx,efieldvecy,efieldvecz);
119+ efieldm.fillvector < hydra::multiarray<double ,3 ,hydra::host::sys_t > >(_vec_ef);
113120
114121 for (auto cf:configlist){
115122 if (std::get<bool >(cf.get (" plot" ))){
@@ -126,6 +133,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
126133 wfieldm.prepare ();
127134 wfieldm.fillspacepoints <VecDev_t<double > >(_xvec_wf,_yvec_wf,_zvec_wf);
128135 wfieldm.fillvector <VecDev_t<double > >(wfieldvecx,wfieldvecy,wfieldvecz);
136+ wfieldm.fillvector < hydra::multiarray<double ,3 ,hydra::host::sys_t > >(_vec_wf);
129137
130138 std::string emobmap_path=root[" PhysicsMaps" ][" emob" ];
131139 maps::physmap<double ,4 > emobm (emobmap_path); // Electron mobility is a scalar
@@ -165,7 +173,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
165173
166174 RunningStateHost_t data_dinit;
167175 if (tmpfile==DEFAULT_PATH) data_dinit = loaddata::getDummy ( std::get<size_t >(configlist[0 ].get (" nparticles" )),
168- std::get<double >(configlist[0 ].get (" length" )));
176+ std::get<double >(configlist[0 ].get (" length" )),std::get< size_t >(configlist[ 0 ]. get ( " group " )) );
169177 else data_dinit=loaddata::loadfile (tmpfile);
170178
171179
@@ -178,6 +186,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
178186 auto bunchsize = std::get<size_t >(cf.get (" bunchsize" ));
179187 auto nparticles = std::get<size_t >(cf.get (" nparticles" ));
180188 auto nsteps = std::get<size_t >(cf.get (" nsteps" ));
189+ auto group = std::get<size_t >(cf.get (" group" ));
181190 auto path = std::get<std::string>(cf.get (" path" ));
182191 auto nickname = std::get<std::string>(cf.get (" nickname" ));
183192 auto plot = std::get<bool >(cf.get (" plot" ));
@@ -191,13 +200,11 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
191200 auto amp = std::get<double >(cf.get (" amp" ));
192201 auto length = std::get<double >(cf.get (" length" ));
193202
194- // cf.Print();
195-
196203 auto start = std::chrono::high_resolution_clock::now ();
197204 if (path!=tmpfile){
198205 tmpfile=path;
199- if (tmpfile==DEFAULT_PATH) data_dinit=loaddata::getDummy (nparticles,length);
200- else data_dinit=loaddata::loadfile (tmpfile);
206+ if (tmpfile==DEFAULT_PATH) data_dinit=loaddata::getDummy (nparticles,length,group );
207+ else data_dinit=loaddata::loadfile (tmpfile,group );
201208 }
202209
203210 // create running state
@@ -231,7 +238,8 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
231238 size_t rest = nsteps%bunchsize;
232239
233240 INFO_LINE (" Simulation " <<sim<<" (" <<nickname<<" )" )
234- INFO_LINE (" Nparticles(dep. charge): " <<nparticles<<" (" << (double )(nparticles)*HCHARGE/2 . <<" C)" << " , Temperature " << temperature << " , timestep " <<timestep)
241+ if (group>1 ) INFO_LINE (" Particles are grouped in " << nparticles <<" bunches of " <<group);
242+ INFO_LINE (" Nparticles(dep. charge): " <<nparticles*group<<" (" << (double )(nparticles*group)*HCHARGE/2 . <<" C)" << " , Temperature " << temperature << " , timestep " <<timestep)
235243 INFO_LINE (" Nsteps: " <<nsteps)
236244// if(ampexp[sim]!=0.0) INFO_LINE("Amp_exp "<< cf.get("amp").getd() << ", Sigma_exp "<<cf.get("sig").getd())
237245 if (xshift!=0.0 ) INFO_LINE (" shifted in x by " <<xshift<< " micron" )
@@ -271,13 +279,13 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
271279 Generator.Uniform (0.0 , PI, data_d.begin (_tc_angle_2), data_d.end (_tc_angle_2));
272280
273281
274- hydra::for_each (data_d, evolve::ApplyRamo_multi (niter,
282+ hydra::for_each (data_d, evolve::make_RamoCurrent (niter,
275283 timestep,
276284 temperature_nmob,
277- _xvec_ef, _yvec_ef, _zvec_ef, efieldvecx, efieldvecy, efieldvecz ,
285+ _xvec_ef, _yvec_ef, _zvec_ef, _vec_ef ,
278286 _xvec_emob, _yvec_emob, _zvec_emob, emobvec,
279287 _xvec_hmob, _yvec_hmob, _zvec_hmob, hmobvec,
280- _xvec_wf, _yvec_wf, _zvec_wf, wfieldvecx, wfieldvecy, wfieldvecz ));
288+ _xvec_wf, _yvec_wf, _zvec_wf, _vec_wf ));
281289
282290 // reducing data
283291 auto int_curr=HYDRA_EXTERNAL_NS::thrust::transform_reduce (data_d.begin (_tc_charge,_tc_isin,_tc_curr,_tc_issec),data_d.end (_tc_charge,_tc_isin,_tc_curr,_tc_issec),analysis::SelectChargeAndSec (), ReducedTuple_init,analysis::SumTuples ());
@@ -295,13 +303,14 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
295303
296304
297305 if (niter==nsteps-1 ) break ;
298-
299- hydra::for_each (data_d, evolve::Evolve_multi (niter,
300- timestep,
301- _xvec_ef, _yvec_ef, _zvec_ef, efieldvecx, efieldvecy, efieldvecz,
302- _xvec_emob, _yvec_emob, _zvec_emob, emobvec,
303- _xvec_hmob, _yvec_hmob, _zvec_hmob, hmobvec,
304- _xmin,_xmax,_ymin,_ymax,_zmin,_zmax));
306+
307+ hydra::for_each (data_d, evolve::make_Evolution (niter,
308+ timestep,
309+ _xvec_ef, _yvec_ef, _zvec_ef, _vec_ef,
310+ _xvec_emob, _yvec_emob, _zvec_emob, emobvec,
311+ _xvec_hmob, _yvec_hmob, _zvec_hmob, hmobvec,
312+ _xmin,_xmax,_ymin,_ymax,_zmin,_zmax));
313+
305314 niter++;
306315
307316
@@ -320,13 +329,10 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
320329 Generator.Uniform (0.0 , PI, data_d.begin (_tc_angle_2), data_d.end (_tc_angle_2));
321330
322331
323- hydra::for_each (data_d, evolve::ApplyRamo (niter,
332+ hydra::for_each (data_d, evolve::make_RamoCurrent (niter,
324333 timestep,
325334 temperature_nmob,
326- _xvec, _yvec, _zvec,
327- efieldvecx, efieldvecy, efieldvecz,
328- emobvec,hmobvec,
329- wfieldvecx, wfieldvecy, wfieldvecz));
335+ _xvec, _yvec, _zvec, _vec_map));
330336
331337 // reducing data
332338 auto int_curr=HYDRA_EXTERNAL_NS::thrust::transform_reduce (data_d.begin (_tc_charge,_tc_isin,_tc_curr,_tc_issec),data_d.end (_tc_charge,_tc_isin,_tc_curr,_tc_issec),analysis::SelectChargeAndSec (), ReducedTuple_init,analysis::SumTuples ());
@@ -345,11 +351,10 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
345351
346352 if (niter==nsteps-1 ) break ;
347353
348- hydra::for_each (data_d, evolve::Evolve (niter,
349- timestep,
350- _xvec, _yvec, _zvec,
351- efieldvecx, efieldvecy, efieldvecz,
352- emobvec,hmobvec));
354+ hydra::for_each (data_d, evolve::make_Evolution (niter,
355+ timestep,
356+ _xvec, _yvec, _zvec, _vec_map));
357+
353358 niter++;
354359
355360
0 commit comments