diff --git a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C index c98439984fd13632bd3b7417fb5c417c7b562285..89dd6b6b2d3b07b591b02e67c64104989807a684 100644 --- a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C +++ b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,13 +30,14 @@ License void Foam::setRefCell ( const volScalarField& field, + const volScalarField& fieldRef, const dictionary& dict, label& refCelli, scalar& refValue, const bool forceReference ) { - if (field.needReference() || forceReference) + if (fieldRef.needReference() || forceReference) { word refCellName = field.name() + "RefCell"; word refPointName = field.name() + "RefPoint"; @@ -56,6 +57,7 @@ void Foam::setRefCell "void Foam::setRefCell\n" "(\n" " const volScalarField&,\n" + " const volScalarField&,\n" " const dictionary&,\n" " label& scalar&,\n" " bool\n" @@ -76,7 +78,7 @@ void Foam::setRefCell point refPointi(dict.lookup(refPointName)); refCelli = field.mesh().findCell(refPointi); label hasRef = (refCelli >= 0 ? 1 : 0); - label sumHasRef = returnReduce(hasRef, sumOp<label>()); + label sumHasRef = returnReduce<label>(hasRef, sumOp<label>()); if (sumHasRef != 1) { FatalIOErrorIn @@ -84,6 +86,7 @@ void Foam::setRefCell "void Foam::setRefCell\n" "(\n" " const volScalarField&,\n" + " const volScalarField&,\n" " const dictionary&,\n" " label& scalar&,\n" " bool\n" @@ -103,6 +106,7 @@ void Foam::setRefCell "void Foam::setRefCell\n" "(\n" " const volScalarField&,\n" + " const volScalarField&,\n" " const dictionary&,\n" " label& scalar&,\n" " bool\n" @@ -119,6 +123,19 @@ void Foam::setRefCell } +void Foam::setRefCell +( + const volScalarField& field, + const dictionary& dict, + label& refCelli, + scalar& refValue, + const bool forceReference +) +{ + setRefCell(field, field, dict, refCelli, refValue, forceReference); +} + + Foam::scalar Foam::getRefCellValue ( const volScalarField& field, diff --git a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H index db69771874f17504c37fce387b94cdd29a2d4199..66ff72013d80b9f58d28b15d11588cc76ce2b298 100644 --- a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H +++ b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,8 +44,22 @@ SourceFiles namespace Foam { -//- Find the reference cell nearest (in index) to the given cell, -// but which is not on a cyclic, symmetry or processor patch. +//- If the field fieldRef needs referencing find the reference cell nearest +// (in index) to the given cell looked-up for field, but which is not on a +// cyclic, symmetry or processor patch. +void setRefCell +( + const volScalarField& field, + const volScalarField& fieldRef, + const dictionary& dict, + label& refCelli, + scalar& refValue, + const bool forceReference = false +); + +//- If the field needs referencing find the reference cell nearest +// (in index) to the given cell looked-up for field, but which is not on a +// cyclic, symmetry or processor patch. void setRefCell ( const volScalarField& field,