Skip to content

Commit

Permalink
Merge pull request #378 from albertoesmp/devel
Browse files Browse the repository at this point in the history
Fine-tuning performance
  • Loading branch information
albertoesmp authored Oct 5, 2023
2 parents 6818014 + d4a8449 commit 4d0c4d3
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/helios_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const char * HELIOS_VERSION = "1.2.0";

const char * HELIOS_GIT_HASH = "5cba90e3";
const char * HELIOS_GIT_HASH = "3d0656db";

const char * getHeliosVersion(){
return HELIOS_VERSION;
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/MultiScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Rotation MultiScanner::calcAbsoluteBeamAttitude(size_t const idx){
}
void MultiScanner::computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/MultiScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class MultiScanner : public Scanner{
*/
void computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
3 changes: 2 additions & 1 deletion src/scanner/Scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ class Scanner : public Asset {
*/
virtual void computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const
&subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/ScanningDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Rotation ScanningDevice::calcExactAbsoluteBeamAttitude(

void ScanningDevice::computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/ScanningDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class ScanningDevice : public Asset {
*/
void computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/SingleScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Rotation SingleScanner::calcAbsoluteBeamAttitude(size_t const idx) {
}
void SingleScanner::computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/SingleScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class SingleScanner : public Scanner{
*/
void computeSubrays(
std::function<void(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
6 changes: 3 additions & 3 deletions src/scanner/detector/FullWaveformPulseRunnable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void FullWaveformPulseRunnable::computeSubrays(
){
scanner->computeSubrays(
[&] (
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down Expand Up @@ -155,7 +155,7 @@ void FullWaveformPulseRunnable::computeSubrays(
}

void FullWaveformPulseRunnable::handleSubray(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
map<double, double> &reflections,
Expand Down Expand Up @@ -239,7 +239,7 @@ void FullWaveformPulseRunnable::handleSubray(
double intensity = 0.0;
if (intersect->prim->canComputeSigmaWithLadLut()) {
// LadLut based intensity computation
double sigma = intersect->prim->computeSigmaWithLadLut(
double const sigma = intersect->prim->computeSigmaWithLadLut(
subrayDirection
);
intensity = scanner->calcIntensity(
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/detector/FullWaveformPulseRunnable.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class FullWaveformPulseRunnable : public AbstractPulseRunnable {
* @see FullWaveformPulseRunnable::computeSubrays
*/
void handleSubray(
Rotation &subrayRotation,
Rotation const &subrayRotation,
double const divergenceAngle,
NoiseSource<double> &intersectionHandlingNoiseSource,
std::map<double, double> &reflections,
Expand Down
14 changes: 12 additions & 2 deletions src/util/Yielder.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,18 @@ class Yielder{
inline void push(T const &elem){
mtx.lock();
buffer.push_back(elem);
mtx.unlock();
if(buffer.size() >= bufferSize) yield();
if(buffer.size() >= bufferSize){
// Copy what must be written before releasing the mutex
vector<T> copy = copyBuffer();
// Empty buffer before releasing the mutex
buffer.clear();
mtx.unlock();
// Digest temporal copy
digest(copy);
}
else{
mtx.unlock();
}
}

/**
Expand Down

0 comments on commit 4d0c4d3

Please sign in to comment.