/*---------------------------------------------------------------------------*\
========= |
\\ / 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 .
\*---------------------------------------------------------------------------*/
#include "codedFixedValueFvPatchField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template
const Foam::wordList Foam::codedFixedValueFvPatchField::codeKeys
(
{"code", "codeInclude", "localCode"}
);
template
const Foam::wordList Foam::codedFixedValueFvPatchField::codeDictVars
(
{word::null, word::null, word::null}
);
template
const Foam::word Foam::codedFixedValueFvPatchField::codeOptions
(
"codedFixedValueFvPatchFieldOptions"
);
template
const Foam::wordList Foam::codedFixedValueFvPatchField::compileFiles
{
"codedFixedValueFvPatchFieldTemplate.C"
};
template
const Foam::wordList Foam::codedFixedValueFvPatchField::copyFiles
{
"codedFixedValueFvPatchFieldTemplate.H"
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField& iF,
const dictionary& dict
)
:
fixedValueFvPatchField(p, iF, dict),
codedBase
(
dict.lookupOrDefault
(
"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::typeName);
// Set variable substitutions
varSubstitutions().set
(
{
{"TemplateType", fieldType},
{"FieldType", fieldType.capitalise() + "Field"},
{"verbose", Foam::name(bool(debug))}
}
);
updateLibrary(dict);
}
template
Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField
(
const codedFixedValueFvPatchField& ptf,
const fvPatch& p,
const DimensionedField& iF,
const fieldMapper& mapper
)
:
fixedValueFvPatchField(ptf, p, iF, mapper),
codedBase(ptf)
{}
template
Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField
(
const codedFixedValueFvPatchField& ptf,
const DimensionedField& iF
)
:
fixedValueFvPatchField(ptf, iF),
codedBase(ptf)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
const Foam::fvPatchField&
Foam::codedFixedValueFvPatchField::redirectPatchField() const
{
if (!redirectPatchFieldPtr_.valid())
{
OStringStream os;
writeEntry(os, "type", codeName());
if (this->overridesConstraint())
{
writeEntry(os, "patchType", patch().type());
}
writeEntry(os, "value", *this);
IStringStream is(os.str());
dictionary dict(is);
redirectPatchFieldPtr_.set
(
fvPatchField::New
(
patch(),
internalField(),
dict
).ptr()
);
}
return redirectPatchFieldPtr_();
}
template
void Foam::codedFixedValueFvPatchField::updateCoeffs()
{
if (this->updated())
{
return;
}
const fvPatchField& fvp = redirectPatchField();
const_cast&>(fvp).updateCoeffs();
// Copy through value
this->operator==(fvp);
fixedValueFvPatchField::updateCoeffs();
}
template
void Foam::codedFixedValueFvPatchField::evaluate
(
const Pstream::commsTypes commsType
)
{
const fvPatchField& fvp = redirectPatchField();
const_cast&>(fvp).evaluate(commsType);
fixedValueFvPatchField::evaluate(commsType);
}
template
void Foam::codedFixedValueFvPatchField::write(Ostream& os) const
{
fixedValueFvPatchField::write(os);
codedBase::write(os);
}
// ************************************************************************* //