Compare commits
1 Commits
wip-issue2
...
OpenFOAM-v
| Author | SHA1 | Date | |
|---|---|---|---|
| 76d719d1e6 |
@ -5,8 +5,6 @@ It is likely incomplete...
|
||||
|
||||
## Contributors (alphabetical by surname)
|
||||
|
||||
- Tetsuo Aoyagi
|
||||
- Akira Azami
|
||||
- William Bainbridge
|
||||
- Gabriel Barajas
|
||||
- Kutalmis Bercin
|
||||
@ -21,7 +19,6 @@ It is likely incomplete...
|
||||
- Bernhard Gschaider
|
||||
- Andrew Heather
|
||||
- David Hill
|
||||
- Yoshiaki Inoue
|
||||
- Mattijs Janssens
|
||||
- Andrew Jackson
|
||||
- Hrvoje Jasak
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_DTRMParticle_H
|
||||
#define Foam_DTRMParticle_H
|
||||
#ifndef DTRMParticle_H
|
||||
#define DTRMParticle_H
|
||||
|
||||
#include "particle.H"
|
||||
#include "IOstream.H"
|
||||
@ -50,13 +50,12 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class DTRMParticle;
|
||||
|
||||
Ostream& operator<<(Ostream&, const DTRMParticle&);
|
||||
|
||||
using namespace Foam::radiation;
|
||||
|
||||
// Forward declaration of friend functions
|
||||
Ostream& operator<<(Ostream&, const DTRMParticle&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DTRMParticle Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -131,7 +130,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
// Member functions
|
||||
|
||||
inline const interpolationCell<scalar>& aInterp() const;
|
||||
inline const interpolationCell<scalar>& eInterp() const;
|
||||
@ -233,34 +232,37 @@ public:
|
||||
// Access
|
||||
|
||||
//- Return const access to the initial position
|
||||
const point& p0() const noexcept { return p0_; }
|
||||
inline const point& p0() const;
|
||||
|
||||
//- Return const access to the target position
|
||||
const point& p1() const noexcept { return p1_; }
|
||||
inline const point& p1() const;
|
||||
|
||||
//- Return const access to the initial intensity
|
||||
scalar I0() const noexcept { return I0_; }
|
||||
inline scalar I0() const;
|
||||
|
||||
//- Return const access to the current intensity
|
||||
scalar I() const noexcept { return I_; }
|
||||
inline scalar I() const;
|
||||
|
||||
//- Return const access dA
|
||||
scalar dA() const noexcept { return dA_; }
|
||||
inline scalar dA() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to the target position
|
||||
point& p1() noexcept { return p1_; }
|
||||
inline point& p1();
|
||||
|
||||
//- Return access to the initial intensity
|
||||
scalar& I0() noexcept { return I0_; }
|
||||
inline scalar& I0();
|
||||
|
||||
//- Return access to the current intensity
|
||||
scalar& I() noexcept { return I_; }
|
||||
inline scalar& I();
|
||||
|
||||
//- Return access to dA
|
||||
scalar& dA() noexcept { return dA_; }
|
||||
inline scalar& dA();
|
||||
|
||||
//- Return access to reflectedId
|
||||
inline label& reflectedId();
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
@ -107,4 +107,58 @@ inline Foam::scalar& Foam::DTRMParticle::trackingData::Q(label celli)
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::point& Foam::DTRMParticle::p0() const
|
||||
{
|
||||
return p0_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::point& Foam::DTRMParticle::p1() const
|
||||
{
|
||||
return p1_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::DTRMParticle::I0() const
|
||||
{
|
||||
return I0_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::DTRMParticle::I() const
|
||||
{
|
||||
return I_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::DTRMParticle::dA() const
|
||||
{
|
||||
return dA_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::dA()
|
||||
{
|
||||
return dA_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::point& Foam::DTRMParticle::p1()
|
||||
{
|
||||
return p1_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::I0()
|
||||
{
|
||||
return I0_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::I()
|
||||
{
|
||||
return I_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,7 @@ Foam::DTRMParticle::DTRMParticle
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
if (is.format() == IOstreamOption::ASCII)
|
||||
if (is.format() == IOstream::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() == IOstreamOption::ASCII)
|
||||
if (os.format() == IOstream::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.writeLine(lines[pointi], lines[pointi+1]);
|
||||
os.write(linePointRef(lines[pointi], lines[pointi+1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020 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"
|
||||
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
// IOstreamOption streamOpt(IOstreamOption::ASCII);
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
// IOstream::streamFormat format = IOstream::ASCII;
|
||||
|
||||
const label size = 20000000;
|
||||
|
||||
@ -85,7 +85,11 @@ int main(int argc, char *argv[])
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
faces2.writeObject(streamOpt, true);
|
||||
faces2.writeObject
|
||||
(
|
||||
IOstreamOption(format),
|
||||
true
|
||||
);
|
||||
|
||||
Info<< "Written old format faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
@ -141,7 +145,11 @@ int main(int argc, char *argv[])
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
faces2.writeObject(streamOpt, true);
|
||||
faces2.writeObject
|
||||
(
|
||||
IOstreamOption(format),
|
||||
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, IOstreamOption::BINARY);
|
||||
OFstream os(binaryOutput, IOstream::BINARY);
|
||||
|
||||
os.writeEntry("idl1", idl1);
|
||||
os.writeEntry("idl2", idl2);
|
||||
|
||||
@ -28,14 +28,15 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "scalar.H"
|
||||
using namespace Foam;
|
||||
|
||||
#include "floatScalar.H"
|
||||
#include "doubleScalar.H"
|
||||
#include "complex.H"
|
||||
#include "Matrix.H"
|
||||
#include "Random.H"
|
||||
#include <chrono>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Total number of unit tests
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-barycentric.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-barycentric
|
||||
@ -1,2 +0,0 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
@ -1,93 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-barycentric
|
||||
|
||||
Description
|
||||
Some simple tests for barycentric coordinates and transforms
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "barycentricTensor.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "vectorField.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Tets to test
|
||||
tetPoints tetA
|
||||
(
|
||||
point(0, 0, 0),
|
||||
point(1, 0, 0),
|
||||
point(1, 1, 0),
|
||||
point(1, 1, 1)
|
||||
);
|
||||
|
||||
const barycentricTensor baryT(tetA[0], tetA[1], tetA[2], tetA[3]);
|
||||
|
||||
Info<< nl << "Tet: " << tetA << nl;
|
||||
Info<< "tens:" << baryT << nl;
|
||||
|
||||
for
|
||||
(
|
||||
const barycentric& bary :
|
||||
List<barycentric>
|
||||
({
|
||||
{0.25, 0.25, 0.25, 0.25},
|
||||
{1, 0, 0, 0},
|
||||
{0, 1, 0, 0},
|
||||
{0, 0, 1, 0},
|
||||
{0, 0, 0, 1},
|
||||
{0, 0, 0, 0} // Not really valid
|
||||
})
|
||||
)
|
||||
{
|
||||
vector v(tetA.tet().barycentricToPoint(bary));
|
||||
barycentric b(tetA.tet().pointToBarycentric(v));
|
||||
|
||||
Info<< nl
|
||||
<< "bary: " << bary << nl
|
||||
<< "vec: " << v << nl
|
||||
// << "Vec: " << baryT.inner(bary) << nl
|
||||
<< "Vec: " << (baryT & bary) << nl
|
||||
<< "bary: " << b << nl
|
||||
// This won't work (needs a differently defined tensor)
|
||||
// << "Bary: " << (v & baryT) << nl
|
||||
;
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -78,8 +78,8 @@ int main(int argc, char *argv[])
|
||||
OFstream os
|
||||
(
|
||||
objPath,
|
||||
IOstreamOption::BINARY,
|
||||
IOstreamOption::currentVersion,
|
||||
IOstream::BINARY,
|
||||
IOstream::currentVersion,
|
||||
runTime.writeCompression()
|
||||
);
|
||||
if (!os.good())
|
||||
|
||||
@ -42,7 +42,7 @@ namespace Foam
|
||||
// Something like an internal state field. Probably only dimensionless
|
||||
typedef DimensionedField<uint8_t, volMesh> dimUint8Field;
|
||||
|
||||
defineTemplateTypeNameAndDebug(dimUint8Field, 0);
|
||||
defineTemplate2TypeNameAndDebug(dimUint8Field, 0);
|
||||
|
||||
} // End namespace Foam
|
||||
#endif
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -82,7 +82,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< nl << "hash-like functionality" << nl;
|
||||
|
||||
e4.clear();
|
||||
// doesn't work e4 = -1;
|
||||
e4.start() = e4.end() = -1;
|
||||
|
||||
printInfo(e4);
|
||||
for (label i : {2, -1, 2, 1, 4, 1, 2, 3})
|
||||
@ -92,24 +93,24 @@ int main(int argc, char *argv[])
|
||||
printInfo(e4);
|
||||
}
|
||||
|
||||
e4.clear();
|
||||
e4.start() = e4.end() = -1;
|
||||
Info<< "insert from list\n";
|
||||
labelHashSet newIndices({2, -1, 2, 1, 4, 1, 2, 3});
|
||||
e4.insert(newIndices.toc());
|
||||
printInfo(e4);
|
||||
|
||||
e4.clear();
|
||||
e4.start() = e4.end() = -1;
|
||||
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.clear();
|
||||
e4.start() = e4.end() = -1;
|
||||
Info<< "insert from list: " << otherIndices << nl;
|
||||
e4.insert(otherIndices);
|
||||
printInfo(e4);
|
||||
|
||||
e4.a() = e4.b();
|
||||
e4.start() = e4.end();
|
||||
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-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017 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", IOstreamOption::ASCII);
|
||||
OFstream os(args.caseName() + ".graph", IOstream::ASCII);
|
||||
|
||||
os << "%% metis graph file, of an OpenFOAM mesh %%" << nl
|
||||
<< "%% nCells=" << mesh.nCells()
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Foam
|
||||
{
|
||||
typedef GeometricField<vector2D, fvPatchField, volMesh> volVector2DField;
|
||||
|
||||
defineTemplateTypeNameAndDebug(volVector2DField::Internal, 0);
|
||||
defineTemplate2TypeNameAndDebug(volVector2DField::Internal, 0);
|
||||
defineTemplateTypeNameAndDebug(volVector2DField, 0);
|
||||
|
||||
typedef fvPatchField<vector2D> fvPatchVector2DField;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,31 +30,11 @@ 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:
|
||||
|
||||
@ -68,7 +48,6 @@ 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");
|
||||
@ -82,19 +61,6 @@ 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-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,11 +24,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Print some numerical limits.
|
||||
Print max limits.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include "int.H"
|
||||
#include "uint.H"
|
||||
@ -38,63 +37,21 @@ 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 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;
|
||||
//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;
|
||||
|
||||
cout<< nl;
|
||||
Info<< nl;
|
||||
|
||||
cout<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
|
||||
cout<< "int32:" << pTraits<int32_t>::max << nl;
|
||||
@ -102,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
cout<< "int64:" << pTraits<int64_t>::max << nl;
|
||||
cout<< "uint64:" << pTraits<uint64_t>::max << nl;
|
||||
|
||||
cout<< nl << "=digits=" << nl;
|
||||
Info<< nl << "=digits=" << nl;
|
||||
|
||||
cout<< "int16:" << std::numeric_limits<int16_t>::digits << nl;
|
||||
cout<< "int32:" << std::numeric_limits<int32_t>::digits << nl;
|
||||
@ -113,15 +70,29 @@ int main(int argc, char *argv[])
|
||||
cout<< "double:" << std::numeric_limits<double>::digits << nl;
|
||||
cout<< "long double:" << std::numeric_limits<long double>::digits << nl;
|
||||
|
||||
// std::nanl (long double)
|
||||
cout<< nl;
|
||||
cout<< nl << "=float=" << nl;
|
||||
PrintFloatLimits(float, nanf);
|
||||
Info<< nl << "=float=" << nl;
|
||||
|
||||
cout<< nl << "=double=" << nl;
|
||||
PrintFloatLimits(double, nan);
|
||||
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<< "---\nEnd\n" << std::endl;
|
||||
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;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -38,7 +38,8 @@ Description
|
||||
|
||||
#include "DiagonalMatrix.H"
|
||||
#include "RectangularMatrix.H"
|
||||
#include "scalar.H"
|
||||
#include "floatScalar.H"
|
||||
#include "doubleScalar.H"
|
||||
#include "complex.H"
|
||||
#include "TestTools.H"
|
||||
|
||||
|
||||
@ -44,7 +44,8 @@ Note
|
||||
|
||||
#include "RectangularMatrix.H"
|
||||
#include "SquareMatrix.H"
|
||||
#include "scalar.H"
|
||||
#include "floatScalar.H"
|
||||
#include "doubleScalar.H"
|
||||
#include "complex.H"
|
||||
#include "IOmanip.H"
|
||||
#include "TestTools.H"
|
||||
|
||||
@ -45,7 +45,8 @@ Note
|
||||
#include "scalarMatrices.H"
|
||||
#include "RectangularMatrix.H"
|
||||
#include "SquareMatrix.H"
|
||||
#include "scalar.H"
|
||||
#include "floatScalar.H"
|
||||
#include "doubleScalar.H"
|
||||
#include "complex.H"
|
||||
#include "IOmanip.H"
|
||||
#include "TestTools.H"
|
||||
|
||||
@ -46,7 +46,8 @@ Note
|
||||
#include "RectangularMatrix.H"
|
||||
#include "SquareMatrix.H"
|
||||
#include "SymmetricSquareMatrix.H"
|
||||
#include "scalar.H"
|
||||
#include "floatScalar.H"
|
||||
#include "doubleScalar.H"
|
||||
#include "complex.H"
|
||||
#include "IOmanip.H"
|
||||
#include "Random.H"
|
||||
|
||||
@ -38,7 +38,7 @@ Description
|
||||
#include "polyMesh.H"
|
||||
#include "ListOps.H"
|
||||
#include "face.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "triFaceList.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 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), IOstreamOption::BINARY);
|
||||
OListStream os(std::move(buf), IOstream::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, IOstreamOption::BINARY);
|
||||
UIListStream is(buf, IOstream::BINARY);
|
||||
is.setScalarByteSize(sizeof(otherType));
|
||||
|
||||
Info<< "Stream scalar-size ("
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +31,7 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tetrahedron.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
#include "cut.H"
|
||||
@ -45,12 +44,12 @@ void writeOBJ
|
||||
(
|
||||
Ostream& os,
|
||||
label& vertI,
|
||||
const tetPoints& tet
|
||||
const FixedList<point, 4>& tet
|
||||
)
|
||||
{
|
||||
for (const point& p : tet)
|
||||
forAll(tet, fp)
|
||||
{
|
||||
meshTools::writeOBJ(os, p);
|
||||
meshTools::writeOBJ(os, tet[fp]);
|
||||
}
|
||||
os << "l " << vertI+1 << ' ' << vertI+2 << nl
|
||||
<< "l " << vertI+1 << ' ' << vertI+3 << nl
|
||||
@ -62,27 +61,33 @@ void writeOBJ
|
||||
}
|
||||
|
||||
|
||||
tetPointRef makeTetPointRef(const FixedList<point, 4>& p)
|
||||
{
|
||||
return tetPointRef(p[0], p[1], p[2], p[3]);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Tets to test
|
||||
tetPoints tetA
|
||||
(
|
||||
FixedList<point, 4> tetA
|
||||
({
|
||||
point(0, 0, 0),
|
||||
point(1, 0, 0),
|
||||
point(1, 1, 0),
|
||||
point(1, 1, 1)
|
||||
);
|
||||
tetPoints tetB
|
||||
(
|
||||
});
|
||||
FixedList<point, 4> tetB
|
||||
({
|
||||
point(0.1, 0.1, 0.1),
|
||||
point(1.1, 0.1, 0.1),
|
||||
point(1.1, 1.1, 0.1),
|
||||
point(1.1, 1.1, 1.1)
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
// Do intersection
|
||||
typedef DynamicList<tetPoints> tetList;
|
||||
typedef DynamicList<FixedList<point, 4>> tetList;
|
||||
tetList tetsIn1, tetsIn2, tetsOut;
|
||||
cut::appendOp<tetList> tetOpIn1(tetsIn1);
|
||||
cut::appendOp<tetList> tetOpIn2(tetsIn2);
|
||||
@ -150,25 +155,25 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Check the volumes
|
||||
Info<< "Vol A: " << tetA.tet().mag() << endl;
|
||||
Info<< "Vol A: " << makeTetPointRef(tetA).mag() << endl;
|
||||
|
||||
scalar volIn = 0;
|
||||
for (const auto& t : tetsIn)
|
||||
forAll(tetsIn, i)
|
||||
{
|
||||
volIn += t.tet().mag();
|
||||
volIn += makeTetPointRef(tetsIn[i]).mag();
|
||||
}
|
||||
Info<< "Vol A inside B: " << volIn << endl;
|
||||
|
||||
scalar volOut = 0;
|
||||
for (const auto& t : tetsOut)
|
||||
forAll(tetsOut, i)
|
||||
{
|
||||
volOut += t.tet().mag();
|
||||
volOut += makeTetPointRef(tetsOut[i]).mag();
|
||||
}
|
||||
Info<< "Vol A outside B: " << volOut << endl;
|
||||
|
||||
Info<< "Sum inside and outside: " << volIn + volOut << endl;
|
||||
|
||||
if (mag(volIn + volOut - tetA.tet().mag()) > SMALL)
|
||||
if (mag(volIn + volOut - makeTetPointRef(tetA).mag()) > SMALL)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Tet volumes do not sum up to input tet."
|
||||
|
||||
@ -42,7 +42,7 @@ namespace Foam
|
||||
// - still needs some basic boundary conditions!!
|
||||
typedef GeometricField<uint8_t, fvPatchField, volMesh> volUint8Field;
|
||||
|
||||
defineTemplateTypeNameAndDebug(volUint8Field, 0);
|
||||
defineTemplate2TypeNameAndDebug(volUint8Field, 0);
|
||||
|
||||
} // End namespace Foam
|
||||
#endif
|
||||
|
||||
@ -1397,20 +1397,26 @@ void extrudeGeometricProperties
|
||||
{
|
||||
Pout<< "Model :" << faceCentres[facei] << endl
|
||||
<< "regionMesh:" << regionMesh.faceCentres()[facei] << endl;
|
||||
faceStr.writeLine
|
||||
faceStr.write
|
||||
(
|
||||
faceCentres[facei],
|
||||
regionMesh.faceCentres()[facei]
|
||||
linePointRef
|
||||
(
|
||||
faceCentres[facei],
|
||||
regionMesh.faceCentres()[facei]
|
||||
)
|
||||
);
|
||||
}
|
||||
forAll(cellCentres, celli)
|
||||
{
|
||||
Pout<< "Model :" << cellCentres[celli] << endl
|
||||
<< "regionMesh:" << regionMesh.cellCentres()[celli] << endl;
|
||||
cellStr.writeLine
|
||||
cellStr.write
|
||||
(
|
||||
cellCentres[celli],
|
||||
regionMesh.cellCentres()[celli]
|
||||
linePointRef
|
||||
(
|
||||
cellCentres[celli],
|
||||
regionMesh.cellCentres()[celli]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ void Foam::PrintTable<KeyType, DataType>::print
|
||||
|
||||
os << endl;
|
||||
|
||||
const List<KeyType> sortedTable(combinedTable.sortedToc());
|
||||
const List<KeyType>& sortedTable = combinedTable.sortedToc();
|
||||
|
||||
forAll(sortedTable, keyI)
|
||||
{
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
#include "pointIOField.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "triadIOField.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "plane.H"
|
||||
#include "transform.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
|
||||
#include "fileControl.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "scalarList.H"
|
||||
#include "vectorTools.H"
|
||||
#include "pointIOField.H"
|
||||
@ -49,6 +50,9 @@ addToRunTimeSelectionTable
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fileControl::fileControl
|
||||
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "cellSizeFunction.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "searchableBox.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "vectorTools.H"
|
||||
#include "quaternion.H"
|
||||
|
||||
|
||||
@ -1687,7 +1687,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
)
|
||||
)
|
||||
{
|
||||
multipleIntersections.writeLine(ptA, ptB);
|
||||
multipleIntersections.write(linePointRef(ptA, ptB));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
// Forward declaration of classes
|
||||
class initialPointsMethod;
|
||||
class relaxationModel;
|
||||
class faceAreaWeightModel;
|
||||
|
||||
@ -1433,15 +1433,18 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
// && (mag(snapDir & norm[0]) > 0.5)
|
||||
// )
|
||||
// {
|
||||
// snapping1.writeLine
|
||||
// snapping1.write
|
||||
// (
|
||||
// dual,
|
||||
// nearestPointOnTet
|
||||
// linePointRef(dual, nearestPointOnTet)
|
||||
// );
|
||||
// snapping2.writeLine
|
||||
//
|
||||
// snapping2.write
|
||||
// (
|
||||
// nearestPointOnTet,
|
||||
// hitInfo.hitPoint()
|
||||
// linePointRef
|
||||
// (
|
||||
// nearestPointOnTet,
|
||||
// hitInfo.hitPoint()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// pts[cit->cellIndex()] = hitInfo.hitPoint();
|
||||
@ -1761,10 +1764,9 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
|
||||
if ((*vcit)->real())
|
||||
{
|
||||
featurePointDualsStr.writeLine
|
||||
featurePointDualsStr.write
|
||||
(
|
||||
topoint(vit->point()),
|
||||
(*vcit)->dual()
|
||||
linePointRef(topoint(vit->point()), (*vcit)->dual())
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1865,7 +1867,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
<< " " << vc2->dual()
|
||||
<< endl;
|
||||
|
||||
startCellStr.writeLine(vc1->dual(), vc2->dual());
|
||||
startCellStr.write(linePointRef(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,7 +1395,10 @@ void Foam::conformalVoronoiMesh::writePointPairs
|
||||
|
||||
if (ptPairs_.isPointPair(vA, vB))
|
||||
{
|
||||
os.writeLine(topoint(vA->point()), topoint(vB->point()));
|
||||
os.write
|
||||
(
|
||||
linePointRef(topoint(vA->point()), topoint(vB->point()))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "plane.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "pointConversion.H"
|
||||
#include "CGALTriangulation3DKernel.H"
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 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() == IOstreamOption::ASCII && mergeTol < writeTol)
|
||||
if (runTime.writeFormat() == IOstream::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() == IOstreamOption::ASCII && !dryRun)
|
||||
if (mesh.time().writeFormat() == IOstream::ASCII && !dryRun)
|
||||
{
|
||||
const scalar writeTol = std::pow
|
||||
(
|
||||
@ -1342,17 +1342,6 @@ int main(int argc, char *argv[])
|
||||
const snapParameters snapParams(snapDict, dryRun);
|
||||
|
||||
|
||||
Info<< "Setting refinement level of surface to be consistent"
|
||||
<< " with curvature." << endl;
|
||||
surfaces.setCurvatureMinLevelFields
|
||||
(
|
||||
refineParams.curvature(),
|
||||
meshRefiner.meshCutter().level0EdgeLength()
|
||||
);
|
||||
Info<< "Checked curvature refinement in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
|
||||
// Add all the cellZones and faceZones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "polyMeshTools.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "syncTools.H"
|
||||
#include "tetrahedron.H"
|
||||
#include "tetPointRef.H"
|
||||
#include "regionSplit.H"
|
||||
#include "wallDist.H"
|
||||
#include "cellAspectRatio.H"
|
||||
|
||||
@ -606,7 +606,7 @@ void syncPoints
|
||||
pointField nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
// so cannot use UIPstream::read
|
||||
// so cannot use Pstream::read.
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,30 +55,17 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"deltaT",
|
||||
"time",
|
||||
"Override deltaT (eg, for accelerated motion)"
|
||||
);
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"endTime",
|
||||
"time",
|
||||
"Override endTime (eg, for shorter tests)"
|
||||
"Override deltaT for accelerated motion"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
scalar timeVal = 0;
|
||||
if (args.readIfPresent("deltaT", timeVal))
|
||||
scalar deltaT = 0;
|
||||
if (args.readIfPresent("deltaT", deltaT))
|
||||
{
|
||||
runTime.setDeltaT(timeVal);
|
||||
}
|
||||
|
||||
if (args.readIfPresent("endTime", timeVal))
|
||||
{
|
||||
runTime.stopAt(Time::stopAtControls::saEndTime);
|
||||
runTime.setEndTime(timeVal);
|
||||
runTime.setDeltaT(deltaT);
|
||||
}
|
||||
|
||||
autoPtr<motionSolver> motionPtr = motionSolver::New(mesh);
|
||||
|
||||
@ -43,7 +43,7 @@ Description
|
||||
static void usage();
|
||||
static void version();
|
||||
static std::string getLine(const std::string&, const std::string&);
|
||||
static std::string pipeOpen(const std::string& cmd, const int lineNum = 0);
|
||||
static std::string pOpen(const std::string&, int line=0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -132,50 +132,51 @@ void version()
|
||||
}
|
||||
|
||||
|
||||
// Read up to and including lineNum from the piped command
|
||||
// Return the final line read
|
||||
std::string pipeOpen(const std::string& cmd, int lineNum)
|
||||
std::string pOpen(const std::string& cmd, int line)
|
||||
{
|
||||
std::string str;
|
||||
std::string res;
|
||||
|
||||
FILE* handle = popen(cmd.c_str(), "r");
|
||||
if (!handle) return str;
|
||||
FILE* cmdPipe = popen(cmd.c_str(), "r");
|
||||
if (!cmdPipe) return res;
|
||||
|
||||
char* buf = nullptr;
|
||||
size_t len = 0;
|
||||
ssize_t nread;
|
||||
|
||||
// Read lineNum number of lines
|
||||
for
|
||||
(
|
||||
int cnt = 0;
|
||||
cnt <= lineNum && (nread = ::getline(&buf, &len, handle)) >= 0;
|
||||
++cnt
|
||||
)
|
||||
// Read line number of lines
|
||||
for (int cnt = 0; cnt <= line; ++cnt)
|
||||
{
|
||||
if (cnt == lineNum)
|
||||
{
|
||||
// Retain the last line, trimming trailing newline
|
||||
str.assign(buf);
|
||||
size_t linecap = 0;
|
||||
ssize_t linelen = ::getline(&buf, &linecap, cmdPipe);
|
||||
|
||||
if (str.size())
|
||||
if (linelen < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (cnt == line)
|
||||
{
|
||||
res = std::string(buf);
|
||||
|
||||
// Trim trailing newline
|
||||
if (res.size())
|
||||
{
|
||||
str.resize(str.size()-1);
|
||||
res.resize(res.size()-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(buf);
|
||||
pclose(handle);
|
||||
if (buf) free(buf);
|
||||
|
||||
return str;
|
||||
pclose(cmdPipe);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
std::string getLine(const std::string& filename, const std::string& addr)
|
||||
{
|
||||
std::string line =
|
||||
pipeOpen
|
||||
pOpen
|
||||
(
|
||||
"echo 'image lookup -va " + addr
|
||||
+ "'"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -160,7 +160,7 @@ bool writeZones
|
||||
// Force writing as ASCII
|
||||
writeOk = meshObject.regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstreamOption::ASCII, compression),
|
||||
IOstreamOption(IOstream::ASCII, compression),
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -355,7 +355,7 @@ int main(int argc, char *argv[])
|
||||
runTime
|
||||
);
|
||||
|
||||
if (runTime.writeFormat() == IOstreamOption::ASCII)
|
||||
if (runTime.writeFormat() == IOstream::ASCII)
|
||||
{
|
||||
// Only do zones when converting from binary to ascii
|
||||
// The other way gives problems since working on dictionary level.
|
||||
|
||||
@ -663,11 +663,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Merge tolerance : " << mergeTol << nl
|
||||
<< "Write tolerance : " << writeTol << endl;
|
||||
|
||||
if
|
||||
(
|
||||
runTime.writeFormat() == IOstreamOption::ASCII
|
||||
&& mergeTol < writeTol
|
||||
)
|
||||
if (runTime.writeFormat() == IOstream::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-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,8 +35,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_passivePositionParticle_H
|
||||
#define Foam_passivePositionParticle_H
|
||||
#ifndef passivePositionParticle_H
|
||||
#define passivePositionParticle_H
|
||||
|
||||
#include "passiveParticle.H"
|
||||
|
||||
@ -130,9 +130,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const point& cachedPosition() const noexcept
|
||||
const point& cachedPosition() const
|
||||
{
|
||||
return cachedPosition_;
|
||||
}
|
||||
@ -159,7 +157,7 @@ public:
|
||||
p.origProc = ppi.origProc();
|
||||
p.origId = ppi.origId();
|
||||
|
||||
if (os.format() == IOstreamOption::ASCII)
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << p.position
|
||||
<< token::SPACE << p.celli
|
||||
|
||||
@ -232,13 +232,13 @@ vtk::outputOptions getOutputOptions(const argList& args)
|
||||
|
||||
if (!args.found("ascii"))
|
||||
{
|
||||
if (sizeof(float) != 4 || sizeof(label) != 4)
|
||||
if (sizeof(floatScalar) != 4 || sizeof(label) != 4)
|
||||
{
|
||||
opts.ascii(true);
|
||||
|
||||
WarningInFunction
|
||||
<< "Using ASCII rather than legacy binary VTK format since "
|
||||
<< "float and/or label are not 4 bytes in size."
|
||||
<< "floatScalar and/or label are not 4 bytes in size."
|
||||
<< nl << endl;
|
||||
}
|
||||
else
|
||||
|
||||
@ -390,7 +390,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
summary.writeHeader(os);
|
||||
summary.writeData(os);
|
||||
IOobject::writeEndDivider(os);
|
||||
summary.writeEndDivider(os);
|
||||
|
||||
Info<< "Wrote to " << outputName << nl << endl;
|
||||
}
|
||||
|
||||
@ -662,8 +662,8 @@ int main(int argc, char *argv[])
|
||||
// Read dictionary
|
||||
// Note: disable class type checking so we can load field
|
||||
Info<< "Loading dictionary " << fieldName << endl;
|
||||
const word oldTypeName = localIOdictionary::typeName;
|
||||
const_cast<word&>(localIOdictionary::typeName) = word::null;
|
||||
const word oldTypeName = IOdictionary::typeName;
|
||||
const_cast<word&>(IOdictionary::typeName) = word::null;
|
||||
|
||||
IOobject fieldHeader
|
||||
(
|
||||
@ -675,15 +675,11 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (fieldHeader.typeHeaderOk<localIOdictionary>(false))
|
||||
if (fieldHeader.typeHeaderOk<IOdictionary>(false))
|
||||
{
|
||||
//IOdictionary fieldDict(fieldHeader);
|
||||
//- dictionaries to-be-changed are either boundary
|
||||
// or field dictionary. Both are processor-local.
|
||||
localIOdictionary fieldDict(fieldHeader);
|
||||
IOdictionary fieldDict(fieldHeader);
|
||||
|
||||
const_cast<word&>(localIOdictionary::typeName) =
|
||||
oldTypeName;
|
||||
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
|
||||
|
||||
// Fake type back to what was in field
|
||||
const_cast<word&>(fieldDict.type()) =
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -199,7 +199,7 @@ void createFieldFiles
|
||||
|
||||
fieldOut.regIOobject::writeObject
|
||||
(
|
||||
IOstreamOption(IOstreamOption::ASCII),
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020,2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -96,15 +96,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
label nCoarseFaces = 0;
|
||||
|
||||
|
||||
const auto& patchesDict =
|
||||
agglomDict.optionalSubDict
|
||||
(
|
||||
"patchAgglomeration",
|
||||
keyType::LITERAL
|
||||
);
|
||||
|
||||
for (const entry& dEntry : patchesDict)
|
||||
for (const entry& dEntry : agglomDict)
|
||||
{
|
||||
labelList patchids = boundary.indices(dEntry.keyword());
|
||||
|
||||
@ -120,7 +112,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
pp.localFaces(),
|
||||
pp.localPoints(),
|
||||
dEntry.dict()
|
||||
agglomDict.subDict(pp.name())
|
||||
);
|
||||
|
||||
agglomObject.agglomerate();
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2019 PCOpt/NTUA
|
||||
Copyright (C) 2013-2019 FOSS GP
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 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(IOstreamOption::ASCII),
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ void isoFacesToFile
|
||||
{
|
||||
for (const List<point>& facePts : procFaces)
|
||||
{
|
||||
os.writeFace(facePts);
|
||||
os.write(face(identity(facePts.size())), facePts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ void isoFacesToFile
|
||||
|
||||
for (const List<point>& facePts : faces)
|
||||
{
|
||||
os.writeFace(facePts);
|
||||
os.write(face(identity(facePts.size())), facePts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 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(IOstreamOption::ASCII);
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
}
|
||||
|
||||
forAll(times, timei)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 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(IOstreamOption::ASCII);
|
||||
ctrl.streamOpt.format(IOstream::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(IOstreamOption::ASCII);
|
||||
ctrl.streamOpt.format(IOstream::ASCII);
|
||||
}
|
||||
|
||||
if (ctrl.createNew && ctrl.keepPatches)
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments # (error catching)
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_cgal
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
unset COMP_FLAGS LINK_FLAGS
|
||||
|
||||
if have_cgal
|
||||
then
|
||||
echo " found CGAL -- enabling CGAL support."
|
||||
else
|
||||
echo " did not find CGAL -- disabling CGAL functionality"
|
||||
export COMP_FLAGS="-DNO_CGAL"
|
||||
fi
|
||||
|
||||
wmake $targetType
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,18 +1,10 @@
|
||||
include $(GENERAL_RULES)/cgal-header-only
|
||||
|
||||
EXE_INC = \
|
||||
-Wno-old-style-cast \
|
||||
$(COMP_FLAGS) \
|
||||
${CGAL_INC} \
|
||||
-DCGAL_HEADER_ONLY \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/distributed/lnInclude
|
||||
|
||||
-I$(LIB_SRC)/parallel/distributed/lnInclude \
|
||||
|
||||
EXE_LIBS = \
|
||||
/* ${CGAL_LIBS} */ \
|
||||
-lfiniteVolume \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
Random rndGen(653213);
|
||||
|
||||
// Determine mesh bounding boxes:
|
||||
List<treeBoundBox> meshBb
|
||||
(
|
||||
1,
|
||||
treeBoundBox
|
||||
(
|
||||
boundBox(coarseMesh.points(), false)
|
||||
).extend(rndGen, 1e-3)
|
||||
);
|
||||
|
||||
// Dummy bounds dictionary
|
||||
dictionary dict;
|
||||
dict.add("bounds", meshBb);
|
||||
dict.add
|
||||
(
|
||||
"distributionType",
|
||||
distributedTriSurfaceMesh::distributionTypeNames_
|
||||
[
|
||||
distributedTriSurfaceMesh::FROZEN
|
||||
]
|
||||
);
|
||||
dict.add("mergeDistance", SMALL);
|
||||
|
||||
labelList triSurfaceToAgglom(5*nFineFaces);
|
||||
|
||||
triSurface localSurface = triangulate
|
||||
(
|
||||
patches,
|
||||
includePatches,
|
||||
finalAgglom,
|
||||
triSurfaceToAgglom,
|
||||
globalNumbering,
|
||||
coarsePatches
|
||||
);
|
||||
|
||||
|
||||
// CGAL surface
|
||||
|
||||
distributedTriSurfaceMesh surfacesMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wallSurface.stl",
|
||||
runTime.constant(), // directory
|
||||
"triSurface", // instance
|
||||
runTime, // registry
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
localSurface,
|
||||
dict
|
||||
);
|
||||
|
||||
triSurfaceToAgglom.resize(surfacesMesh.size());
|
||||
|
||||
surfacesMesh.setField(triSurfaceToAgglom);
|
||||
|
||||
const pointField& pts = surfacesMesh.localPoints();
|
||||
|
||||
std::list<Triangle> triangles;
|
||||
|
||||
for (const auto& triLocal : surfacesMesh.localFaces())
|
||||
{
|
||||
point p1l = pts[triLocal[0]];
|
||||
point p2l = pts[triLocal[1]];
|
||||
point p3l = pts[triLocal[2]];
|
||||
|
||||
Point p1(p1l[0], p1l[1], p1l[2]);
|
||||
Point p2(p2l[0], p2l[1], p2l[2]);
|
||||
Point p3(p3l[0], p3l[1], p3l[2]);
|
||||
|
||||
Triangle tri(p1, p2, p3);
|
||||
|
||||
if (tri.is_degenerate())
|
||||
{
|
||||
std::cout << tri << std::endl;
|
||||
}
|
||||
triangles.push_back(tri);
|
||||
}
|
||||
|
||||
// constructs AABB tree
|
||||
Tree tree(triangles.begin(), triangles.end());
|
||||
@ -1,15 +1,6 @@
|
||||
// All rays expressed as start face (local) index end end face (global)
|
||||
// Pre-size by assuming a certain percentage is visible.
|
||||
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "\nShooting rays using distributedTriSurfaceMesh (no CGAL support)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Maximum length for dynamicList
|
||||
const label maxDynListLength
|
||||
(
|
||||
|
||||
@ -1,131 +0,0 @@
|
||||
// Maximum length for dynamicList
|
||||
const label maxDynListLength
|
||||
(
|
||||
viewFactorDict.getOrDefault<label>("maxDynListLength", 1000000000)
|
||||
);
|
||||
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
std::vector<Point> start;
|
||||
start.reserve(coarseMesh.nFaces());
|
||||
|
||||
std::vector<Point> end(start.size());
|
||||
end.reserve(start.size());
|
||||
|
||||
DynamicList<label> startIndex(start.size());
|
||||
DynamicList<label> endIndex(start.size());
|
||||
|
||||
DynamicList<label> startAgg(start.size());
|
||||
DynamicList<label> endAgg(start.size());
|
||||
|
||||
const pointField& myFc = remoteCoarseCf[Pstream::myProcNo()];
|
||||
const vectorField& myArea = remoteCoarseSf[Pstream::myProcNo()];
|
||||
const labelField& myAgg = remoteCoarseAgg[Pstream::myProcNo()];
|
||||
|
||||
const pointField& remoteArea = remoteCoarseSf[proci];
|
||||
const pointField& remoteFc = remoteCoarseCf[proci];
|
||||
const labelField& remoteAgg = remoteCoarseAgg[proci];
|
||||
|
||||
label i = 0;
|
||||
label j = 0;
|
||||
do
|
||||
{
|
||||
for (; i < myFc.size(); i++)
|
||||
{
|
||||
const point& fc = myFc[i];
|
||||
const vector& fA = myArea[i];
|
||||
const label& fAgg = myAgg[i];
|
||||
|
||||
for (; j < remoteFc.size(); j++)
|
||||
{
|
||||
if (proci != Pstream::myProcNo() || i != j)
|
||||
{
|
||||
const point& remFc = remoteFc[j];
|
||||
const vector& remA = remoteArea[j];
|
||||
const label& remAgg = remoteAgg[j];
|
||||
|
||||
const vector d(remFc - fc);
|
||||
|
||||
|
||||
const vector nd = d/mag(d);
|
||||
const vector nfA = fA/mag(fA);
|
||||
const vector nremA = remA/mag(remA);
|
||||
|
||||
if (((nd & nfA) < 0) && ((nd & nremA) > 0))
|
||||
{
|
||||
vector direction(d[0], d[1], d[2]);
|
||||
vector s(fc[0], fc[1], fc[2]);
|
||||
vector rayEnd(s + (1-intTol)*direction);
|
||||
end.push_back(Point(rayEnd[0], rayEnd[1], rayEnd[2]));
|
||||
|
||||
s += vector(intTol*d[0], intTol*d[1], intTol*d[2]);
|
||||
|
||||
start.push_back(Point(s[0], s[1], s[2]));
|
||||
startIndex.append(i);
|
||||
if (useAgglomeration)
|
||||
{
|
||||
startAgg.append
|
||||
(
|
||||
globalNumbering.toGlobal(proci, fAgg)
|
||||
);
|
||||
endAgg.append
|
||||
(
|
||||
globalNumbering.toGlobal(proci, remAgg)
|
||||
);
|
||||
}
|
||||
|
||||
label globalI = globalNumbering.toGlobal(proci, j);
|
||||
endIndex.append(globalI);
|
||||
|
||||
if (startIndex.size() > maxDynListLength)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Dynamic list need from capacity."
|
||||
<< "Actual size maxDynListLength : "
|
||||
<< maxDynListLength
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (j == remoteFc.size())
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} while (i < myFc.size());
|
||||
|
||||
label totalRays(startIndex.size());
|
||||
reduce(totalRays, sumOp<scalar>());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Number of rays :" << totalRays << endl;
|
||||
}
|
||||
|
||||
for (unsigned long rayI = 0; rayI < start.size(); ++rayI)
|
||||
{
|
||||
Segment ray(start[rayI], end[rayI]);
|
||||
Segment_intersection intersects = tree.any_intersection(ray);
|
||||
|
||||
if (!intersects)
|
||||
{
|
||||
rayStartFace.append(startIndex[rayI]);
|
||||
rayEndFace.append(endIndex[rayI]);
|
||||
}
|
||||
}
|
||||
start.clear();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout << "hits : " << rayStartFace.size()<< endl;
|
||||
}
|
||||
|
||||
startIndex.clear();
|
||||
end.clear();
|
||||
endIndex.clear();
|
||||
startAgg.clear();
|
||||
endAgg.clear();
|
||||
}
|
||||
@ -31,34 +31,14 @@ Group
|
||||
grpPreProcessingUtilities
|
||||
|
||||
Description
|
||||
This view factors generation application uses a combined approach of
|
||||
double area integral (2AI) and double linear integral (2LI). 2AI is used
|
||||
when the two surfaces are 'far' apart and 2LI when they are 'close'.
|
||||
2LI is integrated along edges using Gaussian quadrature.
|
||||
The distance between faces is calculating a ratio between averaged areas
|
||||
and the distance between face centres.
|
||||
View factors are calculated based on a face agglomeration array
|
||||
(finalAgglom generated by faceAgglomerate utility).
|
||||
|
||||
The input from viewFactorsDict are:
|
||||
Each view factor between the agglomerated faces i and j (Fij) is calculated
|
||||
using a double integral of the sub-areas composing the agglomeration.
|
||||
|
||||
GaussQuadTol 0.1; // GaussQuad error
|
||||
distTol 8; // R/Average(rm)
|
||||
alpha 0.22; // Use for common edges for 2LI
|
||||
|
||||
|
||||
For debugging purposes, the following entries can be set in viewFactorsDict:
|
||||
|
||||
writeViewFactorMatrix true;
|
||||
writeFacesAgglomeration false;
|
||||
dumpRays false;
|
||||
|
||||
|
||||
writeViewFactorMatrix writes the sum of the VF on each face.
|
||||
writeFacesAgglomeration writes the agglomeration
|
||||
dumpRays dumps rays
|
||||
|
||||
|
||||
The participating patches in the VF calculation have to be in the
|
||||
'viewFactorWall' patch group (in the polyMesh/boundary file), e.g.
|
||||
The patches involved in the view factor calculation are taken from the
|
||||
boundary file and should be part on the group viewFactorWall. ie.:
|
||||
|
||||
floor
|
||||
{
|
||||
@ -68,9 +48,6 @@ Description
|
||||
startFace 3100;
|
||||
}
|
||||
|
||||
Compile with -DNO_CGAL only if no CGAL present - CGAL AABB tree performs
|
||||
better than the built-in octree.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
@ -79,52 +56,21 @@ Description
|
||||
#include "surfaceFields.H"
|
||||
#include "distributedTriSurfaceMesh.H"
|
||||
#include "meshTools.H"
|
||||
#include "constants.H"
|
||||
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "DynamicField.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
#include "scalarMatrices.H"
|
||||
#include "labelListIOList.H"
|
||||
#include "scalarListIOList.H"
|
||||
|
||||
#include "singleCellFvMesh.H"
|
||||
|
||||
#include "IOmapDistribute.H"
|
||||
|
||||
#ifndef NO_CGAL
|
||||
|
||||
// Silence boost bind deprecation warnings (before CGAL-5.2.1)
|
||||
#include "CGAL/version.h"
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/AABB_triangle_primitive.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> K;
|
||||
typedef K::Point_3 Point;
|
||||
typedef K::Direction_3 Vector3C;
|
||||
typedef K::Triangle_3 Triangle;
|
||||
typedef K::Segment_3 Segment;
|
||||
|
||||
typedef std::list<Triangle>::iterator Iterator;
|
||||
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
|
||||
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
|
||||
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
|
||||
typedef boost::optional
|
||||
<
|
||||
Tree::Intersection_and_primitive_id<Segment>::Type
|
||||
> Segment_intersection;
|
||||
|
||||
#endif // NO_CGAL
|
||||
|
||||
using namespace Foam;
|
||||
using namespace Foam::constant;
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
|
||||
triSurface triangulate
|
||||
(
|
||||
@ -181,56 +127,20 @@ triSurface triangulate
|
||||
newPatchI++;
|
||||
}
|
||||
|
||||
//triSurfaceToAgglom.resize(localTriFaceI-1);
|
||||
//striSurfaceToAgglom.resize(localTriFaceI-1);
|
||||
|
||||
triangles.shrink();
|
||||
triSurface surface(triangles, mesh.points());
|
||||
surface.compactPoints();
|
||||
|
||||
// Create globally numbered tri surface
|
||||
triSurface rawSurface(triangles, mesh.points());
|
||||
|
||||
#ifndef NO_CGAL
|
||||
|
||||
// CGAL : every processor has whole surface
|
||||
|
||||
globalIndex globalFaceIdx(surface.size(), globalIndex::gatherOnly());
|
||||
globalIndex globalPointIdx
|
||||
// Create locally numbered tri surface
|
||||
triSurface surface
|
||||
(
|
||||
surface.points().size(), globalIndex::gatherOnly()
|
||||
rawSurface.localFaces(),
|
||||
rawSurface.localPoints()
|
||||
);
|
||||
|
||||
List<labelledTri> globalSurfaceTris(globalFaceIdx.gather(surface));
|
||||
pointField globalSurfacePoints(globalPointIdx.gather(surface.points()));
|
||||
|
||||
//label offset = 0;
|
||||
for (const label proci : globalPointIdx.allProcs())
|
||||
{
|
||||
const label offset = globalPointIdx.localStart(proci);
|
||||
|
||||
if (offset)
|
||||
{
|
||||
for
|
||||
(
|
||||
labelledTri& tri
|
||||
: globalSurfaceTris.slice(globalFaceIdx.range(proci))
|
||||
)
|
||||
{
|
||||
tri[0] += offset;
|
||||
tri[1] += offset;
|
||||
tri[2] += offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surface =
|
||||
triSurface
|
||||
(
|
||||
std::move(globalSurfaceTris),
|
||||
std::move(globalSurfacePoints)
|
||||
);
|
||||
|
||||
Pstream::broadcast(surface);
|
||||
#endif
|
||||
|
||||
// Add patch names to surface
|
||||
surface.patches().setSize(newPatchI);
|
||||
|
||||
@ -283,7 +193,7 @@ void writeRays
|
||||
}
|
||||
|
||||
|
||||
scalar calculateViewFactorFij2AI
|
||||
scalar calculateViewFactorFij
|
||||
(
|
||||
const vector& i,
|
||||
const vector& j,
|
||||
@ -340,74 +250,6 @@ void insertMatrixElements
|
||||
}
|
||||
|
||||
|
||||
scalar GaussQuad
|
||||
(
|
||||
|
||||
const scalarList& w,
|
||||
const scalarList& p,
|
||||
const scalar& magSi,
|
||||
const scalar& magSj,
|
||||
const vector& di,
|
||||
const vector& dj,
|
||||
const vector& ci,
|
||||
const vector& cj,
|
||||
const scalar cosij,
|
||||
const scalar alpha,
|
||||
label gi
|
||||
)
|
||||
{
|
||||
scalar dIntFij = 0;
|
||||
if (gi == 0)
|
||||
{
|
||||
vector r(ci - cj);
|
||||
if (mag(r) < SMALL)
|
||||
{
|
||||
r = (alpha*magSi)*di;
|
||||
}
|
||||
dIntFij = max(cosij*Foam::log(r&r)*magSi*magSj, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<vector> pi(w.size());
|
||||
forAll (pi, i)
|
||||
{
|
||||
pi[i] = ci + p[i]*(magSi/2)*di;
|
||||
}
|
||||
|
||||
List<vector> pj(w.size());
|
||||
forAll (pj, i)
|
||||
{
|
||||
pj[i] = cj + p[i]*(magSj/2)*dj;
|
||||
}
|
||||
|
||||
forAll (w, i)
|
||||
{
|
||||
forAll (w, j)
|
||||
{
|
||||
vector r(pi[i] - pj[j]);
|
||||
|
||||
if (mag(r) < SMALL)
|
||||
{
|
||||
r = (alpha*magSi)*di;
|
||||
dIntFij +=
|
||||
cosij*w[i]*w[j]*Foam::log(r&r);
|
||||
}
|
||||
else
|
||||
{
|
||||
dIntFij +=
|
||||
cosij*w[i]*w[j]*Foam::log(r&r);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
dIntFij *= (magSi/2) * (magSj/2);
|
||||
|
||||
}
|
||||
return dIntFij;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -431,7 +273,7 @@ int main(int argc, char *argv[])
|
||||
"viewFactorsDict",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
@ -446,23 +288,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
const label debug = viewFactorDict.getOrDefault<label>("debug", 0);
|
||||
|
||||
const scalar GaussQuadTol =
|
||||
viewFactorDict.getOrDefault<scalar>("GaussQuadTol", 0.01);
|
||||
|
||||
const scalar distTol =
|
||||
viewFactorDict.getOrDefault<scalar>("distTol", 8);
|
||||
|
||||
const scalar alpha =
|
||||
viewFactorDict.getOrDefault<scalar>("alpha", 0.21);
|
||||
|
||||
const scalar intTol =
|
||||
viewFactorDict.getOrDefault<scalar>("intTol", 1e-2);
|
||||
|
||||
bool useAgglomeration(true);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const labelList viewFactorsPatches(patches.indices(viewFactorWall));
|
||||
|
||||
// Read agglomeration map
|
||||
labelListIOList finalAgglom
|
||||
(
|
||||
@ -471,22 +296,12 @@ int main(int argc, char *argv[])
|
||||
"finalAgglom",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
if (!finalAgglom.typeHeaderOk<labelListIOList>())
|
||||
{
|
||||
finalAgglom.setSize(patches.size());
|
||||
for (label patchi=0; patchi < patches.size(); patchi++)
|
||||
{
|
||||
finalAgglom[patchi] = identity(patches[patchi].size());
|
||||
}
|
||||
useAgglomeration = false;
|
||||
}
|
||||
|
||||
// Create the coarse mesh using agglomeration
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -521,8 +336,10 @@ int main(int argc, char *argv[])
|
||||
label nCoarseFaces = 0; //total number of coarse faces
|
||||
label nFineFaces = 0; //total number of fine faces
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& coarsePatches = coarseMesh.boundaryMesh();
|
||||
|
||||
labelList viewFactorsPatches(patches.indices(viewFactorWall));
|
||||
for (const label patchi : viewFactorsPatches)
|
||||
{
|
||||
nCoarseFaces += coarsePatches[patchi].size();
|
||||
@ -648,13 +465,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Set up searching engine for obstacles
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef NO_CGAL
|
||||
// Using octree
|
||||
#include "searchingEngine.H"
|
||||
#else
|
||||
// Using CGAL aabbtree (faster, more robust)
|
||||
#include "searchingEngine_CGAL.H"
|
||||
#endif
|
||||
|
||||
// Determine rays between coarse face centres
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -662,15 +473,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
DynamicList<label> rayEndFace(rayStartFace.size());
|
||||
|
||||
|
||||
// Return rayStartFace in local index and rayEndFace in global index
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef NO_CGAL
|
||||
// Using octree, distributedTriSurfaceMesh
|
||||
|
||||
#include "shootRays.H"
|
||||
#else
|
||||
// Using CGAL aabbtree (faster, more robust)
|
||||
#include "shootRays_CGAL.H"
|
||||
#endif
|
||||
|
||||
// Calculate number of visible faces from local index
|
||||
labelList nVisibleFaceFaces(nCoarseFaces, Zero);
|
||||
@ -711,9 +518,9 @@ int main(int argc, char *argv[])
|
||||
visibleFaceFaces[faceI][nVisibleFaceFaces[faceI]++] = compactI;
|
||||
}
|
||||
|
||||
|
||||
// Construct data in compact addressing
|
||||
// (2AA) need coarse (Ai), fine Sf (dAi) and fine Cf(r) to calculate Fij
|
||||
// (2LI) need edges (li)
|
||||
// I need coarse Sf (Ai), fine Sf (dAi) and fine Cf(r) to calculate Fij
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
pointField compactCoarseCf(map.constructSize(), Zero);
|
||||
@ -721,16 +528,12 @@ int main(int argc, char *argv[])
|
||||
List<List<point>> compactFineSf(map.constructSize());
|
||||
List<List<point>> compactFineCf(map.constructSize());
|
||||
|
||||
DynamicList<List<point>> compactPoints(map.constructSize());
|
||||
|
||||
DynamicList<label> compactPatchId(map.constructSize());
|
||||
|
||||
// Insert my coarse local values
|
||||
SubList<point>(compactCoarseSf, nCoarseFaces) = localCoarseSf;
|
||||
SubList<point>(compactCoarseCf, nCoarseFaces) = localCoarseCf;
|
||||
|
||||
const faceList& faces = mesh.faces();
|
||||
|
||||
// Insert my fine local values
|
||||
label compactI = 0;
|
||||
forAll(viewFactorsPatches, i)
|
||||
@ -745,21 +548,11 @@ int main(int argc, char *argv[])
|
||||
const labelList& coarsePatchFace =
|
||||
coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
const polyPatch& pp = patches[patchID];
|
||||
|
||||
forAll(coarseToFine, coarseI)
|
||||
{
|
||||
compactPatchId.append(patchID);
|
||||
List<point>& fineCf = compactFineCf[compactI];
|
||||
List<point>& fineSf = compactFineSf[compactI];
|
||||
|
||||
label startFace = pp.start();
|
||||
|
||||
const vectorField locPoints
|
||||
(
|
||||
mesh.points(),
|
||||
faces[coarseI + startFace]
|
||||
);
|
||||
List<point>& fineSf = compactFineSf[compactI++];
|
||||
|
||||
const label coarseFaceI = coarsePatchFace[coarseI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceI];
|
||||
@ -767,8 +560,6 @@ int main(int argc, char *argv[])
|
||||
fineCf.setSize(fineFaces.size());
|
||||
fineSf.setSize(fineFaces.size());
|
||||
|
||||
compactPoints.append(locPoints);
|
||||
|
||||
fineCf = UIndirectList<point>
|
||||
(
|
||||
mesh.Cf().boundaryField()[patchID],
|
||||
@ -779,25 +570,19 @@ int main(int argc, char *argv[])
|
||||
mesh.Sf().boundaryField()[patchID],
|
||||
coarseToFine[coarseFaceI]
|
||||
);
|
||||
|
||||
compactI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master() && debug)
|
||||
{
|
||||
Info<< "map distribute..." << endl;
|
||||
}
|
||||
|
||||
// Do all swapping
|
||||
map.distribute(compactCoarseSf);
|
||||
map.distribute(compactCoarseCf);
|
||||
map.distribute(compactFineCf);
|
||||
map.distribute(compactFineSf);
|
||||
map.distribute(compactPoints);
|
||||
|
||||
map.distribute(compactPatchId);
|
||||
|
||||
|
||||
// Plot all rays between visible faces.
|
||||
if (dumpRays)
|
||||
{
|
||||
@ -813,7 +598,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Fill local view factor matrix
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
scalarListIOList F2LI
|
||||
|
||||
scalarListIOList F
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -844,61 +630,6 @@ int main(int argc, char *argv[])
|
||||
Info<< "\nCalculating view factors..." << endl;
|
||||
}
|
||||
|
||||
FixedList<scalarList, 5> GaussPoints;
|
||||
GaussPoints[0].setSize(1);
|
||||
GaussPoints[0] = 0;
|
||||
|
||||
GaussPoints[1].setSize(2);
|
||||
GaussPoints[1][0] = 1/std::sqrt(3);
|
||||
GaussPoints[1][1] = -1/std::sqrt(3);
|
||||
|
||||
GaussPoints[2].setSize(3);
|
||||
GaussPoints[2][0] = 0;
|
||||
GaussPoints[2][1] = std::sqrt(3.0/5.0);
|
||||
GaussPoints[2][2] = -std::sqrt(3.0/5.0);
|
||||
|
||||
GaussPoints[3].setSize(4);
|
||||
GaussPoints[3][0] = std::sqrt(3.0/7.0 - (2.0/7.0)*std::sqrt(6.0/5.0));
|
||||
GaussPoints[3][1] = -GaussPoints[3][0];
|
||||
GaussPoints[3][2] = std::sqrt(3.0/7.0 + (2.0/7.0)*std::sqrt(6.0/5.0));
|
||||
GaussPoints[3][3] = -GaussPoints[3][2];
|
||||
|
||||
GaussPoints[4].setSize(5);
|
||||
GaussPoints[4][0] = 0;
|
||||
GaussPoints[4][1] = (1.0/3.0)*std::sqrt(5.0 - 2.0*std::sqrt(10.0/7.0));
|
||||
GaussPoints[4][2] = -GaussPoints[4][1];
|
||||
GaussPoints[4][3] = (1.0/3.0)*std::sqrt(5.0 + 2.0*std::sqrt(10.0/7.0));
|
||||
GaussPoints[4][4] = -GaussPoints[4][3];
|
||||
|
||||
|
||||
List<scalarList> GaussWeights(5);
|
||||
GaussWeights[0].setSize(1);
|
||||
GaussWeights[0] = 2;
|
||||
|
||||
GaussWeights[1].setSize(2);
|
||||
GaussWeights[1][0] = 1;
|
||||
GaussWeights[1][1] = 1;
|
||||
|
||||
GaussWeights[2].setSize(3);
|
||||
GaussWeights[2][0] = 8.0/9.0;
|
||||
GaussWeights[2][1] = 5.0/9.0;
|
||||
GaussWeights[2][2] = 5.0/9.0;
|
||||
|
||||
GaussWeights[3].setSize(4);
|
||||
GaussWeights[3][0] = (18.0 + std::sqrt(30))/36.0;
|
||||
GaussWeights[3][1] = (18.0 + std::sqrt(30))/36.0;
|
||||
GaussWeights[3][2] = (18.0 - std::sqrt(30))/36.0;
|
||||
GaussWeights[3][3] = (18.0 - std::sqrt(30))/36.0;
|
||||
|
||||
GaussWeights[4].setSize(5);
|
||||
GaussWeights[4][0] = 128.0/225.0;
|
||||
GaussWeights[4][1] = (322.0 + 13.0*std::sqrt(70))/900.0;
|
||||
GaussWeights[4][2] = (322.0 + 13.0*std::sqrt(70))/900.0;
|
||||
GaussWeights[4][3] = (322.0 - 13.0*std::sqrt(70))/900.0;
|
||||
GaussWeights[4][4] = (322.0 - 13.0*std::sqrt(70))/900.0;
|
||||
|
||||
const label maxQuadOrder = 5;
|
||||
|
||||
if (mesh.nSolutionD() == 3)
|
||||
{
|
||||
forAll(localCoarseSf, coarseFaceI)
|
||||
@ -907,207 +638,119 @@ int main(int argc, char *argv[])
|
||||
const vector Ai = sum(localFineSf);
|
||||
const List<point>& localFineCf = compactFineCf[coarseFaceI];
|
||||
const label fromPatchId = compactPatchId[coarseFaceI];
|
||||
|
||||
const List<point>& lPoints = compactPoints[coarseFaceI];
|
||||
|
||||
patchArea[fromPatchId] += mag(Ai);
|
||||
|
||||
const labelList& visCoarseFaces = visibleFaceFaces[coarseFaceI];
|
||||
|
||||
forAll(visCoarseFaces, visCoarseFaceI)
|
||||
{
|
||||
//F2AI[coarseFaceI].setSize(visCoarseFaces.size());
|
||||
F2LI[coarseFaceI].setSize(visCoarseFaces.size());
|
||||
F[coarseFaceI].setSize(visCoarseFaces.size());
|
||||
label compactJ = visCoarseFaces[visCoarseFaceI];
|
||||
const List<point>& remoteFineSj = compactFineSf[compactJ];
|
||||
const List<point>& remoteFineCj = compactFineCf[compactJ];
|
||||
|
||||
const List<point>& rPointsCj = compactPoints[compactJ];
|
||||
|
||||
const label toPatchId = compactPatchId[compactJ];
|
||||
|
||||
bool far(false);
|
||||
// Relative distance
|
||||
scalar Fij = 0;
|
||||
forAll(localFineSf, i)
|
||||
{
|
||||
const scalar dAi =
|
||||
Foam::sqrt
|
||||
(
|
||||
mag(localFineSf[i])/constant::mathematical::pi
|
||||
);
|
||||
const vector& dAi = localFineSf[i];
|
||||
const vector& dCi = localFineCf[i];
|
||||
|
||||
forAll(remoteFineSj, j)
|
||||
{
|
||||
const scalar dAj =
|
||||
Foam::sqrt
|
||||
(
|
||||
mag(remoteFineSj[j])/constant::mathematical::pi
|
||||
);
|
||||
const vector& dAj = remoteFineSj[j];
|
||||
const vector& dCj = remoteFineCj[j];
|
||||
|
||||
const scalar dist = mag(dCi - dCj)/((dAi + dAj)/2);
|
||||
|
||||
if (dist > distTol)
|
||||
{
|
||||
far = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (far)
|
||||
{
|
||||
// 2AI method
|
||||
scalar F2AIij = 0;
|
||||
|
||||
forAll(localFineSf, i)
|
||||
{
|
||||
const vector& dAi = localFineSf[i];
|
||||
const vector& dCi = localFineCf[i];
|
||||
|
||||
forAll(remoteFineSj, j)
|
||||
{
|
||||
const vector& dAj = remoteFineSj[j];
|
||||
const vector& dCj = remoteFineCj[j];
|
||||
|
||||
scalar dIntFij = calculateViewFactorFij2AI
|
||||
(
|
||||
dCi,
|
||||
dCj,
|
||||
dAi,
|
||||
dAj
|
||||
);
|
||||
|
||||
F2AIij += dIntFij;
|
||||
}
|
||||
}
|
||||
F2LI[coarseFaceI][visCoarseFaceI] = F2AIij/mag(Ai);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2LI method
|
||||
label nLocal = lPoints.size();
|
||||
label nRemote = rPointsCj.size();
|
||||
|
||||
// Using sub-divisions (quadrature)
|
||||
scalar oldEToeInt = 0;
|
||||
for (label gi=0; gi < maxQuadOrder; gi++)
|
||||
{
|
||||
scalar F2LIij = 0;
|
||||
for(label i=0; i<nLocal; i++)
|
||||
{
|
||||
vector si;
|
||||
vector ci;
|
||||
|
||||
vector sj;
|
||||
vector cj;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
si = lPoints[i] - lPoints[nLocal-1];
|
||||
ci = (lPoints[i] + lPoints[nLocal-1])/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
si = lPoints[i] - lPoints[i-1];
|
||||
ci = (lPoints[i] + lPoints[i-1])/2;
|
||||
}
|
||||
|
||||
for(label j=0; j<nRemote; j++)
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
sj = rPointsCj[j]-rPointsCj[nRemote-1];
|
||||
cj = (rPointsCj[j]+rPointsCj[nRemote-1])/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sj = rPointsCj[j] - rPointsCj[j-1];
|
||||
cj = (rPointsCj[j] + rPointsCj[j-1])/2;
|
||||
}
|
||||
|
||||
|
||||
scalar magSi = mag(si);
|
||||
scalar magSj = mag(sj);
|
||||
scalar cosij = (si & sj)/(magSi * magSj);
|
||||
|
||||
vector di = si/magSi;
|
||||
vector dj = sj/magSj;
|
||||
|
||||
label quadOrder = gi;
|
||||
const vector r(ci - cj);
|
||||
// Common edges use n = 0
|
||||
if (mag(r) < SMALL)
|
||||
{
|
||||
quadOrder = 0;
|
||||
}
|
||||
|
||||
scalar dIntFij =
|
||||
GaussQuad
|
||||
(
|
||||
GaussWeights[gi],
|
||||
GaussPoints[gi],
|
||||
magSi,
|
||||
magSj,
|
||||
di,
|
||||
dj,
|
||||
ci,
|
||||
cj,
|
||||
cosij,
|
||||
alpha,
|
||||
quadOrder
|
||||
);
|
||||
|
||||
F2LIij += dIntFij;
|
||||
}
|
||||
}
|
||||
|
||||
scalar err = (F2LIij-oldEToeInt)/F2LIij;
|
||||
|
||||
if
|
||||
scalar dIntFij = calculateViewFactorFij
|
||||
(
|
||||
(mag(err) < GaussQuadTol && gi > 0)
|
||||
|| gi == maxQuadOrder-1
|
||||
)
|
||||
{
|
||||
F2LI[coarseFaceI][visCoarseFaceI] =
|
||||
F2LIij/mag(Ai)/4/constant::mathematical::pi;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldEToeInt = F2LIij;
|
||||
}
|
||||
dCi,
|
||||
dCj,
|
||||
dAi,
|
||||
dAj
|
||||
);
|
||||
|
||||
Fij += dIntFij;
|
||||
}
|
||||
}
|
||||
|
||||
sumViewFactorPatch[fromPatchId][toPatchId] +=
|
||||
F2LI[coarseFaceI][visCoarseFaceI]*mag(Ai);
|
||||
F[coarseFaceI][visCoarseFaceI] = Fij/mag(Ai);
|
||||
sumViewFactorPatch[fromPatchId][toPatchId] += Fij;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (mesh.nSolutionD() == 2)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " View factors are not available in 2D "
|
||||
<< exit(FatalError);
|
||||
const boundBox& box = mesh.bounds();
|
||||
const Vector<label>& dirs = mesh.geometricD();
|
||||
vector emptyDir = Zero;
|
||||
forAll(dirs, i)
|
||||
{
|
||||
if (dirs[i] == -1)
|
||||
{
|
||||
emptyDir[i] = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
scalar wideBy2 = (box.span() & emptyDir)*2.0;
|
||||
|
||||
forAll(localCoarseSf, coarseFaceI)
|
||||
{
|
||||
const vector& Ai = localCoarseSf[coarseFaceI];
|
||||
const vector& Ci = localCoarseCf[coarseFaceI];
|
||||
vector Ain = Ai/mag(Ai);
|
||||
vector R1i = Ci + (mag(Ai)/wideBy2)*(Ain ^ emptyDir);
|
||||
vector R2i = Ci - (mag(Ai)/wideBy2)*(Ain ^ emptyDir) ;
|
||||
|
||||
const label fromPatchId = compactPatchId[coarseFaceI];
|
||||
patchArea[fromPatchId] += mag(Ai);
|
||||
|
||||
const labelList& visCoarseFaces = visibleFaceFaces[coarseFaceI];
|
||||
forAll(visCoarseFaces, visCoarseFaceI)
|
||||
{
|
||||
F[coarseFaceI].setSize(visCoarseFaces.size());
|
||||
label compactJ = visCoarseFaces[visCoarseFaceI];
|
||||
const vector& Aj = compactCoarseSf[compactJ];
|
||||
const vector& Cj = compactCoarseCf[compactJ];
|
||||
|
||||
const label toPatchId = compactPatchId[compactJ];
|
||||
|
||||
vector Ajn = Aj/mag(Aj);
|
||||
vector R1j = Cj + (mag(Aj)/wideBy2)*(Ajn ^ emptyDir);
|
||||
vector R2j = Cj - (mag(Aj)/wideBy2)*(Ajn ^ emptyDir);
|
||||
|
||||
scalar d1 = mag(R1i - R2j);
|
||||
scalar d2 = mag(R2i - R1j);
|
||||
scalar s1 = mag(R1i - R1j);
|
||||
scalar s2 = mag(R2i - R2j);
|
||||
|
||||
scalar Fij = mag((d1 + d2) - (s1 + s2))/(4.0*mag(Ai)/wideBy2);
|
||||
|
||||
F[coarseFaceI][visCoarseFaceI] = Fij;
|
||||
sumViewFactorPatch[fromPatchId][toPatchId] += Fij*mag(Ai);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info << "Writing view factor matrix..." << endl;
|
||||
}
|
||||
|
||||
// Write view factors matrix in listlist form
|
||||
F2LI.write();
|
||||
F.write();
|
||||
|
||||
reduce(sumViewFactorPatch, sumOp<scalarSquareMatrix>());
|
||||
reduce(patchArea, sumOp<scalarList>());
|
||||
|
||||
|
||||
if (Pstream::master() && debug)
|
||||
{
|
||||
forAll(viewFactorsPatches, i)
|
||||
{
|
||||
label patchI = viewFactorsPatches[i];
|
||||
for (label j=i; j<viewFactorsPatches.size(); j++)
|
||||
forAll(viewFactorsPatches, i)
|
||||
{
|
||||
label patchJ = viewFactorsPatches[j];
|
||||
|
||||
label patchJ = viewFactorsPatches[i];
|
||||
Info << "F" << patchI << patchJ << ": "
|
||||
<< sumViewFactorPatch[patchI][patchJ]/patchArea[patchI]
|
||||
<< endl;
|
||||
@ -1115,13 +758,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (writeViewFactors)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info << "Writing view factor matrix..." << endl;
|
||||
}
|
||||
|
||||
volScalarField viewFactorField
|
||||
(
|
||||
IOobject
|
||||
@ -1152,14 +791,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(coarseToFine, coarseI)
|
||||
{
|
||||
const scalar FiSum = sum(F2LI[compactI]);
|
||||
|
||||
const scalar Fij = sum(F[compactI]);
|
||||
const label coarseFaceID = coarsePatchFace[coarseI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceID];
|
||||
forAll(fineFaces, fineId)
|
||||
{
|
||||
const label faceID = fineFaces[fineId];
|
||||
vfbf[patchID][faceID] = FiSum;
|
||||
vfbf[patchID][faceID] = Fij;
|
||||
}
|
||||
compactI++;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ if have_cgal
|
||||
then
|
||||
wmake $targetType PolyhedronReader
|
||||
export COMP_FLAGS='-IPolyhedronReader'
|
||||
export LINK_FLAGS='-lPolyhedronReader'
|
||||
export LINK_FLAGS='${CGAL_LIBS} -lPolyhedronReader'
|
||||
else
|
||||
export COMP_FLAGS="-DNO_CGAL"
|
||||
fi
|
||||
|
||||
@ -26,5 +26,4 @@ EXE_LIBS = \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lmeshTools \
|
||||
${CGAL_LIBS} \
|
||||
$(LINK_FLAGS)
|
||||
|
||||
@ -81,6 +81,7 @@ 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-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -856,10 +856,12 @@ int main(int argc, char *argv[])
|
||||
if (debug)
|
||||
{
|
||||
OBJstream str(runTime.path()/"isScaledPoint.obj");
|
||||
|
||||
for (const label pointi : isScaledPoint)
|
||||
forAll(isScaledPoint, pointI)
|
||||
{
|
||||
str.write(initialPoints[meshPoints[pointi]]);
|
||||
if (isScaledPoint[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-2022 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 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 '${0##*/} -help' for usage"
|
||||
echo "See '${Script##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@ -73,7 +73,7 @@ die()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
optSyntax="sh"
|
||||
optSyntax=sh
|
||||
unset verboseOutput
|
||||
|
||||
# Parse options
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
# [WM_PROJECT_VERSION] - A human-readable version name
|
||||
# A development version is often named 'com' - as in www.openfoam.com
|
||||
export WM_PROJECT_VERSION=com
|
||||
export WM_PROJECT_VERSION=v2206
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Configuration environment variables.
|
||||
|
||||
@ -230,21 +230,6 @@ castellatedMeshControls
|
||||
// outside locations. Default is only after all refinement has
|
||||
// been done.
|
||||
//leakLevel 10;
|
||||
|
||||
// Additional refinement for regions of high curvature. Expressed
|
||||
// (bit similar to gapLevel) as:
|
||||
// - number of cells per radius of curvature. (usually 1 is
|
||||
// good enough)
|
||||
// - starting cell level? Not used at the moment.
|
||||
// - maximum cell level. This can be smaller or larger than the
|
||||
// max 'surface' level
|
||||
// - minumum curvature radius to ignore (expressed as a cell level).
|
||||
// This can be used to avoid detecting small sharp surface
|
||||
// features. Set to -1 to ignore.
|
||||
// (sometimes you want more refinement than sharp features since
|
||||
// these can be done with feature edge snapping (so can leave
|
||||
// level (0 0))
|
||||
//curvatureLevel (10 0 10 -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ executeControl writeTime;
|
||||
writeControl writeTime;
|
||||
|
||||
setFormat vtk;
|
||||
direction forward; // (forward | backward | bidirectional)
|
||||
trackForward true;
|
||||
|
||||
lifeTime 10000;
|
||||
nSubCycle 5;
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
# [WM_PROJECT_VERSION] - A human-readable version name
|
||||
# A development version is often named 'com' - as in www.openfoam.com
|
||||
setenv WM_PROJECT_VERSION com
|
||||
setenv WM_PROJECT_VERSION v2206
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Configuration environment variables.
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_fileStat_H
|
||||
#define Foam_fileStat_H
|
||||
#ifndef fileStat_H
|
||||
#define fileStat_H
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@ -54,7 +54,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
// Forward declarations
|
||||
class fileStat;
|
||||
|
||||
Istream& operator>>(Istream& is, fileStat& fs);
|
||||
@ -67,7 +67,7 @@ Ostream& operator<<(Ostream& os, const fileStat& fs);
|
||||
|
||||
class fileStat
|
||||
{
|
||||
// Private Data
|
||||
// Private data
|
||||
|
||||
struct stat status_;
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
//- Empty constructor
|
||||
fileStat();
|
||||
|
||||
//- Construct from components.
|
||||
@ -89,7 +89,7 @@ public:
|
||||
// \param maxTime The timeout value.
|
||||
//
|
||||
// \note An empty filename is a no-op.
|
||||
explicit fileStat
|
||||
fileStat
|
||||
(
|
||||
const char* fName,
|
||||
const bool followLink = true,
|
||||
@ -104,7 +104,7 @@ public:
|
||||
// \param maxTime The timeout value.
|
||||
//
|
||||
// \note An empty filename is a no-op.
|
||||
explicit fileStat
|
||||
fileStat
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool followLink = true,
|
||||
@ -119,33 +119,27 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- True if file-stat was successful
|
||||
bool valid() const noexcept
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- True if file-stat was successful
|
||||
explicit operator bool() const noexcept
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- The raw status
|
||||
const struct stat& status() const noexcept
|
||||
//- Raw status
|
||||
const struct stat& status() const
|
||||
{
|
||||
return status_;
|
||||
}
|
||||
|
||||
//- Size in bytes, 0 for an invalid file-stat.
|
||||
//- Was file-stat successful?
|
||||
bool valid() const
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- Size in bytes. Zero for an invalid file-stat.
|
||||
label size() const;
|
||||
|
||||
//- The modification time in seconds,
|
||||
//- 0 for an invalid file-stat.
|
||||
//- Return the modification time in seconds.
|
||||
// Zero for an invalid file-stat.
|
||||
time_t modTime() const;
|
||||
|
||||
//- The modification time in seconds (nanosecond resolution),
|
||||
//- 0 for an invalid file-stat.
|
||||
//- Return the modification time in seconds (nanosecond resolution)
|
||||
// Zero for an invalid file-stat.
|
||||
double dmodTime() const;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_fileStat_H
|
||||
#define Foam_fileStat_H
|
||||
#ifndef fileStat_H
|
||||
#define fileStat_H
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@ -54,7 +54,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
// Forward declarations
|
||||
class fileStat;
|
||||
|
||||
Istream& operator>>(Istream& is, fileStat& fs);
|
||||
@ -67,7 +67,7 @@ Ostream& operator<<(Ostream& os, const fileStat& fs);
|
||||
|
||||
class fileStat
|
||||
{
|
||||
// Private Data
|
||||
// Private data
|
||||
|
||||
struct stat status_;
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
//- Empty constructor
|
||||
fileStat();
|
||||
|
||||
//- Construct from components.
|
||||
@ -89,7 +89,7 @@ public:
|
||||
// \param maxTime The timeout value.
|
||||
//
|
||||
// \note An empty filename is a no-op.
|
||||
explicit fileStat
|
||||
fileStat
|
||||
(
|
||||
const char* fName,
|
||||
const bool followLink = true,
|
||||
@ -104,7 +104,7 @@ public:
|
||||
// \param maxTime The timeout value.
|
||||
//
|
||||
// \note An empty filename is a no-op.
|
||||
explicit fileStat
|
||||
fileStat
|
||||
(
|
||||
const fileName& fName,
|
||||
const bool followLink = true,
|
||||
@ -119,33 +119,27 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- True if file-stat was successful
|
||||
bool valid() const noexcept
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- True if file-stat was successful
|
||||
explicit operator bool() const noexcept
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- The raw status
|
||||
const struct stat& status() const noexcept
|
||||
//- Raw status
|
||||
const struct stat& status() const
|
||||
{
|
||||
return status_;
|
||||
}
|
||||
|
||||
//- Size in bytes, 0 for an invalid file-stat.
|
||||
//- Was file-stat successful?
|
||||
bool valid() const
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- Size in bytes. Zero for an invalid file-stat.
|
||||
label size() const;
|
||||
|
||||
//- The modification time in seconds,
|
||||
//- 0 for an invalid file-stat.
|
||||
//- Return the modification time in seconds.
|
||||
// Zero for an invalid file-stat.
|
||||
time_t modTime() const;
|
||||
|
||||
//- The modification time in seconds (nanosecond resolution),
|
||||
//- 0 for an invalid file-stat.
|
||||
//- Return the modification time in seconds (nanosecond resolution)
|
||||
// Zero for an invalid file-stat.
|
||||
double dmodTime() const;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,112 +28,95 @@ License
|
||||
|
||||
#include "error.H"
|
||||
#include "OSspecific.H"
|
||||
#include "IFstream.H"
|
||||
#include "StringStream.H"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <sstream>
|
||||
#include <cxxabi.h>
|
||||
#include <dlfcn.h>
|
||||
#include <execinfo.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Read up to and including lineNum from the piped command
|
||||
// Return the final line read
|
||||
std::string pipeOpen(const std::string& cmd, const int lineNum = 0)
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
string pOpen(const string& cmd, label line=0)
|
||||
{
|
||||
std::string str;
|
||||
string res;
|
||||
|
||||
FILE *handle = popen(cmd.c_str(), "r");
|
||||
if (!handle) return str;
|
||||
|
||||
char* buf = nullptr;
|
||||
size_t len = 0;
|
||||
ssize_t nread;
|
||||
|
||||
// Read lineNum number of lines
|
||||
for
|
||||
(
|
||||
int cnt = 0;
|
||||
cnt <= lineNum && (nread = ::getline(&buf, &len, handle)) >= 0;
|
||||
++cnt
|
||||
)
|
||||
FILE *cmdPipe = popen(cmd.c_str(), "r");
|
||||
if (cmdPipe)
|
||||
{
|
||||
if (cnt == lineNum)
|
||||
{
|
||||
// Retain the last line, trimming trailing newline
|
||||
str.assign(buf);
|
||||
char *buf = nullptr;
|
||||
|
||||
if (str.size())
|
||||
// Read line number of lines
|
||||
for (label cnt = 0; cnt <= line; ++cnt)
|
||||
{
|
||||
size_t linecap = 0;
|
||||
ssize_t linelen = ::getline(&buf, &linecap, cmdPipe);
|
||||
|
||||
if (linelen < 0)
|
||||
{
|
||||
str.resize(str.size()-1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cnt == line)
|
||||
{
|
||||
res = string(buf);
|
||||
// Trim trailing newline
|
||||
if (res.size())
|
||||
{
|
||||
res.resize(res.size()-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != nullptr)
|
||||
{
|
||||
free(buf);
|
||||
}
|
||||
|
||||
pclose(cmdPipe);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
pclose(handle);
|
||||
|
||||
return str;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
inline std::string addressToWord(const uintptr_t addr)
|
||||
inline word addressToWord(const uintptr_t addr)
|
||||
{
|
||||
std::ostringstream buf;
|
||||
buf.setf(std::ios_base::hex, std::ios_base::basefield);
|
||||
|
||||
buf << "0x"; // Same as setf(std::ios::showbase)
|
||||
|
||||
OStringStream os;
|
||||
#ifdef __APPLE__
|
||||
buf << uint64_t(addr);
|
||||
os << "0x" << hex << uint64_t(addr);
|
||||
#else
|
||||
buf << addr;
|
||||
os << "0x" << hex << addr;
|
||||
#endif
|
||||
|
||||
return buf.str(); // Needs no stripping
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
// Note: demangle requires symbols only - without extra '(' etc.
|
||||
inline std::string demangleSymbol(const char* sn)
|
||||
inline string& shorterPath(string& s)
|
||||
{
|
||||
int st = 0;
|
||||
|
||||
char* cxx_sname = abi::__cxa_demangle(sn, nullptr, nullptr, &st);
|
||||
|
||||
if (st == 0 && cxx_sname)
|
||||
{
|
||||
std::string demangled(cxx_sname);
|
||||
free(cxx_sname);
|
||||
|
||||
return demangled;
|
||||
}
|
||||
|
||||
return sn;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::string& shorterPath(Foam::string& s)
|
||||
{
|
||||
s.replace(Foam::cwd() + '/', "");
|
||||
s.replace(Foam::home(), "~");
|
||||
s.replace(cwd() + '/', "");
|
||||
s.replace(home(), "~");
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
void printSourceFileAndLine
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const Foam::fileName& filename,
|
||||
const Dl_info& info,
|
||||
Ostream& os,
|
||||
const fileName& filename,
|
||||
Dl_info *info,
|
||||
void *addr
|
||||
)
|
||||
{
|
||||
uintptr_t address = uintptr_t(addr);
|
||||
std::string myAddress = addressToWord(address);
|
||||
word myAddress = addressToWord(address);
|
||||
|
||||
// Can use relative addresses for executables and libraries with the
|
||||
// Darwin addr2line implementation.
|
||||
@ -144,14 +127,14 @@ void printSourceFileAndLine
|
||||
#endif
|
||||
{
|
||||
// Convert address into offset into dynamic library
|
||||
uintptr_t offset = uintptr_t(info.dli_fbase);
|
||||
uintptr_t offset = uintptr_t(info->dli_fbase);
|
||||
intptr_t relativeAddress = address - offset;
|
||||
myAddress = addressToWord(relativeAddress);
|
||||
}
|
||||
|
||||
if (filename[0] == '/')
|
||||
{
|
||||
Foam::string line = pipeOpen
|
||||
string line = pOpen
|
||||
(
|
||||
"addr2line -f --demangle=auto --exe "
|
||||
+ filename
|
||||
@ -164,7 +147,7 @@ void printSourceFileAndLine
|
||||
{
|
||||
os << " addr2line failed";
|
||||
}
|
||||
else if (line == "??:0" || line == "??:?" )
|
||||
else if (line == "??:0")
|
||||
{
|
||||
line = filename;
|
||||
os << " in " << shorterPath(line).c_str();
|
||||
@ -177,138 +160,113 @@ void printSourceFileAndLine
|
||||
}
|
||||
|
||||
|
||||
// Uses 'which' to find executable on PATH
|
||||
// - could also iterate through PATH directly
|
||||
inline Foam::fileName whichPath(const char* fn)
|
||||
fileName absolutePath(const char* fn)
|
||||
{
|
||||
Foam::fileName fname(fn);
|
||||
fileName fname(fn);
|
||||
|
||||
if (!fname.empty() && fname[0] != '/' && fname[0] != '~')
|
||||
if (fname[0] != '/' && fname[0] != '~')
|
||||
{
|
||||
std::string s = pipeOpen("which " + fname);
|
||||
string tmp = pOpen("which " + fname);
|
||||
|
||||
if (s[0] == '/' || s[0] == '~')
|
||||
if (tmp[0] == '/' || tmp[0] == '~')
|
||||
{
|
||||
fname = s;
|
||||
fname = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return fname;
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
word demangleSymbol(const char* sn)
|
||||
{
|
||||
int st;
|
||||
char* cxx_sname = abi::__cxa_demangle
|
||||
(
|
||||
sn,
|
||||
nullptr,
|
||||
0,
|
||||
&st
|
||||
);
|
||||
|
||||
if (st == 0 && cxx_sname)
|
||||
{
|
||||
word demangled(cxx_sname);
|
||||
free(cxx_sname);
|
||||
|
||||
return demangled;
|
||||
}
|
||||
|
||||
return sn;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::error::safePrintStack(std::ostream& os)
|
||||
{
|
||||
// Get raw stack symbols
|
||||
void *callstack[100];
|
||||
const int size = backtrace(callstack, 100);
|
||||
char **strings = backtrace_symbols(callstack, size);
|
||||
size_t rdelim;
|
||||
void *array[100];
|
||||
size_t size = backtrace(array, 100);
|
||||
char **strings = backtrace_symbols(array, size);
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
// See if they contain function between () e.g. "(__libc_start_main+0xd0)"
|
||||
// and see if cplus_demangle can make sense of part before +
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
std::string str(strings[i]);
|
||||
string msg(strings[i]);
|
||||
fileName programFile;
|
||||
word address;
|
||||
|
||||
os << '#' << i << '\t';
|
||||
|
||||
// Possibly shorten paths that appear to correspond to OpenFOAM
|
||||
// locations (platforms).
|
||||
//
|
||||
// Eg, "/path/openfoam/platforms/linux64GccDPInt32Opt/lib/libxyz.so"
|
||||
// --> "platforms/linux64GccDPInt32Opt/lib/libxyz.so"
|
||||
|
||||
auto ldelim = str.find('(');
|
||||
auto beg = str.find("/platforms/");
|
||||
|
||||
if (beg == std::string::npos || !beg || beg > ldelim)
|
||||
{
|
||||
beg = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
++beg;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
(ldelim != std::string::npos)
|
||||
&& (rdelim = str.find('+', ldelim+1)) != std::string::npos
|
||||
&& (rdelim > ldelim+1)
|
||||
)
|
||||
{
|
||||
// Found function between () e.g. "(__libc_start_main+0xd0)"
|
||||
// - demangle function name (before the '+' offset)
|
||||
// - preserve trailing [0xAddr]
|
||||
|
||||
os << str.substr(beg, ldelim-beg)
|
||||
<< ' '
|
||||
<< demangleSymbol
|
||||
(
|
||||
str.substr(ldelim+1, rdelim-ldelim-1).c_str()
|
||||
);
|
||||
|
||||
if ((rdelim = str.find('[', rdelim)) != std::string::npos)
|
||||
{
|
||||
os << ' ' << str.substr(rdelim);
|
||||
}
|
||||
}
|
||||
else if (beg)
|
||||
{
|
||||
// With shortened path name
|
||||
os << str.substr(beg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No modification to string
|
||||
os << str;
|
||||
}
|
||||
os << std::endl;
|
||||
os << '#' << label(i) << '\t' << msg << std::endl;
|
||||
}
|
||||
|
||||
free(strings);
|
||||
}
|
||||
|
||||
|
||||
void Foam::error::printStack(Ostream& os)
|
||||
{
|
||||
// Get raw stack symbols
|
||||
void *callstack[100];
|
||||
const int size = backtrace(callstack, 100);
|
||||
const size_t CALLSTACK_SIZE = 128;
|
||||
|
||||
Dl_info info;
|
||||
fileName fname;
|
||||
void *callstack[CALLSTACK_SIZE];
|
||||
size_t size = backtrace(callstack, CALLSTACK_SIZE);
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
Dl_info *info = new Dl_info;
|
||||
|
||||
fileName fname = "???";
|
||||
word address;
|
||||
|
||||
for (size_t i=0; i<size; ++i)
|
||||
{
|
||||
int st = dladdr(callstack[i], &info);
|
||||
int st = dladdr(callstack[i], info);
|
||||
|
||||
os << '#' << i << " ";
|
||||
if (st != 0 && info.dli_fname != nullptr && *(info.dli_fname))
|
||||
os << '#' << label(i) << " ";
|
||||
if (st != 0 && info->dli_fname != nullptr && info->dli_fname[0] != '\0')
|
||||
{
|
||||
fname = whichPath(info.dli_fname);
|
||||
fname = absolutePath(info->dli_fname);
|
||||
|
||||
if (info.dli_sname)
|
||||
{
|
||||
os << demangleSymbol(info.dli_sname).c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
os << '?';
|
||||
}
|
||||
os <<
|
||||
(
|
||||
(info->dli_sname != nullptr)
|
||||
? demangleSymbol(info->dli_sname)
|
||||
: "?"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fname = "???";
|
||||
os << '?';
|
||||
os << "?";
|
||||
}
|
||||
|
||||
printSourceFileAndLine(os, fname, info, callstack[i]);
|
||||
os << nl;
|
||||
os << nl;
|
||||
}
|
||||
|
||||
delete info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -339,8 +339,9 @@ $(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
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dynamicIndexedOctree.H"
|
||||
#include "line.H"
|
||||
#include "linePointRef.H"
|
||||
#include "OFstream.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_dynamicIndexedOctree_H
|
||||
#define Foam_dynamicIndexedOctree_H
|
||||
#ifndef dynamicIndexedOctree_H
|
||||
#define dynamicIndexedOctree_H
|
||||
|
||||
#include "treeBoundBox.H"
|
||||
#include "pointIndexHit.H"
|
||||
@ -54,7 +54,7 @@ namespace Foam
|
||||
|
||||
typedef DynamicList<autoPtr<DynamicList<label>>> contentListList;
|
||||
|
||||
// Forward Declarations
|
||||
// Forward declaration of classes
|
||||
template<class Type> class dynamicIndexedOctree;
|
||||
|
||||
template<class Type> Ostream& operator<<
|
||||
|
||||
@ -39,12 +39,12 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_dynamicTreeDataPoint_H
|
||||
#define Foam_dynamicTreeDataPoint_H
|
||||
#ifndef dynamicTreeDataPoint_H
|
||||
#define dynamicTreeDataPoint_H
|
||||
|
||||
#include "pointField.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "line.H"
|
||||
#include "linePointRef.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -52,7 +52,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
// Forward declaration of classes
|
||||
template<class Type> class dynamicIndexedOctree;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "indexedOctree.H"
|
||||
#include "line.H"
|
||||
#include "linePointRef.H"
|
||||
#include "OFstream.H"
|
||||
#include "ListOps.H"
|
||||
#include "memInfo.H"
|
||||
|
||||
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_indexedOctree_H
|
||||
#define Foam_indexedOctree_H
|
||||
#ifndef indexedOctree_H
|
||||
#define indexedOctree_H
|
||||
|
||||
#include "treeBoundBox.H"
|
||||
#include "pointIndexHit.H"
|
||||
@ -51,7 +51,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
// Forward declaration of classes
|
||||
template<class Type> class indexedOctree;
|
||||
template<class Type> Ostream& operator<<(Ostream&, const indexedOctree<Type>&);
|
||||
class Istream;
|
||||
|
||||
@ -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() == IOstreamOption::BINARY)
|
||||
if (os.format() == IOstream::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-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 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() == IOstreamOption::BINARY)
|
||||
if (is.format() == IOstream::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() == IOstreamOption::BINARY)
|
||||
if (os.format() == IOstream::BINARY)
|
||||
{
|
||||
// Binary (always contiguous)
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ Foam::Ostream& Foam::CircularBuffer<T>::writeList
|
||||
}
|
||||
#endif
|
||||
|
||||
if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstream::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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstream::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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstream::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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (is.format() == IOstream::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-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (is.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||
{
|
||||
// Binary and contiguous
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 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() == IOstreamOption::ASCII)
|
||||
else if (os.format() == IOstream::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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (os.format() == IOstream::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() == IOstreamOption::BINARY && is_contiguous<T>::value)
|
||||
if (is.format() == IOstream::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() == IOstreamOption::ASCII)
|
||||
if (streamOpt.format() == IOstream::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() == IOstreamOption::ASCII)
|
||||
// Keep ascii writing same.
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const Field<T>&>(L);
|
||||
}
|
||||
|
||||
@ -174,11 +174,11 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
|
||||
{
|
||||
if
|
||||
(
|
||||
streamOpt.format() == IOstreamOption::BINARY
|
||||
streamOpt.format() == IOstream::BINARY
|
||||
&& overflows()
|
||||
)
|
||||
{
|
||||
streamOpt.format(IOstreamOption::ASCII);
|
||||
streamOpt.format(IOstream::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() == IOstreamOption::ASCII)
|
||||
if (streamOpt.format() == IOstream::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() == IOstreamOption::ASCII)
|
||||
// Keep ascii writing same.
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const List<T>&>(L);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2018 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(IOstreamOption::BINARY, typeName);
|
||||
readHeaderOk(IOstream::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(IOstreamOption::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstream::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(IOstreamOption::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
{
|
||||
Field<Type>::operator=(content);
|
||||
}
|
||||
@ -90,7 +90,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
|
||||
Field<Type>::transfer(content);
|
||||
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
Field<Type>::transfer(tfld.ref());
|
||||
}
|
||||
|
||||
if (!readHeaderOk(IOstreamOption::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstream::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(IOstreamOption::BINARY, typeName);
|
||||
readHeaderOk(IOstream::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(IOstreamOption::BINARY, typeName);
|
||||
readHeaderOk(IOstream::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(IOstreamOption::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstream::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(IOstreamOption::BINARY, typeName))
|
||||
if (!readHeaderOk(IOstream::BINARY, typeName))
|
||||
{
|
||||
List<Type>::operator=(content);
|
||||
}
|
||||
@ -102,7 +102,7 @@ Foam::GlobalIOList<Type>::GlobalIOList
|
||||
|
||||
List<Type>::transfer(content);
|
||||
|
||||
readHeaderOk(IOstreamOption::BINARY, typeName);
|
||||
readHeaderOk(IOstream::BINARY, typeName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,7 +62,7 @@ Foam::IOdictionary::IOdictionary
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstreamOption::ASCII, wantedType) && fallback)
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,7 @@ Foam::localIOdictionary::localIOdictionary
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstreamOption::ASCII, wantedType) && fallback)
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
:
|
||||
baseIOdictionary(io, fallback)
|
||||
{
|
||||
if (!readHeaderOk(IOstreamOption::ASCII, wantedType) && fallback)
|
||||
if (!readHeaderOk(IOstream::ASCII, wantedType) && fallback)
|
||||
{
|
||||
dictionary::operator=(*fallback);
|
||||
}
|
||||
|
||||
@ -789,7 +789,7 @@ bool Foam::decomposedBlockData::writeBlocks
|
||||
for (label proci = 1; proci < nProcs; ++proci)
|
||||
{
|
||||
elems.resize(recvSizes[proci]);
|
||||
UIPstream::read
|
||||
IPstream::read
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
proci,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Foam_IOmanip_H
|
||||
#define Foam_IOmanip_H
|
||||
#ifndef IOmanip_H
|
||||
#define IOmanip_H
|
||||
|
||||
#include "Istream.H"
|
||||
#include "Ostream.H"
|
||||
@ -178,21 +178,21 @@ inline Omanip<char> setfill(char fillch)
|
||||
}
|
||||
|
||||
|
||||
inline Omanip<IOstreamOption::streamFormat> setformat
|
||||
inline Omanip<IOstream::streamFormat> setformat
|
||||
(
|
||||
const IOstreamOption::streamFormat fmt
|
||||
const IOstream::streamFormat fmt
|
||||
)
|
||||
{
|
||||
return Omanip<IOstreamOption::streamFormat>(&IOstreamOption::format, fmt);
|
||||
return Omanip<IOstream::streamFormat>(&IOstream::format, fmt);
|
||||
}
|
||||
|
||||
|
||||
inline Omanip<IOstreamOption::versionNumber> setversion
|
||||
inline Omanip<IOstream::versionNumber> setversion
|
||||
(
|
||||
const IOstreamOption::versionNumber ver
|
||||
const IOstream::versionNumber ver
|
||||
)
|
||||
{
|
||||
return Omanip<IOstreamOption::versionNumber>(&IOstreamOption::version, ver);
|
||||
return Omanip<IOstream::versionNumber>(&IOstream::version, ver);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -118,22 +118,22 @@ void Foam::IOstream::print(Ostream& os) const
|
||||
|
||||
void Foam::IOstream::print(Ostream& os, const int streamState) const
|
||||
{
|
||||
if (streamState == std::ios_base::goodbit)
|
||||
if (streamState == ios_base::goodbit)
|
||||
{
|
||||
os << "ios_base::goodbit set : the last operation on stream succeeded"
|
||||
<< endl;
|
||||
}
|
||||
else if (streamState & std::ios_base::badbit)
|
||||
else if (streamState & ios_base::badbit)
|
||||
{
|
||||
os << "ios_base::badbit set : characters possibly lost"
|
||||
<< endl;
|
||||
}
|
||||
else if (streamState & std::ios_base::failbit)
|
||||
else if (streamState & ios_base::failbit)
|
||||
{
|
||||
os << "ios_base::failbit set : some type of formatting error"
|
||||
<< endl;
|
||||
}
|
||||
else if (streamState & std::ios_base::eofbit)
|
||||
else if (streamState & ios_base::eofbit)
|
||||
{
|
||||
os << "ios_base::eofbit set : at end of stream"
|
||||
<< endl;
|
||||
|
||||
@ -60,9 +60,9 @@ using std::ios_base;
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
|
||||
using std::cerr;
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#define Foam_IOstream_extras
|
||||
@ -147,7 +147,7 @@ protected:
|
||||
//- Set stream state to be good
|
||||
void setGood() noexcept
|
||||
{
|
||||
ioState_ = std::ios_base::goodbit;
|
||||
ioState_ = std::ios_base::iostate(0);
|
||||
}
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
explicit IOstream(IOstreamOption streamOpt = IOstreamOption())
|
||||
:
|
||||
IOstreamOption(streamOpt),
|
||||
ioState_(std::ios_base::goodbit),
|
||||
ioState_(std::ios_base::iostate(0)),
|
||||
openClosed_(CLOSED),
|
||||
sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
@ -233,7 +233,7 @@ public:
|
||||
//- True if next operation might succeed
|
||||
bool good() const noexcept
|
||||
{
|
||||
return ioState_ == 0; // == goodbit
|
||||
return ioState_ == 0;
|
||||
}
|
||||
|
||||
//- True if end of input seen
|
||||
@ -331,7 +331,7 @@ public:
|
||||
// \return the previous value
|
||||
label lineNumber(const label num) noexcept
|
||||
{
|
||||
label old(lineNumber_);
|
||||
const label old(lineNumber_);
|
||||
lineNumber_ = num;
|
||||
return old;
|
||||
}
|
||||
@ -440,31 +440,31 @@ inline IOstream& operator<<(IOstream& io, IOstreamManip f)
|
||||
|
||||
inline IOstream& dec(IOstream& io)
|
||||
{
|
||||
io.setf(std::ios_base::dec, std::ios_base::basefield);
|
||||
io.setf(ios_base::dec, ios_base::dec|ios_base::hex|ios_base::oct);
|
||||
return io;
|
||||
}
|
||||
|
||||
inline IOstream& hex(IOstream& io)
|
||||
{
|
||||
io.setf(std::ios_base::hex, std::ios_base::basefield);
|
||||
io.setf(ios_base::hex, ios_base::dec|ios_base::hex|ios_base::oct);
|
||||
return io;
|
||||
}
|
||||
|
||||
inline IOstream& oct(IOstream& io)
|
||||
{
|
||||
io.setf(std::ios_base::oct, std::ios_base::basefield);
|
||||
io.setf(ios_base::oct, ios_base::dec|ios_base::hex|ios_base::oct);
|
||||
return io;
|
||||
}
|
||||
|
||||
inline IOstream& fixed(IOstream& io)
|
||||
{
|
||||
io.setf(std::ios_base::fixed, std::ios_base::floatfield);
|
||||
io.setf(ios_base::fixed, ios_base::floatfield);
|
||||
return io;
|
||||
}
|
||||
|
||||
inline IOstream& scientific(IOstream& io)
|
||||
{
|
||||
io.setf(std::ios_base::scientific, std::ios_base::floatfield);
|
||||
io.setf(ios_base::scientific, ios_base::floatfield);
|
||||
return io;
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -156,11 +156,11 @@ public:
|
||||
//- Read a label
|
||||
virtual Istream& read(label&) = 0;
|
||||
|
||||
//- Read a float
|
||||
virtual Istream& read(float&) = 0;
|
||||
//- Read a floatScalar
|
||||
virtual Istream& read(floatScalar&) = 0;
|
||||
|
||||
//- Read a double
|
||||
virtual Istream& read(double&) = 0;
|
||||
//- Read a doubleScalar
|
||||
virtual Istream& read(doubleScalar&) = 0;
|
||||
|
||||
//- Read binary block
|
||||
virtual Istream& read(char*, std::streamsize) = 0;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -147,11 +147,11 @@ public:
|
||||
//- Write int64_t
|
||||
virtual Ostream& write(const int64_t val) = 0;
|
||||
|
||||
//- Write float
|
||||
virtual Ostream& write(const float val) = 0;
|
||||
//- Write floatScalar
|
||||
virtual Ostream& write(const floatScalar val) = 0;
|
||||
|
||||
//- Write double
|
||||
virtual Ostream& write(const double val) = 0;
|
||||
//- Write doubleScalar
|
||||
virtual Ostream& write(const doubleScalar val) = 0;
|
||||
|
||||
//- Write binary block.
|
||||
virtual Ostream& write(const char* data, std::streamsize count) = 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user