Compare commits

..

1 Commits

Author SHA1 Message Date
14aeaf8dab RELEASE: Updated version to v2112 2021-12-20 18:57:43 +00:00
631 changed files with 5902 additions and 9338 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -274,9 +274,9 @@ int main(int argc, char *argv[])
{
DLPtrList<Scalar> llist1;
llist1.prepend(new Scalar(100));
llist1.prepend(new Scalar(200));
llist1.prepend(new Scalar(300));
llist1.insert(new Scalar(100));
llist1.insert(new Scalar(200));
llist1.insert(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.prepend(new Scalar(100));
llist1.prepend(new Scalar(200));
llist1.prepend(new Scalar(300));
llist1.insert(new Scalar(100));
llist1.insert(new Scalar(200));
llist1.insert(new Scalar(300));
for (const auto& it : llist1)
{

View File

@ -104,8 +104,6 @@ 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>();

View File

@ -633,10 +633,10 @@ int main(int argc, char *argv[])
fileName::Type lnAType = lnA.type(false);
if (lnAType != fileName::SYMLINK)
if (lnAType != fileName::LINK)
{
FatalErrorIn("Test-fileName") << "Type of softlink " << lnA
<< " should be " << fileName::SYMLINK
<< " should be " << fileName::LINK
<< " 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::SYMLINK)
if (lnB.type(false) != fileName::LINK)
{
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
<< " should be " << fileName::SYMLINK
<< " should be " << fileName::LINK
<< " but is " << lnB.type(false) << exit(FatalError);
}
if (lnB.type(true) != fileName::DIRECTORY)

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020 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) \
Info<< nl << #Format << ": " \
<< flatOutput(Content, FlatOutput::Format{}) << nl
#define printFlatOutput(Content, Format) \
STRINGIFY(Format) << ": " << flatOutput(Content, FlatOutput::Format{})
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,20 +77,20 @@ int main(int argc, char *argv[])
Info<< nl << "write: ";
flatOutput(words1).write(Info) << nl;
printFlatOutput(words1, BareComma);
printFlatOutput(words1, BareSpace);
Info<< nl << printFlatOutput(words1, BareComma) << nl;
Info<< nl << printFlatOutput(words1, BareSpace) << nl;
printFlatOutput(words1, BraceComma);
printFlatOutput(words1, BraceSpace);
Info<< nl << printFlatOutput(words1, BraceComma) << nl;
Info<< nl << printFlatOutput(words1, BraceSpace) << nl;
printFlatOutput(words1, ParenComma);
printFlatOutput(words1, ParenSpace);
Info<< nl << printFlatOutput(words1, ParenComma) << nl;
Info<< nl << printFlatOutput(words1, ParenSpace) << nl;
printFlatOutput(words1, PointyComma);
printFlatOutput(words1, PointySpace);
Info<< nl << printFlatOutput(words1, PointyComma) << nl;
Info<< nl << printFlatOutput(words1, PointySpace) << nl;
printFlatOutput(words1, SquareComma);
printFlatOutput(words1, SquareSpace);
Info<< nl << printFlatOutput(words1, SquareComma) << nl;
Info<< nl << printFlatOutput(words1, SquareSpace) << nl;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -180,36 +180,6 @@ 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;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 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
Info<< "Gathered/scattered cell centres:" << endl;
labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size();
pointField allCcs(globalNumbering.size());
globalNumbering.gather
(
Pstream::worldComm,
Pstream::procID(Pstream::worldComm),
mesh.cellCentres(),
allCcs
);
Pstream::scatter(allCcs);
inOut[1] = allCcs.size();
Pout<< " " << inOut << endl;
// Compare
forAll(ccs, i)
@ -239,13 +239,10 @@ int main(int argc, char *argv[])
Info<< "local-sizes: " << globalPointsPtr().sizes() << nl;
pointField patchPoints
(
globalPointsPtr().gather
(
UIndirectList<point>(mesh.points(), uniqueMeshPointLabels)
)
);
UIndirectList<point> procPoints(mesh.points(), uniqueMeshPointLabels);
pointField patchPoints;
globalPointsPtr().gather(procPoints, patchPoints);
Info<< "gathered point field = " << patchPoints.size() << " points\n";
}

View File

@ -62,6 +62,7 @@ Note
#include "triSurface.H"
#include "surfMesh.H"
#include "surfFields.H"
#include "surfPointFields.H"
#include "MeshedSurfaces.H"
#include "ModifiableMeshedSurface.H"

View File

@ -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 IOstreamOption::streamFormat format =
const IOstream::streamFormat format =
(
args.found("ascii")
? IOstreamOption::ASCII
: IOstreamOption::BINARY
? IOstream::ASCII
: IOstream::BINARY
);
// Increase the precision of the points data

View File

@ -90,11 +90,11 @@ int main(int argc, char *argv[])
// Binary output, unless otherwise specified
const IOstreamOption::streamFormat format =
const IOstream::streamFormat format =
(
args.found("ascii")
? IOstreamOption::ASCII
: IOstreamOption::BINARY
? IOstream::ASCII
: IOstream::BINARY
);
// increase the precision of the points data

View File

@ -96,11 +96,11 @@ int main(int argc, char *argv[])
Time runTime(args.rootPath(), args.caseName());
// Binary output, unless otherwise specified
const IOstreamOption::streamFormat format =
const IOstream::streamFormat format =
(
args.found("ascii")
? IOstreamOption::ASCII
: IOstreamOption::BINARY
? IOstream::ASCII
: IOstream::BINARY
);
// Increase the precision of the points data

View File

@ -731,7 +731,11 @@ int main(int argc, char *argv[])
PatchTools::gatherAndMerge
(
tolDim,
primitivePatch(SubList<face>(isoFaces), isoPoints),
primitivePatch
(
SubList<face>(isoFaces, isoFaces.size()),
isoPoints
),
mergedPoints,
mergedFaces,
pointMergeMap

View File

@ -11,11 +11,10 @@
#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
@ -478,60 +477,6 @@ 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,
@ -1031,30 +976,59 @@ Foam::label Foam::checkGeometry
<< cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl;
const word pName("patch" + Foam::name(cpp.index()));
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
const AMIPatchToPatchInterpolation& ami =
cpp.AMI();
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
Foam::PatchTools::gatherAndMerge
(
mesh,
wr,
outputDir / pName + "-src_" + tmName,
ami.srcWeightsSum(),
cpp.localFaces(),
cpp.meshPoints(),
cpp.meshPointMap(),
mergedFaces,
mergedPoints,
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
globalPoints
mergedFaces,
mergedPoints
);
// 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]))
{
@ -1062,15 +1036,25 @@ 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 / pName + "-src_" + tmName),
(outputDir / fName),
false // serial - already merged
);
@ -1081,25 +1065,54 @@ Foam::label Foam::checkGeometry
}
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
Foam::PatchTools::gatherAndMerge
(
mesh,
wr,
outputDir / pName + "-tgt_" + tmName,
ami.tgtWeightsSum(),
cpp.neighbPatch().localFaces(),
cpp.neighbPatch().meshPoints(),
cpp.neighbPatch().meshPointMap(),
mergedFaces,
mergedPoints,
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
globalPoints
mergedFaces,
mergedPoints
);
// 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]))
{
@ -1114,11 +1127,17 @@ Foam::label Foam::checkGeometry
if (Pstream::master())
{
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-tgt_" + tmName
);
wr.open
(
mergedPoints,
mergedFaces,
(outputDir / pName + "-tgt_" + tmName),
(outputDir / fName),
false // serial - already merged
);
@ -1129,35 +1148,6 @@ 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
);
}
}
}

