Skip to content
Snippets Groups Projects
Commit 2ab34905 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: invert ASCII/BINARY checks. Helps if adding other formats

STYLE: use globalIndex::totalSize()
parent 5a29b2b0
Branches
Tags
No related merge requests found
......@@ -381,7 +381,7 @@ int main(int argc, char *argv[])
if (nChanged > 0)
{
Info<< "Flipping " << nChanged << " out of "
<< globalFaces.size() << " faces." << nl << endl;
<< globalFaces.totalSize() << " faces." << nl << endl;
mesh.faceZones()[zoneName].resetAddressing(faceLabels, newFlipMap);
if (!mesh.faceZones().write())
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -462,11 +462,7 @@ void Foam::boundBox::operator&=(const boundBox& bb)
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
{
if (os.format() == IOstreamOption::ASCII)
{
os << bb.min_ << token::SPACE << bb.max_;
}
else
if (os.format() == IOstreamOption::BINARY)
{
os.write
(
......@@ -474,6 +470,10 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
sizeof(boundBox)
);
}
else
{
os << bb.min_ << token::SPACE << bb.max_;
}
os.check(FUNCTION_NAME);
return os;
......@@ -482,11 +482,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
{
if (is.format() == IOstreamOption::ASCII)
{
is >> bb.min_ >> bb.max_;
}
else
if (is.format() == IOstreamOption::BINARY)
{
Detail::readContiguous<boundBox>
(
......@@ -495,6 +491,10 @@ Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
sizeof(boundBox)
);
}
else
{
is >> bb.min_ >> bb.max_;
}
is.check(FUNCTION_NAME);
return is;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -139,15 +139,7 @@ inline Foam::labelledTri::labelledTri(Istream& is)
inline Foam::Istream& Foam::operator>>(Istream& is, labelledTri& t)
{
if (is.format() == IOstreamOption::ASCII)
{
is.readBegin("labelledTri");
is >> static_cast<triFace&>(t) >> t.index();
is.readEnd("labelledTri");
}
else
if (is.format() == IOstreamOption::BINARY)
{
Detail::readContiguous<labelledTri>
(
......@@ -156,6 +148,14 @@ inline Foam::Istream& Foam::operator>>(Istream& is, labelledTri& t)
sizeof(labelledTri)
);
}
else
{
is.readBegin("labelledTri");
is >> static_cast<triFace&>(t) >> t.index();
is.readEnd("labelledTri");
}
is.check(FUNCTION_NAME);
return is;
......@@ -164,13 +164,7 @@ inline Foam::Istream& Foam::operator>>(Istream& is, labelledTri& t)
inline Foam::Ostream& Foam::operator<<(Ostream& os, const labelledTri& t)
{
if (os.format() == IOstreamOption::ASCII)
{
os << token::BEGIN_LIST
<< static_cast<const triFace&>(t) << token::SPACE << t.index()
<< token::END_LIST;
}
else
if (os.format() == IOstreamOption::BINARY)
{
os.write
(
......@@ -178,6 +172,12 @@ inline Foam::Ostream& Foam::operator<<(Ostream& os, const labelledTri& t)
sizeof(labelledTri)
);
}
else
{
os << token::BEGIN_LIST
<< static_cast<const triFace&>(t) << token::SPACE << t.index()
<< token::END_LIST;
}
os.check(FUNCTION_NAME);
return os;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -276,13 +276,7 @@ public:
friend Ostream& operator<<(Ostream& os, const PointIndexHit& pHit)
{
if (os.format() == IOstreamOption::ASCII)
{
os << pHit.hit_ << token::SPACE
<< pHit.point_ << token::SPACE
<< pHit.index_;
}
else
if (os.format() == IOstreamOption::BINARY)
{
os.write
(
......@@ -290,6 +284,12 @@ public:
sizeof(PointIndexHit)
);
}
else
{
os << pHit.hit_ << token::SPACE
<< pHit.point_ << token::SPACE
<< pHit.index_;
}
os.check(FUNCTION_NAME);
return os;
......@@ -298,11 +298,7 @@ public:
friend Istream& operator>>(Istream& is, PointIndexHit& pHit)
{
if (is.format() == IOstreamOption::ASCII)
{
is >> pHit.hit_ >> pHit.point_ >> pHit.index_;
}
else
if (is.format() == IOstreamOption::BINARY)
{
// TODO (2019-08-06):
// cannot properly handle mixed-precision reading
......@@ -314,6 +310,10 @@ public:
sizeof(PointIndexHit)
);
}
else
{
is >> pHit.hit_ >> pHit.point_ >> pHit.index_;
}
is.check(FUNCTION_NAME);
return is;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment