mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: ConstantField: allow nonuniform. See #1046.
This commit is contained in:
@ -70,11 +70,44 @@ Foam::Field<Type> Foam::PatchFunction1Types::ConstantField<Type>::getValue
|
||||
fld.setSize(len);
|
||||
fld = pTraits<Type>(is);
|
||||
}
|
||||
else if (firstToken.wordToken() == "nonuniform")
|
||||
{
|
||||
List<Type>& list = fld;
|
||||
is >> list;
|
||||
label currentSize = fld.size();
|
||||
if (currentSize != len)
|
||||
{
|
||||
if
|
||||
(
|
||||
len < currentSize
|
||||
&& FieldBase::allowConstructFromLargerSize
|
||||
)
|
||||
{
|
||||
#ifdef FULLDEBUG
|
||||
IOWarningInFunction(dict)
|
||||
<< "Sizes do not match. "
|
||||
<< "Re-sizing " << currentSize
|
||||
<< " entries to " << len
|
||||
<< endl;
|
||||
#endif
|
||||
|
||||
// Resize the data
|
||||
fld.setSize(len);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "expected keyword 'uniform' or 'constant', found "
|
||||
<< firstToken.wordToken()
|
||||
<< "size " << fld.size()
|
||||
<< " is not equal to the given value of " << len
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "expected keyword 'uniform', 'nonuniform' or 'constant'"
|
||||
<< ", found " << firstToken.wordToken()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user