Graceful exit when a field is not found
This commit is contained in:
parent
9e7526282e
commit
af228db90a
1 changed files with 13 additions and 11 deletions
|
@ -45,8 +45,18 @@ void setFieldType
|
||||||
Istream& fieldValueStream
|
Istream& fieldValueStream
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Read field and value together; otherwise there will be an input error
|
||||||
|
// when a field is not found. HJ, 3/Aug/2011
|
||||||
word fieldName(fieldValueStream);
|
word fieldName(fieldValueStream);
|
||||||
|
|
||||||
|
typename GeoField::value_type value
|
||||||
|
(
|
||||||
|
static_cast<const typename GeoField::value_type&>
|
||||||
|
(
|
||||||
|
pTraits<typename GeoField::value_type>(fieldValueStream)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
IOobject fieldHeader
|
IOobject fieldHeader
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
|
@ -63,14 +73,6 @@ void setFieldType
|
||||||
|
|
||||||
GeoField field(fieldHeader, mesh);
|
GeoField field(fieldHeader, mesh);
|
||||||
|
|
||||||
typename GeoField::value_type value
|
|
||||||
(
|
|
||||||
static_cast<const typename GeoField::value_type&>
|
|
||||||
(
|
|
||||||
pTraits<typename GeoField::value_type>(fieldValueStream)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedCells.size() == field.size())
|
if (selectedCells.size() == field.size())
|
||||||
{
|
{
|
||||||
field.internalField() = value;
|
field.internalField() = value;
|
||||||
|
|
Reference in a new issue