diff --git a/src/fileFormats/coordSet/coordSet.C b/src/fileFormats/coordSet/coordSet.C index ce53eaa56c..e1ed73bc6a 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 705f8ec694..765356fbfe 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& newPoints) + { + static_cast(*this) = newPoints; + } + + //- Set the points + void setPoints(List&& newPoints) + { + static_cast(*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/Make/files b/src/sampling/Make/files index 438f67c235..a97d335f17 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -6,6 +6,7 @@ sampledSet/circle/circleSet.C sampledSet/cloud/cloudSet.C sampledSet/patchCloud/patchCloudSet.C sampledSet/polyLine/polyLineSet.C +sampledSet/cellCentre/cellCentreSet.C sampledSet/face/faceOnlySet.C sampledSet/midPoint/midPointSet.C sampledSet/midPointAndFace/midPointAndFaceSet.C diff --git a/src/sampling/sampledSet/array/arraySet.C b/src/sampling/sampledSet/array/arraySet.C index 1ff788d173..6c32f51bb1 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 da6c519a29..2954348728 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 particle; @@ -114,7 +126,7 @@ public: //- Destructor - virtual ~arraySet(); + virtual ~arraySet() = default; }; diff --git a/src/sampling/sampledSet/cellCentre/cellCentreSet.C b/src/sampling/sampledSet/cellCentre/cellCentreSet.C new file mode 100644 index 0000000000..2631595ff1 --- /dev/null +++ b/src/sampling/sampledSet/cellCentre/cellCentreSet.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "cellCentreSet.H" +#include "meshSearch.H" +#include "polyMesh.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cellCentreSet, 0); + addToRunTimeSelectionTable(sampledSet, cellCentreSet, word); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::cellCentreSet::genSamples() +{ + const label len = mesh().nCells(); + + const auto& cellCentres = + refCast(mesh()).C().primitiveField(); + + labelList selectedCells = identity(len); + List selectedPoints; + + if (bounds_.empty()) + { + selectedPoints = cellCentres; + } + else + { + label count = 0; + for (label celli=0; celli < len; ++celli) + { + if (bounds_.contains(cellCentres[celli])) + { + selectedCells[count++] = celli; + } + } + + selectedCells.resize(count); + selectedPoints = UIndirectList(cellCentres, selectedCells); + } + + labelList samplingFaces(selectedCells.size(), -1); + labelList samplingSegments(selectedCells.size(), -1); + scalarList samplingCurveDist(selectedCells.size(), 0.0); + + // Move into *this + setSamples + ( + std::move(selectedPoints), + std::move(selectedCells), + std::move(samplingFaces), + std::move(samplingSegments), + std::move(samplingCurveDist) + ); + + if (debug) + { + write(Info); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellCentreSet::cellCentreSet +( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const word& axis, + const boundBox& bbox +) +: + sampledSet(name, mesh, searchEngine, axis), + bounds_(bbox) +{ + genSamples(); +} + + +Foam::cellCentreSet::cellCentreSet +( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const dictionary& dict +) +: + sampledSet + ( + name, + mesh, + searchEngine, + dict.lookupOrDefault("axis", "xyz") + ), + bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)) +{ + genSamples(); +} + + +// ************************************************************************* // diff --git a/src/sampling/sampledSet/cellCentre/cellCentreSet.H b/src/sampling/sampledSet/cellCentre/cellCentreSet.H new file mode 100644 index 0000000000..508e82ee51 --- /dev/null +++ b/src/sampling/sampledSet/cellCentre/cellCentreSet.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::cellCentreSet + +Description + A sampleSet based on cell centres + + For a dictionary specification: + \table + Property | Description | Required | Default + type | cellCentre | yes | + axis | x, y, z, xyz, distance | no | xyz + bounds | limit with bounding box | no | + \endtable + +SourceFiles + cellCentreSet.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellCentreSet_H +#define cellCentreSet_H + +#include "sampledSet.H" +#include "boundBox.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class cellCentreSet Declaration +\*---------------------------------------------------------------------------*/ + +class cellCentreSet +: + public sampledSet +{ + // Private data + + //- Optional bounding box to restrict the geometry + const boundBox bounds_; + + + // Private Member Functions + + //- Generate samples + void genSamples(); + + +public: + + //- Runtime type information + TypeName("cellCentre"); + + + // Constructors + + //- Construct from components + cellCentreSet + ( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const word& axis, + const boundBox& bbox = boundBox::invertedBox + ); + + //- Construct from dictionary + cellCentreSet + ( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const dictionary& dict + ); + + + //- Destructor + virtual ~cellCentreSet() = default; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSet/circle/circleSet.C b/src/sampling/sampledSet/circle/circleSet.C index c91aef3ba4..ee30a5a90a 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("dTheta")) { // Normalise circleAxis circleAxis_ /= mag(circleAxis_); genSamples(); - - if (debug) - { - write(Info); - } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::circleSet::~circleSet() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::point Foam::circleSet::getRefPoint(const List& pts) const diff --git a/src/sampling/sampledSet/circle/circleSet.H b/src/sampling/sampledSet/circle/circleSet.H index b0e6ed1361..5d4cb59734 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&) const; + virtual point getRefPoint(const List& pts) const; }; diff --git a/src/sampling/sampledSet/cloud/cloudSet.C b/src/sampling/sampledSet/cloud/cloudSet.C index 79b7f8f4a9..8232696a03 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 c312bff44c..b4f5a33481 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 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 bf1793d944..f259200d94 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 39c1dcda59..4fee951dda 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 38031ee7b0..ea3db892c4 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 679acbc8bf..8068f42cfc 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 1628ca50ef..f62c5242cb 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 ee2b13cc82..f0b949d55b 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 12c0b4a8df..cb41e1fb72 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("maxDistance")) { genSamples(); - - if (debug) - { - write(Info); - } } diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.H b/src/sampling/sampledSet/patchCloud/patchCloudSet.H index c6a87c74e1..99a17e8d26 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 4ecb3761d6..ed03419c9e 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