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
a2762d16
Commit
a2762d16
authored
Jan 12, 2018
by
Andrew Heather
Browse files
ENH: Field - read error if insufficient values provided, but allow if more are available
parent
eedb266c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/fields/Fields/Field/Field.C
View file @
a2762d16
...
...
@@ -198,22 +198,35 @@ Foam::Field<Type>::Field
else
if
(
firstToken
.
wordToken
()
==
"nonuniform"
)
{
is
>>
static_cast
<
List
<
Type
>&>
(
*
this
);
if
(
this
->
size
()
!=
len
)
label
currentSize
=
this
->
size
();
if
(
currentSize
!=
len
)
{
FatalIOErrorInFunction
(
dict
)
<<
"size "
<<
this
->
size
()
<<
" is not equal to the given value of "
<<
len
<<
exit
(
FatalIOError
);
if
(
len
<
currentSize
&&
allowConstructFromLargerSize
)
{
#ifdef FULLDEBUG
IOWarningInFunction
(
dict
)
<<
"Sizes do not match. "
<<
"Re-sizing "
<<
currentSize
<<
" entries to "
<<
len
<<
endl
;
#endif
// Resize the data
this
->
setSize
(
len
);
}
else
{
FatalIOErrorInFunction
(
dict
)
<<
"size "
<<
this
->
size
()
<<
" is not equal to the given value of "
<<
len
<<
exit
(
FatalIOError
);
}
}
}
else
{
FatalIOErrorInFunction
(
dict
)
<<
"expected keyword 'uniform' or 'nonuniform', found "
FatalIOErrorInFunction
(
dict
)
<<
"expected keyword 'uniform' or 'nonuniform', found "
<<
firstToken
.
wordToken
()
<<
exit
(
FatalIOError
);
}
...
...
src/OpenFOAM/fields/Fields/Field/FieldBase.C
View file @
a2762d16
...
...
@@ -29,5 +29,7 @@ License
const
char
*
const
Foam
::
FieldBase
::
typeName
(
"Field"
);
bool
Foam
::
FieldBase
::
allowConstructFromLargerSize
=
false
;
// ************************************************************************* //
src/OpenFOAM/fields/Fields/Field/FieldBase.H
View file @
a2762d16
...
...
@@ -57,6 +57,8 @@ public:
//- Typename for Field
static
const
char
*
const
typeName
;
static
bool
allowConstructFromLargerSize
;
// Constructors
...
...
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