diff --git a/src/fileFormats/coordSet/coordSet.C b/src/fileFormats/coordSet/coordSet.C index ce53eaa56cfc9f6f449649cce9f06430cedb1ef5..e1ed73bc6add59a695dbf24b3b536dc5bf4c16ad 100644 --- a/src/fileFormats/coordSet/coordSet.C +++ b/src/fileFormats/coordSet/coordSet.C @@ -58,6 +58,19 @@ void Foam::coordSet::checkDimensions() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::coordSet::coordSet +( + const word& name, + const coordFormat axisType +) +: + pointField(), + name_(name), + axis_(axisType), + curveDist_() +{} + + Foam::coordSet::coordSet ( const word& name, diff --git a/src/fileFormats/coordSet/coordSet.H b/src/fileFormats/coordSet/coordSet.H index 705f8ec6945aa791d443a7f8908c31bd1678c211..765356fbfe46fb241c6609eeae05fd8755d1e96f 100644 --- a/src/fileFormats/coordSet/coordSet.H +++ b/src/fileFormats/coordSet/coordSet.H @@ -52,7 +52,6 @@ class coordSet : public pointField { - public: // Public data types @@ -94,8 +93,11 @@ public: //- Construct from components // Note: curveDist will be empty - coordSet(const word& name, const word& axis); + coordSet(const word& name, const coordFormat axisType); + //- Construct from components + // Note: curveDist will be empty + coordSet(const word& name, const word& axis); //- Copy construct from components coordSet @@ -128,19 +130,38 @@ public: return coordFormatNames[axis_]; } - //- Cumulative distance + //- Set the points + void setPoints(const List<point>& newPoints) + { + static_cast<pointField&>(*this) = newPoints; + } + + //- Set the points + void setPoints(List<point>&& newPoints) + { + static_cast<pointField&>(*this) = std::move(newPoints); + } + + //- Return the cumulative distance const scalarList& curveDist() const { return curveDist_; } - //- Set cumulative distance + //- Set the cumulative distance void setCurveDist(const scalarList& curveDist) { curveDist_ = curveDist; checkDimensions(); } + //- Set the cumulative distance + void setCurveDist(scalarList&& curveDist) + { + curveDist_ = std::move(curveDist); + checkDimensions(); + } + //- Is axis specification a vector bool hasVectorAxis() const; diff --git a/src/sampling/sampledSet/array/arraySet.C b/src/sampling/sampledSet/array/arraySet.C index 1ff788d173b189fcf3c40820c5b14a3d406aa06d..6c32f51bb11464e8d78e5b0ef2a459fbf0d4155b 100644 --- a/src/sampling/sampledSet/array/arraySet.C +++ b/src/sampling/sampledSet/array/arraySet.C @@ -68,15 +68,15 @@ void Foam::arraySet::calcSamples const scalar deltaz = spanBox_.z()/(pointsDensity_.z() + 1); label p(0); - for (label k=1; k<=pointsDensity_.z(); k++) + for (label k=1; k<=pointsDensity_.z(); ++k) { - for (label j=1; j<=pointsDensity_.y(); j++) + for (label j=1; j<=pointsDensity_.y(); ++j) { - for (label i=1; i<=pointsDensity_.x(); i++) + for (label i=1; i<=pointsDensity_.x(); ++i) { vector t(deltax*i , deltay*j, deltaz*k); sampleCoords[p] = coordSys_.origin() + t; - p++; + ++p; } } } @@ -126,14 +126,20 @@ void Foam::arraySet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -156,11 +162,6 @@ Foam::arraySet::arraySet spanBox_(spanBox) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -178,18 +179,7 @@ Foam::arraySet::arraySet spanBox_(dict.lookup("spanBox")) { genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::arraySet::~arraySet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/array/arraySet.H b/src/sampling/sampledSet/array/arraySet.H index da6c519a290f9fd2209d0df2a4ef8cd7828dcd2d..2954348728b4cea174358a0c847bb1a07e217e08 100644 --- a/src/sampling/sampledSet/array/arraySet.H +++ b/src/sampling/sampledSet/array/arraySet.H @@ -25,6 +25,18 @@ Class Foam::arraySet Description + Specifies an x,y,z array of uniformly distributed sampling points. + + For a dictionary specification: + \table + Property | Description | Required | Default + type | array | yes | + axis | x, y, z, xyz, distance | yes | + pointsDensity | The sampling density as (x y z) integers | yes | + spanBox | The sample box dimensions (vector) | yes | + \endtable + + The dictionary can also contain an embedded coordinateSystem specification. SourceFiles arraySet.C @@ -43,7 +55,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class passiveParticle; template<class Type> class particle; @@ -114,7 +126,7 @@ public: //- Destructor - virtual ~arraySet(); + virtual ~arraySet() = default; }; diff --git a/src/sampling/sampledSet/circle/circleSet.C b/src/sampling/sampledSet/circle/circleSet.C index c91aef3ba4931f0bdae911710ceb893bdace9a9d..ee30a5a90a8d3e0ce6f3bdad32ec31f88578fea5 100644 --- a/src/sampling/sampledSet/circle/circleSet.C +++ b/src/sampling/sampledSet/circle/circleSet.C @@ -111,7 +111,7 @@ void Foam::circleSet::calcSamples radius*constant::mathematical::pi/180.0*theta ); - nPoint++; + ++nPoint; } else { @@ -148,14 +148,20 @@ void Foam::circleSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -180,11 +186,6 @@ Foam::circleSet::circleSet dTheta_(dTheta) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -200,26 +201,15 @@ Foam::circleSet::circleSet origin_(dict.lookup("origin")), circleAxis_(dict.lookup("circleAxis")), startPoint_(dict.lookup("startPoint")), - dTheta_(readScalar(dict.lookup("dTheta"))) + dTheta_(dict.get<scalar>("dTheta")) { // Normalise circleAxis circleAxis_ /= mag(circleAxis_); genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::circleSet::~circleSet() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::point Foam::circleSet::getRefPoint(const List<point>& pts) const diff --git a/src/sampling/sampledSet/circle/circleSet.H b/src/sampling/sampledSet/circle/circleSet.H index b0e6ed13615234d95977fb22a1609e3665f8aa35..5d4cb5973497e7bbeba5836db4138e39ce1cc401 100644 --- a/src/sampling/sampledSet/circle/circleSet.H +++ b/src/sampling/sampledSet/circle/circleSet.H @@ -27,6 +27,17 @@ Class Description Samples along a circular path + For a dictionary specification: + \table + Property | Description | Required | Default + type | circle | yes | + axis | x, y, z, xyz, distance | yes | + origin | The origin of the circle | yes | + circleAxis | The axis of the circle | yes | + startPoint | Starting point of the circle | yes | + dTheta | Sampling increment in degrees | yes | + \endtable + SourceFiles circleSet.C @@ -43,7 +54,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class meshSearch; /*---------------------------------------------------------------------------*\ @@ -121,15 +132,14 @@ public: ); - // Destructor - - virtual ~circleSet(); + //- Destructor + virtual ~circleSet() = default; // Member Functions //- Get reference point - virtual point getRefPoint(const List<point>&) const; + virtual point getRefPoint(const List<point>& pts) const; }; diff --git a/src/sampling/sampledSet/cloud/cloudSet.C b/src/sampling/sampledSet/cloud/cloudSet.C index 79b7f8f4a9bd461db0d2e3e268a8355b33844146..8232696a036206e68c36a15e13daa7a47adea1cf 100644 --- a/src/sampling/sampledSet/cloud/cloudSet.C +++ b/src/sampling/sampledSet/cloud/cloudSet.C @@ -161,14 +161,20 @@ void Foam::cloudSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -187,11 +193,6 @@ Foam::cloudSet::cloudSet sampleCoords_(sampleCoords) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -207,18 +208,7 @@ Foam::cloudSet::cloudSet sampleCoords_(dict.lookup("points")) { genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::cloudSet::~cloudSet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/cloud/cloudSet.H b/src/sampling/sampledSet/cloud/cloudSet.H index c312bff44cc62b2ba4f998f72bd177a3a7446d14..b4f5a334818cc712ec69d7d217810fe54b6103c3 100644 --- a/src/sampling/sampledSet/cloud/cloudSet.H +++ b/src/sampling/sampledSet/cloud/cloudSet.H @@ -25,6 +25,15 @@ Class Foam::cloudSet Description + Samples at arbitrary locations with a volume mesh. + + For a dictionary specification: + \table + Property | Description | Required | Default + type | cloud | yes | + axis | x, y, z, xyz, distance | yes | + points | The locations | yes | + \endtable SourceFiles cloudSet.C @@ -42,12 +51,12 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class passiveParticle; template<class Type> class particle; /*---------------------------------------------------------------------------*\ - Class cloudSet Declaration + Class cloudSet Declaration \*---------------------------------------------------------------------------*/ class cloudSet @@ -105,7 +114,7 @@ public: //- Destructor - virtual ~cloudSet(); + virtual ~cloudSet() = default; }; diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index bf1793d94444ad6008e932864ef62a9619b8118a..f259200d94bc643ca5ca05d4bd3fa37ed2010f17 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -36,10 +36,10 @@ namespace Foam { defineTypeNameAndDebug(faceOnlySet, 0); addToRunTimeSelectionTable(sampledSet, faceOnlySet, word); - - const scalar faceOnlySet::tol = 1e-6; } +const Foam::scalar Foam::faceOnlySet::tol = 1e-6; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -60,7 +60,7 @@ bool Foam::faceOnlySet::trackToBoundary point trackPt = singleParticle.position(); - while(true) + while (true) { point oldPoint = trackPt; @@ -265,7 +265,7 @@ void Foam::faceOnlySet::calcSamples } else { - bHitI++; + ++bHitI; } } @@ -280,7 +280,7 @@ void Foam::faceOnlySet::calcSamples trackPt = pushIn(bHits[bHitI].hitPoint(), trackFacei); trackCelli = getBoundaryCell(trackFacei); - segmentI++; + ++segmentI; startSegmentI = samplingPts.size(); } @@ -313,15 +313,20 @@ void Foam::faceOnlySet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); - // Copy into *this + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -342,11 +347,6 @@ Foam::faceOnlySet::faceOnlySet end_(end) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -363,18 +363,7 @@ Foam::faceOnlySet::faceOnlySet end_(dict.lookup("end")) { genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::faceOnlySet::~faceOnlySet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/face/faceOnlySet.H b/src/sampling/sampledSet/face/faceOnlySet.H index 39c1dcda59cf48a7d79d1f7ccba0d69f687b500a..4fee951ddae84f3de2758e7a62f571b066ddf57e 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.H +++ b/src/sampling/sampledSet/face/faceOnlySet.H @@ -25,6 +25,16 @@ Class Foam::faceOnlySet Description + Sample on faces along a specified path + + For a dictionary specification: + \table + Property | Description | Required | Default + type | face | yes | + axis | x, y, z, xyz, distance | yes | + start | The start point | yes | + end | The end point | yes | + \endtable SourceFiles faceOnlySet.C @@ -129,7 +139,7 @@ public: //- Destructor - virtual ~faceOnlySet(); + virtual ~faceOnlySet() = default; // Member Functions diff --git a/src/sampling/sampledSet/midPoint/midPointSet.C b/src/sampling/sampledSet/midPoint/midPointSet.C index 38031ee7b00ead9c8bd59e1817d0492c7810baff..ea3db892c4fcd259d731a0b1eb88d3b2648cedb7 100644 --- a/src/sampling/sampledSet/midPoint/midPointSet.C +++ b/src/sampling/sampledSet/midPoint/midPointSet.C @@ -69,10 +69,10 @@ void Foam::midPointSet::genSamples() midCells[mSamplei] = cellm; midSegments[mSamplei] = segments_[samplei]; midCurveDist[mSamplei] = mag(midPoints[mSamplei] - start()); - mSamplei++; + ++mSamplei; } - samplei++; + ++samplei; } if (samplei == size() - 1) @@ -80,7 +80,7 @@ void Foam::midPointSet::genSamples() break; } - samplei++; + ++samplei; } midPoints.setSize(mSamplei); @@ -88,14 +88,22 @@ void Foam::midPointSet::genSamples() midSegments.setSize(mSamplei); midCurveDist.setSize(mSamplei); + labelList midFaces(midCells.size(), -1); + + // Move into *this setSamples ( - midPoints, - midCells, - labelList(midCells.size(), -1), - midSegments, - midCurveDist + std::move(midPoints), + std::move(midCells), + std::move(midFaces), + std::move(midSegments), + std::move(midCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -114,11 +122,6 @@ Foam::midPointSet::midPointSet faceOnlySet(name, mesh, searchEngine, axis, start, end) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -133,18 +136,7 @@ Foam::midPointSet::midPointSet faceOnlySet(name, mesh, searchEngine, dict) { genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::midPointSet::~midPointSet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/midPoint/midPointSet.H b/src/sampling/sampledSet/midPoint/midPointSet.H index 679acbc8bf97a8eb10788a7e120d15efb15510fc..8068f42cfc811655cc27f548842942a16c107575 100644 --- a/src/sampling/sampledSet/midPoint/midPointSet.H +++ b/src/sampling/sampledSet/midPoint/midPointSet.H @@ -41,7 +41,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class meshSearch; /*---------------------------------------------------------------------------*\ @@ -87,7 +87,7 @@ public: //- Destructor - virtual ~midPointSet(); + virtual ~midPointSet() = default; }; diff --git a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C index 1628ca50ef1c5889f6fe20757515a0eb9758775f..f62c5242cbf9574bf6ff80c6c0e1f416a35068cd 100644 --- a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C @@ -60,7 +60,7 @@ void Foam::midPointAndFaceSet::genSamples() mpfSampleFaces[mpfSamplei] = faces_[samplei]; mpfSampleSegments[mpfSamplei] = segments_[samplei]; mpfSampleCurveDist[mpfSamplei] = curveDist_[samplei]; - mpfSamplei++; + ++mpfSamplei; while ( @@ -80,7 +80,7 @@ void Foam::midPointAndFaceSet::genSamples() mpfSampleCurveDist[mpfSamplei] = mag(mpfSamplePoints[mpfSamplei] - start()); - mpfSamplei++; + ++mpfSamplei; } // Add second face @@ -91,16 +91,16 @@ void Foam::midPointAndFaceSet::genSamples() mpfSampleCurveDist[mpfSamplei] = mag(mpfSamplePoints[mpfSamplei] - start()); - mpfSamplei++; + ++mpfSamplei; - samplei++; + ++samplei; } if (samplei == size() - 1) { break; } - samplei++; + ++samplei; } mpfSamplePoints.setSize(mpfSamplei); @@ -109,16 +109,23 @@ void Foam::midPointAndFaceSet::genSamples() mpfSampleSegments.setSize(mpfSamplei); mpfSampleCurveDist.setSize(mpfSamplei); + // Move into *this setSamples ( - mpfSamplePoints, - mpfSampleCells, - mpfSampleFaces, - mpfSampleSegments, - mpfSampleCurveDist + std::move(mpfSamplePoints), + std::move(mpfSampleCells), + std::move(mpfSampleFaces), + std::move(mpfSampleSegments), + std::move(mpfSampleCurveDist) ); + + if (debug) + { + write(Info); + } } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::midPointAndFaceSet::midPointAndFaceSet @@ -134,11 +141,6 @@ Foam::midPointAndFaceSet::midPointAndFaceSet faceOnlySet(name, mesh, searchEngine, axis, start, end) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -153,18 +155,7 @@ Foam::midPointAndFaceSet::midPointAndFaceSet faceOnlySet(name, mesh, searchEngine, dict) { genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::midPointAndFaceSet::~midPointAndFaceSet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H index ee2b13cc82ed1618cbdf3436c771b07acce07f46..f0b949d55b98a1409d2e5fcd981d568a0f138512 100644 --- a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H @@ -41,11 +41,11 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class meshSearch; /*---------------------------------------------------------------------------*\ - Class midPointAndFaceSet Declaration + Class midPointAndFaceSet Declaration \*---------------------------------------------------------------------------*/ class midPointAndFaceSet @@ -88,7 +88,7 @@ public: //- Destructor - virtual ~midPointAndFaceSet(); + virtual ~midPointAndFaceSet() = default; }; diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.C b/src/sampling/sampledSet/patchCloud/patchCloudSet.C index 12c0b4a8df8659f85cd6c8268e690bc962b4520f..cb41e1fb723e4e4a421acc116ebc1dc54f8d1820 100644 --- a/src/sampling/sampledSet/patchCloud/patchCloudSet.C +++ b/src/sampling/sampledSet/patchCloud/patchCloudSet.C @@ -180,9 +180,9 @@ void Foam::patchCloudSet::calcSamples if (nearest[i].first().hit()) { meshTools::writeOBJ(str, sampleCoords_[i]); - vertI++; + ++vertI; meshTools::writeOBJ(str, nearest[i].first().hitPoint()); - vertI++; + ++vertI; str << "l " << vertI-1 << ' ' << vertI << nl; } } @@ -256,6 +256,11 @@ void Foam::patchCloudSet::genSamples() samplingSegments, samplingCurveDist ); + + if (debug) + { + write(Info); + } } @@ -278,11 +283,6 @@ Foam::patchCloudSet::patchCloudSet searchDist_(searchDist) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -303,14 +303,9 @@ Foam::patchCloudSet::patchCloudSet wordReList(dict.lookup("patches")) ) ), - searchDist_(readScalar(dict.lookup("maxDistance"))) + searchDist_(dict.get<scalar>("maxDistance")) { genSamples(); - - if (debug) - { - write(Info); - } } diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.H b/src/sampling/sampledSet/patchCloud/patchCloudSet.H index c6a87c74e13bf8c58f1f7bbacd5f7d52dc69d922..99a17e8d26c344cac501c7e12f161d159ba71b1c 100644 --- a/src/sampling/sampledSet/patchCloud/patchCloudSet.H +++ b/src/sampling/sampledSet/patchCloud/patchCloudSet.H @@ -25,8 +25,17 @@ Class Foam::patchCloudSet Description - Like cloudSet but samples nearest patch face - + Like Foam::cloudSet but samples nearest patch face + + For a dictionary specification: + \table + Property | Description | Required | Default + type | patchCloud | yes | + axis | x, y, z, xyz, distance | yes | + patches | List of patch names or regexs | yes | + points | List of selected locations | yes | + maxDistance | Max serach distance | yes | + \endtable SourceFiles patchCloudSet.C diff --git a/src/sampling/sampledSet/patchSeed/patchSeedSet.C b/src/sampling/sampledSet/patchSeed/patchSeedSet.C index 4ecb3761d616fcbb0b6a0bdbb0728a50869c1960..ed03419c9eb9de03c14a3a5e2eff3902cab1478d 100644 --- a/src/sampling/sampledSet/patchSeed/patchSeedSet.C +++ b/src/sampling/sampledSet/patchSeed/patchSeedSet.C @@ -223,7 +223,7 @@ void Foam::patchSeedSet::calcSamples label(scalar(patchFaces.size())/totalSize*maxPoints_); labelList subset = identity(patchFaces.size()); - for (label iter = 0; iter < 4; iter++) + for (label iter = 0; iter < 4; ++iter) { forAll(subset, i) { @@ -316,14 +316,20 @@ void Foam::patchSeedSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -345,7 +351,7 @@ Foam::patchSeedSet::patchSeedSet wordReList(dict.lookup("patches")) ) ), - maxPoints_(readLabel(dict.lookup("maxPoints"))), + maxPoints_(dict.get<label>("maxPoints")), selectedLocations_ ( dict.lookupOrDefault<pointField> @@ -356,11 +362,6 @@ Foam::patchSeedSet::patchSeedSet ) { genSamples(); - - if (debug) - { - write(Info); - } } diff --git a/src/sampling/sampledSet/patchSeed/patchSeedSet.H b/src/sampling/sampledSet/patchSeed/patchSeedSet.H index 59c31feca72a7d72c82efbb1436804c8f26c4991..44b762f21a4e428f1270622e66209e5a36280ffc 100644 --- a/src/sampling/sampledSet/patchSeed/patchSeedSet.H +++ b/src/sampling/sampledSet/patchSeed/patchSeedSet.H @@ -27,6 +27,16 @@ Class Description Initialises points on or just off patch + For a dictionary specification: + \table + Property | Description | Required | Default + type | patchSeed | yes | + axis | x, y, z, xyz, distance | yes | + patches | List of patch names or regexs | yes | + maxPoints | Max number of points to seed | yes | + points | List of selected locations | no | empty + \endtable + SourceFiles patchSeedSet.C diff --git a/src/sampling/sampledSet/polyLine/polyLineSet.C b/src/sampling/sampledSet/polyLine/polyLineSet.C index 1c19c4bf5b23f224b98b9728f26db348c6f1bf20..21253f929d7f7ce9030c77c131708b912764bf2f 100644 --- a/src/sampling/sampledSet/polyLine/polyLineSet.C +++ b/src/sampling/sampledSet/polyLine/polyLineSet.C @@ -36,10 +36,10 @@ namespace Foam { defineTypeNameAndDebug(polyLineSet, 0); addToRunTimeSelectionTable(sampledSet, polyLineSet, word); - - const scalar polyLineSet::tol = 1e-6; } +const Foam::scalar Foam::polyLineSet::tol = 1e-6; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -99,7 +99,7 @@ bool Foam::polyLineSet::trackToBoundary samplingCurveDist.append(sampleI + dist); // go to next samplePt - sampleI++; + ++sampleI; if (sampleI == sampleCoords_.size() - 1) { @@ -129,7 +129,7 @@ void Foam::polyLineSet::calcSamples << sampleCoords_ << exit(FatalError); } point oldPoint = sampleCoords_[0]; - for (label sampleI = 1; sampleI < sampleCoords_.size(); sampleI++) + for (label sampleI = 1; sampleI < sampleCoords_.size(); ++sampleI) { if (mag(sampleCoords_[sampleI] - oldPoint) < SMALL) { @@ -229,7 +229,7 @@ void Foam::polyLineSet::calcSamples if (trackCelli == -1) { // No intersection found. Go to next point - sampleI++; + ++sampleI; } } while ((trackCelli == -1) && (sampleI < sampleCoords_.size() - 1)); @@ -281,7 +281,7 @@ void Foam::polyLineSet::calcSamples // Find next boundary. - sampleI++; + ++sampleI; if (sampleI == sampleCoords_.size() - 1) { @@ -291,7 +291,7 @@ void Foam::polyLineSet::calcSamples break; } - segmentI++; + ++segmentI; startSegmentI = samplingPts.size(); } @@ -324,14 +324,20 @@ void Foam::polyLineSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -350,11 +356,6 @@ Foam::polyLineSet::polyLineSet sampleCoords_(sampleCoords) { genSamples(); - - if (debug) - { - write(Info); - } } @@ -370,18 +371,7 @@ Foam::polyLineSet::polyLineSet sampleCoords_(dict.lookup("points")) { genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::polyLineSet::~polyLineSet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/polyLine/polyLineSet.H b/src/sampling/sampledSet/polyLine/polyLineSet.H index c97ff9fc7d0de9742920d2421dcf0743dbf67480..d984ce5da140f70bc1c54c4fb978d75616e540d0 100644 --- a/src/sampling/sampledSet/polyLine/polyLineSet.H +++ b/src/sampling/sampledSet/polyLine/polyLineSet.H @@ -27,6 +27,14 @@ Class Description Sample along poly line defined by a list of points (knots) + For a dictionary specification: + \table + Property | Description | Required | Default + type | polyLine | yes | + axis | x, y, z, xyz, distance | yes | + points | The locations | yes | + \endtable + SourceFiles polyLineSet.C @@ -98,7 +106,7 @@ public: // Static data //- Tolerance when comparing points relative to difference between - // start_ and end_ + //- start and end points static const scalar tol; @@ -125,7 +133,7 @@ public: //- Destructor - virtual ~polyLineSet(); + virtual ~polyLineSet() = default; }; diff --git a/src/sampling/sampledSet/sampledSet/sampledSet.C b/src/sampling/sampledSet/sampledSet/sampledSet.C index dff48c26f7459eef2ec1dfc6f8e3ec2d5ab68905..f13fce7c77ff1781ce70a48505893d0c0b054a6e 100644 --- a/src/sampling/sampledSet/sampledSet/sampledSet.C +++ b/src/sampling/sampledSet/sampledSet/sampledSet.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,6 +42,28 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +void Foam::sampledSet::checkDimensions() const +{ + if + ( + (cells_.size() != size()) + || (faces_.size() != size()) + || (segments_.size() != size()) + || (curveDist_.size() != size()) + ) + { + FatalErrorInFunction + << "sizes not equal : " + << " points:" << size() + << " cells:" << cells_.size() + << " faces:" << faces_.size() + << " segments:" << segments_.size() + << " curveDist:" << curveDist_.size() + << abort(FatalError); + } +} + + Foam::label Foam::sampledSet::getBoundaryCell(const label facei) const { return mesh().faceOwner()[facei]; @@ -69,7 +91,7 @@ Foam::label Foam::sampledSet::pointInCell { // Collect the face owner and neighbour cells of the sample into an array // for convenience - label cells[4] = + const label cells[4] = { mesh().faceOwner()[faces_[samplei]], getNeighbourCell(faces_[samplei]), @@ -90,7 +112,7 @@ Foam::label Foam::sampledSet::pointInCell // otherwise ignore if (!mesh().pointInCell(p, cellm, searchEngine_.decompMode())) { - cellm = -1; + cellm = -1; if (debug) { @@ -104,7 +126,7 @@ Foam::label Foam::sampledSet::pointInCell { // If the sample does not pass through a single cell check if the point // is in any of the owners or neighbours otherwise ignore - for (label i=0; i<4; i++) + for (label i=0; i<4; ++i) { if (mesh().pointInCell(p, cells[i], searchEngine_.decompMode())) { @@ -238,7 +260,7 @@ Foam::point Foam::sampledSet::pushIn tetPtI ); - iterNo++; + ++iterNo; } while (tetFacei < 0 && iterNo <= trap); } @@ -367,39 +389,34 @@ void Foam::sampledSet::setSamples const scalarList& samplingCurveDist ) { - setSize(samplingPts.size()); - cells_.setSize(samplingCells.size()); - faces_.setSize(samplingFaces.size()); - segments_.setSize(samplingSegments.size()); - curveDist_.setSize(samplingCurveDist.size()); - - if - ( - (cells_.size() != size()) - || (faces_.size() != size()) - || (segments_.size() != size()) - || (curveDist_.size() != size()) - ) - { - FatalErrorInFunction - << "sizes not equal : " - << " points:" << size() - << " cells:" << cells_.size() - << " faces:" << faces_.size() - << " segments:" << segments_.size() - << " curveDist:" << curveDist_.size() - << abort(FatalError); - } - - forAll(samplingPts, sampleI) - { - operator[](sampleI) = samplingPts[sampleI]; - } + setPoints(samplingPts); curveDist_ = samplingCurveDist; + segments_ = samplingSegments; cells_ = samplingCells; faces_ = samplingFaces; - segments_ = samplingSegments; + + checkDimensions(); +} + + +void Foam::sampledSet::setSamples +( + List<point>&& samplingPts, + labelList&& samplingCells, + labelList&& samplingFaces, + labelList&& samplingSegments, + scalarList&& samplingCurveDist +) +{ + setPoints(std::move(samplingPts)); + curveDist_ = std::move(samplingCurveDist); + + segments_ = std::move(samplingSegments); + cells_ = std::move(samplingCells); + faces_ = std::move(samplingFaces); + + checkDimensions(); } @@ -461,15 +478,12 @@ Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather SortableList<scalar> sortedDist(allCurveDist); indexSet = sortedDist.indices(); - return autoPtr<coordSet> + return autoPtr<coordSet>::New ( - new coordSet - ( - name(), - axis(), - List<point>(UIndirectList<point>(allPts, indexSet)), - sortedDist - ) + name(), + axis(), + List<point>(UIndirectList<point>(allPts, indexSet)), + sortedDist ); } @@ -481,15 +495,15 @@ Foam::sampledSet::sampledSet const word& name, const polyMesh& mesh, const meshSearch& searchEngine, - const word& axis + const coordSet::coordFormat axisType ) : - coordSet(name, axis), + coordSet(name, axisType), mesh_(mesh), searchEngine_(searchEngine), - segments_(0), - cells_(0), - faces_(0) + segments_(), + cells_(), + faces_() {} @@ -498,21 +512,32 @@ Foam::sampledSet::sampledSet const word& name, const polyMesh& mesh, const meshSearch& searchEngine, - const dictionary& dict + const word& axis ) : - coordSet(name, dict.lookup("axis")), + coordSet(name, axis), mesh_(mesh), searchEngine_(searchEngine), - segments_(0), - cells_(0), - faces_(0) + segments_(), + cells_(), + faces_() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::sampledSet::~sampledSet() +Foam::sampledSet::sampledSet +( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const dictionary& dict +) +: + coordSet(name, dict.get<word>("axis")), + mesh_(mesh), + searchEngine_(searchEngine), + segments_(), + cells_(), + faces_() {} @@ -526,7 +551,7 @@ Foam::autoPtr<Foam::sampledSet> Foam::sampledSet::New const dictionary& dict ) { - const word sampleType(dict.lookup("type")); + const word sampleType(dict.get<word>("type")); auto cstrIter = wordConstructorTablePtr_->cfind(sampleType); @@ -535,7 +560,7 @@ Foam::autoPtr<Foam::sampledSet> Foam::sampledSet::New FatalErrorInFunction << "Unknown sample type " << sampleType << nl << nl - << "Valid sample types : " << endl + << "Valid sample types : " << nl << wordConstructorTablePtr_->sortedToc() << exit(FatalError); } @@ -557,13 +582,13 @@ Foam::Ostream& Foam::sampledSet::write(Ostream& os) const { coordSet::write(os); - os << endl << "\t(celli)\t(facei)" << endl; + os << nl << "\t(celli)\t(facei)" << nl; - forAll(*this, sampleI) + forAll(*this, samplei) { - os << '\t' << cells_[sampleI] - << '\t' << faces_[sampleI] - << endl; + os << '\t' << cells_[samplei] + << '\t' << faces_[samplei] + << nl; } return os; diff --git a/src/sampling/sampledSet/sampledSet/sampledSet.H b/src/sampling/sampledSet/sampledSet/sampledSet.H index 9d78d7dc9f292fa8f5c44f18baea10282e9a53ce..a5f018c7e3fc5f3af2368c08c3456413c5d70079 100644 --- a/src/sampling/sampledSet/sampledSet/sampledSet.H +++ b/src/sampling/sampledSet/sampledSet/sampledSet.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,6 +36,12 @@ Description Each 'sampledSet' has a name and a specifier of how the axis should be write (x/y/z component or all 3 components) + For a dictionary specification: + \table + Property | Description | Required | Default + axis | x, y, z, xyz, distance | yes | + \endtable + SourceFiles sampledSet.C @@ -54,7 +60,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class polyMesh; class meshSearch; @@ -89,6 +95,9 @@ protected: // Protected Member Functions + //- Check for consistent sizing + void checkDimensions() const; + //- Returns cell next to boundary face label getBoundaryCell(const label) const; @@ -135,7 +144,7 @@ protected: label& trackFacei ) const; - //- Sets sample data + //- Set sample data. Copy list contents. void setSamples ( const List<point>& samplingPts, @@ -145,6 +154,15 @@ protected: const scalarList& samplingCurveDist ); + //- Set sample data. Move list contents. + void setSamples + ( + List<point>&& samplingPts, + labelList&& samplingCells, + labelList&& samplingFaces, + labelList&& samplingSegments, + scalarList&& samplingCurveDist + ); public: @@ -195,6 +213,15 @@ public: // Constructors + //- Construct from components + sampledSet + ( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const coordSet::coordFormat axisType + ); + //- Construct from components sampledSet ( @@ -234,7 +261,7 @@ public: //- Destructor - virtual ~sampledSet(); + virtual ~sampledSet() = default; // Member Functions @@ -267,8 +294,8 @@ public: //- Output for debugging Ostream& write(Ostream&) const; - //- Helper: gather onto master and sort. Return (on master) gathered set - // and overall sort order + //- Helper: gather onto master and sort. + // \return (on master) gathered set and overall sort order autoPtr<coordSet> gather(labelList& indexSet) const; }; diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H index 9ae1bd01f29c28c1f6f158b6e6721a6156e8e9a4..60bcfc7002760e9c7f515920bf448a83f1e282d2 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.H +++ b/src/sampling/sampledSet/sampledSets/sampledSets.H @@ -26,7 +26,7 @@ Class Description Set of sets to sample. - Call sampledSets.write() to sample&write files. + Call sampledSets.write() to sample and write files. SourceFiles sampledSets.C @@ -50,7 +50,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class Time; class objectRegistry; class dictionary; diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C index 5186920e32267772bb9953afc00f759bdf73ea4f..6c6078bbbdc2e2b169d4f17d6858344cc8f6cec0 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C +++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C @@ -223,7 +223,7 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields) { if (fields.size()) { - bool interpolate = interpolationScheme_ != "cell"; + const bool interpolate = interpolationScheme_ != "cell"; // Create or use existing writer if (fields.formatter.empty()) diff --git a/src/sampling/sampledSet/shortestPath/shortestPathSet.C b/src/sampling/sampledSet/shortestPath/shortestPathSet.C index d289f43b9749771978142260edc0082dae92b9ab..778fd7aab49af3615569a9b42578a476b9fe5151 100644 --- a/src/sampling/sampledSet/shortestPath/shortestPathSet.C +++ b/src/sampling/sampledSet/shortestPath/shortestPathSet.C @@ -272,20 +272,27 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh) } } } + samplingPts.shrink(); samplingCells.shrink(); samplingFaces.shrink(); samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -306,11 +313,6 @@ Foam::shortestPathSet::shortestPathSet outsidePoints_(outsidePoints) { genSamples(mesh); - - if (debug) - { - write(Info); - } } @@ -327,18 +329,7 @@ Foam::shortestPathSet::shortestPathSet outsidePoints_(dict.lookup("outsidePoints")) { genSamples(mesh); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::shortestPathSet::~shortestPathSet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/shortestPath/shortestPathSet.H b/src/sampling/sampledSet/shortestPath/shortestPathSet.H index 0cfa5b159849cc077f3d9d5de579ca07f56d4bdb..9f9181033c2609e75f91cd3e74279fcc1f5faa91 100644 --- a/src/sampling/sampledSet/shortestPath/shortestPathSet.H +++ b/src/sampling/sampledSet/shortestPath/shortestPathSet.H @@ -55,6 +55,15 @@ Usage } \endverbatim + For a dictionary specification: + \table + Property | Description | Required | Default + type | shortestPath | yes | + axis | x, y, z, xyz, distance | yes | + insidePoints | The inside points | yes | + outsidePoints | The outside points | yes | + \endtable + SourceFiles shortestPathSet.C @@ -134,7 +143,7 @@ public: //- Destructor - virtual ~shortestPathSet(); + virtual ~shortestPathSet() = default; }; diff --git a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C index fe6643cd9e54231360325cb7c7f9578ca16bf9af..557e8bad9d112d05164b59f50eac4a09cfd2f2c4 100644 --- a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C +++ b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C @@ -91,14 +91,20 @@ void Foam::triSurfaceMeshPointSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Info); + } } @@ -113,7 +119,7 @@ Foam::triSurfaceMeshPointSet::triSurfaceMeshPointSet ) : sampledSet(name, mesh, searchEngine, dict), - surface_(dict.lookup("surface")) + surface_(dict.get<word>("surface")) { // Load surface. if (mesh.time().foundObject<triSurfaceMesh>(surface_)) @@ -143,34 +149,23 @@ Foam::triSurfaceMeshPointSet::triSurfaceMeshPointSet } genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::triSurfaceMeshPointSet::~triSurfaceMeshPointSet() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::point Foam::triSurfaceMeshPointSet::getRefPoint(const List<point>& pts) - const +Foam::point Foam::triSurfaceMeshPointSet::getRefPoint +( + const List<point>& pts +) const { if (pts.size()) { // Use first samplePt as starting point - return pts[0]; - } - else - { - return Zero; + return pts.first(); } + + return Zero; } diff --git a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.H b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.H index 92ef83ebf862134ea1c085efa0a31077dae778b4..da99bcb354919c5dba83167522c6a7ca2d786a00 100644 --- a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.H +++ b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.H @@ -25,7 +25,15 @@ Class Foam::triSurfaceMeshPointSet Description - sampleSet from all points of a triSurfaceMesh. + A sampleSet from all points of a triSurfaceMesh. + + For a dictionary specification: + \table + Property | Description | Required | Default + type | triSurfaceMeshPointSet | yes | + axis | x, y, z, xyz, distance | yes | + surface | The surface name | yes | + \endtable SourceFiles triSurfaceMeshPointSet.C @@ -42,10 +50,8 @@ SourceFiles namespace Foam { -// Forward declaration of classes - /*---------------------------------------------------------------------------*\ - Class triSurfaceMeshPointSet Declaration + Class triSurfaceMeshPointSet Declaration \*---------------------------------------------------------------------------*/ class triSurfaceMeshPointSet @@ -96,13 +102,13 @@ public: //- Destructor - virtual ~triSurfaceMeshPointSet(); + virtual ~triSurfaceMeshPointSet() = default; // Member Functions //- Get reference point - virtual point getRefPoint(const List<point>&) const; + virtual point getRefPoint(const List<point>& pts) const; }; diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index 5dad10a996690bafb19326b457dbe315b1abaa4a..73575c77817305484ea80df61c0e5bc82bad31d2 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -36,10 +36,10 @@ namespace Foam { defineTypeNameAndDebug(uniformSet, 0); addToRunTimeSelectionTable(sampledSet, uniformSet, word); - - const scalar uniformSet::tol = 1e-3; } +const Foam::scalar Foam::uniformSet::tol = 1e-3; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -57,9 +57,9 @@ bool Foam::uniformSet::nextSample const vector normOffset = offset/mag(offset); samplePt += offset; - sampleI++; + ++sampleI; - for (; sampleI < nPoints_; sampleI++) + for (; sampleI < nPoints_; ++sampleI) { scalar s = (samplePt - currentPt) & normOffset; @@ -96,7 +96,7 @@ bool Foam::uniformSet::trackToBoundary point trackPt = singleParticle.position(); - while(true) + while (true) { // Find next samplePt on/after trackPt. Update samplePt, sampleI if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI)) @@ -282,7 +282,7 @@ void Foam::uniformSet::calcSamples // index in bHits; current boundary intersection label bHitI = 1; - while(true) + while (true) { // Initialize tracking starting from trackPt passiveParticle singleParticle(mesh(), trackPt, trackCelli); @@ -344,7 +344,7 @@ void Foam::uniformSet::calcSamples } else { - bHitI++; + ++bHitI; } } @@ -359,7 +359,7 @@ void Foam::uniformSet::calcSamples trackPt = pushIn(bPoint, trackFacei); trackCelli = getBoundaryCell(trackFacei); - segmentI++; + ++segmentI; startSegmentI = samplingPts.size(); } @@ -392,14 +392,20 @@ void Foam::uniformSet::genSamples() samplingSegments.shrink(); samplingCurveDist.shrink(); + // Move into *this setSamples ( - samplingPts, - samplingCells, - samplingFaces, - samplingSegments, - samplingCurveDist + std::move(samplingPts), + std::move(samplingCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) ); + + if (debug) + { + write(Pout); + } } @@ -422,11 +428,6 @@ Foam::uniformSet::uniformSet nPoints_(nPoints) { genSamples(); - - if (debug) - { - write(Pout); - } } @@ -441,21 +442,10 @@ Foam::uniformSet::uniformSet sampledSet(name, mesh, searchEngine, dict), start_(dict.lookup("start")), end_(dict.lookup("end")), - nPoints_(readLabel(dict.lookup("nPoints"))) + nPoints_(dict.get<label>("nPoints")) { genSamples(); - - if (debug) - { - write(Pout); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::uniformSet::~uniformSet() -{} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/uniform/uniformSet.H b/src/sampling/sampledSet/uniform/uniformSet.H index 990b433eb381fcb0128863c5c9fa962861fb562a..0703736d395aef4b2536c0acc8b1162c14503aee 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.H +++ b/src/sampling/sampledSet/uniform/uniformSet.H @@ -26,6 +26,16 @@ Class Description + For a dictionary specification: + \table + Property | Description | Required | Default + type | uniform | yes | + axis | x, y, z, xyz, distance | yes | + start | The start point | yes | + end | The end point | yes | + nPoints | The number of points between start/end | yes + \endtable + SourceFiles uniformSet.C @@ -145,7 +155,7 @@ public: //- Destructor - virtual ~uniformSet(); + virtual ~uniformSet() = default; };