mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'cvm' of /home/noisy3/OpenFOAM/OpenFOAM-dev into cvm
This commit is contained in:
@ -27,8 +27,7 @@ initialPointsMethod/uniformGrid/uniformGrid.C
|
||||
initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C
|
||||
initialPointsMethod/faceCentredCubic/faceCentredCubic.C
|
||||
initialPointsMethod/pointFile/pointFile.C
|
||||
initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C
|
||||
initialPointsMethod/hierarchicalDensityWeightedStochastic/hierarchicalDensityWeightedStochastic.C
|
||||
initialPointsMethod/autoDensity/autoDensity.C
|
||||
|
||||
relaxationModel/relaxationModel/relaxationModel.C
|
||||
relaxationModel/adaptiveLinear/adaptiveLinear.C
|
||||
|
||||
@ -989,11 +989,11 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
|
||||
if (newCellI == -1)
|
||||
{
|
||||
Pout<< "findCell backgroundMeshDecomposition "
|
||||
<< v << " "
|
||||
<< oldCellI
|
||||
<< newCellI
|
||||
<< " find nearest cellI ";
|
||||
// Pout<< "findCell backgroundMeshDecomposition "
|
||||
// << v << " "
|
||||
// << oldCellI
|
||||
// << newCellI
|
||||
// << " find nearest cellI ";
|
||||
|
||||
newCellI = cellSearch.findNearestCell(v);
|
||||
|
||||
@ -1150,6 +1150,14 @@ Foam::boolList Foam::backgroundMeshDecomposition::positionOnThisProcessor
|
||||
return posProc;
|
||||
}
|
||||
|
||||
bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
|
||||
(
|
||||
const treeBoundBox& box
|
||||
) const
|
||||
{
|
||||
return !bFTreePtr_().findBox(box).empty();
|
||||
}
|
||||
|
||||
|
||||
Foam::pointIndexHit Foam::backgroundMeshDecomposition::findLine
|
||||
(
|
||||
|
||||
@ -225,6 +225,10 @@ public:
|
||||
//- Are the given positions inside the domain of this decomposition
|
||||
boolList positionOnThisProcessor(const List<point>& pts) const;
|
||||
|
||||
//- Does the given box overlap the faces of the bounday of this
|
||||
// processor
|
||||
bool overlapsThisProcessor(const treeBoundBox& box) const;
|
||||
|
||||
//- Find nearest intersection of line between start and end, (exposing
|
||||
// underlying indexedOctree)
|
||||
pointIndexHit findLine
|
||||
|
||||
@ -1331,12 +1331,13 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
|
||||
|
||||
if (cellI == -1)
|
||||
{
|
||||
Pout<< "findCell conformalVoronoiMesh::distribute findCell "
|
||||
<< vit->type() << " "
|
||||
<< vit->index() << " "
|
||||
<< v << " "
|
||||
<< cellI
|
||||
<< " find nearest cellI ";
|
||||
// Pout<< "findCell conformalVoronoiMesh::distribute "
|
||||
// << "findCell "
|
||||
// << vit->type() << " "
|
||||
// << vit->index() << " "
|
||||
// << v << " "
|
||||
// << cellI
|
||||
// << " find nearest cellI ";
|
||||
|
||||
cellI = cellSearch.findNearestCell(v);
|
||||
|
||||
@ -1916,7 +1917,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
|
||||
// Report any Delaunay vertices that do not think that they are in the
|
||||
// domain the processor they are on.
|
||||
reportProcessorOccupancy();
|
||||
// reportProcessorOccupancy();
|
||||
|
||||
if(cvMeshControls().objOutput())
|
||||
{
|
||||
|
||||
@ -472,6 +472,17 @@ Foam::conformalVoronoiMesh::geometryToConformTo() const
|
||||
inline const Foam::backgroundMeshDecomposition&
|
||||
Foam::conformalVoronoiMesh::decomposition() const
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"inline const Foam::backgroundMeshDecomposition& "
|
||||
"Foam::conformalVoronoiMesh::decomposition() const"
|
||||
)
|
||||
<< "The backgroundMeshDecomposition cannot be asked for in serial."
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
return decomposition_();
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hierarchicalDensityWeightedStochastic.H"
|
||||
#include "autoDensity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -33,17 +33,17 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(hierarchicalDensityWeightedStochastic, 0);
|
||||
defineTypeNameAndDebug(autoDensity, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
initialPointsMethod,
|
||||
hierarchicalDensityWeightedStochastic,
|
||||
autoDensity,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::hierarchicalDensityWeightedStochastic::writeOBJ
|
||||
void Foam::autoDensity::writeOBJ
|
||||
(
|
||||
const treeBoundBox& bb,
|
||||
fileName name
|
||||
@ -68,8 +68,114 @@ void Foam::hierarchicalDensityWeightedStochastic::writeOBJ
|
||||
}
|
||||
}
|
||||
|
||||
bool Foam::autoDensity::combinedOverlaps(const treeBoundBox& box) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
return
|
||||
cvMesh_.decomposition().overlapsThisProcessor(box)
|
||||
|| cvMesh_.geometryToConformTo().overlaps(box);
|
||||
}
|
||||
|
||||
void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
return cvMesh_.geometryToConformTo().overlaps(box);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::autoDensity::combinedInside(const point& p) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
return
|
||||
cvMesh_.decomposition().positionOnThisProcessor(p)
|
||||
&& cvMesh_.geometryToConformTo().inside(p);
|
||||
}
|
||||
|
||||
return cvMesh_.geometryToConformTo().inside(p);
|
||||
}
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::autoDensity::combinedWellInside
|
||||
(
|
||||
const pointField& pts,
|
||||
const scalarField& sizes
|
||||
) const
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
return cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
pts,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
||||
);
|
||||
}
|
||||
|
||||
Field<bool> inside(pts.size(), true);
|
||||
|
||||
// Perform AND operation between testing the surfaces and the previous
|
||||
// field, i.e the parallel result, or in serial, with true.
|
||||
|
||||
Field<bool> insideA
|
||||
(
|
||||
cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
pts,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(sizes)
|
||||
)
|
||||
);
|
||||
|
||||
Field<bool> insideB(cvMesh_.decomposition().positionOnThisProcessor(pts));
|
||||
|
||||
// inside = insideA && insideB;
|
||||
|
||||
// Pout<< insideA << nl << insideB << endl;
|
||||
|
||||
forAll(inside, i)
|
||||
{
|
||||
// if (inside[i] != (insideA[i] && insideB[i]))
|
||||
// {
|
||||
// Pout<< i << " not equal " << " "
|
||||
// << pts[i] << " " << sizes[i] << " "
|
||||
// << insideA[i] << " "
|
||||
// << insideB[i] << " "
|
||||
// << inside[i]
|
||||
// << endl;
|
||||
// }
|
||||
|
||||
inside[i] = (insideA[i] && insideB[i]);
|
||||
}
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::autoDensity::combinedWellInside
|
||||
(
|
||||
const point& p,
|
||||
scalar size
|
||||
) const
|
||||
{
|
||||
bool inside = true;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
inside = cvMesh_.decomposition().positionOnThisProcessor(p);
|
||||
}
|
||||
|
||||
// Perform AND operation between testing the surfaces and the previous
|
||||
// result, i.e the parallel result, or in serial, with true.
|
||||
inside =
|
||||
inside
|
||||
&& cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
p,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(size)
|
||||
);
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoDensity::recurseAndFill
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
@ -77,8 +183,6 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
word recursionName
|
||||
) const
|
||||
{
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
|
||||
for (direction i = 0; i < 8; i++)
|
||||
{
|
||||
treeBoundBox subBB = bb.subBbox(i);
|
||||
@ -90,7 +194,7 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
cvMesh_.timeCheck(newName);
|
||||
}
|
||||
|
||||
if (geometry.overlaps(subBB))
|
||||
if (combinedOverlaps(subBB))
|
||||
{
|
||||
if (levelLimit > 0)
|
||||
{
|
||||
@ -104,14 +208,14 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
}
|
||||
else
|
||||
{
|
||||
// writeOBJ
|
||||
// (
|
||||
// subBB,
|
||||
// word(newName + "_overlap")
|
||||
// );
|
||||
|
||||
if (debug)
|
||||
{
|
||||
writeOBJ
|
||||
(
|
||||
subBB,
|
||||
word(newName + "_overlap")
|
||||
);
|
||||
|
||||
Pout<< newName + "_overlap " << subBB << endl;
|
||||
}
|
||||
|
||||
@ -127,16 +231,16 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (geometry.inside(subBB.midpoint()))
|
||||
else if (combinedInside(subBB.midpoint()))
|
||||
{
|
||||
// writeOBJ
|
||||
// (
|
||||
// subBB,
|
||||
// newName + "_inside"
|
||||
// );
|
||||
|
||||
if (debug)
|
||||
{
|
||||
writeOBJ
|
||||
(
|
||||
subBB,
|
||||
newName + "_inside"
|
||||
);
|
||||
|
||||
Pout<< newName + "_inside " << subBB << endl;
|
||||
}
|
||||
|
||||
@ -153,24 +257,27 @@ void Foam::hierarchicalDensityWeightedStochastic::recurseAndFill
|
||||
}
|
||||
else
|
||||
{
|
||||
// writeOBJ
|
||||
// (
|
||||
// subBB,
|
||||
// newName + "_outside"
|
||||
// );
|
||||
if (debug)
|
||||
{
|
||||
writeOBJ
|
||||
(
|
||||
subBB,
|
||||
newName + "_outside"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
bool Foam::autoDensity::fillBox
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
bool overlapping
|
||||
) const
|
||||
{
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
const conformationSurfaces& geometry(cvMesh_.geometryToConformTo());
|
||||
|
||||
Random& rnd = cvMesh_.rndGen();
|
||||
|
||||
@ -214,7 +321,10 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (!surfHit.hit())
|
||||
{
|
||||
// Pout<< "box wellInside, no need to sample surface." << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "box wellInside, no need to sample surface." << endl;
|
||||
}
|
||||
|
||||
wellInside = true;
|
||||
}
|
||||
@ -235,11 +345,7 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
List<bool>(8, false)
|
||||
);
|
||||
|
||||
Field<bool> insideCorners = geometry.wellInside
|
||||
(
|
||||
corners,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(cornerSizes)
|
||||
);
|
||||
Field<bool> insideCorners = combinedWellInside(corners, cornerSizes);
|
||||
|
||||
// Pout<< corners << nl << cornerSizes << nl << insideCorners << endl;
|
||||
|
||||
@ -260,11 +366,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at corner sample stage,"
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at corner sample stage,"
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -274,9 +383,12 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
// If one or more corners is not "wellInside", then treat this
|
||||
// as an overlapping box.
|
||||
|
||||
// Pout<< "Inside box found to have some non-wellInside "
|
||||
// << "corners, using overlapping fill."
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Inside box found to have some non-wellInside "
|
||||
<< "corners, using overlapping fill."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
overlapping = true;
|
||||
|
||||
@ -294,8 +406,6 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
scalarField lineSizes(nLine, 0.0);
|
||||
|
||||
Field<bool> insideLines(nLine, true);
|
||||
|
||||
for (label i = 0; i < surfRes_; i++)
|
||||
{
|
||||
label lPI = 0;
|
||||
@ -348,10 +458,10 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
List<bool>(nLine, false)
|
||||
);
|
||||
|
||||
insideLines = geometry.wellInside
|
||||
Field<bool> insideLines = combinedWellInside
|
||||
(
|
||||
linePoints,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(lineSizes)
|
||||
lineSizes
|
||||
);
|
||||
|
||||
forAll(insideLines, i)
|
||||
@ -371,11 +481,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at surface sample stage, "
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at surface sample stage, "
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -386,10 +499,13 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
// then treat this as an overlapping box.
|
||||
overlapping = true;
|
||||
|
||||
// Pout<< "Inside box found to have some non-"
|
||||
// << "wellInside surface points, using "
|
||||
// << "overlapping fill."
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Inside box found to have some non-"
|
||||
<< "wellInside surface points, using "
|
||||
<< "overlapping fill."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -445,10 +561,10 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
List<bool>(samplePoints.size(), false)
|
||||
);
|
||||
|
||||
Field<bool> insidePoints = geometry.wellInside
|
||||
Field<bool> insidePoints = combinedWellInside
|
||||
(
|
||||
samplePoints,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(sampleSizes)
|
||||
sampleSizes
|
||||
);
|
||||
|
||||
label nInside = 0;
|
||||
@ -473,11 +589,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at sample stage,"
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at sample stage,"
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -486,17 +605,26 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (nInside == 0)
|
||||
{
|
||||
// Pout<< "No sample points found inside box" << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "No sample points found inside box" << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pout<< scalar(nInside)/scalar(samplePoints.size())
|
||||
// << " full overlapping box" << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< scalar(nInside)/scalar(samplePoints.size())
|
||||
<< " full overlapping box" << endl;
|
||||
}
|
||||
|
||||
totalVolume *= scalar(nInside)/scalar(samplePoints.size());
|
||||
|
||||
// Pout<< "Total volume to fill = " << totalVolume << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Total volume to fill = " << totalVolume << endl;
|
||||
}
|
||||
|
||||
// Using the sampledPoints as the first test locations as they are
|
||||
// randomly shuffled, but unfiormly sampling space and have wellInside
|
||||
@ -540,12 +668,15 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
scalar r = rnd.scalar01();
|
||||
|
||||
// Pout<< "totalVolume " << totalVolume << nl
|
||||
// << "volumeAdded " << volumeAdded << nl
|
||||
// << "localVolume " << localVolume << nl
|
||||
// << "addProbability " << addProbability << nl
|
||||
// << "random " << r
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "totalVolume " << totalVolume << nl
|
||||
<< "volumeAdded " << volumeAdded << nl
|
||||
<< "localVolume " << localVolume << nl
|
||||
<< "addProbability " << addProbability << nl
|
||||
<< "random " << r
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (addProbability > r)
|
||||
{
|
||||
@ -576,9 +707,12 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (volumeAdded < totalVolume)
|
||||
{
|
||||
// Pout<< "Adding random points, remaining volume "
|
||||
// << totalVolume - volumeAdded
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Adding random points, remaining volume "
|
||||
<< totalVolume - volumeAdded
|
||||
<< endl;
|
||||
}
|
||||
|
||||
maxDensity = 1/pow3(max(minCellSize, SMALL));
|
||||
|
||||
@ -599,11 +733,7 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
else
|
||||
{
|
||||
// Determine if the point is "wellInside" the domain
|
||||
insidePoint = geometry.wellInside
|
||||
(
|
||||
p,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(localSize)
|
||||
);
|
||||
insidePoint = combinedWellInside(p, localSize);
|
||||
}
|
||||
|
||||
if (insidePoint)
|
||||
@ -626,11 +756,14 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
if (maxCellSize/minCellSize > maxSizeRatio_)
|
||||
{
|
||||
// Pout<< "Abort fill at random fill stage,"
|
||||
// << " minCellSize " << minCellSize
|
||||
// << " maxCellSize " << maxCellSize
|
||||
// << " maxSizeRatio " << maxCellSize/minCellSize
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Abort fill at random fill stage,"
|
||||
<< " minCellSize " << minCellSize
|
||||
<< " maxCellSize " << maxCellSize
|
||||
<< " maxSizeRatio " << maxCellSize/minCellSize
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Discard any points already filled into this box by
|
||||
// setting size of initialPoints back to its starting value
|
||||
@ -658,12 +791,15 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
scalar r = rnd.scalar01();
|
||||
|
||||
// Pout<< "totalVolume " << totalVolume << nl
|
||||
// << "volumeAdded " << volumeAdded << nl
|
||||
// << "localVolume " << localVolume << nl
|
||||
// << "addProbability " << addProbability << nl
|
||||
// << "random " << r
|
||||
// << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "totalVolume " << totalVolume << nl
|
||||
<< "volumeAdded " << volumeAdded << nl
|
||||
<< "localVolume " << localVolume << nl
|
||||
<< "addProbability " << addProbability << nl
|
||||
<< "random " << r
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (addProbability > r)
|
||||
{
|
||||
@ -694,16 +830,19 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
globalTrialPoints_ += trialPoints;
|
||||
|
||||
// Pout<< trialPoints
|
||||
// << " locations queried, " << initialPoints.size() - initialSize
|
||||
// << " points placed, ("
|
||||
// << scalar(initialPoints.size() - initialSize)
|
||||
// /scalar(max(trialPoints, 1))
|
||||
// << " success rate)." << nl
|
||||
// << "minCellSize " << minCellSize
|
||||
// << ", maxCellSize " << maxCellSize
|
||||
// << ", ratio " << maxCellSize/minCellSize
|
||||
// << nl << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< trialPoints
|
||||
<< " locations queried, " << initialPoints.size() - initialSize
|
||||
<< " points placed, ("
|
||||
<< scalar(initialPoints.size() - initialSize)
|
||||
/scalar(max(trialPoints, 1))
|
||||
<< " success rate)." << nl
|
||||
<< "minCellSize " << minCellSize
|
||||
<< ", maxCellSize " << maxCellSize
|
||||
<< ", ratio " << maxCellSize/minCellSize
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -711,7 +850,7 @@ bool Foam::hierarchicalDensityWeightedStochastic::fillBox
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
hierarchicalDensityWeightedStochastic::hierarchicalDensityWeightedStochastic
|
||||
autoDensity::autoDensity
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
@ -737,8 +876,7 @@ hierarchicalDensityWeightedStochastic::hierarchicalDensityWeightedStochastic
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"hierarchicalDensityWeightedStochastic::"
|
||||
"hierarchicalDensityWeightedStochastic"
|
||||
"autoDensity::autoDensity"
|
||||
"("
|
||||
"const dictionary& initialPointsDict,"
|
||||
"const conformalVoronoiMesh& cvMesh"
|
||||
@ -753,15 +891,25 @@ hierarchicalDensityWeightedStochastic::hierarchicalDensityWeightedStochastic
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point>
|
||||
hierarchicalDensityWeightedStochastic::initialPoints() const
|
||||
std::list<Vb::Point> autoDensity::initialPoints() const
|
||||
{
|
||||
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
|
||||
treeBoundBox hierBB;
|
||||
|
||||
treeBoundBox hierBB = geometry.globalBounds().extend
|
||||
(
|
||||
cvMesh_.rndGen(), 1e-6
|
||||
);
|
||||
// Pick up the bounds of this processor, or the whole geometry, depending
|
||||
// on whether this is a parallel run.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
hierBB = cvMesh_.decomposition().procBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extend the global box to move it off large plane surfaces
|
||||
hierBB = cvMesh_.geometryToConformTo().globalBounds().extend
|
||||
(
|
||||
cvMesh_.rndGen(),
|
||||
1e-6
|
||||
);
|
||||
}
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
@ -22,19 +22,19 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::hierarchicalDensityWeightedStochastic
|
||||
Foam::autoDensity
|
||||
|
||||
Description
|
||||
Choose random points inside the domain and place them with a probability
|
||||
proportional to the target density of points.
|
||||
|
||||
SourceFiles
|
||||
hierarchicalDensityWeightedStochastic.C
|
||||
autoDensity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hierarchicalDensityWeightedStochastic_H
|
||||
#define hierarchicalDensityWeightedStochastic_H
|
||||
#ifndef autoDensity_H
|
||||
#define autoDensity_H
|
||||
|
||||
#include "initialPointsMethod.H"
|
||||
#include "treeBoundBox.H"
|
||||
@ -45,10 +45,10 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hierarchicalDensityWeightedStochastic Declaration
|
||||
Class autoDensity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class hierarchicalDensityWeightedStochastic
|
||||
class autoDensity
|
||||
:
|
||||
public initialPointsMethod
|
||||
{
|
||||
@ -82,6 +82,30 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check if the given box overlaps the geometry or, in parallel, the
|
||||
// backgroundMeshDecomposition
|
||||
bool combinedOverlaps(const treeBoundBox& box) const;
|
||||
|
||||
//- Check if the given point is inside the geometry and, in parallel,
|
||||
// the backgroundMeshDecomposition
|
||||
bool combinedInside(const point& p) const;
|
||||
|
||||
//- Check if the given points are wellInside the geometry and, in
|
||||
// parallel, inside the backgroundMeshDecomposition
|
||||
Field<bool> combinedWellInside
|
||||
(
|
||||
const pointField& pts,
|
||||
const scalarField& sizes
|
||||
) const;
|
||||
|
||||
//- Check if the given points are wellInside the geometry and, in
|
||||
// parallel, inside the backgroundMeshDecomposition
|
||||
bool combinedWellInside
|
||||
(
|
||||
const point& p,
|
||||
scalar size
|
||||
) const;
|
||||
|
||||
//- Write boundBox as obj
|
||||
void writeOBJ
|
||||
(
|
||||
@ -112,12 +136,12 @@ private:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("hierarchicalDensityWeightedStochastic");
|
||||
TypeName("autoDensity");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
hierarchicalDensityWeightedStochastic
|
||||
autoDensity
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
@ -125,7 +149,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~hierarchicalDensityWeightedStochastic()
|
||||
virtual ~autoDensity()
|
||||
{}
|
||||
|
||||
|
||||
@ -58,19 +58,30 @@ bodyCentredCubic::bodyCentredCubic
|
||||
|
||||
std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
boundBox bb;
|
||||
|
||||
// Pick up the bounds of this processor, or the whole geometry, depending
|
||||
// on whether this is a parallel run.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
bb = cvMesh_.decomposition().procBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
}
|
||||
|
||||
scalar x0 = bb.min().x();
|
||||
scalar xR = bb.max().x() - x0;
|
||||
label ni = label(xR/initialCellSize_) + 1;
|
||||
label ni = label(xR/initialCellSize_);
|
||||
|
||||
scalar y0 = bb.min().y();
|
||||
scalar yR = bb.max().y() - y0;
|
||||
label nj = label(yR/initialCellSize_) + 1;
|
||||
label nj = label(yR/initialCellSize_);
|
||||
|
||||
scalar z0 = bb.min().z();
|
||||
scalar zR = bb.max().z() - z0;
|
||||
label nk = label(zR/initialCellSize_) + 1;
|
||||
label nk = label(zR/initialCellSize_);
|
||||
|
||||
vector delta(xR/ni, yR/nj, zR/nk);
|
||||
|
||||
@ -82,8 +93,6 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
List<bool> isSurfacePoint(2*nk, false);
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
for (label j = 0; j < nj; j++)
|
||||
@ -114,7 +123,19 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
pA.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = pA;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(pA))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = pA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = pA;
|
||||
}
|
||||
|
||||
if (randomiseInitialGrid_)
|
||||
{
|
||||
@ -123,14 +144,35 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
pB.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = pB;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(pB))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = pB;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = pB;
|
||||
}
|
||||
}
|
||||
|
||||
points.setSize(pI);
|
||||
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
points,
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr(cvMesh_.cellSizeControl().cellSize(points, isSurfacePoint))
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
forAll(insidePoints, i)
|
||||
|
||||
@ -1,147 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "densityWeightedStochastic.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(densityWeightedStochastic, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
initialPointsMethod,
|
||||
densityWeightedStochastic,
|
||||
dictionary
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
densityWeightedStochastic::densityWeightedStochastic
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
)
|
||||
:
|
||||
initialPointsMethod(typeName, initialPointsDict, cvMesh),
|
||||
totalVolume_(readScalar(detailsDict().lookup("totalVolume"))),
|
||||
minCellSize_
|
||||
(
|
||||
detailsDict().lookupOrDefault<scalar>("minCellSize", GREAT)
|
||||
),
|
||||
minCellSizeLimit_
|
||||
(
|
||||
detailsDict().lookupOrDefault<scalar>("minCellSizeLimit", 0.0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> densityWeightedStochastic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
|
||||
Random& rndGen = cvMesh_.rndGen();
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
scalar volumeAdded = 0.0;
|
||||
|
||||
const point& min = bb.min();
|
||||
|
||||
vector span = bb.span();
|
||||
|
||||
label trialPoints = 0;
|
||||
|
||||
scalar maxDensity = 1/pow3(max(minCellSize_, SMALL));
|
||||
|
||||
while (volumeAdded < totalVolume_)
|
||||
{
|
||||
trialPoints++;
|
||||
|
||||
point p =
|
||||
min
|
||||
+ vector
|
||||
(
|
||||
span.x()*rndGen.scalar01(),
|
||||
span.y()*rndGen.scalar01(),
|
||||
span.z()*rndGen.scalar01()
|
||||
);
|
||||
|
||||
scalar localSize = cvMesh_.cellSizeControl().cellSize(p);
|
||||
|
||||
if (localSize < minCellSize_)
|
||||
{
|
||||
minCellSize_ = max(localSize, minCellSizeLimit_);
|
||||
|
||||
// 1/(minimum cell size)^3, gives the maximum permissible point
|
||||
// density
|
||||
maxDensity = 1/pow3(max(minCellSize_, SMALL));
|
||||
}
|
||||
|
||||
scalar localDensity = 1/pow3(max(localSize, SMALL));
|
||||
|
||||
// Accept possible placements proportional to the relative local density
|
||||
if (localDensity/maxDensity > rndGen.scalar01())
|
||||
{
|
||||
// Determine if the point is "wellInside" the domain
|
||||
if
|
||||
(
|
||||
cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
p,
|
||||
minimumSurfaceDistanceCoeffSqr_*sqr(localSize)
|
||||
)
|
||||
)
|
||||
{
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
|
||||
volumeAdded += 1/localDensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl << " " << typeName << nl
|
||||
<< " " << initialPoints.size() << " points placed" << nl
|
||||
<< " " << trialPoints << " locations queried" << nl
|
||||
<< " " << scalar(initialPoints.size())/scalar(trialPoints)
|
||||
<< " success rate" << nl
|
||||
<< " minCellSize " << minCellSize_
|
||||
<< endl;
|
||||
|
||||
return initialPoints;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,106 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::densityWeightedStochastic
|
||||
|
||||
Description
|
||||
Choose random points inside the domain and place them with a probability
|
||||
proportional to the target density of points.
|
||||
|
||||
SourceFiles
|
||||
densityWeightedStochastic.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef densityWeightedStochastic_H
|
||||
#define densityWeightedStochastic_H
|
||||
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class densityWeightedStochastic Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class densityWeightedStochastic
|
||||
:
|
||||
public initialPointsMethod
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- The total volume to be filled
|
||||
scalar totalVolume_;
|
||||
|
||||
//- Working variable for minimum cell size, a starting value may be
|
||||
// specified in the dictionary
|
||||
mutable scalar minCellSize_;
|
||||
|
||||
//- Smallest minimum cell size allowed, i.e. to avoid high initial
|
||||
// population of areas of small size
|
||||
scalar minCellSizeLimit_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("densityWeightedStochastic");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
densityWeightedStochastic
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~densityWeightedStochastic()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -58,19 +58,30 @@ faceCentredCubic::faceCentredCubic
|
||||
|
||||
std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
boundBox bb;
|
||||
|
||||
// Pick up the bounds of this processor, or the whole geometry, depending
|
||||
// on whether this is a parallel run.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
bb = cvMesh_.decomposition().procBounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
bb = cvMesh_.geometryToConformTo().globalBounds();
|
||||
}
|
||||
|
||||
scalar x0 = bb.min().x();
|
||||
scalar xR = bb.max().x() - x0;
|
||||
label ni = label(xR/initialCellSize_) + 1;
|
||||
label ni = label(xR/initialCellSize_);
|
||||
|
||||
scalar y0 = bb.min().y();
|
||||
scalar yR = bb.max().y() - y0;
|
||||
label nj = label(yR/initialCellSize_) + 1;
|
||||
label nj = label(yR/initialCellSize_);
|
||||
|
||||
scalar z0 = bb.min().z();
|
||||
scalar zR = bb.max().z() - z0;
|
||||
label nk = label(zR/initialCellSize_) + 1;
|
||||
label nk = label(zR/initialCellSize_);
|
||||
|
||||
vector delta(xR/ni, yR/nj, zR/nk);
|
||||
|
||||
@ -82,8 +93,6 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
|
||||
List<bool> isSurfacePoint(4*nk, false);
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
for (label j = 0; j < nj; j++)
|
||||
@ -112,7 +121,19 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
|
||||
p = point
|
||||
(
|
||||
@ -128,7 +149,19 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
|
||||
p = point
|
||||
(
|
||||
@ -144,7 +177,19 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
|
||||
p = point
|
||||
(
|
||||
@ -160,14 +205,35 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
p.z() += pert*(rndGen.scalar01() - 0.5);
|
||||
}
|
||||
|
||||
points[pI++] = p;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (cvMesh_.decomposition().positionOnThisProcessor(p))
|
||||
{
|
||||
// Add this point in parallel only if this position is
|
||||
// on this processor.
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
points[pI++] = p;
|
||||
}
|
||||
}
|
||||
|
||||
points.setSize(pI);
|
||||
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
points,
|
||||
minimumSurfaceDistanceCoeffSqr_
|
||||
*sqr(cvMesh_.cellSizeControl().cellSize(points, isSurfacePoint))
|
||||
*sqr
|
||||
(
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
forAll(insidePoints, i)
|
||||
|
||||
@ -146,7 +146,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
|
||||
cvMesh_.cellSizeControl().cellSize
|
||||
(
|
||||
points,
|
||||
List<bool>(pI, false)
|
||||
List<bool>(points.size(), false)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user