View File

@ -1,13 +1,12 @@
#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&);
@ -24,24 +23,6 @@ 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,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

View File

@ -36,12 +36,10 @@ 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"

View File

@ -1,16 +1,15 @@
#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);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +36,6 @@ License
#include "IOmanip.H"
#include "emptyPolyPatch.H"
#include "processorPolyPatch.H"
#include "vtkSetWriter.H"
#include "vtkSurfaceWriter.H"
#include "checkTools.H"
#include "treeBoundBox.H"

View File

@ -1,12 +1,11 @@
#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>

View File

@ -459,7 +459,7 @@ bool Foam::removeEmptyDir(const fileName& path)
Foam::readDir
(
path,
fileName::SYMLINK,
fileName::LINK,
false, // filterGz
false // followLink
)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -716,7 +716,7 @@ void writeProcAddressing
}
autoPtr<fileOperation> defaultHandler;
if (writeHandler)
if (writeHandler.valid())
{
defaultHandler = fileHandler(std::move(writeHandler));
}
@ -726,7 +726,7 @@ void writeProcAddressing
const bool pointOk = pointMap.write();
const bool patchOk = patchMap.write();
if (defaultHandler)
if (defaultHandler.valid())
{
writeHandler = fileHandler(std::move(defaultHandler));
}
@ -827,24 +827,9 @@ void readFields
fields.setSize(masterNames.size());
// 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
// Have master send all fields to processors that don't have a mesh
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];
@ -852,16 +837,9 @@ void readFields
io.writeOpt(IOobject::AUTO_WRITE);
// Load field (but not oldTime)
const bool oldParRun = Pstream::parRun();
if (decompose)
{
Pstream::parRun(false);
}
//const bool oldParRun = Pstream::parRun(false);
readField(io, mesh, i, fields);
if (decompose)
{
Pstream::parRun(oldParRun);
}
//Pstream::parRun(oldParRun);
// Create zero sized field and send
if (subsetterPtr)
@ -964,8 +942,7 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
auto& pfld = bfld[patchi];
const auto& fvp = mesh.boundary()[patchi];
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
{
pfld.initEvaluate(Pstream::defaultCommsType);
}
@ -985,8 +962,7 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
{
const auto& fvp = pfld.patch();
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
{
pfld.evaluate(Pstream::defaultCommsType);
}
@ -1003,8 +979,7 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
const auto& fvp = mesh.boundary()[patchi];
auto& pfld = bfld[patchi];
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
{
if (patchSchedule[patchEvali].init)
{
@ -1341,27 +1316,27 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
correctCoupledBoundaryConditions
<
volScalarField,
processorFvPatch
processorFvPatchField<scalar>
>(mesh);
correctCoupledBoundaryConditions
<
volVectorField,
processorFvPatch
processorFvPatchField<vector>
>(mesh);
correctCoupledBoundaryConditions
<
volSphericalTensorField,
processorFvPatch
processorFvPatchField<sphericalTensor>
>(mesh);
correctCoupledBoundaryConditions
<
volSymmTensorField,
processorFvPatch
processorFvPatchField<symmTensor>
>(mesh);
correctCoupledBoundaryConditions
<
volTensorField,
processorFvPatch
processorFvPatchField<tensor>
>(mesh);
// No update surface fields
@ -1432,14 +1407,14 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
else
{
autoPtr<fileOperation> defaultHandler;
if (writeHandler)
if (writeHandler.valid())
{
defaultHandler = fileHandler(std::move(writeHandler));
}
mesh.write();
if (defaultHandler)
if (defaultHandler.valid())
{
writeHandler = fileHandler(std::move(defaultHandler));
}
@ -2563,7 +2538,7 @@ int main(int argc, char *argv[])
// File handler to be used for writing
const fileOperation& fh
(
writeHandler
writeHandler.valid()
? writeHandler()
: fileHandler()
);
@ -3009,7 +2984,7 @@ int main(int argc, char *argv[])
);
fvMesh& mesh = meshPtr();
if (writeHandler && Pstream::master())
if (writeHandler.valid() && Pstream::master())
{
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around e.g. collated start-up
@ -3310,7 +3285,7 @@ int main(int argc, char *argv[])
);
fvMesh& mesh = meshPtr();
if (writeHandler)
if (writeHandler.valid())
{
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around the collated start-up

View File

@ -308,11 +308,11 @@ int main(int argc, char *argv[])
// Configuration
// Default to binary output, unless otherwise specified
const IOstreamOption::streamFormat format =
const IOstream::streamFormat format =
(
args.found("ascii")
? IOstreamOption::ASCII
: IOstreamOption::BINARY
? IOstream::ASCII
: IOstream::BINARY
);
const bool doBoundary = !args.found("no-boundary");

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -90,7 +90,7 @@ makeZeroGradientField
>& tdf
)
{
if (tdf)
if (tdf.valid())
{
auto& df = tdf.ref();
@ -125,7 +125,7 @@ makeZeroGradientField
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tdf
)
{
if (tdf)
if (tdf.valid())
{
auto& df = tdf.ref();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 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)
if (!tfield.valid())
{
return false;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -36,7 +36,7 @@ bool writeDimField
const tmp<DimensionedField<Type, volMesh>>& tdf
)
{
if (!tdf)
if (!tdf.valid())
{
return false;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 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)
if (!tfield.valid())
{
return false;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -38,7 +38,7 @@ bool writeVolField
const bool nearCellValue = false
)
{
if (!tfield)
if (!tfield.valid())
{
return false;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2018 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)
if (tfield.valid())
{
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)
if (tfield.valid())
{
fields.set(nFields++, tfield.ptr());
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,7 +56,7 @@ bool writeAreaField
const tmp<GeoField>& tfield
)
{
if (tfield)
if (tfield.valid())
{
writer.write(tfield());
tfield.clear();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,7 +53,7 @@ bool writeDimField
const tmp<GeoField>& tfield
)
{
if (!tfield)
if (!tfield.valid())
{
return false;
}
@ -78,7 +78,7 @@ bool writeDimField
const tmp<GeoField>& tfield
)
{
if (!tfield)
if (!tfield.valid())
{
return false;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,7 +57,7 @@ bool writePointField
const fvMeshSubsetProxy& proxy
)
{
if (!tfield)
if (!tfield.valid())
{
return false;
}
@ -73,7 +73,7 @@ bool writePointField
tproxied = tfield;
}
if (!tproxied)
if (!tproxied.valid())
{
// Or Error?
return false;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,7 +55,7 @@ bool writeVolField
const tmp<GeoField>& tfield
)
{
if (!tfield)
if (!tfield.valid())
{
return false;
}
@ -91,7 +91,7 @@ bool writeVolField
const tmp<GeoField>& tfield
)
{
if (!tfield)
if (!tfield.valid())
{
return false;
}

View File

@ -1,30 +0,0 @@
// 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)
);
// ************************************************************************* //

View File

@ -0,0 +1,26 @@
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");

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -247,48 +247,16 @@ 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"
// 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"
// ------------------------------------------------------------------------
// Control properties
#include "createControls.H"
args.readIfPresent("format", setFormat);
args.readIfPresent("stride", sampleFrequency);
sampleFrequency = max(1, sampleFrequency); // sanity
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,19 +0,0 @@
// 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)
);
// ************************************************************************* //

View File

@ -0,0 +1,9 @@
const word dictName("particleTrackDict");
#include "setConstantMeshDictionaryIO.H"
IOdictionary propsDict(dictIO);
word cloudName(propsDict.get<word>("cloud"));
List<word> userFields(propsDict.lookup("fields"));

View File

@ -126,19 +126,14 @@ int main(int argc, char *argv[])
argList::noParallel();
timeSelector::addOptions();
#include "addRegionOption.H"
argList::addOption
(
"dict",
"file",
"Alternative particleTrackDict dictionary"
);
argList::addVerboseOption("Additional verbosity");
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H"
#include "createControls.H"
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -145,12 +145,7 @@ int main(int argc, char *argv[])
"implicit function."
);
argList::addOption
(
"dict",
"file",
"Alternative setAlphaFieldDict dictionary"
);
#include "addDictOption.H"
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"

View File

@ -55,7 +55,7 @@
# [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com
export WM_PROJECT_VERSION=com
export WM_PROJECT_VERSION=v2112
#------------------------------------------------------------------------------
# Configuration environment variables.

View File

@ -16,6 +16,7 @@ FoamFile
// Set output format : choice of
// xmgr
// jplot
// gnuplot
// raw
// vtk
@ -24,7 +25,7 @@ FoamFile
setFormat raw;
// Surface output format. Choice of
// none : suppress output
// null : suppress output
// ensight : Ensight Gold format, one field per case file
// foamFile : separate points, faces and values file
// dx : DX scalar or vector format

View File

@ -26,7 +26,7 @@ Documentation
(
"$WM_PROJECT_USER_DIR/html"
"$WM_PROJECT_DIR/doc/Doxygen/html"
"https://www.openfoam.com/documentation/guides/latest/doc/"
"https://www.openfoam.com/documentation/cpp-guide/html"
);
}
@ -656,6 +656,7 @@ DebugSwitches
isoSurfaceCell 0;
isoSurfacePoint 0;
isoSurfaceTopo 0;
jplot 0;
jumpCyclic 0;
kEpsilon 0;
kOmega 0;

View File

@ -55,7 +55,7 @@
# [WM_PROJECT_VERSION] - A human-readable version name
# A development version is often named 'com' - as in www.openfoam.com
setenv WM_PROJECT_VERSION com
setenv WM_PROJECT_VERSION v2112
#------------------------------------------------------------------------------
# Configuration environment variables.

View File

@ -7,7 +7,7 @@
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2011 Symscape
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -83,7 +83,7 @@ namespace Foam
// Move file, overwriting existing
static bool renameFile(const std::string& src, const std::string& dst)
static bool renameFile(const fileName& src, const fileName& dst)
{
constexpr const int flags
(
@ -132,7 +132,7 @@ class directoryIterator
public:
//- Construct for dirName, optionally allowing hidden files/dirs
directoryIterator(const std::string& dirName, bool allowHidden = false)
directoryIterator(const fileName& dirName, bool allowHidden = false)
:
handle_(INVALID_HANDLE_VALUE),
exists_(false),
@ -170,13 +170,13 @@ public:
// Member Functions
//- Directory existed for opening
bool exists() const noexcept
bool exists() const
{
return exists_;
}
//- Directory pointer is valid
bool good() const noexcept
bool good() const
{
return (INVALID_HANDLE_VALUE != handle_);
}
@ -192,7 +192,7 @@ public:
}
//- The current item
const std::string& val() const noexcept
const std::string& val() const
{
return item_;
}
@ -225,13 +225,13 @@ public:
// Member Operators
//- Same as good()
operator bool() const noexcept
operator bool() const
{
return good();
}
//- Same as val()
const std::string& operator*() const noexcept
const std::string& operator*() const
{
return val();
}
@ -407,7 +407,7 @@ bool Foam::setEnv
}
Foam::string Foam::hostName()
Foam::string Foam::hostName(bool)
{
const DWORD bufLen = MAX_COMPUTERNAME_LENGTH + 1;
TCHAR buf[bufLen];
@ -417,20 +417,12 @@ Foam::string Foam::hostName()
}
// 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();
return string::null;
}
@ -460,7 +452,7 @@ Foam::fileName Foam::home()
if (env.empty())
{
env = Foam::getEnv("USERPROFILE");
env = Foam::getEnv("USERPROFILE");
}
return env;
@ -603,21 +595,21 @@ Foam::fileName::Type Foam::type
// Ignore an empty name => always UNDEFINED
if (name.empty())
{
return fileName::Type::UNDEFINED;
return fileName::UNDEFINED;
}
const DWORD m = ::GetFileAttributes(name.c_str());
if (ms_isreg(m))
{
return fileName::Type::FILE;
return fileName::FILE;
}
else if (ms_isdir(m))
{
return fileName::Type::DIRECTORY;
return fileName::DIRECTORY;
}
return fileName::Type::UNDEFINED;
return fileName::UNDEFINED;
}

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_MSwindows_H
#define Foam_MSwindows_H
#ifndef MSwindows_H
#define MSwindows_H
#include "className.H"

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_regExp_H
#define Foam_regExp_H
#ifndef regExp_H
#define regExp_H
#include "regExpCxx.H"
#include "regExpFwd.H"

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_regExpFwd_H
#define Foam_regExpFwd_H
#ifndef regExpFwd_H
#define regExpFwd_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -142,7 +142,7 @@ public:
// Constructors
//- Construct for dirName, optionally allowing hidden files/dirs
directoryIterator(const std::string& dirName, bool allowHidden = false)
directoryIterator(const fileName& dirName, bool allowHidden = false)
:
dirptr_(nullptr),
exists_(false),
@ -168,13 +168,13 @@ public:
// Member Functions
//- Directory open succeeded
bool exists() const noexcept
bool exists() const
{
return exists_;
}
//- Directory pointer is valid
bool good() const noexcept
bool good() const
{
return dirptr_;
}
@ -190,7 +190,7 @@ public:
}
//- The current item
const std::string& val() const noexcept
const std::string& val() const
{
return item_;
}
@ -220,13 +220,13 @@ public:
// Member Operators
//- Same as good()
operator bool() const noexcept
operator bool() const
{
return good();
}
//- Same as val()
const std::string& operator*() const noexcept
const std::string& operator*() const
{
return val();
}
@ -302,36 +302,25 @@ bool Foam::setEnv
}
Foam::string Foam::hostName()
Foam::string Foam::hostName(bool full)
{
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 Foam::hostName();
return buf;
}
// DEPRECATED (2022-01)
Foam::string Foam::domainName()
{
char buf[128];
@ -349,7 +338,7 @@ Foam::string Foam::domainName()
}
}
return string();
return string::null;
}
@ -724,16 +713,12 @@ 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::Type::UNDEFINED;
return fileName::UNDEFINED;
}
if (POSIX::debug)
@ -745,18 +730,18 @@ Foam::fileName::Type Foam::type
if (S_ISREG(m))
{
return fileName::Type::FILE;
return fileName::FILE;
}
else if (S_ISLNK(m))
{
return fileName::Type::SYMLINK;
return fileName::LINK;
}
else if (S_ISDIR(m))
{
return fileName::Type::DIRECTORY;
return fileName::DIRECTORY;
}
return fileName::Type::UNDEFINED;
return fileName::UNDEFINED;
}
@ -1048,7 +1033,7 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
return false;
}
}
else if (srcType == fileName::SYMLINK)
else if (srcType == fileName::LINK)
{
// If dest is a directory, create the destination file name.
if (destFile.type() == fileName::DIRECTORY)

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_POSIX_H
#define Foam_POSIX_H
#ifndef POSIX_H
#define POSIX_H
#include "className.H"

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_regExp_H
#define Foam_regExp_H
#ifndef regExp_H
#define regExp_H
#include "regExpCxx.H"
#include "regExpPosix.H"

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_regExpFwd_H
#define Foam_regExpFwd_H
#ifndef regExpFwd_H
#define regExpFwd_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -64,8 +64,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_regExpPosix_H
#define Foam_regExpPosix_H
#ifndef regExpPosix_H
#define regExpPosix_H
#include "regExpCxx.H"
#include <regex.h>

View File

@ -819,6 +819,7 @@ writers = graph/writers
$(writers)/rawGraph/rawGraph.C
$(writers)/gnuplotGraph/gnuplotGraph.C
$(writers)/xmgrGraph/xmgrGraph.C
$(writers)/jplotGraph/jplotGraph.C
meshes/data/data.C

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2020 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>::prepend(const word& keyword, T* ptr)
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
{
// NOTE: we should probably check that HashTable::insert actually worked
hashedTs_.insert(keyword, ptr);
IDLListType::prepend(ptr);
hashedTs_.insert(keyword, tPtr);
IDLListType::insert(tPtr);
}
template<class IDLListType, class T>
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* ptr)
void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
{
// NOTE: we should probably check that HashTable::insert actually worked
hashedTs_.insert(keyword, ptr);
IDLListType::append(ptr);
hashedTs_.insert(keyword, tPtr);
IDLListType::append(tPtr);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,8 +48,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_DictionaryBase_H
#define Foam_DictionaryBase_H
#ifndef DictionaryBase_H
#define DictionaryBase_H
#include "HashTable.H"
#include "wordList.H"
@ -141,11 +141,11 @@ public:
// Editing
//- Add to front of dictionary
void prepend(const word& keyword, T* ptr);
//- Add at head of dictionary
void insert(const word& keyword, T*);
//- Add to back of dictionary
void append(const word& keyword, T* ptr);
//- Add at tail of dictionary
void append(const word& keyword, T*);
//- Remove and return entry specified by keyword.
// Return nullptr if the keyword was not found.
@ -189,6 +189,7 @@ 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
@ -197,18 +198,13 @@ 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);
}
};

