diff --git a/src/mesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/src/mesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index 4fda7ff5a9..f4ff9245e8 100644 --- a/src/mesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/src/mesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "backgroundMeshDecomposition.H" -#include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -40,21 +39,6 @@ defineTypeNameAndDebug(backgroundMeshDecomposition, 0); 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 ( IOobject @@ -72,25 +56,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement() const conformationSurfaces& geometry = cvMesh_.geometryToConformTo(); - // Decomposition - autoPtr 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); - } + decompositionMethod& decomposer = decomposerPtr_(); hexRef8 meshCutter ( @@ -369,7 +335,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement() cellWeights ); - fvMeshDistribute distributor(mesh_, mergeDist); + fvMeshDistribute distributor(mesh_, mergeDist_); autoPtr mapDist = distributor.distribute(newDecomp); @@ -625,6 +591,88 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells } +void Foam::backgroundMeshDecomposition::buildPatchAndTree() +{ + primitivePatch tmpBoundaryFaces + ( + SubList + ( + 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(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