ENH: make sampleSets setSamples movable - preliminary to issue #869

- add some more documentation
This commit is contained in:
Mark Olesen
2018-06-12 19:19:10 +02:00
parent c05dab5e50
commit 7402cd7b5a
30 changed files with 459 additions and 376 deletions

View File

@ -58,6 +58,19 @@ void Foam::coordSet::checkDimensions() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coordSet::coordSet
(
const word& name,
const coordFormat axisType
)
:
pointField(),
name_(name),
axis_(axisType),
curveDist_()
{}
Foam::coordSet::coordSet Foam::coordSet::coordSet
( (
const word& name, const word& name,

View File

@ -52,7 +52,6 @@ class coordSet
: :
public pointField public pointField
{ {
public: public:
// Public data types // Public data types
@ -94,8 +93,11 @@ public:
//- Construct from components //- Construct from components
// Note: curveDist will be empty // 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 //- Copy construct from components
coordSet coordSet
@ -128,19 +130,38 @@ public:
return coordFormatNames[axis_]; 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 const scalarList& curveDist() const
{ {
return curveDist_; return curveDist_;
} }
//- Set cumulative distance //- Set the cumulative distance
void setCurveDist(const scalarList& curveDist) void setCurveDist(const scalarList& curveDist)
{ {
curveDist_ = curveDist; curveDist_ = curveDist;
checkDimensions(); checkDimensions();
} }
//- Set the cumulative distance
void setCurveDist(scalarList&& curveDist)
{
curveDist_ = std::move(curveDist);
checkDimensions();
}
//- Is axis specification a vector //- Is axis specification a vector
bool hasVectorAxis() const; bool hasVectorAxis() const;

View File

@ -68,15 +68,15 @@ void Foam::arraySet::calcSamples
const scalar deltaz = spanBox_.z()/(pointsDensity_.z() + 1); const scalar deltaz = spanBox_.z()/(pointsDensity_.z() + 1);
label p(0); 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); vector t(deltax*i , deltay*j, deltaz*k);
sampleCoords[p] = coordSys_.origin() + t; sampleCoords[p] = coordSys_.origin() + t;
p++; ++p;
} }
} }
} }
@ -126,14 +126,20 @@ void Foam::arraySet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -156,11 +162,6 @@ Foam::arraySet::arraySet
spanBox_(spanBox) spanBox_(spanBox)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -178,18 +179,7 @@ Foam::arraySet::arraySet
spanBox_(dict.lookup("spanBox")) spanBox_(dict.lookup("spanBox"))
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::arraySet::~arraySet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -25,6 +25,18 @@ Class
Foam::arraySet Foam::arraySet
Description 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 SourceFiles
arraySet.C arraySet.C
@ -43,7 +55,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class passiveParticle; class passiveParticle;
template<class Type> class particle; template<class Type> class particle;
@ -114,7 +126,7 @@ public:
//- Destructor //- Destructor
virtual ~arraySet(); virtual ~arraySet() = default;
}; };

View File

@ -111,7 +111,7 @@ void Foam::circleSet::calcSamples
radius*constant::mathematical::pi/180.0*theta radius*constant::mathematical::pi/180.0*theta
); );
nPoint++; ++nPoint;
} }
else else
{ {
@ -148,14 +148,20 @@ void Foam::circleSet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -180,11 +186,6 @@ Foam::circleSet::circleSet
dTheta_(dTheta) dTheta_(dTheta)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -200,26 +201,15 @@ Foam::circleSet::circleSet
origin_(dict.lookup("origin")), origin_(dict.lookup("origin")),
circleAxis_(dict.lookup("circleAxis")), circleAxis_(dict.lookup("circleAxis")),
startPoint_(dict.lookup("startPoint")), startPoint_(dict.lookup("startPoint")),
dTheta_(readScalar(dict.lookup("dTheta"))) dTheta_(dict.get<scalar>("dTheta"))
{ {
// Normalise circleAxis // Normalise circleAxis
circleAxis_ /= mag(circleAxis_); circleAxis_ /= mag(circleAxis_);
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::circleSet::~circleSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::circleSet::getRefPoint(const List<point>& pts) const Foam::point Foam::circleSet::getRefPoint(const List<point>& pts) const

View File

@ -27,6 +27,17 @@ Class
Description Description
Samples along a circular path 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 SourceFiles
circleSet.C circleSet.C
@ -43,7 +54,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class meshSearch; class meshSearch;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -121,15 +132,14 @@ public:
); );
// Destructor //- Destructor
virtual ~circleSet() = default;
virtual ~circleSet();
// Member Functions // Member Functions
//- Get reference point //- Get reference point
virtual point getRefPoint(const List<point>&) const; virtual point getRefPoint(const List<point>& pts) const;
}; };

View File

@ -161,14 +161,20 @@ void Foam::cloudSet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -187,11 +193,6 @@ Foam::cloudSet::cloudSet
sampleCoords_(sampleCoords) sampleCoords_(sampleCoords)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -207,18 +208,7 @@ Foam::cloudSet::cloudSet
sampleCoords_(dict.lookup("points")) sampleCoords_(dict.lookup("points"))
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cloudSet::~cloudSet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -25,6 +25,15 @@ Class
Foam::cloudSet Foam::cloudSet
Description 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 SourceFiles
cloudSet.C cloudSet.C
@ -42,12 +51,12 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class passiveParticle; class passiveParticle;
template<class Type> class particle; template<class Type> class particle;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class cloudSet Declaration Class cloudSet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class cloudSet class cloudSet
@ -105,7 +114,7 @@ public:
//- Destructor //- Destructor
virtual ~cloudSet(); virtual ~cloudSet() = default;
}; };

View File

@ -36,10 +36,10 @@ namespace Foam
{ {
defineTypeNameAndDebug(faceOnlySet, 0); defineTypeNameAndDebug(faceOnlySet, 0);
addToRunTimeSelectionTable(sampledSet, faceOnlySet, word); addToRunTimeSelectionTable(sampledSet, faceOnlySet, word);
const scalar faceOnlySet::tol = 1e-6;
} }
const Foam::scalar Foam::faceOnlySet::tol = 1e-6;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -60,7 +60,7 @@ bool Foam::faceOnlySet::trackToBoundary
point trackPt = singleParticle.position(); point trackPt = singleParticle.position();
while(true) while (true)
{ {
point oldPoint = trackPt; point oldPoint = trackPt;
@ -265,7 +265,7 @@ void Foam::faceOnlySet::calcSamples
} }
else else
{ {
bHitI++; ++bHitI;
} }
} }
@ -280,7 +280,7 @@ void Foam::faceOnlySet::calcSamples
trackPt = pushIn(bHits[bHitI].hitPoint(), trackFacei); trackPt = pushIn(bHits[bHitI].hitPoint(), trackFacei);
trackCelli = getBoundaryCell(trackFacei); trackCelli = getBoundaryCell(trackFacei);
segmentI++; ++segmentI;
startSegmentI = samplingPts.size(); startSegmentI = samplingPts.size();
} }
@ -313,15 +313,20 @@ void Foam::faceOnlySet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Copy into *this // Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -342,11 +347,6 @@ Foam::faceOnlySet::faceOnlySet
end_(end) end_(end)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -363,18 +363,7 @@ Foam::faceOnlySet::faceOnlySet
end_(dict.lookup("end")) end_(dict.lookup("end"))
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceOnlySet::~faceOnlySet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -25,6 +25,16 @@ Class
Foam::faceOnlySet Foam::faceOnlySet
Description 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 SourceFiles
faceOnlySet.C faceOnlySet.C
@ -129,7 +139,7 @@ public:
//- Destructor //- Destructor
virtual ~faceOnlySet(); virtual ~faceOnlySet() = default;
// Member Functions // Member Functions

View File