View File

@ -1 +1,61 @@
#warning File removed - left for old dependency check only
/*---------------------------------------------------------------------------*\
========= |
\\ / 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)
{}
// ************************************************************************* //

View File

@ -32,10 +32,13 @@ Description
It is derived from DictionaryBase instantiated on a memory managed form of
intrusive doubly-linked list of \<T\>.
SourceFiles
PtrDictionary.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_PtrDictionary_H
#define Foam_PtrDictionary_H
#ifndef PtrDictionary_H
#define PtrDictionary_H
#include "DictionaryBase.H"
#include "DLPtrList.H"
@ -54,37 +57,26 @@ class PtrDictionary
:
public DictionaryBase<DLPtrList<T>, T>
{
public:
// Constructors
//- Construct given initial table size
explicit PtrDictionary(const label size = 128)
:
DictionaryBase<DLPtrList<T>, T>(size)
{}
PtrDictionary(const label size = 128);
//- Copy construct
PtrDictionary(const PtrDictionary& dict)
:
DictionaryBase<DLPtrList<T>, T>(dict)
{}
PtrDictionary(const PtrDictionary& dict);
//- Construct from Istream using given Istream constructor class
template<class INew>
PtrDictionary(Istream& is, const INew& inew)
:
DictionaryBase<DLPtrList<T>, T>(is, inew)
{}
PtrDictionary(Istream& is, const INew& inew);
//- Construct from Istream
explicit PtrDictionary(Istream& is)
:
DictionaryBase<DLPtrList<T>, T>(is)
{}
PtrDictionary(Istream& is);
// Member Operators
// Member operators
//- Find and return entry
const T& operator[](const word& key) const
@ -104,6 +96,14 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "PtrDictionary.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_PtrListDictionary_H
#define Foam_PtrListDictionary_H
#ifndef PtrListDictionary_H
#define PtrListDictionary_H
#include "DictionaryBase.H"
#include "PtrList.H"
@ -57,12 +57,13 @@ class PtrListDictionary
:
public DictionaryBase<PtrList<T>, T>
{
public:
// Constructors
//- Construct given initial list size
explicit PtrListDictionary(const label size);
PtrListDictionary(const label size);
//- Copy construct
PtrListDictionary(const PtrListDictionary& dict);
@ -72,19 +73,19 @@ public:
PtrListDictionary(Istream& is, const INew& inew);
//- Construct from Istream
explicit PtrListDictionary(Istream& is);
PtrListDictionary(Istream& is);
// Member functions
//- Set element to pointer provided and return old element
autoPtr<T> set(const label i, const word& key, T* ptr);
autoPtr<T> set(const label, const word& key, T*);
//- Set element to autoPtr value provided and return old element
autoPtr<T> set(const label i, const word& key, autoPtr<T>& aptr);
autoPtr<T> set(const label, const word& key, autoPtr<T>&);
//- Set element to tmp value provided and return old element
autoPtr<T> set(const label i, const word& key, tmp<T>& t);
autoPtr<T> set(const label, const word& key, tmp<T>&);
// Member operators

View File

@ -1 +1,48 @@
#warning File removed - left for old dependency check only
/*---------------------------------------------------------------------------*\
========= |
\\ / 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)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -33,10 +33,13 @@ Description
It is derived from DictionaryBase instantiated on a non-memory managed
form of intrusive doubly-linked list of \<T\>.
SourceFiles
UPtrDictionary.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_UPtrDictionary_H
#define Foam_UPtrDictionary_H
#ifndef UPtrDictionary_H
#define UPtrDictionary_H
#include "DictionaryBase.H"
#include "DLList.H"
@ -55,21 +58,16 @@ class UPtrDictionary
:
public DictionaryBase<DLList<T*>, T>
{
public:
// Constructors
//- Construct given initial table size
explicit UPtrDictionary(const label size = 128)
:
DictionaryBase<DLList<T*>, T>(size)
{}
UPtrDictionary(const label size = 128);
//- Copy construct
UPtrDictionary(const UPtrDictionary& dict)
:
DictionaryBase<DLList<T*>, T>(dict)
{}
UPtrDictionary(const UPtrDictionary&);
};
@ -79,6 +77,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "UPtrDictionary.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 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,26 +83,37 @@ template<class LListBase, class T>
bool Foam::ILList<LListBase, T>::eraseHead()
{
T* p = this->removeHead();
delete p;
return bool(p);
}
if (p)
{
delete p;
return true;
}
return false;
}
template<class LListBase, class T>
bool Foam::ILList<LListBase, T>::erase(T* item)
{
T* p = remove(item);
delete p;
return bool(p);
if (p)
{
delete p;
return true;
}
return false;
}
template<class LListBase, class T>
void Foam::ILList<LListBase, T>::clear()
{
label len = this->size();
const label len = this->size();
while (len--)
for (label i=0; i<len; ++i)
{
eraseHead();
}

View File

@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_ILList_H
#define Foam_ILList_H
#ifndef ILList_H
#define ILList_H
#include "UILList.H"
@ -82,14 +82,14 @@ public:
//- Default construct
ILList() = default;
//- Construct and add initial item pointer
//- Construct and insert the initial T item pointer
explicit ILList(T* item)
:
UILList<LListBase, T>(item)
{}
//- Construct from Istream
explicit ILList(Istream& is);
ILList(Istream& is);
//- Copy construct using the 'clone()' method for each element
ILList(const ILList<LListBase, T>& lst);

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,11 +76,10 @@ Foam::LList<LListBase, T>::~LList()
template<class LListBase, class T>
void Foam::LList<LListBase, T>::clear()
{
label len = this->size();
while (len--)
const label len = this->size();
for (label i=0; i<len; ++i)
{
this->eraseHead();
this->removeHead();
}
LListBase::clear();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,11 +36,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_LList_H
#define Foam_LList_H
#ifndef LList_H
#define LList_H
#include "label.H"
#include "stdFoam.H"
#include <initializer_list>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -100,11 +100,11 @@ public:
//- The type that can represent the container size
typedef label size_type;
//- The difference between iterators
//- The difference between iterator objects
typedef label difference_type;
// Forward Declarations (iterators)
// Forward declaration of STL iterators
class iterator;
class const_iterator;
@ -119,52 +119,43 @@ public:
public LListBase::link
{
//- Stored object
T val_;
T obj_;
//- Copy construct from given object
link(const T& elem)
link(const T& obj)
:
val_(elem)
obj_(obj)
{}
//- Move construct from given object
link(T&& elem)
link(T&& obj)
:
val_(std::move(elem))
obj_(std::move(obj))
{}
//- 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)->val_);
return &(static_cast<link*>(node)->obj_);
}
//- 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)->val_);
return &(static_cast<const link*>(node)->obj_);
}
//- Dereference LListBase::link to obtain the stored object
static constexpr T& ref(typename LListBase::link* node)
{
return static_cast<link*>(node)->val_;
return static_cast<link*>(node)->obj_;
}
//- Dereference LListBase::link to obtain the stored object
static constexpr const T& ref(const typename LListBase::link* node)
{
return static_cast<const link*>(node)->val_;
return static_cast<const link*>(node)->obj_;
}
};
@ -174,16 +165,16 @@ public:
//- Default construct
LList() = default;
//- Construct and copy add initial item
explicit LList(const T& elem)
//- Construct and copy insert the initial T item
explicit LList(const T& item)
{
this->prepend(elem);
this->insert(item);
}
//- Construct and move add initial item
explicit LList(T&& elem)
//- Construct and move insert the initial T item
explicit LList(T&& item)
{
this->prepend(std::move(elem));
this->insert(std::move(item));
}
//- Construct from Istream
@ -230,54 +221,57 @@ public:
}
//- Add copy at front of list
void prepend(const T& elem)
//- Add copy at head of list
void insert(const T& item)
{
LListBase::prepend(new link(elem));
LListBase::insert(new link(item));
}
//- Move construct at front of list
void prepend(T&& elem)
//- Move construct at head of list
void insert(T&& item)
{
LListBase::prepend(new link(std::move(elem)));
LListBase::insert(new link(std::move(item)));
}
//- Add copy at back of list
void append(const T& elem)
//- Add copy at tail of list
void append(const T& item)
{
LListBase::append(new link(elem));
LListBase::append(new link(item));
}
//- Move construct at back of list
void append(T&& elem)
//- Move construct at tail of list
void append(T&& item)
{
LListBase::append(new link(std::move(elem)));
LListBase::append(new link(std::move(item)));
}
//- Erase the first entry
bool eraseHead()
{
link* p = static_cast<link*>(LListBase::removeHead());
delete p;
return bool(p);
}
//- Remove and return first entry
//- Remove and return head
T removeHead()
{
return link::remove(LListBase::removeHead());
auto p = LListBase::removeHead();
T obj(std::move(link::ref(p)));
delete p;
return obj;
}
//- Remove and return element
T remove(link* item)
{
return link::remove(LListBase::remove(item));
auto p = LListBase::remove(item);
T obj(std::move(link::ref(p)));
delete p;
return obj;
}
//- Remove and return element specified by iterator
T remove(iterator& iter)
{
return link::remove(LListBase::remove(iter));
auto p = LListBase::remove(iter);
T obj(std::move(link::ref(p)));
delete p;
return obj;
}
@ -285,7 +279,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);
@ -573,14 +567,6 @@ 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)); }
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,21 +68,19 @@ Foam::Istream& Foam::LList<LListBase, T>::readList(Istream& is)
{
for (label i=0; i<len; ++i)
{
T elem;
is >> elem;
list.append(std::move(elem));
T element;
is >> element;
list.append(element);
}
}
else
{
// Uniform content (delimiter == token::BEGIN_BLOCK)
T elem;
is >> elem;
T element;
is >> element;
for (label i=0; i<len; ++i)
{
list.append(elem);
list.append(element);
}
}
}
@ -99,9 +97,9 @@ Foam::Istream& Foam::LList<LListBase, T>::readList(Istream& is)
{
is.putBack(tok);
T elem;
is >> elem;
list.append(std::move(elem));
T element;
is >> element;
list.append(element);
is >> tok;
is.fatalCheck(FUNCTION_NAME);

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,17 +65,22 @@ template<class LListBase, class T>
bool Foam::LPtrList<LListBase, T>::eraseHead()
{
T* p = this->removeHead();
delete p;
return bool(p);
if (p)
{
delete p;
return true;
}
return false;
}
template<class LListBase, class T>
void Foam::LPtrList<LListBase, T>::clear()
{
label len = this->size();
while (len--)
const label len = this->size();
for (label i=0; i<len; ++i)
{
eraseHead();
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_LPtrList_H
#define Foam_LPtrList_H
#ifndef LPtrList_H
#define LPtrList_H
#include "LList.H"
@ -46,7 +46,7 @@ SourceFiles
namespace Foam
{
// Forward Declarations
// Forward declarations
template<class LListBase, class T> class LPtrList;
@ -74,6 +74,8 @@ class LPtrList
:
public LList<LListBase, T*>
{
private:
// Private Member Functions
//- Read from Istream using given Istream constructor class
@ -112,13 +114,13 @@ public:
// Constructors
//- Default construct
//- Null construct
LPtrList() = default;
//- Construct and add initial item pointer
//- Construct and insert the initial T item
explicit LPtrList(T* item)
{
this->prepend(item);
this->insert(item);
}
//- Copy construct by using 'clone()' for each element
@ -132,7 +134,7 @@ public:
LPtrList(Istream& is, const INew& inew);
//- Construct from Istream using default Istream constructor class
explicit LPtrList(Istream& is);
LPtrList(Istream& is);
//- Destructor

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_UILList_H
#define Foam_UILList_H
#ifndef UILList_H
#define UILList_H
#include "label.H"
#include "uLabel.H"
@ -95,7 +95,7 @@ public:
typedef label difference_type;
// Forward Declarations (iterators)
// Forward declaration of STL iterators
class iterator;
class const_iterator;
@ -109,10 +109,10 @@ public:
//- Default construct
UILList() = default;
//- Construct and add initial item pointer
//- Construct and insert the initial T item
explicit UILList(T* item)
{
this->prepend(item);
this->insert(item);
}
//- Construct as copy
@ -446,6 +446,7 @@ public:
{
return crend();
}
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::DLListBase::prepend(DLListBase::link* item)
void Foam::DLListBase::insert(DLListBase::link* item)
{
if (!item)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,8 +43,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_DLListBase_H
#define Foam_DLListBase_H
#ifndef DLListBase_H
#define 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 noexcept;
inline bool registered() const;
//- Deregister the node after removal
inline void deregister() noexcept;
inline void deregister();
};
@ -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 front of list
void prepend(link* item);
//- Add at head of list
void insert(link* item);
//- Add at back of list
//- Add at tail 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 first entry
//- Remove and return head
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,10 +236,18 @@ public:
inline iterator(DLListBase* list, link* item);
//- The storage node
inline link* get_node() const noexcept;
inline link* get_node() const;
//- Pointing at a valid storage node
inline bool good() const noexcept;
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();
}
//- Move backward through list
inline void prev();
@ -282,10 +290,18 @@ public:
inline const_iterator(const DLListBase::iterator& iter);
//- The storage node
inline const link* get_node() const noexcept;
inline const link* get_node() const;
//- Pointing at a valid storage node
inline bool good() const noexcept;
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();
}
//- Move backward through list
inline void prev();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2019 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 noexcept
inline bool Foam::DLListBase::link::registered() const
{
return prev_ != nullptr && next_ != nullptr;
}
inline void Foam::DLListBase::link::deregister() noexcept
inline void Foam::DLListBase::link::deregister()
{
prev_ = next_ = nullptr;
}
@ -252,13 +252,13 @@ inline Foam::DLListBase::iterator::iterator
inline Foam::DLListBase::link*
Foam::DLListBase::iterator::get_node() const noexcept
Foam::DLListBase::iterator::get_node() const
{
return node_;
}
inline bool Foam::DLListBase::iterator::good() const noexcept
inline bool Foam::DLListBase::iterator::good() const
{
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 noexcept
Foam::DLListBase::const_iterator::get_node() const
{
return node_;
}
inline bool Foam::DLListBase::const_iterator::good() const noexcept
inline bool Foam::DLListBase::const_iterator::good() const
{
return (node_ != nullptr);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::SLListBase::prepend(SLListBase::link* item)
void Foam::SLListBase::insert(SLListBase::link* item)
{
if (!item)
{

View File

@ -43,8 +43,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_SLListBase_H
#define Foam_SLListBase_H
#ifndef SLListBase_H
#define SLListBase_H
#include "label.H"
#include "uLabel.H"
@ -157,13 +157,13 @@ public:
inline const link* last() const;
//- Add at front of list
void prepend(link* item);
//- Add at head of list
void insert(link* item);
//- Add at back of list
//- Add at tail of list
void append(link* item);
//- Remove and return first entry
//- Remove and return head
link* removeHead();
// Remove and return element
@ -212,10 +212,18 @@ public:
inline iterator(SLListBase* list, link* item);
//- The storage node
inline link* get_node() const noexcept;
inline link* get_node() const;
//- Pointing at a valid storage node
inline bool good() const noexcept;
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();
}
//- Cannot move backward through list
inline void prev() = delete;
@ -257,10 +265,18 @@ public:
inline const_iterator(const SLListBase::iterator& iter);
//- The storage node
inline const link* get_node() const noexcept;
inline const link* get_node() const;
//- Pointing at a valid storage node
inline bool good() const noexcept;
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();
}
//- Cannot move backward through list
inline void prev() = delete;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2019 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 noexcept
Foam::SLListBase::iterator::get_node() const
{
return node_;
}
inline bool Foam::SLListBase::iterator::good() const noexcept
inline bool Foam::SLListBase::iterator::good() const
{
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 noexcept
Foam::SLListBase::const_iterator::get_node() const
{
return node_;
}
inline bool Foam::SLListBase::const_iterator::good() const noexcept
inline bool Foam::SLListBase::const_iterator::good() const
{
return (node_ != nullptr);
}

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_DLList_H
#define Foam_DLList_H
#ifndef DLList_H
#define DLList_H
#include "LList.H"
#include "DLListBase.H"

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_DLPtrList_H
#define Foam_DLPtrList_H
#ifndef DLPtrList_H
#define DLPtrList_H
#include "LPtrList.H"
#include "DLListBase.H"

View File

@ -34,8 +34,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_FIFOStack_H
#define Foam_FIFOStack_H
#ifndef FIFOStack_H
#define FIFOStack_H
#include "SLList.H"
@ -63,28 +63,28 @@ public:
// Member Functions
//- Const reference to the top element
const T& top() const
//- Return a copy of the top element
T top() const
{
return this->last();
}
//- Const reference to the bottom element
const T& bottom() const
//- Return a copy of the bottom element
T bottom() const
{
return this->first();
}
//- Push an element onto the back of the stack
void push(const T& elem)
void push(const T& element)
{
this->append(elem);
this->append(element);
}
//- Move an element onto the back of the stack
void push(T&& elem)
void push(T&& element)
{
this->append(std::move(elem));
this->append(std::move(element));
}
//- Pop the bottom element off the stack

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_IDLList_H
#define Foam_IDLList_H
#ifndef IDLList_H
#define IDLList_H
#include "ILList.H"
#include "DLListBase.H"

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_ISLList_H
#define Foam_ISLList_H
#ifndef ISLList_H
#define ISLList_H
#include "ILList.H"
#include "SLListBase.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,8 +34,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_LIFOStack_H
#define Foam_LIFOStack_H
#ifndef LIFOStack_H
#define LIFOStack_H
#include "SLList.H"
@ -63,28 +63,28 @@ public:
// Member Functions
//- Const reference to the top element
const T& top() const
//- Return a copy of the top element
T top() const
{
return this->first();
}
//- Const reference to the bottom element
const T& bottom() const
//- Return a copy of the bottom element
T bottom() const
{
return this->last();
}
//- Push an element onto the front of the stack
void push(const T& elem)
void push(const T& element)
{
this->prepend(elem);
this->insert(element);
}
//- Move an element onto the front of the stack
void push(T&& elem)
void push(T&& element)
{
this->prepend(std::move(elem));
this->insert(std::move(element));
}
//- Pop the top element off the stack

View File

@ -31,11 +31,12 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_SLList_H
#define Foam_SLList_H
#ifndef SLList_H
#define SLList_H
#include "SLListBase.H"
#include "LList.H"
#include "SLListFwd.H"
#endif

View File

@ -31,14 +31,14 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_SLListFwd_H
#define Foam_SLListFwd_H
#ifndef SLListFwd_H
#define SLListFwd_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
// Forward declarations
class SLListBase;
template<class LListBase, class T> class LList;

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_SLPtrList_H
#define Foam_SLPtrList_H
#ifndef SLPtrList_H
#define SLPtrList_H
#include "SLListBase.H"
#include "LPtrList.H"

View File

@ -31,14 +31,14 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_SLPtrListFwd_H
#define Foam_SLPtrListFwd_H
#ifndef SLPtrListFwd_H
#define SLPtrListFwd_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
// Forward declarations
class SLListBase;
template<class LListBase, class T> class LPtrList;

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_UIDLList_H
#define Foam_UIDLList_H
#ifndef UIDLList_H
#define UIDLList_H
#include "UILList.H"
#include "DLListBase.H"

View File

@ -652,9 +652,12 @@ void Foam::List<T>::operator=(SLList<T>&& list)
reAlloc(len);
for (T* iter = this->begin(); len--; ++iter)
T* iter = this->begin();
while (len--)
{
*iter = std::move(list.removeHead());
++iter;
}
list.clear();

View File

@ -52,7 +52,7 @@ namespace Foam
const fileName::Type pathType = Foam::type(otherName, false);
if (pathType == fileName::FILE || pathType == fileName::SYMLINK)
if (pathType == fileName::FILE || pathType == fileName::LINK)
{
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::SYMLINK)
if (!append && Foam::type(targetName, false) == fileName::LINK)
{
Foam::rm(targetName);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,8 +40,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_UPstream_H
#define Foam_UPstream_H
#ifndef UPstream_H
#define UPstream_H
#include "labelList.H"
#include "DynamicList.H"
@ -645,10 +645,8 @@ public:
// Gather single, contiguous value(s)
//- 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.
//- Individual values into list locations.
// On master list length == nProcs, otherwise zero length
template<class T>
static List<T> listGatherValues
(
@ -656,10 +654,8 @@ public:
const label communicator = worldComm
);
//- 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).
//- Individual values into list locations.
// On master list length == nProcs, otherwise zero length
template<class T>
static T listScatterValues
(

View File

@ -55,25 +55,25 @@ std::size_t Foam::base64Layer::encodedLength(std::size_t n)
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
inline unsigned char Foam::base64Layer::encode0() const noexcept
inline unsigned char Foam::base64Layer::encode0() const
{
// Top 6 bits of char0
return base64Chars[((group_[0] & 0xFC) >> 2)];
}
inline unsigned char Foam::base64Layer::encode1() const noexcept
inline unsigned char Foam::base64Layer::encode1() const
{
// 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 noexcept
inline unsigned char Foam::base64Layer::encode2() const
{
// 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 noexcept
inline unsigned char Foam::base64Layer::encode3() const
{
// Bottom 6 bits of char2
return base64Chars[(group_[2] & 0x3F)];

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_base64Layer_H
#define Foam_base64Layer_H
#ifndef base64Layer_H
#define base64Layer_H
#include <iostream>
@ -72,10 +72,16 @@ class base64Layer
// Private Member Functions
inline unsigned char encode0() const noexcept;
inline unsigned char encode1() const noexcept;
inline unsigned char encode2() const noexcept;
inline unsigned char encode3() const noexcept;
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;
protected:
@ -85,12 +91,6 @@ 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:

View File

@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_token_H
#define Foam_token_H
#ifndef token_H
#define token_H
#include "label.H"
#include "uLabel.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1284,13 +1284,12 @@ 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(scalar(10), -precision_), 0.1*userDeltaT), SMALL);
max(min(pow(10.0, -precision_), 0.1*deltaT_), SMALL);
// User-time equivalent of deltaT
const scalar userDeltaT = timeToUserTime(deltaT_);
// Time value obtained by reading timeName
scalar timeNameValue = -VGREAT;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -102,8 +102,8 @@ Foam::dictionary::dictionary
if (e.keyword().isPattern())
{
patterns_.prepend(&e);
regexps_.prepend(autoPtr<regExp>::New(e.keyword()));
patterns_.insert(&e);
regexps_.insert(autoPtr<regExp>::New(e.keyword()));
}
}
}
@ -124,8 +124,8 @@ Foam::dictionary::dictionary
if (e.keyword().isPattern())
{
patterns_.prepend(&e);
regexps_.prepend(autoPtr<regExp>::New(e.keyword()));
patterns_.insert(&e);
regexps_.insert(autoPtr<regExp>::New(e.keyword()));
}
}
}
@ -670,8 +670,8 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
if (entryPtr->keyword().isPattern())
{
patterns_.prepend(entryPtr);
regexps_.prepend(autoPtr<regExp>::New(entryPtr->keyword()));
patterns_.insert(entryPtr);
regexps_.insert(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_.prepend(entryPtr);
regexps_.prepend(autoPtr<regExp>::New(entryPtr->keyword()));
patterns_.insert(entryPtr);
regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
}
return entryPtr; // now an entry in the dictionary

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -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>
bool findInPatterns
static bool findInPatterns
(
const bool patternMatch,
const Foam::word& keyword,
@ -680,8 +680,8 @@ bool Foam::dictionary::changeKeyword
if (newKeyword.isPattern())
{
patterns_.prepend(iter());
regexps_.prepend(autoPtr<regExp>::New(newKeyword));
patterns_.insert(iter());
regexps_.insert(autoPtr<regExp>::New(newKeyword));
}
return true;

View File

@ -30,6 +30,12 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::namedDictionary::namedDictionary()
:
Tuple2<keyType, dictionary>()
{}
Foam::namedDictionary::namedDictionary(Istream& is)
{
is >> *this;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenFOAM Foundation
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,8 +61,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_namedDictionary_H
#define Foam_namedDictionary_H
#ifndef namedDictionary_H
#define namedDictionary_H
#include "dictionary.H"
#include "Tuple2.H"
@ -74,7 +74,6 @@ namespace Foam
// Forward Declarations
class namedDictionary;
Istream& operator>>(Istream&, namedDictionary&);
Ostream& operator<<(Ostream&, const namedDictionary&);
@ -94,7 +93,7 @@ public:
using Tuple2<keyType, dictionary>::Tuple2;
//- Default construct
namedDictionary() = default;
namedDictionary();
//- Construct from Istream
explicit namedDictionary(Istream& is);

View File

@ -45,7 +45,7 @@ Foam::expressions::fieldExpr::parseDriver::getField
}
if (tvar)
if (tvar.valid())
{
const auto& var = tvar.cref();
const Field<Type>& vals = var.cref<Type>();

View File

@ -7,7 +7,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -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<< #T << " at " << driver_.parsePosition() << nl; \
DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \
parser_->parse(TOKEN_OF(T)); \
driver_.parsePosition() = (p-buf);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -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<< #T << " at " << driver_.parsePosition() << nl; \
DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \
parser_->parse(TOKEN_OF(T)); \
driver_.parsePosition() = (p-buf);

Some files were not shown because too many files have changed in this diff Show More