mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-dictionary-checks' into develop
This commit is contained in:
@ -134,10 +134,7 @@ Foam::dictionary::dictionary
|
|||||||
if (iter().keyword().isPattern())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
patterns_.insert(&iter());
|
patterns_.insert(&iter());
|
||||||
regexps_.insert
|
regexps_.insert(autoPtr<regExp>::New(iter().keyword()));
|
||||||
(
|
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,10 +156,7 @@ Foam::dictionary::dictionary
|
|||||||
if (iter().keyword().isPattern())
|
if (iter().keyword().isPattern())
|
||||||
{
|
{
|
||||||
patterns_.insert(&iter());
|
patterns_.insert(&iter());
|
||||||
regexps_.insert
|
regexps_.insert(autoPtr<regExp>::New(iter().keyword()));
|
||||||
(
|
|
||||||
autoPtr<regExp>(new regExp(iter().keyword()))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -612,10 +606,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
if (entryPtr->keyword().isPattern())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
patterns_.insert(entryPtr);
|
patterns_.insert(entryPtr);
|
||||||
regexps_.insert
|
regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
|
||||||
(
|
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return entryPtr; // now an entry in the dictionary
|
return entryPtr; // now an entry in the dictionary
|
||||||
@ -641,10 +632,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
if (entryPtr->keyword().isPattern())
|
if (entryPtr->keyword().isPattern())
|
||||||
{
|
{
|
||||||
patterns_.insert(entryPtr);
|
patterns_.insert(entryPtr);
|
||||||
regexps_.insert
|
regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
|
||||||
(
|
|
||||||
autoPtr<regExp>(new regExp(entryPtr->keyword()))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return entryPtr; // now an entry in the dictionary
|
return entryPtr; // now an entry in the dictionary
|
||||||
|
|||||||
@ -51,7 +51,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declarations
|
||||||
class dictionaryEntry;
|
class dictionaryEntry;
|
||||||
Ostream& operator<<(Ostream& os, const dictionaryEntry& e);
|
Ostream& operator<<(Ostream& os, const dictionaryEntry& e);
|
||||||
|
|
||||||
@ -75,7 +75,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from the parent dictionary and Istream
|
//- Construct from the parent dictionary and Istream.
|
||||||
|
// The keyword is extracted from the stream
|
||||||
dictionaryEntry(const dictionary& parentDict, Istream& is);
|
dictionaryEntry(const dictionary& parentDict, Istream& is);
|
||||||
|
|
||||||
//- Construct from the keyword, parent dictionary and a Istream
|
//- Construct from the keyword, parent dictionary and a Istream
|
||||||
|
|||||||
@ -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 | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -100,13 +100,27 @@ bool Foam::dictionary::read(Istream& is, bool keepHeader)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The expected end character
|
||||||
|
int endChar = token::END_BLOCK;
|
||||||
token currToken(is);
|
token currToken(is);
|
||||||
if (currToken != token::BEGIN_BLOCK)
|
|
||||||
|
if (currToken == token::END_BLOCK)
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(is)
|
||||||
|
<< "Dictionary input cannot start with '}'"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
else if (currToken != token::BEGIN_BLOCK)
|
||||||
{
|
{
|
||||||
is.putBack(currToken);
|
is.putBack(currToken);
|
||||||
|
endChar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!is.eof() && entry::New(*this, is))
|
while
|
||||||
|
(
|
||||||
|
!is.eof()
|
||||||
|
&& entry::New(*this, is, entry::inputMode::GLOBAL, endChar)
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
if (!keepHeader)
|
if (!keepHeader)
|
||||||
|
|||||||
@ -689,10 +689,7 @@ bool Foam::dictionary::changeKeyword
|
|||||||
if (newKeyword.isPattern())
|
if (newKeyword.isPattern())
|
||||||
{
|
{
|
||||||
patterns_.insert(iter());
|
patterns_.insert(iter());
|
||||||
regexps_.insert
|
regexps_.insert(autoPtr<regExp>::New(newKeyword));
|
||||||
(
|
|
||||||
autoPtr<regExp>(new regExp(newKeyword))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -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-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -51,14 +51,13 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class ITstream;
|
class ITstream;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
|
|
||||||
class entry;
|
class entry;
|
||||||
Ostream& operator<<(Ostream& os, const entry& e);
|
Ostream& operator<<(Ostream& os, const entry& e);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class entry Declaration
|
Class entry Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -137,15 +136,36 @@ public:
|
|||||||
// Note: the parent directory is set to dictionary::null
|
// Note: the parent directory is set to dictionary::null
|
||||||
virtual autoPtr<entry> clone() const;
|
virtual autoPtr<entry> clone() const;
|
||||||
|
|
||||||
//- Construct from Istream and insert into dictionary
|
//- Construct from an Istream and insert into the dictionary
|
||||||
|
// \param parentDict dictionary to insert into
|
||||||
|
// \param is the input stream
|
||||||
|
// \param inpMode the input mode.
|
||||||
|
// The default is to use the currently active #globalInputMode
|
||||||
|
// \param endChar the expected end character (eg, a closing brace).
|
||||||
|
// The endChar is 0 if no expectations are asserted.
|
||||||
static bool New
|
static bool New
|
||||||
(
|
(
|
||||||
dictionary& parentDict,
|
dictionary& parentDict,
|
||||||
Istream& is,
|
Istream& is,
|
||||||
const inputMode inMode = inputMode::GLOBAL
|
const inputMode inpMode = inputMode::GLOBAL,
|
||||||
|
const int endChar = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct on freestore from Istream and return
|
//- Construct an entry from Istream.
|
||||||
|
// The expected input comprises a keyword followed by a
|
||||||
|
// dictionaryEntry or a primitiveEntry.
|
||||||
|
//
|
||||||
|
// - The dictionaryEntry starts with a '{' left brace and ends
|
||||||
|
// with a '}' right brace.
|
||||||
|
// - The primitiveEntry ends with a ';' semi-colon.
|
||||||
|
//
|
||||||
|
// Example input
|
||||||
|
// \verbatim
|
||||||
|
// key1 { ... } // dictionary input
|
||||||
|
// key2 ... ; // primitive input
|
||||||
|
// \endverbatim
|
||||||
|
//
|
||||||
|
// \return The #entry read, or nullptr on error.
|
||||||
static autoPtr<entry> New(Istream& is);
|
static autoPtr<entry> New(Istream& is);
|
||||||
|
|
||||||
//- Reset the #globalInputMode to %merge
|
//- Reset the #globalInputMode to %merge
|
||||||
@ -153,8 +173,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~entry()
|
virtual ~entry() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|||||||
@ -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-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 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.
|
||||||
@ -78,7 +78,7 @@ bool Foam::entry::getKeyword(keyType& keyword, Istream& is)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do some more checking
|
// Mark as invalid, but allow for some more checking
|
||||||
if (keyToken == token::END_BLOCK || is.eof())
|
if (keyToken == token::END_BLOCK || is.eof())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -89,7 +89,7 @@ bool Foam::entry::getKeyword(keyType& keyword, Istream& is)
|
|||||||
<< "--> FOAM Warning :" << nl
|
<< "--> FOAM Warning :" << nl
|
||||||
<< " From function " << FUNCTION_NAME << nl
|
<< " From function " << FUNCTION_NAME << nl
|
||||||
<< " in file " << __FILE__ << " at line " << __LINE__ << nl
|
<< " in file " << __FILE__ << " at line " << __LINE__ << nl
|
||||||
<< " Reading " << is.name().c_str() << nl
|
<< " Reading " << is.name() << nl
|
||||||
<< " found " << keyToken << nl
|
<< " found " << keyToken << nl
|
||||||
<< " expected either " << token::END_BLOCK << " or EOF"
|
<< " expected either " << token::END_BLOCK << " or EOF"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -101,24 +101,23 @@ bool Foam::entry::New
|
|||||||
(
|
(
|
||||||
dictionary& parentDict,
|
dictionary& parentDict,
|
||||||
Istream& is,
|
Istream& is,
|
||||||
const entry::inputMode inMode
|
const entry::inputMode inpMode,
|
||||||
|
const int endChar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// The inputMode for dealing with duplicate entries
|
// The inputMode for dealing with duplicate entries
|
||||||
const entry::inputMode mode =
|
const entry::inputMode mode =
|
||||||
(
|
(
|
||||||
inMode == inputMode::GLOBAL
|
inpMode == inputMode::GLOBAL
|
||||||
? globalInputMode
|
? globalInputMode
|
||||||
: inMode
|
: inpMode
|
||||||
);
|
);
|
||||||
|
|
||||||
// If somehow the global itself is 'global' - this is a severe logic error.
|
// If somehow the global itself is 'global' - this is a severe logic error.
|
||||||
if (mode == inputMode::GLOBAL)
|
if (mode == inputMode::GLOBAL)
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(is)
|
||||||
(
|
<< "Cannot use 'GLOBAL' as an inputMode"
|
||||||
is
|
|
||||||
) << "Cannot use 'GLOBAL' as an inputMode"
|
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,37 +129,63 @@ bool Foam::entry::New
|
|||||||
// Get the next keyword and if a valid keyword return true
|
// Get the next keyword and if a valid keyword return true
|
||||||
const bool valid = getKeyword(keyword, keyToken, is);
|
const bool valid = getKeyword(keyword, keyToken, is);
|
||||||
|
|
||||||
|
// Can accept a list of entries too
|
||||||
|
if
|
||||||
|
(
|
||||||
|
keyToken.isLabel()
|
||||||
|
|| (keyToken.isPunctuation() && keyToken.pToken() == token::BEGIN_LIST)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
is.putBack(keyToken);
|
||||||
|
return parentDict.add
|
||||||
|
(
|
||||||
|
new dictionaryListEntry(parentDict, is),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
|
// Error processing for invalid or unexpected input
|
||||||
|
|
||||||
// Do some more checking
|
// Do some more checking
|
||||||
if (keyToken == token::END_BLOCK || is.eof())
|
if (keyToken == token::END_BLOCK)
|
||||||
{
|
{
|
||||||
|
if (token::END_BLOCK != endChar)
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(is)
|
||||||
|
<< "Unexpected '}' while reading dictionary entry"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (is.eof())
|
||||||
|
{
|
||||||
|
if (endChar)
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(is)
|
||||||
|
<< "Unexpected EOF while reading dictionary entry"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
|
||||||
(
|
if (endChar)
|
||||||
keyToken.isLabel()
|
|
||||||
|| (keyToken.isPunctuation() && keyToken.pToken() == token::BEGIN_LIST)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
is.putBack(keyToken);
|
FatalIOErrorInFunction(is)
|
||||||
return parentDict.add
|
<< "Found " << keyToken
|
||||||
(
|
<< " but expected " << char(endChar)
|
||||||
new dictionaryListEntry(parentDict, is),
|
<< exit(FatalIOError);
|
||||||
false
|
}
|
||||||
);
|
else
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(is)
|
||||||
|
<< "Found " << keyToken
|
||||||
|
<< " but expected EOF, or perhaps a '}' char"
|
||||||
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise the token is invalid
|
|
||||||
std::cerr
|
|
||||||
<< "--> FOAM Warning :" << nl
|
|
||||||
<< " From function " << FUNCTION_NAME << nl
|
|
||||||
<< " in file " << __FILE__ << " at line " << __LINE__ << nl
|
|
||||||
<< " Reading " << is.name().c_str() << nl
|
|
||||||
<< " found " << keyToken << nl
|
|
||||||
<< " expected either " << token::END_BLOCK << " or EOF"
|
|
||||||
<< std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -264,17 +264,8 @@ Foam::primitiveEntry::primitiveEntry
|
|||||||
|
|
||||||
Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is)
|
Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is)
|
||||||
:
|
:
|
||||||
entry(key),
|
primitiveEntry(key, dictionary::null, is)
|
||||||
ITstream
|
{}
|
||||||
(
|
|
||||||
is.name() + '.' + key,
|
|
||||||
tokenList(10),
|
|
||||||
is.format(),
|
|
||||||
is.version()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
readEntry(dictionary::null, is);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -73,25 +73,30 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
Info<< "Selecting function " << functionType << endl;
|
Info<< "Selecting function " << functionType << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("functionObjectLibs"))
|
// Load any additional libraries
|
||||||
{
|
{
|
||||||
const_cast<Time&>(runTime).libs().open
|
const auto finder =
|
||||||
(
|
dict.csearchCompat("libs", {{"functionObjectLibs", 1612}});
|
||||||
dict,
|
|
||||||
"functionObjectLibs",
|
if (finder.found())
|
||||||
dictionaryConstructorTablePtr_
|
{
|
||||||
);
|
const_cast<Time&>(runTime).libs().open
|
||||||
}
|
(
|
||||||
else
|
dict,
|
||||||
{
|
finder.ref().keyword(),
|
||||||
const_cast<Time&>(runTime).libs().open
|
dictionaryConstructorTablePtr_
|
||||||
(
|
);
|
||||||
dict,
|
}
|
||||||
"libs",
|
|
||||||
dictionaryConstructorTablePtr_
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is the simplified version without compatibility messages
|
||||||
|
// const_cast<Time&>(runTime).libs().open
|
||||||
|
// (
|
||||||
|
// dict,
|
||||||
|
// "libs",
|
||||||
|
// dictionaryConstructorTablePtr_
|
||||||
|
// );
|
||||||
|
|
||||||
if (!dictionaryConstructorTablePtr_)
|
if (!dictionaryConstructorTablePtr_)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
|||||||
@ -217,12 +217,7 @@ Foam::codedFixedValuePointPatchField<Type>::codedFixedValuePointPatchField
|
|||||||
fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
|
fixedValuePointPatchField<Type>(p, iF, dict, valueRequired),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
name_
|
name_(dict.getCompat<word>("name", {{"redirectType", 1706}})),
|
||||||
(
|
|
||||||
dict.found("redirectType")
|
|
||||||
? dict.lookup("redirectType")
|
|
||||||
: dict.lookup("name")
|
|
||||||
),
|
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{
|
{
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
|
|||||||
@ -120,15 +120,7 @@ Foam::codedPoints0MotionSolver::codedPoints0MotionSolver
|
|||||||
motionSolver(mesh, dict, typeName),
|
motionSolver(mesh, dict, typeName),
|
||||||
codedBase()
|
codedBase()
|
||||||
{
|
{
|
||||||
// Backward compatibility
|
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
||||||
if (dict.found("redirectType"))
|
|
||||||
{
|
|
||||||
dict.lookup("redirectType") >> name_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dict.lookup("name") >> name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
redirectMotionSolver();
|
redirectMotionSolver();
|
||||||
|
|||||||
@ -215,12 +215,7 @@ Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
|
|||||||
fixedValueFvPatchField<Type>(p, iF, dict),
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
name_
|
name_(dict.getCompat<word>("name", {{"redirectType", 1706}})),
|
||||||
(
|
|
||||||
dict.found("redirectType")
|
|
||||||
? dict.lookup("redirectType")
|
|
||||||
: dict.lookup("name")
|
|
||||||
),
|
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{
|
{
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
|
|||||||
@ -215,12 +215,7 @@ Foam::codedMixedFvPatchField<Type>::codedMixedFvPatchField
|
|||||||
mixedFvPatchField<Type>(p, iF, dict),
|
mixedFvPatchField<Type>(p, iF, dict),
|
||||||
codedBase(),
|
codedBase(),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
name_
|
name_(dict.getCompat<word>("name", {{"redirectType", 1706}})),
|
||||||
(
|
|
||||||
dict.found("redirectType")
|
|
||||||
? dict.lookup("redirectType")
|
|
||||||
: dict.lookup("name")
|
|
||||||
),
|
|
||||||
redirectPatchFieldPtr_()
|
redirectPatchFieldPtr_()
|
||||||
{
|
{
|
||||||
updateLibrary(name_);
|
updateLibrary(name_);
|
||||||
|
|||||||
@ -191,15 +191,7 @@ bool Foam::functionObjects::codedFunctionObject::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
functionObject::read(dict);
|
functionObject::read(dict);
|
||||||
|
|
||||||
// Backward compatibility
|
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
||||||
if (dict.found("redirectType"))
|
|
||||||
{
|
|
||||||
dict.lookup("redirectType") >> name_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dict.lookup("name") >> name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const entry* dataPtr = dict.lookupEntryPtr
|
const entry* dataPtr = dict.lookupEntryPtr
|
||||||
(
|
(
|
||||||
|
|||||||
@ -119,18 +119,10 @@ bool Foam::fv::explicitPorositySource::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (cellSetOption::read(dict))
|
if (cellSetOption::read(dict))
|
||||||
{
|
{
|
||||||
if (coeffs_.found("UNames"))
|
if (!coeffs_.readIfPresent("UNames", fieldNames_))
|
||||||
{
|
{
|
||||||
coeffs_.lookup("UNames") >> fieldNames_;
|
fieldNames_.resize(1);
|
||||||
}
|
fieldNames_.first() = coeffs_.lookupOrDefault<word>("U", "U");
|
||||||
else if (coeffs_.found("U"))
|
|
||||||
{
|
|
||||||
word UName(coeffs_.lookup("U"));
|
|
||||||
fieldNames_ = wordList(1, UName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldNames_ = wordList(1, "U");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|||||||
@ -36,15 +36,7 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
|||||||
coeffs_.lookup("fields") >> fieldNames_;
|
coeffs_.lookup("fields") >> fieldNames_;
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|
||||||
// Backward compatibility
|
dict.readCompat<word>("name", {{"redirectType", 1706}}, name_);
|
||||||
if (coeffs_.found("redirectType"))
|
|
||||||
{
|
|
||||||
coeffs_.lookup("redirectType") >> name_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
coeffs_.lookup("name") >> name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Code snippets
|
// Code snippets
|
||||||
{
|
{
|
||||||
|
|||||||
@ -85,13 +85,18 @@ Foam::boxToCell::boxToCell
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
bbs_
|
bbs_()
|
||||||
(
|
{
|
||||||
dict.found("box")
|
if (dict.found("box"))
|
||||||
? treeBoundBoxList(1, treeBoundBox(dict.lookup("box")))
|
{
|
||||||
: dict.lookup("boxes")
|
bbs_.resize(1);
|
||||||
)
|
dict.read("box", bbs_.first());
|
||||||
{}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dict.read("boxes", bbs_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::boxToCell::boxToCell
|
Foam::boxToCell::boxToCell
|
||||||
|
|||||||
@ -85,13 +85,18 @@ Foam::boxToFace::boxToFace
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
bbs_
|
bbs_()
|
||||||
(
|
{
|
||||||
dict.found("box")
|
if (dict.found("box"))
|
||||||
? treeBoundBoxList(1, treeBoundBox(dict.lookup("box")))
|
{
|
||||||
: dict.lookup("boxes")
|
bbs_.resize(1);
|
||||||
)
|
dict.read("box", bbs_.first());
|
||||||
{}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dict.read("boxes", bbs_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::boxToFace::boxToFace
|
Foam::boxToFace::boxToFace
|
||||||
|
|||||||
@ -84,13 +84,18 @@ Foam::boxToPoint::boxToPoint
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
topoSetSource(mesh),
|
topoSetSource(mesh),
|
||||||
bbs_
|
bbs_()
|
||||||
(
|
{
|
||||||
dict.found("box")
|
if (dict.found("box"))
|
||||||
? treeBoundBoxList(1, treeBoundBox(dict.lookup("box")))
|
{
|
||||||
: dict.lookup("boxes")
|
bbs_.resize(1);
|
||||||
)
|
dict.read("box", bbs_.first());
|
||||||
{}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dict.read("boxes", bbs_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::boxToPoint::boxToPoint
|
Foam::boxToPoint::boxToPoint
|
||||||
|
|||||||
@ -207,18 +207,10 @@ bool Foam::fv::multiphaseMangrovesSource::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (option::read(dict))
|
if (option::read(dict))
|
||||||
{
|
{
|
||||||
if (coeffs_.found("UNames"))
|
if (!coeffs_.readIfPresent("UNames", fieldNames_))
|
||||||
{
|
{
|
||||||
coeffs_.lookup("UNames") >> fieldNames_;
|
fieldNames_.resize(1);
|
||||||
}
|
fieldNames_.first() = coeffs_.lookupOrDefault<word>("U", "U");
|
||||||
else if (coeffs_.found("U"))
|
|
||||||
{
|
|
||||||
word UName(coeffs_.lookup("U"));
|
|
||||||
fieldNames_ = wordList(1, UName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldNames_ = wordList(1, "U");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|||||||
@ -205,19 +205,19 @@ void Foam::fv::multiphaseMangrovesTurbulenceModel::addSup
|
|||||||
|
|
||||||
if (eqn.psi().name() == epsilonName_)
|
if (eqn.psi().name() == epsilonName_)
|
||||||
{
|
{
|
||||||
fvMatrix<scalar> epsilonEqn
|
fvMatrix<scalar> epsilonEqn
|
||||||
(
|
(
|
||||||
- fvm::Sp(rho*epsilonCoeff(U), eqn.psi())
|
- fvm::Sp(rho*epsilonCoeff(U), eqn.psi())
|
||||||
);
|
);
|
||||||
eqn += epsilonEqn;
|
eqn += epsilonEqn;
|
||||||
}
|
}
|
||||||
else if (eqn.psi().name() == kName_)
|
else if (eqn.psi().name() == kName_)
|
||||||
{
|
{
|
||||||
fvMatrix<scalar> kEqn
|
fvMatrix<scalar> kEqn
|
||||||
(
|
(
|
||||||
- fvm::Sp(rho*kCoeff(U), eqn.psi())
|
- fvm::Sp(rho*kCoeff(U), eqn.psi())
|
||||||
);
|
);
|
||||||
eqn += kEqn;
|
eqn += kEqn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,20 +226,19 @@ bool Foam::fv::multiphaseMangrovesTurbulenceModel::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (option::read(dict))
|
if (option::read(dict))
|
||||||
{
|
{
|
||||||
if (coeffs_.found("epsilonNames"))
|
if (!coeffs_.readIfPresent("epsilonNames", fieldNames_))
|
||||||
{
|
{
|
||||||
coeffs_.lookup("epsilonNames") >> fieldNames_;
|
if (coeffs_.found("epsilon"))
|
||||||
}
|
{
|
||||||
else if (coeffs_.found("epsilon"))
|
fieldNames_.resize(1);
|
||||||
{
|
coeffs_.read("epsilon", fieldNames_.first());
|
||||||
word UName(coeffs_.lookup("epsilon"));
|
}
|
||||||
fieldNames_ = wordList(1, UName);
|
else
|
||||||
}
|
{
|
||||||
else
|
fieldNames_.resize(2);
|
||||||
{
|
fieldNames_[0] = "epsilon";
|
||||||
fieldNames_.setSize(2);
|
fieldNames_[1] = "k";
|
||||||
fieldNames_[0] = "epsilon";
|
}
|
||||||
fieldNames_[1] = "k";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_.setSize(fieldNames_.size(), false);
|
applied_.setSize(fieldNames_.size(), false);
|
||||||
|
|||||||
7
tutorials/IO/dictionary/Allrun
Executable file
7
tutorials/IO/dictionary/Allrun
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
|
||||||
|
runApplication ./TestParsing "$@"
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
111
tutorials/IO/dictionary/TestParsing
Executable file
111
tutorials/IO/dictionary/TestParsing
Executable file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
|
||||||
|
echo "dictionary input tests"
|
||||||
|
|
||||||
|
verbose=true
|
||||||
|
npass=0
|
||||||
|
nwarn=0
|
||||||
|
nfail=0
|
||||||
|
|
||||||
|
foamDictionary -help > /dev/null 2>&1 || {
|
||||||
|
echo "Error: non-functional foamDictionary"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Reduced verbosity in test mode?
|
||||||
|
if isTest "$@"
|
||||||
|
then
|
||||||
|
verbose=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
for dict in \
|
||||||
|
good*.dict \
|
||||||
|
warn*.dict \
|
||||||
|
fatal*.dict \
|
||||||
|
;
|
||||||
|
do
|
||||||
|
[ -f "$dict" ] || continue # protect against bad globs
|
||||||
|
|
||||||
|
# capture stderr, ignore stdout
|
||||||
|
stderr=$(foamDictionary -keywords $dict 2>&1 >/dev/null)
|
||||||
|
exitCode=$?
|
||||||
|
|
||||||
|
case "$dict" in
|
||||||
|
*fatal*)
|
||||||
|
if [ $exitCode -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "NOK did not detect fatal input $dict"
|
||||||
|
nfail=$(($fail + 1))
|
||||||
|
else
|
||||||
|
echo "OK detected fatal input $dict"
|
||||||
|
npass=$(($npass + 1))
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*good*)
|
||||||
|
if [ $exitCode -eq 0 ]
|
||||||
|
then
|
||||||
|
npass=$(($npass + 1))
|
||||||
|
if [ "${#stderr}" -gt 0 ]
|
||||||
|
then
|
||||||
|
# count unexpected warnings
|
||||||
|
nwarn=$(($nwarn + 1))
|
||||||
|
echo "NOK unexpected warnings: $dict"
|
||||||
|
else
|
||||||
|
echo "OK good input $dict"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "NOK failed input $dict"
|
||||||
|
nfail=$(($fail + 1))
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*warn*)
|
||||||
|
if [ $exitCode -eq 0 ]
|
||||||
|
then
|
||||||
|
npass=$(($npass + 1))
|
||||||
|
if [ "${#stderr}" -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "OK trapped warnings: $dict"
|
||||||
|
else
|
||||||
|
# count missing warnings
|
||||||
|
nwarn=$(($nwarn + 1))
|
||||||
|
echo "NOK missing expected warnings: $dict"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
nfail=$(($fail + 1))
|
||||||
|
echo "NOK failed (not warn) input $dict"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$verbose" = true ] && [ "${#stderr}" -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "================" 1>&2
|
||||||
|
echo "dictionary = $dict" 1>&2
|
||||||
|
echo "$stderr" 1>&2
|
||||||
|
echo "================" 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$npass passed"
|
||||||
|
echo "$nwarn warnings"
|
||||||
|
echo "$nfail failed"
|
||||||
|
|
||||||
|
if test $nfail -eq 0
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo End
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
20
tutorials/IO/dictionary/fatal-ending1.dict
Normal file
20
tutorials/IO/dictionary/fatal-ending1.dict
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
} // A stray '}' before any real entries
|
||||||
|
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
20
tutorials/IO/dictionary/fatal-ending2.dict
Normal file
20
tutorials/IO/dictionary/fatal-ending2.dict
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // oops extra stray '}'
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
21
tutorials/IO/dictionary/fatal-ending3.dict
Normal file
21
tutorials/IO/dictionary/fatal-ending3.dict
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
23
tutorials/IO/dictionary/fatal-ending4.dict
Normal file
23
tutorials/IO/dictionary/fatal-ending4.dict
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict
|
||||||
|
{
|
||||||
|
{ key val; } // A stray '{}' pair after the first entries
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
25
tutorials/IO/dictionary/fatal-premature-ending1.dict
Normal file
25
tutorials/IO/dictionary/fatal-premature-ending1.dict
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict
|
||||||
|
{
|
||||||
|
key1 value1;
|
||||||
|
key2 value2;
|
||||||
|
|
||||||
|
// oops no trailing '}'
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
34
tutorials/IO/dictionary/fatal-premature-ending2.dict
Normal file
34
tutorials/IO/dictionary/fatal-premature-ending2.dict
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict1
|
||||||
|
{
|
||||||
|
key1 value1;
|
||||||
|
key2 value2;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // oops extra stray '}'
|
||||||
|
|
||||||
|
|
||||||
|
dict2
|
||||||
|
{
|
||||||
|
key1 value1;
|
||||||
|
key2 value2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
23
tutorials/IO/dictionary/fatal-primitive-ending1.dict
Normal file
23
tutorials/IO/dictionary/fatal-primitive-ending1.dict
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict
|
||||||
|
{
|
||||||
|
key missing ending
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
24
tutorials/IO/dictionary/fatal-primitive-ending2.dict
Normal file
24
tutorials/IO/dictionary/fatal-primitive-ending2.dict
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict
|
||||||
|
{
|
||||||
|
key missing ending
|
||||||
|
|
||||||
|
// no closing } either
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
20
tutorials/IO/dictionary/fatal-primitive-ending3.dict
Normal file
20
tutorials/IO/dictionary/fatal-primitive-ending3.dict
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
key missing ending
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
1
tutorials/IO/dictionary/good-empty1.dict
Normal file
1
tutorials/IO/dictionary/good-empty1.dict
Normal file
@ -0,0 +1 @@
|
|||||||
|
// A dictionary file that exists, but without any tokens
|
||||||
20
tutorials/IO/dictionary/good-empty2.dict
Normal file
20
tutorials/IO/dictionary/good-empty2.dict
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// A dictionary file without any tokens except the header
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
32
tutorials/IO/dictionary/good-ending1.dict
Normal file
32
tutorials/IO/dictionary/good-ending1.dict
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict1
|
||||||
|
{
|
||||||
|
key1 value1;
|
||||||
|
key2 value2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dict2
|
||||||
|
{
|
||||||
|
key1 value1;
|
||||||
|
key2 value2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
23
tutorials/IO/dictionary/good-primitive-ending1.dict
Normal file
23
tutorials/IO/dictionary/good-primitive-ending1.dict
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dict
|
||||||
|
{
|
||||||
|
key with ending;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
20
tutorials/IO/dictionary/missed-ending3.dict
Normal file
20
tutorials/IO/dictionary/missed-ending3.dict
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
{} // A stray '{}' pair before any real entries
|
||||||
|
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dictionary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -49,13 +49,9 @@ functions
|
|||||||
{
|
{
|
||||||
error
|
error
|
||||||
{
|
{
|
||||||
// Load the library containing the 'coded' functionObject
|
name error;
|
||||||
libs ("libutilityFunctionObjects.so");
|
type coded;
|
||||||
|
libs ("libutilityFunctionObjects.so");
|
||||||
type coded;
|
|
||||||
|
|
||||||
// Name of on-the-fly generated functionObject
|
|
||||||
name error;
|
|
||||||
|
|
||||||
codeEnd
|
codeEnd
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -23,13 +23,13 @@ boundaryField
|
|||||||
{
|
{
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value $internalField;
|
value $internalField;
|
||||||
}
|
}
|
||||||
cylinder
|
cylinder
|
||||||
{
|
{
|
||||||
type codedFixedValue;
|
name pointDisplacementy_cylinder;
|
||||||
name pointDisplacementy_cylinder;
|
type codedFixedValue;
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
const scalar t = this->db().time().value();
|
const scalar t = this->db().time().value();
|
||||||
@ -37,21 +37,21 @@ boundaryField
|
|||||||
const scalar f = 200;
|
const scalar f = 200;
|
||||||
operator==(a*sin(constant::mathematical::twoPi*f*t));
|
operator==(a*sin(constant::mathematical::twoPi*f*t));
|
||||||
#};
|
#};
|
||||||
value $internalField;
|
value $internalField;
|
||||||
}
|
}
|
||||||
"inlet.*"
|
"inlet.*"
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value $internalField;
|
value $internalField;
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
value $internalField;
|
value $internalField;
|
||||||
}
|
}
|
||||||
frontAndBack
|
frontAndBack
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,9 +55,9 @@ functions
|
|||||||
{
|
{
|
||||||
timeStep
|
timeStep
|
||||||
{
|
{
|
||||||
type coded;
|
name setDeltaT;
|
||||||
libs ("libutilityFunctionObjects.so");
|
type coded;
|
||||||
name setDeltaT;
|
libs ("libutilityFunctionObjects.so");
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -19,10 +19,10 @@ functions
|
|||||||
{
|
{
|
||||||
createVortex
|
createVortex
|
||||||
{
|
{
|
||||||
type coded;
|
name createVortices;
|
||||||
libs ("libutilityFunctionObjects.so");
|
type coded;
|
||||||
name createVortices;
|
libs ("libutilityFunctionObjects.so");
|
||||||
enabled yes;
|
enabled yes;
|
||||||
|
|
||||||
codeInclude
|
codeInclude
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -24,8 +24,8 @@ boundaryField
|
|||||||
|
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type codedFixedValue;
|
|
||||||
name swirl;
|
name swirl;
|
||||||
|
type codedFixedValue;
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
inletMassFlowRate
|
inletMassFlowRate
|
||||||
{
|
{
|
||||||
type surfaceFieldValue;
|
type surfaceFieldValue;
|
||||||
libs ("libfieldFunctionObjects.so");
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
@ -31,8 +31,8 @@ inletMassFlowRate
|
|||||||
|
|
||||||
outletMassFlowRate
|
outletMassFlowRate
|
||||||
{
|
{
|
||||||
type surfaceFieldValue;
|
type surfaceFieldValue;
|
||||||
libs ("libfieldFunctionObjects.so");
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
|
||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
@ -54,9 +54,9 @@ outletMassFlowRate
|
|||||||
|
|
||||||
totalMass
|
totalMass
|
||||||
{
|
{
|
||||||
type coded;
|
|
||||||
libs ("libutilityFunctionObjects.so");
|
|
||||||
name error;
|
name error;
|
||||||
|
type coded;
|
||||||
|
libs ("libutilityFunctionObjects.so");
|
||||||
|
|
||||||
code
|
code
|
||||||
#{
|
#{
|
||||||
|
|||||||
Reference in New Issue
Block a user