@ -69,10 +69,10 @@ void Foam::midPointSet::genSamples()
midCells[mSamplei] = cellm; midCells[mSamplei] = cellm;
midSegments[mSamplei] = segments_[samplei]; midSegments[mSamplei] = segments_[samplei];
midCurveDist[mSamplei] = mag(midPoints[mSamplei] - start()); midCurveDist[mSamplei] = mag(midPoints[mSamplei] - start());
mSamplei++; ++mSamplei;
} }
samplei++; ++samplei;
} }
if (samplei == size() - 1) if (samplei == size() - 1)
@ -80,7 +80,7 @@ void Foam::midPointSet::genSamples()
break; break;
} }
samplei++; ++samplei;
} }
midPoints.setSize(mSamplei); midPoints.setSize(mSamplei);
@ -88,14 +88,22 @@ void Foam::midPointSet::genSamples()
midSegments.setSize(mSamplei); midSegments.setSize(mSamplei);
midCurveDist.setSize(mSamplei); midCurveDist.setSize(mSamplei);
labelList midFaces(midCells.size(), -1);
// Move into *this
setSamples setSamples
( (
midPoints, std::move(midPoints),
midCells, std::move(midCells),
labelList(midCells.size(), -1), std::move(midFaces),
midSegments, std::move(midSegments),
midCurveDist std::move(midCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -114,11 +122,6 @@ Foam::midPointSet::midPointSet
faceOnlySet(name, mesh, searchEngine, axis, start, end) faceOnlySet(name, mesh, searchEngine, axis, start, end)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -133,18 +136,7 @@ Foam::midPointSet::midPointSet
faceOnlySet(name, mesh, searchEngine, dict) faceOnlySet(name, mesh, searchEngine, dict)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::midPointSet::~midPointSet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -41,7 +41,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class meshSearch; class meshSearch;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -87,7 +87,7 @@ public:
//- Destructor //- Destructor
virtual ~midPointSet(); virtual ~midPointSet() = default;
}; };

View File

@ -60,7 +60,7 @@ void Foam::midPointAndFaceSet::genSamples()
mpfSampleFaces[mpfSamplei] = faces_[samplei]; mpfSampleFaces[mpfSamplei] = faces_[samplei];
mpfSampleSegments[mpfSamplei] = segments_[samplei]; mpfSampleSegments[mpfSamplei] = segments_[samplei];
mpfSampleCurveDist[mpfSamplei] = curveDist_[samplei]; mpfSampleCurveDist[mpfSamplei] = curveDist_[samplei];
mpfSamplei++; ++mpfSamplei;
while while
( (
@ -80,7 +80,7 @@ void Foam::midPointAndFaceSet::genSamples()
mpfSampleCurveDist[mpfSamplei] = mpfSampleCurveDist[mpfSamplei] =
mag(mpfSamplePoints[mpfSamplei] - start()); mag(mpfSamplePoints[mpfSamplei] - start());
mpfSamplei++; ++mpfSamplei;
} }
// Add second face // Add second face
@ -91,16 +91,16 @@ void Foam::midPointAndFaceSet::genSamples()
mpfSampleCurveDist[mpfSamplei] = mpfSampleCurveDist[mpfSamplei] =
mag(mpfSamplePoints[mpfSamplei] - start()); mag(mpfSamplePoints[mpfSamplei] - start());
mpfSamplei++; ++mpfSamplei;
samplei++; ++samplei;
} }
if (samplei == size() - 1) if (samplei == size() - 1)
{ {
break; break;
} }
samplei++; ++samplei;
} }
mpfSamplePoints.setSize(mpfSamplei); mpfSamplePoints.setSize(mpfSamplei);
@ -109,16 +109,23 @@ void Foam::midPointAndFaceSet::genSamples()
mpfSampleSegments.setSize(mpfSamplei); mpfSampleSegments.setSize(mpfSamplei);
mpfSampleCurveDist.setSize(mpfSamplei); mpfSampleCurveDist.setSize(mpfSamplei);
// Move into *this
setSamples setSamples
( (
mpfSamplePoints, std::move(mpfSamplePoints),
mpfSampleCells, std::move(mpfSampleCells),
mpfSampleFaces, std::move(mpfSampleFaces),
mpfSampleSegments, std::move(mpfSampleSegments),
mpfSampleCurveDist std::move(mpfSampleCurveDist)
); );
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::midPointAndFaceSet::midPointAndFaceSet Foam::midPointAndFaceSet::midPointAndFaceSet
@ -134,11 +141,6 @@ Foam::midPointAndFaceSet::midPointAndFaceSet
faceOnlySet(name, mesh, searchEngine, axis, start, end) faceOnlySet(name, mesh, searchEngine, axis, start, end)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -153,18 +155,7 @@ Foam::midPointAndFaceSet::midPointAndFaceSet
faceOnlySet(name, mesh, searchEngine, dict) faceOnlySet(name, mesh, searchEngine, dict)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::midPointAndFaceSet::~midPointAndFaceSet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -41,11 +41,11 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class meshSearch; class meshSearch;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class midPointAndFaceSet Declaration Class midPointAndFaceSet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class midPointAndFaceSet class midPointAndFaceSet
@ -88,7 +88,7 @@ public:
//- Destructor //- Destructor
virtual ~midPointAndFaceSet(); virtual ~midPointAndFaceSet() = default;
}; };

