OpenFOAM-dev / data /src /finiteVolume /fields /DimensionedFields /DimensionedFieldFunctions /Coded /Coded_DimensionedFieldFunction.C
Download data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/Coded/Coded_DimensionedFieldFunction.C from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 5.31 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/Coded/Coded_DimensionedFieldFunction.C
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/Coded/Coded_DimensionedFieldFunction.C
-
curl -L -o Coded_DimensionedFieldFunction.C https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/DimensionedFields/DimensionedFieldFunctions/Coded/Coded_DimensionedFieldFunction.C
5.31 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / 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 <http://www.gnu.org/licenses/>. | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | |
| template<class Type> | |
| const Foam::wordList Foam::DimensionedFieldFunctions::Coded<Type>::codeKeys | |
| ( | |
| {"evaluate", "update", "codeInclude"} | |
| ); | |
| template<class Type> | |
| const Foam::wordList Foam::DimensionedFieldFunctions::Coded<Type>::codeDictVars | |
| ( | |
| {word::null, word::null, word::null} | |
| ); | |
| template<class Type> | |
| const Foam::word Foam::DimensionedFieldFunctions::Coded<Type>::codeOptions | |
| ( | |
| "codedDimensionedFieldFunctionOptions" | |
| ); | |
| template<class Type> | |
| const Foam::wordList Foam::DimensionedFieldFunctions::Coded<Type>::compileFiles | |
| { | |
| "codedDimensionedFieldFunctionTemplate.C" | |
| }; | |
| template<class Type> | |
| const Foam::wordList Foam::DimensionedFieldFunctions::Coded<Type>::copyFiles | |
| { | |
| "codedDimensionedFieldFunctionTemplate.H" | |
| }; | |
| // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | |
| template<class DimensionedFieldType> | |
| Foam::DimensionedFieldFunctions::Coded<DimensionedFieldType>:: | |
| Coded | |
| ( | |
| const dictionary& dict, | |
| DimensionedFieldType& field | |
| ) | |
| : | |
| DimensionedFieldFunction<DimensionedFieldType>(dict, field), | |
| codedBase | |
| ( | |
| dict.lookupOrDefault<word> | |
| ( | |
| "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<class DimensionedFieldType> | |
| Foam::DimensionedFieldFunctions::Coded<DimensionedFieldType>:: | |
| Coded | |
| ( | |
| const Coded& dff, | |
| DimensionedFieldType& field | |
| ) | |
| : | |
| DimensionedFieldFunction<DimensionedFieldType>(dff, field), | |
| codedBase(dff) | |
| {} | |
| template<class DimensionedFieldType> | |
| Foam::autoPtr<Foam::DimensionedFieldFunction<DimensionedFieldType>> | |
| Foam::DimensionedFieldFunctions::Coded<DimensionedFieldType>::clone | |
| ( | |
| DimensionedFieldType& field | |
| ) const | |
| { | |
| return autoPtr<DimensionedFieldFunction<DimensionedFieldType>> | |
| ( | |
| new Coded<DimensionedFieldType>(*this, field) | |
| ); | |
| } | |
| // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | |
| template<class DimensionedFieldType> | |
| void Foam::DimensionedFieldFunctions::Coded<DimensionedFieldType>:: | |
| evaluate() | |
| { | |
| if (!redirectFunctionPtr_.valid()) | |
| { | |
| dictionary redirectDict; | |
| redirectDict.set("type", codeName()); | |
| redirectFunctionPtr_ = | |
| DimensionedFieldFunction<DimensionedFieldType>::New | |
| ( | |
| redirectDict, | |
| this->field_ | |
| ); | |
| } | |
| redirectFunctionPtr_->evaluate(); | |
| } | |
| template<class DimensionedFieldType> | |
| bool Foam::DimensionedFieldFunctions::Coded<DimensionedFieldType>:: | |
| update() | |
| { | |
| if (!redirectFunctionPtr_.valid()) | |
| { | |
| dictionary redirectDict; | |
| redirectDict.set("type", codeName()); | |
| redirectFunctionPtr_ = | |
| DimensionedFieldFunction<DimensionedFieldType>::New | |
| ( | |
| redirectDict, | |
| this->field_ | |
| ); | |
| } | |
| return redirectFunctionPtr_->update(); | |
| } | |
| template<class DimensionedFieldType> | |
| void Foam::DimensionedFieldFunctions::Coded<DimensionedFieldType>::write | |
| ( | |
| Ostream& os | |
| ) const | |
| { | |
| codedBase::write(os); | |
| } | |
| // ************************************************************************* // | |