OpenFOAM-dev / data /src /finiteVolume /fields /fvPatchFields /derived /codedMixed /codedMixedFvPatchField.C
Download data/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 5.78 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
-
curl -L -o codedMixedFvPatchField.C https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
5.78 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Copyright (C) 2011-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::codedMixedFvPatchField<Type>::codeKeys | |
| ( | |
| {"code", "codeInclude", "localCode"} | |
| ); | |
| template<class Type> | |
| const Foam::wordList Foam::codedMixedFvPatchField<Type>::codeDictVars | |
| ( | |
| {word::null, word::null, word::null} | |
| ); | |
| template<class Type> | |
| const Foam::word Foam::codedMixedFvPatchField<Type>::codeOptions | |
| ( | |
| "codedMixedFvPatchFieldOptions" | |
| ); | |
| template<class Type> | |
| const Foam::wordList Foam::codedMixedFvPatchField<Type>::compileFiles | |
| { | |
| "codedMixedFvPatchFieldTemplate.C" | |
| }; | |
| template<class Type> | |
| const Foam::wordList Foam::codedMixedFvPatchField<Type>::copyFiles | |
| { | |
| "codedMixedFvPatchFieldTemplate.H" | |
| }; | |
| // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | |
| template<class Type> | |
| Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField | |
| ( | |
| const fvPatch& p, | |
| const DimensionedField<Type, fvMesh>& iF, | |
| const dictionary& dict | |
| ) | |
| : | |
| mixedFvPatchField<Type>(p, iF, dict), | |
| codedBase | |
| ( | |
| dict.lookupOrDefault<word> | |
| ( | |
| "name", | |
| word | |
| ( | |
| ( | |
| iF.mesh().name() == polyMesh::defaultRegion | |
| ? word::null | |
| : word(iF.mesh().name() + '_') | |
| ), | |
| iF.name(), '_', p.name() | |
| ) | |
| ), | |
| dict, | |
| codeKeys, | |
| codeDictVars, | |
| codeOptions, | |
| compileFiles, | |
| copyFiles | |
| ) | |
| { | |
| const word fieldType(pTraits<Type>::typeName); | |
| // Set variable substitutions | |
| varSubstitutions().set | |
| ( | |
| { | |
| {"TemplateType", fieldType}, | |
| {"FieldType", fieldType.capitalise() + "Field"}, | |
| {"verbose", Foam::name(bool(debug))} | |
| } | |
| ); | |
| // Compile the library containing user-defined fvPatchField | |
| updateLibrary(dict); | |
| } | |
| template<class Type> | |
| Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField | |
| ( | |
| const codedMixedFvPatchField<Type>& ptf, | |
| const fvPatch& p, | |
| const DimensionedField<Type, fvMesh>& iF, | |
| const fieldMapper& mapper | |
| ) | |
| : | |
| mixedFvPatchField<Type>(ptf, p, iF, mapper), | |
| codedBase(ptf) | |
| {} | |
| template<class Type> | |
| Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField | |
| ( | |
| const codedMixedFvPatchField<Type>& ptf, | |
| const DimensionedField<Type, fvMesh>& iF | |
| ) | |
| : | |
| mixedFvPatchField<Type>(ptf, iF), | |
| codedBase(ptf) | |
| {} | |
| // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | |
| template<class Type> | |
| const Foam::mixedFvPatchField<Type>& | |
| Foam::codedMixedFvPatchField<Type>::redirectPatchField() const | |
| { | |
| if (!redirectPatchFieldPtr_.valid()) | |
| { | |
| OStringStream os; | |
| mixedFvPatchField<Type>::write(os); | |
| IStringStream is(os.str()); | |
| dictionary dict(is); | |
| // Override the type to enforce the fvPatchField::New constructor | |
| // to choose our type | |
| dict.set("type", codeName()); | |
| redirectPatchFieldPtr_.set | |
| ( | |
| dynamic_cast<mixedFvPatchField<Type>*> | |
| ( | |
| fvPatchField<Type>::New | |
| ( | |
| patch(), | |
| internalField(), | |
| dict | |
| ).ptr() | |
| ) | |
| ); | |
| } | |
| return redirectPatchFieldPtr_(); | |
| } | |
| template<class Type> | |
| void Foam::codedMixedFvPatchField<Type>::updateCoeffs() | |
| { | |
| if (this->updated()) | |
| { | |
| return; | |
| } | |
| const mixedFvPatchField<Type>& fvp = redirectPatchField(); | |
| const_cast<mixedFvPatchField<Type>&>(fvp).updateCoeffs(); | |
| // Copy through coefficients | |
| this->refValue() = fvp.refValue(); | |
| this->refGrad() = fvp.refGrad(); | |
| this->valueFraction() = fvp.valueFraction(); | |
| mixedFvPatchField<Type>::updateCoeffs(); | |
| } | |
| template<class Type> | |
| void Foam::codedMixedFvPatchField<Type>::evaluate | |
| ( | |
| const Pstream::commsTypes commsType | |
| ) | |
| { | |
| const mixedFvPatchField<Type>& fvp = redirectPatchField(); | |
| // - updates the value of fvp (though not used) | |
| // - resets the updated() flag | |
| const_cast<mixedFvPatchField<Type>&>(fvp).evaluate(commsType); | |
| // Update the value (using the coefficients) locally | |
| mixedFvPatchField<Type>::evaluate(commsType); | |
| } | |
| template<class Type> | |
| void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const | |
| { | |
| mixedFvPatchField<Type>::write(os); | |
| codedBase::write(os); | |
| } | |
| // ************************************************************************* // | |