Skip to content

Commit

Permalink
Add custom source flag to rebuild source on apply
Browse files Browse the repository at this point in the history
  • Loading branch information
tobre1 committed Jun 27, 2024
1 parent 225313a commit a6c7c2d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/viennaray/rayTrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ template <class NumericType, int D> class Trace {
Vec3D<Vec3D<NumericType>> orthonormalBasis;
if (usePrimaryDirection_)
orthonormalBasis = rayInternal::getOrthonormalBasis(primaryDirection_);
if (!pSource_)
if (!useCustomSource)
pSource_ = std::make_shared<SourceRandom<NumericType, D>>(
boundingBox, pParticle_->getSourceDistributionPower(), traceSettings,
geometry_.getNumPoints(), usePrimaryDirection_, orthonormalBasis);
Expand Down Expand Up @@ -132,10 +132,14 @@ template <class NumericType, int D> class Trace {
/// the raySource class.
void setSource(std::shared_ptr<Source<NumericType>> source) {
pSource_ = source;
useCustomSource = true;
}

/// Reset the source to the default random source.
void resetSource() { pSource_.reset(); }
void resetSource() {
pSource_.reset();
useCustomSource = false;
}

void enableProgressBar() { printProgress_ = true; }

Expand Down Expand Up @@ -382,6 +386,7 @@ template <class NumericType, int D> class Trace {

bool usePrimaryDirection_ = false;
bool useRandomSeeds_ = false;
bool useCustomSource = false;
size_t runNumber_ = 0;
bool calcFlux_ = true;
bool checkError_ = true;
Expand Down

0 comments on commit a6c7c2d

Please sign in to comment.