Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
19e602b0
Commit
19e602b0
authored
Mar 16, 2017
by
Henry Weller
Browse files
dictionary: Added lookupType function for convenient lookup and setting of value
of the specified type
parent
2c31e665
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/dictionary/dictionary.H
View file @
19e602b0
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
7
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -334,7 +334,19 @@ public:
)
const
;
//- Find and return a T,
// if not found return the given default value
// if not found throw a fatal error.
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
template
<
class
T
>
T
lookupType
(
const
word
&
,
bool
recursive
=
false
,
bool
patternMatch
=
true
)
const
;
//- Find and return a T,
// if not found return the given default value.
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
template
<
class
T
>
...
...
src/OpenFOAM/db/dictionary/dictionaryTemplates.C
View file @
19e602b0
...
...
@@ -28,6 +28,30 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
T
>
T
Foam
::
dictionary
::
lookupType
(
const
word
&
keyword
,
bool
recursive
,
bool
patternMatch
)
const
{
const
entry
*
entryPtr
=
lookupEntryPtr
(
keyword
,
recursive
,
patternMatch
);
if
(
entryPtr
==
nullptr
)
{
FatalIOErrorInFunction
(
*
this
)
<<
"keyword "
<<
keyword
<<
" is undefined in dictionary "
<<
name
()
<<
exit
(
FatalIOError
);
}
return
pTraits
<
T
>
(
entryPtr
->
stream
());
}
template
<
class
T
>
T
Foam
::
dictionary
::
lookupOrDefault
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment