/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 .
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template
Foam::tmp> Foam::fvsPatchField::New
(
const word& patchFieldType,
const word& actualPatchType,
const fvPatch& p,
const DimensionedField& iF
)
{
DebugInFunction << "Constructing fvsPatchField" << endl;
auto cstrIter = patchConstructorTablePtr_->cfind(patchFieldType);
if (!cstrIter.found())
{
FatalErrorInLookup
(
"patchField",
patchFieldType,
*patchConstructorTablePtr_
) << exit(FatalError);
}
if
(
actualPatchType == word::null
|| actualPatchType != p.type()
)
{
auto patchTypeCstrIter = patchConstructorTablePtr_->cfind(p.type());
if (patchTypeCstrIter.found())
{
return patchTypeCstrIter()(p, iF);
}
}
return cstrIter()(p, iF);
}
template
Foam::tmp> Foam::fvsPatchField::New
(
const word& patchFieldType,
const fvPatch& p,
const DimensionedField& iF
)
{
return New(patchFieldType, word::null, p, iF);
}
template
Foam::tmp> Foam::fvsPatchField::New
(
const fvPatch& p,
const DimensionedField& iF,
const dictionary& dict
)
{
DebugInFunction << "Constructing fvsPatchField" << endl;
const word patchFieldType(dict.get("type"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(patchFieldType);
if (!cstrIter.found())
{
if (!disallowGenericFvsPatchField)
{
cstrIter = dictionaryConstructorTablePtr_->cfind("generic");
}
if (!cstrIter.found())
{
FatalIOErrorInFunction(dict)
<< "Unknown patchField type " << patchFieldType
<< " for patch type " << p.type() << nl << nl
<< "Valid patchField types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
}
if
(
!dict.found("patchType")
|| dict.get("patchType") != p.type()
)
{
auto patchTypeCstrIter
= dictionaryConstructorTablePtr_->cfind(p.type());
if (patchTypeCstrIter.found() && patchTypeCstrIter() != cstrIter())
{
FatalIOErrorInFunction(dict)
<< "inconsistent patch and patchField types for\n"
" patch type " << p.type()
<< " and patchField type " << patchFieldType
<< exit(FatalIOError);
}
}
return cstrIter()(p, iF, dict);
}
template
Foam::tmp> Foam::fvsPatchField::New
(
const fvsPatchField& ptf,
const fvPatch& p,
const DimensionedField& iF,
const fvPatchFieldMapper& pfMapper
)
{
DebugInFunction << "Constructing fvsPatchField" << endl;
auto cstrIter = patchMapperConstructorTablePtr_->cfind(ptf.type());
if (!cstrIter.found())
{
FatalErrorInLookup
(
"patchField",
ptf.type(),
*patchMapperConstructorTablePtr_
) << exit(FatalError);
}
auto patchTypeCstrIter = patchMapperConstructorTablePtr_->cfind(p.type());
if (patchTypeCstrIter.found())
{
return patchTypeCstrIter()(ptf, p, iF, pfMapper);
}
return cstrIter()(ptf, p, iF, pfMapper);
}
// ************************************************************************* //