/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-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 "CodedFunction2.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template
const Foam::wordList Foam::Function2s::Coded::codeKeys
(
{"code", "codeInclude"}
);
template
const Foam::wordList Foam::Function2s::Coded::codeDictVars
(
{word::null, word::null}
);
template
const Foam::word Foam::Function2s::Coded::codeOptions
(
"codedFunction2Options"
);
template
const Foam::wordList Foam::Function2s::Coded::compileFiles
{
"codedFunction2Template.C"
};
template
const Foam::wordList Foam::Function2s::Coded::copyFiles
{
"codedFunction2Template.H"
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::Function2s::Coded::Coded
(
const word& name,
const unitSets& units,
const dictionary& dict
)
:
Function2(name),
codedBase
(
name,
dict,
codeKeys,
codeDictVars,
codeOptions,
compileFiles,
copyFiles
),
units_(units)
{
// Set variable substitutions
varSubstitutions().set
(
{
{"TemplateType", pTraits::typeName},
{"verbose", Foam::name(bool(debug))}
}
);
this->updateLibrary(dict);
dictionary redirectDict(dict);
redirectDict.set(codeName(), codeName());
redirectFunction2Ptr_ =
Function2::New(codeName(), this->units_, redirectDict);
}
template
Foam::Function2s::Coded::Coded(const Coded& cf2)
:
Function2(cf2),
codedBase(cf2),
units_(cf2.units_),
redirectFunction2Ptr_(cf2.redirectFunction2Ptr_, false)
{}
template
Foam::tmp> Foam::Function2s::Coded::clone() const
{
return tmp>(new Coded(*this));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template
Foam::Function2s::Coded::~Coded()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
Foam::tmp> Foam::Function2s::Coded::value
(
const scalarField& x,
const scalarField& y
) const
{
return
units_.value.toStandard
(
redirectFunction2Ptr_->value
(
units_.x.toUser(tmp(x)),
units_.y.toUser(tmp(y))
)
);
}
template
void Foam::Function2s::Coded::write
(
Ostream& os,
const unitSets& units
) const
{
codedBase::write(os);
}
// ************************************************************************* //