View File

@ -180,9 +180,9 @@ void Foam::patchCloudSet::calcSamples
if (nearest[i].first().hit()) if (nearest[i].first().hit())
{ {
meshTools::writeOBJ(str, sampleCoords_[i]); meshTools::writeOBJ(str, sampleCoords_[i]);
vertI++; ++vertI;
meshTools::writeOBJ(str, nearest[i].first().hitPoint()); meshTools::writeOBJ(str, nearest[i].first().hitPoint());
vertI++; ++vertI;
str << "l " << vertI-1 << ' ' << vertI << nl; str << "l " << vertI-1 << ' ' << vertI << nl;
} }
} }
@ -256,6 +256,11 @@ void Foam::patchCloudSet::genSamples()
samplingSegments, samplingSegments,
samplingCurveDist samplingCurveDist
); );
if (debug)
{
write(Info);
}
} }
@ -278,11 +283,6 @@ Foam::patchCloudSet::patchCloudSet
searchDist_(searchDist) searchDist_(searchDist)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -303,14 +303,9 @@ Foam::patchCloudSet::patchCloudSet
wordReList(dict.lookup("patches")) wordReList(dict.lookup("patches"))
) )
), ),
searchDist_(readScalar(dict.lookup("maxDistance"))) searchDist_(dict.get<scalar>("maxDistance"))
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }

View File

@ -25,8 +25,17 @@ Class
Foam::patchCloudSet Foam::patchCloudSet
Description 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 SourceFiles
patchCloudSet.C patchCloudSet.C

View File

@ -223,7 +223,7 @@ void Foam::patchSeedSet::calcSamples
label(scalar(patchFaces.size())/totalSize*maxPoints_); label(scalar(patchFaces.size())/totalSize*maxPoints_);
labelList subset = identity(patchFaces.size()); labelList subset = identity(patchFaces.size());
for (label iter = 0; iter < 4; iter++) for (label iter = 0; iter < 4; ++iter)
{ {
forAll(subset, i) forAll(subset, i)
{ {
@ -316,14 +316,20 @@ void Foam::patchSeedSet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -345,7 +351,7 @@ Foam::patchSeedSet::patchSeedSet
wordReList(dict.lookup("patches")) wordReList(dict.lookup("patches"))
) )
), ),
maxPoints_(readLabel(dict.lookup("maxPoints"))), maxPoints_(dict.get<label>("maxPoints")),
selectedLocations_ selectedLocations_
( (
dict.lookupOrDefault<pointField> dict.lookupOrDefault<pointField>
@ -356,11 +362,6 @@ Foam::patchSeedSet::patchSeedSet
) )
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }

View File

@ -27,6 +27,16 @@ Class
Description Description
Initialises points on or just off patch 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 SourceFiles
patchSeedSet.C patchSeedSet.C

View File

