/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2016-2026 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "fieldsExpression.H" #include "volFields.H" #include "surfaceFields.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template class GeoField, class Op, class A, class B, class> bool Foam::functionObjects::fieldsExpression::opAndStore ( const GeoField& a, const GeoField& b ) { store(resultName_, eval(Op::value(a, b))); return true; } template class GeoField, class Op, class ... Args> bool Foam::functionObjects::fieldsExpression::opAndStore(const Args& ...) { return false; } template class GeoField, class Op, class A, class B> bool Foam::functionObjects::fieldsExpression::foldAB(const label i) { if ( i == 0 && foundObject>(fieldNames_[0]) ) { clearObject(resultName_); store ( resultName_, lookupObject>(fieldNames_[0]).clone() ); return true; } if ( i > 0 && foundObject>(resultName_) && foundObject>(fieldNames_[i]) ) { tmp> a = lookupObject>(resultName_).clone(); const GeoField& b = lookupObject>(fieldNames_[i]); clearObject(resultName_); return opAndStore(a(), b); } return false; } template class GeoField, class Op, class A> bool Foam::functionObjects::fieldsExpression::foldA(const label i) { bool success = false; #define processType(Type, none) \ success = success || foldAB(i); FOR_ALL_FIELD_TYPES(processType); #undef processType return success; } template class GeoField, class Op> bool Foam::functionObjects::fieldsExpression::fold(const label i) { bool success = false; #define processType(Type, none) \ success = success || foldA(i); FOR_ALL_FIELD_TYPES(processType); #undef processType return success; } template class GeoField, class Op> bool Foam::functionObjects::fieldsExpression::calcGeoFieldOp() { forAll(fieldNames_, i) { if (!fold(i)) { return false; } } return true; } template bool Foam::functionObjects::fieldsExpression::calcOp() { return calcGeoFieldOp() || calcGeoFieldOp() || calcGeoFieldOp(); } // ************************************************************************* //