diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index 397ee24b01..5261a515cc 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -55,14 +55,14 @@ bool Foam::uniformSet::nextSample { bool pointFound = false; - const vector normOffset = offset/mag(offset); + const vector normOffset(offset/mag(offset)); samplePt += offset; ++sampleI; for (; sampleI < nPoints_; ++sampleI) { - scalar s = (samplePt - currentPt) & normOffset; + const scalar s = (samplePt - currentPt) & normOffset; if (s > -smallDist) { @@ -91,9 +91,8 @@ bool Foam::uniformSet::trackToBoundary ) const { // distance vector between sampling points - const vector offset = (end_ - start_)/(nPoints_ - 1); - const vector smallVec(tol_*offset); - const scalar smallDist = mag(smallVec); + const vector offset((end_ - start_)/(nPoints_ - 1)); + const scalar smallDist = mag(tol_*offset); point trackPt = singleParticle.position(); @@ -204,8 +203,8 @@ void Foam::uniformSet::calcSamples << exit(FatalError); } - const vector offset = (end_ - start_)/(nPoints_ - 1); - const vector normOffset = offset/mag(offset); + const vector offset((end_ - start_)/(nPoints_ - 1)); + const vector normOffset(offset/mag(offset)); const vector smallVec(tol_*offset); const scalar smallDist = mag(smallVec); @@ -235,7 +234,7 @@ void Foam::uniformSet::calcSamples label trackCelli = -1; label trackFacei = -1; - bool isSample = + const bool isSample = getTrackingPoint ( start_, @@ -324,7 +323,7 @@ void Foam::uniformSet::calcSamples while (bHitI < bHits.size()) { - scalar dist = + const scalar dist = (bHits[bHitI].hitPoint() - singleParticle.position()) & normOffset; diff --git a/src/sampling/sampledSet/uniform/uniformSet.H b/src/sampling/sampledSet/uniform/uniformSet.H index 4654b72a60..84c36ffae7 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.H +++ b/src/sampling/sampledSet/uniform/uniformSet.H @@ -28,17 +28,51 @@ Class Foam::uniformSet Description + A sampler type which provides a uniform distribution of \c nPoints + sample locations along a straight line specified between a given + \c start and an \c end points. - For a dictionary specification: +Usage + Example specification: + \verbatim + sets + ( + + { + // Mandatory entries + type uniform; + axis ; + start ; + end ; + nPoints