Compare commits
10 Commits
develop-fe
...
wip-issue2
| Author | SHA1 | Date | |
|---|---|---|---|
| cf818a653b | |||
| 42150cf3fe | |||
| 5630db5493 | |||
| dfdbe7efd0 | |||
| b4612b4c04 | |||
| c4d18e97a3 | |||
| dea31e9b4a | |||
| 3d892ace29 | |||
| 8b1514c99b | |||
| 1afd27db6c |
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
"normalisedGradP",
|
||||
tmagGradP()/max(tmagGradP())
|
||||
);
|
||||
normalisedGradP.writeOpt() = IOobject::AUTO_WRITE;
|
||||
normalisedGradP.writeOpt(IOobject::AUTO_WRITE);
|
||||
tmagGradP.clear();
|
||||
|
||||
++runTime;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,7 @@ Foam::DTRMParticle::DTRMParticle
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
|
||||
}
|
||||
@ -115,7 +115,7 @@ void Foam::DTRMParticle::writeProperties
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const DTRMParticle& p)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << static_cast<const particle&>(p)
|
||||
<< token::SPACE << p.p0_
|
||||
|
||||
@ -699,7 +699,7 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
|
||||
for (label pointi = 0; pointi < lines.size(); pointi += 2)
|
||||
{
|
||||
os.write(linePointRef(lines[pointi], lines[pointi+1]));
|
||||
os.writeLine(lines[pointi], lines[pointi+1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,8 +49,8 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
// IOstream::streamFormat format = IOstream::ASCII;
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
// IOstreamOption streamOpt(IOstreamOption::ASCII);
|
||||
|
||||
const label size = 20000000;
|
||||
|
||||
@ -85,11 +85,7 @@ int main(int argc, char *argv[])
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
faces2.writeObject
|
||||
(
|
||||
IOstreamOption(format),
|
||||
true
|
||||
);
|
||||
faces2.writeObject(streamOpt, true);
|
||||
|
||||
Info<< "Written old format faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
@ -145,11 +141,7 @@ int main(int argc, char *argv[])
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
faces2.writeObject
|
||||
(
|
||||
IOstreamOption(format),
|
||||
true
|
||||
);
|
||||
faces2.writeObject(streamOpt, true);
|
||||
|
||||
Info<< "Written new format faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
@ -146,7 +146,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<<"Writing output to " << binaryOutput << endl;
|
||||
|
||||
OFstream os(binaryOutput, IOstream::BINARY);
|
||||
OFstream os(binaryOutput, IOstreamOption::BINARY);
|
||||
|
||||
os.writeEntry("idl1", idl1);
|
||||
os.writeEntry("idl2", idl2);
|
||||
|
||||
@ -78,8 +78,8 @@ int main(int argc, char *argv[])
|
||||
OFstream os
|
||||
(
|
||||
objPath,
|
||||
IOstream::BINARY,
|
||||
IOstream::currentVersion,
|
||||
IOstreamOption::BINARY,
|
||||
IOstreamOption::currentVersion,
|
||||
runTime.writeCompression()
|
||||
);
|
||||
if (!os.good())
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,8 +82,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< nl << "hash-like functionality" << nl;
|
||||
|
||||
// doesn't work e4 = -1;
|
||||
e4.start() = e4.end() = -1;
|
||||
e4.clear();
|
||||
|
||||
printInfo(e4);
|
||||
for (label i : {2, -1, 2, 1, 4, 1, 2, 3})
|
||||
@ -93,24 +92,24 @@ int main(int argc, char *argv[])
|
||||
printInfo(e4);
|
||||
}
|
||||
|
||||
e4.start() = e4.end() = -1;
|
||||
e4.clear();
|
||||
Info<< "insert from list\n";
|
||||
labelHashSet newIndices({2, -1, 2, 1, 4, 1, 2, 3});
|
||||
e4.insert(newIndices.toc());
|
||||
printInfo(e4);
|
||||
|
||||
e4.start() = e4.end() = -1;
|
||||
e4.clear();
|
||||
Info<< "insert from list\n";
|
||||
e4.insert({0, 5, 2, -1, 2, 1, 4, 1, 2, 3});
|
||||
printInfo(e4);
|
||||
|
||||
FixedList<label, 8> otherIndices{12, 2, -1, 1, 4, 1, 2, 3};
|
||||
e4.start() = e4.end() = -1;
|
||||
e4.clear();
|
||||
Info<< "insert from list: " << otherIndices << nl;
|
||||
e4.insert(otherIndices);
|
||||
printInfo(e4);
|
||||
|
||||
e4.start() = e4.end();
|
||||
e4.a() = e4.b();
|
||||
Info<< "erase from list: " << otherIndices << nl;
|
||||
Info<< "removed " << e4.erase(otherIndices) << " values" << nl;
|
||||
printInfo(e4);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
||||
// No. of Nodes = nCells
|
||||
// No. of Edges connecting Nodes = nInternalFaces
|
||||
|
||||
OFstream os(args.caseName() + ".graph", IOstream::ASCII);
|
||||
OFstream os(args.caseName() + ".graph", IOstreamOption::ASCII);
|
||||
|
||||
os << "%% metis graph file, of an OpenFOAM mesh %%" << nl
|
||||
<< "%% nCells=" << mesh.nCells()
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,11 +30,31 @@ Description
|
||||
|
||||
#include "argList.H"
|
||||
#include "instant.H"
|
||||
#include "Pair.H"
|
||||
#include "fileNameInstant.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
template<class T>
|
||||
Ostream& printInstant(const UList<T>& times, const label i)
|
||||
{
|
||||
if (i >= 0 && i < times.size())
|
||||
{
|
||||
Info<< " (" << times[i] << ")";
|
||||
}
|
||||
return Info;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Ostream& printInstant(const UList<T>& times, const Pair<label>& range)
|
||||
{
|
||||
printInstant(times, range.first());
|
||||
printInstant(times, range.second());
|
||||
return Info;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -48,6 +68,7 @@ int main(int argc, char *argv[])
|
||||
times.append({300.456, "def"});
|
||||
times.append({454.456, "xyz"});
|
||||
times.append({10, "ten"});
|
||||
times.append({15, "fifteen"});
|
||||
|
||||
{
|
||||
word timeName("twenty");
|
||||
@ -61,6 +82,19 @@ int main(int argc, char *argv[])
|
||||
sort(times);
|
||||
Info<< "Sorted:" << times << nl;
|
||||
|
||||
for (const scalar val : { -0.5, 5.0, 18.0, 25.0, 450.0, 480.0 })
|
||||
{
|
||||
label start = instant::findStart(times, val);
|
||||
Pair<label> range = instant::findRange(times, val);
|
||||
|
||||
Info<< nl
|
||||
<< "time:" << val << nl;
|
||||
Info<< " start:" << start;
|
||||
printInstant(times, start) << nl;
|
||||
|
||||
Info<< " range:" << range;
|
||||
printInstant(times, range) << nl;
|
||||
}
|
||||
|
||||
DynamicList<fileNameInstant> files;
|
||||
files.append(fileNameInstant{});
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,10 +24,11 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Print max limits.
|
||||
Print some numerical limits.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include "int.H"
|
||||
#include "uint.H"
|
||||
@ -37,21 +38,63 @@ Description
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
std::ostream& print(const char* tag, float val)
|
||||
{
|
||||
std::cout
|
||||
<< tag << val
|
||||
<< " 0x" << std::hex << *reinterpret_cast<const uint32_t*>(&val);
|
||||
return std::cout;
|
||||
}
|
||||
|
||||
|
||||
std::ostream& print(const char* tag, double val)
|
||||
{
|
||||
std::cout
|
||||
<< tag << val
|
||||
<< " 0x" << std::hex << *reinterpret_cast<const uint64_t*>(&val);
|
||||
return std::cout;
|
||||
}
|
||||
|
||||
|
||||
// Have (float|double)Scalar(GREAT|SMALL|..)
|
||||
|
||||
#define PrintFloatLimits(FloatType, NanFunction) \
|
||||
{ \
|
||||
print("max:", std::numeric_limits<FloatType>::max()); \
|
||||
print(" VGREAT:", FloatType##ScalarVGREAT); \
|
||||
print(" ROOTVGREAT:", FloatType##ScalarROOTVGREAT) << nl; \
|
||||
\
|
||||
print("min:", std::numeric_limits<FloatType>::min()); \
|
||||
print(" VSMALL:", FloatType##ScalarVSMALL); \
|
||||
print(" ROOTVSMALL:", FloatType##ScalarROOTVSMALL) << nl; \
|
||||
\
|
||||
print("epsilon:", std::numeric_limits<FloatType>::epsilon()); \
|
||||
print(" SMALL:", FloatType##ScalarSMALL); \
|
||||
print(" ROOTSMALL:", FloatType##ScalarROOTSMALL) << nl; \
|
||||
\
|
||||
print("1/epsilon:", 1/std::numeric_limits<FloatType>::epsilon()); \
|
||||
print(" GREAT:", FloatType##ScalarGREAT); \
|
||||
print(" ROOTGREAT:", FloatType##ScalarROOTGREAT) << nl; \
|
||||
\
|
||||
print("nan:", std::NanFunction("nan")) << nl; \
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//NONE Info<<"int16:" << pTraits<int16_t>::max << nl;
|
||||
Info<< "=max=" << nl;
|
||||
Info<< "uint8:" << pTraits<uint8_t>::max << nl;
|
||||
Info<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
|
||||
Info<< "int32:" << pTraits<int32_t>::max << nl;
|
||||
Info<< "uint32:" << pTraits<uint32_t>::max << nl;
|
||||
Info<< "int64:" << pTraits<int64_t>::max << nl;
|
||||
Info<< "uint64:" << pTraits<uint64_t>::max << nl;
|
||||
//NONE cout<<"int16:" << pTraits<int16_t>::max << nl;
|
||||
cout<< "=max=" << nl;
|
||||
cout<< "uint8:" << pTraits<uint8_t>::max << nl;
|
||||
cout<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
|
||||
cout<< "int32:" << pTraits<int32_t>::max << nl;
|
||||
cout<< "uint32:" << pTraits<uint32_t>::max << nl;
|
||||
cout<< "int64:" << pTraits<int64_t>::max << nl;
|
||||
cout<< "uint64:" << pTraits<uint64_t>::max << nl;
|
||||
|
||||
Info<< nl;
|
||||
cout<< nl;
|
||||
|
||||
cout<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
|
||||
cout<< "int32:" << pTraits<int32_t>::max << nl;
|
||||
@ -59,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
cout<< "int64:" << pTraits<int64_t>::max << nl;
|
||||
cout<< "uint64:" << pTraits<uint64_t>::max << nl;
|
||||
|
||||
Info<< nl << "=digits=" << nl;
|
||||
cout<< nl << "=digits=" << nl;
|
||||
|
||||
cout<< "int16:" << std::numeric_limits<int16_t>::digits << nl;
|
||||
cout<< "int32:" << std::numeric_limits<int32_t>::digits << nl;
|
||||
@ -70,29 +113,15 @@ int main(int argc, char *argv[])
|
||||
cout<< "double:" << std::numeric_limits<double>::digits << nl;
|
||||
cout<< "long double:" << std::numeric_limits<long double>::digits << nl;
|
||||
|
||||
Info<< nl << "=float=" << nl;
|
||||
// std::nanl (long double)
|
||||
cout<< nl;
|
||||
cout<< nl << "=float=" << nl;
|
||||
PrintFloatLimits(float, nanf);
|
||||
|
||||
cout<< "max:" << std::numeric_limits<float>::max()
|
||||
<< " VGREAT:" << floatScalarVGREAT << nl;
|
||||
cout<< "min:" << std::numeric_limits<float>::min()
|
||||
<< " VSMALL:" << floatScalarVSMALL << nl;
|
||||
cout<< "epsilon:" << std::numeric_limits<float>::epsilon()
|
||||
<< " SMALL:" << floatScalarSMALL << nl;
|
||||
cout<< "1/epsilon:" << 1.0f/std::numeric_limits<float>::epsilon()
|
||||
<< " GREAT:" << floatScalarGREAT << nl;
|
||||
cout<< nl << "=double=" << nl;
|
||||
PrintFloatLimits(double, nan);
|
||||
|
||||
Info<< nl << "=double=" << nl;
|
||||
|
||||
cout<< "max:" << std::numeric_limits<double>::max()
|
||||
<< " VGREAT:" << doubleScalarVGREAT << nl;
|
||||
cout<< "min:" << std::numeric_limits<double>::min()
|
||||
<< " VSMALL:" << doubleScalarVSMALL << nl;
|
||||
cout<< "epsilon:" << std::numeric_limits<double>::epsilon()
|
||||
<< " SMALL:" << doubleScalarSMALL << nl;
|
||||
cout<< "1/epsilon:" << 1.0f/std::numeric_limits<double>::epsilon()
|
||||
<< " GREAT:" << doubleScalarGREAT << nl;
|
||||
|
||||
Info << "---\nEnd\n" << endl;
|
||||
cout<< "---\nEnd\n" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
DynamicList<char> buf;
|
||||
|
||||
OListStream os(std::move(buf), IOstream::BINARY);
|
||||
OListStream os(std::move(buf), IOstreamOption::BINARY);
|
||||
os << srcList;
|
||||
|
||||
os.swap(buf); // Recover buffer
|
||||
@ -342,7 +342,7 @@ int main(int argc, char *argv[])
|
||||
// Read back
|
||||
List<scalar> dstList;
|
||||
|
||||
UIListStream is(buf, IOstream::BINARY);
|
||||
UIListStream is(buf, IOstreamOption::BINARY);
|
||||
is.setScalarByteSize(sizeof(otherType));
|
||||
|
||||
Info<< "Stream scalar-size ("
|
||||
|
||||
@ -1397,26 +1397,20 @@ void extrudeGeometricProperties
|
||||
{
|
||||
Pout<< "Model :" << faceCentres[facei] << endl
|
||||
<< "regionMesh:" << regionMesh.faceCentres()[facei] << endl;
|
||||
faceStr.write
|
||||
faceStr.writeLine
|
||||
(
|
||||
linePointRef
|
||||
(
|
||||
faceCentres[facei],
|
||||
regionMesh.faceCentres()[facei]
|
||||
)
|
||||
faceCentres[facei],
|
||||
regionMesh.faceCentres()[facei]
|
||||
);
|
||||
}
|
||||
forAll(cellCentres, celli)
|
||||
{
|
||||
Pout<< "Model :" << cellCentres[celli] << endl
|
||||
<< "regionMesh:" << regionMesh.cellCentres()[celli] << endl;
|
||||
cellStr.write
|
||||
cellStr.writeLine
|
||||
(
|
||||
linePointRef
|
||||
(
|
||||
cellCentres[celli],
|
||||
regionMesh.cellCentres()[celli]
|
||||
)
|
||||
cellCentres[celli],
|
||||
regionMesh.cellCentres()[celli]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1687,7 +1687,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
)
|
||||
)
|
||||
{
|
||||
multipleIntersections.write(linePointRef(ptA, ptB));
|
||||
multipleIntersections.writeLine(ptA, ptB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
// Forward Declarations
|
||||
class initialPointsMethod;
|
||||
class relaxationModel;
|
||||
class faceAreaWeightModel;
|
||||
|
||||
@ -1433,18 +1433,15 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
// && (mag(snapDir & norm[0]) > 0.5)
|
||||
// )
|
||||
// {
|
||||
// snapping1.write
|
||||
// snapping1.writeLine
|
||||
// (
|
||||
// linePointRef(dual, nearestPointOnTet)
|
||||
// dual,
|
||||
// nearestPointOnTet
|
||||
// );
|
||||
//
|
||||
// snapping2.write
|
||||
// snapping2.writeLine
|
||||
// (
|
||||
// linePointRef
|
||||
// (
|
||||
// nearestPointOnTet,
|
||||
// hitInfo.hitPoint()
|
||||
// )
|
||||
// nearestPointOnTet,
|
||||
// hitInfo.hitPoint()
|
||||
// );
|
||||
//
|
||||
// pts[cit->cellIndex()] = hitInfo.hitPoint();
|
||||
@ -1764,9 +1761,10 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
|
||||
if ((*vcit)->real())
|
||||
{
|
||||
featurePointDualsStr.write
|
||||
featurePointDualsStr.writeLine
|
||||
(
|
||||
linePointRef(topoint(vit->point()), (*vcit)->dual())
|
||||
topoint(vit->point()),
|
||||
(*vcit)->dual()
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1867,7 +1865,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
<< " " << vc2->dual()
|
||||
<< endl;
|
||||
|
||||
startCellStr.write(linePointRef(vc1->dual(), vc2->dual()));
|
||||
startCellStr.writeLine(vc1->dual(), vc2->dual());
|
||||
|
||||
// Get patch by getting face between cells and the two
|
||||
// points on the face that are not the feature vertex
|
||||
|
||||
@ -1395,10 +1395,7 @@ void Foam::conformalVoronoiMesh::writePointPairs
|
||||
|
||||
if (ptPairs_.isPointPair(vA, vB))
|
||||
{
|
||||
os.write
|
||||
(
|
||||
linePointRef(topoint(vA->point()), topoint(vB->point()))
|
||||
);
|
||||
os.writeLine(topoint(vA->point()), topoint(vB->point()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -73,7 +73,7 @@ scalar getMergeDistance
|
||||
Info<< "Merge tolerance : " << mergeTol << nl
|
||||
<< "Write tolerance : " << writeTol << endl;
|
||||
|
||||
if (runTime.writeFormat() == IOstream::ASCII && mergeTol < writeTol)
|
||||
if (runTime.writeFormat() == IOstreamOption::ASCII && mergeTol < writeTol)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Your current settings specify ASCII writing with "
|
||||
|
||||
@ -616,7 +616,7 @@ scalar getMergeDistance
|
||||
<< endl;
|
||||
|
||||
// check writing tolerance
|
||||
if (mesh.time().writeFormat() == IOstream::ASCII && !dryRun)
|
||||
if (mesh.time().writeFormat() == IOstreamOption::ASCII && !dryRun)
|
||||
{
|
||||
const scalar writeTol = std::pow
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -160,7 +160,7 @@ bool writeZones
|
||||
// Force writing as ASCII
|
||||
writeOk = meshObject.regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstream::ASCII, compression),
|
||||
IOstreamOption(IOstreamOption::ASCII, compression),
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -355,7 +355,7 @@ int main(int argc, char *argv[])
|
||||
runTime
|
||||
);
|
||||
|
||||
if (runTime.writeFormat() == IOstream::ASCII)
|
||||
if (runTime.writeFormat() == IOstreamOption::ASCII)
|
||||
{
|
||||
// Only do zones when converting from binary to ascii
|
||||
// The other way gives problems since working on dictionary level.
|
||||
|
||||
@ -663,7 +663,11 @@ int main(int argc, char *argv[])
|
||||
Info<< "Merge tolerance : " << mergeTol << nl
|
||||
<< "Write tolerance : " << writeTol << endl;
|
||||
|
||||
if (runTime.writeFormat() == IOstream::ASCII && mergeTol < writeTol)
|
||||
if
|
||||
(
|
||||
runTime.writeFormat() == IOstreamOption::ASCII
|
||||
&& mergeTol < writeTol
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Your current settings specify ASCII writing with "
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -159,7 +159,7 @@ public:
|
||||
p.origProc = ppi.origProc();
|
||||
p.origId = ppi.origId();
|
||||
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << p.position
|
||||
<< token::SPACE << p.celli
|
||||
|
||||
@ -390,7 +390,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
summary.writeHeader(os);
|
||||
summary.writeData(os);
|
||||
summary.writeEndDivider(os);
|
||||
IOobject::writeEndDivider(os);
|
||||
|
||||
Info<< "Wrote to " << outputName << nl << endl;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -199,7 +199,7 @@ void createFieldFiles
|
||||
|
||||
fieldOut.regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
IOstreamOption(IOstreamOption::ASCII),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2019 PCOpt/NTUA
|
||||
Copyright (C) 2013-2019 FOSS GP
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
// Write modified dictionary
|
||||
optDict.regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
IOstreamOption(IOstreamOption::ASCII),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ void isoFacesToFile
|
||||
{
|
||||
for (const List<point>& facePts : procFaces)
|
||||
{
|
||||
os.write(face(identity(facePts.size())), facePts);
|
||||
os.writeFace(facePts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ void isoFacesToFile
|
||||
|
||||
for (const List<point>& facePts : faces)
|
||||
{
|
||||
os.write(face(identity(facePts.size())), facePts);
|
||||
os.writeFace(facePts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
||||
IOstreamOption streamOpt(runTime.writeFormat());
|
||||
if (args.found("ascii"))
|
||||
{
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
streamOpt.format(IOstreamOption::ASCII);
|
||||
}
|
||||
|
||||
forAll(times, timei)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -767,7 +767,7 @@ int main(int argc, char *argv[])
|
||||
ctrl.streamOpt.format(runTime.writeFormat());
|
||||
if (args.found("ascii"))
|
||||
{
|
||||
ctrl.streamOpt.format(IOstream::ASCII);
|
||||
ctrl.streamOpt.format(IOstreamOption::ASCII);
|
||||
}
|
||||
|
||||
expressions::exprString valueExpr_
|
||||
@ -838,7 +838,7 @@ int main(int argc, char *argv[])
|
||||
ctrl.streamOpt.format(runTime.writeFormat());
|
||||
if (args.found("ascii"))
|
||||
{
|
||||
ctrl.streamOpt.format(IOstream::ASCII);
|
||||
ctrl.streamOpt.format(IOstreamOption::ASCII);
|
||||
}
|
||||
|
||||
if (ctrl.createNew && ctrl.keepPatches)
|
||||
|
||||
@ -81,7 +81,6 @@ Description
|
||||
#include "triSurfaceSearch.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "OFstream.H"
|
||||
#include "OBJstream.H"
|
||||
#include "booleanSurface.H"
|
||||
#include "edgeIntersections.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -856,12 +856,10 @@ int main(int argc, char *argv[])
|
||||
if (debug)
|
||||
{
|
||||
OBJstream str(runTime.path()/"isScaledPoint.obj");
|
||||
forAll(isScaledPoint, pointI)
|
||||
|
||||
for (const label pointi : isScaledPoint)
|
||||
{
|
||||
if (isScaledPoint[pointI])
|
||||
{
|
||||
str.write(initialPoints[meshPoints[pointI]]);
|
||||
}
|
||||
str.write(initialPoints[meshPoints[pointi]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ getNumberOfPatchFaces()
|
||||
'/^ *'"$patch"' *$/,/}/{s/^ *nFaces *\([0-9][0-9]*\) *;.*$/\1/p}' \
|
||||
"$file")
|
||||
|
||||
if [ -n "nFaces" ]
|
||||
if [ -n "$nFaces" ]
|
||||
then
|
||||
echo "$nFaces"
|
||||
else
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -65,7 +65,7 @@ die()
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${Script##*/} -help' for usage"
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@ -73,7 +73,7 @@ die()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
optSyntax=sh
|
||||
optSyntax="sh"
|
||||
unset verboseOutput
|
||||
|
||||
# Parse options
|
||||
|
||||
@ -339,9 +339,8 @@ $(IOdictionary)/IOdictionary.C
|
||||
db/IOobjects/IOMap/IOMaps.C
|
||||
db/IOobjects/decomposedBlockData/decomposedBlockData.C
|
||||
db/IOobjects/decomposedBlockData/decomposedBlockDataHeader.C
|
||||
db/IOobjects/rawIOField/rawIOFields.C
|
||||
db/IOobjects/GlobalIOField/GlobalIOFields.C
|
||||
|
||||
|
||||
db/IOobjects/GlobalIOList/globalIOLists.C
|
||||
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ inline UIntType repeat_value(unsigned val)
|
||||
template<class UIntType>
|
||||
inline Ostream& print(Ostream& os, UIntType value, char off='0', char on='1')
|
||||
{
|
||||
if (os.format() == IOstream::BINARY)
|
||||
if (os.format() == IOstreamOption::BINARY)
|
||||
{
|
||||
// Perhaps not the most sensible, but the only thing we currently have.
|
||||
os << label(value);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -81,7 +81,7 @@ Foam::Istream& Foam::PackedList<Width>::readList(Istream& is)
|
||||
// Set list length to that read
|
||||
list.resize(len);
|
||||
|
||||
if (is.format() == IOstream::BINARY)
|
||||
if (is.format() == IOstreamOption::BINARY)
|
||||
{
|
||||
// Binary (always contiguous)
|
||||
|
||||
@ -184,7 +184,7 @@ Foam::Ostream& Foam::PackedList<Width>::writeList
|
||||
const PackedList<Width>& list = *this;
|
||||
const label len = list.size();
|
||||
|
||||
if (os.format() == IOstream::BINARY)
|
||||
if (os.format() == IOstreamOption::BINARY)
|
||||
{
|
||||
// Binary (always contiguous)
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ Foam::Ostream& Foam::CircularBuffer<T>::writeList
|
||||
}
|
||||
#endif
|
||||
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -44,7 +44,7 @@ Foam::Ostream& Foam::IndirectListBase<T, Addr>::writeList
|
||||
|
||||
const label len = list.size();
|
||||
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
os << nl << len << nl;
|
||||
|
||||
@ -40,7 +40,7 @@ void Foam::FixedList<T, N>::writeEntry(Ostream& os) const
|
||||
if (token::compound::isCompound(tag))
|
||||
{
|
||||
os << tag << token::SPACE;
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Need the size too so that List<Type>::readList parses correctly
|
||||
os << static_cast<label>(N);
|
||||
@ -90,7 +90,7 @@ Foam::Ostream& Foam::FixedList<T, N>::writeList
|
||||
// small and we prefer a consistent appearance.
|
||||
// Eg, FixedList<T,2> or Pair<T> as "(-1 -1)", never as "2{-1}"
|
||||
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous. Size is always non-zero
|
||||
|
||||
@ -158,7 +158,7 @@ Foam::Istream& Foam::FixedList<T, N>::readList
|
||||
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
if (is.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous. Length is non-zero
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -80,7 +80,7 @@ Foam::Istream& Foam::List<T>::readList(Istream& is)
|
||||
// Resize to actual length read
|
||||
list.resize(len);
|
||||
|
||||
if (is.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,7 @@ void Foam::UList<T>::writeEntry(Ostream& os) const
|
||||
{
|
||||
os << *this;
|
||||
}
|
||||
else if (os.format() == IOstream::ASCII)
|
||||
else if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
// Zero-sized ASCII - Write size and delimiters
|
||||
os << 0 << token::BEGIN_LIST << token::END_LIST;
|
||||
@ -85,7 +85,7 @@ Foam::Ostream& Foam::UList<T>::writeList
|
||||
|
||||
const label len = list.size();
|
||||
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
@ -211,7 +211,7 @@ Foam::Istream& Foam::UList<T>::readList(Istream& is)
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (is.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ bool Foam::CompactIOField<T, BaseType>::writeObject
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
if (streamOpt.format() == IOstream::ASCII)
|
||||
if (streamOpt.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
// Change type to be non-compact format type
|
||||
const word oldTypeName(typeName);
|
||||
@ -282,8 +282,8 @@ Foam::Ostream& Foam::operator<<
|
||||
const Foam::CompactIOField<T, BaseType>& L
|
||||
)
|
||||
{
|
||||
// Keep ascii writing same.
|
||||
if (os.format() == IOstream::ASCII)
|
||||
// Keep ASCII writing same
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << static_cast<const Field<T>&>(L);
|
||||
}
|
||||
|
||||
@ -174,11 +174,11 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
|
||||
{
|
||||
if
|
||||
(
|
||||
streamOpt.format() == IOstream::BINARY
|
||||
streamOpt.format() == IOstreamOption::BINARY
|
||||
&& overflows()
|
||||
)
|
||||
{
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
streamOpt.format(IOstreamOption::ASCII);
|
||||
|
||||
WarningInFunction
|
||||
<< "Overall number of elements of CompactIOList of size "
|
||||
@ -186,7 +186,7 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
|
||||
<< nl << " Switching to ascii writing" << endl;
|
||||
}
|
||||
|
||||
if (streamOpt.format() == IOstream::ASCII)
|
||||
if (streamOpt.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
// Change type to be non-compact format type
|
||||
const word oldTypeName(typeName);
|
||||
@ -264,8 +264,8 @@ Foam::Ostream& Foam::operator<<
|
||||
const Foam::CompactIOList<T, BaseType>& L
|
||||
)
|
||||
{
|
||||
// Keep ascii writing same.
|
||||
if (os.format() == IOstream::ASCII)
|
||||
// Keep ASCII writing same
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << static_cast<const List<T>&>(L);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,7 +38,7 @@ Foam::GlobalIOField<Type>::GlobalIOField(const IOobject& io)
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOField<Type>>();
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ Foam::GlobalIOField<Type>::GlobalIOField(const IOobject& io, const label size)
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOField<Type>>();
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstreamOption::BINARY, typeName))
|
||||
{
|
||||
Field<Type>::setSize(size);
|
||||
}
|
||||
@ -69,7 +69,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOField<Type>>();
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstreamOption::BINARY, typeName))
|
||||
{
|
||||
Field<Type>::operator=(content);
|
||||
}
|
||||
@ -90,7 +90,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
|
||||
Field<Type>::transfer(content);
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
Field<Type>::transfer(tfld.ref());
|
||||
}
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstreamOption::BINARY, typeName))
|
||||
{
|
||||
Field<Type>::operator=(tfld());
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io)
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOList<Type>>();
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, Foam::zero)
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOList<Type>>();
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::GlobalIOList<Type>::GlobalIOList(const IOobject& io, const label len)
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOList<Type>>();
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstreamOption::BINARY, typeName))
|
||||
{
|
||||
List<Type>::resize(len);
|
||||
}
|
||||
@ -81,7 +81,7 @@ Foam::GlobalIOList<Type>::GlobalIOList
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
warnNoRereading<GlobalIOList<Type>>();
|
||||
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstreamOption::BINARY, typeName))
|
||||
{
|
||||
List<Type>::operator=(content);
|
||||
}
|
||||
@ -102,7 +102,7 @@ Foam::GlobalIOList<Type>::GlobalIOList
|
||||
|
||||
List<Type>::transfer(content);
|
||||
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,7 +62,7 @@ Foam::IOdictionary::IOdictionary
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
if (!readHeaderOk(IOstreamOption::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,7 @@ Foam::localIOdictionary::localIOdictionary
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
if (!readHeaderOk(IOstreamOption::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
if (!readHeaderOk(IOstreamOption::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,6 +34,7 @@ template<class Type>
|
||||
Foam::rawIOField<Type>::rawIOField(const IOobject& io, const bool readAverage)
|
||||
:
|
||||
regIOobject(io),
|
||||
hasAverage_(false),
|
||||
average_(Zero)
|
||||
{
|
||||
// Check for MUST_READ_IF_MODIFIED
|
||||
@ -61,15 +62,13 @@ Foam::rawIOField<Type>::rawIOField(const IOobject& io, const bool readAverage)
|
||||
{
|
||||
haveFile = true;
|
||||
|
||||
ISstream& is = isPtr();
|
||||
auto& is = *isPtr;
|
||||
|
||||
const token firstToken(is);
|
||||
|
||||
headerOk = is.good() && firstToken.isWord("FoamFile");
|
||||
}
|
||||
|
||||
isPtr.clear();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "rawIOField : object:" << io.name()
|
||||
@ -90,18 +89,31 @@ Foam::rawIOField<Type>::rawIOField(const IOobject& io, const bool readAverage)
|
||||
is >> static_cast<Field<Type>&>(*this);
|
||||
if (readAverage)
|
||||
{
|
||||
average_ = pTraits<Type>(is);
|
||||
hasAverage_ = true;
|
||||
is >> average_;
|
||||
}
|
||||
close();
|
||||
}
|
||||
}
|
||||
else if (haveFile)
|
||||
{
|
||||
// Failed reading - fall back to IFstream
|
||||
// Failed reading header - fall back to IFstream
|
||||
autoPtr<ISstream> isPtr(fileHandler().NewIFstream(io.objectPath()));
|
||||
|
||||
if (!isPtr || !isPtr->good())
|
||||
if (isPtr && isPtr->good())
|
||||
{
|
||||
auto& is = *isPtr;
|
||||
|
||||
is >> static_cast<Field<Type>&>(*this);
|
||||
if (readAverage)
|
||||
{
|
||||
hasAverage_ = true;
|
||||
is >> average_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error if missing and MUST_READ or MUST_READ_IF_MODIFIED
|
||||
if (io.readOpt() != IOobject::READ_IF_PRESENT)
|
||||
{
|
||||
FatalIOErrorInFunction(*isPtr)
|
||||
@ -109,16 +121,6 @@ Foam::rawIOField<Type>::rawIOField(const IOobject& io, const bool readAverage)
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ISstream& is = isPtr();
|
||||
|
||||
is >> static_cast<Field<Type>&>(*this);
|
||||
if (readAverage)
|
||||
{
|
||||
average_ = pTraits<Type>(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
@ -132,11 +134,19 @@ Foam::rawIOField<Type>::rawIOField(const IOobject& io, const bool readAverage)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::rawIOField<Type>::setAverage(const Type& val)
|
||||
{
|
||||
hasAverage_ = true;
|
||||
average_ = val;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::rawIOField<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
os << static_cast<const Field<Type>&>(*this);
|
||||
if (average_ != pTraits<Type>::zero)
|
||||
if (hasAverage_)
|
||||
{
|
||||
os << token::NL << average_;
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,8 +35,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef rawIOField_H
|
||||
#define rawIOField_H
|
||||
#ifndef Foam_rawIOField_H
|
||||
#define Foam_rawIOField_H
|
||||
|
||||
#include "IOField.H"
|
||||
|
||||
@ -57,7 +57,10 @@ class rawIOField
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The average of the field (Zero if not used)
|
||||
//- Has an average value
|
||||
bool hasAverage_;
|
||||
|
||||
//- The average for the field (zero if not used)
|
||||
Type average_;
|
||||
|
||||
|
||||
@ -72,7 +75,7 @@ public:
|
||||
rawIOField(const rawIOField&) = default;
|
||||
|
||||
//- Construct from IOobject
|
||||
explicit rawIOField(const IOobject& io, const bool readAverage);
|
||||
explicit rawIOField(const IOobject& io, const bool readAverage=false);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -81,11 +84,21 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
const Type& average() const
|
||||
//- Has an average value
|
||||
bool hasAverage() const noexcept
|
||||
{
|
||||
return hasAverage_;
|
||||
}
|
||||
|
||||
//- The average value (if any)
|
||||
const Type& average() const noexcept
|
||||
{
|
||||
return average_;
|
||||
}
|
||||
|
||||
//- Set an average value
|
||||
void setAverage(const Type& val);
|
||||
|
||||
bool writeData(Ostream& os) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOmanip_H
|
||||
#define IOmanip_H
|
||||
#ifndef Foam_IOmanip_H
|
||||
#define Foam_IOmanip_H
|
||||
|
||||
#include "Istream.H"
|
||||
#include "Ostream.H"
|
||||
@ -178,21 +178,21 @@ inline Omanip<char> setfill(char fillch)
|
||||
}
|
||||
|
||||
|
||||
inline Omanip<IOstream::streamFormat> setformat
|
||||
inline Omanip<IOstreamOption::streamFormat> setformat
|
||||
(
|
||||
const IOstream::streamFormat fmt
|
||||
const IOstreamOption::streamFormat fmt
|
||||
)
|
||||
{
|
||||
return Omanip<IOstream::streamFormat>(&IOstream::format, fmt);
|
||||
return Omanip<IOstreamOption::streamFormat>(&IOstreamOption::format, fmt);
|
||||
}
|
||||
|
||||
|
||||
inline Omanip<IOstream::versionNumber> setversion
|
||||
inline Omanip<IOstreamOption::versionNumber> setversion
|
||||
(
|
||||
const IOstream::versionNumber ver
|
||||
const IOstreamOption::versionNumber ver
|
||||
)
|
||||
{
|
||||
return Omanip<IOstream::versionNumber>(&IOstream::version, ver);
|
||||
return Omanip<IOstreamOption::versionNumber>(&IOstreamOption::version, ver);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,11 +49,11 @@ inline static void processFlags(Istream& is, int flagMask)
|
||||
{
|
||||
if ((flagMask & token::ASCII))
|
||||
{
|
||||
is.format(IOstream::ASCII);
|
||||
is.format(IOstreamOption::ASCII);
|
||||
}
|
||||
else if ((flagMask & token::BINARY))
|
||||
{
|
||||
is.format(IOstream::BINARY);
|
||||
is.format(IOstreamOption::BINARY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -459,7 +459,7 @@ Foam::Time::Time
|
||||
writeOnce_(false),
|
||||
sigWriteNow_(*this, true),
|
||||
sigStopAtWriteNow_(*this, true),
|
||||
writeStreamOption_(IOstream::ASCII),
|
||||
writeStreamOption_(IOstreamOption::ASCII),
|
||||
graphFormat_("raw"),
|
||||
runTimeModifiable_(false),
|
||||
functionObjects_(*this, false)
|
||||
@ -525,7 +525,7 @@ Foam::Time::Time
|
||||
writeOnce_(false),
|
||||
sigWriteNow_(*this, true),
|
||||
sigStopAtWriteNow_(*this, true),
|
||||
writeStreamOption_(IOstream::ASCII),
|
||||
writeStreamOption_(IOstreamOption::ASCII),
|
||||
graphFormat_("raw"),
|
||||
runTimeModifiable_(false),
|
||||
functionObjects_(*this, false)
|
||||
@ -619,7 +619,7 @@ Foam::Time::Time
|
||||
writeOnce_(false),
|
||||
sigWriteNow_(*this, true),
|
||||
sigStopAtWriteNow_(*this, true),
|
||||
writeStreamOption_(IOstream::ASCII),
|
||||
writeStreamOption_(IOstreamOption::ASCII),
|
||||
graphFormat_("raw"),
|
||||
runTimeModifiable_(false),
|
||||
functionObjects_(*this, false)
|
||||
@ -693,7 +693,7 @@ Foam::Time::Time
|
||||
purgeWrite_(0),
|
||||
subCycling_(0),
|
||||
writeOnce_(false),
|
||||
writeStreamOption_(IOstream::ASCII),
|
||||
writeStreamOption_(IOstreamOption::ASCII),
|
||||
graphFormat_("raw"),
|
||||
runTimeModifiable_(false),
|
||||
functionObjects_(*this, false)
|
||||
|
||||
@ -385,19 +385,19 @@ public:
|
||||
}
|
||||
|
||||
//- The write stream format
|
||||
IOstream::streamFormat writeFormat() const
|
||||
IOstreamOption::streamFormat writeFormat() const
|
||||
{
|
||||
return writeStreamOption_.format();
|
||||
}
|
||||
|
||||
//- The write stream compression
|
||||
IOstream::compressionType writeCompression() const
|
||||
IOstreamOption::compressionType writeCompression() const
|
||||
{
|
||||
return writeStreamOption_.compression();
|
||||
}
|
||||
|
||||
//- The write stream version
|
||||
IOstream::versionNumber writeVersion() const
|
||||
IOstreamOption::versionNumber writeVersion() const
|
||||
{
|
||||
return writeStreamOption_.version();
|
||||
}
|
||||
|
||||
@ -116,28 +116,17 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- The value (const access)
|
||||
scalar value() const noexcept
|
||||
{
|
||||
return val_;
|
||||
}
|
||||
scalar value() const noexcept { return val_; }
|
||||
|
||||
//- The value (non-const access)
|
||||
scalar& value() noexcept
|
||||
{
|
||||
return val_;
|
||||
}
|
||||
scalar& value() noexcept { return val_; }
|
||||
|
||||
//- The name/key (const access)
|
||||
const T& name() const noexcept
|
||||
{
|
||||
return key_;
|
||||
}
|
||||
const T& name() const noexcept { return key_; }
|
||||
|
||||
//- The name/key (non-const access)
|
||||
T& name() noexcept
|
||||
{
|
||||
return key_;
|
||||
}
|
||||
T& name() noexcept { return key_; }
|
||||
|
||||
|
||||
//- True if values are equal (includes SMALL for rounding)
|
||||
bool equal(scalar val) const noexcept
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,8 @@ License
|
||||
|
||||
#include "instant.H"
|
||||
#include "Time.H"
|
||||
#include "Pair.H"
|
||||
#include "UList.H"
|
||||
#include <cstdlib> // std::atof
|
||||
#include <utility> // std::move
|
||||
|
||||
@ -36,6 +38,62 @@ License
|
||||
const char* const Foam::instant::typeName = "instant";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::instant::findStart
|
||||
(
|
||||
const UList<instant>& times,
|
||||
const scalar timeVal
|
||||
)
|
||||
{
|
||||
for (label i = 0; i < times.size(); ++i)
|
||||
{
|
||||
if (timeVal <= times[i].value())
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Foam::Pair<Foam::label> Foam::instant::findRange
|
||||
(
|
||||
const UList<instant>& times,
|
||||
const scalar timeVal,
|
||||
const label start
|
||||
)
|
||||
{
|
||||
Pair<label> range(start, -1); // lower/upper
|
||||
|
||||
for (label i = start+1; i < times.size(); ++i)
|
||||
{
|
||||
if (timeVal < times[i].value())
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
range.first() = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (range.first() < 0 || range.first() >= times.size())
|
||||
{
|
||||
// Invalid
|
||||
return Pair<label>(-1, -1);
|
||||
}
|
||||
|
||||
if (range.first() < times.size()-1)
|
||||
{
|
||||
// Upper part of range within bounds
|
||||
range.second() = range.first()+1;
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::instant::instant(scalar timeValue)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,7 +32,7 @@ Description
|
||||
Uses Foam::Time when formatting the name.
|
||||
|
||||
SourceFiles
|
||||
instants.C
|
||||
instant.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -47,6 +47,10 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
template<class T> class Pair;
|
||||
template<class T> class UList;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class instant Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -94,6 +98,26 @@ public:
|
||||
|
||||
//- Move construct from timeName, parsing timeName for a value
|
||||
explicit instant(word&& timeName);
|
||||
|
||||
|
||||
// Helper Functions (for searching)
|
||||
|
||||
//- Find and return index of given start time (linear search)
|
||||
static label findStart
|
||||
(
|
||||
const UList<instant>& times,
|
||||
const scalar timeVal
|
||||
);
|
||||
|
||||
//- Find lower/upper indices for given time value in list of instances
|
||||
//- (linear search) continuing \em after the given start index.
|
||||
// \returns the range indices or (-1,-1) if unsuccessful.
|
||||
static Pair<label> findRange
|
||||
(
|
||||
const UList<instant>& times,
|
||||
const scalar timeVal,
|
||||
const label start = -1
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -778,7 +778,7 @@ bool Foam::functionObjectList::execute()
|
||||
|
||||
propsDictPtr_->writeObject
|
||||
(
|
||||
IOstreamOption(IOstream::ASCII, time_.writeCompression()),
|
||||
IOstreamOption(IOstreamOption::ASCII, time_.writeCompression()),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -226,7 +226,8 @@ bool Foam::regIOobject::read()
|
||||
|
||||
// Note: IOstream::binary flag is for all the processor comms. (Only for
|
||||
// dictionaries should it be ascii)
|
||||
bool ok = fileHandler().read(*this, masterOnly, IOstream::BINARY, type());
|
||||
bool ok =
|
||||
fileHandler().read(*this, masterOnly, IOstreamOption::BINARY, type());
|
||||
|
||||
if (oldWatchFiles.size())
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -679,7 +679,7 @@ Foam::Ostream& Foam::dimensionSet::write
|
||||
|
||||
os << token::BEGIN_SQR;
|
||||
|
||||
if (writeUnits.valid() && os.format() == IOstream::ASCII)
|
||||
if (writeUnits.valid() && os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
scalarField exponents(dimensionSet::nDimensions);
|
||||
for (int d=0; d < dimensionSet::nDimensions; ++d)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -587,7 +587,7 @@ void Foam::expressions::exprResult::writeDict
|
||||
const bool subDict
|
||||
) const
|
||||
{
|
||||
// const auto oldFmt = os.format(IOstream::ASCII);
|
||||
// const auto oldFmt = os.format(IOstreamOption::ASCII);
|
||||
|
||||
DebugInFunction
|
||||
<< Foam::name(this) << nl
|
||||
@ -631,7 +631,7 @@ void Foam::expressions::exprResult::writeField
|
||||
const word& keyword
|
||||
) const
|
||||
{
|
||||
// const auto oldFmt = os.format(IOstream::ASCII);
|
||||
// const auto oldFmt = os.format(IOstreamOption::ASCII);
|
||||
|
||||
DebugInFunction
|
||||
<< Foam::name(this) << nl
|
||||
@ -662,7 +662,7 @@ void Foam::expressions::exprResult::writeValue
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
// const auto oldFmt = os.format(IOstream::ASCII);
|
||||
// const auto oldFmt = os.format(IOstreamOption::ASCII);
|
||||
|
||||
DebugInFunction
|
||||
<< Foam::name(this) << nl
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2012-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -163,7 +163,7 @@ bool Foam::expressions::exprResultGlobals::Delete(const objectRegistry& obr)
|
||||
bool Foam::expressions::exprResultGlobals::writeData(Ostream& os) const
|
||||
{
|
||||
// Enforce ASCII to avoid any potential binary issues
|
||||
const auto oldFmt = os.format(IOstream::ASCII);
|
||||
const auto oldFmt = os.format(IOstreamOption::ASCII);
|
||||
|
||||
os << variables_;
|
||||
|
||||
@ -176,7 +176,7 @@ bool Foam::expressions::exprResultGlobals::writeData(Ostream& os) const
|
||||
bool Foam::expressions::exprResultGlobals::readData(Istream& is)
|
||||
{
|
||||
// Enforce ASCII to avoid any potential binary issues
|
||||
const auto oldFmt = is.format(IOstream::ASCII);
|
||||
const auto oldFmt = is.format(IOstreamOption::ASCII);
|
||||
|
||||
is >> variables_;
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,7 +41,7 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
dimensioned<Type>(dt)
|
||||
{
|
||||
// Read value
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +69,7 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
addWatch();
|
||||
|
||||
// Read unless NO_READ
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -221,7 +221,8 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
||||
OFstream os
|
||||
(
|
||||
pathName,
|
||||
IOstreamOption(IOstream::BINARY, streamOpt.version()), // UNCOMPRESSED
|
||||
// UNCOMPRESSED
|
||||
IOstreamOption(IOstreamOption::BINARY, streamOpt.version()),
|
||||
!isMaster // append slaves
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,7 +58,7 @@ Foam::threadedCollatedOFstream::~threadedCollatedOFstream()
|
||||
decomposedBlockData::typeName,
|
||||
pathName_,
|
||||
str(),
|
||||
IOstreamOption(IOstream::BINARY, version(), compression_),
|
||||
IOstreamOption(IOstreamOption::BINARY, version(), compression_),
|
||||
false, // append=false
|
||||
useThread_,
|
||||
headerEntries_
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2009-2016 Bernhard Gschaider
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -387,7 +387,12 @@ bool Foam::profiling::writeObject
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
return regIOobject::writeObject(IOstreamOption(IOstream::ASCII), true);
|
||||
return
|
||||
regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstreamOption::ASCII),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,7 @@ Foam::labelList Foam::csvTableReader<Type>::getComponentColumns
|
||||
labelList cols;
|
||||
|
||||
ITstream& is = dict.lookupCompat(name, compat);
|
||||
is.format(IOstream::ASCII);
|
||||
is.format(IOstreamOption::ASCII);
|
||||
is >> cols;
|
||||
dict.checkITstream(is, name);
|
||||
|
||||
@ -225,7 +225,7 @@ void Foam::csvTableReader<Type>::write(Ostream& os) const
|
||||
os.writeEntry("refColumn", refColumn_);
|
||||
|
||||
// Force writing labelList in ASCII
|
||||
const auto oldFmt = os.format(IOstream::ASCII);
|
||||
const auto oldFmt = os.format(IOstreamOption::ASCII);
|
||||
os.writeEntry("componentColumns", componentColumns_);
|
||||
os.format(oldFmt);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -235,7 +235,7 @@ void Foam::uniformInterpolationTable<Type>::write() const
|
||||
|
||||
dict.regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstream::ASCII, dict.time().writeCompression()),
|
||||
IOstreamOption(IOstreamOption::ASCII, dict.time().writeCompression()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -70,7 +70,7 @@ bool Foam::Matrix<Form, Type>::readMatrix(Istream& is)
|
||||
// The total size
|
||||
const label len = size();
|
||||
|
||||
if (is.format() == IOstream::BINARY && is_contiguous<Type>::value)
|
||||
if (is.format() == IOstreamOption::BINARY && is_contiguous<Type>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
@ -154,7 +154,7 @@ Foam::Ostream& Foam::Matrix<Form, Type>::writeMatrix
|
||||
// Rows, columns size
|
||||
os << mat.nRows() << token::SPACE << mat.nCols();
|
||||
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<Type>::value)
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<Type>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ Foam::schemesLookup::schemesLookup
|
||||
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||
)
|
||||
{
|
||||
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
readOpt(IOobject::MUST_READ_IF_MODIFIED);
|
||||
addWatch();
|
||||
}
|
||||
|
||||
|
||||
@ -49,31 +49,35 @@ static const Foam::List<Foam::word> subDictNames
|
||||
|
||||
void Foam::solution::read(const dictionary& dict)
|
||||
{
|
||||
if (dict.found("cache"))
|
||||
const dictionary* dictptr;
|
||||
|
||||
if ((dictptr = dict.findDict("cache")) != nullptr)
|
||||
{
|
||||
cache_ = dict.subDict("cache");
|
||||
cache_ = *dictptr;
|
||||
caching_ = cache_.getOrDefault("active", true);
|
||||
}
|
||||
|
||||
if (dict.found("relaxationFactors"))
|
||||
if ((dictptr = dict.findDict("relaxationFactors")) != nullptr)
|
||||
{
|
||||
const dictionary& relaxDict = dict.subDict("relaxationFactors");
|
||||
const dictionary& relaxDict = *dictptr;
|
||||
|
||||
if (relaxDict.found("fields") || relaxDict.found("equations"))
|
||||
bool needsCompat = true;
|
||||
|
||||
if ((dictptr = relaxDict.findDict("fields")) != nullptr)
|
||||
{
|
||||
if (relaxDict.found("fields"))
|
||||
{
|
||||
fieldRelaxDict_ = relaxDict.subDict("fields");
|
||||
fieldRelaxCache_.clear();
|
||||
}
|
||||
|
||||
if (relaxDict.found("equations"))
|
||||
{
|
||||
eqnRelaxDict_ = relaxDict.subDict("equations");
|
||||
eqnRelaxCache_.clear();
|
||||
}
|
||||
needsCompat = false;
|
||||
fieldRelaxDict_ = *dictptr;
|
||||
fieldRelaxCache_.clear();
|
||||
}
|
||||
else
|
||||
|
||||
if ((dictptr = relaxDict.findDict("equations")) != nullptr)
|
||||
{
|
||||
needsCompat = false;
|
||||
eqnRelaxDict_ = *dictptr;
|
||||
eqnRelaxCache_.clear();
|
||||
}
|
||||
|
||||
if (needsCompat)
|
||||
{
|
||||
// backwards compatibility
|
||||
fieldRelaxDict_.clear();
|
||||
@ -130,9 +134,9 @@ void Foam::solution::read(const dictionary& dict)
|
||||
<< "equations: " << eqnRelaxDict_ << endl;
|
||||
}
|
||||
|
||||
if (dict.found("solvers"))
|
||||
if ((dictptr = dict.findDict("solvers")) != nullptr)
|
||||
{
|
||||
solvers_ = dict.subDict("solvers");
|
||||
solvers_ = *dictptr;
|
||||
upgradeSolverDict(solvers_);
|
||||
}
|
||||
}
|
||||
@ -173,7 +177,7 @@ Foam::solution::solution
|
||||
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
|
||||
)
|
||||
{
|
||||
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
readOpt(IOobject::MUST_READ_IF_MODIFIED);
|
||||
addWatch();
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -280,7 +280,7 @@ Foam::point Foam::boundBox::nearest(const point& pt) const
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << bb.min_ << token::SPACE << bb.max_;
|
||||
}
|
||||
@ -300,7 +300,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is >> bb.min_ >> bb.max_;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -107,27 +107,40 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return first vertex label
|
||||
//- The first vertex
|
||||
label a() const { return labelPair::first(); }
|
||||
|
||||
//- The second vertex
|
||||
label b() const { return labelPair::second(); }
|
||||
|
||||
//- The first vertex
|
||||
label& a() { return labelPair::first(); }
|
||||
|
||||
//- The second vertex
|
||||
label& b() { return labelPair::second(); }
|
||||
|
||||
|
||||
//- The first vertex label
|
||||
using labelPair::first;
|
||||
|
||||
//- Return last (second) vertex label
|
||||
using labelPair::last;
|
||||
|
||||
//- Return second (last) vertex label
|
||||
//- The second (last) vertex label
|
||||
using labelPair::second;
|
||||
|
||||
//- The last (second) vertex label
|
||||
using labelPair::last;
|
||||
|
||||
//- Return start (first) vertex label
|
||||
inline label start() const;
|
||||
//- The start (first) vertex label
|
||||
label start() const { return labelPair::first(); }
|
||||
|
||||
//- Return start (first) vertex label
|
||||
inline label& start();
|
||||
//- The end (last/second) vertex label
|
||||
label end() const { return labelPair::second(); }
|
||||
|
||||
//- Return end (last/second) vertex label
|
||||
inline label end() const;
|
||||
//- The start (first) vertex label
|
||||
label& start() { return labelPair::first(); }
|
||||
|
||||
//- The end (last/second) vertex label
|
||||
label& end() { return labelPair::second(); }
|
||||
|
||||
//- Return end (last/second) vertex label
|
||||
inline label& end();
|
||||
|
||||
//- Return reverse edge as copy.
|
||||
// No special handling of negative point labels.
|
||||
|
||||
@ -92,29 +92,6 @@ inline Foam::edge::edge(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::edge::start() const
|
||||
{
|
||||
return first();
|
||||
}
|
||||
|
||||
inline Foam::label& Foam::edge::start()
|
||||
{
|
||||
return first();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::end() const
|
||||
{
|
||||
return second();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label& Foam::edge::end()
|
||||
{
|
||||
return second();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::minVertex() const
|
||||
{
|
||||
return (first() < second() ? first() : second());
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -139,7 +139,7 @@ inline Foam::labelledTri::labelledTri(Istream& is)
|
||||
|
||||
inline Foam::Istream& Foam::operator>>(Istream& is, labelledTri& t)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is.readBegin("labelledTri");
|
||||
|
||||
@ -164,7 +164,7 @@ inline Foam::Istream& Foam::operator>>(Istream& is, labelledTri& t)
|
||||
|
||||
inline Foam::Ostream& Foam::operator<<(Ostream& os, const labelledTri& t)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << token::BEGIN_LIST
|
||||
<< static_cast<const triFace&>(t) << token::SPACE << t.index()
|
||||
|
||||
@ -102,16 +102,35 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return first vertex label
|
||||
//- The first vertex
|
||||
label a() const { return operator[](0); }
|
||||
|
||||
//- The second vertex
|
||||
label b() const { return operator[](1); }
|
||||
|
||||
//- The third vertex
|
||||
label c() const { return operator[](2); }
|
||||
|
||||
//- The first vertex
|
||||
label& a() { return operator[](0); }
|
||||
|
||||
//- The second vertex
|
||||
label& b() { return operator[](1); }
|
||||
|
||||
//- The third vertex
|
||||
label& c() { return operator[](2); }
|
||||
|
||||
|
||||
//- The first vertex label
|
||||
using FixedList<label, 3>::first;
|
||||
|
||||
//- Return last (third) vertex label
|
||||
//- The last (third) vertex label
|
||||
using FixedList<label, 3>::last;
|
||||
|
||||
//- Return second vertex label
|
||||
//- The second vertex label
|
||||
label& second() { return operator[](1); }
|
||||
|
||||
//- Return second vertex label
|
||||
//- The second vertex label
|
||||
label second() const { return operator[](1); }
|
||||
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ namespace Foam
|
||||
// is flattened on a single line.
|
||||
static Ostream& printMaps(Ostream& os, const labelListList& maps)
|
||||
{
|
||||
if (os.format() == IOstream::BINARY || maps.empty())
|
||||
if (os.format() == IOstreamOption::BINARY || maps.empty())
|
||||
{
|
||||
os << maps;
|
||||
}
|
||||
@ -61,7 +61,7 @@ static Ostream& printMaps(Ostream& os, const labelListList& maps)
|
||||
|
||||
static void writeMaps(Ostream& os, const word& key, const labelListList& maps)
|
||||
{
|
||||
if (os.format() == IOstream::BINARY || maps.empty())
|
||||
if (os.format() == IOstreamOption::BINARY || maps.empty())
|
||||
{
|
||||
os.writeEntry(key, maps);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "vector.H"
|
||||
#include "PointHit.H"
|
||||
#include "FixedList.H"
|
||||
#include "Pair.H"
|
||||
#include "UList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -67,6 +68,55 @@ inline Ostream& operator<<(Ostream& os, const line<Point, PointRef>& l);
|
||||
typedef line<point, const point&> linePointRef;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linePoints Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Line point storage. Default constructable (line is not)
|
||||
class linePoints
|
||||
:
|
||||
public Pair<point>
|
||||
{
|
||||
public:
|
||||
|
||||
// Generated Methods
|
||||
|
||||
//- Default construct
|
||||
linePoints() = default;
|
||||
|
||||
//- Inherit constructors
|
||||
using Pair<point>::Pair;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from point references
|
||||
inline explicit linePoints(const linePointRef& pts);
|
||||
|
||||
//- Copy construct from subset of points
|
||||
inline linePoints
|
||||
(
|
||||
const UList<point>& points,
|
||||
const FixedList<label, 2>& indices
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The first vertex
|
||||
const point& a() const { return Pair<point>::first(); }
|
||||
|
||||
//- The second vertex
|
||||
const point& b() const { return Pair<point>::second(); }
|
||||
|
||||
//- The first vertex
|
||||
point& a() { return Pair<point>::first(); }
|
||||
|
||||
//- The second vertex
|
||||
point& b() { return Pair<point>::second(); }
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class line Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -106,20 +156,26 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return first point
|
||||
inline PointRef first() const noexcept { return a_; }
|
||||
//- The first point
|
||||
PointRef a() const noexcept { return a_; }
|
||||
|
||||
//- Return second (last) point
|
||||
inline PointRef second() const noexcept { return b_; }
|
||||
//- The second point
|
||||
PointRef b() const noexcept { return b_; }
|
||||
|
||||
//- Return last (second) point
|
||||
inline PointRef last() const noexcept { return b_; }
|
||||
//- The first point
|
||||
PointRef first() const noexcept { return a_; }
|
||||
|
||||
//- Return start (first) point
|
||||
inline PointRef start() const noexcept { return a_; }
|
||||
//- The second (last) point
|
||||
PointRef second() const noexcept { return b_; }
|
||||
|
||||
//- Return end (second) point
|
||||
inline PointRef end() const noexcept { return b_; }
|
||||
//- The last (second) point
|
||||
PointRef last() const noexcept { return b_; }
|
||||
|
||||
//- The start (first) point
|
||||
PointRef start() const noexcept { return a_; }
|
||||
|
||||
//- The end (second) point
|
||||
PointRef end() const noexcept { return b_; }
|
||||
|
||||
|
||||
// Properties
|
||||
@ -151,19 +207,10 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// IOstream operators
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>> <Point, PointRef>
|
||||
(
|
||||
Istream& is,
|
||||
line& l
|
||||
);
|
||||
|
||||
friend Ostream& operator<< <Point, PointRef>
|
||||
(
|
||||
Ostream& os,
|
||||
const line& l
|
||||
);
|
||||
friend Istream& operator>> <Point, PointRef>(Istream&, line&);
|
||||
friend Ostream& operator<< <Point, PointRef>(Ostream&, const line&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,22 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::linePoints::linePoints(const linePointRef& pts)
|
||||
:
|
||||
Pair<point>(pts.a(), pts.b())
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::linePoints::linePoints
|
||||
(
|
||||
const UList<point>& points,
|
||||
const FixedList<label, 2>& indices
|
||||
)
|
||||
:
|
||||
Pair<point>(points[indices.first()], points[indices.last()])
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::line<Point, PointRef>::line(const Point& from, const Point& to)
|
||||
:
|
||||
@ -46,8 +62,8 @@ inline Foam::line<Point, PointRef>::line
|
||||
const FixedList<label, 2>& indices
|
||||
)
|
||||
:
|
||||
a_(points[indices[0]]),
|
||||
b_(points[indices[1]])
|
||||
a_(points[indices.first()]),
|
||||
b_(points[indices.last()])
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -256,7 +256,7 @@ public:
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const PointIndexHit& pHit)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << pHit.hit_ << token::SPACE
|
||||
<< pHit.point_ << token::SPACE
|
||||
@ -278,7 +278,7 @@ public:
|
||||
|
||||
friend Istream& operator>>(Istream& is, PointIndexHit& pHit)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is >> pHit.hit_ >> pHit.point_ >> pHit.index_;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -84,7 +84,7 @@ Istream& List<char>::readList(Istream& is)
|
||||
|
||||
if (len)
|
||||
{
|
||||
const auto oldFmt = is.format(IOstream::BINARY);
|
||||
const auto oldFmt = is.format(IOstreamOption::BINARY);
|
||||
|
||||
// read(...) includes surrounding start/end delimiters
|
||||
is.read(list.data(), std::streamsize(len));
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,7 @@ static Ostream& writeChars
|
||||
|
||||
if (count)
|
||||
{
|
||||
const auto oldFmt = os.format(IOstream::BINARY);
|
||||
const auto oldFmt = os.format(IOstreamOption::BINARY);
|
||||
|
||||
// write(...) includes surrounding start/end delimiters
|
||||
os.write(chars, count);
|
||||
@ -163,7 +163,7 @@ Istream& UList<char>::readList(Istream& is)
|
||||
|
||||
if (len)
|
||||
{
|
||||
const auto oldFmt = is.format(IOstream::BINARY);
|
||||
const auto oldFmt = is.format(IOstreamOption::BINARY);
|
||||
|
||||
// read(...) includes surrounding start/end delimiters
|
||||
is.read(list.data(), std::streamsize(len));
|
||||
|
||||
@ -325,7 +325,7 @@ bool Foam::coordinateSystems::writeObject
|
||||
// Force ASCII, uncompressed
|
||||
return regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
IOstreamOption(IOstreamOption::ASCII),
|
||||
valid
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,7 +45,7 @@ Foam::labelList Foam::Function1Types::CSV<Type>::getComponentColumns
|
||||
labelList cols;
|
||||
|
||||
ITstream& is = dict.lookup(name);
|
||||
is.format(IOstream::ASCII);
|
||||
is.format(IOstreamOption::ASCII);
|
||||
is >> cols;
|
||||
dict.checkITstream(is, name);
|
||||
|
||||
@ -261,7 +261,7 @@ void Foam::Function1Types::CSV<Type>::writeEntries(Ostream& os) const
|
||||
os.writeEntry("refColumn", refColumn_);
|
||||
|
||||
// Force writing labelList in ASCII
|
||||
const auto oldFmt = os.format(IOstream::ASCII);
|
||||
const auto oldFmt = os.format(IOstreamOption::ASCII);
|
||||
os.writeEntry("componentColumns", componentColumns_);
|
||||
os.format(oldFmt);
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ inline T& Foam::Pair<T>::second() noexcept
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::Pair<T>::other(const T& a) const
|
||||
inline const T& Foam::Pair<T>::other(const T& val) const
|
||||
{
|
||||
if (first() == second())
|
||||
{
|
||||
@ -139,15 +139,15 @@ inline const T& Foam::Pair<T>::other(const T& a) const
|
||||
<< "Call to other only valid for Pair with differing elements:"
|
||||
<< *this << abort(FatalError);
|
||||
}
|
||||
else if (a == first())
|
||||
else if (val == first())
|
||||
{
|
||||
return second();
|
||||
}
|
||||
else if (a != second())
|
||||
else if (val != second())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Pair " << *this
|
||||
<< " does not contain " << a << abort(FatalError);
|
||||
<< " does not contain " << val << abort(FatalError);
|
||||
}
|
||||
|
||||
return first();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -100,7 +100,7 @@ void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const
|
||||
ioObj.writeHeader(os);
|
||||
|
||||
os << interfaces_;
|
||||
ioObj.writeEndDivider(os);
|
||||
IOobject::writeEndDivider(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -376,7 +376,7 @@ void Foam::fileFormats::FIREMeshReader::addPatches(polyMesh& mesh) const
|
||||
|
||||
bool Foam::fileFormats::FIREMeshReader::readGeometry(const scalar scaleFactor)
|
||||
{
|
||||
IOstreamOption::streamFormat fmt = IOstream::ASCII;
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::ASCII;
|
||||
|
||||
const word ext(geometryFile_.ext());
|
||||
|
||||
@ -387,11 +387,11 @@ bool Foam::fileFormats::FIREMeshReader::readGeometry(const scalar scaleFactor)
|
||||
FIRECore::fileExt3d fireFileType = FIRECore::file3dExtensions[ext];
|
||||
if (fireFileType == FIRECore::POLY_ASCII)
|
||||
{
|
||||
fmt = IOstream::ASCII;
|
||||
fmt = IOstreamOption::ASCII;
|
||||
}
|
||||
else if (fireFileType == FIRECore::POLY_BINARY)
|
||||
{
|
||||
fmt = IOstream::BINARY;
|
||||
fmt = IOstreamOption::BINARY;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,17 +38,21 @@ bool Foam::fileFormats::FIREMeshWriter::compress = false;
|
||||
bool Foam::fileFormats::FIREMeshWriter::prefixBoundary = true;
|
||||
|
||||
|
||||
//! \cond fileScope
|
||||
//- Output newline in ascii mode, no-op in binary mode
|
||||
inline static void newline(Foam::OSstream& os)
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
if (os.format() == Foam::IOstream::ASCII)
|
||||
|
||||
// Output newline in ascii mode, no-op in binary mode
|
||||
inline void newline(Foam::OSstream& os)
|
||||
{
|
||||
if (os.format() == Foam::IOstreamOption::ASCII)
|
||||
{
|
||||
os << Foam::endl;
|
||||
}
|
||||
}
|
||||
|
||||
//! \endcond
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -316,9 +320,15 @@ bool Foam::fileFormats::FIREMeshWriter::write(const fileName& meshName) const
|
||||
new OFstream
|
||||
(
|
||||
filename,
|
||||
(useBinary ? IOstream::BINARY : IOstream::ASCII),
|
||||
IOstream::currentVersion,
|
||||
(useCompress ? IOstream::COMPRESSED : IOstream::UNCOMPRESSED)
|
||||
(
|
||||
useBinary
|
||||
? IOstreamOption::BINARY : IOstreamOption::ASCII
|
||||
),
|
||||
IOstreamOption::currentVersion,
|
||||
(
|
||||
useCompress
|
||||
? IOstreamOption::COMPRESSED : IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -208,7 +208,7 @@ Foam::Ostream& Foam::operator<<
|
||||
const directionInfo& rhs
|
||||
)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << rhs.index_ << rhs.n_;
|
||||
}
|
||||
@ -232,7 +232,7 @@ Foam::Istream& Foam::operator>>
|
||||
directionInfo& rhs
|
||||
)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is >> rhs.index_ >> rhs.n_;
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -83,7 +84,7 @@ Foam::refineCell::refineCell(Istream& is)
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const refineCell& r)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << r.cellNo() << token::SPACE << r.direction();
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,7 @@ Foam::Ostream& Foam::operator<<
|
||||
const wallNormalInfo& rhs
|
||||
)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << rhs.normal();
|
||||
}
|
||||
@ -60,7 +60,7 @@ Foam::Istream& Foam::operator>>
|
||||
wallNormalInfo& rhs
|
||||
)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is >> rhs.normal_;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,7 @@ Foam::Ostream& Foam::operator<<
|
||||
const refinementData& rhs
|
||||
)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
os << rhs.refinementCount_ << token::SPACE << rhs.count_;
|
||||
}
|
||||
@ -60,7 +60,7 @@ Foam::Istream& Foam::operator>>
|
||||
refinementData& rhs
|
||||
)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
{
|
||||
is >> rhs.refinementCount_ >> rhs.count_;
|
||||
}
|
||||
|
||||
@ -31,6 +31,8 @@ License
|
||||
#include "cloud.H"
|
||||
#include "IOmanip.H"
|
||||
#include "OSstream.H"
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,6 +42,20 @@ const char* Foam::ensightCase::geometryName = "geometry";
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::ensightCase::padded(const int nwidth, const label value)
|
||||
{
|
||||
if (nwidth < 1)
|
||||
{
|
||||
return Foam::name(value);
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << std::setfill('0') << std::setw(nwidth) << value;
|
||||
|
||||
return word(oss.str(), false); // stripping=false
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightCase::printTimeset
|
||||
(
|
||||
OSstream& os,
|
||||
@ -456,6 +472,7 @@ Foam::ensightCase::createDataFile
|
||||
{
|
||||
// The data/ITER subdirectory must exist
|
||||
// Note that data/ITER is indeed a valid ensight::FileName
|
||||
|
||||
const fileName outdir = dataDir()/padded(timeIndex_);
|
||||
mkDir(outdir);
|
||||
|
||||
@ -526,10 +543,10 @@ Foam::ensightCase::ensightCase
|
||||
(
|
||||
const fileName& ensightDir,
|
||||
const word& caseName,
|
||||
const IOstreamOption::streamFormat format
|
||||
const IOstreamOption::streamFormat fmt
|
||||
)
|
||||
:
|
||||
options_(new options(format)),
|
||||
options_(new options(fmt)),
|
||||
os_(nullptr),
|
||||
ensightDir_(ensightDir),
|
||||
caseName_(caseName + ".case"),
|
||||
@ -698,9 +715,9 @@ void Foam::ensightCase::write() const
|
||||
|
||||
|
||||
// Field variables (always use timeset 1)
|
||||
const wordList varNames(variables_.sortedToc());
|
||||
// NB: The output file name is stricter than the variable name
|
||||
|
||||
for (const word& varName : varNames)
|
||||
for (const word& varName : variables_.sortedToc())
|
||||
{
|
||||
const string& ensType = variables_[varName];
|
||||
|
||||
@ -713,7 +730,7 @@ void Foam::ensightCase::write() const
|
||||
: " per element: 1 " // time-set 1
|
||||
)
|
||||
<< setw(15) << varName << ' '
|
||||
<< (dataMask/varName).c_str() << nl;
|
||||
<< (dataMask/ensight::FileName(varName)).c_str() << nl;
|
||||
}
|
||||
|
||||
|
||||
@ -721,6 +738,7 @@ void Foam::ensightCase::write() const
|
||||
// Write
|
||||
// as -> "data/********/lagrangian/<cloudName>/positions"
|
||||
// or -> "lagrangian/<cloudName>/********/positions"
|
||||
// NB: The output file name is stricter than the variable name
|
||||
|
||||
label cloudNo = 0;
|
||||
for (const word& cloudName : cloudNames)
|
||||
@ -744,8 +762,7 @@ void Foam::ensightCase::write() const
|
||||
<< word::printf("measured node: %-5d", tsCloud) // width 20
|
||||
<< setw(15)
|
||||
<< ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
|
||||
<< (masked/varName).c_str()
|
||||
<< nl;
|
||||
<< (masked/ensight::FileName(varName)).c_str() << nl;
|
||||
}
|
||||
|
||||
++cloudNo;
|
||||
|
||||
@ -218,7 +218,7 @@ public:
|
||||
(
|
||||
const fileName& ensightDir,
|
||||
const word& caseName,
|
||||
const IOstreamOption::streamFormat format = IOstreamOption::BINARY
|
||||
const IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
@ -226,6 +226,12 @@ public:
|
||||
~ensightCase() = default;
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Stringified zero-padded integer value
|
||||
static word padded(const int nwidth, const label value);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
@ -409,7 +415,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct with the specified format (default is binary)
|
||||
options(IOstreamOption::streamFormat format = IOstreamOption::BINARY);
|
||||
options(IOstreamOption::streamFormat fmt = IOstreamOption::BINARY);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -29,9 +29,9 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightCase::options::options(IOstreamOption::streamFormat format)
|
||||
Foam::ensightCase::options::options(IOstreamOption::streamFormat fmt)
|
||||
:
|
||||
format_(format),
|
||||
format_(fmt),
|
||||
overwrite_(false),
|
||||
nodeValues_(false),
|
||||
separateCloud_(false),
|
||||
|
||||
@ -43,7 +43,6 @@ Foam::ensightCase::newData
|
||||
if (Pstream::master())
|
||||
{
|
||||
const ensight::VarName varName(name);
|
||||
|
||||
output = createDataFile(varName);
|
||||
|
||||
// Description
|
||||
@ -90,7 +89,7 @@ Foam::ensightCase::newCloudData
|
||||
const word& name
|
||||
) const
|
||||
{
|
||||
autoPtr<Foam::ensightFile> output;
|
||||
autoPtr<ensightFile> output;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
|
||||
@ -36,57 +36,14 @@ License
|
||||
|
||||
bool Foam::ensightFile::allowUndef_ = false;
|
||||
|
||||
Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT;
|
||||
|
||||
// Default is width 8
|
||||
Foam::string Foam::ensightFile::mask_ = "********";
|
||||
Foam::string Foam::ensightFile::dirFmt_ = "%08d";
|
||||
float Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT;
|
||||
|
||||
const char* const Foam::ensightFile::coordinates = "coordinates";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::string Foam::ensightFile::mask()
|
||||
{
|
||||
return mask_;
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::ensightFile::subDir(const label n)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
sprintf(buf, dirFmt_.c_str(), n);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
void Foam::ensightFile::subDirWidth(const label n)
|
||||
{
|
||||
// enforce max limit to avoid buffer overflow in subDir()
|
||||
if (n < 1 || n > 31)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// appropriate printf format
|
||||
std::ostringstream oss;
|
||||
oss << "%0" << n << "d";
|
||||
dirFmt_ = oss.str();
|
||||
|
||||
// set mask accordingly
|
||||
mask_.resize(n, '*');
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ensightFile::subDirWidth()
|
||||
{
|
||||
return mask_.size();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::ensightFile::isUndef(const UList<scalar>& field)
|
||||
bool Foam::ensightFile::hasUndef(const UList<scalar>& field)
|
||||
{
|
||||
for (const scalar& val : field)
|
||||
{
|
||||
@ -102,13 +59,13 @@ bool Foam::ensightFile::isUndef(const UList<scalar>& field)
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightFile::initialize()
|
||||
void Foam::ensightFile::init()
|
||||
{
|
||||
// ascii formatting specs
|
||||
// The ASCII formatting specs for ensight files
|
||||
setf
|
||||
(
|
||||
ios_base::scientific,
|
||||
ios_base::floatfield
|
||||
std::ios_base::scientific,
|
||||
std::ios_base::floatfield
|
||||
);
|
||||
precision(5);
|
||||
}
|
||||
@ -119,12 +76,12 @@ void Foam::ensightFile::initialize()
|
||||
Foam::ensightFile::ensightFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption::streamFormat format
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
:
|
||||
OFstream(ensight::FileName(pathname), format)
|
||||
OFstream(ensight::FileName(pathname), fmt)
|
||||
{
|
||||
initialize();
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@ -132,42 +89,50 @@ Foam::ensightFile::ensightFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstreamOption::streamFormat format
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
:
|
||||
OFstream(path/ensight::FileName(name), format)
|
||||
OFstream(path/ensight::FileName(name), fmt)
|
||||
{
|
||||
initialize();
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::ensightFile::allowUndef()
|
||||
bool Foam::ensightFile::allowUndef() noexcept
|
||||
{
|
||||
return allowUndef_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::ensightFile::allowUndef(bool enabled)
|
||||
// float Foam::ensightFile::undefValue() noexcept
|
||||
// {
|
||||
// return undefValue_;
|
||||
// }
|
||||
|
||||
|
||||
bool Foam::ensightFile::allowUndef(bool on) noexcept
|
||||
{
|
||||
bool old = allowUndef_;
|
||||
allowUndef_ = enabled;
|
||||
allowUndef_ = on;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::ensightFile::undefValue(const scalar value)
|
||||
float Foam::ensightFile::undefValue(float value) noexcept
|
||||
{
|
||||
// enable its use too
|
||||
allowUndef_ = true;
|
||||
|
||||
scalar old = undefValue_;
|
||||
float old = undefValue_;
|
||||
undefValue_ = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::ensightFile::writeString(const char* str)
|
||||
{
|
||||
// Output 80 chars, but allocate for trailing nul character
|
||||
@ -253,14 +218,14 @@ Foam::Ostream& Foam::ensightFile::write(const int64_t val)
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::ensightFile::write(const floatScalar val)
|
||||
Foam::Ostream& Foam::ensightFile::write(const float val)
|
||||
{
|
||||
if (format() == IOstreamOption::BINARY)
|
||||
{
|
||||
write
|
||||
(
|
||||
reinterpret_cast<const char *>(&val),
|
||||
sizeof(floatScalar)
|
||||
sizeof(float)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -273,7 +238,7 @@ Foam::Ostream& Foam::ensightFile::write(const floatScalar val)
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::ensightFile::write(const doubleScalar val)
|
||||
Foam::Ostream& Foam::ensightFile::write(const double val)
|
||||
{
|
||||
float fvalue(narrowFloat(val));
|
||||
|
||||
|
||||
@ -60,19 +60,13 @@ class ensightFile
|
||||
static bool allowUndef_;
|
||||
|
||||
//- Value to represent undef in results (default: 1e+37, floatVGREAT)
|
||||
static scalar undefValue_;
|
||||
|
||||
//- The '*' mask appropriate for subDir
|
||||
static string mask_;
|
||||
|
||||
//- The printf format for zero-padded subdirectory numbers
|
||||
static string dirFmt_;
|
||||
static float undefValue_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Initialize by setting the ASCII output formatting
|
||||
void initialize();
|
||||
//- Initialize sets the ASCII output formatting
|
||||
void init();
|
||||
|
||||
//- No copy construct
|
||||
ensightFile(const ensightFile&) = delete;
|
||||
@ -83,6 +77,12 @@ class ensightFile
|
||||
|
||||
public:
|
||||
|
||||
// Public Data Types
|
||||
|
||||
//- Ensight uses \c float not \d double for floating-point
|
||||
typedef float floatType;
|
||||
|
||||
|
||||
// Static Data Members
|
||||
|
||||
//- The keyword "coordinates"
|
||||
@ -100,21 +100,21 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from pathName.
|
||||
// The entire pathName is checked for valid ensight naming.
|
||||
//- Construct from path-name.
|
||||
// The path-name is adjusted for valid ensight file naming.
|
||||
explicit ensightFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption::streamFormat format = IOstreamOption::BINARY
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
//- Construct from path and name.
|
||||
// Only the name portion is checked for valid ensight naming.
|
||||
// Only the name portion is adjusted for valid ensight file naming.
|
||||
ensightFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstreamOption::streamFormat format = IOstreamOption::BINARY
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
@ -127,31 +127,18 @@ public:
|
||||
// Access
|
||||
|
||||
//- Return setting for whether 'undef' values are allowed in results
|
||||
static bool allowUndef();
|
||||
|
||||
//- The '*' mask appropriate for subDir
|
||||
static string mask();
|
||||
|
||||
//- Consistent zero-padded numbers for subdirectories
|
||||
static string subDir(const label);
|
||||
|
||||
//- Set width of subDir and mask. Default width is 8 digits.
|
||||
// Max width is 31 digits.
|
||||
static void subDirWidth(const label);
|
||||
|
||||
//- Return current width of subDir and mask.
|
||||
static label subDirWidth();
|
||||
static bool allowUndef() noexcept;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Enable/disable use of \c undef keyword and value
|
||||
static bool allowUndef(bool enabled);
|
||||
static bool allowUndef(bool on) noexcept;
|
||||
|
||||
//- Assign the value to represent undef in the results
|
||||
// Returns the previous value
|
||||
// NB: do not use values larger than floatScalarVGREAT
|
||||
static scalar undefValue(const scalar value);
|
||||
static float undefValue(float value) noexcept;
|
||||
|
||||
|
||||
// Output
|
||||
@ -209,10 +196,10 @@ public:
|
||||
Ostream& write(const label value, const label fieldWidth);
|
||||
|
||||
//- Write floating-point as "%12.5e" or as binary
|
||||
virtual Ostream& write(const floatScalar val);
|
||||
virtual Ostream& write(const float val);
|
||||
|
||||
//- Write floating-point as "%12.5e" or as binary
|
||||
virtual Ostream& write(const doubleScalar val);
|
||||
//- Write floating-point as "%12.5e" or as binary (narrowed to float)
|
||||
virtual Ostream& write(const double val);
|
||||
|
||||
//- Add carriage return to ascii stream
|
||||
void newline();
|
||||
@ -252,11 +239,11 @@ public:
|
||||
// Other Methods
|
||||
|
||||
//- Check for any NaN in the field
|
||||
static bool isUndef(const UList<scalar>& field);
|
||||
static bool hasUndef(const UList<scalar>& field);
|
||||
|
||||
//- Check for any NaN in the field
|
||||
template<class Addr>
|
||||
static bool isUndef(const IndirectListBase<scalar, Addr>& field);
|
||||
static bool hasUndef(const IndirectListBase<scalar, Addr>& field);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,7 @@ License
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Addr>
|
||||
bool Foam::ensightFile::isUndef(const IndirectListBase<scalar, Addr>& field)
|
||||
bool Foam::ensightFile::hasUndef(const IndirectListBase<scalar, Addr>& field)
|
||||
{
|
||||
for (const scalar val : field)
|
||||
{
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightGeoFile::initialize()
|
||||
void Foam::ensightGeoFile::init()
|
||||
{
|
||||
writeBinaryHeader();
|
||||
|
||||
@ -56,12 +56,12 @@ void Foam::ensightGeoFile::initialize()
|
||||
Foam::ensightGeoFile::ensightGeoFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption::streamFormat format
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
:
|
||||
ensightFile(pathname, format)
|
||||
ensightFile(pathname, fmt)
|
||||
{
|
||||
initialize();
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@ -69,12 +69,12 @@ Foam::ensightGeoFile::ensightGeoFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstreamOption::streamFormat format
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
:
|
||||
ensightFile(path, name, format)
|
||||
ensightFile(path, name, fmt)
|
||||
{
|
||||
initialize();
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,8 +52,8 @@ class ensightGeoFile
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Initialize by outputting header information
|
||||
void initialize();
|
||||
//- Initialize outputs the header information
|
||||
void init();
|
||||
|
||||
//- No copy construct
|
||||
ensightGeoFile(const ensightGeoFile&) = delete;
|
||||
@ -75,21 +75,21 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from pathName.
|
||||
// The entire pathName is checked for valid ensight naming.
|
||||
//- Construct from path-name.
|
||||
// The path-name is adjusted for valid ensight file naming.
|
||||
explicit ensightGeoFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption::streamFormat format = IOstreamOption::BINARY
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
//- Construct from path and name.
|
||||
// Only the name portion is checked for valid ensight naming.
|
||||
// Only the name portion is adjusted for valid ensight file naming.
|
||||
ensightGeoFile
|
||||
(
|
||||
const fileName& path,
|
||||
const fileName& name,
|
||||
IOstreamOption::streamFormat format = IOstreamOption::BINARY
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user