ENH: Compiling version. Insertion query for background. Balances.

This commit is contained in:
graham
2011-05-20 20:25:53 +01:00
parent cf6c0c4c01
commit 4e106f076a
15 changed files with 463 additions and 217 deletions

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "backgroundMeshDecomposition.H" #include "backgroundMeshDecomposition.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -40,21 +39,6 @@ defineTypeNameAndDebug(backgroundMeshDecomposition, 0);
void Foam::backgroundMeshDecomposition::initialRefinement() void Foam::backgroundMeshDecomposition::initialRefinement()
{ {
//Read decomposePar dictionary
IOdictionary decomposeDict
(
IOobject
(
"decomposeParDict",
cvMesh_.time().system(),
cvMesh_.time(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
scalar mergeDist = 1e-6*mesh_.bounds().mag();
volScalarField cellWeights volScalarField cellWeights
( (
IOobject IOobject
@ -72,25 +56,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo(); const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
// Decomposition decompositionMethod& decomposer = decomposerPtr_();
autoPtr<decompositionMethod> decomposerPtr
(
decompositionMethod::New(decomposeDict)
);
decompositionMethod& decomposer = decomposerPtr();
if (!decomposer.parallelAware())
{
FatalErrorIn
(
"void Foam::backgroundMeshDecomposition::initialRefinement() const"
)
<< "You have selected decomposition method "
<< decomposer.typeName
<< " which is not parallel aware." << endl
<< exit(FatalError);
}
hexRef8 meshCutter hexRef8 meshCutter
( (
@ -369,7 +335,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
cellWeights cellWeights
); );
fvMeshDistribute distributor(mesh_, mergeDist); fvMeshDistribute distributor(mesh_, mergeDist_);
autoPtr<mapDistributePolyMesh> mapDist = autoPtr<mapDistributePolyMesh> mapDist =
distributor.distribute(newDecomp); distributor.distribute(newDecomp);
@ -625,6 +591,88 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
} }
void Foam::backgroundMeshDecomposition::buildPatchAndTree()
{
primitivePatch tmpBoundaryFaces
(
SubList<face>
(
mesh_.faces(),
mesh_.nFaces() - mesh_.nInternalFaces(),
mesh_.nInternalFaces()
),
mesh_.points()
);
boundaryFacesPtr_.reset
(
new bPatch
(
tmpBoundaryFaces.localFaces(),
tmpBoundaryFaces.localPoints()
)
);
// Overall bb
treeBoundBox overallBb(boundaryFacesPtr_().localPoints());
Random& rnd = cvMesh_.rndGen();
bFTreePtr_.reset
(
new indexedOctree<treeDataBPatch>
(
treeDataBPatch(false, boundaryFacesPtr_()),
overallBb.extend(rnd, 1e-4),
10, // maxLevel
10, // leafSize
3.0 // duplicity
)
);
if (debug)
{
OFstream fStr
(
cvMesh_.time().path()
/"backgroundMeshDecomposition_proc_"
+ name(Pstream::myProcNo())
+ "_boundaryFaces.obj"
);
const faceList& faces = boundaryFacesPtr_().localFaces();
const pointField& points = boundaryFacesPtr_().localPoints();
Map<label> foamToObj(points.size());
label vertI = 0;
forAll(faces, i)
{
const face& f = faces[i];
forAll(f, fPI)
{
if (foamToObj.insert(f[fPI], vertI))
{
meshTools::writeOBJ(fStr, points[f[fPI]]);
vertI++;
}
}
fStr<< 'f';
forAll(f, fPI)
{
fStr<< ' ' << foamToObj[f[fPI]] + 1;
}
fStr<< nl;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::backgroundMeshDecomposition::backgroundMeshDecomposition Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
@ -645,6 +693,21 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
IOobject::MUST_READ IOobject::MUST_READ
) )
), ),
boundaryFacesPtr_(),
bFTreePtr_(),
decomposeDict_
(
IOobject
(
"decomposeParDict",
cvMesh_.time().system(),
cvMesh_.time(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
decomposerPtr_(decompositionMethod::New(decomposeDict_)),
mergeDist_(1e-6*mesh_.bounds().mag()),
spanScale_(readScalar(coeffsDict_.lookup("spanScale"))), spanScale_(readScalar(coeffsDict_.lookup("spanScale"))),
minCellSizeLimit_ minCellSizeLimit_
( (
@ -667,9 +730,23 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
<< exit(FatalError); << exit(FatalError);
} }
if (!decomposerPtr_().parallelAware())
{
FatalErrorIn
(
"void Foam::backgroundMeshDecomposition::initialRefinement() const"
)
<< "You have selected decomposition method "
<< decomposerPtr_().typeName
<< " which is not parallel aware." << endl
<< exit(FatalError);
}
Info<< nl << "Building initial background mesh decomposition" << endl; Info<< nl << "Building initial background mesh decomposition" << endl;
initialRefinement(); initialRefinement();
buildPatchAndTree();
} }
@ -681,17 +758,54 @@ Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::conformationSurfaces::positionOnThisProc(const point& pt) const Foam::autoPtr<Foam::mapDistributePolyMesh>
Foam::backgroundMeshDecomposition::distribute
(
volScalarField& cellWeights
)
{ {
if (debug)
{
const_cast<Time&>(mesh_.time())++;
cellWeights.write();
mesh_.write();
}
labelList newDecomp = decomposerPtr_().decompose
(
mesh_,
mesh_.cellCentres(),
cellWeights
);
fvMeshDistribute distributor(mesh_, mergeDist_);
autoPtr<mapDistributePolyMesh> mapDist =
distributor.distribute(newDecomp);
if (debug)
{
printMeshData(mesh_);
const_cast<Time&>(mesh_.time())++;
mesh_.write();
cellWeights.write();
}
buildPatchAndTree();
return mapDist;
} }
Foam::label Foam::conformationSurfaces::positionProc(const point& pt) const bool Foam::backgroundMeshDecomposition::positionInThisDomain
(
const point& pt
) const
{ {
return
bFTreePtr_().getVolumeType(pt)
return -1; == indexedOctree<treeDataBPatch>::INSIDE;
} }

View File

@ -66,13 +66,23 @@ SourceFiles
#include "mapDistributePolyMesh.H" #include "mapDistributePolyMesh.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "treeBoundBox.H" #include "treeBoundBox.H"
#include "primitivePatch.H"
#include "face.H"
#include "List.H"
#include "pointField.H"
#include "indexedOctree.H"
#include "treeDataPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
typedef treeDataPrimitivePatch<face, List, const pointField, point>
treeDataBPatch;
typedef PrimitivePatch<face, List, const pointField, point> bPatch;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class backgroundMeshDecomposition Declaration Class backgroundMeshDecomposition Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -91,6 +101,22 @@ class backgroundMeshDecomposition
// is responsible for. // is responsible for.
fvMesh mesh_; fvMesh mesh_;
//- Patch containing an independent representation of the surface of the
// mesh of this processor
autoPtr<bPatch> boundaryFacesPtr_;
//- Search tree for the boundaryFaces_ patch
autoPtr<indexedOctree<treeDataBPatch> > bFTreePtr_;
//- Decomposition dictionary
IOdictionary decomposeDict_;
//- Decomposition method
autoPtr<decompositionMethod> decomposerPtr_;
//- merge distance required by fvMeshDistribute
scalar mergeDist_;
//- Scale of a cell span vs cell size used to decide to refine a cell //- Scale of a cell span vs cell size used to decide to refine a cell
scalar spanScale_; scalar spanScale_;
@ -133,6 +159,9 @@ class backgroundMeshDecomposition
volScalarField& cellWeights volScalarField& cellWeights
) const; ) const;
//- Build the surface patch and search tree
void buildPatchAndTree();
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
backgroundMeshDecomposition(const backgroundMeshDecomposition&); backgroundMeshDecomposition(const backgroundMeshDecomposition&);
@ -162,23 +191,20 @@ public:
// Member Functions // Member Functions
void distribute() const; //- Redistribute the background mesh based on a supplied weight field,
// returning a map to use to redistribute vertices.
//- Check if the point is in the domain handled by this processor autoPtr<mapDistributePolyMesh> distribute
bool positionOnThisProc(const point& pt) const; (
volScalarField& cellWeights
//- Which processor's domain handles this point );
label positionProc(const point& pt) const;
//- Is the given position inside the domain of this decomposition
bool positionInThisDomain(const point& pt) const;
// Access // Access
// Check //- Return access to the underlying mesh
inline const fvMesh& mesh() const;
// Edit
// Write
}; };

View File

@ -23,36 +23,11 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // {
return mesh_;
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -286,7 +286,7 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
{ {
if (isSurfacePoint) if (isSurfacePoint)
{ {
Pout<< "WARNING: isSurfacePoint is broken!" << endl; // Pout<< "WARNING: isSurfacePoint is broken!" << endl;
} }
scalar size = defaultCellSize_; scalar size = defaultCellSize_;
@ -326,17 +326,17 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
} }
else else
{ {
FatalErrorIn // FatalErrorIn
( // (
"Foam::scalar Foam::cellSizeControlSurfaces::cellSize" // "Foam::scalar Foam::cellSizeControlSurfaces::cellSize"
"(" // "("
"const point& pt, " // "const point& pt, "
"bool isSurfacePoint" // "bool isSurfacePoint"
") const" // ") const"
) // )
<< "Point " << pt // << "Point " << pt
<< " Cannot use isSurfacePoint here, or at all!" // << " Cannot use isSurfacePoint here, or at all!"
<< nl << exit(FatalError) << endl; // << nl << exit(FatalError) << endl;
// Evaluating the cell size at the nearest surface // Evaluating the cell size at the nearest surface
evalCellSizeFunctions(surfHit.hitPoint(), size, true); evalCellSizeFunctions(surfHit.hitPoint(), size, true);

View File

@ -28,6 +28,7 @@ License
#include "relaxationModel.H" #include "relaxationModel.H"
#include "faceAreaWeightModel.H" #include "faceAreaWeightModel.H"
#include "backgroundMeshDecomposition.H" #include "backgroundMeshDecomposition.H"
#include "meshSearch.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -576,7 +577,7 @@ void Foam::conformalVoronoiMesh::insertConvexFeaturePoints()
{ {
const Foam::point& featPt = feMesh.points()[ptI]; const Foam::point& featPt = feMesh.points()[ptI];
if (!geometryToConformTo_.positionOnThisProc(featPt)) if (!positionOnThisProc(featPt))
{ {
continue; continue;
} }
@ -628,7 +629,7 @@ void Foam::conformalVoronoiMesh::insertConcaveFeaturePoints()
{ {
const Foam::point& featPt = feMesh.points()[ptI]; const Foam::point& featPt = feMesh.points()[ptI];
if (!geometryToConformTo_.positionOnThisProc(featPt)) if (!positionOnThisProc(featPt))
{ {
continue; continue;
} }
@ -728,7 +729,7 @@ void Foam::conformalVoronoiMesh::insertMixedFeaturePoints()
const Foam::point& pt(feMesh.points()[ptI]); const Foam::point& pt(feMesh.points()[ptI]);
if (!geometryToConformTo_.positionOnThisProc(pt)) if (!positionOnThisProc(pt))
{ {
continue; continue;
} }
@ -856,6 +857,116 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
} }
void Foam::conformalVoronoiMesh::distribute()
{
Info<< nl << "Redistributing points" << endl;
timeCheck("Before distribute");
const fvMesh& bMesh = decomposition_().mesh();
volScalarField cellWeights
(
IOobject
(
"cellWeights",
bMesh.time().timeName(),
bMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
bMesh,
dimensionedScalar("weight", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
meshSearch cellSearch(bMesh);
List<DynamicList<Foam::point> > cellVertices(bMesh.nCells());
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
if (vit->real())
{
Foam::point v = topoint(vit->point());
label cellI = cellSearch.findCell(v);
if (cellI == -1)
{
Pout<< "findCell "
<< vit->type() << " "
<< vit->index() << " "
<< v << " "
<< cellI << endl;
}
else
{
cellVertices[cellI].append(topoint(vit->point()));
}
}
}
forAll(cellVertices, cI)
{
cellWeights.internalField()[cI] = min
(
max(cellVertices[cI].size(), 1e-3),
100
);
}
autoPtr<mapDistributePolyMesh> mapDist = decomposition_().distribute
(
cellWeights
);
Pout<< "number_of_vertices() before distribution "
<< label(number_of_vertices()) << endl;
mapDist().distributeCellData(cellVertices);
// Remove the entire tessellation
this->clear();
// Info<< "NEED TO MAP FEATURE POINTS" << endl;
// reinsertFeaturePoints();
startOfInternalPoints_ = number_of_vertices();
timeCheck("Distribution performed");
Info<< nl << "Inserting distributed tessellation" << endl;
std::vector<Point> pointsToInsert;
forAll(cellVertices, cI)
{
forAll(cellVertices[cI], cVPI)
{
pointsToInsert.push_back(toPoint(cellVertices[cI][cVPI]));
}
}
insertPoints(pointsToInsert);
Pout<< "number_of_vertices() after distribution "
<< label(number_of_vertices()) << endl;
if(cvMeshControls().objOutput())
{
writePoints("distributedPoints.obj", true);
}
timeCheck("After distribute");
}
void Foam::conformalVoronoiMesh::storeSizesAndAlignments void Foam::conformalVoronoiMesh::storeSizesAndAlignments
( (
const std::vector<Point>& storePts const std::vector<Point>& storePts
@ -1266,7 +1377,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
); );
} }
createFeaturePoints(); // createFeaturePoints();
if (cvMeshControls().objOutput()) if (cvMeshControls().objOutput())
{ {
@ -1275,6 +1386,10 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
insertInitialPoints(); insertInitialPoints();
distribute();
createFeaturePoints();
buildSurfaceConformation(rmCoarse); buildSurfaceConformation(rmCoarse);
if(cvMeshControls().objOutput()) if(cvMeshControls().objOutput())
@ -1675,4 +1790,36 @@ void Foam::conformalVoronoiMesh::move()
} }
bool Foam::conformalVoronoiMesh::positionOnThisProc
(
const Foam::point& pt
) const
{
if (Pstream::parRun())
{
return decomposition_().positionInThisDomain(pt);
}
return true;
}
Foam::label Foam::conformalVoronoiMesh::positionProc
(
const Foam::point& pt
) const
{
Pout<< "Dummy positionProc" << endl;
if (!Pstream::parRun())
{
return -1;
}
else
{
return Pstream::myProcNo();
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -67,6 +67,7 @@ SourceFiles
#include "cellSet.H" #include "cellSet.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,7 +83,6 @@ class faceAreaWeightModel;
class backgroundMeshDecomposition; class backgroundMeshDecomposition;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class conformalVoronoiMesh Declaration Class conformalVoronoiMesh Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -372,6 +372,10 @@ private:
// initialPointsMethod // initialPointsMethod
void insertInitialPoints(); void insertInitialPoints();
//- In parallel redistribute the backgroundMeshDecomposition and
//- vertices to balance the number of vertices on each processor
void distribute();
//- Store data for sizeAndAlignmentLocations_, storedSizes_ and //- Store data for sizeAndAlignmentLocations_, storedSizes_ and
// storedAlignments_ and initialise the sizeAndAlignmentTreePtr_ // storedAlignments_ and initialise the sizeAndAlignmentTreePtr_
void storeSizesAndAlignments(const std::vector<Point>& storePts); void storeSizesAndAlignments(const std::vector<Point>& storePts);
@ -786,6 +790,12 @@ 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;
//- Which processor's domain handles this point
label positionProc(const Foam::point& pt) const;
//- Conversion functions between point (OpenFOAM) and Point (CGAL) //- Conversion functions between point (OpenFOAM) and Point (CGAL)
# ifdef CGAL_INEXACT # ifdef CGAL_INEXACT

View File

@ -446,43 +446,43 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAnyIntersection
Foam::point dE0 = topoint(dual(fit->first)); Foam::point dE0 = topoint(dual(fit->first));
Foam::point dE1 = topoint(dual(fit->first->neighbor(fit->second))); Foam::point dE1 = topoint(dual(fit->first->neighbor(fit->second)));
if (Pstream::parRun()) // if (Pstream::parRun())
{ // {
const treeBoundBoxList& procBbs = // const treeBoundBoxList& procBbs =
geometryToConformTo_.processorDomains()[Pstream::myProcNo()]; // geometryToConformTo_.processorDomains()[Pstream::myProcNo()];
forAll(procBbs, pBI) // forAll(procBbs, pBI)
{ // {
const treeBoundBox& procBb = procBbs[pBI]; // const treeBoundBox& procBb = procBbs[pBI];
Foam::point a = dE0; // Foam::point a = dE0;
Foam::point b = dE1; // Foam::point b = dE1;
bool inBox = clipLineToBox(a, b, procBb); // bool inBox = clipLineToBox(a, b, procBb);
// Check for the edge passing through a surface // // Check for the edge passing through a surface
if // if
( // (
inBox // inBox
&& geometryToConformTo_.findSurfaceAnyIntersection(a, b) // && geometryToConformTo_.findSurfaceAnyIntersection(a, b)
) // )
{ // {
// Pout<< "# findSurfaceAnyIntersection" << endl; // // Pout<< "# findSurfaceAnyIntersection" << endl;
// meshTools::writeOBJ(Pout, a); // // meshTools::writeOBJ(Pout, a);
// meshTools::writeOBJ(Pout, b); // // meshTools::writeOBJ(Pout, b);
// Pout<< "l cr0 cr1" << endl; // // Pout<< "l cr0 cr1" << endl;
return true; // return true;
} // }
} // }
} // }
else // else
{ // {
if (geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1)) if (geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1))
{ {
return true; return true;
} }
} // }
} }
return false; return false;
@ -635,7 +635,7 @@ void Foam::conformalVoronoiMesh::buildParallelInterface
// Hard coded switch, can be turned on for debugging purposes and all // Hard coded switch, can be turned on for debugging purposes and all
// vertices will be referred to all processors. // vertices will be referred to all processors.
bool allPointReferral = false; bool allPointReferral = true;
if (allPointReferral) if (allPointReferral)
{ {
@ -1121,48 +1121,48 @@ void Foam::conformalVoronoiMesh::parallelInterfaceIntersection
label closestHitProc = -1; label closestHitProc = -1;
scalar closestHitDistSqr = GREAT; scalar closestHitDistSqr = GREAT;
forAll(geometryToConformTo_.processorDomains(), procI) // forAll(geometryToConformTo_.processorDomains(), procI)
{ // {
if (procI == Pstream::myProcNo()) // if (procI == Pstream::myProcNo())
{ // {
continue; // continue;
} // }
const treeBoundBoxList& procBbs = // const treeBoundBoxList& procBbs =
geometryToConformTo_.processorDomains()[procI]; // geometryToConformTo_.processorDomains()[procI];
forAll(procBbs, pBI) // forAll(procBbs, pBI)
{ // {
const treeBoundBox& procBb = procBbs[pBI]; // const treeBoundBox& procBb = procBbs[pBI];
intersects = procBb.intersects(dE0, dE1, boxPt); // intersects = procBb.intersects(dE0, dE1, boxPt);
if (intersects) // if (intersects)
{ // {
hitDistSqr = magSqr(vert - boxPt); // hitDistSqr = magSqr(vert - boxPt);
if (hitDistSqr < closestHitDistSqr) // if (hitDistSqr < closestHitDistSqr)
{ // {
closestHitProc = procI; // closestHitProc = procI;
closestHitDistSqr = hitDistSqr; // closestHitDistSqr = hitDistSqr;
} // }
} // }
// Perform the query in the opposite direction // // Perform the query in the opposite direction
intersects = procBb.intersects(dE1, dE0, boxPt); // intersects = procBb.intersects(dE1, dE0, boxPt);
if (intersects) // if (intersects)
{ // {
hitDistSqr = magSqr(vert - boxPt); // hitDistSqr = magSqr(vert - boxPt);
if (hitDistSqr < closestHitDistSqr) // if (hitDistSqr < closestHitDistSqr)
{ // {
closestHitProc = procI; // closestHitProc = procI;
closestHitDistSqr = hitDistSqr; // closestHitDistSqr = hitDistSqr;
} // }
} // }
} // }
} // }
if (closestHitProc >= 0) if (closestHitProc >= 0)
{ {
@ -1204,21 +1204,21 @@ void Foam::conformalVoronoiMesh::parallelInterfaceInfluence
// Pout<< nl << "# circumradius " << sqrt(circumradiusSqr) << endl; // Pout<< nl << "# circumradius " << sqrt(circumradiusSqr) << endl;
// drawDelaunayCell(Pout, cit); // drawDelaunayCell(Pout, cit);
forAll(geometryToConformTo_.processorMeshBounds(), procI) // forAll(geometryToConformTo_.processorMeshBounds(), procI)
{ // {
if (procI == Pstream::myProcNo()) // if (procI == Pstream::myProcNo())
{ // {
continue; // continue;
} // }
const treeBoundBox& procBb = // const treeBoundBox& procBb =
geometryToConformTo_.processorMeshBounds()[procI]; // geometryToConformTo_.processorMeshBounds()[procI];
if (procBb.overlaps(circumcentre, circumradiusSqr)) // if (procBb.overlaps(circumcentre, circumradiusSqr))
{ // {
toProc[procI] = true; // toProc[procI] = true;
} // }
} // }
} }
} }
@ -1303,7 +1303,7 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceProtrusion
if if
( (
surfHitLargest.hit() surfHitLargest.hit()
&& !geometryToConformTo_.positionOnThisProc(surfHitLargest.hitPoint()) && !positionOnThisProc(surfHitLargest.hitPoint())
) )
{ {
// A protrusion was identified, but not penetrating on this processor, // A protrusion was identified, but not penetrating on this processor,
@ -1400,7 +1400,7 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion
if if
( (
surfHitLargest.hit() surfHitLargest.hit()
&& !geometryToConformTo_.positionOnThisProc(surfHitLargest.hitPoint()) && !positionOnThisProc(surfHitLargest.hitPoint())
) )
{ {
// A protrusion was identified, but not penetrating on this processor, // A protrusion was identified, but not penetrating on this processor,
@ -1757,7 +1757,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
if (edHit.hit()) if (edHit.hit())
{ {
if(!geometryToConformTo_.positionOnThisProc(edHit.hitPoint())) if(!positionOnThisProc(edHit.hitPoint()))
{ {
continue; continue;
} }

View File

@ -94,7 +94,7 @@ bool Foam::conformalVoronoiMesh::insertSpecialisedFeaturePoint
if (nExternal == 2 && nInternal == 1) if (nExternal == 2 && nInternal == 1)
{ {
// if (!geometryToConformTo_.positionOnThisProc(pt)) // if (!positionOnThisProc(pt))
// { // {
// continue; // continue;
// } // }

View File

@ -771,7 +771,7 @@ Foam::label Foam::conformationSurfaces::findPatch(const point& pt) const
findSurfaceNearest findSurfaceNearest
( (
pt, pt,
spanMagSqr_, sqr(GREAT),
surfHit, surfHit,
hitSurface hitSurface
); );

View File

@ -58,7 +58,7 @@ bodyCentredCubic::bodyCentredCubic
std::vector<Vb::Point> bodyCentredCubic::initialPoints() const std::vector<Vb::Point> bodyCentredCubic::initialPoints() const
{ {
const boundBox& bb = cvMesh_.geometryToConformTo().bounds(); const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
scalar x0 = bb.min().x(); scalar x0 = bb.min().x();
scalar xR = bb.max().x() - x0; scalar xR = bb.max().x() - x0;

View File

@ -66,7 +66,7 @@ densityWeightedStochastic::densityWeightedStochastic
std::vector<Vb::Point> densityWeightedStochastic::initialPoints() const std::vector<Vb::Point> densityWeightedStochastic::initialPoints() const
{ {
const boundBox& bb = cvMesh_.geometryToConformTo().bounds(); const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
Random& rndGen = cvMesh_.rndGen(); Random& rndGen = cvMesh_.rndGen();

View File

@ -58,7 +58,7 @@ faceCentredCubic::faceCentredCubic
std::vector<Vb::Point> faceCentredCubic::initialPoints() const std::vector<Vb::Point> faceCentredCubic::initialPoints() const
{ {
const boundBox& bb = cvMesh_.geometryToConformTo().bounds(); const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
scalar x0 = bb.min().x(); scalar x0 = bb.min().x();
scalar xR = bb.max().x() - x0; scalar xR = bb.max().x() - x0;

View File

@ -758,7 +758,10 @@ hierarchicalDensityWeightedStochastic::initialPoints() const
{ {
const conformationSurfaces& geometry = cvMesh_.geometryToConformTo(); const conformationSurfaces& geometry = cvMesh_.geometryToConformTo();
treeBoundBox hierBB = geometry.bounds().extend(cvMesh_.rndGen(), 1e-6); treeBoundBox hierBB = geometry.globalBounds().extend
(
cvMesh_.rndGen(), 1e-6
);
std::vector<Vb::Point> initialPoints; std::vector<Vb::Point> initialPoints;

View File

@ -79,10 +79,7 @@ std::vector<Vb::Point> pointFile::initialPoints() const
forAll(points, ptI) forAll(points, ptI)
{ {
procPt[ptI] = cvMesh_.geometryToConformTo().positionOnThisProc procPt[ptI] = cvMesh_.positionOnThisProc(points[ptI]);
(
points[ptI]
);
} }
if (Pstream::parRun()) if (Pstream::parRun())
@ -95,32 +92,6 @@ std::vector<Vb::Point> pointFile::initialPoints() const
Pstream::scatterList(allProcPt); Pstream::scatterList(allProcPt);
// forAll(procPt, ptI)
// {
// label nProcsTrue = 0;
// forAll(allProcPt, procI)
// {
// if (allProcPt[procI][ptI])
// {
// nProcsTrue++;
// }
// }
// if (nProcsTrue != 1)
// {
// Info<< points[ptI] << " " << nProcsTrue << " true" << endl;
// if (nProcsTrue > 1)
// {
// forAll(allProcPt, procI)
// {
// allProcPt[procI][ptI] = false;
// }
// }
// }
// }
forAll(procPt, ptI) forAll(procPt, ptI)
{ {
bool foundAlready = false; bool foundAlready = false;

View File

@ -58,7 +58,7 @@ uniformGrid::uniformGrid
std::vector<Vb::Point> uniformGrid::initialPoints() const std::vector<Vb::Point> uniformGrid::initialPoints() const
{ {
const boundBox& bb = cvMesh_.geometryToConformTo().bounds(); const boundBox& bb = cvMesh_.geometryToConformTo().globalBounds();
scalar x0 = bb.min().x(); scalar x0 = bb.min().x();
scalar xR = bb.max().x() - x0; scalar xR = bb.max().x() - x0;