mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: update applications/tests to use SpanStream/CharStream
This commit is contained in:
committed by
Andrew Heather
parent
3693d61e6c
commit
0fb2c8eb1c
@ -34,7 +34,6 @@ Description
|
|||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "CircularBuffer.H"
|
#include "CircularBuffer.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,7 +35,7 @@ Description
|
|||||||
#include "CompactListList.H"
|
#include "CompactListList.H"
|
||||||
#include "IndirectList.H"
|
#include "IndirectList.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
@ -126,20 +126,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
{
|
{
|
||||||
// IO
|
// IO
|
||||||
OStringStream ostr;
|
OCharStream ostr;
|
||||||
ostr << cll4;
|
ostr << cll4;
|
||||||
|
|
||||||
IStringStream istr(ostr.str());
|
ISpanStream istr(ostr.view());
|
||||||
CompactListList<label> cll5(istr);
|
CompactListList<label> cll5(istr);
|
||||||
Info<< "cll5 = " << cll5 << endl;
|
Info<< "cll5 = " << cll5 << endl;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// IO
|
// IO
|
||||||
cll4.clear();
|
cll4.clear();
|
||||||
OStringStream ostr;
|
OCharStream ostr;
|
||||||
ostr << cll4;
|
ostr << cll4;
|
||||||
|
|
||||||
IStringStream istr(ostr.str());
|
ISpanStream istr(ostr.view());
|
||||||
CompactListList<label> cll5(istr);
|
CompactListList<label> cll5(istr);
|
||||||
Info<< "cll5 = " << cll5 << endl;
|
Info<< "cll5 = " << cll5 << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,6 @@ Description
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "ITstream.H"
|
#include "ITstream.H"
|
||||||
#include "OTstream.H"
|
#include "OTstream.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "labelRange.H"
|
#include "labelRange.H"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,7 +31,7 @@ License
|
|||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "stringListOps.H"
|
#include "stringListOps.H"
|
||||||
|
|
||||||
@ -119,9 +119,9 @@ int main()
|
|||||||
<< table1["aaa"] << nl;
|
<< table1["aaa"] << nl;
|
||||||
|
|
||||||
{
|
{
|
||||||
OStringStream os;
|
OCharStream os;
|
||||||
os << table1;
|
os << table1;
|
||||||
HashTable<scalar> readTable(IStringStream(os.str())());
|
HashTable<scalar> readTable(ISpanStream(os.view())());
|
||||||
|
|
||||||
Info<< "Istream constructor:" << readTable << endl;
|
Info<< "Istream constructor:" << readTable << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
@ -20,7 +20,7 @@ Description
|
|||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
#include "IntRange.H"
|
#include "IntRange.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -75,9 +75,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Read from stream
|
// Read from stream
|
||||||
{
|
{
|
||||||
IStringStream is("(10 100)");
|
ICharStream is("(10 100)");
|
||||||
intRange range;
|
intRange range;
|
||||||
|
|
||||||
is >> range;
|
is >> range;
|
||||||
|
|
||||||
Info<< "From stream int32_t: " << range << nl;
|
Info<< "From stream int32_t: " << range << nl;
|
||||||
|
|||||||
@ -40,7 +40,7 @@ See also
|
|||||||
#include "wordRes.H"
|
#include "wordRes.H"
|
||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
@ -183,17 +183,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
labelList intlist(IStringStream("(0 1 2)")());
|
labelList intlist(ICharStream("(0 1 2)")());
|
||||||
Info<<"construct from Istream: " << intlist << endl;
|
Info<<"construct from Istream: " << intlist << endl;
|
||||||
|
|
||||||
IStringStream("(3 4 5)")() >> static_cast<labelUList&>(intlist);
|
ICharStream("(3 4 5)")() >> static_cast<labelUList&>(intlist);
|
||||||
Info<<"is >>: " << intlist << endl;
|
Info<<"is >>: " << intlist << endl;
|
||||||
|
|
||||||
IStringStream("(6 7 8)")() >> intlist;
|
ICharStream("(6 7 8)")() >> intlist;
|
||||||
Info<<"is >>: " << intlist << endl;
|
Info<<"is >>: " << intlist << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<vector> list1(IStringStream("1 ((0 1 2))")());
|
List<vector> list1(ICharStream("1 ((0 1 2))")());
|
||||||
Info<< "list1: " << list1 << endl;
|
Info<< "list1: " << list1 << endl;
|
||||||
|
|
||||||
List<vector> list2
|
List<vector> list2
|
||||||
|
|||||||
@ -37,7 +37,6 @@ Description
|
|||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "Fstream.H"
|
#include "Fstream.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
|
|||||||
@ -290,8 +290,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "address: " << Foam::name(os2.list().cdata()) << nl;
|
Info<< "address: " << Foam::name(os2.list().cdata()) << nl;
|
||||||
|
|
||||||
List<char> chars(os2.release());
|
DynamicList<char> chars(os2.release());
|
||||||
Info<< "chars: " << chars.size() << nl;
|
Info<< "chars: " << chars.size() << '/' << chars.capacity() << nl;
|
||||||
Info<< "address: " << Foam::name(chars.cdata()) << nl;
|
Info<< "address: " << Foam::name(chars.cdata()) << nl;
|
||||||
Info<< "release" << nl;
|
Info<< "release" << nl;
|
||||||
printInfo(os2);
|
printInfo(os2);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,6 +29,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "OCountStream.H"
|
#include "OCountStream.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
#include "StringStream.H"
|
#include "StringStream.H"
|
||||||
#include "Fstream.H"
|
#include "Fstream.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
@ -63,9 +64,11 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
OCountStream cnt;
|
OCountStream cnt;
|
||||||
|
OCharStream cstr;
|
||||||
OStringStream str;
|
OStringStream str;
|
||||||
ocountstream plain;
|
ocountstream plain;
|
||||||
|
|
||||||
|
generateOutput(cstr);
|
||||||
generateOutput(str);
|
generateOutput(str);
|
||||||
generateOutput(cnt);
|
generateOutput(cnt);
|
||||||
generateOutput(plain);
|
generateOutput(plain);
|
||||||
@ -73,6 +76,7 @@ int main(int argc, char *argv[])
|
|||||||
cnt.print(Info);
|
cnt.print(Info);
|
||||||
|
|
||||||
Info<< "counter state: " << (cnt.stdStream().rdstate()) << nl
|
Info<< "counter state: " << (cnt.stdStream().rdstate()) << nl
|
||||||
|
<< "via char-stream: " << label(cstr.view().size()) << " chars" << nl
|
||||||
<< "via string-stream: " << str.str().size() << " chars" << nl
|
<< "via string-stream: " << str.str().size() << " chars" << nl
|
||||||
<< "via ocountstream: " << plain.count() << " chars" << endl;
|
<< "via ocountstream: " << plain.count() << " chars" << endl;
|
||||||
|
|
||||||
|
|||||||
@ -28,18 +28,15 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
#include "StringStream.H"
|
#include "StringStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
template<class OStreamType>
|
||||||
// Main program:
|
void doTest()
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
Info<< "Begin test OStringStream" << endl;
|
OStreamType os;
|
||||||
|
|
||||||
OStringStream os;
|
|
||||||
os << "output with some values " << 1 << " entry" << endl;
|
os << "output with some values " << 1 << " entry" << endl;
|
||||||
|
|
||||||
Info<< "contains:" << nl
|
Info<< "contains:" << nl
|
||||||
@ -59,8 +56,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "after reset:" << nl
|
Info<< "after reset:" << nl
|
||||||
<< os.str() << endl;
|
<< os.str() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
Info<< "Begin test OStringStream" << endl;
|
||||||
|
|
||||||
|
doTest<OStringStream>();
|
||||||
|
// No reset() method: doTest<OCharStream>();
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +36,7 @@ See also
|
|||||||
|
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
|
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<<"Read from " << inputSLList << nl;
|
Info<<"Read from " << inputSLList << nl;
|
||||||
|
|
||||||
IStringStream is(inputSLList);
|
ISpanStream is(inputSLList);
|
||||||
is >> ulist;
|
is >> ulist;
|
||||||
|
|
||||||
// Info<<"source: "; print(source);
|
// Info<<"source: "; print(source);
|
||||||
@ -107,7 +107,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<<"Read from " << inputCompound << nl;
|
Info<<"Read from " << inputCompound << nl;
|
||||||
|
|
||||||
IStringStream is(inputCompound);
|
ISpanStream is(inputCompound);
|
||||||
is >> ulist;
|
is >> ulist;
|
||||||
|
|
||||||
// Info<<"source: "; print(source);
|
// Info<<"source: "; print(source);
|
||||||
|
|||||||
@ -31,7 +31,6 @@ Description
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "MinMax.H"
|
#include "MinMax.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "StringStream.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Description
|
|||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Test read/write (ASCII)" << nl;
|
Info<< "Test read/write (ASCII)" << nl;
|
||||||
|
|
||||||
OStringStream ostr;
|
OCharStream ostr;
|
||||||
|
|
||||||
undecorated(ostr, set3a); // like flatOutput
|
undecorated(ostr, set3a); // like flatOutput
|
||||||
ostr << bitSet();
|
ostr << bitSet();
|
||||||
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
|||||||
undecorated(ostr, set3a); // like flatOutput
|
undecorated(ostr, set3a); // like flatOutput
|
||||||
|
|
||||||
{
|
{
|
||||||
IStringStream istr(ostr.str());
|
ISpanStream istr(ostr.view());
|
||||||
Info<< "parse: " << istr.str() << nl;
|
Info<< "parse: " << istr.str() << nl;
|
||||||
|
|
||||||
bitSet bset1(istr);
|
bitSet bset1(istr);
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Description
|
|||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "ITstream.H"
|
#include "ITstream.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "bitSet.H"
|
#include "bitSet.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "\nassign from indices\n";
|
Info<< "\nassign from indices\n";
|
||||||
list4.readList
|
list4.readList
|
||||||
(
|
(
|
||||||
IStringStream
|
ICharStream
|
||||||
(
|
(
|
||||||
"{0 1 2 3 12 13 14 19 20 21}"
|
"{0 1 2 3 12 13 14 19 20 21}"
|
||||||
)()
|
)()
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,7 +38,7 @@ Description
|
|||||||
|
|
||||||
#include "charList.H"
|
#include "charList.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "SubList.H"
|
#include "SubList.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
@ -61,7 +61,7 @@ int main(int argc, char *argv[])
|
|||||||
// Info<< "Known compound tokens: "
|
// Info<< "Known compound tokens: "
|
||||||
// << token::compound::emptyConstructorTablePtr_->sortedToc() << nl;
|
// << token::compound::emptyConstructorTablePtr_->sortedToc() << nl;
|
||||||
|
|
||||||
OStringStream ostr;
|
OCharStream ostr;
|
||||||
|
|
||||||
{
|
{
|
||||||
List<char> alphabet(64);
|
List<char> alphabet(64);
|
||||||
@ -75,7 +75,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
IStringStream istr(ostr.str());
|
// ICharStream istr(ostr.release());
|
||||||
|
ISpanStream istr(ostr.view());
|
||||||
List<char> alphabet(istr);
|
List<char> alphabet(istr);
|
||||||
|
|
||||||
Info<< "re-read: " << alphabet << nl;
|
Info<< "re-read: " << alphabet << nl;
|
||||||
@ -88,6 +89,8 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "blanked: " << alphabet << nl;
|
Info<< "blanked: " << alphabet << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << nl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@ Description
|
|||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,6 +36,7 @@ Description
|
|||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
#include "ops.H"
|
#include "ops.H"
|
||||||
#include "scalarRange.H"
|
#include "scalarRange.H"
|
||||||
#include "stringOps.H"
|
#include "stringOps.H"
|
||||||
@ -348,7 +349,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< nl << "Test reading good/bad/empty scalar entries" << nl;
|
Info<< nl << "Test reading good/bad/empty scalar entries" << nl;
|
||||||
dictionary dict2
|
dictionary dict2
|
||||||
(
|
(
|
||||||
IStringStream
|
ICharStream
|
||||||
(
|
(
|
||||||
"good 3.14159;\n"
|
"good 3.14159;\n"
|
||||||
"negative -3.14159;\n"
|
"negative -3.14159;\n"
|
||||||
@ -418,7 +419,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
dictionary mydict
|
dictionary mydict
|
||||||
(
|
(
|
||||||
IStringStream
|
ICharStream
|
||||||
(
|
(
|
||||||
"scalar 3.14159;\n"
|
"scalar 3.14159;\n"
|
||||||
"label 10;\n"
|
"label 10;\n"
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,7 +35,7 @@ Description
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ int main(int argc, char *argv[])
|
|||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
|
|
||||||
{
|
{
|
||||||
IStringStream is
|
ICharStream is
|
||||||
(
|
(
|
||||||
"value 10;"
|
"value 10;"
|
||||||
"scalar1 $value;"
|
"scalar1 $value;"
|
||||||
|
|||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "primitiveEntry.H"
|
#include "primitiveEntry.H"
|
||||||
#include "dimensionedTypes.H"
|
#include "dimensionedTypes.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
{
|
{
|
||||||
string dimString("[Pa m^2 s^-2]");
|
string dimString("[Pa m^2 s^-2]");
|
||||||
IStringStream is("[Pa m^2 s^-2]");
|
ICharStream is("[Pa m^2 s^-2]");
|
||||||
|
|
||||||
Pout<< nl;
|
Pout<< nl;
|
||||||
Pout<< "dimensionSet construct from (is) with contents "
|
Pout<< "dimensionSet construct from (is) with contents "
|
||||||
@ -70,23 +71,23 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Pout<< nl
|
Pout<< nl
|
||||||
<< "construct from (is) = "
|
<< "construct from (is) = "
|
||||||
<< dimensionedScalar(IStringStream("bla [Pa mm^2 s^-2] 3.0")())
|
<< dimensionedScalar(ICharStream("bla [Pa mm^2 s^-2] 3.0")())
|
||||||
<< endl;
|
<< endl;
|
||||||
Pout<< "construct from (name,is) = "
|
Pout<< "construct from (name,is) = "
|
||||||
<< dimensionedScalar
|
<< dimensionedScalar
|
||||||
(
|
(
|
||||||
"ABC",
|
"ABC",
|
||||||
IStringStream("[Pa mm^2 s^-2] 3.0")()
|
ICharStream("[Pa mm^2 s^-2] 3.0")()
|
||||||
) << endl;
|
) << endl;
|
||||||
Pout<< "construct from (name,dims,is) = "
|
Pout<< "construct from (name,dims,is) = "
|
||||||
<< dimensionedScalar
|
<< dimensionedScalar
|
||||||
(
|
(
|
||||||
"ABC",
|
"ABC",
|
||||||
dimLength,
|
dimLength,
|
||||||
IStringStream("bla [mm] 3.0")()
|
ICharStream("bla [mm] 3.0")()
|
||||||
) << endl;
|
) << endl;
|
||||||
{
|
{
|
||||||
IStringStream is("bla [mm] 3.0");
|
ICharStream is("bla [mm] 3.0");
|
||||||
dimensionedScalar ds;
|
dimensionedScalar ds;
|
||||||
is >> ds;
|
is >> ds;
|
||||||
Pout<< "read:" << ds << endl;
|
Pout<< "read:" << ds << endl;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -76,9 +77,9 @@ int main(int argc, char *argv[])
|
|||||||
PtrList<dictionary> boundaryDicts(pbm.size());
|
PtrList<dictionary> boundaryDicts(pbm.size());
|
||||||
forAll(pbm, patchi)
|
forAll(pbm, patchi)
|
||||||
{
|
{
|
||||||
OStringStream os;
|
OCharStream os;
|
||||||
os << pbm[patchi];
|
os << pbm[patchi];
|
||||||
IStringStream is(os.str());
|
ISpanStream is(os.view());
|
||||||
boundaryDicts.set(patchi, new dictionary(is));
|
boundaryDicts.set(patchi, new dictionary(is));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,6 @@ Description
|
|||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include "SpanStream.H"
|
#include "SpanStream.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "NASCore.H"
|
#include "NASCore.H"
|
||||||
#include "parsing.H"
|
#include "parsing.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
@ -443,6 +442,7 @@ int main(int argc, char *argv[])
|
|||||||
<< " read " << sizeof(scalar) << nl;
|
<< " read " << sizeof(scalar) << nl;
|
||||||
|
|
||||||
List<otherType> srcList(15);
|
List<otherType> srcList(15);
|
||||||
|
List<scalar> dstList; // Read back
|
||||||
|
|
||||||
forAll(srcList, i)
|
forAll(srcList, i)
|
||||||
{
|
{
|
||||||
@ -452,13 +452,8 @@ int main(int argc, char *argv[])
|
|||||||
OCharStream os(IOstreamOption::BINARY);
|
OCharStream os(IOstreamOption::BINARY);
|
||||||
os << srcList;
|
os << srcList;
|
||||||
|
|
||||||
DynamicList<char> buf;
|
// Recover written contents
|
||||||
os.swap(buf); // Recover written contents
|
ICharStream is(os.release(), IOstreamOption::BINARY);
|
||||||
|
|
||||||
// Read back
|
|
||||||
List<scalar> dstList;
|
|
||||||
|
|
||||||
ISpanStream is(buf, IOstreamOption::BINARY);
|
|
||||||
is.setScalarByteSize(sizeof(otherType));
|
is.setScalarByteSize(sizeof(otherType));
|
||||||
|
|
||||||
Info<< "Stream scalar-size ("
|
Info<< "Stream scalar-size ("
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Description
|
|||||||
#include "scalarPredicates.H"
|
#include "scalarPredicates.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "ops.H"
|
#include "ops.H"
|
||||||
#include "bitSet.H"
|
#include "bitSet.H"
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< nl << "Construct from Istream" << nl;
|
Info<< nl << "Construct from Istream" << nl;
|
||||||
{
|
{
|
||||||
IStringStream is("((less 10) (greater 100) (less -8) (le -9))");
|
ICharStream is("((less 10) (greater 100) (less -8) (le -9))");
|
||||||
predicates::scalars accept(is);
|
predicates::scalars accept(is);
|
||||||
|
|
||||||
doTest(values, accept);
|
doTest(values, accept);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,6 +32,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "OSHA1stream.H"
|
#include "OSHA1stream.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
#include "StringStream.H"
|
#include "StringStream.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
dictionary dict
|
dictionary dict
|
||||||
(
|
(
|
||||||
IStringStream
|
ICharStream
|
||||||
(
|
(
|
||||||
"parent { Default_Boundary_Region { type zeroGradient; } }"
|
"parent { Default_Boundary_Region { type zeroGradient; } }"
|
||||||
"inlet_1 { value inlet_1; }"
|
"inlet_1 { value inlet_1; }"
|
||||||
|
|||||||
@ -34,7 +34,6 @@ Description
|
|||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "labelRange.H"
|
#include "labelRange.H"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,7 +32,7 @@ Description
|
|||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "FlatOutput.H"
|
#include "FlatOutput.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
};
|
};
|
||||||
labelList matches;
|
labelList matches;
|
||||||
|
|
||||||
wordRes matcher1(IStringStream("( okey \"[hy]e+.*\" )")());
|
wordRes matcher1(ICharStream("( okey \"[hy]e+.*\" )")());
|
||||||
|
|
||||||
Info<< "stringList " << strings << nl;
|
Info<< "stringList " << strings << nl;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,8 +66,7 @@ Note
|
|||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "ModifiableMeshedSurface.H"
|
#include "ModifiableMeshedSurface.H"
|
||||||
#include "UnsortedMeshedSurfaces.H"
|
#include "UnsortedMeshedSurfaces.H"
|
||||||
|
#include "SpanStream.H"
|
||||||
#include "StringStream.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -180,9 +179,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// check: output to ostream, construct from istream
|
// check: output to ostream, construct from istream
|
||||||
{
|
{
|
||||||
OStringStream os;
|
OCharStream os;
|
||||||
os << surf;
|
os << surf;
|
||||||
IStringStream is(os.str());
|
ISpanStream is(os.view());
|
||||||
|
|
||||||
// both work:
|
// both work:
|
||||||
triSurface surf2(is);
|
triSurface surf2(is);
|
||||||
@ -245,9 +244,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// check: output to ostream, construct from istream
|
// check: output to ostream, construct from istream
|
||||||
{
|
{
|
||||||
OStringStream os;
|
OCharStream os;
|
||||||
os << surf;
|
os << surf;
|
||||||
IStringStream is(os.str());
|
ISpanStream is(os.view());
|
||||||
|
|
||||||
// both work:
|
// both work:
|
||||||
UnsortedMeshedSurface<face> surf2(is);
|
UnsortedMeshedSurface<face> surf2(is);
|
||||||
@ -309,9 +308,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// check: output to ostream, construct from istream
|
// check: output to ostream, construct from istream
|
||||||
{
|
{
|
||||||
OStringStream os;
|
OCharStream os;
|
||||||
os << surf;
|
os << surf;
|
||||||
IStringStream is(os.str());
|
ISpanStream is(os.view());
|
||||||
|
|
||||||
// both work:
|
// both work:
|
||||||
MeshedSurface<face> surf2(is);
|
MeshedSurface<face> surf2(is);
|
||||||
@ -373,9 +372,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// check: output to ostream, construct from istream
|
// check: output to ostream, construct from istream
|
||||||
{
|
{
|
||||||
OStringStream os;
|
OCharStream os;
|
||||||
os << surf;
|
os << surf;
|
||||||
IStringStream is(os.str());
|
ISpanStream is(os.view());
|
||||||
|
|
||||||
// both work:
|
// both work:
|
||||||
MeshedSurface<face> surf2(is);
|
MeshedSurface<face> surf2(is);
|
||||||
|
|||||||
@ -31,7 +31,6 @@ Description
|
|||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "StringStream.H"
|
|
||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "scalarList.H"
|
#include "scalarList.H"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,7 +34,7 @@ Description
|
|||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "StringStream.H"
|
#include "SpanStream.H"
|
||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "input string: " << rawArg << nl;
|
Info<< "input string: " << rawArg << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
IStringStream is(rawArg);
|
ISpanStream is(rawArg);
|
||||||
|
|
||||||
DynamicList<token> tokens;
|
DynamicList<token> tokens;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user