@ -36,10 +36,10 @@ namespace Foam
{ {
defineTypeNameAndDebug(polyLineSet, 0); defineTypeNameAndDebug(polyLineSet, 0);
addToRunTimeSelectionTable(sampledSet, polyLineSet, word); addToRunTimeSelectionTable(sampledSet, polyLineSet, word);
const scalar polyLineSet::tol = 1e-6;
} }
const Foam::scalar Foam::polyLineSet::tol = 1e-6;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -99,7 +99,7 @@ bool Foam::polyLineSet::trackToBoundary
samplingCurveDist.append(sampleI + dist); samplingCurveDist.append(sampleI + dist);
// go to next samplePt // go to next samplePt
sampleI++; ++sampleI;
if (sampleI == sampleCoords_.size() - 1) if (sampleI == sampleCoords_.size() - 1)
{ {
@ -129,7 +129,7 @@ void Foam::polyLineSet::calcSamples
<< sampleCoords_ << exit(FatalError); << sampleCoords_ << exit(FatalError);
} }
point oldPoint = sampleCoords_[0]; 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) if (mag(sampleCoords_[sampleI] - oldPoint) < SMALL)
{ {
@ -229,7 +229,7 @@ void Foam::polyLineSet::calcSamples
if (trackCelli == -1) if (trackCelli == -1)
{ {
// No intersection found. Go to next point // No intersection found. Go to next point
sampleI++; ++sampleI;
} }
} while ((trackCelli == -1) && (sampleI < sampleCoords_.size() - 1)); } while ((trackCelli == -1) && (sampleI < sampleCoords_.size() - 1));
@ -281,7 +281,7 @@ void Foam::polyLineSet::calcSamples
// Find next boundary. // Find next boundary.
sampleI++; ++sampleI;
if (sampleI == sampleCoords_.size() - 1) if (sampleI == sampleCoords_.size() - 1)
{ {
@ -291,7 +291,7 @@ void Foam::polyLineSet::calcSamples
break; break;
} }
segmentI++; ++segmentI;
startSegmentI = samplingPts.size(); startSegmentI = samplingPts.size();
} }
@ -324,14 +324,20 @@ void Foam::polyLineSet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -350,11 +356,6 @@ Foam::polyLineSet::polyLineSet
sampleCoords_(sampleCoords) sampleCoords_(sampleCoords)
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
@ -370,18 +371,7 @@ Foam::polyLineSet::polyLineSet
sampleCoords_(dict.lookup("points")) sampleCoords_(dict.lookup("points"))
{ {
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polyLineSet::~polyLineSet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,6 +27,14 @@ Class
Description Description
Sample along poly line defined by a list of points (knots) 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 SourceFiles
polyLineSet.C polyLineSet.C
@ -98,7 +106,7 @@ public:
// Static data // Static data
//- Tolerance when comparing points relative to difference between //- Tolerance when comparing points relative to difference between
// start_ and end_ //- start and end points
static const scalar tol; static const scalar tol;
@ -125,7 +133,7 @@ public:
//- Destructor //- Destructor
virtual ~polyLineSet(); virtual ~polyLineSet() = default;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,6 +42,28 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * 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 Foam::label Foam::sampledSet::getBoundaryCell(const label facei) const
{ {
return mesh().faceOwner()[facei]; 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 // Collect the face owner and neighbour cells of the sample into an array
// for convenience // for convenience
label cells[4] = const label cells[4] =
{ {
mesh().faceOwner()[faces_[samplei]], mesh().faceOwner()[faces_[samplei]],
getNeighbourCell(faces_[samplei]), getNeighbourCell(faces_[samplei]),
@ -90,7 +112,7 @@ Foam::label Foam::sampledSet::pointInCell
// otherwise ignore // otherwise ignore
if (!mesh().pointInCell(p, cellm, searchEngine_.decompMode())) if (!mesh().pointInCell(p, cellm, searchEngine_.decompMode()))
{ {
cellm = -1; cellm = -1;
if (debug) 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 // If the sample does not pass through a single cell check if the point
// is in any of the owners or neighbours otherwise ignore // 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())) if (mesh().pointInCell(p, cells[i], searchEngine_.decompMode()))
{ {
@ -238,7 +260,7 @@ Foam::point Foam::sampledSet::pushIn
tetPtI tetPtI
); );
iterNo++; ++iterNo;
} while (tetFacei < 0 && iterNo <= trap); } while (tetFacei < 0 && iterNo <= trap);
} }
@ -367,39 +389,34 @@ void Foam::sampledSet::setSamples
const scalarList& samplingCurveDist const scalarList& samplingCurveDist
) )
{ {
setSize(samplingPts.size()); setPoints(samplingPts);
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];
}
curveDist_ = samplingCurveDist; curveDist_ = samplingCurveDist;
segments_ = samplingSegments;
cells_ = samplingCells; cells_ = samplingCells;
faces_ = samplingFaces; 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,21 +478,35 @@ Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather
SortableList<scalar> sortedDist(allCurveDist); SortableList<scalar> sortedDist(allCurveDist);
indexSet = sortedDist.indices(); indexSet = sortedDist.indices();
return autoPtr<coordSet> return autoPtr<coordSet>::New
( (
new coordSet name(),
( axis(),
name(), List<point>(UIndirectList<point>(allPts, indexSet)),
axis(), sortedDist
List<point>(UIndirectList<point>(allPts, indexSet)),
sortedDist
)
); );
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sampledSet::sampledSet
(
const word& name,
const polyMesh& mesh,
const meshSearch& searchEngine,
const coordSet::coordFormat axisType
)
:
coordSet(name, axisType),
mesh_(mesh),
searchEngine_(searchEngine),
segments_(),
cells_(),
faces_()
{}
Foam::sampledSet::sampledSet Foam::sampledSet::sampledSet
( (
const word& name, const word& name,
@ -487,9 +518,9 @@ Foam::sampledSet::sampledSet
coordSet(name, axis), coordSet(name, axis),
mesh_(mesh), mesh_(mesh),
searchEngine_(searchEngine), searchEngine_(searchEngine),
segments_(0), segments_(),
cells_(0), cells_(),
faces_(0) faces_()
{} {}
@ -501,18 +532,12 @@ Foam::sampledSet::sampledSet
const dictionary& dict const dictionary& dict
) )
: :
coordSet(name, dict.lookup("axis")), coordSet(name, dict.get<word>("axis")),
mesh_(mesh), mesh_(mesh),
searchEngine_(searchEngine), searchEngine_(searchEngine),
segments_(0), segments_(),
cells_(0), cells_(),
faces_(0) faces_()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sampledSet::~sampledSet()
{} {}
@ -526,7 +551,7 @@ Foam::autoPtr<Foam::sampledSet> Foam::sampledSet::New
const dictionary& dict const dictionary& dict
) )
{ {
const word sampleType(dict.lookup("type")); const word sampleType(dict.get<word>("type"));
auto cstrIter = wordConstructorTablePtr_->cfind(sampleType); auto cstrIter = wordConstructorTablePtr_->cfind(sampleType);
@ -535,7 +560,7 @@ Foam::autoPtr<Foam::sampledSet> Foam::sampledSet::New
FatalErrorInFunction FatalErrorInFunction
<< "Unknown sample type " << "Unknown sample type "
<< sampleType << nl << nl << sampleType << nl << nl
<< "Valid sample types : " << endl << "Valid sample types : " << nl
<< wordConstructorTablePtr_->sortedToc() << wordConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
} }
@ -557,13 +582,13 @@ Foam::Ostream& Foam::sampledSet::write(Ostream& os) const
{ {
coordSet::write(os); 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] os << '\t' << cells_[samplei]
<< '\t' << faces_[sampleI] << '\t' << faces_[samplei]
<< endl; << nl;
} }
return os; return os;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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 Each 'sampledSet' has a name and a specifier of how the axis should be
write (x/y/z component or all 3 components) 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 SourceFiles
sampledSet.C sampledSet.C
@ -54,7 +60,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class polyMesh; class polyMesh;
class meshSearch; class meshSearch;
@ -89,6 +95,9 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Check for consistent sizing
void checkDimensions() const;
//- Returns cell next to boundary face //- Returns cell next to boundary face
label getBoundaryCell(const label) const; label getBoundaryCell(const label) const;
@ -135,7 +144,7 @@ protected:
label& trackFacei label& trackFacei
) const; ) const;
//- Sets sample data //- Set sample data. Copy list contents.
void setSamples void setSamples
( (
const List<point>& samplingPts, const List<point>& samplingPts,
@ -145,6 +154,15 @@ protected:
const scalarList& samplingCurveDist const scalarList& samplingCurveDist
); );
//- Set sample data. Move list contents.
void setSamples
(
List<point>&& samplingPts,
labelList&& samplingCells,
labelList&& samplingFaces,
labelList&& samplingSegments,
scalarList&& samplingCurveDist
);
public: public:
@ -195,6 +213,15 @@ public:
// Constructors // Constructors
//- Construct from components
sampledSet
(
const word& name,
const polyMesh& mesh,
const meshSearch& searchEngine,
const coordSet::coordFormat axisType
);
//- Construct from components //- Construct from components
sampledSet sampledSet
( (
@ -234,7 +261,7 @@ public:
//- Destructor //- Destructor
virtual ~sampledSet(); virtual ~sampledSet() = default;
// Member Functions // Member Functions
@ -267,8 +294,8 @@ public:
//- Output for debugging //- Output for debugging
Ostream& write(Ostream&) const; Ostream& write(Ostream&) const;
//- Helper: gather onto master and sort. Return (on master) gathered set //- Helper: gather onto master and sort.
// and overall sort order // \return (on master) gathered set and overall sort order
autoPtr<coordSet> gather(labelList& indexSet) const; autoPtr<coordSet> gather(labelList& indexSet) const;
}; };

