Compare commits

..

39 Commits

Author SHA1 Message Date
8b319324b6 COMP: g++11: suppress optimisation. See #3024 2024-01-19 20:29:44 +01:00
9f40e04cc1 BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:31:51 +01:00
927b06a19d BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:37:41 +02:00
e6a27e0a67 BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923) 2023-06-26 17:58:31 +02:00
50b44dbfe2 BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:27:35 +02:00
54567be3c6 Revert "BUG: Fixing ray dAve and omega for 1D and 2D cases"
This reverts commit 5848b0afd5.
2023-05-22 09:39:53 +01:00
8c20e769ba BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 16:05:25 +02:00
d1264955e8 COMP: code adjustments for gcc-13 (#2714) 2023-02-28 16:03:54 +01:00
2c6fc15734 BUG: globalIndex gather/scatter fails with multi-world (fixes #2706)
- was using UPstream::procIDs(), which returns the sub-ranks with
  respect to the parent communicator. This is normally just an
  identity list (single-world) but with multi-world the indexing
  is incorrect.  Use UPstream::allProcs() instead.
2023-02-22 10:01:48 +01:00
ffde9c2c6f COMP: backslash instead of slash in Make/options 2023-02-22 09:41:49 +01:00
0081eca87d BUG: expression field functionObject 'store' keyword ignored 2023-02-22 09:41:27 +01:00
a3f173e937 BUG: inconsistent finiteArea proc-boundary contributions (fixes #2672) 2023-02-22 09:37:02 +01:00
06a60286d2 BUG: incorrect order for output scaling (transformPoints, ...)
- the output write scaling should be applied *after* undoing the
  effects of the specified rotation centre. Fixes #2566

ENH: update option names for transformPoints and surfaceTransformPoints

- prefer  '-auto-centre' and '-centre', but also accept the previous
  options '-auto-origin' and '-origin' as aliases.

  Changing to '-centre' avoids possible confusion with
  coordinate system origin().
2022-08-18 12:29:57 +02:00
6e1fca0e46 CONFIG: bump patch level 2022-06-10 12:25:10 +02:00
7b5cfbd1b0 COMP: Gcc 11+ potential fix - see #2434 2022-06-09 12:58:22 +02:00
40cadfd2f2 COMP: references to temporaries
COMP: include <limits>
2022-06-03 10:04:38 +02:00
91198eaf6a COMP: gcc-12 buffer check bypasses xsputn (#2481, #2496)
- add overflow() method to the SHA1 streambuf. Previously could rely
  on xsputn for adding to sha1 content, but streams now check pptr()
  first to test for the buffering range and thus overflow() is needed.
2022-06-03 10:04:35 +02:00
6f4196ae62 BUG: totalFlowRateAdvectiveDiffusive: missing autoMap. Fixes #2475 2022-05-18 12:19:33 +01:00
f8dc192941 CONFIG: sourcing etc/cshrc twice unset the environment (fixes #2458) 2022-05-07 15:53:55 +02:00
2c7621116e COMP: missing linkage to regionFaModels (fixes #2449)
- needed for the lld linker (eg, AMD aocc compiler)
2022-05-06 19:32:34 +02:00
de1aa80593 BUG: SprayParcel - set the child origProc. Fixed #1857 2022-05-06 10:54:39 +01:00
579883354a BUG: ManualInjection - corrected for non-zero SOI. See #2096 2022-05-04 12:39:03 +01:00
0e5dfb1f64 BUG: atmosphericModels: add missing clone functions (fixes #2428) 2022-04-01 08:56:25 +01:00
cae9b6b868 BUG: Added missing GbyNu name - see #2409 2022-03-24 14:27:08 +00:00
b9d6a84314 BUG: Ensure T can be checked-out on destruction of thermo. See #1619 2022-03-24 09:17:19 +00:00
80318542e1 CONFIG: bump patch level 2022-03-01 11:00:00 +01:00
942c354b59 BUG: atmTurbulentHeatFluxTemperature BC - added missing clone() calls for Function1. See #2370 2022-02-25 13:01:04 +00:00
3d7e99b7a7 BUG: timeActivatedFileUpdate file check on non-master (fixes #2377)
ENH: report relative paths for output for easier reading
2022-02-23 12:48:18 +01:00
cc65f5f0f0 TUT: coded functionObject called on execute instead of write
- generated too much output that also missed topology changes,
  which prevents proper post-processing
2022-02-18 10:41:17 +01:00
3d842aac93 BUG: decomposeParDict: operate with masterUncollated. Fixes #2368. 2022-02-16 16:43:33 +01:00
34a3e0abe3 BUG: cyclicAMI: optional settings not written. Fixes #2363 2022-02-16 16:43:25 +01:00
3a6c0d7fb0 BUG: sample/store surface field triggers dimension check (fixes #2361)
- when used for example with wallShearStress, the stress field is
  initially created as incompressible but later updated with the
  correct compressible/incompressible dimensions.

  If this field is sampled as a surface and stored on the registry
  the dimensions should be reset() and not '=' assigned, since that
  causes a dimension check which will obviously fail.
2022-02-11 14:27:00 +01:00
19398ded1c CONFIG: align adios2 settings with shipped ThirdParty version (#2353) 2022-02-04 09:01:32 +01:00
d44c8318f0 COMP: use automatic cleanup for run-time compat table (fixes #2314)
- occurs with newer gcc on ubuntu impish (gcc-11.2.0), but may perhaps
  actually be related to `-flto=auto` or to the destruction order of
  the static variables (race condition?).

  Leaving the compat table around for automatic cleanup does not
  impact on other lookups (which are nullptr checked anyhow).
2022-01-11 11:39:57 +01:00
91b5525749 CONFIG: incorrect lib-name handling (fixes #2322) 2022-01-11 11:24:24 +01:00
48562b8649 BUG: KinematicReynoldsNumber: enable cloud function object (fixes #2317)
TUT: hopperEmptying: add an example for KinematicReynoldsNumber
DOC: ThermoReynoldsNumber/KinematicReynoldsNumber: correct the usage examples
2022-01-11 11:24:24 +01:00
145f29cc9a Merge branch 'develop' 2021-12-21 19:19:38 +00:00
14aeaf8dab RELEASE: Updated version to v2112 2021-12-20 18:57:43 +00:00
f815a12bba BUG: error with empty distributed roots specification (fixes #2196)
- previously used the size of distributed roots to transmit if the
  case was running in distributed mode, but this behaves rather poorly
  with bad input. Specifically, the following questionable setup:

      distributed true;
      roots ( /*none*/ );

  Now transmit the ParRunControl distributed() value instead,
  and also emit a gentle warning for the user:

      WARNING: running distributed but did not specify roots!
2021-09-08 09:29:27 +02:00
856 changed files with 7888 additions and 12896 deletions

View File

@ -1,2 +1,2 @@
api=2112
patch=0
patch=220610

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -19,7 +19,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \

View File

@ -8,7 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View File

@ -39,6 +39,6 @@ EXE_LIBS = \
-lturbulenceModels \
-lsampling \
-lregionModels \
-lregionFaModels \
-lsurfaceFilmModels \
-lcompressibleTwoPhaseMixtureTurbulenceModels

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -196,23 +196,19 @@ int main(int argc, char *argv[])
SortList<scalar> sorter1(list1);
Info<< nl << "Sorted: " << flatOutput(sorter1) << nl;
Info<< nl << "Sort indices: " << flatOutput(sorter1.indices()) << nl;
// Reverses indices
Info<< nl << "Reverse indices: " << flatOutput(sorter1.indices()) << nl;
sorter1.reverse();
Info<< nl << "Reverse: " << flatOutput(sorter1.indices()) << nl;
sorter1.reset();
Info<< nl << "Reset indices: " << flatOutput(sorter1.indices()) << nl;
Info<< nl << "Again indices: " << flatOutput(sorter1.indices()) << nl;
sorter1.reverseSort();
Info<< nl << "Reverse indices: " << flatOutput(sorter1.indices()) << nl;
Info<< nl << "Reverse sorted: " << flatOutput(sorter1) << nl;
Info<< nl << "Sorted : " << flatOutput(sorter1) << nl;
sorter1.sort(std::greater<scalar>());

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,
@ -1015,10 +960,7 @@ Foam::label Foam::checkGeometry
const fileName outputDir
(
mesh.time().globalPath()
/functionObject::outputPrefix
/(mesh.name() == polyMesh::defaultRegion ? word::null : mesh.name())
/"checkMesh"
mesh.time().globalPath()/functionObject::outputPrefix/"checkMesh"
);
forAll(pbm, patchi)
@ -1034,29 +976,59 @@ Foam::label Foam::checkGeometry
<< cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl;
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 / cpp.name() + "-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]))
{
@ -1064,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 / cpp.name() + "-src_" + tmName),
(outputDir / fName),
false // serial - already merged
);
@ -1082,31 +1064,55 @@ Foam::label Foam::checkGeometry
}
}
{
const auto& nbrPp = cpp.neighbPatch();
// 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
/ nbrPp.name() + "-tgt_" + tmName
),
ami.tgtWeightsSum(),
nbrPp.localFaces(),
nbrPp.meshPoints(),
nbrPp.meshPointMap(),
cpp.neighbPatch().localFaces(),
cpp.neighbPatch().meshPoints(),
cpp.neighbPatch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints,
globalFaces,
globalPoints
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]))
{
@ -1121,14 +1127,17 @@ Foam::label Foam::checkGeometry
if (Pstream::master())
{
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-tgt_" + tmName
);
wr.open
(
mergedPoints,
mergedFaces,
(
outputDir
/ nbrPp.name() + "-tgt_" + tmName
),
(outputDir / fName),
false // serial - already merged
);
@ -1139,61 +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();
// Collect geometry
faceList mergedFaces;
pointField mergedPoints;
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
(
mesh,
wr,
outputDir / pp.name() + "-src_" + tmName,
ami.srcWeightsSum(),
pp.localFaces(),
pp.meshPoints(),
pp.meshPointMap(),
mergedFaces,
mergedPoints,
globalFaces,
globalPoints
);
if (cpp.sameWorld())
{
//- Get the patch on the region
const polyPatch& nbrPp = cpp.samplePolyPatch();
// Collect neighbour geometry
faceList mergedFaces;
pointField mergedPoints;
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
(
cpp.sampleMesh(),
wr,
outputDir / nbrPp.name() + "-tgt_" + tmName,
ami.tgtWeightsSum(),
nbrPp.localFaces(),
nbrPp.meshPoints(),
nbrPp.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

@ -5,6 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh \
-lreconstruct

View File

@ -5,6 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh \
-lreconstruct

View File

@ -5,6 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh \
-lreconstruct

View File

@ -53,8 +53,8 @@ Usage
-rotate-angle (vector angle)
Rotate angle degrees about vector axis.
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees)
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees)
or -yawPitchRoll : (yaw pitch roll) degrees
or -rollPitchYaw : (roll pitch yaw) degrees
-scale scalar|vector
Scale the points by the given scalar or vector on output.
@ -259,15 +259,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -411,18 +414,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
if (args.found("rotate"))
@ -503,15 +506,15 @@ int main(int argc, char *argv[])
}
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));

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

@ -591,7 +591,7 @@ int main(int argc, char *argv[])
{
for
(
const word& opt
const char * const opt
: { "cellSet", "cellZone", "faceSet", "pointSet" }
)
{

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

@ -1,14 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/randomProcesses/lnInclude \
-I$(FFTW_INC_DIR)
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-lsampling \
-lrandomProcesses

View File

@ -1,13 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/randomProcesses/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-lrandomProcesses

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

@ -92,7 +92,7 @@ bool setCellFieldType
fieldType field(fieldHeader, mesh, false);
const Type& value = pTraits<Type>(fieldValueStream);
const Type value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size())
{
@ -244,7 +244,7 @@ bool setFaceFieldType
fieldType field(fieldHeader, mesh);
const Type& value = pTraits<Type>(fieldValueStream);
const Type value = pTraits<Type>(fieldValueStream);
// Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());

View File

@ -188,15 +188,18 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"auto-origin",
"Use bounding box centre as origin for rotations"
"auto-centre",
"Use bounding box centre as centre for rotations"
);
argList::addOption
(
"origin",
"centre",
"point",
"Use specified <point> as origin for rotations"
"Use specified <point> as centre for rotations"
);
argList::addOptionCompat("auto-centre", {"auto-origin", 2206});
argList::addOptionCompat("centre", {"origin", 2206});
argList::addOption
(
"rotate",
@ -334,18 +337,18 @@ int main(int argc, char *argv[])
points += v;
}
vector origin;
bool useOrigin = args.readIfPresent("origin", origin);
if (args.found("auto-origin") && !useOrigin)
vector rotationCentre;
bool useRotationCentre = args.readIfPresent("centre", rotationCentre);
if (args.found("auto-centre") && !useRotationCentre)
{
useOrigin = true;
origin = boundBox(points).centre();
useRotationCentre = true;
rotationCentre = boundBox(points).centre();
}
if (useOrigin)
if (useRotationCentre)
{
Info<< "Set origin for rotations to " << origin << endl;
points -= origin;
Info<< "Set centre of rotation to " << rotationCentre << endl;
points -= rotationCentre;
}
if (args.found("rotate"))
@ -406,15 +409,15 @@ int main(int argc, char *argv[])
points = transform(rot, points);
}
if (useRotationCentre)
{
Info<< "Unset centre of rotation from " << rotationCentre << endl;
points += rotationCentre;
}
// Output scaling
applyScaling(points, getScalingOpt("write-scale", args));
if (useOrigin)
{
Info<< "Unset origin for rotations from " << origin << endl;
points += origin;
}
surf1.movePoints(points);
surf1.write(exportName, writeFileType);

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

@ -47,9 +47,6 @@ pointSync false;
// Patches to create.
patches
(
// Example of creating cyclic patch pair
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
// Name of new patch
name cyc_half0;
@ -73,17 +70,10 @@ patches
//matchTolerance 1E-2;
}
// How to select the faces:
// - set : specify faceSet in 'set'
// - patches : specify names in 'patches'
// - autoPatch : attempts automatic patching of the specified
// candidates in 'patches'.
// - single region : match in the region itself
// - multi regions : match in between regions only
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches or autoPatch: names of patches.
// Wildcards&patchGroups allowed.
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (periodic1);
// If constructFrom = set : name of faceSet
@ -108,66 +98,15 @@ patches
// separationVector (1 0 0);
}
// How to select the faces:
// - set : specify faceSet in 'set'
// - patches : specify names in 'patches'
// - autoPatch : attempts automatic patching of the specified
// candidates in 'patches'.
// - single region : match in the region itself
// - multi regions : match in between regions only
// How to construct: either from 'patches' or 'set'
constructFrom patches;
// If constructFrom = patches or autoPatch: names of patches.
// Wildcards&patchGroups allowed.
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (periodic2);
// If constructFrom = set : name of faceSet
set f0;
}
// Example of creating mapped patches using geometric matching
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
// Name of new patch
name solid;
// Dictionary to construct new patch from
patchInfo
{
type mappedPatch;
sampleMode nearestPatchFaceAMI;
AMIMethod faceAreaWeightAMI;
// Overwritten
//sampleRegion otherRegion;
//samplePatch otherPatch;
//- Optional override of added patchfields. If not specified
// any added patchfields are of type calculated.
patchFields
{
T
{
type fixedValue;
value uniform 300;
}
}
}
// How to select the faces:
// - set : specify faceSet in 'set'
// - patches : specify names in 'patches'
// - autoPatch : attempts automatic patching of the specified
// candidates in 'patches'.
// - single region : match in the region itself
// - multi regions : match in between regions only
constructFrom autoPatch;
// If constructFrom = patches or autoPatch: names of patches.
// Wildcards&patchGroups allowed.
patches (coupling_group);
}
);
// ************************************************************************* //

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

@ -480,8 +480,6 @@ castellatedMeshControls
// when generating meshes with faceZones as baffles or boundary
// faces.
//minCellFraction 0.001;
// Optional: same but in absolute number of cells. Default is 0.
//nMinCells 100;
}
// Settings for the snapping.

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -20,7 +20,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
set adios2_version=ADIOS2-2.6.0
set adios2_version=ADIOS2-2.7.1
setenv ADIOS2_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -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.
@ -210,8 +210,8 @@ endif
# Remove duplicates from environment paths
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
_foamClean PATH
_foamClean MANPATH
_foamClean -lib
# Add trailing ':' for system manpages

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd.
# Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -21,7 +21,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
adios2_version=ADIOS2-2.6.0
adios2_version=ADIOS2-2.7.1
export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
# END OF (NORMAL) USER EDITABLE PART

View File

@ -149,7 +149,7 @@ then
then
case "$foamVar_end" in
(/*) # Absolute path
_foamAddLib "foamVar_end"
_foamAddLib "$foamVar_end"
;;
(*) # Relative to prefix
_foamAddLib "$foamVar_prefix/$foamVar_end"

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -26,7 +26,7 @@ Documentation
(
"$WM_PROJECT_USER_DIR/html"
"$WM_PROJECT_DIR/doc/Doxygen/html"
"https://www.openfoam.com/documentation/guides/latest/api/"
"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

@ -365,7 +365,6 @@ $(funcObjs)/logFiles/logFiles.C
$(funcObjs)/timeControl/timeControl.C
$(funcObjs)/timeControl/timeControlFunctionObject.C
$(funcObjs)/regionFunctionObject/regionFunctionObject.C
$(funcObjs)/valueAverageBase/valueAverageBase.C
Time = db/Time
$(Time)/TimePaths.C
@ -595,6 +594,7 @@ meshes/ProcessorTopology/commSchedule.C
globalMeshData = $(polyMesh)/globalMeshData
$(globalMeshData)/globalMeshData.C
$(globalMeshData)/globalPoints.C
$(globalMeshData)/globalIndex.C
$(polyMesh)/syncTools/syncTools.C
$(polyMesh)/polyMeshTetDecomposition/polyMeshTetDecomposition.C
@ -803,14 +803,23 @@ $(interpolationWeights)/linearInterpolationWeights/linearInterpolationWeights.C
$(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C
algorithms/indexedOctree/indexedOctreeName.C
algorithms/indexedOctree/treeDataCell.C
algorithms/indexedOctree/volumeType.C
algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C
algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C
parallel/globalIndex/globalIndex.C
graph/curve/curve.C
graph/graph.C
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-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,14 +143,11 @@ public:
// Access
//- True if the number of rows is zero
inline bool empty() const noexcept;
//- The primary size (the number of rows)
inline label size() const noexcept;
//- The total addressed size
inline label totalSize() const;
//- True if the number of rows is zero
inline bool empty() const noexcept;
//- Return the offset table (= size()+1)
inline const List<label>& offsets() const;

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.
@ -123,13 +123,6 @@ Foam::CompactListList<T, Container>::null()
}
template<class T, class Container>
inline bool Foam::CompactListList<T, Container>::empty() const noexcept
{
return !size_;
}
template<class T, class Container>
inline Foam::label Foam::CompactListList<T, Container>::size() const noexcept
{
@ -138,10 +131,9 @@ inline Foam::label Foam::CompactListList<T, Container>::size() const noexcept
template<class T, class Container>
inline Foam::label Foam::CompactListList<T, Container>::totalSize() const
inline bool Foam::CompactListList<T, Container>::empty() const noexcept
{
const label len = (offsets_.size() - 1);
return (len < 1) ? static_cast<label>(0) : offsets_[len];
return !size_;
}

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

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,8 +37,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_SortList_H
#define Foam_SortList_H
#ifndef SortList_H
#define SortList_H
#include "IndirectList.H"
@ -72,13 +72,13 @@ public:
// Member Functions
//- Return the list of sorted indices (updated every sort).
//- Return the list of sorted indices. Updated every sort
// Same as addressing()
inline const labelUList& indices() const noexcept;
inline const labelUList& indices() const;
//- Return the list of indices (updated every sort).
//- Return the list of indices. Updated every sort
// Same as addressing()
inline labelList& indices() noexcept;
inline labelList& indices();
//- Reverse the indices
inline void reverse();
@ -94,13 +94,9 @@ public:
//- Functionally identical to sort with std::less\<T\>()
inline void sort();
//- Reverse (stable) sort the list.
//- Functionally identical to sort with std::greater\<T\>()
//- Reverse (stable) sort the list
inline void reverseSort();
//- Sort the list, only retaining unique entries
inline void uniqueSort();
// Member Operators

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +32,7 @@ License
template<class T>
inline Foam::SortList<T>::SortList(const UList<T>& values)
:
IndirectList<T>(values, labelList())
IndirectList<T>(values, identity(values.size()))
{
sort();
}
@ -42,7 +42,7 @@ template<class T>
template<class Compare>
inline Foam::SortList<T>::SortList(const UList<T>& values, const Compare& comp)
:
IndirectList<T>(values, labelList())
IndirectList<T>(values, identity(values.size()))
{
sort<Compare>(comp);
}
@ -51,14 +51,14 @@ inline Foam::SortList<T>::SortList(const UList<T>& values, const Compare& comp)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
inline const Foam::labelUList& Foam::SortList<T>::indices() const noexcept
inline const Foam::labelUList& Foam::SortList<T>::indices() const
{
return this->addressing();
}
template<class T>
inline Foam::labelList& Foam::SortList<T>::indices() noexcept
inline Foam::labelList& Foam::SortList<T>::indices()
{
return this->addressing();
}
@ -74,9 +74,10 @@ inline void Foam::SortList<T>::reverse()
template<class T>
inline void Foam::SortList<T>::reset()
{
auto& addr = this->indices();
const label len = this->values().size();
addr.resize_nocopy(this->values().size());
labelList& addr = this->indices();
addr.resize(len);
ListOps::identity(addr);
}
@ -85,11 +86,14 @@ template<class T>
template<class Compare>
inline void Foam::SortList<T>::sort(const Compare& comp)
{
auto& vals = this->values();
auto& addr = this->indices();
UList<T>& vals = this->values();
labelList& addr = this->indices();
addr.resize_nocopy(vals.size());
ListOps::identity(addr);
if (addr.size() != vals.size())
{
addr.resize(vals.size());
ListOps::identity(addr);
}
std::stable_sort
(
@ -103,26 +107,43 @@ inline void Foam::SortList<T>::sort(const Compare& comp)
template<class T>
inline void Foam::SortList<T>::sort()
{
Foam::sortedOrder(this->values(), this->indices());
}
UList<T>& vals = this->values();
labelList& addr = this->indices();
if (addr.size() != vals.size())
{
addr.resize(vals.size());
ListOps::identity(addr);
}
template<class T>
inline void Foam::SortList<T>::uniqueSort()
{
Foam::uniqueOrder(this->values(), this->indices());
// Forward sort of indices
std::stable_sort
(
addr.begin(),
addr.end(),
[&](label a, label b) -> bool { return vals[a] < vals[b]; }
);
}
template<class T>
inline void Foam::SortList<T>::reverseSort()
{
// Reverse sorted order for indices
Foam::sortedOrder
UList<T>& vals = this->values();
labelList& addr = this->indices();
if (addr.size() != vals.size())
{
addr.resize(vals.size());
ListOps::identity(addr);
}
// Reverse sort of indices
std::stable_sort
(
this->values(),
this->indices(),
typename UList<T>::greater(this->values())
addr.begin(),
addr.end(),
[&](label a, label b) -> bool { return vals[b] < vals[a]; }
);
}

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);
}

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