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