/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 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 "DimensionedFunction2.H" // * * * * * * * * * * * * * * Private Constructors * * * * * * * * * * * * // template Foam::DimensionedFunction2::DimensionedFunction2 ( const word& name, const Function2s::unitSets& units, const dictionary& dict ) : xDimensions_(units.x.dimensions()), yDimensions_(units.y.dimensions()), valueDimensions_(units.value.dimensions()), function_(Function2::New(name, units, dict)) {} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template template < class GeoMesh, template class ResultPrimitiveField, template class XPrimitiveField, template class YPrimitiveField > void Foam::DimensionedFunction2::value ( DimensionedField& result, const DimensionedField& x, const DimensionedField& y ) const { x.dimensions() = xDimensions_; y.dimensions() = yDimensions_; result.primitiveFieldRef() = function_->value(x.primitiveField(), y.primitiveField()); } template template < class GeoMesh, template class ResultPrimitiveField, template class XPrimitiveField, template class YPrimitiveField > void Foam::DimensionedFunction2::value ( GeometricField& result, const GeometricField& x, const GeometricField& y ) const { value(result.internalFieldRef(), x.internalField(), y.internalField()); typename GeometricField::BoundaryField& bresult = result.boundaryFieldRef(); const typename GeometricField::BoundaryField& bx = x.boundaryField(); const typename GeometricField::BoundaryField& by = y.boundaryField(); forAll(bresult, patchi) { bresult[patchi] = function_->value(bx[patchi], by[patchi]); } } // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // template Foam::autoPtr> Foam::DimensionedFunction2::New ( const word& name, const Function2s::unitSets& units, const dictionary& dict ) { return autoPtr> ( new DimensionedFunction2(name, units, dict) ); } template Foam::autoPtr> Foam::DimensionedFunction2::New ( const word& name, const unitSet& xUnits, const unitSet& yUnits, const unitSet& valueUnits, const dictionary& dict ) { return autoPtr> ( new DimensionedFunction2(name, {xUnits, yUnits, valueUnits}, dict) ); } // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // template Foam::tmp> Foam::DimensionedFunction2::value ( const scalarField& x, const scalarField& y ) const { return function_->value(x, y); } template template < class GeoMesh, template class XPrimitiveField, template class YPrimitiveField > Foam::tmp> Foam::DimensionedFunction2::value ( const DimensionedField& x, const DimensionedField& y ) const { tmp> tresult ( DimensionedField::New ( word(function_->name(), '(', x.name(), ')'), x.mesh(), valueDimensions_ ) ); value(tresult.ref(), x, y); return tresult; } template template < class GeoMesh, template class XPrimitiveField, template class YPrimitiveField > Foam::tmp> Foam::DimensionedFunction2::value ( const GeometricField& x, const GeometricField& y ) const { tmp> tresult ( GeometricField::New ( word(function_->name(), '(', x.name(), ')'), x.mesh(), valueDimensions_ ) ); value(tresult.ref(), x, y); return tresult; } // ************************************************************************* //