milupHPC documentation
  • src
particle_handler.cpp
Go to the documentation of this file.
1#include "../include/particle_handler.h"
2
3ParticleHandler::ParticleHandler(integer numParticles, integer numNodes) : numParticles(numParticles),
4 numNodes(numNodes) {
5
6 Logger(INFO) << "numParticles: " << numParticles << " numNodes: " << numNodes;
7
8 h_mass = new real[numNodes];
9 _h_x = new real[numNodes];
10 h_x = _h_x;
11 _h_vx = new real[numParticles]; // numNodes
12 h_vx = _h_vx;
13 _h_ax = new real[numParticles]; // numNodes
14 h_ax = _h_ax;
15 h_g_ax = new real[numParticles]; // numNodes
16#if DIM > 1
17 _h_y = new real[numNodes];
18 h_y = _h_y;
19 _h_vy = new real[numParticles]; // numNodes
20 h_vy = _h_vy;
21 _h_ay = new real[numParticles]; // numNodes
22 h_ay = _h_ay;
23 h_g_ay = new real[numParticles]; // numNodes
24#if DIM == 3
25 _h_z = new real[numNodes];
26 h_z = _h_z;
27 _h_vz = new real[numParticles]; // numNodes
28 h_vz = _h_vz;
29 _h_az = new real[numParticles]; // numNodes
30 h_az = _h_az;
31 h_g_az = new real[numParticles]; // numNodes
32#endif
33#endif
34
35 h_nodeType = new integer[numNodes];
36 h_level = new integer[numNodes];
37 _h_uid = new idInteger[numParticles];
38 h_uid = _h_uid;
39 h_materialId = new integer[numParticles];
40
41#if SPH_SIM
42
43 _h_sml = new real[numParticles];
44 h_sml = _h_sml;
45 h_nnl = new integer[numParticles * MAX_NUM_INTERACTIONS];
46 h_noi = new integer [numParticles];
47 _h_e = new real[numParticles];
48 h_e = _h_e;
49 _h_dedt = new real[numParticles];
50 h_dedt = _h_dedt;
51 h_u = new real[numParticles];
52 _h_cs = new real[numParticles];
53 h_cs = _h_cs;
54 _h_rho = new real[numParticles];
55 h_rho = _h_rho;
56 _h_p = new real[numParticles];
57 h_p = _h_p;
58 h_muijmax = new real[numParticles];
59
60//#if INTEGRATE_DENSITY
61 _h_drhodt = new real[numParticles];
62 h_drhodt = _h_drhodt;
63//#endif
64#if VARIABLE_SML || INTEGRATE_SML
65 _h_dsmldt = new real[numParticles];
66 h_dsmldt = _h_dsmldt;
67#endif
68#if SML_CORRECTION
69 h_sml_omega = new real[numParticles];
70#endif
71#if NAVIER_STOKES
72 h_Tshear = new real[DIM * DIM * numParticles];
73 h_eta = new real[DIM * DIM * numParticles];
74#endif
75#if SOLID
76 h_S = new real[DIM * DIM * numParticles];
77 h_dSdt = new real[DIM * DIM * numParticles];
78 h_localStrain = new real[numParticles];
79#endif
80#if SOLID || NAVIER_STOKES
81 h_sigma = new real[DIM * DIM * numParticles];
82#endif
83#if ARTIFICIAL_STRESS
84 h_R = new real[DIM * DIM * numParticles];;
85#endif
86#if POROSITY
87 h_pold = new real[numParticles];
88 h_alpha_jutzi = new real[numParticles];
89 h_alpha_jutzi_old = new real[numParticles];
90 h_dalphadt = new real[numParticles];
91 h_dalphadp = new real[numParticles];
92 h_dp = new real[numParticles];
93 h_dalphadrho = new real[numParticles];
94 h_f = new real[numParticles];
95 h_delpdelrho = new real[numParticles];
96 h_delpdele = new real[numParticles];
97 h_cs_old = new real[numParticles];
98 h_alpha_epspor = new real[numParticles];
99 h_dalpha_epspordt = new real[numParticles];
100 h_epsilon_v = new real[numParticles];
101 h_depsilon_vdt = new real[numParticles];
102#endif
103#if ZERO_CONSISTENCY
104 h_shepardCorrection = new real[numParticles];
105#endif
106#if LINEAR_CONSISTENCY
107 h_tensorialCorrectionMatrix = new real[DIM * DIM * numParticles];
108#endif
109#if FRAGMENTATION
110 h_d = new real[numParticles];
111 h_damage_total = new real[numParticles];
112 h_dddt = new real[numParticles];
113 h_numFlaws = new integer[numParticles];
114 h_maxNumFlaws = new integer[numParticles];
115 h_numActiveFlaws = new integer[numParticles];
116 h_flaws = new real[numParticles];
117#if PALPHA_POROSITY
118 h_damage_porjutzi = new real[numParticles];
119 h_ddamage_porjutzidt = new real[numParticles];
120#endif
121#endif
122
123#endif // SPH_SIM
124
125 h_particles = new Particles();
126
127 cuda::malloc(d_numParticles, 1);
128 cuda::malloc(d_numNodes, 1);
129
130 //real *d_positions;
131 //cuda::malloc(d_positions, DIM * numNodes);
132 cuda::malloc(d_mass, numNodes);
133 cuda::malloc(_d_x, numNodes);
134 //_d_x = &d_positions[0];
135 d_x = _d_x;
136 cuda::malloc(_d_vx, numParticles); // numNodes
137 d_vx = _d_vx;
138 cuda::malloc(_d_ax, numParticles); // numNodes
139 d_ax = _d_ax;
140 cuda::malloc(d_g_ax, numParticles); // numNodes
141#if DIM > 1
142 cuda::malloc(_d_y, numNodes);
143 //_d_y = &d_positions[numNodes];
144 d_y = _d_y;
145 cuda::malloc(_d_vy, numParticles); // numNodes
146 d_vy = _d_vy;
147 cuda::malloc(_d_ay, numParticles); // numNodes
148 d_ay = _d_ay;
149 cuda::malloc(d_g_ay, numParticles); // numNodes
150#if DIM == 3
151 cuda::malloc(_d_z, numNodes);
152 //_d_z = &d_positions[2 * numNodes];
153 d_z = _d_z;
154 cuda::malloc(_d_vz, numParticles); // numNodes
155 d_vz = _d_vz;
156 cuda::malloc(_d_az, numParticles); // numNodes
157 d_az = _d_az;
158 cuda::malloc(d_g_az, numParticles); // numNodes
159#endif
160#endif
161 cuda::malloc(d_nodeType, numNodes);
162 cuda::malloc(d_level, numNodes);
163 cuda::malloc(_d_uid, numParticles);
164 d_uid = _d_uid;
165 cuda::malloc(d_materialId, numParticles);
166
167#if SPH_SIM
168
169 cuda::malloc(_d_sml, numParticles);
170 d_sml = _d_sml;
171 cuda::malloc(d_nnl, numParticles * MAX_NUM_INTERACTIONS);
172 cuda::malloc(d_noi, numParticles);
173 cuda::malloc(_d_e, numParticles);
174 d_e = _d_e;
175 cuda::malloc(_d_dedt, numParticles);
176 d_dedt = _d_dedt;
177 cuda::malloc(d_u, numParticles);
178 cuda::malloc(_d_cs, numParticles);
179 d_cs = _d_cs;
180 cuda::malloc(_d_rho, numParticles);
181 d_rho = _d_rho;
182 cuda::malloc(_d_p, numParticles);
183 d_p = _d_p;
184 cuda::malloc(d_muijmax, numParticles);
185
186//#if INTEGRATE_DENSITY
187 cuda::malloc(_d_drhodt, numParticles);
188 d_drhodt =_d_drhodt;
189//#endif
190#if VARIABLE_SML || INTEGRATE_SML
191 cuda::malloc(_d_dsmldt, numParticles);
192 d_dsmldt = _d_dsmldt;
193#endif
194#if SML_CORRECTION
195 cuda::malloc(d_sml_omega, numParticles);
196#endif
197#if NAVIER_STOKES
198 cuda::malloc(d_Tshear, DIM * DIM * numParticles);
199 cuda::malloc(d_eta, DIM * DIM * numParticles);
200#endif
201#if SOLID
202 cuda::malloc(d_S, DIM * DIM *numParticles);
203 cuda::malloc(d_dSdt, DIM * numParticles);
204 cuda::malloc(d_localStrain, numParticles);
205#endif
206#if SOLID || NAVIER_STOKES
207 cuda::malloc(d_sigma, DIM * DIM * numParticles);
208#endif
209#if ARTIFICIAL_STRESS
210 cuda::malloc(d_R, DIM * DIM * numParticles);
211#endif
212#if POROSITY
213 cuda::malloc(d_pold, numParticles);
214 cuda::malloc(d_alpha_jutzi, numParticles);
215 cuda::malloc(d_alpha_jutzi_old, numParticles);
216 cuda::malloc(d_dalphadt, numParticles);
217 cuda::malloc(d_dalphadp, numParticles);
218 cuda::malloc(d_dp, numParticles);
219 cuda::malloc(d_dalphadrho, numParticles);
220 cuda::malloc(d_f, numParticles);
221 cuda::malloc(d_delpdelrho, numParticles);
222 cuda::malloc(d_delpdele, numParticles);
223 cuda::malloc(d_cs_old, numParticles);
224 cuda::malloc(d_alpha_epspor, numParticles);
225 cuda::malloc(d_dalpha_epspordt, numParticles);
226 cuda::malloc(d_epsilon_v, numParticles);
227 cuda::malloc(d_depsilon_vdt, numParticles);
228#endif
229#if ZERO_CONSISTENCY
230 cuda::malloc(d_shepardCorrection, numParticles);
231#endif
232#if LINEAR_CONSISTENCY
233 cuda::malloc(d_tensorialCorrectionMatrix, DIM * DIM * numParticles);
234#endif
235#if FRAGMENTATION
236 cuda::malloc(d_d, numParticles);
237 cuda::malloc(d_damage_total, numParticles);
238 cuda::malloc(d_dddt, numParticles);
239 cuda::malloc(d_numFlaws, numParticles);
240 cuda::malloc(d_maxNumFlaws, numParticles);
241 cuda::malloc(d_numActiveFlaws, numParticles);
242 cuda::malloc(d_flaws, numParticles);
243#if PALPHA_POROSITY
244 cuda::malloc(d_damage_porjutzi, numParticles);
245 cuda::malloc(d_ddamage_porjutzidt, numParticles);
246#endif
247#endif
248
249#endif // SPH_SIM
250
251#if BALSARA_SWITCH
252 h_divv = new real[numParticles];
253 h_curlv = new real[numParticles * DIM];
254 cuda::malloc(d_divv, numParticles);
255 cuda::malloc(d_curlv, numParticles * DIM);
256#endif
257
258 cuda::malloc(d_particles, 1);
259
260
261#if DIM == 1
262 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_vx, h_ax, h_level, h_uid, h_materialId, h_sml, h_nnl,
263 h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
264 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_vx, d_ax, d_level, d_uid,
265 d_materialId, d_sml, d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
266#elif DIM == 2
267 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_y, h_vx, h_vy, h_ax, h_ay, h_level, h_uid, h_materialId,
268 h_sml, h_nnl, h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
269 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_y, d_vx, d_vy, d_ax, d_ay,
270 d_level, d_uid, d_materialId, d_sml, d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
271#else
272 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_y, h_z, h_vx, h_vy, h_vz, h_ax, h_ay, h_az,
273 h_level, h_uid, h_materialId, h_sml, h_nnl, h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
274 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_y, d_z, d_vx, d_vy, d_vz,
275 d_ax, d_ay, d_az, d_level, d_uid, d_materialId, d_sml,
276 d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
277#endif
278
279#if DIM == 1
280 h_particles->setGravity(h_g_ax);
281 ParticlesNS::Kernel::Launch::setGravity(d_particles, d_g_ax);
282#elif DIM == 2
283 h_particles->setGravity(h_g_ax, h_g_ay);
284 ParticlesNS::Kernel::Launch::setGravity(d_particles, d_g_ax, d_g_ay);
285#else
286 h_particles->setGravity(h_g_ax, h_g_ay, h_g_az);
287 ParticlesNS::Kernel::Launch::setGravity(d_particles, d_g_ax, d_g_ay, d_g_az);
288#endif
289
290 h_particles->setNodeType(h_nodeType);
291 ParticlesNS::Kernel::Launch::setNodeType(d_particles, d_nodeType);
292 h_particles->setU(h_u);
293 ParticlesNS::Kernel::Launch::setU(d_particles, d_u);
294
295#if SPH_SIM
296 h_particles->setArtificialViscosity(h_muijmax);
297 ParticlesNS::Kernel::Launch::setArtificialViscosity(d_particles, d_muijmax);
298
299//#if INTEGRATE_DENSITY
300 h_particles->setIntegrateDensity(h_drhodt);
301 ParticlesNS::Kernel::Launch::setIntegrateDensity(d_particles, d_drhodt);
302//#endif
303#if VARIABLE_SML || INTEGRATE_SML
304 h_particles->setVariableSML(h_dsmldt);
305 ParticlesNS::Kernel::Launch::setVariableSML(d_particles, d_dsmldt);
306#endif
307#if SML_CORRECTION
308 h_particles->setSMLCorrection(h_sml_omega);
309 ParticlesNS::Kernel::Launch::setSMLCorrection(d_particles, d_sml_omega);
310#endif
311#if NAVIER_STOKES
312 h_particles->setNavierStokes(h_Tshear, h_eta);
313 ParticlesNS::Kernel::Launch::setNavierStokes(d_particles, d_Tshear, d_eta);
314#endif
315#if SOLID
316 h_particles->setSolid(h_S, h_dSdt, h_localStrain);
317 ParticlesNS::Kernel::Launch::setSolid(d_particles, d_S, d_dSdt, d_localStrain);
318#endif
319#if SOLID || NAVIER_STOKES
320 h_particles->setSolidNavierStokes(h_sigma);
321 ParticlesNS::Kernel::Launch::setSolidNavierStokes(d_particles, d_sigma);
322#endif
323#if ARTIFICIAL_STRESS
324 h_particles->setArtificialStress(h_R);
325 ParticlesNS::Kernel::Launch::setArtificialStress(d_particles, d_R);
326#endif
327#if POROSITY
328 h_particles->setPorosity(h_pold, h_alpha_jutzi, h_alpha_jutzi_old, h_dalphadt, h_dalphadp, h_dp, h_dalphadrho, h_f,
329 h_delpdelrho, h_delpdele, h_cs_old, h_alpha_epspor, h_dalpha_epspordt, h_epsilon_v,
330 h_depsilon_vdt);
331 ParticlesNS::Kernel::Launch::setPorosity(d_particles, d_pold, d_alpha_jutzi, d_alpha_jutzi_old, d_dalphadt,
332 d_dalphadp, d_dp, d_dalphadrho, d_f, d_delpdelrho, d_delpdele, d_cs_old,
333 d_alpha_epspor, d_dalpha_epspordt, d_epsilon_v, d_depsilon_vdt);
334#endif
335#if ZERO_CONSISTENCY
336 h_particles->setZeroConsistency(h_shepardCorrection);
337 ParticlesNS::Kernel::Launch::setZeroConsistency(d_particles, d_shepardCorrection);
338#endif
339#if LINEAR_CONSISTENCY
340 h_particles->setLinearConsistency(h_tensorialCorrectionMatrix);
341 ParticlesNS::Kernel::Launch::setLinearConsistency(d_particles, d_tensorialCorrectionMatrix);
342#endif
343#if FRAGMENTATION
344 h_particles->setFragmentation(h_d, h_damage_total, h_dddt, h_numFlaws, h_maxNumFlaws,
345 h_numActiveFlaws, h_flaws);
346 ParticlesNS::Kernel::Launch::setFragmentation(d_particles, d_d, d_damage_total, d_dddt, d_numFlaws, d_maxNumFlaws,
347 d_numActiveFlaws, d_flaws);
348#if PALPHA_POROSITY
349 h_particles->setPalphaPorosity(h_damage_porjutzi, h_ddamage_porjutzidt);
350 ParticlesNS::Kernel::Launch::setPalphaPorosity(d_particles, d_damage_porjutzi, d_ddamage_porjutzidt);
351#endif
352#endif
353#endif // SPH_SIM
354
355#if BALSARA_SWITCH
356 h_particles->setDivCurl(h_divv, h_curlv);
357 ParticlesNS::Kernel::Launch::setDivCurl(d_particles, d_divv, d_curlv);
358#endif
359
360 cuda::copy(&numParticles, d_numParticles, 1, To::device);
361 cuda::copy(&numNodes, d_numNodes, 1, To::device);
362
363}
364
365ParticleHandler::~ParticleHandler() {
366
367 delete [] h_mass;
368 delete [] _h_x;
369 delete [] _h_vx;
370 delete [] _h_ax;
371 delete [] h_g_ax;
372#if DIM > 1
373 delete [] _h_y;
374 delete [] _h_vy;
375 delete [] _h_ay;
376 delete [] h_g_ay;
377#if DIM == 3
378 delete [] _h_z;
379 delete [] _h_vz;
380 delete [] _h_az;
381 delete [] h_g_az;
382#endif
383#endif
384 delete [] h_nodeType;
385 delete [] h_uid;
386 delete [] h_materialId;
387#if SPH_SIM
388 delete [] _h_sml;
389 delete [] h_nnl;
390 delete [] h_noi;
391 delete [] _h_e;
392 delete [] _h_dedt;
393 delete [] _h_cs;
394 delete [] _h_rho;
395 delete [] _h_p;
396 delete [] h_muijmax;
397#endif // SPH_SIM
398
399 // device particle entries
400 cuda::free(d_numParticles);
401 cuda::free(d_numNodes);
402
403 cuda::free(d_mass);
404 cuda::free(_d_x);
405 cuda::free(_d_vx);
406 cuda::free(_d_ax);
407 cuda::free(d_g_ax);
408#if DIM > 1
409 cuda::free(_d_y);
410 cuda::free(_d_vy);
411 cuda::free(_d_ay);
412 cuda::free(d_g_ay);
413#if DIM == 3
414 cuda::free(_d_z);
415 cuda::free(_d_vz);
416 cuda::free(_d_az);
417 cuda::free(d_g_az);
418#endif
419#endif
420 cuda::free(d_nodeType);
421 cuda::free(d_uid);
422 cuda::free(d_materialId);
423#if SPH_SIM
424 cuda::free(_d_sml);
425 cuda::free(d_nnl);
426 cuda::free(d_noi);
427 cuda::free(_d_e);
428 cuda::free(_d_dedt);
429 cuda::free(_d_cs);
430 cuda::free(_d_rho);
431 cuda::free(_d_p);
432 cuda::free(d_muijmax);
433#endif // SPH_SIM
434
435#if SPH_SIM
436 delete [] h_muijmax;
437 cuda::free(d_muijmax);
438
439//#if INTEGRATE_DENSITY
440 delete [] _h_drhodt;
441 cuda::free(_d_drhodt);
442//#endif
443#if VARIABLE_SML || INTEGRATE_SML
444 delete [] _h_dsmldt;
445 cuda::free(_d_dsmldt);
446#endif
447#if SML_CORRECTION
448 delete [] h_sml_omega;
449 cuda::free(d_sml_omega);
450#endif
451#if NAVIER_STOKES
452 delete [] h_Tshear;
453 cuda::free(d_Tshear);
454 delete [] h_eta;
455 cuda::free(d_eta);
456#endif
457#if SOLID
458 delete [] h_S;
459 cuda::free(d_S);
460 delete [] h_dSdt;
461 cuda::free(d_dSdt);
462 delete [] h_localStrain;
463 cuda::free(d_localStrain);
464#endif
465#if SOLID || NAVIER_STOKES
466 delete [] h_sigma;
467 cuda::free(d_sigma);
468#endif
469#if ARTIFICIAL_STRESS
470 delete [] h_R;
471 cuda::free(d_R);
472#endif
473#if POROSITY
474 delete [] h_pold;
475 cuda::free(d_pold);
476 delete [] h_alpha_jutzi;
477 cuda::free(d_alpha_jutzi);
478 delete [] h_alpha_jutzi_old;
479 cuda::free(d_alpha_jutzi_old);
480 delete [] h_dalphadt;
481 cuda::free(d_dalphadt);
482 delete [] h_dalphadp;
483 cuda::free(d_dalphadp);
484 delete [] h_dp;
485 cuda::free(d_dp);
486 delete [] h_dalphadrho;
487 cuda::free(d_dalphadrho);
488 delete [] h_f;
489 cuda::free(d_f);
490 delete [] h_delpdelrho;
491 cuda::free(d_delpdelrho);
492 delete [] h_delpdele;
493 cuda::free(d_delpdele);
494 delete [] h_cs_old;
495 cuda::free(d_cs_old);
496 delete [] h_alpha_epspor;
497 cuda::free(d_alpha_epspor);
498 delete [] h_dalpha_epspordt;
499 cuda::free(d_dalpha_epspordt);
500 delete [] h_epsilon_v;
501 cuda::free(d_epsilon_v);
502 delete [] h_depsilon_vdt;
503 cuda::free(d_depsilon_vdt);
504#endif
505#if ZERO_CONSISTENCY
506 delete [] h_shepardCorrection;
507 cuda::free(d_shepardCorrection);
508#endif
509#if LINEAR_CONSISTENCY
510 delete [] h_tensorialCorrectionMatrix;
511 cuda::free(d_tensorialCorrectionMatrix);
512#endif
513#if FRAGMENTATION
514 delete [] h_d;
515 cuda::free(d_d);
516 delete [] h_damage_total;
517 cuda::free(d_damage_total);
518 delete [] h_dddt;
519 cuda::free(d_dddt);
520 delete [] h_numFlaws;
521 cuda::free(d_numFlaws);
522 delete [] h_maxNumFlaws;
523 cuda::free(d_maxNumFlaws);
524 delete [] h_numActiveFlaws;
525 cuda::free(d_numActiveFlaws);
526 delete [] h_flaws;
527 cuda::free(d_flaws);
528#if PALPHA_POROSITY
529 delete [] h_damage_porjutzi;
530 cuda::free(d_damage_porjutzi);
531 delete [] h_ddamage_porjutzidt;
532 cuda::free(d_ddamage_porjutzidt);
533#endif
534#endif
535#endif // SPH_SIM
536
537#if BALSARA_SWITCH
538 delete [] h_divv;
539 delete [] h_curlv;
540 cuda::free(d_divv);
541 cuda::free(d_curlv);
542#endif
543
544 delete h_particles;
545 cuda::free(d_particles);
546
547}
548
549void ParticleHandler::initLeapfrog() {
550
551 leapfrog = true;
552
553 // TODO: should be numParticles instead of numNodes
554 h_ax_old = new real[numNodes];
555 h_g_ax_old = new real[numNodes];
556 cuda::malloc(d_ax_old, numNodes);
557 cuda::set(d_ax_old, (real)0, numNodes);
558 cuda::malloc(d_g_ax_old, numNodes);
559 cuda::set(d_g_ax_old, (real)0, numNodes);
560#if DIM > 1
561 h_ay_old = new real[numNodes];
562 h_g_ay_old = new real[numNodes];
563 cuda::malloc(d_ay_old, numNodes);
564 cuda::set(d_ay_old, (real)0, numNodes);
565 cuda::malloc(d_g_ay_old, numNodes);
566 cuda::set(d_g_ay_old, (real)0, numNodes);
567#if DIM == 3
568 h_az_old = new real[numNodes];
569 h_g_az_old = new real[numNodes];
570 cuda::malloc(d_az_old, numNodes);
571 cuda::set(d_az_old, (real)0, numNodes);
572 cuda::malloc(d_g_az_old, numNodes);
573 cuda::set(d_g_az_old, (real)0, numNodes);
574#endif
575#endif
576
577#if DIM == 1
578
579#elif DIM == 2
580
581#else
582 h_particles->setLeapfrog(h_ax_old, h_ay_old, h_az_old, h_g_ax_old, h_g_ay_old, h_g_az_old);
583 ParticlesNS::Kernel::Launch::setLeapfrog(d_particles, d_ax_old, d_ay_old, d_az_old, d_g_ax_old, d_g_ay_old, d_g_az_old);
584#endif
585
586}
587
588void ParticleHandler::freeLeapfrog() {
589
590 delete h_g_ax_old;
591 cuda::free(d_g_ax_old);
592#if DIM > 1
593 delete h_g_ay_old;
594 cuda::free(d_g_ay_old);
595#if DIM == 3
596 delete h_g_az_old;
597 cuda::free(d_g_az_old);
598#endif
599#endif
600
601}
602
603template <typename T>
604T*& ParticleHandler::getEntry(Entry::Name entry, Execution::Location location) {
605 switch (location) {
606 case Execution::device: {
607 switch (entry) {
608 case Entry::x: {
609 return d_x;
610 }
611#if DIM > 1
612 case Entry::y: {
613 return d_y;
614 }
615#if DIM == 3
616 case Entry::z: {
617 return d_z;
618 }
619#endif
620#endif
621 case Entry::mass: {
622 return d_mass;
623 }
624 default: {
625 printf("Entry is not available!\n");
626 return NULL;
627 }
628 }
629 } break;
630 case Execution::host: {
631 switch (entry) {
632 case Entry::x: {
633 return h_x;
634 }
635#if DIM > 1
636 case Entry::y: {
637 return h_y;
638 }
639#if DIM == 3
640 case Entry::z: {
641 return h_z;
642 }
643#endif
644#endif
645 case Entry::mass: {
646 return h_mass;
647 } break;
648 default: {
649 printf("Entry is not available!\n");
650 return NULL;
651 }
652 }
653 } break;
654 default: {
655 printf("Location is not available!\n");
656 return NULL;
657 }
658 }
659}
660
661void ParticleHandler::setPointer(IntegratedParticleHandler *integratedParticleHandler) {
662
663 d_x = integratedParticleHandler->d_x;
664 d_vx = integratedParticleHandler->d_vx;
665 d_ax = integratedParticleHandler->d_ax;
666#if DIM > 1
667 d_y = integratedParticleHandler->d_y;
668 d_vy = integratedParticleHandler->d_vy;
669 d_ay = integratedParticleHandler->d_ay;
670#if DIM == 3
671 d_z = integratedParticleHandler->d_z;
672 d_vz = integratedParticleHandler->d_vz;
673 d_az = integratedParticleHandler->d_az;
674#endif
675#endif
676 d_uid = integratedParticleHandler->d_uid;
677
678#if SPH_SIM
679 d_rho = integratedParticleHandler->d_rho;
680 d_e = integratedParticleHandler->d_e;
681 d_dedt = integratedParticleHandler->d_dedt;
682 d_p = integratedParticleHandler->d_p;
683 d_cs = integratedParticleHandler->d_cs;
684 d_sml = integratedParticleHandler->d_sml;
685
686//#if INTEGRATE_DENSITY
687 d_drhodt = integratedParticleHandler->d_drhodt;
688//#endif
689
690#if VARIABLE_SML || INTEGRATE_SML
691 d_dsmldt = integratedParticleHandler->d_dsmldt;
692#endif
693#endif // SPH_SIM
694
695// Already redirected pointers, thus just call setter like in constructor
696#if DIM == 1
697 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_vx, h_ax, h_level, h_uid, h_materialId, h_sml, h_nnl,
698 h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
699 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_vx, d_ax, d_level, d_uid,
700 d_materialId, d_sml, d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
701#elif DIM == 2
702 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_y, h_vx, h_vy, h_ax, h_ay, h_level, h_uid, h_materialId,
703 h_sml, h_nnl, h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
704 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_y, d_vx, d_vy, d_ax, d_ay,
705 d_level, d_uid, d_materialId, d_sml, d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
706#else
707 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_y, h_z, h_vx, h_vy, h_vz, h_ax, h_ay, h_az,
708 h_level, h_uid, h_materialId, h_sml, h_nnl, h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
709 h_particles->setIntegrateDensity(h_drhodt);
710
711#if SPH_SIM
712#if VARIABLE_SML || INTEGRATE_SML
713 h_particles->setVariableSML(h_dsmldt);
714#endif
715
716 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_y, d_z, d_vx, d_vy, d_vz,
717 d_ax, d_ay, d_az, d_level, d_uid, d_materialId, d_sml,
718 d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
719 ParticlesNS::Kernel::Launch::setIntegrateDensity(d_particles, d_drhodt);
720#if VARIABLE_SML || INTEGRATE_SML
721 ParticlesNS::Kernel::Launch::setVariableSML(d_particles, d_dsmldt);
722#endif
723#endif
724#endif // SPH_SIM
725
726}
727
728void ParticleHandler::resetPointer() {
729
730 d_x = _d_x;
731 d_vx = _d_vx;
732 d_ax = _d_ax;
733#if DIM > 1
734 d_y = _d_y;
735 d_vy = _d_vy;
736 d_ay = _d_ay;
737#if DIM == 3
738 d_z = _d_z;
739 d_vz = _d_vz;
740 d_az = _d_az;
741#endif
742#endif
743
744 d_uid = _d_uid;
745
746#if SPH_SIM
747 d_rho = _d_rho;
748 d_e = _d_e;
749 d_dedt = _d_dedt;
750 d_p = _d_p;
751 d_cs = _d_cs;
752 d_sml = _d_sml;
753
754//#if INTEGRATE_DENSITY
755 d_drhodt = _d_drhodt;
756//#endif
757
758#if VARIABLE_SML || INTEGRATE_SML
759 d_dsmldt = _d_dsmldt;
760#endif
761#endif // SPH_SIM
762
763#if DIM == 1
764 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_vx, h_ax, h_level, h_uid, h_materialId, h_sml, h_nnl,
765 h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
766 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_vx, d_ax, d_level, d_uid,
767 d_materialId, d_sml, d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
768#elif DIM == 2
769 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_y, h_vx, h_vy, h_ax, h_ay, h_level, h_uid, h_materialId,
770 h_sml, h_nnl, h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
771 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_y, d_vx, d_vy, d_ax, d_ay,
772 d_level, d_uid, d_materialId, d_sml, d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
773#else
774 h_particles->set(&numParticles, &numNodes, h_mass, h_x, h_y, h_z, h_vx, h_vy, h_vz, h_ax, h_ay, h_az,
775 h_level, h_uid, h_materialId, h_sml, h_nnl, h_noi, h_e, h_dedt, h_cs, h_rho, h_p);
776 h_particles->setIntegrateDensity(h_drhodt);
777
778#if SPH_SIM
779#if VARIABLE_SML || INTEGRATE_SML
780 h_particles->setVariableSML(h_dsmldt);
781#endif
782
783 ParticlesNS::Kernel::Launch::set(d_particles, d_numParticles, d_numNodes, d_mass, d_x, d_y, d_z, d_vx, d_vy, d_vz,
784 d_ax, d_ay, d_az, d_level, d_uid, d_materialId, d_sml,
785 d_nnl, d_noi, d_e, d_dedt, d_cs, d_rho, d_p);
786 ParticlesNS::Kernel::Launch::setIntegrateDensity(d_particles, d_drhodt);
787#if VARIABLE_SML || INTEGRATE_SML
788 ParticlesNS::Kernel::Launch::setVariableSML(d_particles, d_dsmldt);
789#endif
790#endif
791#endif // SPH_SIM
792
793}
794
795
796void ParticleHandler::copyMass(To::Target target, bool includePseudoParticles) {
797 int length;
798 if (includePseudoParticles) {
799 length = numNodes;
800 }
801 else {
802 length = numParticles;
803 }
804 cuda::copy(h_mass, d_mass, length, target);
805}
806
807void ParticleHandler::copyUid(To::Target target) {
808 int length = numParticles;
809 cuda::copy(h_uid, d_uid, length, target);
810}
811
812void ParticleHandler::copyMatId(To::Target target) {
813 int length = numParticles;
814 cuda::copy(h_materialId, d_materialId, length, target);
815}
816
817void ParticleHandler::copySML(To::Target target) {
818 int length = numParticles;
819 cuda::copy(h_sml, d_sml, length, target);
820}
821
822void ParticleHandler::copyPosition(To::Target target, bool includePseudoParticles) {
823 int length;
824 if (includePseudoParticles) {
825 length = numNodes;
826 }
827 else {
828 length = numParticles;
829 }
830 cuda::copy(h_x, d_x, length, target);
831#if DIM > 1
832 cuda::copy(h_y, d_y, length, target);
833#if DIM == 3
834 cuda::copy(h_z, d_z, length, target);
835#endif
836#endif
837}
838
839void ParticleHandler::copyVelocity(To::Target target, bool includePseudoParticles) {
840 int length = numParticles;
841 //if (includePseudoParticles) {
842 // length = numNodes;
843 //}
844 //else {
845 // length = numParticles;
846 //}
847 cuda::copy(h_vx, d_vx, length, target);
848#if DIM > 1
849 cuda::copy(h_vy, d_vy, length, target);
850#if DIM == 3
851 cuda::copy(h_vz, d_vz, length, target);
852#endif
853#endif
854}
855
856void ParticleHandler::copyAcceleration(To::Target target, bool includePseudoParticles) {
857 int length = numParticles;
858 //if (includePseudoParticles) {
859 // length = numNodes;
860 //}
861 //else {
862 // length = numParticles;
863 //}
864 cuda::copy(h_ax, d_ax, length, target);
865#if DIM > 1
866 cuda::copy(h_ay, d_ay, length, target);
867#if DIM == 3
868 cuda::copy(h_az, d_az, length, target);
869#endif
870#endif
871}
872
873void ParticleHandler::copyDistribution(To::Target target, bool velocity, bool acceleration, bool includePseudoParticles) {
874 copyUid(target);
875 copyMass(target, includePseudoParticles);
876 copyPosition(target, includePseudoParticles);
877 copyMatId(target);
878#if SPH_SIM
879 copySML(target);
880#endif
881 if (velocity) {
882 copyVelocity(target, includePseudoParticles);
883 }
884 if (acceleration) {
885 copyAcceleration(target, includePseudoParticles);
886 }
887}
888
889void ParticleHandler::copySPH(To::Target target) {
890 int length = numParticles;
891 cuda::copy(h_rho, d_rho, length, target);
892 cuda::copy(h_p, d_p, length, target);
893 cuda::copy(h_e, d_e, length, target);
894 cuda::copy(h_sml, d_sml, length, target);
895 cuda::copy(h_noi, d_noi, length, target);
896 cuda::copy(h_cs, d_cs, length, target);
897}
898
899IntegratedParticleHandler::IntegratedParticleHandler(integer numParticles, integer numNodes) :
900 numParticles(numParticles), numNodes(numNodes) {
901
902 cuda::malloc(d_uid, numParticles);
903
904 cuda::malloc(d_x, numNodes);
905 cuda::malloc(d_vx, numParticles); // numNodes
906 cuda::malloc(d_ax, numParticles); // numNodes
907#if DIM > 1
908 cuda::malloc(d_y, numNodes);
909 cuda::malloc(d_vy, numParticles); // numNodes
910 cuda::malloc(d_ay, numParticles); // numNodes
911#if DIM == 3
912 cuda::malloc(d_z, numNodes);
913 cuda::malloc(d_vz, numParticles); // numNodes
914 cuda::malloc(d_az, numParticles); // numNodes
915#endif
916#endif
917
918 cuda::malloc(d_rho, numParticles);
919 cuda::malloc(d_e, numParticles);
920 cuda::malloc(d_dedt, numParticles);
921 cuda::malloc(d_p, numParticles);
922 cuda::malloc(d_cs, numParticles);
923
924 cuda::malloc(d_sml, numParticles);
925
926//#if INTEGRATE_DENSITY
927 cuda::malloc(d_drhodt, numParticles);
928//#endif
929
930#if VARIABLE_SML || INTEGRATE_SML
931 cuda::malloc(d_dsmldt, numParticles);
932#endif
933
934 cuda::malloc(d_integratedParticles, 1);
935
936#if DIM == 1
937 IntegratedParticlesNS::Kernel::Launch::set(d_integratedParticles, d_uid, d_rho, d_e, d_dedt, d_p, d_cs, d_x,
938 d_vx, d_ax);
939#elif DIM == 2
940 IntegratedParticlesNS::Kernel::Launch::set(d_integratedParticles, d_uid, d_rho, d_e, d_dedt, d_p, d_cs, d_x,
941 d_y, d_vx, d_vy, d_ax, d_ay);
942#else
943 IntegratedParticlesNS::Kernel::Launch::set(d_integratedParticles, d_uid, d_rho, d_e, d_dedt, d_p, d_cs, d_x,
944 d_y, d_z, d_vx, d_vy, d_vz, d_ax, d_ay, d_az);
945#endif
946
947 IntegratedParticlesNS::Kernel::Launch::setSML(d_integratedParticles, d_sml);
948
949//#if INTEGRATE_DENSITY
950 IntegratedParticlesNS::Kernel::Launch::setIntegrateDensity(d_integratedParticles, d_drhodt);
951//#endif
952
953#if VARIABLE_SML || INTEGRATE_SML
954 IntegratedParticlesNS::Kernel::Launch::setIntegrateSML(d_integratedParticles, d_dsmldt);
955#endif
956
957}
958
959IntegratedParticleHandler::~IntegratedParticleHandler() {
960
961 cuda::free(d_uid);
962
963 cuda::free(d_x);
964 cuda::free(d_vx);
965 cuda::free(d_ax);
966#if DIM > 1
967 cuda::free(d_y);
968 cuda::free(d_vy);
969 cuda::free(d_ay);
970#if DIM == 3
971 cuda::free(d_z);
972 cuda::free(d_vz);
973 cuda::free(d_az);
974#endif
975#endif
976
977 cuda::free(d_rho);
978 cuda::free(d_e);
979 cuda::free(d_dedt);
980 cuda::free(d_p);
981 cuda::free(d_cs);
982
983 cuda::free(d_sml);
984
985//#if INTEGRATE_DENSITY
986 cuda::free(d_drhodt);
987//#endif
988
989#if VARIABLE_SML || INTEGRATE_SML
990 cuda::free(d_dsmldt);
991#endif
992
993 cuda::free(d_integratedParticles);
994
995}
996
997
IntegratedParticleHandler
Definition: particle_handler.h:425
IntegratedParticleHandler::~IntegratedParticleHandler
~IntegratedParticleHandler()
Definition: particle_handler.cpp:959
IntegratedParticleHandler::d_integratedParticles
IntegratedParticles * d_integratedParticles
device instance of IntegratedParticles class
Definition: particle_handler.h:474
IntegratedParticleHandler::d_e
real * d_e
Definition: particle_handler.h:458
IntegratedParticleHandler::d_dedt
real * d_dedt
Definition: particle_handler.h:459
IntegratedParticleHandler::d_vz
real * d_vz
device time derivative of particle's z position
Definition: particle_handler.h:451
IntegratedParticleHandler::d_rho
real * d_rho
Definition: particle_handler.h:457
IntegratedParticleHandler::d_sml
real * d_sml
Definition: particle_handler.h:463
IntegratedParticleHandler::d_vy
real * d_vy
device time derivative of particle's y position
Definition: particle_handler.h:445
IntegratedParticleHandler::d_uid
idInteger * d_uid
device unique identifier
Definition: particle_handler.h:435
IntegratedParticleHandler::d_vx
real * d_vx
device time derivative of particle's x position
Definition: particle_handler.h:439
IntegratedParticleHandler::d_az
real * d_az
device time derivative of particle's z velocity
Definition: particle_handler.h:453
IntegratedParticleHandler::d_cs
real * d_cs
Definition: particle_handler.h:461
IntegratedParticleHandler::d_y
real * d_y
Definition: particle_handler.h:443
IntegratedParticleHandler::d_ay
real * d_ay
device time derivative of particle's y velocity
Definition: particle_handler.h:447
IntegratedParticleHandler::numParticles
integer numParticles
(host) number of particles
Definition: particle_handler.h:430
IntegratedParticleHandler::d_drhodt
real * d_drhodt
Definition: particle_handler.h:466
IntegratedParticleHandler::d_p
real * d_p
Definition: particle_handler.h:460
IntegratedParticleHandler::d_ax
real * d_ax
device time derivative of particle's x velocity
Definition: particle_handler.h:441
IntegratedParticleHandler::IntegratedParticleHandler
IntegratedParticleHandler(integer numParticles, integer numNodes)
Definition: particle_handler.cpp:899
IntegratedParticleHandler::numNodes
integer numNodes
(host) number of nodes
Definition: particle_handler.h:432
IntegratedParticleHandler::d_z
real * d_z
Definition: particle_handler.h:449
IntegratedParticleHandler::d_x
real * d_x
Definition: particle_handler.h:437
Logger
Logger class.
Definition: logger.h:80
ParticleHandler::d_materialId
integer * d_materialId
device material identifier
Definition: particle_handler.h:227
ParticleHandler::_d_ax
real * _d_ax
Definition: particle_handler.h:197
ParticleHandler::d_muijmax
real * d_muijmax
device max(mu_ij)
Definition: particle_handler.h:247
ParticleHandler::h_rho
real * h_rho
host density
Definition: particle_handler.h:80
ParticleHandler::h_noi
integer * h_noi
host number of interactions
Definition: particle_handler.h:70
ParticleHandler::d_numNodes
integer * d_numNodes
device number of nodes
Definition: particle_handler.h:187
ParticleHandler::h_az
real * h_az
host z acceleration
Definition: particle_handler.h:52
ParticleHandler::h_ax
real * h_ax
host x acceleration
Definition: particle_handler.h:34
ParticleHandler::_h_rho
real * _h_rho
Definition: particle_handler.h:80
ParticleHandler::d_dedt
real * d_dedt
device time derivative of internal energy
Definition: particle_handler.h:237
ParticleHandler::h_e
real * h_e
host internal energy
Definition: particle_handler.h:72
ParticleHandler::leapfrog
bool leapfrog
Definition: particle_handler.h:20
ParticleHandler::d_z
real * d_z
device z position
Definition: particle_handler.h:211
ParticleHandler::d_nnl
integer * d_nnl
device near(est) neighbor list
Definition: particle_handler.h:231
ParticleHandler::h_level
integer * h_level
Definition: particle_handler.h:60
ParticleHandler::d_ay
real * d_ay
device y acceleration
Definition: particle_handler.h:206
ParticleHandler::h_az_old
real * h_az_old
Definition: particle_handler.h:54
ParticleHandler::_h_sml
real * _h_sml
Definition: particle_handler.h:66
ParticleHandler::d_u
real * d_u
energy
Definition: particle_handler.h:239
ParticleHandler::d_az_old
real * d_az_old
Definition: particle_handler.h:217
ParticleHandler::d_mass
real * d_mass
device mass array
Definition: particle_handler.h:191
ParticleHandler::resetPointer
void resetPointer()
Definition: particle_handler.cpp:728
ParticleHandler::_d_drhodt
real * _d_drhodt
Definition: particle_handler.h:251
ParticleHandler::h_drhodt
real * h_drhodt
host time derivative of density
Definition: particle_handler.h:88
ParticleHandler::_h_e
real * _h_e
Definition: particle_handler.h:72
ParticleHandler::copyMass
void copyMass(To::Target target=To::device, bool includePseudoParticles=false)
Definition: particle_handler.cpp:796
ParticleHandler::_d_uid
idInteger * _d_uid
Definition: particle_handler.h:225
ParticleHandler::d_g_az
real * d_g_az
Definition: particle_handler.h:216
ParticleHandler::_d_rho
real * _d_rho
Definition: particle_handler.h:243
ParticleHandler::h_p
real * h_p
host pressure
Definition: particle_handler.h:82
ParticleHandler::d_g_ax
real * d_g_ax
Definition: particle_handler.h:198
ParticleHandler::d_ax_old
real * d_ax_old
Definition: particle_handler.h:199
ParticleHandler::h_vx
real * h_vx
host x velocity
Definition: particle_handler.h:32
ParticleHandler::h_ay_old
real * h_ay_old
Definition: particle_handler.h:45
ParticleHandler::h_y
real * h_y
host y position
Definition: particle_handler.h:39
ParticleHandler::_h_x
real * _h_x
Definition: particle_handler.h:30
ParticleHandler::d_ay_old
real * d_ay_old
Definition: particle_handler.h:208
ParticleHandler::getEntry
T *& getEntry(Entry::Name entry, Execution::Location location=Execution::device)
Definition: particle_handler.cpp:604
ParticleHandler::d_numParticles
integer * d_numParticles
device number of particles
Definition: particle_handler.h:185
ParticleHandler::d_az
real * d_az
device z acceleration
Definition: particle_handler.h:215
ParticleHandler::h_g_ay
real * h_g_ay
Definition: particle_handler.h:44
ParticleHandler::_h_vx
real * _h_vx
Definition: particle_handler.h:32
ParticleHandler::copyDistribution
void copyDistribution(To::Target target=To::device, bool velocity=true, bool acceleration=true, bool includePseudoParticles=false)
Definition: particle_handler.cpp:873
ParticleHandler::_d_sml
real * _d_sml
Definition: particle_handler.h:229
ParticleHandler::_d_vz
real * _d_vz
Definition: particle_handler.h:213
ParticleHandler::_h_az
real * _h_az
Definition: particle_handler.h:52
ParticleHandler::_h_vz
real * _h_vz
Definition: particle_handler.h:50
ParticleHandler::h_dedt
real * h_dedt
host time derivative of internal energy
Definition: particle_handler.h:74
ParticleHandler::d_g_ax_old
real * d_g_ax_old
Definition: particle_handler.h:199
ParticleHandler::d_e
real * d_e
device internal energy
Definition: particle_handler.h:235
ParticleHandler::d_nodeType
integer * d_nodeType
Definition: particle_handler.h:221
ParticleHandler::_h_cs
real * _h_cs
Definition: particle_handler.h:78
ParticleHandler::numNodes
integer numNodes
(host) number of nodes
Definition: particle_handler.h:25
ParticleHandler::d_vx
real * d_vx
device x velocity
Definition: particle_handler.h:195
ParticleHandler::d_particles
Particles * d_particles
device instance of particles class
Definition: particle_handler.h:350
ParticleHandler::h_particles
Particles * h_particles
host instance of particles class
Definition: particle_handler.h:348
ParticleHandler::copyMatId
void copyMatId(To::Target target=To::device)
Definition: particle_handler.cpp:812
ParticleHandler::freeLeapfrog
void freeLeapfrog()
Definition: particle_handler.cpp:588
ParticleHandler::_d_p
real * _d_p
Definition: particle_handler.h:245
ParticleHandler::h_u
real * h_u
energy
Definition: particle_handler.h:76
ParticleHandler::h_vz
real * h_vz
host z velocity
Definition: particle_handler.h:50
ParticleHandler::_h_uid
idInteger * _h_uid
Definition: particle_handler.h:62
ParticleHandler::_h_z
real * _h_z
Definition: particle_handler.h:48
ParticleHandler::copySML
void copySML(To::Target target=To::device)
Definition: particle_handler.cpp:817
ParticleHandler::copyUid
void copyUid(To::Target target=To::device)
Definition: particle_handler.cpp:807
ParticleHandler::h_nnl
integer * h_nnl
host near(est) neighbor list
Definition: particle_handler.h:68
ParticleHandler::_h_dedt
real * _h_dedt
Definition: particle_handler.h:74
ParticleHandler::_d_y
real * _d_y
Definition: particle_handler.h:202
ParticleHandler::h_g_az_old
real * h_g_az_old
Definition: particle_handler.h:54
ParticleHandler::h_ax_old
real * h_ax_old
Definition: particle_handler.h:36
ParticleHandler::copyPosition
void copyPosition(To::Target target=To::device, bool includePseudoParticles=false)
Definition: particle_handler.cpp:822
ParticleHandler::h_g_az
real * h_g_az
Definition: particle_handler.h:53
ParticleHandler::_h_y
real * _h_y
Definition: particle_handler.h:39
ParticleHandler::d_uid
idInteger * d_uid
device unique identifier
Definition: particle_handler.h:225
ParticleHandler::h_materialId
integer * h_materialId
host material identifier
Definition: particle_handler.h:64
ParticleHandler::h_x
real * h_x
host x position
Definition: particle_handler.h:30
ParticleHandler::_d_ay
real * _d_ay
Definition: particle_handler.h:206
ParticleHandler::d_ax
real * d_ax
device x acceleration
Definition: particle_handler.h:197
ParticleHandler::_d_e
real * _d_e
Definition: particle_handler.h:235
ParticleHandler::h_mass
real * h_mass
host mass
Definition: particle_handler.h:28
ParticleHandler::numParticles
integer numParticles
(host) number of particles
Definition: particle_handler.h:23
ParticleHandler::d_y
real * d_y
device y position
Definition: particle_handler.h:202
ParticleHandler::d_sml
real * d_sml
device smoothing length
Definition: particle_handler.h:229
ParticleHandler::setPointer
void setPointer(IntegratedParticleHandler *integratedParticleHandler)
Definition: particle_handler.cpp:661
ParticleHandler::d_vy
real * d_vy
device y velocity
Definition: particle_handler.h:204
ParticleHandler::d_g_az_old
real * d_g_az_old
Definition: particle_handler.h:217
ParticleHandler::h_sml
real * h_sml
host smoothing length
Definition: particle_handler.h:66
ParticleHandler::_h_vy
real * _h_vy
Definition: particle_handler.h:41
ParticleHandler::_d_x
real * _d_x
Definition: particle_handler.h:193
ParticleHandler::_d_vy
real * _d_vy
Definition: particle_handler.h:204
ParticleHandler::h_cs
real * h_cs
host speed of sound
Definition: particle_handler.h:78
ParticleHandler::h_nodeType
integer * h_nodeType
Definition: particle_handler.h:58
ParticleHandler::h_z
real * h_z
host z position
Definition: particle_handler.h:48
ParticleHandler::d_cs
real * d_cs
device speed of sound
Definition: particle_handler.h:241
ParticleHandler::~ParticleHandler
~ParticleHandler()
Definition: particle_handler.cpp:365
ParticleHandler::_d_cs
real * _d_cs
Definition: particle_handler.h:241
ParticleHandler::h_g_ay_old
real * h_g_ay_old
Definition: particle_handler.h:45
ParticleHandler::d_level
integer * d_level
Definition: particle_handler.h:223
ParticleHandler::_d_az
real * _d_az
Definition: particle_handler.h:215
ParticleHandler::h_ay
real * h_ay
host y acceleration
Definition: particle_handler.h:43
ParticleHandler::d_x
real * d_x
device x position
Definition: particle_handler.h:193
ParticleHandler::h_g_ax
real * h_g_ax
Definition: particle_handler.h:35
ParticleHandler::copyVelocity
void copyVelocity(To::Target target=To::device, bool includePseudoParticles=false)
Definition: particle_handler.cpp:839
ParticleHandler::d_drhodt
real * d_drhodt
device time derivative of density
Definition: particle_handler.h:251
ParticleHandler::copyAcceleration
void copyAcceleration(To::Target target=To::device, bool includePseudoParticles=false)
Definition: particle_handler.cpp:856
ParticleHandler::_h_p
real * _h_p
Definition: particle_handler.h:82
ParticleHandler::copySPH
void copySPH(To::Target target)
Definition: particle_handler.cpp:889
ParticleHandler::_h_ay
real * _h_ay
Definition: particle_handler.h:43
ParticleHandler::ParticleHandler
ParticleHandler(integer numParticles, integer numNodes)
Definition: particle_handler.cpp:3
ParticleHandler::h_muijmax
real * h_muijmax
host max(mu_ij)
Definition: particle_handler.h:84
ParticleHandler::d_g_ay_old
real * d_g_ay_old
Definition: particle_handler.h:208
ParticleHandler::_h_ax
real * _h_ax
Definition: particle_handler.h:34
ParticleHandler::d_noi
integer * d_noi
device number of interaction
Definition: particle_handler.h:233
ParticleHandler::d_p
real * d_p
device pressure
Definition: particle_handler.h:245
ParticleHandler::_h_drhodt
real * _h_drhodt
Definition: particle_handler.h:88
ParticleHandler::h_vy
real * h_vy
host y velocity
Definition: particle_handler.h:41
ParticleHandler::_d_dedt
real * _d_dedt
Definition: particle_handler.h:237
ParticleHandler::h_uid
idInteger * h_uid
host unique identifier
Definition: particle_handler.h:62
ParticleHandler::d_g_ay
real * d_g_ay
Definition: particle_handler.h:207
ParticleHandler::_d_z
real * _d_z
Definition: particle_handler.h:211
ParticleHandler::h_g_ax_old
real * h_g_ax_old
Definition: particle_handler.h:36
ParticleHandler::_d_vx
real * _d_vx
Definition: particle_handler.h:195
ParticleHandler::initLeapfrog
void initLeapfrog()
Definition: particle_handler.cpp:549
ParticleHandler::d_vz
real * d_vz
device z velocity
Definition: particle_handler.h:213
ParticleHandler::d_rho
real * d_rho
device density
Definition: particle_handler.h:243
Particles
Particle(s) class based on SoA (Structur of Arrays).
Definition: particles.cuh:50
Particles::set
CUDA_CALLABLE_MEMBER void set(integer *numParticles, integer *numNodes, real *mass, real *x, real *y, real *z, real *vx, real *vy, real *vz, real *ax, real *ay, real *az, integer *level, idInteger *uid, integer *materialId, real *sml, integer *nnl, integer *noi, real *e, real *dedt, real *cs, real *rho, real *p)
Setter (DIM = 3) assigning variables to pointer members.
Definition: particles.cu:98
Particles::setLeapfrog
CUDA_CALLABLE_MEMBER void setLeapfrog(real *ax_old, real *ay_old, real *az_old, real *g_ax_old, real *g_ay_old, real *g_az_old)
Definition: particles.cu:160
Particles::setGravity
CUDA_CALLABLE_MEMBER void setGravity(real *g_ax, real *g_ay, real *g_az)
Constructor (DIM = 3) assigning gravitational acceleration to member variables.
Definition: particles.cu:139
Particles::setNodeType
CUDA_CALLABLE_MEMBER void setNodeType(integer *nodeType)
Setter for node type.
Definition: particles.cu:175
Particles::setArtificialViscosity
CUDA_CALLABLE_MEMBER void setArtificialViscosity(real *muijmax)
Setter for artificial viscosity (entry).
Definition: particles.cu:179
Particles::setIntegrateDensity
CUDA_CALLABLE_MEMBER void setIntegrateDensity(real *drhodt)
Setter in dependence of INTEGRATE_DENSITY.
Definition: particles.cu:191
Particles::setU
CUDA_CALLABLE_MEMBER void setU(real *u)
Setter for energy.
Definition: particles.cu:171
INFO
@ INFO
debug log type
Definition: logger.h:48
IntegratedParticlesNS::Kernel::Launch::setSML
void setSML(IntegratedParticles *integratedParticles, real *sml)
Definition: particles.cu:1159
IntegratedParticlesNS::Kernel::Launch::setIntegrateDensity
void setIntegrateDensity(IntegratedParticles *integratedParticles, real *drhodt)
Definition: particles.cu:1173
IntegratedParticlesNS::Kernel::Launch::set
void set(IntegratedParticles *integratedParticles, idInteger *uid, real *rho, real *e, real *dedt, real *p, real *cs, real *x, real *y, real *z, real *vx, real *vy, real *vz, real *ax, real *ay, real *az)
Definition: particles.cu:1122
ParticlesNS::Kernel::Launch::setU
void setU(Particles *particles, real *u)
Definition: particles.cu:730
ParticlesNS::Kernel::Launch::setIntegrateDensity
void setIntegrateDensity(Particles *particles, real *drhodt)
Definition: particles.cu:774
ParticlesNS::Kernel::Launch::setGravity
void setGravity(Particles *particles, real *g_ax, real *g_ay, real *g_az)
Definition: particles.cu:676
ParticlesNS::Kernel::Launch::setLeapfrog
void setLeapfrog(Particles *particles, real *ax_old, real *ay_old, real *az_old, real *g_ax_old, real *g_ay_old, real *g_az_old)
Definition: particles.cu:716
ParticlesNS::Kernel::Launch::set
void set(Particles *particles, integer *numParticles, integer *numNodes, real *mass, real *x, real *y, real *z, real *vx, real *vy, real *vz, real *ax, real *ay, real *az, integer *level, idInteger *uid, integer *materialId, real *sml, integer *nnl, integer *noi, real *e, real *dedt, real *cs, real *rho, real *p)
Definition: particles.cu:631
ParticlesNS::Kernel::Launch::setNodeType
void setNodeType(Particles *particles, integer *nodeType)
Definition: particles.cu:740
ParticlesNS::Kernel::Launch::setArtificialViscosity
void setArtificialViscosity(Particles *particles, real *muijmax)
Definition: particles.cu:751
ProfilerIds::numParticles
const char *const numParticles
Definition: h5profiler.h:29
cuda::copy
void copy(T *h_var, T *d_var, std::size_t count=1, To::Target copyTo=To::device)
Copy between host and device and vice-versa.
Definition: cuda_runtime.h:30
cuda::set
void set(T *d_var, T val, std::size_t count=1)
Set device memory to a specific value.
Definition: cuda_runtime.h:56
cuda::free
void free(T *d_var)
Free device memory.
Definition: cuda_runtime.h:81
cuda::malloc
void malloc(T *&d_var, std::size_t count)
Allocate device memory.
Definition: cuda_runtime.h:70
real
double real
Definition: parameter.h:15
MAX_NUM_INTERACTIONS
#define MAX_NUM_INTERACTIONS
Definition: parameter.h:106
integer
int integer
Definition: parameter.h:17
DIM
#define DIM
Dimension of the problem.
Definition: parameter.h:38
idInteger
int idInteger
Definition: parameter.h:19
Entry::Name
Name
Definition: parameter.h:255
Entry::mass
@ mass
Definition: parameter.h:263
Entry::y
@ y
Definition: parameter.h:258
Entry::x
@ x
Definition: parameter.h:256
Entry::z
@ z
Definition: parameter.h:260
Execution::Location
Location
Definition: parameter.h:192
Execution::device
@ device
Definition: parameter.h:193
Execution::host
@ host
Definition: parameter.h:193
To::Target
Target
Definition: parameter.h:164
To::device
@ device
Definition: parameter.h:165

milupHPC - src/particle_handler.cpp Source File
Generated on Wed Aug 31 2022 12:16:53 by Doxygen 1.9.3