Compare commits

...

57 Commits

Author SHA1 Message Date
8f53fcfdf6 ENH: cyclicAMI: alternative low-weight correction 2022-02-15 16:55:13 +00:00
8e552bd2b4 ENH: snappyHexMesh: parallel consistency. Fixes #2331.
Coupled boundary faces should behave as internal faces
2022-02-14 16:02:19 +00:00
bdb9a54bed BUG: cyclicAMI: optional settings not written. Fixes #2363 2022-02-11 18:38:49 +00:00
24bee96db2 ENH: avoid unnecessary disk access in writeDictionary (#2362)
- added in special handling for monitoring controlDict.

  Since controlDict is an unwatchedIOdictionary (not IOdictionary) and
  not registered either, the usual objectRegistry caching is not
  available. Instead, access directly from Time.

  Left the balance of the file handling largely intact (for handling
  unregistered dictionaries) but could potentially revisit in the
  future and attempt master-only file access if required. However,
  most other IOdictionary types will be registered, otherwise the
  READ_IF_MODIFIED mechanism would not really work properly.
2022-02-11 17:52:34 +01:00
cbc86d6a88 DEFEATURE: remove deprecated/obsolete sample/store onto surfMesh
- was a stop-gap measure until field/registry storage on
  polySurface was introduced (FEB-2019)
2022-02-10 19:42:06 +01:00
1be63cd378 ENH: update coding for VTK fileFormats, make open() virtual
- add writer support for VERTICES

- updated use of globalIndex

ENH: add base vtk writer for points/verts/lines

STYLE: noexcept, explicit constructors etc
2022-02-10 19:28:51 +01:00
295822daa6 ENH: cleanup/reorganize surfaceWriter and fileFormats
- remove unused surfaceWriter constructors, noexcept on methods

- relocate/rename writerCaching from surfMesh -> fileFormats

- changed from surfaceWriters::writerCaching to
  ensightOutput::writerCaching to permit reuse elsewhere

- relocate static output helpers to ensightCase

- refactor NAS coordinate writing
2022-02-10 19:28:51 +01:00
731e276e21 ENH: extend command-line options for particleTracks
- can specify format, stride without modifying a dictionary
  (increases flexibility, eases testing)
2022-02-10 19:28:51 +01:00
df18b8bb3c DEFEATURE: remove alpha-field support (partly broken) from gltf output
- when used with *any* alphaField and normalised (the usual case)
  would largely give a 0-1 corresponding to the min/max of the first
  component, but could also yield negative values.

- if the alpha field corresponds identically to colour field, it is
  readily possible to combine as into RGBA sequences. However, if the
  fields are different it potentially means referencing an opacity
  field that has not yet been sampled.  This impedes using the format
  for a streaming sampler without additional overhead and/or rewriting
  the alpha channel later.
2022-02-10 19:28:51 +01:00
2a61606251 ENH: improve gltf handling
- scene

  - write with fileName, additional getMesh accessor

  - addColourToMesh accepts an alpha field size 1 as a constant
    alpha value

  - sceneWriter wrapper

ENH: improve gltf handling of colour and alpha specification

- accept plain input directly.
  Eg,
      colour  (1 0 1);
  vs
      colour      uniform;
      colourValue (1 0 1);

- use field magnitude for colouring of non-scalar fields.

  Eg, having three different colour maps for a vector field simply
  does not help much with visualisation.
2022-02-10 19:28:51 +01:00
06ade9515e GIT: relocate coordSet from fileFormats to meshTools
- meshTools is the first layer in which coordSet is actually needed

STYLE: rename writer implementations in advance of upcoming changes (#2347)

- simplifies tracing of code changes (git blame)
2022-02-10 19:28:51 +01:00
0511aebd86 ENH: add probes sampleOnExecute option (#2358)
- supports sampling/probing of values to obtain min/max/average/size
  at execution intervals without writing any output or generating
  output directories.

- 'verbose' option for additional output
2022-02-10 19:28:51 +01:00
e147ac52e9 ENH: probes and patchProbes - added caching of results (#2358)
- min, max, average and sample size results now stored in
  functionObjectProperties similar to sampledSets, e.g. for field p

  - min(p)
  - max(p)
  - average(p)
  - size(p)
2022-02-10 19:28:50 +01:00
e806d18612 ENH: consolidate allow/deny wordRes filtering
- wrap as wordRes::filter functor

- support allow/deny when loading cloud fields to a registry
2022-02-10 19:28:50 +01:00
fb4fe06306 ENH: simplify component handling
- raw writer, components functionObject
2022-02-10 19:28:50 +01:00
7db2a29413 ENH: type aliases for common GeometricField forms (#2348)
ENH: provide fieldTypes::surface names (as per fieldTypes::volume)

ENH: reduce number of files for surface fields

- combine face and point field declarations/definitions,
  simplify typeName definitions
2022-02-10 19:28:50 +01:00
4f8b8258fc ENH: simplify construction of 'one-sided' globalIndex
- uses globalIndex::gatherOnly / globalIndex::gatherNone dispatch tags

  Eg,
      globalIndex(send.size(), globalIndex::gatherOnly{});

  vs.

      globalIndex
      (
          UPstream::listGatherValues(send.size()),
          globalIndex::SIZES
      );
2022-02-10 16:46:13 +01:00
ddcc04dadc BUG: vtk write of uniform field in parallel (fixes #2349)
- used low-level MPI gather, but the wrapping routine contains an
  additional safety check for is_contiguous which is not defined for
  various std::pair<..> combination.

  So std::pair<label,vector> (which is actually contiguous, but not
  declared as is_contiguous) would falsely trip the check.

  Avoid by simply gathering unbundled values instead.
2022-02-10 16:46:13 +01:00
7a6891905e ENH: make tetIndices contiguous, noexcept, sortable, comparable
ENH: make interpolation constructors explicit etc
2022-02-10 16:46:13 +01:00
2919c9b675 STYLE: minor changes
- do not need STRINGIFY macros in ragel code
- remove wordPairHashTable.H and use equivalent wordPairHashes.H instead

STYLE: replace addDictOption with explicit option

 - the usage text is otherwise misleading

GIT: combine Pair/Tuple2 directories
2022-02-10 16:46:13 +01:00
62ec2f2ddf COMP: deprecate domainName and full hostName (#2280)
- unused in regular OpenFOAM code
- POSIX version uses deprecated gethostbyname()
- Windows version never worked

COMP: localize, noexcept on internal OSspecific methods

STYLE: support fileName::Type SYMLINK and LINK as synonyms
2022-02-10 16:46:12 +01:00
debbcfb7df BUG: redistributePar: handle cyclicA(C)MI cleaner. See #1558.
Should test on patch, not patch field
2022-02-10 13:46:21 +00:00
13b6898661 ENH: tutorials: added dummy fv* files
(createPatch now operates on fvMesh)
2022-02-10 13:45:21 +00:00
3902ac2857 BUG: singleProcessorFaceSets: fix parallel/. Fixes #2359.
The logic was not maintaining consistent sets of constraints
on different processors. A single processor with a full
match (very easy with 0 local faces) would invalidate
adding the constraint.
2022-02-10 12:10:00 +00:00
ad6d3a088e ENH: createPatch: update fields. Fixes #1361.
- adds 'patchFields' subdictionary to specify fvPatchFields
  similar to createBaffles
- implements automatic matching across multiple regions
2022-02-09 15:54:24 +00:00
7fa44e3c19 BUG: redistributePar: handle cyclicA(C)MI cleaner. See #1558. 2022-02-09 14:17:17 +00:00
f14263e019 ENH: checkMesh: output AMI weights on mapped. Fixes #2356. 2022-02-07 16:21:08 +00:00
88b64ab054 Merge branch 'feature-core-changes' into 'develop'
bugfixes and style changes

See merge request Development/openfoam!522
2022-02-01 10:18:20 +00:00
e1f06bf38e ENH: globalIndex gather ops with reduced communication (#2332)
- for contiguous data, added mpiGatherOp() to complement the
  gatherOp() static method

- the gather ops (static methods) populate the globalIndex on the
  master only (not needed on other procs) for reduced communication

- rename inplace gather methods to include 'inplace' in their name.
  Regular gather methods return the gathered data directly, which
  allows the following:

      const scalarField mergedWeights(globalFaces().gather(wghtSum));

  vs.
      scalarField mergedWeights;
      globalFaces().gather(wghtSum, mergedWeights());

  or even:

      scalarField mergedWeights;
      List<scalarField> allWeights(Pstream::nProcs());
      allWeights[Pstream::myProcNo()] = wghtSum;
      Pstream::gatherList(allWeights);
      if (Pstream::master())
      {
          mergedWeights =
              ListListOps::combine<scalarField>
              (
                  allWeights, accessOp<scalarField>()
              );
       }

- add parRun guards on various globalIndex gather methods
  (simple copies or no-ops in serial) to simplify the effort for callers.
2022-01-31 20:09:49 +01:00
6b99fea4e7 ENH: use nBoundaryFaces() in more places (less clutter, more clarity)
- noexcept for some methods
- add std:: qualifier to unique_ptr for additional clarity
2022-01-31 20:09:45 +01:00
61aef196ed STYLE: use single-parameter SubList where applicable (reduces clutter) 2022-01-31 20:08:52 +01:00
6a87dbcbcd ENH: encapsulate wordRe regex with pointer
- reduces overall size and other overhead when wordRe represents
  a literal.
2022-01-31 20:08:52 +01:00
8b9dfbfe1f STYLE: combine files, explicit constructors (Dictionary) 2022-01-31 20:08:52 +01:00
ab065cd5d3 BUG: avoid memory slicing in LList (#2300)
ENH: reduce code effort for clearing linked-lists

ENH: adjust linked-list method name

- complement linked-list append() method with prepend() method
  instead of 'insert', which is not very descriptive
2022-01-31 20:08:52 +01:00
511431d6df BUG: snappyHexMesh: excessive memory blockLevel. Fixes #2345
Assumes that gap is formed when both surfaces agree i.e.
it takes the minimum distance of the two. This means that
any wave only needs to be propagated according to the
originating surface.
2022-01-31 16:43:00 +00:00
bd10f67a13 ENH: avoid unneeded IOobjectList scan in sampledSurfaces
STYLE: replace findStrings with ListOps::found
2022-01-24 17:56:19 +01:00
1ea1b84f12 BUG: MapGeometricFields maps symmTensor instead of sphericalTensor (#2335)
STYLE: volFieldValue prints empty lines (#2334)

GIT: remove unused valveBank file (#2336)

STYLE: use value (not dimensioned value) in comfort warning (#2338)
2022-01-24 12:26:38 +01:00
35cf639fe8 COMP: noexcept for label/scalar component access
- qualify include guards for primitives
2022-01-24 12:26:38 +01:00
c3703226c1 SUBMODULE: update OpenQBMM for autoPtr::set() deprecation 2022-01-24 12:26:38 +01:00
d2961eec09 STYLE: avoid deprecation warnings for autoPtr set() method
- set() was silently deprecated in favour of reset() FEB-2018
  since the original additional check for overwriting an existing
  pointer was never used. The reset(...) name is more consistent
  with unique_ptr, tmp etc.

  Now emit deprecations for set().

- use direct test for autoPtr, tmp instead of valid() method.
  More consistent with unique_ptr etc.

STYLE: eliminate redundant ptr() use on cloned quantities
2022-01-24 12:26:38 +01:00
3b1f6e867c STYLE: add std:: qualifier to unique_ptr for additional clarity, noexcept 2022-01-21 09:19:51 +01:00
97f452d53a COMP: isolate include for coordSet writer 2022-01-21 09:19:50 +01:00
b874dc74b0 DEFEATURE: remove support for jplot (defunct) 2022-01-20 17:13:28 +01:00
0d3e84eb10 BUG: Time: correct the user-time operation for time-precision adaptations (fixes #2328) 2022-01-20 10:04:18 +00:00
62982ffad6 ENH: snappyHexMesh: parallel consistency. Fixes #2331. 2022-01-19 14:23:09 +00:00
2e81c80527 BUG: fix typo in comfort functionObject, minor style changes (#2325) 2022-01-18 16:42:11 +01:00
3eb3b74c1e ENH: MappedFile: allow multiple fieldTables. Fixes #2324 2022-01-17 16:11:30 +00:00
15c481204d ENH: comfort function object - added operative temperature. See #2325 2022-01-17 09:40:06 +00:00
74e3306454 ENH: PairModel: add none option 2022-01-14 17:21:35 +00:00
f5eace394b DOC: Corrected online doxygen links. Fixes #2326 2022-01-14 14:33:45 +00:00
befbcfce24 ENH: simpler coordinateSystem writeEntry with single parameter 2022-01-13 13:58:23 +01:00
4b7f92935e BUG: fixedJump: calculate jump in he. Fixes #2327 2022-01-13 10:17:37 +00:00
2047a69115 BUG: reconstructPar: delay locating positions. Fixes #2205. 2022-01-12 11:36:05 +00:00
fa5d79d0e5 ENH: redistributePar: add comment 2022-01-12 09:16:04 +00:00
83ef7aa5d2 ENH: velocityDampingConstraint - updated to operate on a cell section. See #2301 2022-01-11 17:13:29 +00:00
7825d24de1 TUT: Adjusting settings for hPoly thermo for phase change 2022-01-11 14:14:09 +00:00
99b2550af2 ENH: processorField: provision for mesh changes. Fixes #2319 2022-01-06 10:21:44 +00:00
629 changed files with 9321 additions and 5885 deletions

View File

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

View File

@ -104,6 +104,8 @@ int main(int argc, char *argv[])
printInfo<FixedList<word, 2>>();
printInfo<Pair<word>>();
printInfo<std::pair<int, vector>>();
printInfo<FixedList<FixedList<int, 2>, 2>>();
printInfo<segment>();

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,13 +32,13 @@ Description
#include "ListOps.H"
#include "FlatOutput.H"
#include "IOstreams.H"
#include "macros.H"
using namespace Foam;
// For testing various pre-defined formatting
#define printFlatOutput(Content, Format) \
STRINGIFY(Format) << ": " << flatOutput(Content, FlatOutput::Format{})
#define printFlatOutput(Content, Format) \
Info<< nl << #Format << ": " \
<< flatOutput(Content, FlatOutput::Format{}) << nl
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,20 +77,20 @@ int main(int argc, char *argv[])
Info<< nl << "write: ";
flatOutput(words1).write(Info) << nl;
Info<< nl << printFlatOutput(words1, BareComma) << nl;
Info<< nl << printFlatOutput(words1, BareSpace) << nl;
printFlatOutput(words1, BareComma);
printFlatOutput(words1, BareSpace);
Info<< nl << printFlatOutput(words1, BraceComma) << nl;
Info<< nl << printFlatOutput(words1, BraceSpace) << nl;
printFlatOutput(words1, BraceComma);
printFlatOutput(words1, BraceSpace);
Info<< nl << printFlatOutput(words1, ParenComma) << nl;
Info<< nl << printFlatOutput(words1, ParenSpace) << nl;
printFlatOutput(words1, ParenComma);
printFlatOutput(words1, ParenSpace);
Info<< nl << printFlatOutput(words1, PointyComma) << nl;
Info<< nl << printFlatOutput(words1, PointySpace) << nl;
printFlatOutput(words1, PointyComma);
printFlatOutput(words1, PointySpace);
Info<< nl << printFlatOutput(words1, SquareComma) << nl;
Info<< nl << printFlatOutput(words1, SquareSpace) << nl;
printFlatOutput(words1, SquareComma);
printFlatOutput(words1, SquareSpace);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -180,6 +180,36 @@ int main(int argc, char *argv[])
}
}
// This will likely fail - not declared as is_contiguous
// Cannot even catch since it triggers an abort()
#if 0
{
std::pair<label,vector> sendData(Pstream::myProcNo(), vector::one);
const bool oldThrowingError = FatalError.throwing(true);
try
{
List<std::pair<label,vector>> countValues
(
UPstream::listGatherValues<std::pair<label, vector>>
(
sendData
)
);
Pout<< "listGather: " << flatOutput(countValues) << nl;
}
catch (const Foam::error& err)
{
Info<< err.message().c_str() << nl;
}
FatalError.throwing(oldThrowingError);
}
#endif
Info<< "\nEnd\n" << endl;
return 0;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -198,15 +198,15 @@ int main(int argc, char *argv[])
// Do the brute-force method as well : collect all cell centres on all
// processors
pointField allCcs(globalNumbering.size());
globalNumbering.gather
(
Pstream::worldComm,
Pstream::procID(Pstream::worldComm),
mesh.cellCentres(),
allCcs
);
Info<< "Gathered/scattered cell centres:" << endl;
labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size();
Pstream::scatter(allCcs);
inOut[1] = allCcs.size();
Pout<< " " << inOut << endl;
// Compare
forAll(ccs, i)
@ -239,10 +239,13 @@ int main(int argc, char *argv[])
Info<< "local-sizes: " << globalPointsPtr().sizes() << nl;
UIndirectList<point> procPoints(mesh.points(), uniqueMeshPointLabels);
pointField patchPoints;
globalPointsPtr().gather(procPoints, patchPoints);
pointField patchPoints
(
globalPointsPtr().gather
(
UIndirectList<point>(mesh.points(), uniqueMeshPointLabels)
)
);
Info<< "gathered point field = " << patchPoints.size() << " points\n";
}

View File

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

View File

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

View File

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

View File

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

View File

@ -11,10 +11,11 @@
#include "checkTools.H"
#include "functionObject.H"
#include "vtkSetWriter.H"
#include "vtkSurfaceWriter.H"
#include "writer.H"
#include "cyclicACMIPolyPatch.H"
#include "mappedPatchBase.H"
#include "Time.H"
// Find wedge with opposite orientation. Note: does not actually check that
@ -477,6 +478,60 @@ bool Foam::checkCoupledPoints
}
void Foam::collectAndWriteAMIWeights
(
const polyMesh& mesh,
surfaceWriter& wr,
const fileName& fName,
const scalarField& weights,
const faceList& localFaces,
const labelList& meshPoints,
const Map<label>& meshPointMap,
// Collect geometry
faceList& mergedFaces,
pointField& mergedPoints,
autoPtr<globalIndex>& globalFaces,
autoPtr<globalIndex>& globalPoints
)
{
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
Foam::PatchTools::gatherAndMerge
(
mesh,
localFaces,
meshPoints,
meshPointMap,
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather(weights, mergedWeights);
if (Pstream::master())
{
wr.open
(
mergedPoints,
mergedFaces,
fName,
false // serial - already merged
);
wr.write("weightsSum", mergedWeights);
wr.clear();
}
}
Foam::label Foam::checkGeometry
(
const polyMesh& mesh,
@ -976,59 +1031,30 @@ Foam::label Foam::checkGeometry
<< cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl;
const AMIPatchToPatchInterpolation& ami =
cpp.AMI();
const word pName("patch" + Foam::name(cpp.index()));
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
(
mesh,
wr,
outputDir / pName + "-src_" + tmName,
ami.srcWeightsSum(),
cpp.localFaces(),
cpp.meshPoints(),
cpp.meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
mergedPoints,
globalFaces,
globalPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
ami.srcWeightsSum(),
mergedWeights
);
if (Pstream::master())
{
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-src_" + tmName
);
wr.open
(
mergedPoints,
mergedFaces,
(outputDir / fName),
false // serial - already merged
);
wr.write("weightsSum", mergedWeights);
wr.clear();
}
if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
{
@ -1036,25 +1062,15 @@ Foam::label Foam::checkGeometry
refCast<const cyclicACMIPolyPatch>(pbm[patchi]);
scalarField mergedMask;
globalFaces().gather
(
pp.mask(),
mergedMask
);
globalFaces().gather(pp.mask(), mergedMask);
if (Pstream::master())
{
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-src_" + tmName
);
wr.open
(
mergedPoints,
mergedFaces,
(outputDir / fName),
(outputDir / pName + "-src_" + tmName),
false // serial - already merged
);
@ -1065,54 +1081,25 @@ Foam::label Foam::checkGeometry
}
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
(
mesh,
wr,
outputDir / pName + "-tgt_" + tmName,
ami.tgtWeightsSum(),
cpp.neighbPatch().localFaces(),
cpp.neighbPatch().meshPoints(),
cpp.neighbPatch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
mergedPoints,
globalFaces,
globalPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
ami.tgtWeightsSum(),
mergedWeights
);
if (Pstream::master())
{
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-tgt_" + tmName
);
wr.open
(
mergedPoints,
mergedFaces,
(outputDir / fName),
false // serial - already merged
);
wr.write("weightsSum", mergedWeights);
wr.clear();
}
if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
{
@ -1127,17 +1114,11 @@ Foam::label Foam::checkGeometry
if (Pstream::master())
{
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-tgt_" + tmName
);
wr.open
(
mergedPoints,
mergedFaces,
(outputDir / fName),
(outputDir / pName + "-tgt_" + tmName),
false // serial - already merged
);
@ -1148,6 +1129,35 @@ Foam::label Foam::checkGeometry
}
}
}
else if (isA<mappedPatchBase>(pbm[patchi]))
{
const auto& pp = pbm[patchi];
const auto& cpp = refCast<const mappedPatchBase>(pp);
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
const word pName("patch" + Foam::name(patchi));
// Collect geometry
faceList mergedFaces;
pointField mergedPoints;
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
(
mesh,
wr,
outputDir / pName + "-src_" + tmName,
ami.srcWeightsSum(),
pp.localFaces(),
pp.meshPoints(),
pp.meshPointMap(),
mergedFaces,
mergedPoints,
globalFaces,
globalPoints
);
}
}
}

View File

@ -1,12 +1,13 @@
#include "label.H"
#include "HashSet.H"
#include "labelVector.H"
#include "writer.H"
namespace Foam
{
// Forward Declarations
class polyMesh;
class wedgePolyPatch;
template<class T> class writer;
class surfaceWriter;
label findOppositeWedge(const polyMesh&, const wedgePolyPatch&);
@ -23,6 +24,24 @@ namespace Foam
//- Check 0th vertex on coupled faces
bool checkCoupledPoints(const polyMesh&, const bool report, labelHashSet*);
//- Collect AMI weights to master and write
void collectAndWriteAMIWeights
(
const polyMesh& mesh,
surfaceWriter& wr,
const fileName& fName,
const scalarField& weights,
const faceList& localFaces,
const labelList& meshPoints,
const Map<label>& meshPointMap,
// Collect geometry
faceList& mergedFaces,
pointField& mergedPoints,
autoPtr<globalIndex>& globalFaces,
autoPtr<globalIndex>& globalPoints
);
label checkGeometry
(
const polyMesh& mesh,

View File

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

View File

@ -36,10 +36,12 @@ License
#include "tetWedgeMatcher.H"
#include "tetMatcher.H"
#include "IOmanip.H"
#include "OFstream.H"
#include "pointSet.H"
#include "faceSet.H"
#include "cellSet.H"
#include "Time.H"
#include "writer.H"
#include "surfaceWriter.H"
#include "syncTools.H"
#include "globalIndex.H"

View File

@ -1,15 +1,16 @@
#include "scalar.H"
#include "indirectPrimitivePatch.H"
#include "writer.H"
namespace Foam
{
// Forward Declarations
class polyMesh;
class pointSet;
class faceSet;
class cellSet;
class fileName;
class polyMesh;
template<class T> class writer;
class surfaceWriter;
void printMeshStats(const polyMesh& mesh, const bool allTopology);

View File

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

View File

@ -1,11 +1,12 @@
#include "label.H"
#include "autoPtr.H"
#include "writer.H"
namespace Foam
{
// Forward Declarations
class polyMesh;
class pointSet;
template<class T> class writer;
class surfaceWriter;
template<class PatchType>

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -716,7 +716,7 @@ void writeProcAddressing
}
autoPtr<fileOperation> defaultHandler;
if (writeHandler.valid())
if (writeHandler)
{
defaultHandler = fileHandler(std::move(writeHandler));
}
@ -726,7 +726,7 @@ void writeProcAddressing
const bool pointOk = pointMap.write();
const bool patchOk = patchMap.write();
if (defaultHandler.valid())
if (defaultHandler)
{
writeHandler = fileHandler(std::move(defaultHandler));
}
@ -827,9 +827,24 @@ void readFields
fields.setSize(masterNames.size());
// Have master send all fields to processors that don't have a mesh
// Have master send all fields to processors that don't have a mesh. The
// issue is if a patchField does any parallel operations inside its
// construct-from-dictionary. This will not work when going to more
// processors (e.g. decompose = 1 -> many) ! We could make a special
// exception for decomposePar but nicer would be to have read-communicator
// ... For now detect if decomposing & disable parRun
if (Pstream::master())
{
// Work out if we're decomposing - none of the subprocs has a mesh
bool decompose = true;
for (const int procI : Pstream::subProcs())
{
if (haveMesh[procI])
{
decompose = false;
}
}
forAll(masterNames, i)
{
const word& name = masterNames[i];
@ -837,9 +852,16 @@ void readFields
io.writeOpt(IOobject::AUTO_WRITE);
// Load field (but not oldTime)
//const bool oldParRun = Pstream::parRun(false);
const bool oldParRun = Pstream::parRun();
if (decompose)
{
Pstream::parRun(false);
}
readField(io, mesh, i, fields);
//Pstream::parRun(oldParRun);
if (decompose)
{
Pstream::parRun(oldParRun);
}
// Create zero sized field and send
if (subsetterPtr)
@ -942,7 +964,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
auto& pfld = bfld[patchi];
const auto& fvp = mesh.boundary()[patchi];
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
{
pfld.initEvaluate(Pstream::defaultCommsType);
}
@ -962,7 +985,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
{
const auto& fvp = pfld.patch();
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
{
pfld.evaluate(Pstream::defaultCommsType);
}
@ -979,7 +1003,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
const auto& fvp = mesh.boundary()[patchi];
auto& pfld = bfld[patchi];
if (fvp.coupled() && !isA<cyclicACMIFvPatch>(fvp))
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
{
if (patchSchedule[patchEvali].init)
{
@ -1316,27 +1341,27 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
correctCoupledBoundaryConditions
<
volScalarField,
processorFvPatchField<scalar>
processorFvPatch
>(mesh);
correctCoupledBoundaryConditions
<
volVectorField,
processorFvPatchField<vector>
processorFvPatch
>(mesh);
correctCoupledBoundaryConditions
<
volSphericalTensorField,
processorFvPatchField<sphericalTensor>
processorFvPatch
>(mesh);
correctCoupledBoundaryConditions
<
volSymmTensorField,
processorFvPatchField<symmTensor>
processorFvPatch
>(mesh);
correctCoupledBoundaryConditions
<
volTensorField,
processorFvPatchField<tensor>
processorFvPatch
>(mesh);
// No update surface fields
@ -1407,14 +1432,14 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
else
{
autoPtr<fileOperation> defaultHandler;
if (writeHandler.valid())
if (writeHandler)
{
defaultHandler = fileHandler(std::move(writeHandler));
}
mesh.write();
if (defaultHandler.valid())
if (defaultHandler)
{
writeHandler = fileHandler(std::move(defaultHandler));
}
@ -2538,7 +2563,7 @@ int main(int argc, char *argv[])
// File handler to be used for writing
const fileOperation& fh
(
writeHandler.valid()
writeHandler
? writeHandler()
: fileHandler()
);
@ -2984,7 +3009,7 @@ int main(int argc, char *argv[])
);
fvMesh& mesh = meshPtr();
if (writeHandler.valid() && Pstream::master())
if (writeHandler && Pstream::master())
{
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around e.g. collated start-up
@ -3285,7 +3310,7 @@ int main(int argc, char *argv[])
);
fvMesh& mesh = meshPtr();
if (writeHandler.valid())
if (writeHandler)
{
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around the collated start-up

View File

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

View File

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

View File

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

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.
@ -36,7 +36,7 @@ bool writeDimField
const tmp<DimensionedField<Type, volMesh>>& tdf
)
{
if (!tdf.valid())
if (!tdf)
{
return false;
}

View File

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

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.
@ -38,7 +38,7 @@ bool writeVolField
const bool nearCellValue = false
)
{
if (!tfield.valid())
if (!tfield)
{
return false;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -118,7 +118,7 @@ Foam::PtrList<const GeoField> Foam::readFields
auto tfield =
getField<GeoField>(mesh, objects, fieldName, syncPar);
if (tfield.valid())
if (tfield)
{
fields.set(nFields++, tfield.ptr());
}
@ -157,7 +157,7 @@ Foam::PtrList<const GeoField> Foam::readFields
auto tfield =
getField<GeoField>(proxy, objects, fieldName, syncPar);
if (tfield.valid())
if (tfield)
{
fields.set(nFields++, tfield.ptr());
}

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.
@ -56,7 +56,7 @@ bool writeAreaField
const tmp<GeoField>& tfield
)
{
if (tfield.valid())
if (tfield)
{
writer.write(tfield());
tfield.clear();

View File

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

View File

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

View File

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

View File

@ -0,0 +1,30 @@
// Read particleTrackProperties dictionary and extract values from it
const word dictName("particleTrackProperties");
#include "setConstantMeshDictionaryIO.H"
IOdictionary propsDict(dictIO);
const word cloudName(propsDict.get<word>("cloud"));
label sampleFrequency(propsDict.get<label>("sampleFrequency"));
label maxPositions(propsDict.get<label>("maxPositions"));
label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
// Optional - if empty, select all
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
const word UName(propsDict.getOrDefault<word>("U", "U"));
const dictionary formatOptions
(
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
);
// ************************************************************************* //

View File

@ -1,26 +0,0 @@
IOdictionary propsDict
(
IOobject
(
"particleTrackProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED
)
);
const word cloudName(propsDict.get<word>("cloud"));
const label sampleFrequency(propsDict.get<label>("sampleFrequency"));
const label maxPositions(propsDict.get<label>("maxPositions"));
const label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
const word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
const word UName(propsDict.getOrDefault<word>("U", "U"));
const dictionary formatOptions = propsDict.subOrEmptyDict("formatOptions");

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -247,16 +247,48 @@ int main(int argc, char *argv[])
"Generate a file of particle tracks for cases that were"
" computed using a tracked-parcel-type cloud"
);
timeSelector::addOptions();
#include "addRegionOption.H"
#include "setRootCase.H"
// Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict");
argList::setAdvanced("noFunctionObjects");
argList::addOption
(
"dict",
"file",
"Alternative particleTracksProperties dictionary"
);
argList::addOption
(
"stride",
"int",
"Override the sample-frequency"
);
argList::addOption
(
"format",
"name",
"The writer format "
"(default: vtk or 'setFormat' from dictionary)"
);
argList::addVerboseOption("Additional verbosity");
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H"
#include "createFields.H"
// ------------------------------------------------------------------------
// Control properties
#include "createControls.H"
args.readIfPresent("format", setFormat);
args.readIfPresent("stride", sampleFrequency);
sampleFrequency = max(1, sampleFrequency); // sanity
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,19 @@
// Read particleTrackDict dictionary and extract values from it
const word dictName("particleTrackDict");
#include "setConstantMeshDictionaryIO.H"
IOdictionary propsDict(dictIO);
const word cloudName(propsDict.get<word>("cloud"));
List<word> userFields(propsDict.lookup("fields"));
const dictionary formatOptions
(
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
);
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,61 +1 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PtrDictionary.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(const label size)
:
DictionaryBase<DLPtrList<T>, T>(size)
{}
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
:
DictionaryBase<DLPtrList<T>, T>(dict)
{}
template<class T>
template<class INew>
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
:
DictionaryBase<DLPtrList<T>, T>(is, iNew)
{}
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
:
DictionaryBase<DLPtrList<T>, T>(is)
{}
// ************************************************************************* //
#warning File removed - left for old dependency check only

View File

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

View File

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

View File

@ -1,48 +1 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "UPtrDictionary.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
Foam::UPtrDictionary<T>::UPtrDictionary(const label size)
:
DictionaryBase<DLList<T*>, T>(size)
{}
template<class T>
Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
:
DictionaryBase<DLList<T*>, T>(dict)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
#warning File removed - left for old dependency check only

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,7 +61,7 @@ Foam::ILList<LListBase, T>::ILList
:
UILList<LListBase, T>()
{
for (const auto& item :lst)
for (const auto& item : lst)
{
this->append(item.clone(cloneArg).ptr());
}
@ -83,37 +83,26 @@ template<class LListBase, class T>
bool Foam::ILList<LListBase, T>::eraseHead()
{
T* p = this->removeHead();
if (p)
{
delete p;
return true;
}
return false;
delete p;
return bool(p);
}
template<class LListBase, class T>
bool Foam::ILList<LListBase, T>::erase(T* item)
{
T* p = remove(item);
if (p)
{
delete p;
return true;
}
return false;
delete p;
return bool(p);
}
template<class LListBase, class T>
void Foam::ILList<LListBase, T>::clear()
{
const label len = this->size();
label len = this->size();
for (label i=0; i<len; ++i)
while (len--)
{
eraseHead();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,8 +43,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef DLListBase_H
#define DLListBase_H
#ifndef Foam_DLListBase_H
#define Foam_DLListBase_H
#include "label.H"
#include "uLabel.H"
@ -76,10 +76,10 @@ public:
link() = default;
//- Check if the node is registered with the list
inline bool registered() const;
inline bool registered() const noexcept;
//- Deregister the node after removal
inline void deregister();
inline void deregister() noexcept;
};
@ -88,10 +88,10 @@ private:
// Private Data
//- Pointer to first element
link *first_ = nullptr;
link* first_ = nullptr;
//- Pointer to last element
link *last_ = nullptr;
link* last_ = nullptr;
//- Number of elements in the list
label size_ = 0;
@ -169,10 +169,10 @@ public:
inline const link* last() const;
//- Add at head of list
void insert(link* item);
//- Add at front of list
void prepend(link* item);
//- Add at tail of list
//- Add at back of list
void append(link* item);
//- Swap this element with the one above unless it is at the top
@ -181,13 +181,13 @@ public:
//- Swap this element with the one below unless it is at the bottom
bool swapDown(link* item);
//- Remove and return head
//- Remove and return first entry
link* removeHead();
//- Remove and return element
link* remove(link* item);
// Remove and return element specified by iterator
//- Remove and return element specified by iterator
inline link* remove(iterator& iter);
//- Replace oldLink with newLink and return element
@ -236,18 +236,10 @@ public:
inline iterator(DLListBase* list, link* item);
//- The storage node
inline link* get_node() const;
inline link* get_node() const noexcept;
//- Pointing at a valid storage node
inline bool good() const;
//- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method
FOAM_DEPRECATED_FOR(2019-01, "good() method")
bool found() const
{
return this->good();
}
inline bool good() const noexcept;
//- Move backward through list
inline void prev();
@ -290,18 +282,10 @@ public:
inline const_iterator(const DLListBase::iterator& iter);
//- The storage node
inline const link* get_node() const;
inline const link* get_node() const noexcept;
//- Pointing at a valid storage node
inline bool good() const;
//- Deprecated(2019-01) Pointing at a valid storage node
// \deprecated(2019-01) - use good() method
FOAM_DEPRECATED_FOR(2019-01, "good() method")
bool found() const
{
return this->good();
}
inline bool good() const noexcept;
//- Move backward through list
inline void prev();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -99,13 +99,13 @@ Foam::DLListBase::crend() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::DLListBase::link::registered() const
inline bool Foam::DLListBase::link::registered() const noexcept
{
return prev_ != nullptr && next_ != nullptr;
}
inline void Foam::DLListBase::link::deregister()
inline void Foam::DLListBase::link::deregister() noexcept
{
prev_ = next_ = nullptr;
}
@ -252,13 +252,13 @@ inline Foam::DLListBase::iterator::iterator
inline Foam::DLListBase::link*
Foam::DLListBase::iterator::get_node() const
Foam::DLListBase::iterator::get_node() const noexcept
{
return node_;
}
inline bool Foam::DLListBase::iterator::good() const
inline bool Foam::DLListBase::iterator::good() const noexcept
{
return (node_ != nullptr);
}
@ -358,13 +358,13 @@ inline Foam::DLListBase::const_iterator::const_iterator
inline const Foam::DLListBase::link*
Foam::DLListBase::const_iterator::get_node() const
Foam::DLListBase::const_iterator::get_node() const noexcept
{
return node_;
}
inline bool Foam::DLListBase::const_iterator::good() const
inline bool Foam::DLListBase::const_iterator::good() const noexcept
{
return (node_ != nullptr);
}

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -196,13 +196,13 @@ inline Foam::SLListBase::iterator::iterator
inline Foam::SLListBase::link*
Foam::SLListBase::iterator::get_node() const
Foam::SLListBase::iterator::get_node() const noexcept
{
return node_;
}
inline bool Foam::SLListBase::iterator::good() const
inline bool Foam::SLListBase::iterator::good() const noexcept
{
return (node_ != nullptr);
}
@ -295,13 +295,13 @@ inline Foam::SLListBase::const_iterator::const_iterator
inline const Foam::SLListBase::link*
Foam::SLListBase::const_iterator::get_node() const
Foam::SLListBase::const_iterator::get_node() const noexcept
{
return node_;
}
inline bool Foam::SLListBase::const_iterator::good() const
inline bool Foam::SLListBase::const_iterator::good() const noexcept
{
return (node_ != nullptr);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ namespace Foam
const fileName::Type pathType = Foam::type(otherName, false);
if (pathType == fileName::FILE || pathType == fileName::LINK)
if (pathType == fileName::FILE || pathType == fileName::SYMLINK)
{
Foam::rm(otherName);
}
@ -60,7 +60,7 @@ namespace Foam
// Disallow writing into symlinked files.
// Eg, avoid problems with symlinked initial fields
if (!append && Foam::type(targetName, false) == fileName::LINK)
if (!append && Foam::type(targetName, false) == fileName::SYMLINK)
{
Foam::rm(targetName);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,8 +40,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef UPstream_H
#define UPstream_H
#ifndef Foam_UPstream_H
#define Foam_UPstream_H
#include "labelList.H"
#include "DynamicList.H"
@ -645,8 +645,10 @@ public:
// Gather single, contiguous value(s)
//- Individual values into list locations.
// On master list length == nProcs, otherwise zero length
//- Gather individual values into list locations.
// On master list length == nProcs, otherwise zero length.
// If called in non-parallel mode,
// the returned list length is 1 with localValue.
template<class T>
static List<T> listGatherValues
(
@ -654,8 +656,10 @@ public:
const label communicator = worldComm
);
//- Individual values into list locations.
// On master list length == nProcs, otherwise zero length
//- Scatter individual values from list locations.
// On master input list length == nProcs, ignored on other procs.
// If called in non-parallel mode,
// returns the first list element (or zero).
template<class T>
static T listScatterValues
(

View File

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

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef base64Layer_H
#define base64Layer_H
#ifndef Foam_base64Layer_H
#define Foam_base64Layer_H
#include <iostream>
@ -72,16 +72,10 @@ class base64Layer
// Private Member Functions
inline unsigned char encode0() const;
inline unsigned char encode1() const;
inline unsigned char encode2() const;
inline unsigned char encode3() const;
//- No copy construct
base64Layer(const base64Layer&) = delete;
//- No copy assignment
void operator=(const base64Layer&) = delete;
inline unsigned char encode0() const noexcept;
inline unsigned char encode1() const noexcept;
inline unsigned char encode2() const noexcept;
inline unsigned char encode3() const noexcept;
protected:
@ -91,6 +85,12 @@ protected:
//- Add a character to the group, outputting when the group is full.
void add(char c);
//- No copy construct
base64Layer(const base64Layer&) = delete;
//- No copy assignment
void operator=(const base64Layer&) = delete;
public:

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1284,12 +1284,13 @@ Foam::Time& Foam::Time::operator++()
// Adjust the precision of the time directory name if necessary
if (writeTime_)
{
// User-time equivalent of deltaT
const scalar userDeltaT =
timeToUserTime(value()) - timeToUserTime(value() - deltaT_);
// Tolerance used when testing time equivalence
const scalar timeTol =
max(min(pow(10.0, -precision_), 0.1*deltaT_), SMALL);
// User-time equivalent of deltaT
const scalar userDeltaT = timeToUserTime(deltaT_);
max(min(pow(scalar(10), -precision_), 0.1*userDeltaT), SMALL);
// Time value obtained by reading timeName
scalar timeNameValue = -VGREAT;

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +36,7 @@ namespace
// Walk lists of patterns and regexps for an exact match
// or a regular expression match
template<class WcIterator, class ReIterator>
static bool findInPatterns
bool findInPatterns
(
const bool patternMatch,
const Foam::word& keyword,
@ -680,8 +680,8 @@ bool Foam::dictionary::changeKeyword
if (newKeyword.isPattern())
{
patterns_.insert(iter());
regexps_.insert(autoPtr<regExp>::New(newKeyword));
patterns_.prepend(iter());
regexps_.prepend(autoPtr<regExp>::New(newKeyword));
}
return true;

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +36,7 @@ Description
#include "fieldExprLemonParser.h"
#include "fieldExprParser.H"
#include "Enum.H"
#include "macros.H"
//#include "macros.H"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wunused-const-variable"
@ -163,7 +163,7 @@ static int driverTokenType
#define EMIT_TOKEN(T) \
driver_.parsePosition() = (ts-buf); \
DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \
DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \
parser_->parse(TOKEN_OF(T)); \
driver_.parsePosition() = (p-buf);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,7 +34,7 @@ Description
#include "fieldExprLemonParser.h"
#include "fieldExprParser.H"
#include "Enum.H"
#include "macros.H"
//#include "macros.H"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wunused-const-variable"
@ -161,7 +161,7 @@ static int driverTokenType
#define EMIT_TOKEN(T) \
driver_.parsePosition() = (ts-buf); \
DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \
DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \
parser_->parse(TOKEN_OF(T)); \
driver_.parsePosition() = (p-buf);

View File

@ -29,8 +29,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef fieldTypes_H
#define fieldTypes_H
#ifndef Foam_fieldTypes_H
#define Foam_fieldTypes_H
#include "label.H"
#include "scalar.H"
@ -40,9 +40,11 @@ Description
#include "tensor.H"
#include "triad.H"
#include "macros.H"
#include "wordList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define CAPITALIZE_label Label
#define CAPITALIZE_scalar Scalar
#define CAPITALIZE_vector Vector
#define CAPITALIZE_sphericalTensor SphericalTensor

View File

@ -41,8 +41,6 @@ SourceFiles
#include "pointPatchFields.H"
#include "pointFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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