mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make sampleSets setSamples movable - preliminary to issue #869
- add some more documentation
This commit is contained in:
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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,21 +478,35 @@ 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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * 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
|
||||
(
|
||||
const word& name,
|
||||
@ -487,9 +518,9 @@ Foam::sampledSet::sampledSet
|
||||
coordSet(name, axis),
|
||||
mesh_(mesh),
|
||||
searchEngine_(searchEngine),
|
||||
segments_(0),
|
||||
cells_(0),
|
||||
faces_(0)
|
||||
segments_(),
|
||||
cells_(),
|
||||
faces_()
|
||||
{}
|
||||
|
||||
|
||||
@ -501,18 +532,12 @@ Foam::sampledSet::sampledSet
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordSet(name, dict.lookup("axis")),
|
||||
coordSet(name, dict.get<word>("axis")),
|
||||
mesh_(mesh),
|
||||
searchEngine_(searchEngine),
|
||||
segments_(0),
|
||||
cells_(0),
|
||||
faces_(0)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sampledSet::~sampledSet()
|
||||
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;
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user