From 4e106f076a3da2f7b517dc59c7ba1b18e822e1e1 Mon Sep 17 00:00:00 2001 From: graham Date: Fri, 20 May 2011 20:25:53 +0100 Subject: [PATCH] ENH: Compiling version. Insertion query for background. Balances. --- .../backgroundMeshDecomposition.C | 196 ++++++++++++++---- .../backgroundMeshDecomposition.H | 54 +++-- .../backgroundMeshDecompositionI.H | 33 +-- .../cellSizeControlSurfaces.C | 24 +-- .../conformalVoronoiMesh.C | 155 +++++++++++++- .../conformalVoronoiMesh.H | 12 +- .../conformalVoronoiMeshConformToSurface.C | 158 +++++++------- ...alVoronoiMeshFeaturePointSpecialisations.C | 2 +- .../conformationSurfaces.C | 2 +- .../bodyCentredCubic/bodyCentredCubic.C | 2 +- .../densityWeightedStochastic.C | 2 +- .../faceCentredCubic/faceCentredCubic.C | 2 +- .../hierarchicalDensityWeightedStochastic.C | 5 +- .../initialPointsMethod/pointFile/pointFile.C | 31 +-- .../uniformGrid/uniformGrid.C | 2 +- 15 files changed, 463 insertions(+), 217 deletions(-) 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