mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamyHexMesh: Remove some unused functions. Change initialPointMethod constructors
This commit is contained in:
@ -849,7 +849,11 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
|||||||
initialPointsMethod::New
|
initialPointsMethod::New
|
||||||
(
|
(
|
||||||
foamyHexMeshDict.subDict("initialPoints"),
|
foamyHexMeshDict.subDict("initialPoints"),
|
||||||
*this
|
runTime_,
|
||||||
|
rndGen_,
|
||||||
|
geometryToConformTo_,
|
||||||
|
cellShapeControl_,
|
||||||
|
decomposition_
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
relaxationModel_
|
relaxationModel_
|
||||||
@ -1273,7 +1277,11 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
{
|
{
|
||||||
const Foam::point newPt(0.5*(dVA + dVB));
|
const Foam::point newPt(0.5*(dVA + dVB));
|
||||||
|
|
||||||
if (positionOnThisProc(newPt))
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& decomposition().positionOnThisProcessor(newPt)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Prevent insertions spanning surfaces
|
// Prevent insertions spanning surfaces
|
||||||
if (internalPointIsInside(newPt))
|
if (internalPointIsInside(newPt))
|
||||||
@ -1589,64 +1597,6 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::conformalVoronoiMesh::positionOnThisProc
|
|
||||||
(
|
|
||||||
const Foam::point& pt
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (Pstream::parRun())
|
|
||||||
{
|
|
||||||
return decomposition_().positionOnThisProcessor(pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::boolList Foam::conformalVoronoiMesh::positionOnThisProc
|
|
||||||
(
|
|
||||||
const Foam::List<Foam::point>& pts
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (Pstream::parRun())
|
|
||||||
{
|
|
||||||
return decomposition_().positionOnThisProcessor(pts);
|
|
||||||
}
|
|
||||||
|
|
||||||
return boolList(pts.size(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::conformalVoronoiMesh::positionProc
|
|
||||||
(
|
|
||||||
const Foam::List<Foam::point>& pts
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (!Pstream::parRun())
|
|
||||||
{
|
|
||||||
return labelList(pts.size(), -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return decomposition_().processorPosition(pts);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::List<Foam::List<Foam::pointIndexHit> >
|
|
||||||
Foam::conformalVoronoiMesh::intersectsProc
|
|
||||||
(
|
|
||||||
const List<Foam::point>& starts,
|
|
||||||
const List<Foam::point>& ends
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (!Pstream::parRun())
|
|
||||||
{
|
|
||||||
return List<List<pointIndexHit> >(starts.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
return decomposition_().intersectsProcessors(starts, ends, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Foam::labelListList Foam::conformalVoronoiMesh::overlapsProc
|
//Foam::labelListList Foam::conformalVoronoiMesh::overlapsProc
|
||||||
//(
|
//(
|
||||||
// const List<Foam::point>& centres,
|
// const List<Foam::point>& centres,
|
||||||
|
|||||||
@ -836,22 +836,6 @@ public:
|
|||||||
// surface as required
|
// surface as required
|
||||||
void move();
|
void move();
|
||||||
|
|
||||||
//- Check if the point is in the domain handled by this processor
|
|
||||||
bool positionOnThisProc(const Foam::point& pt) const;
|
|
||||||
|
|
||||||
//- Check if the point is in the domain handled by this processor
|
|
||||||
boolList positionOnThisProc(const Foam::List<Foam::point>& pts) const;
|
|
||||||
|
|
||||||
//- Which processor's domain handles this point
|
|
||||||
labelList positionProc(const Foam::List<Foam::point>& pts) const;
|
|
||||||
|
|
||||||
//- Which other processors does each line segment intersect
|
|
||||||
List<List<pointIndexHit> > intersectsProc
|
|
||||||
(
|
|
||||||
const List<Foam::point>& starts,
|
|
||||||
const List<Foam::point>& ends
|
|
||||||
) const;
|
|
||||||
|
|
||||||
// //- Which other processors does each sphere overlap
|
// //- Which other processors does each sphere overlap
|
||||||
// labelListList overlapsProc
|
// labelListList overlapsProc
|
||||||
// (
|
// (
|
||||||
|
|||||||
@ -1336,7 +1336,10 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceProtrusion
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
surfHitLargest.hit()
|
surfHitLargest.hit()
|
||||||
&& !positionOnThisProc(surfHitLargest.hitPoint())
|
&& (
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !decomposition().positionOnThisProcessor(surfHitLargest.hitPoint())
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// A protrusion was identified, but not penetrating on this processor,
|
// A protrusion was identified, but not penetrating on this processor,
|
||||||
@ -1434,7 +1437,10 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
surfHitLargest.hit()
|
surfHitLargest.hit()
|
||||||
&& !positionOnThisProc(surfHitLargest.hitPoint())
|
&& (
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !decomposition().positionOnThisProcessor(surfHitLargest.hitPoint())
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// A protrusion was identified, but not penetrating on this processor,
|
// A protrusion was identified, but not penetrating on this processor,
|
||||||
@ -1457,7 +1463,11 @@ void Foam::conformalVoronoiMesh::reportProcessorOccupancy()
|
|||||||
{
|
{
|
||||||
if (vit->real())
|
if (vit->real())
|
||||||
{
|
{
|
||||||
if (!positionOnThisProc(topoint(vit->point())))
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !decomposition().positionOnThisProcessor(topoint(vit->point()))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Pout<< topoint(vit->point()) << " is not on this processor "
|
Pout<< topoint(vit->point()) << " is not on this processor "
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -202,7 +202,10 @@ void Foam::featurePointConformer::createMasterAndSlavePoints
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!foamyHexMesh_.positionOnThisProc(featPt)
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt)
|
||||||
|
)
|
||||||
|| geometryToConformTo_.outside(featPt)
|
|| geometryToConformTo_.outside(featPt)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -378,7 +381,10 @@ void Foam::featurePointConformer::createMixedFeaturePoints
|
|||||||
{
|
{
|
||||||
const Foam::point& featPt = points[ptI];
|
const Foam::point& featPt = points[ptI];
|
||||||
|
|
||||||
if (!foamyHexMesh_.positionOnThisProc(featPt))
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,11 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
|
|||||||
|
|
||||||
const Foam::point& featPt = feMesh.points()[ptI];
|
const Foam::point& featPt = feMesh.points()[ptI];
|
||||||
|
|
||||||
if (!foamyHexMesh_.positionOnThisProc(featPt))
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -402,7 +406,11 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
|
|||||||
|
|
||||||
const Foam::point& featPt = feMesh.points()[ptI];
|
const Foam::point& featPt = feMesh.points()[ptI];
|
||||||
|
|
||||||
if (!foamyHexMesh_.positionOnThisProc(featPt))
|
if
|
||||||
|
(
|
||||||
|
Pstream::parRun()
|
||||||
|
&& !foamyHexMesh_.decomposition().positionOnThisProcessor(featPt)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ void Foam::autoDensity::writeOBJ
|
|||||||
fileName name
|
fileName name
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
OFstream str(foamyHexMesh_.time().path()/name + ".obj");
|
OFstream str(time().path()/name + ".obj");
|
||||||
|
|
||||||
Pout<< "Writing " << str.name() << endl;
|
Pout<< "Writing " << str.name() << endl;
|
||||||
|
|
||||||
@ -74,11 +74,11 @@ bool Foam::autoDensity::combinedOverlaps(const treeBoundBox& box) const
|
|||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
foamyHexMesh_.decomposition().overlapsThisProcessor(box)
|
decomposition().overlapsThisProcessor(box)
|
||||||
|| foamyHexMesh_.geometryToConformTo().overlaps(box);
|
|| geometryToConformTo().overlaps(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
return foamyHexMesh_.geometryToConformTo().overlaps(box);
|
return geometryToConformTo().overlaps(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ bool Foam::autoDensity::combinedInside(const point& p) const
|
|||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
foamyHexMesh_.decomposition().positionOnThisProcessor(p)
|
decomposition().positionOnThisProcessor(p)
|
||||||
&& foamyHexMesh_.geometryToConformTo().inside(p);
|
&& geometryToConformTo().inside(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
return foamyHexMesh_.geometryToConformTo().inside(p);
|
return geometryToConformTo().inside(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ Foam::Field<bool> Foam::autoDensity::combinedWellInside
|
|||||||
{
|
{
|
||||||
if (!Pstream::parRun())
|
if (!Pstream::parRun())
|
||||||
{
|
{
|
||||||
return foamyHexMesh_.geometryToConformTo().wellInside
|
return geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
pts,
|
pts,
|
||||||
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
||||||
@ -117,7 +117,7 @@ Foam::Field<bool> Foam::autoDensity::combinedWellInside
|
|||||||
|
|
||||||
Field<bool> insideA
|
Field<bool> insideA
|
||||||
(
|
(
|
||||||
foamyHexMesh_.geometryToConformTo().wellInside
|
geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
pts,
|
pts,
|
||||||
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
||||||
@ -126,7 +126,7 @@ Foam::Field<bool> Foam::autoDensity::combinedWellInside
|
|||||||
|
|
||||||
Field<bool> insideB
|
Field<bool> insideB
|
||||||
(
|
(
|
||||||
foamyHexMesh_.decomposition().positionOnThisProcessor(pts)
|
decomposition().positionOnThisProcessor(pts)
|
||||||
);
|
);
|
||||||
|
|
||||||
// inside = insideA && insideB;
|
// inside = insideA && insideB;
|
||||||
@ -162,14 +162,14 @@ bool Foam::autoDensity::combinedWellInside
|
|||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
inside = foamyHexMesh_.decomposition().positionOnThisProcessor(p);
|
inside = decomposition().positionOnThisProcessor(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform AND operation between testing the surfaces and the previous
|
// Perform AND operation between testing the surfaces and the previous
|
||||||
// result, i.e the parallel result, or in serial, with true.
|
// result, i.e the parallel result, or in serial, with true.
|
||||||
inside =
|
inside =
|
||||||
inside
|
inside
|
||||||
&& foamyHexMesh_.geometryToConformTo().wellInside
|
&& geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
p,
|
p,
|
||||||
minimumSurfaceDistanceCoeffSqr_*sqr(size)
|
minimumSurfaceDistanceCoeffSqr_*sqr(size)
|
||||||
@ -184,16 +184,19 @@ void Foam::autoDensity::recurseAndFill
|
|||||||
DynamicList<Vb::Point>& initialPoints,
|
DynamicList<Vb::Point>& initialPoints,
|
||||||
const treeBoundBox& bb,
|
const treeBoundBox& bb,
|
||||||
label levelLimit,
|
label levelLimit,
|
||||||
word recursionName
|
word recursionName,
|
||||||
|
label& nRecursionLevels
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
nRecursionLevels++;
|
||||||
|
|
||||||
for (direction i = 0; i < 8; i++)
|
for (direction i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
treeBoundBox subBB = bb.subBbox(i);
|
treeBoundBox subBB = bb.subBbox(i);
|
||||||
|
|
||||||
word newName = recursionName + "_" + Foam::name(i);
|
word newName = recursionName + "_" + Foam::name(i);
|
||||||
|
|
||||||
conformalVoronoiMesh::timeCheck(foamyHexMesh_.time(), newName, debug);
|
conformalVoronoiMesh::timeCheck(time(), newName, debug);
|
||||||
|
|
||||||
if (combinedOverlaps(subBB))
|
if (combinedOverlaps(subBB))
|
||||||
{
|
{
|
||||||
@ -204,7 +207,8 @@ void Foam::autoDensity::recurseAndFill
|
|||||||
initialPoints,
|
initialPoints,
|
||||||
subBB,
|
subBB,
|
||||||
levelLimit - 1,
|
levelLimit - 1,
|
||||||
newName
|
newName,
|
||||||
|
nRecursionLevels
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -227,7 +231,8 @@ void Foam::autoDensity::recurseAndFill
|
|||||||
initialPoints,
|
initialPoints,
|
||||||
subBB,
|
subBB,
|
||||||
levelLimit - 1,
|
levelLimit - 1,
|
||||||
newName
|
newName,
|
||||||
|
nRecursionLevels
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +257,8 @@ void Foam::autoDensity::recurseAndFill
|
|||||||
initialPoints,
|
initialPoints,
|
||||||
subBB,
|
subBB,
|
||||||
levelLimit - 1,
|
levelLimit - 1,
|
||||||
newName
|
newName,
|
||||||
|
nRecursionLevels
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,9 +284,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
bool overlapping
|
bool overlapping
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const conformationSurfaces& geometry(foamyHexMesh_.geometryToConformTo());
|
const conformationSurfaces& geometry = geometryToConformTo();
|
||||||
|
|
||||||
Random& rnd = foamyHexMesh_.rndGen();
|
|
||||||
|
|
||||||
unsigned int initialSize = initialPoints.size();
|
unsigned int initialSize = initialPoints.size();
|
||||||
|
|
||||||
@ -340,8 +344,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
|
|
||||||
pointField corners(bb.points());
|
pointField corners(bb.points());
|
||||||
|
|
||||||
scalarField cornerSizes =
|
scalarField cornerSizes = cellShapeControls().cellSize(corners);
|
||||||
foamyHexMesh_.cellShapeControls().cellSize(corners);
|
|
||||||
|
|
||||||
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
||||||
|
|
||||||
@ -450,8 +453,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
lineSizes =
|
lineSizes = cellShapeControls().cellSize(linePoints);
|
||||||
foamyHexMesh_.cellShapeControls().cellSize(linePoints);
|
|
||||||
|
|
||||||
Field<bool> insideLines = combinedWellInside
|
Field<bool> insideLines = combinedWellInside
|
||||||
(
|
(
|
||||||
@ -537,9 +539,9 @@ bool Foam::autoDensity::fillBox
|
|||||||
min
|
min
|
||||||
+ vector
|
+ vector
|
||||||
(
|
(
|
||||||
delta.x()*(i + 0.5 + 0.1*(rnd.scalar01() - 0.5)),
|
delta.x()*(i + 0.5 + 0.1*(rndGen().scalar01() - 0.5)),
|
||||||
delta.y()*(j + 0.5 + 0.1*(rnd.scalar01() - 0.5)),
|
delta.y()*(j + 0.5 + 0.1*(rndGen().scalar01() - 0.5)),
|
||||||
delta.z()*(k + 0.5 + 0.1*(rnd.scalar01() - 0.5))
|
delta.z()*(k + 0.5 + 0.1*(rndGen().scalar01() - 0.5))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -550,10 +552,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
// corner when only some these points are required.
|
// corner when only some these points are required.
|
||||||
shuffle(samplePoints);
|
shuffle(samplePoints);
|
||||||
|
|
||||||
scalarField sampleSizes = foamyHexMesh_.cellShapeControls().cellSize
|
scalarField sampleSizes = cellShapeControls().cellSize(samplePoints);
|
||||||
(
|
|
||||||
samplePoints
|
|
||||||
);
|
|
||||||
|
|
||||||
Field<bool> insidePoints = combinedWellInside
|
Field<bool> insidePoints = combinedWellInside
|
||||||
(
|
(
|
||||||
@ -647,7 +646,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
// TODO - is there a lot of cost in the 1/density calc? Could
|
// TODO - is there a lot of cost in the 1/density calc? Could
|
||||||
// assess on
|
// assess on
|
||||||
// (1/maxDensity)/(1/localDensity) = minVolume/localVolume
|
// (1/maxDensity)/(1/localDensity) = minVolume/localVolume
|
||||||
if (localDensity/maxDensity > rnd.scalar01())
|
if (localDensity/maxDensity > rndGen().scalar01())
|
||||||
{
|
{
|
||||||
scalar localVolume = 1/localDensity;
|
scalar localVolume = 1/localDensity;
|
||||||
|
|
||||||
@ -660,7 +659,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
scalar addProbability =
|
scalar addProbability =
|
||||||
(totalVolume - volumeAdded)/localVolume;
|
(totalVolume - volumeAdded)/localVolume;
|
||||||
|
|
||||||
scalar r = rnd.scalar01();
|
scalar r = rndGen().scalar01();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -714,9 +713,9 @@ bool Foam::autoDensity::fillBox
|
|||||||
{
|
{
|
||||||
trialPoints++;
|
trialPoints++;
|
||||||
|
|
||||||
point p = min + cmptMultiply(span, rnd.vector01());
|
point p = min + cmptMultiply(span, rndGen().vector01());
|
||||||
|
|
||||||
scalar localSize = foamyHexMesh_.cellShapeControls().cellSize(p);
|
scalar localSize = cellShapeControls().cellSize(p);
|
||||||
|
|
||||||
bool insidePoint = false;
|
bool insidePoint = false;
|
||||||
|
|
||||||
@ -770,7 +769,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
|
|
||||||
// Accept possible placements proportional to the relative local
|
// Accept possible placements proportional to the relative local
|
||||||
// density
|
// density
|
||||||
if (localDensity/maxDensity > rnd.scalar01())
|
if (localDensity/maxDensity > rndGen().scalar01())
|
||||||
{
|
{
|
||||||
scalar localVolume = 1/localDensity;
|
scalar localVolume = 1/localDensity;
|
||||||
|
|
||||||
@ -783,7 +782,7 @@ bool Foam::autoDensity::fillBox
|
|||||||
scalar addProbability =
|
scalar addProbability =
|
||||||
(totalVolume - volumeAdded)/localVolume;
|
(totalVolume - volumeAdded)/localVolume;
|
||||||
|
|
||||||
scalar r = rnd.scalar01();
|
scalar r = rndGen().scalar01();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -847,10 +846,23 @@ bool Foam::autoDensity::fillBox
|
|||||||
autoDensity::autoDensity
|
autoDensity::autoDensity
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
initialPointsMethod(typeName, initialPointsDict, foamyHexMesh),
|
initialPointsMethod
|
||||||
|
(
|
||||||
|
typeName,
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
),
|
||||||
globalTrialPoints_(0),
|
globalTrialPoints_(0),
|
||||||
minCellSizeLimit_
|
minCellSizeLimit_
|
||||||
(
|
(
|
||||||
@ -875,8 +887,7 @@ autoDensity::autoDensity
|
|||||||
"const dictionary& initialPointsDict,"
|
"const dictionary& initialPointsDict,"
|
||||||
"const conformalVoronoiMesh& foamyHexMesh"
|
"const conformalVoronoiMesh& foamyHexMesh"
|
||||||
")"
|
")"
|
||||||
)
|
) << "The maxSizeRatio must be greater than one to be sensible, "
|
||||||
<< "The maxSizeRatio must be greater than one to be sensible, "
|
|
||||||
<< "setting to " << maxSizeRatio_
|
<< "setting to " << maxSizeRatio_
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -893,14 +904,14 @@ List<Vb::Point> autoDensity::initialPoints() const
|
|||||||
// on whether this is a parallel run.
|
// on whether this is a parallel run.
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
hierBB = foamyHexMesh_.decomposition().procBounds();
|
hierBB = decomposition().procBounds();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Extend the global box to move it off large plane surfaces
|
// Extend the global box to move it off large plane surfaces
|
||||||
hierBB = foamyHexMesh_.geometryToConformTo().globalBounds().extend
|
hierBB = geometryToConformTo().globalBounds().extend
|
||||||
(
|
(
|
||||||
foamyHexMesh_.rndGen(),
|
rndGen(),
|
||||||
1e-6
|
1e-6
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -914,12 +925,15 @@ List<Vb::Point> autoDensity::initialPoints() const
|
|||||||
Pout<< " Filling box " << hierBB << endl;
|
Pout<< " Filling box " << hierBB << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label nRecursionLevels = 0;
|
||||||
|
|
||||||
recurseAndFill
|
recurseAndFill
|
||||||
(
|
(
|
||||||
initialPoints,
|
initialPoints,
|
||||||
hierBB,
|
hierBB,
|
||||||
minLevels_ - 1,
|
minLevels_ - 1,
|
||||||
"recursionBox"
|
"recursionBox",
|
||||||
|
nRecursionLevels
|
||||||
);
|
);
|
||||||
|
|
||||||
initialPoints.shrink();
|
initialPoints.shrink();
|
||||||
@ -932,11 +946,16 @@ List<Vb::Point> autoDensity::initialPoints() const
|
|||||||
reduce(globalTrialPoints_, sumOp<label>());
|
reduce(globalTrialPoints_, sumOp<label>());
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< " " << nInitialPoints << " points placed" << nl
|
Info<< incrIndent << incrIndent
|
||||||
<< " " << globalTrialPoints_ << " locations queried" << nl
|
<< indent << nInitialPoints << " points placed" << nl
|
||||||
<< " "
|
<< indent << globalTrialPoints_ << " locations queried" << nl
|
||||||
|
<< indent
|
||||||
<< scalar(nInitialPoints)/scalar(max(globalTrialPoints_, 1))
|
<< scalar(nInitialPoints)/scalar(max(globalTrialPoints_, 1))
|
||||||
<< " success rate"
|
<< " success rate" << nl
|
||||||
|
<< indent
|
||||||
|
<< returnReduce(nRecursionLevels, maxOp<label>())
|
||||||
|
<< " levels of recursion (maximum)"
|
||||||
|
<< decrIndent << decrIndent
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
return initialPoints;
|
return initialPoints;
|
||||||
|
|||||||
@ -119,7 +119,8 @@ private:
|
|||||||
DynamicList<Vb::Point>& initialPoints,
|
DynamicList<Vb::Point>& initialPoints,
|
||||||
const treeBoundBox& bb,
|
const treeBoundBox& bb,
|
||||||
label levelLimit,
|
label levelLimit,
|
||||||
word recursionName
|
word recursionName,
|
||||||
|
label& nRecursionLevels
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Fill the given box, optionally filling surface overlapping boxes.
|
//- Fill the given box, optionally filling surface overlapping boxes.
|
||||||
@ -144,7 +145,11 @@ public:
|
|||||||
autoDensity
|
autoDensity
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,23 @@ addToRunTimeSelectionTable(initialPointsMethod, bodyCentredCubic, dictionary);
|
|||||||
bodyCentredCubic::bodyCentredCubic
|
bodyCentredCubic::bodyCentredCubic
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
initialPointsMethod(typeName, initialPointsDict, foamyHexMesh),
|
initialPointsMethod
|
||||||
|
(
|
||||||
|
typeName,
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
),
|
||||||
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
||||||
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
||||||
randomPerturbationCoeff_
|
randomPerturbationCoeff_
|
||||||
@ -64,11 +77,11 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
|
|||||||
// on whether this is a parallel run.
|
// on whether this is a parallel run.
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
bb = foamyHexMesh_.decomposition().procBounds();
|
bb = decomposition().procBounds();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bb = foamyHexMesh_.geometryToConformTo().globalBounds();
|
bb = geometryToConformTo().globalBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar x0 = bb.min().x();
|
scalar x0 = bb.min().x();
|
||||||
@ -87,8 +100,6 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
delta *= pow((1.0/2.0),-(1.0/3.0));
|
delta *= pow((1.0/2.0),-(1.0/3.0));
|
||||||
|
|
||||||
Random& rndGen = foamyHexMesh_.rndGen();
|
|
||||||
|
|
||||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||||
|
|
||||||
DynamicList<Vb::Point> initialPoints(ni*nj*nk/10);
|
DynamicList<Vb::Point> initialPoints(ni*nj*nk/10);
|
||||||
@ -118,17 +129,14 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
pA.x() += pert*(rndGen.scalar01() - 0.5);
|
pA.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
pA.y() += pert*(rndGen.scalar01() - 0.5);
|
pA.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
pA.z() += pert*(rndGen.scalar01() - 0.5);
|
pA.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
const backgroundMeshDecomposition& decomp =
|
|
||||||
foamyHexMesh_.decomposition();
|
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
if (decomp.positionOnThisProcessor(pA))
|
if (decomposition().positionOnThisProcessor(pA))
|
||||||
{
|
{
|
||||||
// Add this point in parallel only if this position is
|
// Add this point in parallel only if this position is
|
||||||
// on this processor.
|
// on this processor.
|
||||||
@ -142,14 +150,14 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
pB.x() += pert*(rndGen.scalar01() - 0.5);
|
pB.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
pB.y() += pert*(rndGen.scalar01() - 0.5);
|
pB.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
pB.z() += pert*(rndGen.scalar01() - 0.5);
|
pB.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
if (decomp.positionOnThisProcessor(pB))
|
if (decomposition().positionOnThisProcessor(pB))
|
||||||
{
|
{
|
||||||
// Add this point in parallel only if this position is
|
// Add this point in parallel only if this position is
|
||||||
// on this processor.
|
// on this processor.
|
||||||
@ -165,14 +173,11 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
|
|||||||
points.setSize(pI);
|
points.setSize(pI);
|
||||||
|
|
||||||
Field<bool> insidePoints =
|
Field<bool> insidePoints =
|
||||||
foamyHexMesh_.geometryToConformTo().wellInside
|
geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
points,
|
points,
|
||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr(cellShapeControls().cellSize(points))
|
||||||
(
|
|
||||||
foamyHexMesh_.cellShapeControls().cellSize(points)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(insidePoints, i)
|
forAll(insidePoints, i)
|
||||||
|
|||||||
@ -77,7 +77,11 @@ public:
|
|||||||
bodyCentredCubic
|
bodyCentredCubic
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,23 @@ addToRunTimeSelectionTable(initialPointsMethod, faceCentredCubic, dictionary);
|
|||||||
faceCentredCubic::faceCentredCubic
|
faceCentredCubic::faceCentredCubic
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
initialPointsMethod(typeName, initialPointsDict, foamyHexMesh),
|
initialPointsMethod
|
||||||
|
(
|
||||||
|
typeName,
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
),
|
||||||
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
||||||
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
||||||
randomPerturbationCoeff_
|
randomPerturbationCoeff_
|
||||||
@ -64,11 +77,11 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
// on whether this is a parallel run.
|
// on whether this is a parallel run.
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
bb = foamyHexMesh_.decomposition().procBounds();
|
bb = decomposition().procBounds();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bb = foamyHexMesh_.geometryToConformTo().globalBounds();
|
bb = geometryToConformTo().globalBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar x0 = bb.min().x();
|
scalar x0 = bb.min().x();
|
||||||
@ -87,8 +100,6 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
delta *= pow((1.0/4.0),-(1.0/3.0));
|
delta *= pow((1.0/4.0),-(1.0/3.0));
|
||||||
|
|
||||||
Random& rndGen = foamyHexMesh_.rndGen();
|
|
||||||
|
|
||||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||||
|
|
||||||
DynamicList<Vb::Point> initialPoints(ni*nj*nk/10);
|
DynamicList<Vb::Point> initialPoints(ni*nj*nk/10);
|
||||||
@ -116,17 +127,14 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
p.x() += pert*(rndGen.scalar01() - 0.5);
|
p.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.y() += pert*(rndGen.scalar01() - 0.5);
|
p.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
p.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
const backgroundMeshDecomposition& decomp =
|
|
||||||
foamyHexMesh_.decomposition();
|
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
if (decomp.positionOnThisProcessor(p))
|
if (decomposition().positionOnThisProcessor(p))
|
||||||
{
|
{
|
||||||
// Add this point in parallel only if this position is
|
// Add this point in parallel only if this position is
|
||||||
// on this processor.
|
// on this processor.
|
||||||
@ -147,14 +155,14 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
p.x() += pert*(rndGen.scalar01() - 0.5);
|
p.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.y() += pert*(rndGen.scalar01() - 0.5);
|
p.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
p.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
if (decomp.positionOnThisProcessor(p))
|
if (decomposition().positionOnThisProcessor(p))
|
||||||
{
|
{
|
||||||
// Add this point in parallel only if this position is
|
// Add this point in parallel only if this position is
|
||||||
// on this processor.
|
// on this processor.
|
||||||
@ -175,14 +183,14 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
p.x() += pert*(rndGen.scalar01() - 0.5);
|
p.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.y() += pert*(rndGen.scalar01() - 0.5);
|
p.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
p.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
if (decomp.positionOnThisProcessor(p))
|
if (decomposition().positionOnThisProcessor(p))
|
||||||
{
|
{
|
||||||
// Add this point in parallel only if this position is
|
// Add this point in parallel only if this position is
|
||||||
// on this processor.
|
// on this processor.
|
||||||
@ -203,14 +211,14 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
p.x() += pert*(rndGen.scalar01() - 0.5);
|
p.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.y() += pert*(rndGen.scalar01() - 0.5);
|
p.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
p.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
if (decomp.positionOnThisProcessor(p))
|
if (decomposition().positionOnThisProcessor(p))
|
||||||
{
|
{
|
||||||
// Add this point in parallel only if this position is
|
// Add this point in parallel only if this position is
|
||||||
// on this processor.
|
// on this processor.
|
||||||
@ -226,14 +234,11 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
|
|||||||
points.setSize(pI);
|
points.setSize(pI);
|
||||||
|
|
||||||
Field<bool> insidePoints =
|
Field<bool> insidePoints =
|
||||||
foamyHexMesh_.geometryToConformTo().wellInside
|
geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
points,
|
points,
|
||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr(cellShapeControls().cellSize(points))
|
||||||
(
|
|
||||||
foamyHexMesh_.cellShapeControls().cellSize(points)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(insidePoints, i)
|
forAll(insidePoints, i)
|
||||||
|
|||||||
@ -77,7 +77,11 @@ public:
|
|||||||
faceCentredCubic
|
faceCentredCubic
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,19 @@ initialPointsMethod::initialPointsMethod
|
|||||||
(
|
(
|
||||||
const word& type,
|
const word& type,
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
dictionary(initialPointsDict),
|
dictionary(initialPointsDict),
|
||||||
foamyHexMesh_(foamyHexMesh),
|
runTime_(runTime),
|
||||||
|
rndGen_(rndGen),
|
||||||
|
geometryToConformTo_(geometryToConformTo),
|
||||||
|
cellShapeControls_(cellShapeControls),
|
||||||
|
decomposition_(decomposition),
|
||||||
detailsDict_(subDict(type + "Coeffs")),
|
detailsDict_(subDict(type + "Coeffs")),
|
||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
(
|
(
|
||||||
@ -68,7 +76,11 @@ initialPointsMethod::initialPointsMethod
|
|||||||
autoPtr<initialPointsMethod> initialPointsMethod::New
|
autoPtr<initialPointsMethod> initialPointsMethod::New
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word initialPointsMethodTypeName
|
word initialPointsMethodTypeName
|
||||||
@ -99,7 +111,15 @@ autoPtr<initialPointsMethod> initialPointsMethod::New
|
|||||||
return
|
return
|
||||||
autoPtr<initialPointsMethod>
|
autoPtr<initialPointsMethod>
|
||||||
(
|
(
|
||||||
cstrIter()(initialPointsDict, foamyHexMesh)
|
cstrIter()
|
||||||
|
(
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,8 +62,15 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Reference to the conformalVoronoiMesh holding this object
|
const Time& runTime_;
|
||||||
const conformalVoronoiMesh& foamyHexMesh_;
|
|
||||||
|
Random& rndGen_;
|
||||||
|
|
||||||
|
const conformationSurfaces& geometryToConformTo_;
|
||||||
|
|
||||||
|
const cellShapeControl& cellShapeControls_;
|
||||||
|
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition_;
|
||||||
|
|
||||||
//- Method details dictionary
|
//- Method details dictionary
|
||||||
dictionary detailsDict_;
|
dictionary detailsDict_;
|
||||||
@ -102,9 +109,20 @@ public:
|
|||||||
dictionary,
|
dictionary,
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
),
|
),
|
||||||
(initialPointsDict, foamyHexMesh)
|
(
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +133,11 @@ public:
|
|||||||
(
|
(
|
||||||
const word& type,
|
const word& type,
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +147,11 @@ public:
|
|||||||
static autoPtr<initialPointsMethod> New
|
static autoPtr<initialPointsMethod> New
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -135,19 +161,49 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Const access to the details dictionary
|
// Access
|
||||||
const dictionary& detailsDict() const
|
|
||||||
{
|
|
||||||
return detailsDict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
Switch fixInitialPoints() const
|
const Time& time() const
|
||||||
{
|
{
|
||||||
return fixInitialPoints_;
|
return runTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the initial points for the conformalVoronoiMesh
|
Random& rndGen() const
|
||||||
virtual List<Vb::Point> initialPoints() const = 0;
|
{
|
||||||
|
return rndGen_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const conformationSurfaces& geometryToConformTo() const
|
||||||
|
{
|
||||||
|
return geometryToConformTo_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cellShapeControl& cellShapeControls() const
|
||||||
|
{
|
||||||
|
return cellShapeControls_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const backgroundMeshDecomposition& decomposition() const
|
||||||
|
{
|
||||||
|
return decomposition_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Const access to the details dictionary
|
||||||
|
const dictionary& detailsDict() const
|
||||||
|
{
|
||||||
|
return detailsDict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Switch fixInitialPoints() const
|
||||||
|
{
|
||||||
|
return fixInitialPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Queries
|
||||||
|
|
||||||
|
//- Return the initial points for the conformalVoronoiMesh
|
||||||
|
virtual List<Vb::Point> initialPoints() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,23 @@ addToRunTimeSelectionTable(initialPointsMethod, pointFile, dictionary);
|
|||||||
pointFile::pointFile
|
pointFile::pointFile
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
initialPointsMethod(typeName, initialPointsDict, foamyHexMesh),
|
initialPointsMethod
|
||||||
|
(
|
||||||
|
typeName,
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
),
|
||||||
pointFileName_(detailsDict().lookup("pointFile"))
|
pointFileName_(detailsDict().lookup("pointFile"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -58,8 +71,8 @@ List<Vb::Point> pointFile::initialPoints() const
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
pointFileName_.name(),
|
pointFileName_.name(),
|
||||||
foamyHexMesh_.time().timeName(),
|
time().timeName(),
|
||||||
foamyHexMesh_.time(),
|
time(),
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
@ -85,13 +98,13 @@ List<Vb::Point> pointFile::initialPoints() const
|
|||||||
|
|
||||||
if (!isParentFile)
|
if (!isParentFile)
|
||||||
{
|
{
|
||||||
foamyHexMesh_.decomposition().distributePoints(points);
|
decomposition().distributePoints(points);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Otherwise, this is assumed to be points covering the whole
|
// Otherwise, this is assumed to be points covering the whole
|
||||||
// domain, so filter the points to be only those on this processor
|
// domain, so filter the points to be only those on this processor
|
||||||
boolList procPt(foamyHexMesh_.positionOnThisProc(points));
|
boolList procPt(decomposition().positionOnThisProcessor(points));
|
||||||
|
|
||||||
List<boolList> allProcPt(Pstream::nProcs());
|
List<boolList> allProcPt(Pstream::nProcs());
|
||||||
|
|
||||||
@ -126,14 +139,11 @@ List<Vb::Point> pointFile::initialPoints() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Field<bool> insidePoints = foamyHexMesh_.geometryToConformTo().wellInside
|
Field<bool> insidePoints = geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
points,
|
points,
|
||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr(cellShapeControls().cellSize(points))
|
||||||
(
|
|
||||||
foamyHexMesh_.cellShapeControls().cellSize(points)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
DynamicList<Vb::Point> initialPoints(insidePoints.size()/10);
|
DynamicList<Vb::Point> initialPoints(insidePoints.size()/10);
|
||||||
|
|||||||
@ -73,7 +73,11 @@ public:
|
|||||||
pointFile
|
pointFile
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,10 +41,23 @@ addToRunTimeSelectionTable(initialPointsMethod, uniformGrid, dictionary);
|
|||||||
uniformGrid::uniformGrid
|
uniformGrid::uniformGrid
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
initialPointsMethod(typeName, initialPointsDict, foamyHexMesh),
|
initialPointsMethod
|
||||||
|
(
|
||||||
|
typeName,
|
||||||
|
initialPointsDict,
|
||||||
|
runTime,
|
||||||
|
rndGen,
|
||||||
|
geometryToConformTo,
|
||||||
|
cellShapeControls,
|
||||||
|
decomposition
|
||||||
|
),
|
||||||
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
initialCellSize_(readScalar(detailsDict().lookup("initialCellSize"))),
|
||||||
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
|
||||||
randomPerturbationCoeff_
|
randomPerturbationCoeff_
|
||||||
@ -64,11 +77,11 @@ List<Vb::Point> uniformGrid::initialPoints() const
|
|||||||
// on whether this is a parallel run.
|
// on whether this is a parallel run.
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
bb = foamyHexMesh_.decomposition().procBounds();
|
bb = decomposition().procBounds();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bb = foamyHexMesh_.geometryToConformTo().globalBounds();
|
bb = geometryToConformTo().globalBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar x0 = bb.min().x();
|
scalar x0 = bb.min().x();
|
||||||
@ -87,8 +100,6 @@ List<Vb::Point> uniformGrid::initialPoints() const
|
|||||||
|
|
||||||
delta *= pow((1.0),-(1.0/3.0));
|
delta *= pow((1.0),-(1.0/3.0));
|
||||||
|
|
||||||
Random& rndGen = foamyHexMesh_.rndGen();
|
|
||||||
|
|
||||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||||
|
|
||||||
// Initialise points list
|
// Initialise points list
|
||||||
@ -117,15 +128,15 @@ List<Vb::Point> uniformGrid::initialPoints() const
|
|||||||
|
|
||||||
if (randomiseInitialGrid_)
|
if (randomiseInitialGrid_)
|
||||||
{
|
{
|
||||||
p.x() += pert*(rndGen.scalar01() - 0.5);
|
p.x() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.y() += pert*(rndGen.scalar01() - 0.5);
|
p.y() += pert*(rndGen().scalar01() - 0.5);
|
||||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
p.z() += pert*(rndGen().scalar01() - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
Pstream::parRun()
|
Pstream::parRun()
|
||||||
&& !foamyHexMesh_.decomposition().positionOnThisProcessor(p)
|
&& !decomposition().positionOnThisProcessor(p)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Skip this point if, in parallel, this position is not on
|
// Skip this point if, in parallel, this position is not on
|
||||||
@ -139,13 +150,13 @@ List<Vb::Point> uniformGrid::initialPoints() const
|
|||||||
points.setSize(pI);
|
points.setSize(pI);
|
||||||
|
|
||||||
Field<bool> insidePoints =
|
Field<bool> insidePoints =
|
||||||
foamyHexMesh_.geometryToConformTo().wellInside
|
geometryToConformTo().wellInside
|
||||||
(
|
(
|
||||||
points,
|
points,
|
||||||
minimumSurfaceDistanceCoeffSqr_
|
minimumSurfaceDistanceCoeffSqr_
|
||||||
*sqr
|
*sqr
|
||||||
(
|
(
|
||||||
foamyHexMesh_.cellShapeControls().cellSize(points)
|
cellShapeControls().cellSize(points)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,11 @@ public:
|
|||||||
uniformGrid
|
uniformGrid
|
||||||
(
|
(
|
||||||
const dictionary& initialPointsDict,
|
const dictionary& initialPointsDict,
|
||||||
const conformalVoronoiMesh& foamyHexMesh
|
const Time& runTime,
|
||||||
|
Random& rndGen,
|
||||||
|
const conformationSurfaces& geometryToConformTo,
|
||||||
|
const cellShapeControl& cellShapeControls,
|
||||||
|
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user