Compare commits
57 Commits
maintenanc
...
feature-AM
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f53fcfdf6 | |||
| 8e552bd2b4 | |||
| bdb9a54bed | |||
| 24bee96db2 | |||
| cbc86d6a88 | |||
| 1be63cd378 | |||
| 295822daa6 | |||
| 731e276e21 | |||
| df18b8bb3c | |||
| 2a61606251 | |||
| 06ade9515e | |||
| 0511aebd86 | |||
| e147ac52e9 | |||
| e806d18612 | |||
| fb4fe06306 | |||
| 7db2a29413 | |||
| 4f8b8258fc | |||
| ddcc04dadc | |||
| 7a6891905e | |||
| 2919c9b675 | |||
| 62ec2f2ddf | |||
| debbcfb7df | |||
| 13b6898661 | |||
| 3902ac2857 | |||
| ad6d3a088e | |||
| 7fa44e3c19 | |||
| f14263e019 | |||
| 88b64ab054 | |||
| e1f06bf38e | |||
| 6b99fea4e7 | |||
| 61aef196ed | |||
| 6a87dbcbcd | |||
| 8b9dfbfe1f | |||
| ab065cd5d3 | |||
| 511431d6df | |||
| bd10f67a13 | |||
| 1ea1b84f12 | |||
| 35cf639fe8 | |||
| c3703226c1 | |||
| d2961eec09 | |||
| 3b1f6e867c | |||
| 97f452d53a | |||
| b874dc74b0 | |||
| 0d3e84eb10 | |||
| 62982ffad6 | |||
| 2e81c80527 | |||
| 3eb3b74c1e | |||
| 15c481204d | |||
| 74e3306454 | |||
| f5eace394b | |||
| befbcfce24 | |||
| 4b7f92935e | |||
| 2047a69115 | |||
| fa5d79d0e5 | |||
| 83ef7aa5d2 | |||
| 7825d24de1 | |||
| 99b2550af2 |
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -274,9 +274,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
DLPtrList<Scalar> llist1;
|
||||
llist1.insert(new Scalar(100));
|
||||
llist1.insert(new Scalar(200));
|
||||
llist1.insert(new Scalar(300));
|
||||
llist1.prepend(new Scalar(100));
|
||||
llist1.prepend(new Scalar(200));
|
||||
llist1.prepend(new Scalar(300));
|
||||
|
||||
auto citer = llist1.begin();
|
||||
|
||||
@ -305,9 +305,9 @@ int main(int argc, char *argv[])
|
||||
// Same but as SLPtrList
|
||||
{
|
||||
SLPtrList<Scalar> llist1;
|
||||
llist1.insert(new Scalar(100));
|
||||
llist1.insert(new Scalar(200));
|
||||
llist1.insert(new Scalar(300));
|
||||
llist1.prepend(new Scalar(100));
|
||||
llist1.prepend(new Scalar(200));
|
||||
llist1.prepend(new Scalar(300));
|
||||
|
||||
for (const auto& it : llist1)
|
||||
{
|
||||
|
||||
@ -104,6 +104,8 @@ int main(int argc, char *argv[])
|
||||
printInfo<FixedList<word, 2>>();
|
||||
printInfo<Pair<word>>();
|
||||
|
||||
printInfo<std::pair<int, vector>>();
|
||||
|
||||
printInfo<FixedList<FixedList<int, 2>, 2>>();
|
||||
printInfo<segment>();
|
||||
|
||||
|
||||
@ -633,10 +633,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
fileName::Type lnAType = lnA.type(false);
|
||||
|
||||
if (lnAType != fileName::LINK)
|
||||
if (lnAType != fileName::SYMLINK)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of softlink " << lnA
|
||||
<< " should be " << fileName::LINK
|
||||
<< " should be " << fileName::SYMLINK
|
||||
<< " but is " << lnAType << exit(FatalError);
|
||||
}
|
||||
|
||||
@ -655,10 +655,10 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
|
||||
Foam::cp(lnA, lnB, false);
|
||||
if (lnB.type(false) != fileName::LINK)
|
||||
if (lnB.type(false) != fileName::SYMLINK)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||
<< " should be " << fileName::LINK
|
||||
<< " should be " << fileName::SYMLINK
|
||||
<< " but is " << lnB.type(false) << exit(FatalError);
|
||||
}
|
||||
if (lnB.type(true) != fileName::DIRECTORY)
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,13 +32,13 @@ Description
|
||||
#include "ListOps.H"
|
||||
#include "FlatOutput.H"
|
||||
#include "IOstreams.H"
|
||||
#include "macros.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// For testing various pre-defined formatting
|
||||
#define printFlatOutput(Content, Format) \
|
||||
STRINGIFY(Format) << ": " << flatOutput(Content, FlatOutput::Format{})
|
||||
#define printFlatOutput(Content, Format) \
|
||||
Info<< nl << #Format << ": " \
|
||||
<< flatOutput(Content, FlatOutput::Format{}) << nl
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -77,20 +77,20 @@ int main(int argc, char *argv[])
|
||||
Info<< nl << "write: ";
|
||||
flatOutput(words1).write(Info) << nl;
|
||||
|
||||
Info<< nl << printFlatOutput(words1, BareComma) << nl;
|
||||
Info<< nl << printFlatOutput(words1, BareSpace) << nl;
|
||||
printFlatOutput(words1, BareComma);
|
||||
printFlatOutput(words1, BareSpace);
|
||||
|
||||
Info<< nl << printFlatOutput(words1, BraceComma) << nl;
|
||||
Info<< nl << printFlatOutput(words1, BraceSpace) << nl;
|
||||
printFlatOutput(words1, BraceComma);
|
||||
printFlatOutput(words1, BraceSpace);
|
||||
|
||||
Info<< nl << printFlatOutput(words1, ParenComma) << nl;
|
||||
Info<< nl << printFlatOutput(words1, ParenSpace) << nl;
|
||||
printFlatOutput(words1, ParenComma);
|
||||
printFlatOutput(words1, ParenSpace);
|
||||
|
||||
Info<< nl << printFlatOutput(words1, PointyComma) << nl;
|
||||
Info<< nl << printFlatOutput(words1, PointySpace) << nl;
|
||||
printFlatOutput(words1, PointyComma);
|
||||
printFlatOutput(words1, PointySpace);
|
||||
|
||||
Info<< nl << printFlatOutput(words1, SquareComma) << nl;
|
||||
Info<< nl << printFlatOutput(words1, SquareSpace) << nl;
|
||||
printFlatOutput(words1, SquareComma);
|
||||
printFlatOutput(words1, SquareSpace);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -180,6 +180,36 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// This will likely fail - not declared as is_contiguous
|
||||
// Cannot even catch since it triggers an abort()
|
||||
|
||||
#if 0
|
||||
{
|
||||
std::pair<label,vector> sendData(Pstream::myProcNo(), vector::one);
|
||||
|
||||
const bool oldThrowingError = FatalError.throwing(true);
|
||||
|
||||
try
|
||||
{
|
||||
List<std::pair<label,vector>> countValues
|
||||
(
|
||||
UPstream::listGatherValues<std::pair<label, vector>>
|
||||
(
|
||||
sendData
|
||||
)
|
||||
);
|
||||
|
||||
Pout<< "listGather: " << flatOutput(countValues) << nl;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
{
|
||||
Info<< err.message().c_str() << nl;
|
||||
}
|
||||
|
||||
FatalError.throwing(oldThrowingError);
|
||||
}
|
||||
#endif
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -198,15 +198,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Do the brute-force method as well : collect all cell centres on all
|
||||
// processors
|
||||
pointField allCcs(globalNumbering.size());
|
||||
globalNumbering.gather
|
||||
(
|
||||
Pstream::worldComm,
|
||||
Pstream::procID(Pstream::worldComm),
|
||||
mesh.cellCentres(),
|
||||
allCcs
|
||||
);
|
||||
|
||||
Info<< "Gathered/scattered cell centres:" << endl;
|
||||
|
||||
labelPair inOut;
|
||||
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
|
||||
inOut[0] = allCcs.size();
|
||||
Pstream::scatter(allCcs);
|
||||
inOut[1] = allCcs.size();
|
||||
Pout<< " " << inOut << endl;
|
||||
|
||||
// Compare
|
||||
forAll(ccs, i)
|
||||
@ -239,10 +239,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "local-sizes: " << globalPointsPtr().sizes() << nl;
|
||||
|
||||
UIndirectList<point> procPoints(mesh.points(), uniqueMeshPointLabels);
|
||||
pointField patchPoints;
|
||||
|
||||
globalPointsPtr().gather(procPoints, patchPoints);
|
||||
pointField patchPoints
|
||||
(
|
||||
globalPointsPtr().gather
|
||||
(
|
||||
UIndirectList<point>(mesh.points(), uniqueMeshPointLabels)
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "gathered point field = " << patchPoints.size() << " points\n";
|
||||
}
|
||||
|
||||
@ -62,7 +62,6 @@ Note
|
||||
#include "triSurface.H"
|
||||
#include "surfMesh.H"
|
||||
#include "surfFields.H"
|
||||
#include "surfPointFields.H"
|
||||
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "ModifiableMeshedSurface.H"
|
||||
|
||||
@ -191,11 +191,11 @@ int main(int argc, char *argv[])
|
||||
const scalar scaleFactor = args.getOrDefault<scalar>("scale", 1);
|
||||
|
||||
// Default to binary output, unless otherwise specified
|
||||
const IOstream::streamFormat format =
|
||||
const IOstreamOption::streamFormat format =
|
||||
(
|
||||
args.found("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
? IOstreamOption::ASCII
|
||||
: IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
// Increase the precision of the points data
|
||||
|
||||
@ -90,11 +90,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Binary output, unless otherwise specified
|
||||
const IOstream::streamFormat format =
|
||||
const IOstreamOption::streamFormat format =
|
||||
(
|
||||
args.found("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
? IOstreamOption::ASCII
|
||||
: IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
// increase the precision of the points data
|
||||
|
||||
@ -96,11 +96,11 @@ int main(int argc, char *argv[])
|
||||
Time runTime(args.rootPath(), args.caseName());
|
||||
|
||||
// Binary output, unless otherwise specified
|
||||
const IOstream::streamFormat format =
|
||||
const IOstreamOption::streamFormat format =
|
||||
(
|
||||
args.found("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
? IOstreamOption::ASCII
|
||||
: IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
// Increase the precision of the points data
|
||||
|
||||
@ -731,11 +731,7 @@ int main(int argc, char *argv[])
|
||||
PatchTools::gatherAndMerge
|
||||
(
|
||||
tolDim,
|
||||
primitivePatch
|
||||
(
|
||||
SubList<face>(isoFaces, isoFaces.size()),
|
||||
isoPoints
|
||||
),
|
||||
primitivePatch(SubList<face>(isoFaces), isoPoints),
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
pointMergeMap
|
||||
|
||||
@ -11,10 +11,11 @@
|
||||
#include "checkTools.H"
|
||||
#include "functionObject.H"
|
||||
|
||||
#include "vtkSetWriter.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "writer.H"
|
||||
|
||||
#include "cyclicACMIPolyPatch.H"
|
||||
#include "mappedPatchBase.H"
|
||||
#include "Time.H"
|
||||
|
||||
// Find wedge with opposite orientation. Note: does not actually check that
|
||||
@ -477,6 +478,60 @@ bool Foam::checkCoupledPoints
|
||||
}
|
||||
|
||||
|
||||
void Foam::collectAndWriteAMIWeights
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
surfaceWriter& wr,
|
||||
const fileName& fName,
|
||||
const scalarField& weights,
|
||||
const faceList& localFaces,
|
||||
const labelList& meshPoints,
|
||||
const Map<label>& meshPointMap,
|
||||
|
||||
// Collect geometry
|
||||
faceList& mergedFaces,
|
||||
pointField& mergedPoints,
|
||||
autoPtr<globalIndex>& globalFaces,
|
||||
autoPtr<globalIndex>& globalPoints
|
||||
)
|
||||
{
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
Foam::PatchTools::gatherAndMerge
|
||||
(
|
||||
mesh,
|
||||
localFaces,
|
||||
meshPoints,
|
||||
meshPointMap,
|
||||
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels,
|
||||
globalPoints,
|
||||
globalFaces,
|
||||
|
||||
mergedFaces,
|
||||
mergedPoints
|
||||
);
|
||||
// Collect field
|
||||
scalarField mergedWeights;
|
||||
globalFaces().gather(weights, mergedWeights);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
wr.open
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
fName,
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
wr.write("weightsSum", mergedWeights);
|
||||
wr.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::checkGeometry
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -976,59 +1031,30 @@ Foam::label Foam::checkGeometry
|
||||
<< cpp.name() << " and neighbour patch: "
|
||||
<< cpp.neighbPatch().name() << endl;
|
||||
|
||||
const AMIPatchToPatchInterpolation& ami =
|
||||
cpp.AMI();
|
||||
const word pName("patch" + Foam::name(cpp.index()));
|
||||
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
|
||||
|
||||
{
|
||||
// Collect geometry
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
autoPtr<globalIndex> globalPoints;
|
||||
autoPtr<globalIndex> globalFaces;
|
||||
faceList mergedFaces;
|
||||
pointField mergedPoints;
|
||||
Foam::PatchTools::gatherAndMerge
|
||||
autoPtr<globalIndex> globalFaces;
|
||||
autoPtr<globalIndex> globalPoints;
|
||||
collectAndWriteAMIWeights
|
||||
(
|
||||
mesh,
|
||||
wr,
|
||||
outputDir / pName + "-src_" + tmName,
|
||||
ami.srcWeightsSum(),
|
||||
cpp.localFaces(),
|
||||
cpp.meshPoints(),
|
||||
cpp.meshPointMap(),
|
||||
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels,
|
||||
globalPoints,
|
||||
globalFaces,
|
||||
|
||||
mergedFaces,
|
||||
mergedPoints
|
||||
mergedPoints,
|
||||
globalFaces,
|
||||
globalPoints
|
||||
);
|
||||
// Collect field
|
||||
scalarField mergedWeights;
|
||||
globalFaces().gather
|
||||
(
|
||||
ami.srcWeightsSum(),
|
||||
mergedWeights
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word fName
|
||||
(
|
||||
"patch" + Foam::name(cpp.index())
|
||||
+ "-src_" + tmName
|
||||
);
|
||||
|
||||
wr.open
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
(outputDir / fName),
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
wr.write("weightsSum", mergedWeights);
|
||||
wr.clear();
|
||||
}
|
||||
|
||||
if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
|
||||
{
|
||||
@ -1036,25 +1062,15 @@ Foam::label Foam::checkGeometry
|
||||
refCast<const cyclicACMIPolyPatch>(pbm[patchi]);
|
||||
|
||||
scalarField mergedMask;
|
||||
globalFaces().gather
|
||||
(
|
||||
pp.mask(),
|
||||
mergedMask
|
||||
);
|
||||
globalFaces().gather(pp.mask(), mergedMask);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word fName
|
||||
(
|
||||
"patch" + Foam::name(cpp.index())
|
||||
+ "-src_" + tmName
|
||||
);
|
||||
|
||||
wr.open
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
(outputDir / fName),
|
||||
(outputDir / pName + "-src_" + tmName),
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
@ -1065,54 +1081,25 @@ Foam::label Foam::checkGeometry
|
||||
}
|
||||
{
|
||||
// Collect geometry
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
autoPtr<globalIndex> globalPoints;
|
||||
autoPtr<globalIndex> globalFaces;
|
||||
faceList mergedFaces;
|
||||
pointField mergedPoints;
|
||||
Foam::PatchTools::gatherAndMerge
|
||||
autoPtr<globalIndex> globalFaces;
|
||||
autoPtr<globalIndex> globalPoints;
|
||||
collectAndWriteAMIWeights
|
||||
(
|
||||
mesh,
|
||||
wr,
|
||||
outputDir / pName + "-tgt_" + tmName,
|
||||
ami.tgtWeightsSum(),
|
||||
cpp.neighbPatch().localFaces(),
|
||||
cpp.neighbPatch().meshPoints(),
|
||||
cpp.neighbPatch().meshPointMap(),
|
||||
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels,
|
||||
globalPoints,
|
||||
globalFaces,
|
||||
|
||||
mergedFaces,
|
||||
mergedPoints
|
||||
mergedPoints,
|
||||
globalFaces,
|
||||
globalPoints
|
||||
);
|
||||
// Collect field
|
||||
scalarField mergedWeights;
|
||||
globalFaces().gather
|
||||
(
|
||||
ami.tgtWeightsSum(),
|
||||
mergedWeights
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word fName
|
||||
(
|
||||
"patch" + Foam::name(cpp.index())
|
||||
+ "-tgt_" + tmName
|
||||
);
|
||||
|
||||
wr.open
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
(outputDir / fName),
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
wr.write("weightsSum", mergedWeights);
|
||||
wr.clear();
|
||||
}
|
||||
|
||||
if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
|
||||
{
|
||||
@ -1127,17 +1114,11 @@ Foam::label Foam::checkGeometry
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word fName
|
||||
(
|
||||
"patch" + Foam::name(cpp.index())
|
||||
+ "-tgt_" + tmName
|
||||
);
|
||||
|
||||
wr.open
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
(outputDir / fName),
|
||||
(outputDir / pName + "-tgt_" + tmName),
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
@ -1148,6 +1129,35 @@ Foam::label Foam::checkGeometry
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isA<mappedPatchBase>(pbm[patchi]))
|
||||
{
|
||||
const auto& pp = pbm[patchi];
|
||||
const auto& cpp = refCast<const mappedPatchBase>(pp);
|
||||
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
|
||||
|
||||
const word pName("patch" + Foam::name(patchi));
|
||||
|
||||
// Collect geometry
|
||||
faceList mergedFaces;
|
||||
pointField mergedPoints;
|
||||
autoPtr<globalIndex> globalFaces;
|
||||
autoPtr<globalIndex> globalPoints;
|
||||
collectAndWriteAMIWeights
|
||||
(
|
||||
mesh,
|
||||
wr,
|
||||
outputDir / pName + "-src_" + tmName,
|
||||
ami.srcWeightsSum(),
|
||||
pp.localFaces(),
|
||||
pp.meshPoints(),
|
||||
pp.meshPointMap(),
|
||||
|
||||
mergedFaces,
|
||||
mergedPoints,
|
||||
globalFaces,
|
||||
globalPoints
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
#include "label.H"
|
||||
#include "HashSet.H"
|
||||
#include "labelVector.H"
|
||||
#include "writer.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Forward Declarations
|
||||
class polyMesh;
|
||||
class wedgePolyPatch;
|
||||
template<class T> class writer;
|
||||
class surfaceWriter;
|
||||
|
||||
label findOppositeWedge(const polyMesh&, const wedgePolyPatch&);
|
||||
@ -23,6 +24,24 @@ namespace Foam
|
||||
//- Check 0th vertex on coupled faces
|
||||
bool checkCoupledPoints(const polyMesh&, const bool report, labelHashSet*);
|
||||
|
||||
//- Collect AMI weights to master and write
|
||||
void collectAndWriteAMIWeights
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
surfaceWriter& wr,
|
||||
const fileName& fName,
|
||||
const scalarField& weights,
|
||||
const faceList& localFaces,
|
||||
const labelList& meshPoints,
|
||||
const Map<label>& meshPointMap,
|
||||
|
||||
// Collect geometry
|
||||
faceList& mergedFaces,
|
||||
pointField& mergedPoints,
|
||||
autoPtr<globalIndex>& globalFaces,
|
||||
autoPtr<globalIndex>& globalPoints
|
||||
);
|
||||
|
||||
label checkGeometry
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -36,10 +36,12 @@ License
|
||||
#include "tetWedgeMatcher.H"
|
||||
#include "tetMatcher.H"
|
||||
#include "IOmanip.H"
|
||||
#include "OFstream.H"
|
||||
#include "pointSet.H"
|
||||
#include "faceSet.H"
|
||||
#include "cellSet.H"
|
||||
#include "Time.H"
|
||||
#include "writer.H"
|
||||
#include "surfaceWriter.H"
|
||||
#include "syncTools.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
#include "scalar.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "writer.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Forward Declarations
|
||||
class polyMesh;
|
||||
class pointSet;
|
||||
class faceSet;
|
||||
class cellSet;
|
||||
class fileName;
|
||||
class polyMesh;
|
||||
template<class T> class writer;
|
||||
class surfaceWriter;
|
||||
|
||||
void printMeshStats(const polyMesh& mesh, const bool allTopology);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,6 +36,7 @@ License
|
||||
#include "IOmanip.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "vtkSetWriter.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "checkTools.H"
|
||||
#include "treeBoundBox.H"
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
#include "label.H"
|
||||
#include "autoPtr.H"
|
||||
#include "writer.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Forward Declarations
|
||||
class polyMesh;
|
||||
class pointSet;
|
||||
template<class T> class writer;
|
||||
class surfaceWriter;
|
||||
|
||||
template<class PatchType>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -459,7 +459,7 @@ bool Foam::removeEmptyDir(const fileName& path)
|
||||
Foam::readDir
|
||||
(
|
||||
path,
|
||||
fileName::LINK,
|
||||
fileName::SYMLINK,
|
||||
false, // filterGz
|
||||
false // followLink
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -716,7 +716,7 @@ void writeProcAddressing
|
||||
}
|
||||
|
||||
autoPtr<fileOperation> defaultHandler;
|
||||
if (writeHandler.valid())
|
||||
if (writeHandler)
|
||||
{
|
||||
defaultHandler = fileHandler(std::move(writeHandler));
|
||||
}
|
||||
@ -726,7 +726,7 @@ void writeProcAddressing
|
||||
const bool pointOk = pointMap.write();
|
||||
const bool patchOk = patchMap.write();
|
||||
|
||||
if (defaultHandler.valid())
|
||||
if (defaultHandler)
|
||||
{
|
||||
writeHandler = fileHandler(std::move(defaultHandler));
|
||||
}
|
||||
@ -827,9 +827,24 @@ void readFields
|
||||
|
||||
fields.setSize(masterNames.size());
|
||||
|
||||
// Have master send all fields to processors that don't have a mesh
|
||||
// Have master send all fields to processors that don't have a mesh. The
|
||||
// issue is if a patchField does any parallel operations inside its
|
||||
// construct-from-dictionary. This will not work when going to more
|
||||
// processors (e.g. decompose = 1 -> many) ! We could make a special
|
||||
// exception for decomposePar but nicer would be to have read-communicator
|
||||
// ... For now detect if decomposing & disable parRun
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Work out if we're decomposing - none of the subprocs has a mesh
|
||||
bool decompose = true;
|
||||
for (const int procI : Pstream::subProcs())
|
||||
{
|
||||
if (haveMesh[procI])
|
||||
{
|
||||
decompose = false;
|
||||
}
|
||||
}
|
||||
|
||||
forAll(masterNames, i)
|
||||
{
|
||||
const word& name = masterNames[i];
|
||||
@ -837,9 +852,16 @@ void readFields
|
||||
io.writeOpt(IOobject::AUTO_WRITE);
|
||||
|
||||
// Load field (but not oldTime)
|
||||
//const bool oldParRun = Pstream::parRun(false);
|
||||
const bool oldParRun = Pstream::parRun();
|
||||
if (decompose)
|
||||
{
|
||||
Pstream::parRun(false);
|
||||
}
|
||||
readField(io, mesh, i, fields);
|
||||
//Pstream::parRun(oldParRun);
|
||||
if (decompose)
|
||||
{
|
||||
Pstream::parRun(oldParRun);
|
||||
}
|
||||
|
||||
// Create zero sized field and send
|
||||
if (subsetterPtr)
|
||||
@ -942,7 +964,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
|
||||
auto& pfld = bfld[patchi];
|
||||
const auto& fvp = mesh.boundary()[patchi];
|
||||
|
||||
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
|
||||
const auto* ppPtr = isA<CoupledPatchType>(fvp);
|
||||
if (ppPtr && ppPtr->coupled())
|
||||
{
|
||||
pfld.initEvaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
@ -962,7 +985,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
|
||||
{
|
||||
const auto& fvp = pfld.patch();
|
||||
|
||||
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
|
||||
const auto* ppPtr = isA<CoupledPatchType>(fvp);
|
||||
if (ppPtr && ppPtr->coupled())
|
||||
{
|
||||
pfld.evaluate(Pstream::defaultCommsType);
|
||||
}
|
||||
@ -979,7 +1003,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
|
||||
const auto& fvp = mesh.boundary()[patchi];
|
||||
auto& pfld = bfld[patchi];
|
||||
|
||||
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
|
||||
const auto* ppPtr = isA<CoupledPatchType>(fvp);
|
||||
if (ppPtr && ppPtr->coupled())
|
||||
{
|
||||
if (patchSchedule[patchEvali].init)
|
||||
{
|
||||
@ -1316,27 +1341,27 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
||||
correctCoupledBoundaryConditions
|
||||
<
|
||||
volScalarField,
|
||||
processorFvPatchField<scalar>
|
||||
processorFvPatch
|
||||
>(mesh);
|
||||
correctCoupledBoundaryConditions
|
||||
<
|
||||
volVectorField,
|
||||
processorFvPatchField<vector>
|
||||
processorFvPatch
|
||||
>(mesh);
|
||||
correctCoupledBoundaryConditions
|
||||
<
|
||||
volSphericalTensorField,
|
||||
processorFvPatchField<sphericalTensor>
|
||||
processorFvPatch
|
||||
>(mesh);
|
||||
correctCoupledBoundaryConditions
|
||||
<
|
||||
volSymmTensorField,
|
||||
processorFvPatchField<symmTensor>
|
||||
processorFvPatch
|
||||
>(mesh);
|
||||
correctCoupledBoundaryConditions
|
||||
<
|
||||
volTensorField,
|
||||
processorFvPatchField<tensor>
|
||||
processorFvPatch
|
||||
>(mesh);
|
||||
// No update surface fields
|
||||
|
||||
@ -1407,14 +1432,14 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
|
||||
else
|
||||
{
|
||||
autoPtr<fileOperation> defaultHandler;
|
||||
if (writeHandler.valid())
|
||||
if (writeHandler)
|
||||
{
|
||||
defaultHandler = fileHandler(std::move(writeHandler));
|
||||
}
|
||||
|
||||
mesh.write();
|
||||
|
||||
if (defaultHandler.valid())
|
||||
if (defaultHandler)
|
||||
{
|
||||
writeHandler = fileHandler(std::move(defaultHandler));
|
||||
}
|
||||
@ -2538,7 +2563,7 @@ int main(int argc, char *argv[])
|
||||
// File handler to be used for writing
|
||||
const fileOperation& fh
|
||||
(
|
||||
writeHandler.valid()
|
||||
writeHandler
|
||||
? writeHandler()
|
||||
: fileHandler()
|
||||
);
|
||||
@ -2984,7 +3009,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
fvMesh& mesh = meshPtr();
|
||||
|
||||
if (writeHandler.valid() && Pstream::master())
|
||||
if (writeHandler && Pstream::master())
|
||||
{
|
||||
// Remove any left-over empty processor directories created
|
||||
// by loadOrCreateMesh to get around e.g. collated start-up
|
||||
@ -3285,7 +3310,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
fvMesh& mesh = meshPtr();
|
||||
|
||||
if (writeHandler.valid())
|
||||
if (writeHandler)
|
||||
{
|
||||
// Remove any left-over empty processor directories created
|
||||
// by loadOrCreateMesh to get around the collated start-up
|
||||
|
||||
@ -308,11 +308,11 @@ int main(int argc, char *argv[])
|
||||
// Configuration
|
||||
|
||||
// Default to binary output, unless otherwise specified
|
||||
const IOstream::streamFormat format =
|
||||
const IOstreamOption::streamFormat format =
|
||||
(
|
||||
args.found("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
? IOstreamOption::ASCII
|
||||
: IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
const bool doBoundary = !args.found("no-boundary");
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,7 +90,7 @@ makeZeroGradientField
|
||||
>& tdf
|
||||
)
|
||||
{
|
||||
if (tdf.valid())
|
||||
if (tdf)
|
||||
{
|
||||
auto& df = tdf.ref();
|
||||
|
||||
@ -125,7 +125,7 @@ makeZeroGradientField
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tdf
|
||||
)
|
||||
{
|
||||
if (tdf.valid())
|
||||
if (tdf)
|
||||
{
|
||||
auto& df = tdf.ref();
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -37,7 +37,7 @@ bool writeAreaField
|
||||
const tmp<GeometricField<Type, faPatchField, areaMesh>>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -36,7 +36,7 @@ bool writeDimField
|
||||
const tmp<DimensionedField<Type, volMesh>>& tdf
|
||||
)
|
||||
{
|
||||
if (!tdf.valid())
|
||||
if (!tdf)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -38,7 +38,7 @@ bool writePointField
|
||||
const tmp<GeometricField<Type, pointPatchField, pointMesh>>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -38,7 +38,7 @@ bool writeVolField
|
||||
const bool nearCellValue = false
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -118,7 +118,7 @@ Foam::PtrList<const GeoField> Foam::readFields
|
||||
auto tfield =
|
||||
getField<GeoField>(mesh, objects, fieldName, syncPar);
|
||||
|
||||
if (tfield.valid())
|
||||
if (tfield)
|
||||
{
|
||||
fields.set(nFields++, tfield.ptr());
|
||||
}
|
||||
@ -157,7 +157,7 @@ Foam::PtrList<const GeoField> Foam::readFields
|
||||
auto tfield =
|
||||
getField<GeoField>(proxy, objects, fieldName, syncPar);
|
||||
|
||||
if (tfield.valid())
|
||||
if (tfield)
|
||||
{
|
||||
fields.set(nFields++, tfield.ptr());
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,7 +56,7 @@ bool writeAreaField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (tfield.valid())
|
||||
if (tfield)
|
||||
{
|
||||
writer.write(tfield());
|
||||
tfield.clear();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,7 @@ bool writeDimField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -78,7 +78,7 @@ bool writeDimField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,7 +57,7 @@ bool writePointField
|
||||
const fvMeshSubsetProxy& proxy
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -73,7 +73,7 @@ bool writePointField
|
||||
tproxied = tfield;
|
||||
}
|
||||
|
||||
if (!tproxied.valid())
|
||||
if (!tproxied)
|
||||
{
|
||||
// Or Error?
|
||||
return false;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,7 +55,7 @@ bool writeVolField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -91,7 +91,7 @@ bool writeVolField
|
||||
const tmp<GeoField>& tfield
|
||||
)
|
||||
{
|
||||
if (!tfield.valid())
|
||||
if (!tfield)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
// Read particleTrackProperties dictionary and extract values from it
|
||||
|
||||
const word dictName("particleTrackProperties");
|
||||
|
||||
#include "setConstantMeshDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
|
||||
const word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
label sampleFrequency(propsDict.get<label>("sampleFrequency"));
|
||||
|
||||
label maxPositions(propsDict.get<label>("maxPositions"));
|
||||
|
||||
label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
|
||||
|
||||
word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
|
||||
|
||||
// Optional - if empty, select all
|
||||
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
|
||||
|
||||
const word UName(propsDict.getOrDefault<word>("U", "U"));
|
||||
|
||||
const dictionary formatOptions
|
||||
(
|
||||
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,26 +0,0 @@
|
||||
IOdictionary propsDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"particleTrackProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED
|
||||
)
|
||||
);
|
||||
|
||||
const word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
const label sampleFrequency(propsDict.get<label>("sampleFrequency"));
|
||||
|
||||
const label maxPositions(propsDict.get<label>("maxPositions"));
|
||||
|
||||
const label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
|
||||
|
||||
const word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
|
||||
|
||||
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
|
||||
|
||||
const word UName(propsDict.getOrDefault<word>("U", "U"));
|
||||
|
||||
const dictionary formatOptions = propsDict.subOrEmptyDict("formatOptions");
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -247,16 +247,48 @@ int main(int argc, char *argv[])
|
||||
"Generate a file of particle tracks for cases that were"
|
||||
" computed using a tracked-parcel-type cloud"
|
||||
);
|
||||
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
// Less frequently used - reduce some clutter
|
||||
argList::setAdvanced("decomposeParDict");
|
||||
argList::setAdvanced("noFunctionObjects");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"file",
|
||||
"Alternative particleTracksProperties dictionary"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"stride",
|
||||
"int",
|
||||
"Override the sample-frequency"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"format",
|
||||
"name",
|
||||
"The writer format "
|
||||
"(default: vtk or 'setFormat' from dictionary)"
|
||||
);
|
||||
argList::addVerboseOption("Additional verbosity");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
#include "createFields.H"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Control properties
|
||||
|
||||
#include "createControls.H"
|
||||
|
||||
args.readIfPresent("format", setFormat);
|
||||
|
||||
args.readIfPresent("stride", sampleFrequency);
|
||||
sampleFrequency = max(1, sampleFrequency); // sanity
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
// Read particleTrackDict dictionary and extract values from it
|
||||
|
||||
const word dictName("particleTrackDict");
|
||||
|
||||
#include "setConstantMeshDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
|
||||
const word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
List<word> userFields(propsDict.lookup("fields"));
|
||||
|
||||
const dictionary formatOptions
|
||||
(
|
||||
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,9 +0,0 @@
|
||||
const word dictName("particleTrackDict");
|
||||
|
||||
#include "setConstantMeshDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
|
||||
word cloudName(propsDict.get<word>("cloud"));
|
||||
|
||||
List<word> userFields(propsDict.lookup("fields"));
|
||||
@ -126,14 +126,19 @@ int main(int argc, char *argv[])
|
||||
argList::noParallel();
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
#include "addDictOption.H"
|
||||
argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"file",
|
||||
"Alternative particleTrackDict dictionary"
|
||||
);
|
||||
argList::addVerboseOption("Additional verbosity");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
#include "createFields.H"
|
||||
#include "createControls.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -145,7 +145,12 @@ int main(int argc, char *argv[])
|
||||
"implicit function."
|
||||
);
|
||||
|
||||
#include "addDictOption.H"
|
||||
argList::addOption
|
||||
(
|
||||
"dict",
|
||||
"file",
|
||||
"Alternative setAlphaFieldDict dictionary"
|
||||
);
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -16,7 +16,6 @@ FoamFile
|
||||
|
||||
// Set output format : choice of
|
||||
// xmgr
|
||||
// jplot
|
||||
// gnuplot
|
||||
// raw
|
||||
// vtk
|
||||
@ -25,7 +24,7 @@ FoamFile
|
||||
setFormat raw;
|
||||
|
||||
// Surface output format. Choice of
|
||||
// null : suppress output
|
||||
// none : suppress output
|
||||
// ensight : Ensight Gold format, one field per case file
|
||||
// foamFile : separate points, faces and values file
|
||||
// dx : DX scalar or vector format
|
||||
|
||||
@ -26,7 +26,7 @@ Documentation
|
||||
(
|
||||
"$WM_PROJECT_USER_DIR/html"
|
||||
"$WM_PROJECT_DIR/doc/Doxygen/html"
|
||||
"https://www.openfoam.com/documentation/cpp-guide/html"
|
||||
"https://www.openfoam.com/documentation/guides/latest/doc/"
|
||||
);
|
||||
}
|
||||
|
||||
@ -656,7 +656,6 @@ DebugSwitches
|
||||
isoSurfaceCell 0;
|
||||
isoSurfacePoint 0;
|
||||
isoSurfaceTopo 0;
|
||||
jplot 0;
|
||||
jumpCyclic 0;
|
||||
kEpsilon 0;
|
||||
kOmega 0;
|
||||
|
||||
Submodule modules/OpenQBMM updated: cb2a4f36c3...48d0302de2
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2011 Symscape
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -83,7 +83,7 @@ namespace Foam
|
||||
|
||||
|
||||
// Move file, overwriting existing
|
||||
static bool renameFile(const fileName& src, const fileName& dst)
|
||||
static bool renameFile(const std::string& src, const std::string& dst)
|
||||
{
|
||||
constexpr const int flags
|
||||
(
|
||||
@ -132,7 +132,7 @@ class directoryIterator
|
||||
public:
|
||||
|
||||
//- Construct for dirName, optionally allowing hidden files/dirs
|
||||
directoryIterator(const fileName& dirName, bool allowHidden = false)
|
||||
directoryIterator(const std::string& dirName, bool allowHidden = false)
|
||||
:
|
||||
handle_(INVALID_HANDLE_VALUE),
|
||||
exists_(false),
|
||||
@ -170,13 +170,13 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Directory existed for opening
|
||||
bool exists() const
|
||||
bool exists() const noexcept
|
||||
{
|
||||
return exists_;
|
||||
}
|
||||
|
||||
//- Directory pointer is valid
|
||||
bool good() const
|
||||
bool good() const noexcept
|
||||
{
|
||||
return (INVALID_HANDLE_VALUE != handle_);
|
||||
}
|
||||
@ -192,7 +192,7 @@ public:
|
||||
}
|
||||
|
||||
//- The current item
|
||||
const std::string& val() const
|
||||
const std::string& val() const noexcept
|
||||
{
|
||||
return item_;
|
||||
}
|
||||
@ -225,13 +225,13 @@ public:
|
||||
// Member Operators
|
||||
|
||||
//- Same as good()
|
||||
operator bool() const
|
||||
operator bool() const noexcept
|
||||
{
|
||||
return good();
|
||||
}
|
||||
|
||||
//- Same as val()
|
||||
const std::string& operator*() const
|
||||
const std::string& operator*() const noexcept
|
||||
{
|
||||
return val();
|
||||
}
|
||||
@ -407,7 +407,7 @@ bool Foam::setEnv
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::hostName(bool)
|
||||
Foam::string Foam::hostName()
|
||||
{
|
||||
const DWORD bufLen = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
TCHAR buf[bufLen];
|
||||
@ -417,12 +417,20 @@ Foam::string Foam::hostName(bool)
|
||||
}
|
||||
|
||||
|
||||
// DEPRECATED (2022-01)
|
||||
Foam::string Foam::hostName(bool)
|
||||
{
|
||||
return Foam::hostName();
|
||||
}
|
||||
|
||||
|
||||
// DEPRECATED (2022-01)
|
||||
Foam::string Foam::domainName()
|
||||
{
|
||||
// Could use ::gethostname and ::gethostbyname like POSIX.C, but would
|
||||
// then need to link against ws_32. Prefer to minimize dependencies.
|
||||
|
||||
return string::null;
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
@ -452,7 +460,7 @@ Foam::fileName Foam::home()
|
||||
|
||||
if (env.empty())
|
||||
{
|
||||
env = Foam::getEnv("USERPROFILE");
|
||||
env = Foam::getEnv("USERPROFILE");
|
||||
}
|
||||
|
||||
return env;
|
||||
@ -595,21 +603,21 @@ Foam::fileName::Type Foam::type
|
||||
// Ignore an empty name => always UNDEFINED
|
||||
if (name.empty())
|
||||
{
|
||||
return fileName::UNDEFINED;
|
||||
return fileName::Type::UNDEFINED;
|
||||
}
|
||||
|
||||
const DWORD m = ::GetFileAttributes(name.c_str());
|
||||
|
||||
if (ms_isreg(m))
|
||||
{
|
||||
return fileName::FILE;
|
||||
return fileName::Type::FILE;
|
||||
}
|
||||
else if (ms_isdir(m))
|
||||
{
|
||||
return fileName::DIRECTORY;
|
||||
return fileName::Type::DIRECTORY;
|
||||
}
|
||||
|
||||
return fileName::UNDEFINED;
|
||||
return fileName::Type::UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MSwindows_H
|
||||
#define MSwindows_H
|
||||
#ifndef Foam_MSwindows_H
|
||||
#define Foam_MSwindows_H
|
||||
|
||||
#include "className.H"
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regExp_H
|
||||
#define regExp_H
|
||||
#ifndef Foam_regExp_H
|
||||
#define Foam_regExp_H
|
||||
|
||||
#include "regExpCxx.H"
|
||||
#include "regExpFwd.H"
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regExpFwd_H
|
||||
#define regExpFwd_H
|
||||
#ifndef Foam_regExpFwd_H
|
||||
#define Foam_regExpFwd_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -142,7 +142,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct for dirName, optionally allowing hidden files/dirs
|
||||
directoryIterator(const fileName& dirName, bool allowHidden = false)
|
||||
directoryIterator(const std::string& dirName, bool allowHidden = false)
|
||||
:
|
||||
dirptr_(nullptr),
|
||||
exists_(false),
|
||||
@ -168,13 +168,13 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Directory open succeeded
|
||||
bool exists() const
|
||||
bool exists() const noexcept
|
||||
{
|
||||
return exists_;
|
||||
}
|
||||
|
||||
//- Directory pointer is valid
|
||||
bool good() const
|
||||
bool good() const noexcept
|
||||
{
|
||||
return dirptr_;
|
||||
}
|
||||
@ -190,7 +190,7 @@ public:
|
||||
}
|
||||
|
||||
//- The current item
|
||||
const std::string& val() const
|
||||
const std::string& val() const noexcept
|
||||
{
|
||||
return item_;
|
||||
}
|
||||
@ -220,13 +220,13 @@ public:
|
||||
// Member Operators
|
||||
|
||||
//- Same as good()
|
||||
operator bool() const
|
||||
operator bool() const noexcept
|
||||
{
|
||||
return good();
|
||||
}
|
||||
|
||||
//- Same as val()
|
||||
const std::string& operator*() const
|
||||
const std::string& operator*() const noexcept
|
||||
{
|
||||
return val();
|
||||
}
|
||||
@ -302,25 +302,36 @@ bool Foam::setEnv
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::hostName(bool full)
|
||||
Foam::string Foam::hostName()
|
||||
{
|
||||
char buf[128];
|
||||
::gethostname(buf, sizeof(buf));
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
// DEPRECATED (2022-01)
|
||||
Foam::string Foam::hostName(bool full)
|
||||
{
|
||||
// implementation as per hostname from net-tools
|
||||
if (full)
|
||||
{
|
||||
char buf[128];
|
||||
::gethostname(buf, sizeof(buf));
|
||||
|
||||
struct hostent *hp = ::gethostbyname(buf);
|
||||
if (hp)
|
||||
{
|
||||
return hp->h_name;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
return buf;
|
||||
return Foam::hostName();
|
||||
}
|
||||
|
||||
|
||||
// DEPRECATED (2022-01)
|
||||
Foam::string Foam::domainName()
|
||||
{
|
||||
char buf[128];
|
||||
@ -338,7 +349,7 @@ Foam::string Foam::domainName()
|
||||
}
|
||||
}
|
||||
|
||||
return string::null;
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
@ -713,12 +724,16 @@ mode_t Foam::mode(const fileName& name, const bool followLink)
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
|
||||
Foam::fileName::Type Foam::type
|
||||
(
|
||||
const fileName& name,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
// Ignore an empty name => always UNDEFINED
|
||||
if (name.empty())
|
||||
{
|
||||
return fileName::UNDEFINED;
|
||||
return fileName::Type::UNDEFINED;
|
||||
}
|
||||
|
||||
if (POSIX::debug)
|
||||
@ -730,18 +745,18 @@ Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
|
||||
|
||||
if (S_ISREG(m))
|
||||
{
|
||||
return fileName::FILE;
|
||||
return fileName::Type::FILE;
|
||||
}
|
||||
else if (S_ISLNK(m))
|
||||
{
|
||||
return fileName::LINK;
|
||||
return fileName::Type::SYMLINK;
|
||||
}
|
||||
else if (S_ISDIR(m))
|
||||
{
|
||||
return fileName::DIRECTORY;
|
||||
return fileName::Type::DIRECTORY;
|
||||
}
|
||||
|
||||
return fileName::UNDEFINED;
|
||||
return fileName::Type::UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
@ -1033,7 +1048,7 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (srcType == fileName::LINK)
|
||||
else if (srcType == fileName::SYMLINK)
|
||||
{
|
||||
// If dest is a directory, create the destination file name.
|
||||
if (destFile.type() == fileName::DIRECTORY)
|
||||
|
||||
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef POSIX_H
|
||||
#define POSIX_H
|
||||
#ifndef Foam_POSIX_H
|
||||
#define Foam_POSIX_H
|
||||
|
||||
#include "className.H"
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regExp_H
|
||||
#define regExp_H
|
||||
#ifndef Foam_regExp_H
|
||||
#define Foam_regExp_H
|
||||
|
||||
#include "regExpCxx.H"
|
||||
#include "regExpPosix.H"
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regExpFwd_H
|
||||
#define regExpFwd_H
|
||||
#ifndef Foam_regExpFwd_H
|
||||
#define Foam_regExpFwd_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -64,8 +64,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regExpPosix_H
|
||||
#define regExpPosix_H
|
||||
#ifndef Foam_regExpPosix_H
|
||||
#define Foam_regExpPosix_H
|
||||
|
||||
#include "regExpCxx.H"
|
||||
#include <regex.h>
|
||||
|
||||
@ -819,7 +819,6 @@ writers = graph/writers
|
||||
$(writers)/rawGraph/rawGraph.C
|
||||
$(writers)/gnuplotGraph/gnuplotGraph.C
|
||||
$(writers)/xmgrGraph/xmgrGraph.C
|
||||
$(writers)/jplotGraph/jplotGraph.C
|
||||
|
||||
meshes/data/data.C
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -185,20 +185,20 @@ Foam::wordList Foam::DictionaryBase<IDLListType, T>::sortedToc
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
void Foam::DictionaryBase<IDLListType, T>::prepend(const word& keyword, T* ptr)
|
||||
{
|
||||
// NOTE: we should probably check that HashTable::insert actually worked
|
||||
hashedTs_.insert(keyword, tPtr);
|
||||
IDLListType::insert(tPtr);
|
||||
hashedTs_.insert(keyword, ptr);
|
||||
IDLListType::prepend(ptr);
|
||||
}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
|
||||
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* ptr)
|
||||
{
|
||||
// NOTE: we should probably check that HashTable::insert actually worked
|
||||
hashedTs_.insert(keyword, tPtr);
|
||||
IDLListType::append(tPtr);
|
||||
hashedTs_.insert(keyword, ptr);
|
||||
IDLListType::append(ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,8 +48,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DictionaryBase_H
|
||||
#define DictionaryBase_H
|
||||
#ifndef Foam_DictionaryBase_H
|
||||
#define Foam_DictionaryBase_H
|
||||
|
||||
#include "HashTable.H"
|
||||
#include "wordList.H"
|
||||
@ -141,11 +141,11 @@ public:
|
||||
|
||||
// Editing
|
||||
|
||||
//- Add at head of dictionary
|
||||
void insert(const word& keyword, T*);
|
||||
//- Add to front of dictionary
|
||||
void prepend(const word& keyword, T* ptr);
|
||||
|
||||
//- Add at tail of dictionary
|
||||
void append(const word& keyword, T*);
|
||||
//- Add to back of dictionary
|
||||
void append(const word& keyword, T* ptr);
|
||||
|
||||
//- Remove and return entry specified by keyword.
|
||||
// Return nullptr if the keyword was not found.
|
||||
@ -189,7 +189,6 @@ public:
|
||||
// Housekeeping
|
||||
|
||||
//- Deprecated(2020-03) use cfind()
|
||||
//
|
||||
// \deprecated(2020-03) - use cfind() method
|
||||
FOAM_DEPRECATED_FOR(2020-03, "cfind() method")
|
||||
const T* lookupPtr(const word& keyword) const
|
||||
@ -198,13 +197,18 @@ public:
|
||||
}
|
||||
|
||||
//- Deprecated(2020-03) use find()
|
||||
//
|
||||
// \deprecated(2020-03) - use find() method
|
||||
FOAM_DEPRECATED_FOR(2020-03, "find() method")
|
||||
T* lookupPtr(const word& keyword)
|
||||
{
|
||||
return this->find(keyword);
|
||||
}
|
||||
|
||||
//- Add to front of dictionary
|
||||
void insert(const word& keyword, T* ptr)
|
||||
{
|
||||
this->prepend(keyword, ptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,61 +1 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PtrDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(const label size)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(dict)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
template<class INew>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is, iNew)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
#warning File removed - left for old dependency check only
|
||||
|
||||
@ -32,13 +32,10 @@ Description
|
||||
It is derived from DictionaryBase instantiated on a memory managed form of
|
||||
intrusive doubly-linked list of \<T\>.
|
||||
|
||||
SourceFiles
|
||||
PtrDictionary.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PtrDictionary_H
|
||||
#define PtrDictionary_H
|
||||
#ifndef Foam_PtrDictionary_H
|
||||
#define Foam_PtrDictionary_H
|
||||
|
||||
#include "DictionaryBase.H"
|
||||
#include "DLPtrList.H"
|
||||
@ -57,26 +54,37 @@ class PtrDictionary
|
||||
:
|
||||
public DictionaryBase<DLPtrList<T>, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given initial table size
|
||||
PtrDictionary(const label size = 128);
|
||||
explicit PtrDictionary(const label size = 128)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(size)
|
||||
{}
|
||||
|
||||
//- Copy construct
|
||||
PtrDictionary(const PtrDictionary& dict);
|
||||
PtrDictionary(const PtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(dict)
|
||||
{}
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
PtrDictionary(Istream& is, const INew& inew);
|
||||
PtrDictionary(Istream& is, const INew& inew)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is, inew)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
PtrDictionary(Istream& is);
|
||||
explicit PtrDictionary(Istream& is)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(is)
|
||||
{}
|
||||
|
||||
|
||||
// Member operators
|
||||
// Member Operators
|
||||
|
||||
//- Find and return entry
|
||||
const T& operator[](const word& key) const
|
||||
@ -96,14 +104,6 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "PtrDictionary.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -37,8 +37,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PtrListDictionary_H
|
||||
#define PtrListDictionary_H
|
||||
#ifndef Foam_PtrListDictionary_H
|
||||
#define Foam_PtrListDictionary_H
|
||||
|
||||
#include "DictionaryBase.H"
|
||||
#include "PtrList.H"
|
||||
@ -57,13 +57,12 @@ class PtrListDictionary
|
||||
:
|
||||
public DictionaryBase<PtrList<T>, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given initial list size
|
||||
PtrListDictionary(const label size);
|
||||
explicit PtrListDictionary(const label size);
|
||||
|
||||
//- Copy construct
|
||||
PtrListDictionary(const PtrListDictionary& dict);
|
||||
@ -73,19 +72,19 @@ public:
|
||||
PtrListDictionary(Istream& is, const INew& inew);
|
||||
|
||||
//- Construct from Istream
|
||||
PtrListDictionary(Istream& is);
|
||||
explicit PtrListDictionary(Istream& is);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Set element to pointer provided and return old element
|
||||
autoPtr<T> set(const label, const word& key, T*);
|
||||
autoPtr<T> set(const label i, const word& key, T* ptr);
|
||||
|
||||
//- Set element to autoPtr value provided and return old element
|
||||
autoPtr<T> set(const label, const word& key, autoPtr<T>&);
|
||||
autoPtr<T> set(const label i, const word& key, autoPtr<T>& aptr);
|
||||
|
||||
//- Set element to tmp value provided and return old element
|
||||
autoPtr<T> set(const label, const word& key, tmp<T>&);
|
||||
autoPtr<T> set(const label i, const word& key, tmp<T>& t);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
@ -1,48 +1 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "UPtrDictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary(const label size)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
#warning File removed - left for old dependency check only
|
||||
|
||||
@ -33,13 +33,10 @@ Description
|
||||
It is derived from DictionaryBase instantiated on a non-memory managed
|
||||
form of intrusive doubly-linked list of \<T\>.
|
||||
|
||||
SourceFiles
|
||||
UPtrDictionary.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef UPtrDictionary_H
|
||||
#define UPtrDictionary_H
|
||||
#ifndef Foam_UPtrDictionary_H
|
||||
#define Foam_UPtrDictionary_H
|
||||
|
||||
#include "DictionaryBase.H"
|
||||
#include "DLList.H"
|
||||
@ -58,16 +55,21 @@ class UPtrDictionary
|
||||
:
|
||||
public DictionaryBase<DLList<T*>, T>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given initial table size
|
||||
UPtrDictionary(const label size = 128);
|
||||
explicit UPtrDictionary(const label size = 128)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(size)
|
||||
{}
|
||||
|
||||
//- Copy construct
|
||||
UPtrDictionary(const UPtrDictionary&);
|
||||
UPtrDictionary(const UPtrDictionary& dict)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(dict)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
@ -77,12 +79,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "UPtrDictionary.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,7 +61,7 @@ Foam::ILList<LListBase, T>::ILList
|
||||
:
|
||||
UILList<LListBase, T>()
|
||||
{
|
||||
for (const auto& item :lst)
|
||||
for (const auto& item : lst)
|
||||
{
|
||||
this->append(item.clone(cloneArg).ptr());
|
||||
}
|
||||
@ -83,37 +83,26 @@ template<class LListBase, class T>
|
||||
bool Foam::ILList<LListBase, T>::eraseHead()
|
||||
{
|
||||
T* p = this->removeHead();
|
||||
|
||||
if (p)
|
||||
{
|
||||
delete p;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
delete p;
|
||||
return bool(p);
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
bool Foam::ILList<LListBase, T>::erase(T* item)
|
||||
{
|
||||
T* p = remove(item);
|
||||
|
||||
if (p)
|
||||
{
|
||||
delete p;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
delete p;
|
||||
return bool(p);
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void Foam::ILList<LListBase, T>::clear()
|
||||
{
|
||||
const label len = this->size();
|
||||
label len = this->size();
|
||||
|
||||
for (label i=0; i<len; ++i)
|
||||
while (len--)
|
||||
{
|
||||
eraseHead();
|
||||
}
|
||||
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ILList_H
|
||||
#define ILList_H
|
||||
#ifndef Foam_ILList_H
|
||||
#define Foam_ILList_H
|
||||
|
||||
#include "UILList.H"
|
||||
|
||||
@ -82,14 +82,14 @@ public:
|
||||
//- Default construct
|
||||
ILList() = default;
|
||||
|
||||
//- Construct and insert the initial T item pointer
|
||||
//- Construct and add initial item pointer
|
||||
explicit ILList(T* item)
|
||||
:
|
||||
UILList<LListBase, T>(item)
|
||||
{}
|
||||
|
||||
//- Construct from Istream
|
||||
ILList(Istream& is);
|
||||
explicit ILList(Istream& is);
|
||||
|
||||
//- Copy construct using the 'clone()' method for each element
|
||||
ILList(const ILList<LListBase, T>& lst);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -76,10 +77,11 @@ Foam::LList<LListBase, T>::~LList()
|
||||
template<class LListBase, class T>
|
||||
void Foam::LList<LListBase, T>::clear()
|
||||
{
|
||||
const label len = this->size();
|
||||
for (label i=0; i<len; ++i)
|
||||
label len = this->size();
|
||||
|
||||
while (len--)
|
||||
{
|
||||
this->removeHead();
|
||||
this->eraseHead();
|
||||
}
|
||||
|
||||
LListBase::clear();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,11 +36,11 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LList_H
|
||||
#define LList_H
|
||||
#ifndef Foam_LList_H
|
||||
#define Foam_LList_H
|
||||
|
||||
#include "label.H"
|
||||
#include <initializer_list>
|
||||
#include "stdFoam.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -100,11 +100,11 @@ public:
|
||||
//- The type that can represent the container size
|
||||
typedef label size_type;
|
||||
|
||||
//- The difference between iterator objects
|
||||
//- The difference between iterators
|
||||
typedef label difference_type;
|
||||
|
||||
|
||||
// Forward declaration of STL iterators
|
||||
// Forward Declarations (iterators)
|
||||
|
||||
class iterator;
|
||||
class const_iterator;
|
||||
@ -119,43 +119,52 @@ public:
|
||||
public LListBase::link
|
||||
{
|
||||
//- Stored object
|
||||
T obj_;
|
||||
T val_;
|
||||
|
||||
//- Copy construct from given object
|
||||
link(const T& obj)
|
||||
link(const T& elem)
|
||||
:
|
||||
obj_(obj)
|
||||
val_(elem)
|
||||
{}
|
||||
|
||||
//- Move construct from given object
|
||||
link(T&& obj)
|
||||
link(T&& elem)
|
||||
:
|
||||
obj_(std::move(obj))
|
||||
val_(std::move(elem))
|
||||
{}
|
||||
|
||||
|
||||
//- Delete linked item and return the element value
|
||||
static T remove(typename LListBase::link* node)
|
||||
{
|
||||
link* p = static_cast<link*>(node);
|
||||
T val(std::move(p->val_));
|
||||
delete p;
|
||||
return val;
|
||||
}
|
||||
|
||||
//- Dereference LListBase::link to obtain address of stored object
|
||||
static constexpr T* ptr(typename LListBase::link* node)
|
||||
{
|
||||
return &(static_cast<link*>(node)->obj_);
|
||||
return &(static_cast<link*>(node)->val_);
|
||||
}
|
||||
|
||||
//- Dereference LListBase::link to obtain address of stored object
|
||||
static constexpr const T* ptr(const typename LListBase::link* node)
|
||||
{
|
||||
return &(static_cast<const link*>(node)->obj_);
|
||||
return &(static_cast<const link*>(node)->val_);
|
||||
}
|
||||
|
||||
//- Dereference LListBase::link to obtain the stored object
|
||||
static constexpr T& ref(typename LListBase::link* node)
|
||||
{
|
||||
return static_cast<link*>(node)->obj_;
|
||||
return static_cast<link*>(node)->val_;
|
||||
}
|
||||
|
||||
//- Dereference LListBase::link to obtain the stored object
|
||||
static constexpr const T& ref(const typename LListBase::link* node)
|
||||
{
|
||||
return static_cast<const link*>(node)->obj_;
|
||||
return static_cast<const link*>(node)->val_;
|
||||
}
|
||||
};
|
||||
|
||||
@ -165,16 +174,16 @@ public:
|
||||
//- Default construct
|
||||
LList() = default;
|
||||
|
||||
//- Construct and copy insert the initial T item
|
||||
explicit LList(const T& item)
|
||||
//- Construct and copy add initial item
|
||||
explicit LList(const T& elem)
|
||||
{
|
||||
this->insert(item);
|
||||
this->prepend(elem);
|
||||
}
|
||||
|
||||
//- Construct and move insert the initial T item
|
||||
explicit LList(T&& item)
|
||||
//- Construct and move add initial item
|
||||
explicit LList(T&& elem)
|
||||
{
|
||||
this->insert(std::move(item));
|
||||
this->prepend(std::move(elem));
|
||||
}
|
||||
|
||||
//- Construct from Istream
|
||||
@ -221,57 +230,54 @@ public:
|
||||
}
|
||||
|
||||
|
||||
//- Add copy at head of list
|
||||
void insert(const T& item)
|
||||
//- Add copy at front of list
|
||||
void prepend(const T& elem)
|
||||
{
|
||||
LListBase::insert(new link(item));
|
||||
LListBase::prepend(new link(elem));
|
||||
}
|
||||
|
||||
//- Move construct at head of list
|
||||
void insert(T&& item)
|
||||
//- Move construct at front of list
|
||||
void prepend(T&& elem)
|
||||
{
|
||||
LListBase::insert(new link(std::move(item)));
|
||||
LListBase::prepend(new link(std::move(elem)));
|
||||
}
|
||||
|
||||
|
||||
//- Add copy at tail of list
|
||||
void append(const T& item)
|
||||
//- Add copy at back of list
|
||||
void append(const T& elem)
|
||||
{
|
||||
LListBase::append(new link(item));
|
||||
LListBase::append(new link(elem));
|
||||
}
|
||||
|
||||
//- Move construct at tail of list
|
||||
void append(T&& item)
|
||||
//- Move construct at back of list
|
||||
void append(T&& elem)
|
||||
{
|
||||
LListBase::append(new link(std::move(item)));
|
||||
LListBase::append(new link(std::move(elem)));
|
||||
}
|
||||
|
||||
//- Erase the first entry
|
||||
bool eraseHead()
|
||||
{
|
||||
link* p = static_cast<link*>(LListBase::removeHead());
|
||||
delete p;
|
||||
return bool(p);
|
||||
}
|
||||
|
||||
//- Remove and return head
|
||||
//- Remove and return first entry
|
||||
T removeHead()
|
||||
{
|
||||
auto p = LListBase::removeHead();
|
||||
T obj(std::move(link::ref(p)));
|
||||
delete p;
|
||||
return obj;
|
||||
return link::remove(LListBase::removeHead());
|
||||
}
|
||||
|
||||
//- Remove and return element
|
||||
T remove(link* item)
|
||||
{
|
||||
auto p = LListBase::remove(item);
|
||||
T obj(std::move(link::ref(p)));
|
||||
delete p;
|
||||
return obj;
|
||||
return link::remove(LListBase::remove(item));
|
||||
}
|
||||
|
||||
//- Remove and return element specified by iterator
|
||||
T remove(iterator& iter)
|
||||
{
|
||||
auto p = LListBase::remove(iter);
|
||||
T obj(std::move(link::ref(p)));
|
||||
delete p;
|
||||
return obj;
|
||||
return link::remove(LListBase::remove(iter));
|
||||
}
|
||||
|
||||
|
||||
@ -279,7 +285,7 @@ public:
|
||||
void clear();
|
||||
|
||||
//- Transfer the contents of the argument into this List
|
||||
// and annul the argument list.
|
||||
//- and annul the argument list.
|
||||
void transfer(LList<LListBase, T>& lst);
|
||||
|
||||
|
||||
@ -567,6 +573,14 @@ public:
|
||||
return crend();
|
||||
}
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Add copy at front of list. Same as prepend()
|
||||
void insert(const T& elem) { this->prepend(elem); }
|
||||
|
||||
//- Move construct at front of list. Same as prepend()
|
||||
void insert(T&& elem) { this->prepend(std::move(elem)); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,19 +68,21 @@ Foam::Istream& Foam::LList<LListBase, T>::readList(Istream& is)
|
||||
{
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
T element;
|
||||
is >> element;
|
||||
list.append(element);
|
||||
T elem;
|
||||
is >> elem;
|
||||
list.append(std::move(elem));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
T element;
|
||||
is >> element;
|
||||
// Uniform content (delimiter == token::BEGIN_BLOCK)
|
||||
|
||||
T elem;
|
||||
is >> elem;
|
||||
|
||||
for (label i=0; i<len; ++i)
|
||||
{
|
||||
list.append(element);
|
||||
list.append(elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,9 +99,9 @@ Foam::Istream& Foam::LList<LListBase, T>::readList(Istream& is)
|
||||
{
|
||||
is.putBack(tok);
|
||||
|
||||
T element;
|
||||
is >> element;
|
||||
list.append(element);
|
||||
T elem;
|
||||
is >> elem;
|
||||
list.append(std::move(elem));
|
||||
|
||||
is >> tok;
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,22 +66,17 @@ template<class LListBase, class T>
|
||||
bool Foam::LPtrList<LListBase, T>::eraseHead()
|
||||
{
|
||||
T* p = this->removeHead();
|
||||
|
||||
if (p)
|
||||
{
|
||||
delete p;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
delete p;
|
||||
return bool(p);
|
||||
}
|
||||
|
||||
|
||||
template<class LListBase, class T>
|
||||
void Foam::LPtrList<LListBase, T>::clear()
|
||||
{
|
||||
const label len = this->size();
|
||||
for (label i=0; i<len; ++i)
|
||||
label len = this->size();
|
||||
|
||||
while (len--)
|
||||
{
|
||||
eraseHead();
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LPtrList_H
|
||||
#define LPtrList_H
|
||||
#ifndef Foam_LPtrList_H
|
||||
#define Foam_LPtrList_H
|
||||
|
||||
#include "LList.H"
|
||||
|
||||
@ -46,7 +46,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
|
||||
template<class LListBase, class T> class LPtrList;
|
||||
|
||||
@ -74,8 +74,6 @@ class LPtrList
|
||||
:
|
||||
public LList<LListBase, T*>
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read from Istream using given Istream constructor class
|
||||
@ -114,13 +112,13 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null construct
|
||||
//- Default construct
|
||||
LPtrList() = default;
|
||||
|
||||
//- Construct and insert the initial T item
|
||||
//- Construct and add initial item pointer
|
||||
explicit LPtrList(T* item)
|
||||
{
|
||||
this->insert(item);
|
||||
this->prepend(item);
|
||||
}
|
||||
|
||||
//- Copy construct by using 'clone()' for each element
|
||||
@ -134,7 +132,7 @@ public:
|
||||
LPtrList(Istream& is, const INew& inew);
|
||||
|
||||
//- Construct from Istream using default Istream constructor class
|
||||
LPtrList(Istream& is);
|
||||
explicit LPtrList(Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef UILList_H
|
||||
#define UILList_H
|
||||
#ifndef Foam_UILList_H
|
||||
#define Foam_UILList_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
@ -95,7 +95,7 @@ public:
|
||||
typedef label difference_type;
|
||||
|
||||
|
||||
// Forward declaration of STL iterators
|
||||
// Forward Declarations (iterators)
|
||||
|
||||
class iterator;
|
||||
class const_iterator;
|
||||
@ -109,10 +109,10 @@ public:
|
||||
//- Default construct
|
||||
UILList() = default;
|
||||
|
||||
//- Construct and insert the initial T item
|
||||
//- Construct and add initial item pointer
|
||||
explicit UILList(T* item)
|
||||
{
|
||||
this->insert(item);
|
||||
this->prepend(item);
|
||||
}
|
||||
|
||||
//- Construct as copy
|
||||
@ -446,7 +446,6 @@ public:
|
||||
{
|
||||
return crend();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::DLListBase::insert(DLListBase::link* item)
|
||||
void Foam::DLListBase::prepend(DLListBase::link* item)
|
||||
{
|
||||
if (!item)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,8 +43,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DLListBase_H
|
||||
#define DLListBase_H
|
||||
#ifndef Foam_DLListBase_H
|
||||
#define Foam_DLListBase_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
@ -76,10 +76,10 @@ public:
|
||||
link() = default;
|
||||
|
||||
//- Check if the node is registered with the list
|
||||
inline bool registered() const;
|
||||
inline bool registered() const noexcept;
|
||||
|
||||
//- Deregister the node after removal
|
||||
inline void deregister();
|
||||
inline void deregister() noexcept;
|
||||
};
|
||||
|
||||
|
||||
@ -88,10 +88,10 @@ private:
|
||||
// Private Data
|
||||
|
||||
//- Pointer to first element
|
||||
link *first_ = nullptr;
|
||||
link* first_ = nullptr;
|
||||
|
||||
//- Pointer to last element
|
||||
link *last_ = nullptr;
|
||||
link* last_ = nullptr;
|
||||
|
||||
//- Number of elements in the list
|
||||
label size_ = 0;
|
||||
@ -169,10 +169,10 @@ public:
|
||||
inline const link* last() const;
|
||||
|
||||
|
||||
//- Add at head of list
|
||||
void insert(link* item);
|
||||
//- Add at front of list
|
||||
void prepend(link* item);
|
||||
|
||||
//- Add at tail of list
|
||||
//- Add at back of list
|
||||
void append(link* item);
|
||||
|
||||
//- Swap this element with the one above unless it is at the top
|
||||
@ -181,13 +181,13 @@ public:
|
||||
//- Swap this element with the one below unless it is at the bottom
|
||||
bool swapDown(link* item);
|
||||
|
||||
//- Remove and return head
|
||||
//- Remove and return first entry
|
||||
link* removeHead();
|
||||
|
||||
//- Remove and return element
|
||||
link* remove(link* item);
|
||||
|
||||
// Remove and return element specified by iterator
|
||||
//- Remove and return element specified by iterator
|
||||
inline link* remove(iterator& iter);
|
||||
|
||||
//- Replace oldLink with newLink and return element
|
||||
@ -236,18 +236,10 @@ public:
|
||||
inline iterator(DLListBase* list, link* item);
|
||||
|
||||
//- The storage node
|
||||
inline link* get_node() const;
|
||||
inline link* get_node() const noexcept;
|
||||
|
||||
//- Pointing at a valid storage node
|
||||
inline bool good() const;
|
||||
|
||||
//- Deprecated(2019-01) Pointing at a valid storage node
|
||||
// \deprecated(2019-01) - use good() method
|
||||
FOAM_DEPRECATED_FOR(2019-01, "good() method")
|
||||
bool found() const
|
||||
{
|
||||
return this->good();
|
||||
}
|
||||
inline bool good() const noexcept;
|
||||
|
||||
//- Move backward through list
|
||||
inline void prev();
|
||||
@ -290,18 +282,10 @@ public:
|
||||
inline const_iterator(const DLListBase::iterator& iter);
|
||||
|
||||
//- The storage node
|
||||
inline const link* get_node() const;
|
||||
inline const link* get_node() const noexcept;
|
||||
|
||||
//- Pointing at a valid storage node
|
||||
inline bool good() const;
|
||||
|
||||
//- Deprecated(2019-01) Pointing at a valid storage node
|
||||
// \deprecated(2019-01) - use good() method
|
||||
FOAM_DEPRECATED_FOR(2019-01, "good() method")
|
||||
bool found() const
|
||||
{
|
||||
return this->good();
|
||||
}
|
||||
inline bool good() const noexcept;
|
||||
|
||||
//- Move backward through list
|
||||
inline void prev();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -99,13 +99,13 @@ Foam::DLListBase::crend() const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::DLListBase::link::registered() const
|
||||
inline bool Foam::DLListBase::link::registered() const noexcept
|
||||
{
|
||||
return prev_ != nullptr && next_ != nullptr;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::DLListBase::link::deregister()
|
||||
inline void Foam::DLListBase::link::deregister() noexcept
|
||||
{
|
||||
prev_ = next_ = nullptr;
|
||||
}
|
||||
@ -252,13 +252,13 @@ inline Foam::DLListBase::iterator::iterator
|
||||
|
||||
|
||||
inline Foam::DLListBase::link*
|
||||
Foam::DLListBase::iterator::get_node() const
|
||||
Foam::DLListBase::iterator::get_node() const noexcept
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::DLListBase::iterator::good() const
|
||||
inline bool Foam::DLListBase::iterator::good() const noexcept
|
||||
{
|
||||
return (node_ != nullptr);
|
||||
}
|
||||
@ -358,13 +358,13 @@ inline Foam::DLListBase::const_iterator::const_iterator
|
||||
|
||||
|
||||
inline const Foam::DLListBase::link*
|
||||
Foam::DLListBase::const_iterator::get_node() const
|
||||
Foam::DLListBase::const_iterator::get_node() const noexcept
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::DLListBase::const_iterator::good() const
|
||||
inline bool Foam::DLListBase::const_iterator::good() const noexcept
|
||||
{
|
||||
return (node_ != nullptr);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::SLListBase::insert(SLListBase::link* item)
|
||||
void Foam::SLListBase::prepend(SLListBase::link* item)
|
||||
{
|
||||
if (!item)
|
||||
{
|
||||
|
||||
@ -43,8 +43,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SLListBase_H
|
||||
#define SLListBase_H
|
||||
#ifndef Foam_SLListBase_H
|
||||
#define Foam_SLListBase_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
@ -157,13 +157,13 @@ public:
|
||||
inline const link* last() const;
|
||||
|
||||
|
||||
//- Add at head of list
|
||||
void insert(link* item);
|
||||
//- Add at front of list
|
||||
void prepend(link* item);
|
||||
|
||||
//- Add at tail of list
|
||||
//- Add at back of list
|
||||
void append(link* item);
|
||||
|
||||
//- Remove and return head
|
||||
//- Remove and return first entry
|
||||
link* removeHead();
|
||||
|
||||
// Remove and return element
|
||||
@ -212,18 +212,10 @@ public:
|
||||
inline iterator(SLListBase* list, link* item);
|
||||
|
||||
//- The storage node
|
||||
inline link* get_node() const;
|
||||
inline link* get_node() const noexcept;
|
||||
|
||||
//- Pointing at a valid storage node
|
||||
inline bool good() const;
|
||||
|
||||
//- Deprecated(2019-01) Pointing at a valid storage node
|
||||
// \deprecated(2019-01) - use good() method
|
||||
FOAM_DEPRECATED_FOR(2019-01, "good() method")
|
||||
bool found() const
|
||||
{
|
||||
return this->good();
|
||||
}
|
||||
inline bool good() const noexcept;
|
||||
|
||||
//- Cannot move backward through list
|
||||
inline void prev() = delete;
|
||||
@ -265,18 +257,10 @@ public:
|
||||
inline const_iterator(const SLListBase::iterator& iter);
|
||||
|
||||
//- The storage node
|
||||
inline const link* get_node() const;
|
||||
inline const link* get_node() const noexcept;
|
||||
|
||||
//- Pointing at a valid storage node
|
||||
inline bool good() const;
|
||||
|
||||
//- Deprecated(2019-01) Pointing at a valid storage node
|
||||
// \deprecated(2019-01) - use good() method
|
||||
FOAM_DEPRECATED_FOR(2019-01, "good() method")
|
||||
bool found() const
|
||||
{
|
||||
return this->good();
|
||||
}
|
||||
inline bool good() const noexcept;
|
||||
|
||||
//- Cannot move backward through list
|
||||
inline void prev() = delete;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -196,13 +196,13 @@ inline Foam::SLListBase::iterator::iterator
|
||||
|
||||
|
||||
inline Foam::SLListBase::link*
|
||||
Foam::SLListBase::iterator::get_node() const
|
||||
Foam::SLListBase::iterator::get_node() const noexcept
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::SLListBase::iterator::good() const
|
||||
inline bool Foam::SLListBase::iterator::good() const noexcept
|
||||
{
|
||||
return (node_ != nullptr);
|
||||
}
|
||||
@ -295,13 +295,13 @@ inline Foam::SLListBase::const_iterator::const_iterator
|
||||
|
||||
|
||||
inline const Foam::SLListBase::link*
|
||||
Foam::SLListBase::const_iterator::get_node() const
|
||||
Foam::SLListBase::const_iterator::get_node() const noexcept
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::SLListBase::const_iterator::good() const
|
||||
inline bool Foam::SLListBase::const_iterator::good() const noexcept
|
||||
{
|
||||
return (node_ != nullptr);
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DLList_H
|
||||
#define DLList_H
|
||||
#ifndef Foam_DLList_H
|
||||
#define Foam_DLList_H
|
||||
|
||||
#include "LList.H"
|
||||
#include "DLListBase.H"
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DLPtrList_H
|
||||
#define DLPtrList_H
|
||||
#ifndef Foam_DLPtrList_H
|
||||
#define Foam_DLPtrList_H
|
||||
|
||||
#include "LPtrList.H"
|
||||
#include "DLListBase.H"
|
||||
|
||||
@ -34,8 +34,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef FIFOStack_H
|
||||
#define FIFOStack_H
|
||||
#ifndef Foam_FIFOStack_H
|
||||
#define Foam_FIFOStack_H
|
||||
|
||||
#include "SLList.H"
|
||||
|
||||
@ -63,28 +63,28 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return a copy of the top element
|
||||
T top() const
|
||||
//- Const reference to the top element
|
||||
const T& top() const
|
||||
{
|
||||
return this->last();
|
||||
}
|
||||
|
||||
//- Return a copy of the bottom element
|
||||
T bottom() const
|
||||
//- Const reference to the bottom element
|
||||
const T& bottom() const
|
||||
{
|
||||
return this->first();
|
||||
}
|
||||
|
||||
//- Push an element onto the back of the stack
|
||||
void push(const T& element)
|
||||
void push(const T& elem)
|
||||
{
|
||||
this->append(element);
|
||||
this->append(elem);
|
||||
}
|
||||
|
||||
//- Move an element onto the back of the stack
|
||||
void push(T&& element)
|
||||
void push(T&& elem)
|
||||
{
|
||||
this->append(std::move(element));
|
||||
this->append(std::move(elem));
|
||||
}
|
||||
|
||||
//- Pop the bottom element off the stack
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IDLList_H
|
||||
#define IDLList_H
|
||||
#ifndef Foam_IDLList_H
|
||||
#define Foam_IDLList_H
|
||||
|
||||
#include "ILList.H"
|
||||
#include "DLListBase.H"
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ISLList_H
|
||||
#define ISLList_H
|
||||
#ifndef Foam_ISLList_H
|
||||
#define Foam_ISLList_H
|
||||
|
||||
#include "ILList.H"
|
||||
#include "SLListBase.H"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,8 +34,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LIFOStack_H
|
||||
#define LIFOStack_H
|
||||
#ifndef Foam_LIFOStack_H
|
||||
#define Foam_LIFOStack_H
|
||||
|
||||
#include "SLList.H"
|
||||
|
||||
@ -63,28 +63,28 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return a copy of the top element
|
||||
T top() const
|
||||
//- Const reference to the top element
|
||||
const T& top() const
|
||||
{
|
||||
return this->first();
|
||||
}
|
||||
|
||||
//- Return a copy of the bottom element
|
||||
T bottom() const
|
||||
//- Const reference to the bottom element
|
||||
const T& bottom() const
|
||||
{
|
||||
return this->last();
|
||||
}
|
||||
|
||||
//- Push an element onto the front of the stack
|
||||
void push(const T& element)
|
||||
void push(const T& elem)
|
||||
{
|
||||
this->insert(element);
|
||||
this->prepend(elem);
|
||||
}
|
||||
|
||||
//- Move an element onto the front of the stack
|
||||
void push(T&& element)
|
||||
void push(T&& elem)
|
||||
{
|
||||
this->insert(std::move(element));
|
||||
this->prepend(std::move(elem));
|
||||
}
|
||||
|
||||
//- Pop the top element off the stack
|
||||
|
||||
@ -31,12 +31,11 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SLList_H
|
||||
#define SLList_H
|
||||
#ifndef Foam_SLList_H
|
||||
#define Foam_SLList_H
|
||||
|
||||
#include "SLListBase.H"
|
||||
#include "LList.H"
|
||||
|
||||
#include "SLListFwd.H"
|
||||
|
||||
#endif
|
||||
|
||||
@ -31,14 +31,14 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SLListFwd_H
|
||||
#define SLListFwd_H
|
||||
#ifndef Foam_SLListFwd_H
|
||||
#define Foam_SLListFwd_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class SLListBase;
|
||||
template<class LListBase, class T> class LList;
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SLPtrList_H
|
||||
#define SLPtrList_H
|
||||
#ifndef Foam_SLPtrList_H
|
||||
#define Foam_SLPtrList_H
|
||||
|
||||
#include "SLListBase.H"
|
||||
#include "LPtrList.H"
|
||||
|
||||
@ -31,14 +31,14 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SLPtrListFwd_H
|
||||
#define SLPtrListFwd_H
|
||||
#ifndef Foam_SLPtrListFwd_H
|
||||
#define Foam_SLPtrListFwd_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class SLListBase;
|
||||
template<class LListBase, class T> class LPtrList;
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef UIDLList_H
|
||||
#define UIDLList_H
|
||||
#ifndef Foam_UIDLList_H
|
||||
#define Foam_UIDLList_H
|
||||
|
||||
#include "UILList.H"
|
||||
#include "DLListBase.H"
|
||||
|
||||
@ -652,12 +652,9 @@ void Foam::List<T>::operator=(SLList<T>&& list)
|
||||
|
||||
reAlloc(len);
|
||||
|
||||
T* iter = this->begin();
|
||||
|
||||
while (len--)
|
||||
for (T* iter = this->begin(); len--; ++iter)
|
||||
{
|
||||
*iter = std::move(list.removeHead());
|
||||
++iter;
|
||||
}
|
||||
|
||||
list.clear();
|
||||
|
||||
@ -52,7 +52,7 @@ namespace Foam
|
||||
|
||||
const fileName::Type pathType = Foam::type(otherName, false);
|
||||
|
||||
if (pathType == fileName::FILE || pathType == fileName::LINK)
|
||||
if (pathType == fileName::FILE || pathType == fileName::SYMLINK)
|
||||
{
|
||||
Foam::rm(otherName);
|
||||
}
|
||||
@ -60,7 +60,7 @@ namespace Foam
|
||||
// Disallow writing into symlinked files.
|
||||
// Eg, avoid problems with symlinked initial fields
|
||||
|
||||
if (!append && Foam::type(targetName, false) == fileName::LINK)
|
||||
if (!append && Foam::type(targetName, false) == fileName::SYMLINK)
|
||||
{
|
||||
Foam::rm(targetName);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef UPstream_H
|
||||
#define UPstream_H
|
||||
#ifndef Foam_UPstream_H
|
||||
#define Foam_UPstream_H
|
||||
|
||||
#include "labelList.H"
|
||||
#include "DynamicList.H"
|
||||
@ -645,8 +645,10 @@ public:
|
||||
|
||||
// Gather single, contiguous value(s)
|
||||
|
||||
//- Individual values into list locations.
|
||||
// On master list length == nProcs, otherwise zero length
|
||||
//- Gather individual values into list locations.
|
||||
// On master list length == nProcs, otherwise zero length.
|
||||
// If called in non-parallel mode,
|
||||
// the returned list length is 1 with localValue.
|
||||
template<class T>
|
||||
static List<T> listGatherValues
|
||||
(
|
||||
@ -654,8 +656,10 @@ public:
|
||||
const label communicator = worldComm
|
||||
);
|
||||
|
||||
//- Individual values into list locations.
|
||||
// On master list length == nProcs, otherwise zero length
|
||||
//- Scatter individual values from list locations.
|
||||
// On master input list length == nProcs, ignored on other procs.
|
||||
// If called in non-parallel mode,
|
||||
// returns the first list element (or zero).
|
||||
template<class T>
|
||||
static T listScatterValues
|
||||
(
|
||||
|
||||
@ -55,25 +55,25 @@ std::size_t Foam::base64Layer::encodedLength(std::size_t n)
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
inline unsigned char Foam::base64Layer::encode0() const
|
||||
inline unsigned char Foam::base64Layer::encode0() const noexcept
|
||||
{
|
||||
// Top 6 bits of char0
|
||||
return base64Chars[((group_[0] & 0xFC) >> 2)];
|
||||
}
|
||||
|
||||
inline unsigned char Foam::base64Layer::encode1() const
|
||||
inline unsigned char Foam::base64Layer::encode1() const noexcept
|
||||
{
|
||||
// Bottom 2 bits of char0, Top 4 bits of char1
|
||||
return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)];
|
||||
}
|
||||
|
||||
inline unsigned char Foam::base64Layer::encode2() const
|
||||
inline unsigned char Foam::base64Layer::encode2() const noexcept
|
||||
{
|
||||
// Bottom 4 bits of char1, Top 2 bits of char2
|
||||
return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)];
|
||||
}
|
||||
|
||||
inline unsigned char Foam::base64Layer::encode3() const
|
||||
inline unsigned char Foam::base64Layer::encode3() const noexcept
|
||||
{
|
||||
// Bottom 6 bits of char2
|
||||
return base64Chars[(group_[2] & 0x3F)];
|
||||
|
||||
@ -39,8 +39,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef base64Layer_H
|
||||
#define base64Layer_H
|
||||
#ifndef Foam_base64Layer_H
|
||||
#define Foam_base64Layer_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -72,16 +72,10 @@ class base64Layer
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
inline unsigned char encode0() const;
|
||||
inline unsigned char encode1() const;
|
||||
inline unsigned char encode2() const;
|
||||
inline unsigned char encode3() const;
|
||||
|
||||
//- No copy construct
|
||||
base64Layer(const base64Layer&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const base64Layer&) = delete;
|
||||
inline unsigned char encode0() const noexcept;
|
||||
inline unsigned char encode1() const noexcept;
|
||||
inline unsigned char encode2() const noexcept;
|
||||
inline unsigned char encode3() const noexcept;
|
||||
|
||||
|
||||
protected:
|
||||
@ -91,6 +85,12 @@ protected:
|
||||
//- Add a character to the group, outputting when the group is full.
|
||||
void add(char c);
|
||||
|
||||
//- No copy construct
|
||||
base64Layer(const base64Layer&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const base64Layer&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef token_H
|
||||
#define token_H
|
||||
#ifndef Foam_token_H
|
||||
#define Foam_token_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1284,12 +1284,13 @@ Foam::Time& Foam::Time::operator++()
|
||||
// Adjust the precision of the time directory name if necessary
|
||||
if (writeTime_)
|
||||
{
|
||||
// User-time equivalent of deltaT
|
||||
const scalar userDeltaT =
|
||||
timeToUserTime(value()) - timeToUserTime(value() - deltaT_);
|
||||
|
||||
// Tolerance used when testing time equivalence
|
||||
const scalar timeTol =
|
||||
max(min(pow(10.0, -precision_), 0.1*deltaT_), SMALL);
|
||||
|
||||
// User-time equivalent of deltaT
|
||||
const scalar userDeltaT = timeToUserTime(deltaT_);
|
||||
max(min(pow(scalar(10), -precision_), 0.1*userDeltaT), SMALL);
|
||||
|
||||
// Time value obtained by reading timeName
|
||||
scalar timeNameValue = -VGREAT;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -102,8 +102,8 @@ Foam::dictionary::dictionary
|
||||
|
||||
if (e.keyword().isPattern())
|
||||
{
|
||||
patterns_.insert(&e);
|
||||
regexps_.insert(autoPtr<regExp>::New(e.keyword()));
|
||||
patterns_.prepend(&e);
|
||||
regexps_.prepend(autoPtr<regExp>::New(e.keyword()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -124,8 +124,8 @@ Foam::dictionary::dictionary
|
||||
|
||||
if (e.keyword().isPattern())
|
||||
{
|
||||
patterns_.insert(&e);
|
||||
regexps_.insert(autoPtr<regExp>::New(e.keyword()));
|
||||
patterns_.prepend(&e);
|
||||
regexps_.prepend(autoPtr<regExp>::New(e.keyword()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -670,8 +670,8 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
patterns_.insert(entryPtr);
|
||||
regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
|
||||
patterns_.prepend(entryPtr);
|
||||
regexps_.prepend(autoPtr<regExp>::New(entryPtr->keyword()));
|
||||
}
|
||||
|
||||
return entryPtr; // now an entry in the dictionary
|
||||
@ -698,8 +698,8 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
patterns_.insert(entryPtr);
|
||||
regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
|
||||
patterns_.prepend(entryPtr);
|
||||
regexps_.prepend(autoPtr<regExp>::New(entryPtr->keyword()));
|
||||
}
|
||||
|
||||
return entryPtr; // now an entry in the dictionary
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,7 @@ namespace
|
||||
// Walk lists of patterns and regexps for an exact match
|
||||
// or a regular expression match
|
||||
template<class WcIterator, class ReIterator>
|
||||
static bool findInPatterns
|
||||
bool findInPatterns
|
||||
(
|
||||
const bool patternMatch,
|
||||
const Foam::word& keyword,
|
||||
@ -680,8 +680,8 @@ bool Foam::dictionary::changeKeyword
|
||||
|
||||
if (newKeyword.isPattern())
|
||||
{
|
||||
patterns_.insert(iter());
|
||||
regexps_.insert(autoPtr<regExp>::New(newKeyword));
|
||||
patterns_.prepend(iter());
|
||||
regexps_.prepend(autoPtr<regExp>::New(newKeyword));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -30,12 +30,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::namedDictionary::namedDictionary()
|
||||
:
|
||||
Tuple2<keyType, dictionary>()
|
||||
{}
|
||||
|
||||
|
||||
Foam::namedDictionary::namedDictionary(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,8 +61,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef namedDictionary_H
|
||||
#define namedDictionary_H
|
||||
#ifndef Foam_namedDictionary_H
|
||||
#define Foam_namedDictionary_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "Tuple2.H"
|
||||
@ -74,6 +74,7 @@ namespace Foam
|
||||
|
||||
// Forward Declarations
|
||||
class namedDictionary;
|
||||
|
||||
Istream& operator>>(Istream&, namedDictionary&);
|
||||
Ostream& operator<<(Ostream&, const namedDictionary&);
|
||||
|
||||
@ -93,7 +94,7 @@ public:
|
||||
using Tuple2<keyType, dictionary>::Tuple2;
|
||||
|
||||
//- Default construct
|
||||
namedDictionary();
|
||||
namedDictionary() = default;
|
||||
|
||||
//- Construct from Istream
|
||||
explicit namedDictionary(Istream& is);
|
||||
|
||||
@ -45,7 +45,7 @@ Foam::expressions::fieldExpr::parseDriver::getField
|
||||
}
|
||||
|
||||
|
||||
if (tvar.valid())
|
||||
if (tvar)
|
||||
{
|
||||
const auto& var = tvar.cref();
|
||||
const Field<Type>& vals = var.cref<Type>();
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,7 @@ Description
|
||||
#include "fieldExprLemonParser.h"
|
||||
#include "fieldExprParser.H"
|
||||
#include "Enum.H"
|
||||
#include "macros.H"
|
||||
//#include "macros.H"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#pragma GCC diagnostic ignored "-Wunused-const-variable"
|
||||
@ -163,7 +163,7 @@ static int driverTokenType
|
||||
|
||||
#define EMIT_TOKEN(T) \
|
||||
driver_.parsePosition() = (ts-buf); \
|
||||
DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \
|
||||
DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \
|
||||
parser_->parse(TOKEN_OF(T)); \
|
||||
driver_.parsePosition() = (p-buf);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,7 +34,7 @@ Description
|
||||
#include "fieldExprLemonParser.h"
|
||||
#include "fieldExprParser.H"
|
||||
#include "Enum.H"
|
||||
#include "macros.H"
|
||||
//#include "macros.H"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#pragma GCC diagnostic ignored "-Wunused-const-variable"
|
||||
@ -161,7 +161,7 @@ static int driverTokenType
|
||||
|
||||
#define EMIT_TOKEN(T) \
|
||||
driver_.parsePosition() = (ts-buf); \
|
||||
DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \
|
||||
DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \
|
||||
parser_->parse(TOKEN_OF(T)); \
|
||||
driver_.parsePosition() = (p-buf);
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fieldTypes_H
|
||||
#define fieldTypes_H
|
||||
#ifndef Foam_fieldTypes_H
|
||||
#define Foam_fieldTypes_H
|
||||
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
@ -40,9 +40,11 @@ Description
|
||||
#include "tensor.H"
|
||||
#include "triad.H"
|
||||
#include "macros.H"
|
||||
#include "wordList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define CAPITALIZE_label Label
|
||||
#define CAPITALIZE_scalar Scalar
|
||||
#define CAPITALIZE_vector Vector
|
||||
#define CAPITALIZE_sphericalTensor SphericalTensor
|
||||
|
||||
@ -41,8 +41,6 @@ SourceFiles
|
||||
#include "pointPatchFields.H"
|
||||
#include "pointFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user