From 4015a344cd12d0f0100a6ebd8b39642f10145a63 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 28 May 2014 15:23:56 +0100 Subject: [PATCH] ENH: dynamicRefineFvMesh: #1203 base unrefinement on max, not min of surrounding cells --- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 48 ++++++++++++------- .../dynamicRefineFvMesh/dynamicRefineFvMesh.H | 10 ++-- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 201e62b70a..fc8fcce172 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -59,7 +59,15 @@ Foam::label Foam::dynamicRefineFvMesh::count { n++; } + + // debug also serves to get-around Clang compiler trying to optimsie + // out this forAll loop under O3 optimisation + if (debug) + { + Info<< "n=" << n << endl; + } } + return n; } @@ -659,11 +667,11 @@ Foam::dynamicRefineFvMesh::maxPointField(const scalarField& pFld) const } -// Get min of connected cell +// Get max of connected cell Foam::scalarField -Foam::dynamicRefineFvMesh::minCellField(const volScalarField& vFld) const +Foam::dynamicRefineFvMesh::maxCellField(const volScalarField& vFld) const { - scalarField pFld(nPoints(), GREAT); + scalarField pFld(nPoints(), -GREAT); forAll(pointCells(), pointI) { @@ -671,7 +679,7 @@ Foam::dynamicRefineFvMesh::minCellField(const volScalarField& vFld) const forAll(pCells, i) { - pFld[pointI] = min(pFld[pointI], vFld[pCells[i]]); + pFld[pointI] = max(pFld[pointI], vFld[pCells[i]]); } } return pFld; @@ -774,10 +782,11 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectRefineCells calculateProtectedCells(unrefineableCell); // Count current selection - label nCandidates = returnReduce(count(candidateCell, 1), sumOp