ENH: improvements for token methods
- direct check of punctuation.
For example,
while (!tok.isPunctuation(token::BEGIN_LIST)) ..
instead of
while (!(tok.isPunctuation() && tok.pToken() == token::BEGIN_LIST)) ..
Using direct comparison (tok != token::BEGIN_LIST) can be fragile
when comparing int values:
int c = readChar(is);
while (tok != c) .. // Danger, uses LABEL comparison!
- direct check of word.
For example,
if (tok.isWord("uniform")) ..
instead of
if (tok.isWord() && tok.wordToken() == "uniform") ..
- make token lineNumber() a setter method
ENH: adjust internal compound method empty() -> moved()
- support named compound tokens
STYLE: setter method for stream indentation
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -214,7 +214,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
OListStream os2;
|
||||
os2.indentSize() = 0;
|
||||
os2.indentSize(0);
|
||||
|
||||
outputDict(os2);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -134,7 +134,7 @@ Foam::cv2DControls::cv2DControls
|
||||
|
||||
void Foam::cv2DControls::write(Ostream& os) const
|
||||
{
|
||||
os.indentLevel() = 1;
|
||||
const auto oldLevel = os.indentLevel(1);
|
||||
os.precision(2);
|
||||
os.flags(ios_base::scientific);
|
||||
|
||||
@ -148,6 +148,8 @@ void Foam::cv2DControls::write(Ostream& os) const
|
||||
<< indent << "ppDist_ : " << ppDist_ << nl
|
||||
<< indent << "minEdgeLen2_ : " << minEdgeLen2_ << nl
|
||||
<< token::END_BLOCK << endl;
|
||||
|
||||
os.indentLevel(oldLevel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -96,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fieldName.isWord() || fieldName.wordToken() != "CELL")
|
||||
if (!fieldName.isWord("CELL"))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Expected first CELL, found "
|
||||
|
||||
@ -139,59 +139,39 @@ Foam::Istream& Foam::PackedList<Width>::read(Istream& is)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (firstTok.isPunctuation())
|
||||
else if (firstTok.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstTok.pToken() == token::BEGIN_LIST)
|
||||
token nextTok(is);
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while (!nextTok.isPunctuation(token::END_LIST))
|
||||
{
|
||||
token nextTok(is);
|
||||
is.putBack(nextTok);
|
||||
list.append(list.readValue(is));
|
||||
|
||||
is >> nextTok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while
|
||||
(
|
||||
!( nextTok.isPunctuation()
|
||||
&& nextTok.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
{
|
||||
is.putBack(nextTok);
|
||||
list.append(list.readValue(is));
|
||||
|
||||
is >> nextTok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
}
|
||||
}
|
||||
else if (firstTok.pToken() == token::BEGIN_BLOCK)
|
||||
}
|
||||
else if (firstTok.isPunctuation(token::BEGIN_BLOCK))
|
||||
{
|
||||
token nextTok(is);
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while (!nextTok.isPunctuation(token::END_BLOCK))
|
||||
{
|
||||
token nextTok(is);
|
||||
is.putBack(nextTok);
|
||||
list.setPair(is);
|
||||
|
||||
is >> nextTok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while
|
||||
(
|
||||
!( nextTok.isPunctuation()
|
||||
&& nextTok.pToken() == token::END_BLOCK
|
||||
)
|
||||
)
|
||||
{
|
||||
is.putBack(nextTok);
|
||||
list.setPair(is);
|
||||
|
||||
is >> nextTok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected '(', found "
|
||||
<< firstTok.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int>, '(' or '{', found "
|
||||
<< firstTok.info()
|
||||
<< firstTok.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -92,23 +92,10 @@ void Foam::HashPtrTable<T, Key, Hash>::readIstream
|
||||
// Read end of contents
|
||||
is.readEndList("HashPtrTable");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
Key key;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -203,23 +203,10 @@ Foam::Istream& Foam::operator>>
|
||||
// Read end of contents
|
||||
is.readEndList("HashTable");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,25 +90,12 @@ void Foam::ILList<LListBase, T>::readIstream(Istream& is, const INew& inew)
|
||||
// Read end of contents
|
||||
is.readEndList("ILList");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -86,25 +86,12 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& lst)
|
||||
// Read end of contents
|
||||
is.readEndList("LList");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -91,25 +91,12 @@ void Foam::LPtrList<LListBase, T>::readIstream(Istream& is, const INew& inew)
|
||||
// Read end of contents
|
||||
is.readEndList("LPtrList");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
this->append(inew(is).ptr());
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,9 +55,10 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& list)
|
||||
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
// Compound: simply transfer contents
|
||||
if (firstToken.isCompound())
|
||||
{
|
||||
// Compound: simply transfer contents
|
||||
|
||||
list.transfer
|
||||
(
|
||||
dynamicCast<token::Compound<List<T>>>
|
||||
@ -65,14 +66,11 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& list)
|
||||
firstToken.transferCompoundToken(is)
|
||||
)
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// Label: could be int(..), int{...} or just a plain '0'
|
||||
if (firstToken.isLabel())
|
||||
else if (firstToken.isLabel())
|
||||
{
|
||||
// Label: could be int(..), int{...} or just a plain '0'
|
||||
|
||||
const label len = firstToken.labelToken();
|
||||
|
||||
// Resize to length read
|
||||
@ -140,37 +138,24 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& list)
|
||||
"reading the binary block"
|
||||
);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// "(...)" : read as SLList and transfer contents
|
||||
if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
// "(...)" : read as SLList and transfer contents
|
||||
|
||||
is.putBack(firstToken); // Putback the opening bracket
|
||||
|
||||
SLList<T> sll(is); // Read as singly-linked list
|
||||
|
||||
// Reallocate and move assign list elements
|
||||
list = std::move(sll);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -170,9 +170,10 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& list)
|
||||
|
||||
is.fatalCheck("operator>>(Istream&, UList<T>&) : reading first token");
|
||||
|
||||
// Compound: simply transfer contents
|
||||
if (firstToken.isCompound())
|
||||
{
|
||||
// Compound: simply transfer contents
|
||||
|
||||
List<T> elems;
|
||||
elems.transfer
|
||||
(
|
||||
@ -197,14 +198,11 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& list)
|
||||
{
|
||||
list[i] = std::move(elems[i]);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// Label: could be int(..), int{...} or just a plain '0'
|
||||
if (firstToken.isLabel())
|
||||
else if (firstToken.isLabel())
|
||||
{
|
||||
// Label: could be int(..), int{...} or just a plain '0'
|
||||
|
||||
const label inputLen = firstToken.labelToken();
|
||||
|
||||
// List lengths must match
|
||||
@ -276,24 +274,12 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& list)
|
||||
"operator>>(Istream&, UList<T>&) : reading the binary block"
|
||||
);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// "(...)" : read as SLList and transfer contents
|
||||
if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
// "(...)" : read as SLList and transfer contents
|
||||
|
||||
is.putBack(firstToken); // Putback the opening bracket
|
||||
|
||||
SLList<T> sll(is); // Read as singly-linked list
|
||||
|
||||
// List lengths must match
|
||||
@ -310,15 +296,14 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& list)
|
||||
{
|
||||
list[i] = std::move(sll.removeHead());
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,10 +49,10 @@ void Foam::PtrList<T>::readIstream(Istream& is, const INew& inew)
|
||||
"reading first token"
|
||||
);
|
||||
|
||||
|
||||
// Label: could be int(..), int{...} or just a plain '0'
|
||||
if (firstToken.isLabel())
|
||||
{
|
||||
// Label: could be int(..), int{...} or just a plain '0'
|
||||
|
||||
// Read size of list
|
||||
const label len = firstToken.labelToken();
|
||||
|
||||
@ -98,33 +98,17 @@ void Foam::PtrList<T>::readIstream(Istream& is, const INew& inew)
|
||||
|
||||
// Read end of contents
|
||||
is.readEndList("PtrList");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// "(...)" : read as SLList and transfer contents
|
||||
// This would be more efficient (fewer allocations, lower overhead)
|
||||
// using a DynamicList, but then we have circular dependencies
|
||||
if (firstToken.isPunctuation())
|
||||
else if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found " << firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
// "(...)" : read as SLList and transfer contents
|
||||
// This would be more efficient (fewer allocations, lower overhead)
|
||||
// using a DynamicList, but then we have circular dependencies
|
||||
|
||||
SLList<T*> slList;
|
||||
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
|
||||
@ -147,14 +131,14 @@ void Foam::PtrList<T>::readIstream(Istream& is, const INew& inew)
|
||||
{
|
||||
set(i++, ptr);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,12 +62,7 @@ bool Foam::IOobject::readHeader(Istream& is)
|
||||
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
is.good()
|
||||
&& firstToken.isWord()
|
||||
&& firstToken.wordToken() == "FoamFile"
|
||||
)
|
||||
if (is.good() && firstToken.isWord("FoamFile"))
|
||||
{
|
||||
const dictionary headerDict(is);
|
||||
|
||||
|
||||
@ -1084,12 +1084,7 @@ Foam::label Foam::decomposedBlockData::numBlocks(const fileName& fName)
|
||||
// FoamFile header
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
is.good()
|
||||
&& firstToken.isWord()
|
||||
&& firstToken.wordToken() == "FoamFile"
|
||||
)
|
||||
if (is.good() && firstToken.isWord("FoamFile"))
|
||||
{
|
||||
dictionary headerDict(is);
|
||||
is.version(headerDict.get<token>("version"));
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -171,32 +171,36 @@ public:
|
||||
//- Add indentation characters
|
||||
virtual void indent() = 0;
|
||||
|
||||
//- Return indent level
|
||||
unsigned short indentSize() const
|
||||
//- Return indent size (spaces per level)
|
||||
unsigned short indentSize() const noexcept
|
||||
{
|
||||
return indentSize_;
|
||||
}
|
||||
|
||||
//- Access to indent size
|
||||
unsigned short& indentSize()
|
||||
//- Change indent size (spaces per level), return old value
|
||||
unsigned short indentSize(unsigned short val) noexcept
|
||||
{
|
||||
return indentSize_;
|
||||
auto old(indentSize_);
|
||||
indentSize_ = val;
|
||||
return old;
|
||||
}
|
||||
|
||||
//- Return indent level
|
||||
unsigned short indentLevel() const
|
||||
//- Return the indent level
|
||||
unsigned short indentLevel() const noexcept
|
||||
{
|
||||
return indentLevel_;
|
||||
}
|
||||
|
||||
//- Access to indent level
|
||||
unsigned short& indentLevel()
|
||||
//- Change the indent level, return old value
|
||||
unsigned short indentLevel(unsigned short val) noexcept
|
||||
{
|
||||
return indentLevel_;
|
||||
auto old(indentLevel_);
|
||||
indentLevel_ = val;
|
||||
return old;
|
||||
}
|
||||
|
||||
//- Increment the indent level
|
||||
void incrIndent()
|
||||
void incrIndent() noexcept
|
||||
{
|
||||
++indentLevel_;
|
||||
}
|
||||
@ -293,6 +297,21 @@ public:
|
||||
{
|
||||
return const_cast<Ostream&>(*this);
|
||||
}
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Access to indent level
|
||||
unsigned short& indentLevel() noexcept
|
||||
{
|
||||
return indentLevel_;
|
||||
}
|
||||
|
||||
//- Access to indent size
|
||||
unsigned short& indentSize() noexcept
|
||||
{
|
||||
return indentSize_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -202,7 +202,7 @@ Foam::Istream& Foam::UIPstream::read(token& t)
|
||||
|
||||
|
||||
// Set the line number of this token to the current stream line number
|
||||
t.lineNumber() = lineNumber();
|
||||
t.lineNumber(this->lineNumber());
|
||||
|
||||
// Analyse input starting with this character.
|
||||
switch (c)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -175,7 +175,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
|
||||
char c = nextValid();
|
||||
|
||||
// Set the line number of this token to the current stream line number
|
||||
t.lineNumber() = lineNumber();
|
||||
t.lineNumber(this->lineNumber());
|
||||
|
||||
// Return on error
|
||||
if (!c)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -285,11 +285,11 @@ Foam::Istream& Foam::ITstream::read(token& tok)
|
||||
|
||||
if (size())
|
||||
{
|
||||
tok.lineNumber() = tokenList::last().lineNumber();
|
||||
tok.lineNumber(tokenList::last().lineNumber());
|
||||
}
|
||||
else
|
||||
{
|
||||
tok.lineNumber() = lineNumber();
|
||||
tok.lineNumber(this->lineNumber());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -94,7 +94,7 @@ Foam::token::compound& Foam::token::transferCompoundToken()
|
||||
parseError("compound");
|
||||
}
|
||||
|
||||
if (data_.compoundPtr->empty())
|
||||
if (data_.compoundPtr->moved())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "compound has already been transferred from token\n "
|
||||
@ -102,7 +102,7 @@ Foam::token::compound& Foam::token::transferCompoundToken()
|
||||
}
|
||||
else
|
||||
{
|
||||
data_.compoundPtr->empty() = true;
|
||||
data_.compoundPtr->moved(true);
|
||||
}
|
||||
|
||||
return *data_.compoundPtr;
|
||||
@ -116,7 +116,7 @@ Foam::token::compound& Foam::token::transferCompoundToken(const Istream& is)
|
||||
parseError("compound");
|
||||
}
|
||||
|
||||
if (data_.compoundPtr->empty())
|
||||
if (data_.compoundPtr->moved())
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "compound has already been transferred from token\n "
|
||||
@ -124,7 +124,7 @@ Foam::token::compound& Foam::token::transferCompoundToken(const Istream& is)
|
||||
}
|
||||
else
|
||||
{
|
||||
data_.compoundPtr->empty() = true;
|
||||
data_.compoundPtr->moved(true);
|
||||
}
|
||||
|
||||
return *data_.compoundPtr;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -115,22 +115,17 @@ public:
|
||||
enum punctuationToken : char
|
||||
{
|
||||
NULL_TOKEN = '\0', //!< Nul character
|
||||
SPACE = ' ', //!< Space [isspace]
|
||||
TAB = '\t', //!< Tab [isspace]
|
||||
NL = '\n', //!< Newline [isspace]
|
||||
SPACE = ' ', //!< Space [isspace]
|
||||
|
||||
END_STATEMENT = ';', //!< End entry [#isseparator]
|
||||
BEGIN_LIST = '(', //!< Begin list [#isseparator]
|
||||
END_LIST = ')', //!< End list [#isseparator]
|
||||
BEGIN_SQR = '[', //!< Begin dimensions [#isseparator]
|
||||
END_SQR = ']', //!< End dimensions [#isseparator]
|
||||
BEGIN_BLOCK = '{', //!< Begin block [#isseparator]
|
||||
END_BLOCK = '}', //!< End block [#isseparator]
|
||||
COLON = ':', //!< Colon [#isseparator]
|
||||
SEMICOLON = ';', //!< Semicolon [#isseparator]
|
||||
COMMA = ',', //!< Comma [#isseparator]
|
||||
HASH = '#', //!< Hash - directive or verbatim string
|
||||
DOLLAR = '$', //!< Dollar - start variable
|
||||
ATSYM = '@', //!< At
|
||||
QUESTION = '?', //!< Question mark (eg, ternary)
|
||||
ATSYM = '@', //!< The 'at' symbol
|
||||
SQUOTE = '\'', //!< Single quote
|
||||
DQUOTE = '"', //!< Double quote
|
||||
|
||||
@ -140,8 +135,25 @@ public:
|
||||
MULTIPLY = '*', //!< Multiply [#isseparator]
|
||||
DIVIDE = '/', //!< Divide [#isseparator]
|
||||
|
||||
BEGIN_STRING = DQUOTE, //!< Begin string with double quote
|
||||
END_STRING = DQUOTE //!< End string with double quote
|
||||
LPAREN = '(', //!< Left parenthesis [#isseparator]
|
||||
RPAREN = ')', //!< Right parenthesis [#isseparator]
|
||||
LSQUARE = '[', //!< Left square bracket [#isseparator]
|
||||
RSQUARE = ']', //!< Right square bracket [#isseparator]
|
||||
LBRACE = '{', //!< Left brace [#isseparator]
|
||||
RBRACE = '}', //!< Right brace [#isseparator]
|
||||
|
||||
// With semantically meaning
|
||||
|
||||
END_STATEMENT = SEMICOLON, //!< End entry [#isseparator]
|
||||
BEGIN_LIST = LPAREN, //!< Begin list [#isseparator]
|
||||
END_LIST = RPAREN, //!< End list [#isseparator]
|
||||
BEGIN_SQR = LSQUARE, //!< Begin dimensions [#isseparator]
|
||||
END_SQR = RSQUARE, //!< End dimensions [#isseparator]
|
||||
BEGIN_BLOCK = LBRACE, //!< Begin block [#isseparator]
|
||||
END_BLOCK = RBRACE, //!< End block [#isseparator]
|
||||
|
||||
BEGIN_STRING = DQUOTE, //!< Begin string with double quote
|
||||
END_STRING = DQUOTE //!< End string with double quote
|
||||
};
|
||||
|
||||
|
||||
@ -150,7 +162,8 @@ public:
|
||||
:
|
||||
public refCount
|
||||
{
|
||||
bool empty_;
|
||||
//- Has compound token already been transferred
|
||||
bool moved_;
|
||||
|
||||
//- No copy construct
|
||||
compound(const compound&) = delete;
|
||||
@ -179,7 +192,7 @@ public:
|
||||
//- Default construct
|
||||
constexpr compound() noexcept
|
||||
:
|
||||
empty_(false)
|
||||
moved_(false)
|
||||
{}
|
||||
|
||||
//- Construct compound from Istream
|
||||
@ -195,16 +208,16 @@ public:
|
||||
//- Test if name is a known (registered) compound type
|
||||
static bool isCompound(const word& name);
|
||||
|
||||
//- Has compound been transferred?
|
||||
bool empty() const noexcept
|
||||
//- Get compound transferred status
|
||||
bool moved() const noexcept
|
||||
{
|
||||
return empty_;
|
||||
return moved_;
|
||||
}
|
||||
|
||||
//- Access to empty
|
||||
bool& empty() noexcept
|
||||
//- Set compound transferred status
|
||||
void moved(bool b) noexcept
|
||||
{
|
||||
return empty_;
|
||||
moved_ = b;
|
||||
}
|
||||
|
||||
//- The size of the underlying content
|
||||
@ -256,9 +269,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Using empty from compound refCount
|
||||
using token::compound::empty;
|
||||
|
||||
//- The size of the underlying content
|
||||
virtual label size() const
|
||||
{
|
||||
@ -416,8 +426,8 @@ public:
|
||||
//- The line number for the token
|
||||
inline label lineNumber() const noexcept;
|
||||
|
||||
//- The line number for the token
|
||||
inline label& lineNumber() noexcept;
|
||||
//- Change token line number, return old value
|
||||
inline label lineNumber(const label lineNum) noexcept;
|
||||
|
||||
//- True if token is not UNDEFINED or ERROR
|
||||
inline bool good() const noexcept;
|
||||
@ -437,6 +447,9 @@ public:
|
||||
//- Token is PUNCTUATION
|
||||
inline bool isPunctuation() const noexcept;
|
||||
|
||||
//- True if token is PUNCTUATION and equal to parameter
|
||||
inline bool isPunctuation(const punctuationToken p) const noexcept;
|
||||
|
||||
//- Token is PUNCTUATION and isseparator
|
||||
inline bool isSeparator() const noexcept;
|
||||
|
||||
@ -458,6 +471,9 @@ public:
|
||||
//- Token is WORD or DIRECTIVE word
|
||||
inline bool isWord() const noexcept;
|
||||
|
||||
//- Token is WORD or DIRECTIVE word and equal to parameter
|
||||
inline bool isWord(const std::string& s) const;
|
||||
|
||||
//- Token is DIRECTIVE (word variant)
|
||||
inline bool isDirective() const noexcept;
|
||||
|
||||
@ -599,20 +615,20 @@ public:
|
||||
// Equality
|
||||
|
||||
inline bool operator==(const token& tok) const;
|
||||
inline bool operator==(const punctuationToken p) const;
|
||||
inline bool operator==(const label val) const;
|
||||
inline bool operator==(const floatScalar val) const;
|
||||
inline bool operator==(const doubleScalar val) const;
|
||||
inline bool operator==(const punctuationToken p) const noexcept;
|
||||
inline bool operator==(const label val) const noexcept;
|
||||
inline bool operator==(const floatScalar val) const noexcept;
|
||||
inline bool operator==(const doubleScalar val) const noexcept;
|
||||
inline bool operator==(const std::string& s) const;
|
||||
|
||||
|
||||
// Inequality
|
||||
|
||||
inline bool operator!=(const token& tok) const;
|
||||
inline bool operator!=(const punctuationToken p) const;
|
||||
inline bool operator!=(const label val) const;
|
||||
inline bool operator!=(const floatScalar val) const;
|
||||
inline bool operator!=(const doubleScalar val) const;
|
||||
inline bool operator!=(const punctuationToken p) const noexcept;
|
||||
inline bool operator!=(const label val) const noexcept;
|
||||
inline bool operator!=(const floatScalar val) const noexcept;
|
||||
inline bool operator!=(const doubleScalar val) const noexcept;
|
||||
inline bool operator!=(const std::string& s) const;
|
||||
|
||||
|
||||
@ -628,6 +644,10 @@ public:
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Write access for the token line number
|
||||
// \deprecated(2021-03) - use lineNumber(label)
|
||||
label& lineNumber() noexcept { return line_; }
|
||||
|
||||
//- Token is FLOAT
|
||||
// \deprecated(2020-01) - isFloat()
|
||||
bool isFloatScalar() const { return isFloat(); };
|
||||
@ -670,12 +690,23 @@ Ostream& operator<<(Ostream& os, const InfoProxy<token>& ip);
|
||||
|
||||
// Handling of compound types
|
||||
|
||||
#define defineCompoundTypeName(Type, Name) \
|
||||
//- Define compound using \a Type for its name
|
||||
#define defineCompoundTypeName(Type, UnusedTag) \
|
||||
defineTemplateTypeNameAndDebugWithName(token::Compound<Type>, #Type, 0);
|
||||
|
||||
#define addCompoundToRunTimeSelectionTable(Type, Name) \
|
||||
//- Define compound using \a Name for its name
|
||||
#define defineNamedCompoundTypeName(Type, Name) \
|
||||
defineTemplateTypeNameAndDebugWithName(token::Compound<Type>, #Name, 0);
|
||||
|
||||
//- Add compound to selection table, lookup using typeName
|
||||
#define addCompoundToRunTimeSelectionTable(Type, Tag) \
|
||||
token::compound::addIstreamConstructorToTable<token::Compound<Type>> \
|
||||
add##Name##IstreamConstructorToTable_;
|
||||
add##Tag##IstreamConstructorToTable_;
|
||||
|
||||
//- Add compound to selection table, lookup as \a Name
|
||||
#define addNamedCompoundToRunTimeSelectionTable(Type, Tag, Name) \
|
||||
token::compound::addIstreamConstructorToTable<token::Compound<Type>> \
|
||||
add##Tag##IstreamConstructorToTable_(#Name);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -390,9 +390,11 @@ inline Foam::label Foam::token::lineNumber() const noexcept
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label& Foam::token::lineNumber() noexcept
|
||||
inline Foam::label Foam::token::lineNumber(const label lineNum) noexcept
|
||||
{
|
||||
return line_;
|
||||
label old(line_);
|
||||
line_ = lineNum;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
@ -456,15 +458,13 @@ inline bool Foam::token::isPunctuation() const noexcept
|
||||
}
|
||||
|
||||
|
||||
inline Foam::token::punctuationToken Foam::token::pToken() const
|
||||
inline bool Foam::token::isPunctuation(const punctuationToken p) const noexcept
|
||||
{
|
||||
if (type_ == tokenType::PUNCTUATION)
|
||||
{
|
||||
return data_.punctuationVal;
|
||||
}
|
||||
|
||||
parseError("punctuation character");
|
||||
return punctuationToken::NULL_TOKEN;
|
||||
return
|
||||
(
|
||||
type_ == tokenType::PUNCTUATION
|
||||
&& data_.punctuationVal == p
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -478,6 +478,18 @@ inline bool Foam::token::isSeparator() const noexcept
|
||||
}
|
||||
|
||||
|
||||
inline Foam::token::punctuationToken Foam::token::pToken() const
|
||||
{
|
||||
if (type_ == tokenType::PUNCTUATION)
|
||||
{
|
||||
return data_.punctuationVal;
|
||||
}
|
||||
|
||||
parseError("punctuation character");
|
||||
return punctuationToken::NULL_TOKEN;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::isLabel() const noexcept
|
||||
{
|
||||
return (type_ == tokenType::LABEL);
|
||||
@ -590,6 +602,12 @@ inline bool Foam::token::isWord() const noexcept
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::isWord(const std::string& s) const
|
||||
{
|
||||
return (isWord() && s == *data_.wordPtr);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::isDirective() const noexcept
|
||||
{
|
||||
return (type_ == tokenType::DIRECTIVE);
|
||||
@ -884,9 +902,9 @@ inline bool Foam::token::operator==(const token& tok) const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator==(const punctuationToken p) const
|
||||
inline bool Foam::token::operator==(const punctuationToken p) const noexcept
|
||||
{
|
||||
return (type_ == tokenType::PUNCTUATION && data_.punctuationVal == p);
|
||||
return isPunctuation(p);
|
||||
}
|
||||
|
||||
|
||||
@ -901,7 +919,7 @@ inline bool Foam::token::operator==(const std::string& s) const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator==(const label val) const
|
||||
inline bool Foam::token::operator==(const label val) const noexcept
|
||||
{
|
||||
return
|
||||
(
|
||||
@ -911,7 +929,7 @@ inline bool Foam::token::operator==(const label val) const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator==(const floatScalar val) const
|
||||
inline bool Foam::token::operator==(const floatScalar val) const noexcept
|
||||
{
|
||||
return
|
||||
(
|
||||
@ -921,7 +939,7 @@ inline bool Foam::token::operator==(const floatScalar val) const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator==(const doubleScalar val) const
|
||||
inline bool Foam::token::operator==(const doubleScalar val) const noexcept
|
||||
{
|
||||
return
|
||||
(
|
||||
@ -937,25 +955,25 @@ inline bool Foam::token::operator!=(const token& tok) const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator!=(const punctuationToken p) const
|
||||
inline bool Foam::token::operator!=(const punctuationToken p) const noexcept
|
||||
{
|
||||
return !operator==(p);
|
||||
return !isPunctuation(p);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator!=(const label val) const
|
||||
inline bool Foam::token::operator!=(const label val) const noexcept
|
||||
{
|
||||
return !operator==(val);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator!=(const floatScalar val) const
|
||||
inline bool Foam::token::operator!=(const floatScalar val) const noexcept
|
||||
{
|
||||
return !operator==(val);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::token::operator!=(const doubleScalar val) const
|
||||
inline bool Foam::token::operator!=(const doubleScalar val) const noexcept
|
||||
{
|
||||
return !operator==(val);
|
||||
}
|
||||
|
||||
@ -92,9 +92,9 @@ static OS& printTokenInfo(OS& os, const token& tok)
|
||||
|
||||
case token::tokenType::COMPOUND:
|
||||
{
|
||||
if (tok.compoundToken().empty())
|
||||
if (tok.compoundToken().moved())
|
||||
{
|
||||
os << "empty ";
|
||||
os << "moved ";
|
||||
}
|
||||
os << "compound of type "
|
||||
<< tok.compoundToken().type();
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,43 +70,35 @@ Foam::dictionaryListEntry::dictionaryListEntry
|
||||
dictionary::null
|
||||
)
|
||||
{
|
||||
token firstToken(is);
|
||||
if (firstToken.isLabel())
|
||||
token tok(is);
|
||||
if (tok.isLabel())
|
||||
{
|
||||
const label sz = firstToken.labelToken();
|
||||
const label len = tok.labelToken();
|
||||
|
||||
is.readBeginList("List");
|
||||
|
||||
for (label i=0; i<sz; ++i)
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
entry::New(*this, is);
|
||||
}
|
||||
is.readEndList("List");
|
||||
}
|
||||
else if
|
||||
(
|
||||
firstToken.isPunctuation()
|
||||
&& firstToken.pToken() == token::BEGIN_LIST
|
||||
)
|
||||
else if (tok.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
token nextToken(is);
|
||||
if (nextToken.error())
|
||||
is >> tok;
|
||||
if (tok.error())
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "parsing error " << nextToken.info()
|
||||
<< "parsing error " << tok.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else if
|
||||
(
|
||||
nextToken.isPunctuation()
|
||||
&& nextToken.pToken() == token::END_LIST
|
||||
)
|
||||
else if (tok.isPunctuation(token::END_LIST))
|
||||
{
|
||||
break;
|
||||
}
|
||||
is.putBack(nextToken);
|
||||
is.putBack(tok);
|
||||
entry::New(*this, is);
|
||||
}
|
||||
}
|
||||
@ -113,7 +106,7 @@ Foam::dictionaryListEntry::dictionaryListEntry
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< tok.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -133,11 +133,7 @@ bool Foam::entry::New
|
||||
const bool valid = getKeyword(keyword, keyToken, is);
|
||||
|
||||
// Can accept a list of entries too
|
||||
if
|
||||
(
|
||||
keyToken.isLabel()
|
||||
|| (keyToken.isPunctuation() && keyToken.pToken() == token::BEGIN_LIST)
|
||||
)
|
||||
if (keyToken.isLabel() || keyToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
is.putBack(keyToken);
|
||||
return parentDict.add
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -157,29 +157,21 @@ Foam::exprTools::getList
|
||||
|
||||
|
||||
ITstream& is = eptr->stream();
|
||||
token firstToken(is);
|
||||
token tok(is);
|
||||
|
||||
List<string> list;
|
||||
|
||||
if
|
||||
(
|
||||
firstToken.isLabel()
|
||||
||
|
||||
(
|
||||
firstToken.type() == token::PUNCTUATION
|
||||
&& firstToken.pToken() == token::BEGIN_LIST
|
||||
)
|
||||
)
|
||||
if (tok.isLabel() || tok.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
// A list of strings
|
||||
is.rewind();
|
||||
is >> list;
|
||||
}
|
||||
else if (firstToken.isString())
|
||||
else if (tok.isString())
|
||||
{
|
||||
// A single string
|
||||
list.resize(1);
|
||||
list[0] = firstToken.stringToken();
|
||||
list[0] = tok.stringToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -191,47 +191,35 @@ Foam::Field<Type>::Field
|
||||
// Read first token
|
||||
token firstToken(is);
|
||||
|
||||
if (firstToken.isWord())
|
||||
if (firstToken.isWord("uniform"))
|
||||
{
|
||||
if (firstToken.wordToken() == "uniform")
|
||||
this->resize(len);
|
||||
operator=(pTraits<Type>(is));
|
||||
}
|
||||
else if (firstToken.isWord("nonuniform"))
|
||||
{
|
||||
is >> static_cast<List<Type>&>(*this);
|
||||
const label lenRead = this->size();
|
||||
if (len != lenRead)
|
||||
{
|
||||
this->setSize(len);
|
||||
operator=(pTraits<Type>(is));
|
||||
}
|
||||
else if (firstToken.wordToken() == "nonuniform")
|
||||
{
|
||||
is >> static_cast<List<Type>&>(*this);
|
||||
label currentSize = this->size();
|
||||
if (currentSize != len)
|
||||
if (len < lenRead && allowConstructFromLargerSize)
|
||||
{
|
||||
if (len < currentSize && allowConstructFromLargerSize)
|
||||
{
|
||||
#ifdef FULLDEBUG
|
||||
IOWarningInFunction(dict)
|
||||
<< "Sizes do not match. "
|
||||
<< "Re-sizing " << currentSize
|
||||
<< " entries to " << len
|
||||
<< endl;
|
||||
#endif
|
||||
#ifdef FULLDEBUG
|
||||
IOWarningInFunction(dict)
|
||||
<< "Sizes do not match. Truncating " << lenRead
|
||||
<< " 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);
|
||||
}
|
||||
// Truncate the data
|
||||
this->resize(len);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "size " << lenRead
|
||||
<< " is not equal to the expected length " << len
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Expected keyword 'uniform' or 'nonuniform', found "
|
||||
<< firstToken.wordToken()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,10 +51,7 @@ namespace Foam
|
||||
return
|
||||
(
|
||||
// Token 1 = ':' separator
|
||||
(
|
||||
getToken(is, tok)
|
||||
&& tok.isPunctuation() && tok.pToken() == token::COLON
|
||||
)
|
||||
(getToken(is, tok) && tok.isPunctuation(token::COLON))
|
||||
|
||||
// Token 2 is the value
|
||||
&& getToken(is, tok)
|
||||
@ -441,8 +438,7 @@ Foam::label Foam::vtk::seriesWriter::load
|
||||
if
|
||||
(
|
||||
getValueToken(is, tok)
|
||||
&& tok.isPunctuation()
|
||||
&& tok.pToken() == token::BEGIN_SQR
|
||||
&& tok.isPunctuation(token::BEGIN_SQR)
|
||||
)
|
||||
{
|
||||
state = parse::FILES_ARRAY;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -97,11 +97,7 @@ Foam::genericFaPatchField<Type>::genericFaPatchField
|
||||
// Read first token
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "nonuniform"
|
||||
)
|
||||
if (firstToken.isWord("nonuniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -306,11 +302,7 @@ Foam::genericFaPatchField<Type>::genericFaPatchField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "uniform"
|
||||
)
|
||||
else if (firstToken.isWord("uniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -709,8 +701,7 @@ void Foam::genericFaPatchField<Type>::write(Ostream& os) const
|
||||
(
|
||||
dEntry.isStream()
|
||||
&& dEntry.stream().size()
|
||||
&& dEntry.stream()[0].isWord()
|
||||
&& dEntry.stream()[0].wordToken() == "nonuniform"
|
||||
&& dEntry.stream()[0].isWord("nonuniform")
|
||||
)
|
||||
{
|
||||
if (scalarFields_.found(key))
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -97,11 +97,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
|
||||
// Read first token
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "nonuniform"
|
||||
)
|
||||
if (firstToken.isWord("nonuniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -306,11 +302,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "uniform"
|
||||
)
|
||||
else if (firstToken.isWord("uniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -708,8 +700,7 @@ void Foam::genericFvPatchField<Type>::write(Ostream& os) const
|
||||
(
|
||||
dEntry.isStream()
|
||||
&& dEntry.stream().size()
|
||||
&& dEntry.stream()[0].isWord()
|
||||
&& dEntry.stream()[0].wordToken() == "nonuniform"
|
||||
&& dEntry.stream()[0].isWord("nonuniform")
|
||||
)
|
||||
{
|
||||
if (scalarFields_.found(key))
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -96,11 +96,7 @@ Foam::genericFvsPatchField<Type>::genericFvsPatchField
|
||||
// Read first token
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "nonuniform"
|
||||
)
|
||||
if (firstToken.isWord("nonuniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -305,11 +301,7 @@ Foam::genericFvsPatchField<Type>::genericFvsPatchField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "uniform"
|
||||
)
|
||||
else if (firstToken.isWord("uniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -708,8 +700,7 @@ void Foam::genericFvsPatchField<Type>::write(Ostream& os) const
|
||||
(
|
||||
dEntry.isStream()
|
||||
&& dEntry.stream().size()
|
||||
&& dEntry.stream()[0].isWord()
|
||||
&& dEntry.stream()[0].wordToken() == "nonuniform"
|
||||
&& dEntry.stream()[0].isWord("nonuniform")
|
||||
)
|
||||
{
|
||||
if (scalarFields_.found(key))
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,11 +77,7 @@ Foam::genericPointPatchField<Type>::genericPointPatchField
|
||||
// Read first token
|
||||
token firstToken(is);
|
||||
|
||||
if
|
||||
(
|
||||
firstToken.isWord()
|
||||
&& firstToken.wordToken() == "nonuniform"
|
||||
)
|
||||
if (firstToken.isWord("nonuniform"))
|
||||
{
|
||||
token fieldToken(is);
|
||||
|
||||
@ -490,8 +486,7 @@ void Foam::genericPointPatchField<Type>::write(Ostream& os) const
|
||||
(
|
||||
dEntry.isStream()
|
||||
&& dEntry.stream().size()
|
||||
&& dEntry.stream()[0].isWord()
|
||||
&& dEntry.stream()[0].wordToken() == "nonuniform"
|
||||
&& dEntry.stream()[0].isWord("nonuniform")
|
||||
)
|
||||
{
|
||||
if (scalarFields_.found(key))
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -98,18 +98,18 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
|
||||
{
|
||||
const polyMesh& mesh = c.pMesh();
|
||||
|
||||
token firstToken(is);
|
||||
token tok(is);
|
||||
|
||||
const bool newFormat = (geometryType_ == cloud::geometryType::COORDINATES);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
if (tok.isLabel())
|
||||
{
|
||||
label s = firstToken.labelToken();
|
||||
const label len = tok.labelToken();
|
||||
|
||||
// Read beginning of contents
|
||||
is.readBeginList(FUNCTION_NAME);
|
||||
|
||||
for (label i=0; i<s; i++)
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
// Read position only
|
||||
c.append
|
||||
@ -127,39 +127,27 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
|
||||
// Read end of contents
|
||||
is.readEndList(FUNCTION_NAME);
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (tok.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
is >> tok;
|
||||
while (!tok.isPunctuation(token::END_LIST))
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, '(', found "
|
||||
<< firstToken.info() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
token lastToken(is);
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
{
|
||||
is.putBack(lastToken);
|
||||
is.putBack(tok);
|
||||
|
||||
// Read position only
|
||||
c.append
|
||||
(
|
||||
new typename CloudType::particleType(mesh, is, false, newFormat)
|
||||
);
|
||||
is >> lastToken;
|
||||
is >> tok;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info() << exit(FatalIOError);
|
||||
<< tok.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
is.check(FUNCTION_NAME);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -139,13 +139,7 @@ void Foam::blockMesh::readPatches
|
||||
nPatches = 0;
|
||||
|
||||
token lastToken(patchStream);
|
||||
while
|
||||
(
|
||||
!(
|
||||
lastToken.isPunctuation()
|
||||
&& lastToken.pToken() == token::END_LIST
|
||||
)
|
||||
)
|
||||
while (!lastToken.isPunctuation(token::END_LIST))
|
||||
{
|
||||
if (tmpBlocksPatches.size() <= nPatches)
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,29 +32,29 @@ template<class T>
|
||||
void Foam::blockMeshTools::read
|
||||
(
|
||||
Istream& is,
|
||||
List<T>& L,
|
||||
List<T>& list,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
token firstToken(is);
|
||||
token tok(is);
|
||||
|
||||
if (firstToken.isLabel())
|
||||
if (tok.isLabel())
|
||||
{
|
||||
const label s = firstToken.labelToken();
|
||||
const label len = tok.labelToken();
|
||||
|
||||
// Set list length to that read
|
||||
L.setSize(s);
|
||||
list.resize(len);
|
||||
|
||||
// Read beginning of contents
|
||||
const char delimiter = is.readBeginList("List");
|
||||
|
||||
if (s)
|
||||
if (len)
|
||||
{
|
||||
if (delimiter == token::BEGIN_LIST)
|
||||
{
|
||||
for (label i=0; i<s; ++i)
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
read(is, L[i], dict);
|
||||
read(is, list[i], dict);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -61,39 +62,33 @@ void Foam::blockMeshTools::read
|
||||
// Read end of contents
|
||||
is.readEndList("List");
|
||||
}
|
||||
else if (firstToken.isPunctuation())
|
||||
else if (tok.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
if (firstToken.pToken() != token::BEGIN_LIST)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected '(', found "
|
||||
<< firstToken.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
SLList<T> sll;
|
||||
|
||||
while (true)
|
||||
is >> tok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
while (!tok.isPunctuation(token::END_LIST))
|
||||
{
|
||||
token t(is);
|
||||
if (t.isPunctuation() && t.pToken() == token::END_LIST)
|
||||
{
|
||||
break;
|
||||
}
|
||||
is.putBack(t);
|
||||
is.putBack(tok);
|
||||
|
||||
T elem;
|
||||
read(is, elem, dict);
|
||||
sll.append(elem);
|
||||
|
||||
is >> tok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
}
|
||||
|
||||
// Convert the singly-linked list to this list
|
||||
L = sll;
|
||||
list = std::move(sll);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <int> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< tok.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
@ -106,9 +101,9 @@ Foam::List<T> Foam::blockMeshTools::read
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
List<T> L;
|
||||
read(is, L, dict);
|
||||
return L;
|
||||
List<T> list;
|
||||
read(is, list, dict);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -60,7 +60,7 @@ Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New
|
||||
|
||||
token firstToken(is);
|
||||
|
||||
if (firstToken.isPunctuation() && firstToken.pToken() == token::BEGIN_LIST)
|
||||
if (firstToken.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
// Putback the opening bracket
|
||||
is.putBack(firstToken);
|
||||
@ -92,7 +92,7 @@ Foam::autoPtr<Foam::blockVertex> Foam::blockVertex::New
|
||||
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "incorrect first token, expected <word> or '(', found "
|
||||
<< firstToken.info()
|
||||
<< firstToken.info() << nl
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return nullptr;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -126,7 +126,7 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptor& gd)
|
||||
gd.nDivFraction_ = 1.0;
|
||||
gd.expansionRatio_ = t.number();
|
||||
}
|
||||
else if (t.isPunctuation() && t.pToken() == token::BEGIN_LIST)
|
||||
else if (t.isPunctuation(token::BEGIN_LIST))
|
||||
{
|
||||
is >> gd.blockFraction_ >> gd.nDivFraction_ >> gd.expansionRatio_;
|
||||
is.readEnd("gradingDescriptor");
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,10 +65,7 @@ Foam::rawIOField<Type>::rawIOField(const IOobject& io, const bool readAverage)
|
||||
|
||||
const token firstToken(is);
|
||||
|
||||
headerOk =
|
||||
is.good()
|
||||
&& firstToken.isWord()
|
||||
&& firstToken.wordToken() == "FoamFile";
|
||||
headerOk = is.good() && firstToken.isWord("FoamFile");
|
||||
}
|
||||
|
||||
isPtr.clear();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1216,7 +1216,7 @@ bool finishReaction = false;
|
||||
reactionCoeffsString.replaceAll("d", "e");
|
||||
reactionCoeffsString.replaceAll("D", "e");
|
||||
IStringStream reactionCoeffsStream(reactionCoeffsString);
|
||||
reactionCoeffsStream.lineNumber() = lineNo_;
|
||||
reactionCoeffsStream.lineNumber(lineNo_);
|
||||
|
||||
reactionCoeffsStream
|
||||
>> ArrheniusCoeffs[0]
|
||||
|
||||
Reference in New Issue
Block a user