View File

@ -26,7 +26,7 @@ Class
Description Description
Set of sets to sample. Set of sets to sample.
Call sampledSets.write() to sample&write files. Call sampledSets.write() to sample and write files.
SourceFiles SourceFiles
sampledSets.C sampledSets.C
@ -50,7 +50,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class Time; class Time;
class objectRegistry; class objectRegistry;
class dictionary; class dictionary;

View File

@ -223,7 +223,7 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
{ {
if (fields.size()) if (fields.size())
{ {
bool interpolate = interpolationScheme_ != "cell"; const bool interpolate = interpolationScheme_ != "cell";
// Create or use existing writer // Create or use existing writer
if (fields.formatter.empty()) if (fields.formatter.empty())

View File

@ -272,20 +272,27 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
} }
} }
} }
samplingPts.shrink(); samplingPts.shrink();
samplingCells.shrink(); samplingCells.shrink();
samplingFaces.shrink(); samplingFaces.shrink();
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -306,11 +313,6 @@ Foam::shortestPathSet::shortestPathSet
outsidePoints_(outsidePoints) outsidePoints_(outsidePoints)
{ {
genSamples(mesh); genSamples(mesh);
if (debug)
{
write(Info);
}
} }
@ -327,18 +329,7 @@ Foam::shortestPathSet::shortestPathSet
outsidePoints_(dict.lookup("outsidePoints")) outsidePoints_(dict.lookup("outsidePoints"))
{ {
genSamples(mesh); genSamples(mesh);
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::shortestPathSet::~shortestPathSet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -55,6 +55,15 @@ Usage
} }
\endverbatim \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 SourceFiles
shortestPathSet.C shortestPathSet.C
@ -134,7 +143,7 @@ public:
//- Destructor //- Destructor
virtual ~shortestPathSet(); virtual ~shortestPathSet() = default;
}; };

View File

@ -91,14 +91,20 @@ void Foam::triSurfaceMeshPointSet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Info);
}
} }
@ -113,7 +119,7 @@ Foam::triSurfaceMeshPointSet::triSurfaceMeshPointSet
) )
: :
sampledSet(name, mesh, searchEngine, dict), sampledSet(name, mesh, searchEngine, dict),
surface_(dict.lookup("surface")) surface_(dict.get<word>("surface"))
{ {
// Load surface. // Load surface.
if (mesh.time().foundObject<triSurfaceMesh>(surface_)) if (mesh.time().foundObject<triSurfaceMesh>(surface_))
@ -143,34 +149,23 @@ Foam::triSurfaceMeshPointSet::triSurfaceMeshPointSet
} }
genSamples(); genSamples();
if (debug)
{
write(Info);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::triSurfaceMeshPointSet::~triSurfaceMeshPointSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::triSurfaceMeshPointSet::getRefPoint(const List<point>& pts) Foam::point Foam::triSurfaceMeshPointSet::getRefPoint
const (
const List<point>& pts
) const
{ {
if (pts.size()) if (pts.size())
{ {
// Use first samplePt as starting point // Use first samplePt as starting point
return pts[0]; return pts.first();
}
else
{
return Zero;
} }
return Zero;
} }

View File

@ -25,7 +25,15 @@ Class
Foam::triSurfaceMeshPointSet Foam::triSurfaceMeshPointSet
Description 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 SourceFiles
triSurfaceMeshPointSet.C triSurfaceMeshPointSet.C
@ -42,10 +50,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class triSurfaceMeshPointSet Declaration Class triSurfaceMeshPointSet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class triSurfaceMeshPointSet class triSurfaceMeshPointSet
@ -96,13 +102,13 @@ public:
//- Destructor //- Destructor
virtual ~triSurfaceMeshPointSet(); virtual ~triSurfaceMeshPointSet() = default;
// Member Functions // Member Functions
//- Get reference point //- Get reference point
virtual point getRefPoint(const List<point>&) const; virtual point getRefPoint(const List<point>& pts) const;
}; };

