diff --git a/src/dataanalytics/HDA_SimStepRecorder.cpp b/src/dataanalytics/HDA_SimStepRecorder.cpp index 9f164ea07..fc37c1e46 100644 --- a/src/dataanalytics/HDA_SimStepRecorder.cpp +++ b/src/dataanalytics/HDA_SimStepRecorder.cpp @@ -326,9 +326,16 @@ void HDA_SimStepRecorder::recordScanner(){ scannerPositionZ->push(pos.z); // Record scanner angles double roll, pitch, yaw; - s.getHeadRelativeEmitterAttitude().getAngles( - &RotationOrder::XYZ, roll, pitch, yaw - ); + try { + s.getHeadRelativeEmitterAttitude().getAngles( + &RotationOrder::XYZ, roll, pitch, yaw + ); + } + catch(HeliosException &hex){ + roll = std::numeric_limits::quiet_NaN(); + pitch = std::numeric_limits::quiet_NaN(); + yaw = std::numeric_limits::quiet_NaN(); + } scannerRoll->push(roll); scannerPitch->push(pitch); scannerYaw->push(yaw); @@ -398,15 +405,18 @@ void HDA_SimStepRecorder::recordStochastic(){ // Obtain parallel randomness generator RandomnessGenerator *rg1Par = nullptr; + size_t nthreads = 0; WarehouseScanningPulseProcess * wspp = dynamic_cast(spp); if(wspp != nullptr){ rg1Par = wspp->pool.randGens; + nthreads = wspp->pool.getPoolSize(); } else{ BuddingScanningPulseProcess *bspp = dynamic_cast(spp); rg1Par = bspp->pool.randGens; + nthreads = wspp->pool.getPoolSize(); } // Prepare fake pulse @@ -434,12 +444,14 @@ void HDA_SimStepRecorder::recordStochastic(){ } // Record parallel measurement error - for(size_t i = 0 ; i < N_SAMPLES ; ++i) { - err = ERR_BASE; - fwpr.applyMeasurementError( - *rg1Par, err, fakePulse.getOriginRef(), fakePulse.getOriginRef() - ); - measErrPar->push(err-ERR_BASE); + if(nthreads > 0) { // There is no parallelism for empty thread pools + for (size_t i = 0; i < N_SAMPLES; ++i) { + err = ERR_BASE; + fwpr.applyMeasurementError( + *rg1Par, err, fakePulse.getOriginRef(), fakePulse.getOriginRef() + ); + measErrPar->push(err - ERR_BASE); + } } diff --git a/src/main/helios_version.cpp b/src/main/helios_version.cpp index 1d7f655bb..85cad96ce 100644 --- a/src/main/helios_version.cpp +++ b/src/main/helios_version.cpp @@ -4,7 +4,7 @@ const char * HELIOS_VERSION = "1.2.0"; -const char * HELIOS_GIT_HASH = "03b19a3a"; +const char * HELIOS_GIT_HASH = "a3909937"; const char * getHeliosVersion(){ return HELIOS_VERSION; diff --git a/src/scanner/ScanningDevice.cpp b/src/scanner/ScanningDevice.cpp index b39356ec3..085196463 100644 --- a/src/scanner/ScanningDevice.cpp +++ b/src/scanner/ScanningDevice.cpp @@ -323,19 +323,29 @@ double ScanningDevice::calcIntensity( double const targetArea, double const radius ) const { - double bdrf = 0; + double bdrf = 0, sigma = 0; if(mat.isPhong()) { bdrf = mat.reflectance * EnergyMaths::phongBDRF( incidenceAngle, mat.specularity, mat.specularExponent ); + sigma = EnergyMaths::calcCrossSection( + bdrf, targetArea, incidenceAngle + ); } else if(mat.isLambert()){ bdrf = mat.reflectance * std::cos(incidenceAngle); + sigma = EnergyMaths::calcCrossSection( + bdrf, targetArea, incidenceAngle + ); } else if(mat.isUniform()){ bdrf = mat.reflectance; + sigma = EnergyMaths::calcCrossSection( + bdrf, targetArea, incidenceAngle + ); + if(sigma < 0) sigma = -sigma; } else{ std::stringstream ss; @@ -343,9 +353,6 @@ double ScanningDevice::calcIntensity( << mat.name << "\""; logging::ERR(ss.str()); } - double const sigma = EnergyMaths::calcCrossSection( - bdrf, targetArea, incidenceAngle - ); return EnergyMaths::calcReceivedPower( averagePower_w, wavelength_m,