mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: PatchFunction1: backwards compatibility. See #1046.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -114,7 +114,8 @@ public:
|
|||||||
static autoPtr<Function1<Type>> New
|
static autoPtr<Function1<Type>> New
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const word& redirectType = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,14 +31,20 @@ template<class Type>
|
|||||||
Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
|
Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const word& redirectType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (dict.isDict(entryName))
|
if (dict.isDict(entryName))
|
||||||
{
|
{
|
||||||
const dictionary& coeffsDict(dict.subDict(entryName));
|
const dictionary& coeffsDict(dict.subDict(entryName));
|
||||||
|
|
||||||
const word Function1Type(coeffsDict.get<word>("type"));
|
const word Function1Type
|
||||||
|
(
|
||||||
|
redirectType.empty()
|
||||||
|
? coeffsDict.get<word>("type")
|
||||||
|
: coeffsDict.lookupOrDefault<word>("type", redirectType)
|
||||||
|
);
|
||||||
|
|
||||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type);
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type);
|
||||||
|
|
||||||
@ -57,24 +63,37 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Istream& is = dict.lookup(entryName, keyType::REGEX);
|
const dictionary::const_searcher finder
|
||||||
|
(
|
||||||
|
dict.csearch(entryName, keyType::REGEX)
|
||||||
|
);
|
||||||
|
|
||||||
token firstToken(is);
|
|
||||||
word Function1Type;
|
word Function1Type;
|
||||||
|
if (finder.found())
|
||||||
if (!firstToken.isWord())
|
|
||||||
{
|
{
|
||||||
is.putBack(firstToken);
|
Istream& is = finder.ref().stream();
|
||||||
return autoPtr<Function1<Type>>
|
|
||||||
(
|
token firstToken(is);
|
||||||
new Function1Types::Constant<Type>(entryName, is)
|
|
||||||
);
|
if (!firstToken.isWord())
|
||||||
|
{
|
||||||
|
is.putBack(firstToken);
|
||||||
|
return autoPtr<Function1<Type>>
|
||||||
|
(
|
||||||
|
new Function1Types::Constant<Type>(entryName, is)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Function1Type = firstToken.wordToken();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Function1Type = firstToken.wordToken();
|
Function1Type = redirectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type);
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type);
|
||||||
|
|
||||||
if (!cstrIter.found())
|
if (!cstrIter.found())
|
||||||
|
|||||||
@ -127,6 +127,7 @@ template<class Type>
|
|||||||
Foam::PatchFunction1Types::ConstantField<Type>::ConstantField
|
Foam::PatchFunction1Types::ConstantField<Type>::ConstantField
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues
|
const bool faceValues
|
||||||
|
|||||||
@ -100,6 +100,7 @@ public:
|
|||||||
ConstantField
|
ConstantField
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues = true
|
const bool faceValues = true
|
||||||
|
|||||||
@ -33,6 +33,7 @@ template<class Type>
|
|||||||
Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
|
Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues
|
const bool faceValues
|
||||||
|
|||||||
@ -122,6 +122,7 @@ public:
|
|||||||
MappedFile
|
MappedFile
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues = true
|
const bool faceValues = true
|
||||||
|
|||||||
@ -115,11 +115,12 @@ public:
|
|||||||
dictionary,
|
dictionary,
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues
|
const bool faceValues
|
||||||
),
|
),
|
||||||
(pp, entryName, dict, faceValues)
|
(pp, type, entryName, dict, faceValues)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ Foam::autoPtr<Foam::PatchFunction1<Type>> Foam::PatchFunction1<Type>::New
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cstrIter()(pp, entryName, coeffsDict, faceValues);
|
return cstrIter()(pp, modelType, entryName, coeffsDict, faceValues);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ Foam::autoPtr<Foam::PatchFunction1<Type>> Foam::PatchFunction1<Type>::New
|
|||||||
(
|
(
|
||||||
pp,
|
pp,
|
||||||
entryName,
|
entryName,
|
||||||
value,
|
value, // Supply value
|
||||||
dict,
|
dict,
|
||||||
faceValues
|
faceValues
|
||||||
)
|
)
|
||||||
@ -92,6 +92,7 @@ Foam::autoPtr<Foam::PatchFunction1<Type>> Foam::PatchFunction1<Type>::New
|
|||||||
new PatchFunction1Types::ConstantField<Type>
|
new PatchFunction1Types::ConstantField<Type>
|
||||||
(
|
(
|
||||||
pp,
|
pp,
|
||||||
|
PatchFunction1Types::ConstantField<Type>::typeName,
|
||||||
entryName,
|
entryName,
|
||||||
dict
|
dict
|
||||||
)
|
)
|
||||||
@ -114,6 +115,7 @@ Foam::autoPtr<Foam::PatchFunction1<Type>> Foam::PatchFunction1<Type>::New
|
|||||||
return cstrIter()
|
return cstrIter()
|
||||||
(
|
(
|
||||||
pp,
|
pp,
|
||||||
|
modelType,
|
||||||
entryName,
|
entryName,
|
||||||
dict.found(entryName + "Coeffs")
|
dict.found(entryName + "Coeffs")
|
||||||
? dict.subDict(entryName + "Coeffs")
|
? dict.subDict(entryName + "Coeffs")
|
||||||
|
|||||||
@ -32,13 +32,22 @@ template<class Type>
|
|||||||
Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField
|
Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues
|
const bool faceValues
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
PatchFunction1<Type>(pp, entryName, dict, faceValues),
|
PatchFunction1<Type>(pp, entryName, dict, faceValues),
|
||||||
uniformValuePtr_(Function1<Type>::New(entryName, dict))
|
uniformValuePtr_
|
||||||
|
(
|
||||||
|
Function1<Type>::New
|
||||||
|
(
|
||||||
|
entryName,
|
||||||
|
dict,
|
||||||
|
type
|
||||||
|
)
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,19 +80,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
// //- Construct from components
|
|
||||||
// UniformValueField
|
|
||||||
// (
|
|
||||||
// const polyPatch& pp,
|
|
||||||
// const word& entryName,
|
|
||||||
// const Field<Type>& value,
|
|
||||||
// const bool faceValues = true
|
|
||||||
// );
|
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name and dictionary
|
||||||
UniformValueField
|
UniformValueField
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
const word& type,
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool faceValues = true
|
const bool faceValues = true
|
||||||
|
|||||||
Reference in New Issue
Block a user