dimensionedType: Reinstated backwards-compatibility reading the name of named dimensionedTypes

This commit is contained in:
Henry Weller
2024-04-22 13:38:53 +01:00
parent 28e5556864
commit 6a3c7ab502
2 changed files with 12 additions and 8 deletions

View File

@ -67,7 +67,7 @@ bool Foam::dimensioned<Type>::readDimensions
template<class Type>
bool Foam::dimensioned<Type>::initialise
void Foam::dimensioned<Type>::initialise
(
Istream& is,
const bool haveName,
@ -75,13 +75,19 @@ bool Foam::dimensioned<Type>::initialise
)
{
token nextToken(is);
is.putBack(nextToken);
// Check if the original format is used in which the name is provided
// and reset the name to that read
if (!haveName && nextToken.isWord())
if (nextToken.isWord())
{
is >> name_;
if (!haveName)
{
name_ = nextToken.wordToken();
}
}
else
{
is.putBack(nextToken);
}
scalar multiplier = 1;
@ -102,8 +108,6 @@ bool Foam::dimensioned<Type>::initialise
}
value_ *= multiplier;
return !haveName && nextToken.isWord();
}

View File

@ -83,8 +83,8 @@ class dimensioned
const bool haveDims
);
//- Initialise from Istream. Return whether the name was read.
bool initialise(Istream& is, const bool haveName, const bool haveDims);
//- Initialise from Istream
void initialise(Istream& is, const bool haveName, const bool haveDims);
public: