@@ -49,10 +49,16 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
49
49
TH3D* h3=NULL ;
50
50
51
51
VecDev_t<double > _xvec, _yvec, _zvec;
52
+ hydra::multiarray<double ,8 ,hydra::host::sys_t > _vec_map;
53
+
52
54
// efield vecs
53
55
VecDev_t<double > _xvec_ef, _yvec_ef, _zvec_ef;
56
+
57
+ hydra::multiarray<double ,3 ,hydra::host::sys_t > _vec_ef;
54
58
VecDev_t<double > efieldvecx, efieldvecy, efieldvecz;
55
59
// wfield vecs
60
+
61
+ hydra::multiarray<double ,3 ,hydra::host::sys_t > _vec_wf;
56
62
VecDev_t<double > _xvec_wf, _yvec_wf, _zvec_wf;
57
63
VecDev_t<double > wfieldvecx, wfieldvecy, wfieldvecz;
58
64
@@ -67,7 +73,6 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
67
73
double _xmin=0 , _xmax=0 , _ymin=0 , _ymax=0 , _zmin=0 , _zmax=0 ;
68
74
// load physics maps
69
75
70
-
71
76
bool multimap=true ;
72
77
// get physicsmap path
73
78
if (root[" PhysicsMaps" ].exists (" map" )){
@@ -81,6 +86,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
81
86
82
87
pm.fillspacepoints <VecDev_t<double > >(_xvec,_yvec,_zvec);
83
88
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);
84
90
85
91
_xmin = *(pm.getx ().begin ());
86
92
_xmax = *(pm.getx ().rbegin ());
@@ -110,6 +116,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
110
116
111
117
efieldm.fillspacepoints <VecDev_t<double > >(_xvec_ef,_yvec_ef,_zvec_ef);
112
118
efieldm.fillvector <VecDev_t<double > >(efieldvecx,efieldvecy,efieldvecz);
119
+ efieldm.fillvector < hydra::multiarray<double ,3 ,hydra::host::sys_t > >(_vec_ef);
113
120
114
121
for (auto cf:configlist){
115
122
if (std::get<bool >(cf.get (" plot" ))){
@@ -126,6 +133,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
126
133
wfieldm.prepare ();
127
134
wfieldm.fillspacepoints <VecDev_t<double > >(_xvec_wf,_yvec_wf,_zvec_wf);
128
135
wfieldm.fillvector <VecDev_t<double > >(wfieldvecx,wfieldvecy,wfieldvecz);
136
+ wfieldm.fillvector < hydra::multiarray<double ,3 ,hydra::host::sys_t > >(_vec_wf);
129
137
130
138
std::string emobmap_path=root[" PhysicsMaps" ][" emob" ];
131
139
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){
165
173
166
174
RunningStateHost_t data_dinit;
167
175
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 " )) );
169
177
else data_dinit=loaddata::loadfile (tmpfile);
170
178
171
179
@@ -178,6 +186,7 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
178
186
auto bunchsize = std::get<size_t >(cf.get (" bunchsize" ));
179
187
auto nparticles = std::get<size_t >(cf.get (" nparticles" ));
180
188
auto nsteps = std::get<size_t >(cf.get (" nsteps" ));
189
+ auto group = std::get<size_t >(cf.get (" group" ));
181
190
auto path = std::get<std::string>(cf.get (" path" ));
182
191
auto nickname = std::get<std::string>(cf.get (" nickname" ));
183
192
auto plot = std::get<bool >(cf.get (" plot" ));
@@ -191,13 +200,11 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
191
200
auto amp = std::get<double >(cf.get (" amp" ));
192
201
auto length = std::get<double >(cf.get (" length" ));
193
202
194
- // cf.Print();
195
-
196
203
auto start = std::chrono::high_resolution_clock::now ();
197
204
if (path!=tmpfile){
198
205
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 );
201
208
}
202
209
203
210
// create running state
@@ -231,7 +238,8 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
231
238
size_t rest = nsteps%bunchsize;
232
239
233
240
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)
235
243
INFO_LINE (" Nsteps: " <<nsteps)
236
244
// if(ampexp[sim]!=0.0) INFO_LINE("Amp_exp "<< cf.get("amp").getd() << ", Sigma_exp "<<cf.get("sig").getd())
237
245
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){
271
279
Generator.Uniform (0.0 , PI, data_d.begin (_tc_angle_2), data_d.end (_tc_angle_2));
272
280
273
281
274
- hydra::for_each (data_d, evolve::ApplyRamo_multi (niter,
282
+ hydra::for_each (data_d, evolve::make_RamoCurrent (niter,
275
283
timestep,
276
284
temperature_nmob,
277
- _xvec_ef, _yvec_ef, _zvec_ef, efieldvecx, efieldvecy, efieldvecz ,
285
+ _xvec_ef, _yvec_ef, _zvec_ef, _vec_ef ,
278
286
_xvec_emob, _yvec_emob, _zvec_emob, emobvec,
279
287
_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 ));
281
289
282
290
// reducing data
283
291
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){
295
303
296
304
297
305
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
+
305
314
niter++;
306
315
307
316
@@ -320,13 +329,10 @@ void signal_simulation(cfg::Setting const& root, int icfg=-1){
320
329
Generator.Uniform (0.0 , PI, data_d.begin (_tc_angle_2), data_d.end (_tc_angle_2));
321
330
322
331
323
- hydra::for_each (data_d, evolve::ApplyRamo (niter,
332
+ hydra::for_each (data_d, evolve::make_RamoCurrent (niter,
324
333
timestep,
325
334
temperature_nmob,
326
- _xvec, _yvec, _zvec,
327
- efieldvecx, efieldvecy, efieldvecz,
328
- emobvec,hmobvec,
329
- wfieldvecx, wfieldvecy, wfieldvecz));
335
+ _xvec, _yvec, _zvec, _vec_map));
330
336
331
337
// reducing data
332
338
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){
345
351
346
352
if (niter==nsteps-1 ) break ;
347
353
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
+
353
358
niter++;
354
359
355
360
0 commit comments