@@ -435,6 +435,8 @@ bool CRadiativeTransfer::calcMonteCarloRadiationField(uint command,
435
435
// Init variables
436
436
ullong nr_of_photons = 0 ;
437
437
uint nr_used_wavelengths = 1 ;
438
+ ullong per_counter = 0 ;
439
+ float last_percentage = 0 ;
438
440
ullong kill_counter = 0 ;
439
441
ullong no_interaction_counter = 0 ;
440
442
uint mrw_counter = 0 ;
@@ -443,10 +445,6 @@ bool CRadiativeTransfer::calcMonteCarloRadiationField(uint command,
443
445
// A loop for each source
444
446
for (uint s = 0 ; s < max_source; s++)
445
447
{
446
- // Init variables
447
- ullong per_counter = 0 ;
448
- float last_percentage = 0 ;
449
-
450
448
// Init source from sources list
451
449
CSourceBasic * tm_source = sources_mc[s];
452
450
@@ -497,7 +495,6 @@ bool CRadiativeTransfer::calcMonteCarloRadiationField(uint command,
497
495
#endif
498
496
499
497
// Init progress visualization
500
- per_counter = 0 ;
501
498
cout << CLR_LINE;
502
499
switch (command)
503
500
{
@@ -545,7 +542,7 @@ bool CRadiativeTransfer::calcMonteCarloRadiationField(uint command,
545
542
per_counter++;
546
543
547
544
// Calculate percentage of total progress per source
548
- float percentage = 100 * float (per_counter) / float (nr_of_photons * nr_used_wavelengths);
545
+ float percentage = 100 * float (per_counter) / float (nr_of_photons * nr_used_wavelengths * max_source );
549
546
550
547
// Show only new percentage number if it changed
551
548
if ((percentage - last_percentage) > PERCENTAGE_STEP)
@@ -1322,9 +1319,9 @@ void CRadiativeTransfer::rayThroughCellForLvlPop(photon_package * pp,
1322
1319
bool CRadiativeTransfer::calcPolMapsViaMC ()
1323
1320
{
1324
1321
// Init variables
1325
- ullong nr_of_photons;
1326
- ullong per_counter, nr_of_wavelength ;
1327
- float last_percentage;
1322
+ ullong nr_of_photons, nr_of_wavelength ;
1323
+ ullong per_counter = 0 ;
1324
+ float last_percentage = 0 ;
1328
1325
uint mrw_counter = 0 ;
1329
1326
ullong kill_counter = 0 ;
1330
1327
ullong no_interaction_counter = 0 ;
@@ -1388,10 +1385,6 @@ bool CRadiativeTransfer::calcPolMapsViaMC()
1388
1385
cout << " -> MC pol. map(s) (source ID: " << s + 1 << " , wavelength: " << dust->getWavelength (wID)
1389
1386
<< " [m], photons: " << float (nr_of_photons) << " ) 0 [%] \r " << flush;
1390
1387
1391
- // Init counter and percentage to show progress
1392
- per_counter = 0 ;
1393
- last_percentage = 0 ;
1394
-
1395
1388
CRandomGenerator rand_gen = CRandomGenerator ();
1396
1389
// just an arbitrary, random number for the RNG seed
1397
1390
// this is NOT the seed for KISS
@@ -1417,7 +1410,7 @@ bool CRadiativeTransfer::calcPolMapsViaMC()
1417
1410
per_counter++;
1418
1411
1419
1412
// Calculate percentage of total progress per source
1420
- float percentage = 100.0 * float (per_counter) / float (nr_of_photons);
1413
+ float percentage = 100.0 * float (per_counter) / float (nr_of_photons * nr_of_wavelength * max_source );
1421
1414
1422
1415
// Show only new percentage number if it changed
1423
1416
if ((percentage - last_percentage) >= PERCENTAGE_STEP)
0 commit comments