ENH: foamyHexMesh: enable point randomisation for point file insertion

This commit is contained in:
laurence
2013-08-12 16:40:22 +01:00
parent 8d3508f78a
commit 9dcb920861
2 changed files with 20 additions and 2 deletions

View File

@ -59,7 +59,12 @@ pointFile::pointFile
decomposition decomposition
), ),
pointFileName_(detailsDict().lookup("pointFile")), pointFileName_(detailsDict().lookup("pointFile")),
insideOutsideCheck_(detailsDict().lookup("insideOutsideCheck")) insideOutsideCheck_(detailsDict().lookup("insideOutsideCheck")),
randomiseInitialGrid_(detailsDict().lookup("randomiseInitialGrid")),
randomPerturbationCoeff_
(
readScalar(detailsDict().lookup("randomPerturbationCoeff"))
)
{ {
Info<< " Inside/Outside check is " << insideOutsideCheck_.asText() Info<< " Inside/Outside check is " << insideOutsideCheck_.asText()
<< endl; << endl;
@ -161,7 +166,14 @@ List<Vb::Point> pointFile::initialPoints() const
{ {
if (insidePoints[i]) if (insidePoints[i])
{ {
const point& p(points[i]); point& p = points[i];
if (randomiseInitialGrid_)
{
p.x() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5);
p.y() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5);
p.z() += randomPerturbationCoeff_*(rndGen().scalar01() - 0.5);
}
initialPoints.append(Vb::Point(p.x(), p.y(), p.z())); initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
} }

View File

@ -65,6 +65,12 @@ private:
//- Check if inserted points are inside or outside //- Check if inserted points are inside or outside
Switch insideOutsideCheck_; Switch insideOutsideCheck_;
//- Should the initial positions be randomised
Switch randomiseInitialGrid_;
//- Randomise the initial positions by fraction of the initialCellSize_
scalar randomPerturbationCoeff_;
public: public: