/*---------------------------------------------------------------------------*\ ========= | \\ / 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 "Coded_DimensionedFieldFunction.H" #include "DimensionedField.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // template const Foam::wordList Foam::DimensionedFieldFunctions::Coded::codeKeys ( {"evaluate", "update", "codeInclude"} ); template const Foam::wordList Foam::DimensionedFieldFunctions::Coded::codeDictVars ( {word::null, word::null, word::null} ); template const Foam::word Foam::DimensionedFieldFunctions::Coded::codeOptions ( "codedDimensionedFieldFunctionOptions" ); template const Foam::wordList Foam::DimensionedFieldFunctions::Coded::compileFiles { "codedDimensionedFieldFunctionTemplate.C" }; template const Foam::wordList Foam::DimensionedFieldFunctions::Coded::copyFiles { "codedDimensionedFieldFunctionTemplate.H" }; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::DimensionedFieldFunctions::Coded:: Coded ( const dictionary& dict, DimensionedFieldType& field ) : DimensionedFieldFunction(dict, field), codedBase ( dict.lookupOrDefault ( "name", word ( ( field.mesh().db().name() == polyMesh::defaultRegion ? word::null : word(field.mesh().db().name() + '_') ), field.name(), ( field.mesh().name() == field.mesh().db().name() ? word::null : word('_' + field.mesh().name()) ) ) ), dict, codeKeys, codeDictVars, codeOptions, compileFiles, copyFiles ) { // Set variable substitutions varSubstitutions().set ( { {"DimensionedFieldType", DimensionedFieldType::typeName}, { "DimensionedFieldTypeName", codedName(DimensionedFieldType::typeName) }, {"verbose", Foam::name(bool(debug))} } ); this->updateLibrary(dict); } template Foam::DimensionedFieldFunctions::Coded:: Coded ( const Coded& dff, DimensionedFieldType& field ) : DimensionedFieldFunction(dff, field), codedBase(dff) {} template Foam::autoPtr> Foam::DimensionedFieldFunctions::Coded::clone ( DimensionedFieldType& field ) const { return autoPtr> ( new Coded(*this, field) ); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::DimensionedFieldFunctions::Coded:: evaluate() { if (!redirectFunctionPtr_.valid()) { dictionary redirectDict; redirectDict.set("type", codeName()); redirectFunctionPtr_ = DimensionedFieldFunction::New ( redirectDict, this->field_ ); } redirectFunctionPtr_->evaluate(); } template bool Foam::DimensionedFieldFunctions::Coded:: update() { if (!redirectFunctionPtr_.valid()) { dictionary redirectDict; redirectDict.set("type", codeName()); redirectFunctionPtr_ = DimensionedFieldFunction::New ( redirectDict, this->field_ ); } return redirectFunctionPtr_->update(); } template void Foam::DimensionedFieldFunctions::Coded::write ( Ostream& os ) const { codedBase::write(os); } // ************************************************************************* //