View File

@ -36,10 +36,10 @@ namespace Foam
{ {
defineTypeNameAndDebug(uniformSet, 0); defineTypeNameAndDebug(uniformSet, 0);
addToRunTimeSelectionTable(sampledSet, uniformSet, word); addToRunTimeSelectionTable(sampledSet, uniformSet, word);
const scalar uniformSet::tol = 1e-3;
} }
const Foam::scalar Foam::uniformSet::tol = 1e-3;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -57,9 +57,9 @@ bool Foam::uniformSet::nextSample
const vector normOffset = offset/mag(offset); const vector normOffset = offset/mag(offset);
samplePt += offset; samplePt += offset;
sampleI++; ++sampleI;
for (; sampleI < nPoints_; sampleI++) for (; sampleI < nPoints_; ++sampleI)
{ {
scalar s = (samplePt - currentPt) & normOffset; scalar s = (samplePt - currentPt) & normOffset;
@ -96,7 +96,7 @@ bool Foam::uniformSet::trackToBoundary
point trackPt = singleParticle.position(); point trackPt = singleParticle.position();
while(true) while (true)
{ {
// Find next samplePt on/after trackPt. Update samplePt, sampleI // Find next samplePt on/after trackPt. Update samplePt, sampleI
if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI)) if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI))
@ -282,7 +282,7 @@ void Foam::uniformSet::calcSamples
// index in bHits; current boundary intersection // index in bHits; current boundary intersection
label bHitI = 1; label bHitI = 1;
while(true) while (true)
{ {
// Initialize tracking starting from trackPt // Initialize tracking starting from trackPt
passiveParticle singleParticle(mesh(), trackPt, trackCelli); passiveParticle singleParticle(mesh(), trackPt, trackCelli);
@ -344,7 +344,7 @@ void Foam::uniformSet::calcSamples
} }
else else
{ {
bHitI++; ++bHitI;
} }
} }
@ -359,7 +359,7 @@ void Foam::uniformSet::calcSamples
trackPt = pushIn(bPoint, trackFacei); trackPt = pushIn(bPoint, trackFacei);
trackCelli = getBoundaryCell(trackFacei); trackCelli = getBoundaryCell(trackFacei);
segmentI++; ++segmentI;
startSegmentI = samplingPts.size(); startSegmentI = samplingPts.size();
} }
@ -392,14 +392,20 @@ void Foam::uniformSet::genSamples()
samplingSegments.shrink(); samplingSegments.shrink();
samplingCurveDist.shrink(); samplingCurveDist.shrink();
// Move into *this
setSamples setSamples
( (
samplingPts, std::move(samplingPts),
samplingCells, std::move(samplingCells),
samplingFaces, std::move(samplingFaces),
samplingSegments, std::move(samplingSegments),
samplingCurveDist std::move(samplingCurveDist)
); );
if (debug)
{
write(Pout);
}
} }
@ -422,11 +428,6 @@ Foam::uniformSet::uniformSet
nPoints_(nPoints) nPoints_(nPoints)
{ {
genSamples(); genSamples();
if (debug)
{
write(Pout);
}
} }
@ -441,21 +442,10 @@ Foam::uniformSet::uniformSet
sampledSet(name, mesh, searchEngine, dict), sampledSet(name, mesh, searchEngine, dict),
start_(dict.lookup("start")), start_(dict.lookup("start")),
end_(dict.lookup("end")), end_(dict.lookup("end")),
nPoints_(readLabel(dict.lookup("nPoints"))) nPoints_(dict.get<label>("nPoints"))
{ {
genSamples(); genSamples();
if (debug)
{
write(Pout);
}
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::uniformSet::~uniformSet()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,6 +26,16 @@ Class
Description 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 SourceFiles
uniformSet.C uniformSet.C
@ -145,7 +155,7 @@ public:
//- Destructor //- Destructor
virtual ~uniformSet(); virtual ~uniformSet() = default;
}; };