Compare commits

...

61 Commits

Author SHA1 Message Date
0503f66c90 DOC: splitMeshRegions: additional comment. See #2251 2022-02-17 11:46:50 +00:00
25ff1d7d6f ENH: splitMeshRegions: support automatic patching. Fixes #2251 2022-02-17 11:44:49 +00:00
eb2b9b2823 ENH: createPatch: sample dictionary. See #1361. 2022-02-17 10:34:13 +00:00
d5644058b2 ENH: checkMesh: output AMI weights on mapped. Fixes #2356.
Also output target weights
2022-02-17 09:31:20 +00:00
504f5a8a14 BUG: decomposeParDict: operate with masterUncollated. Fixes #2368. 2022-02-16 09:59:03 +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
625 changed files with 8281 additions and 5922 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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; Info<< "\nEnd\n" << endl;
return 0; return 0;

View File

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

View File

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

View File

@ -191,11 +191,11 @@ int main(int argc, char *argv[])
const scalar scaleFactor = args.getOrDefault<scalar>("scale", 1); const scalar scaleFactor = args.getOrDefault<scalar>("scale", 1);
// Default to binary output, unless otherwise specified // Default to binary output, unless otherwise specified
const IOstream::streamFormat format = const IOstreamOption::streamFormat format =
( (
args.found("ascii") args.found("ascii")
? IOstream::ASCII ? IOstreamOption::ASCII
: IOstream::BINARY : IOstreamOption::BINARY
); );
// Increase the precision of the points data // Increase the precision of the points data

View File

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

View File

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

View File

@ -11,10 +11,11 @@
#include "checkTools.H" #include "checkTools.H"
#include "functionObject.H" #include "functionObject.H"
#include "vtkSetWriter.H"
#include "vtkSurfaceWriter.H" #include "vtkSurfaceWriter.H"
#include "writer.H"
#include "cyclicACMIPolyPatch.H" #include "cyclicACMIPolyPatch.H"
#include "mappedPatchBase.H"
#include "Time.H" #include "Time.H"
// Find wedge with opposite orientation. Note: does not actually check that // 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 Foam::label Foam::checkGeometry
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -976,59 +1031,30 @@ Foam::label Foam::checkGeometry
<< cpp.name() << " and neighbour patch: " << cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl; << cpp.neighbPatch().name() << endl;
const AMIPatchToPatchInterpolation& ami = const word pName("patch" + Foam::name(cpp.index()));
cpp.AMI(); const AMIPatchToPatchInterpolation& ami = cpp.AMI();
{ {
// Collect geometry // Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces; faceList mergedFaces;
pointField mergedPoints; pointField mergedPoints;
Foam::PatchTools::gatherAndMerge autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
( (
mesh, mesh,
wr,
outputDir / pName + "-src_" + tmName,
ami.srcWeightsSum(),
cpp.localFaces(), cpp.localFaces(),
cpp.meshPoints(), cpp.meshPoints(),
cpp.meshPointMap(), cpp.meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces, 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])) if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
{ {
@ -1036,25 +1062,15 @@ Foam::label Foam::checkGeometry
refCast<const cyclicACMIPolyPatch>(pbm[patchi]); refCast<const cyclicACMIPolyPatch>(pbm[patchi]);
scalarField mergedMask; scalarField mergedMask;
globalFaces().gather globalFaces().gather(pp.mask(), mergedMask);
(
pp.mask(),
mergedMask
);
if (Pstream::master()) if (Pstream::master())
{ {
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-src_" + tmName
);
wr.open wr.open
( (
mergedPoints, mergedPoints,
mergedFaces, mergedFaces,
(outputDir / fName), (outputDir / pName + "-src_" + tmName),
false // serial - already merged false // serial - already merged
); );
@ -1065,54 +1081,25 @@ Foam::label Foam::checkGeometry
} }
{ {
// Collect geometry // Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces; faceList mergedFaces;
pointField mergedPoints; pointField mergedPoints;
Foam::PatchTools::gatherAndMerge autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
( (
mesh, mesh,
wr,
outputDir / pName + "-tgt_" + tmName,
ami.tgtWeightsSum(),
cpp.neighbPatch().localFaces(), cpp.neighbPatch().localFaces(),
cpp.neighbPatch().meshPoints(), cpp.neighbPatch().meshPoints(),
cpp.neighbPatch().meshPointMap(), cpp.neighbPatch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces, 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])) if (isA<cyclicACMIPolyPatch>(pbm[patchi]))
{ {
@ -1127,17 +1114,11 @@ Foam::label Foam::checkGeometry
if (Pstream::master()) if (Pstream::master())
{ {
const word fName
(
"patch" + Foam::name(cpp.index())
+ "-tgt_" + tmName
);
wr.open wr.open
( (
mergedPoints, mergedPoints,
mergedFaces, mergedFaces,
(outputDir / fName), (outputDir / pName + "-tgt_" + tmName),
false // serial - already merged false // serial - already merged
); );
@ -1148,6 +1129,63 @@ 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
);
if (cpp.sameWorld())
{
//- Get the patch on the region
const polyPatch& nbrPp = cpp.samplePolyPatch();
// Collect neighbour geometry
faceList mergedFaces;
pointField mergedPoints;
autoPtr<globalIndex> globalFaces;
autoPtr<globalIndex> globalPoints;
collectAndWriteAMIWeights
(
cpp.sampleMesh(),
wr,
outputDir / pName + "-tgt_" + tmName,
ami.tgtWeightsSum(),
nbrPp.localFaces(),
nbrPp.meshPoints(),
nbrPp.meshPointMap(),
mergedFaces,
mergedPoints,
globalFaces,
globalPoints
);
}
}
} }
} }

View File

@ -1,12 +1,13 @@
#include "label.H" #include "label.H"
#include "HashSet.H" #include "HashSet.H"
#include "labelVector.H" #include "labelVector.H"
#include "writer.H"
namespace Foam namespace Foam
{ {
// Forward Declarations
class polyMesh; class polyMesh;
class wedgePolyPatch; class wedgePolyPatch;
template<class T> class writer;
class surfaceWriter; class surfaceWriter;
label findOppositeWedge(const polyMesh&, const wedgePolyPatch&); label findOppositeWedge(const polyMesh&, const wedgePolyPatch&);
@ -23,6 +24,24 @@ namespace Foam
//- Check 0th vertex on coupled faces //- Check 0th vertex on coupled faces
bool checkCoupledPoints(const polyMesh&, const bool report, labelHashSet*); 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 label checkGeometry
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,8 +43,9 @@ Description
- volScalarField with regions as different scalars (-detectOnly) - volScalarField with regions as different scalars (-detectOnly)
or or
- mesh with multiple regions and mapped patches. These patches - mesh with multiple regions and mapped patches. These patches
either cover the whole interface between two region (default) or either cover the whole interface between two region (default),
only part according to faceZones (-useFaceZones) only part according to faceZones (-useFaceZones) or be auto-generated
according to an AMI method (see below)
or or
- mesh with cells put into cellZones (-makeCellZones) - mesh with cells put into cellZones (-makeCellZones)
@ -57,7 +58,7 @@ Description
-combineZones '((zoneA "zoneB.*")(none otherZone)) -combineZones '((zoneA "zoneB.*")(none otherZone))
This can be combined with e.g. 'cellZones' or 'cellZonesOnly'. The This can be combined with e.g. 'cellZones' or 'cellZonesOnly'. The
addZones option supplies the destination region name as first element in addZones option supplies the destination region name as first element in
the list. The combineZones option synthesises the region name e.g. the list. The combineZones option synthesises the region name e.g.
zoneA_zoneB0_zoneB1 zoneA_zoneB0_zoneB1
- cellZonesOnly does not do a walk and uses the cellZones only. Use - cellZonesOnly does not do a walk and uses the cellZones only. Use
@ -98,6 +99,14 @@ Description
- boundaryRegionAddressing : for every patch in this region the - boundaryRegionAddressing : for every patch in this region the
patch in the original mesh (or -1 if added patch) patch in the original mesh (or -1 if added patch)
- auto-generate patches using AMI area-overlap detection. This requires a
patchSet to apply it to and an optional AMIMethod (default is
faceAreaWeightAMI2D).
-autoPatch '("solid*")'
-AMIMethod faceAreaWeightAMI2D
Any mapped patch thus generated should probably use the
nearestPatchFaceAMI sampling method.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
@ -116,6 +125,7 @@ Description
#include "fvMeshTools.H" #include "fvMeshTools.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "processorMeshes.H" #include "processorMeshes.H"
#include "faceAreaWeightAMI2D.H"
using namespace Foam; using namespace Foam;
@ -317,12 +327,115 @@ void addToInterface
} }
labelList getMinBoundaryValue
(
const polyMesh& mesh,
const word& AMIMethod,
const labelList& matchPatchIDs,
const labelList& cellRegion
)
{
// Neighbour cellRegion.
labelList coupledRegion(mesh.nBoundaryFaces());
forAll(coupledRegion, i)
{
label celli = mesh.faceOwner()[i+mesh.nInternalFaces()];
coupledRegion[i] = cellRegion[celli];
}
syncTools::swapBoundaryFaceList(mesh, coupledRegion);
// Add approximate matches
forAll(matchPatchIDs, i)
{
const label patchi = matchPatchIDs[i];
const auto& pp = mesh.boundaryMesh()[patchi];
for (label j = i+1; j < matchPatchIDs.size(); ++j)
{
const label nbrPatchi = matchPatchIDs[j];
const auto& nbrPp = mesh.boundaryMesh()[nbrPatchi];
// Use AMI to try and find matches
auto AMPtr(AMIInterpolation::New(AMIMethod));
AMPtr->calculate(pp, nbrPp, nullptr);
if
(
gAverage(AMPtr->tgtWeightsSum()) > SMALL
|| gAverage(AMPtr->srcWeightsSum()) > SMALL
)
{
// Pull remote data local
labelList thisDecomp(pp.size(), labelMax);
AMPtr->interpolateToSource
(
labelList(cellRegion, nbrPp.faceCells()),
[]
(
label& res,
const label facei,
const label& fld,
const scalar& w
)
{
res = min(res, fld);
},
thisDecomp,
thisDecomp // used in case of low-weight-corr
);
// Put thisDecomp into coupledRegion. Check for unmatched faces.
forAll(thisDecomp, i)
{
if (thisDecomp[i] != labelMax)
{
coupledRegion[pp.offset()+i] = thisDecomp[i];
}
}
labelList nbrDecomp(nbrPp.size(), labelMax);
AMPtr->interpolateToTarget
(
labelList(cellRegion, pp.faceCells()), //thisDecomp,
[]
(
label& res,
const label facei,
const label& fld,
const scalar& w
)
{
res = min(res, fld);
},
nbrDecomp,
nbrDecomp // used in case of low-weight-corr
);
// Put nbrDecomp into coupledRegion. Check for unmatched faces/
forAll(nbrDecomp, i)
{
if (nbrDecomp[i] != labelMax)
{
coupledRegion[nbrPp.offset()+i] = nbrDecomp[i];
}
}
}
}
}
return coupledRegion;
}
// Get region-region interface name and sizes. // Get region-region interface name and sizes.
// Returns interfaces as straight list for looping in identical order. // Returns interfaces as straight list for looping in identical order.
void getInterfaceSizes void getInterfaceSizes
( (
const polyMesh& mesh, const polyMesh& mesh,
const bool useFaceZones, const bool useFaceZones,
const word& AMIMethod,
const labelList& matchPatchIDs,
const labelList& cellRegion, const labelList& cellRegion,
const wordList& regionNames, const wordList& regionNames,
@ -361,15 +474,16 @@ void getInterfaceSizes
// Boundary faces // Boundary faces
// ~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~
// Neighbour cellRegion. const labelList coupledRegion
labelList coupledRegion(mesh.nBoundaryFaces()); (
getMinBoundaryValue
forAll(coupledRegion, i) (
{ mesh,
label celli = mesh.faceOwner()[i+mesh.nInternalFaces()]; AMIMethod,
coupledRegion[i] = cellRegion[celli]; matchPatchIDs,
} cellRegion
syncTools::swapBoundaryFaceList(mesh, coupledRegion); )
);
forAll(coupledRegion, i) forAll(coupledRegion, i)
{ {
@ -583,6 +697,8 @@ autoPtr<mapPolyMesh> createRegionMesh
const labelList& cellRegion, const labelList& cellRegion,
const label regionI, const label regionI,
const word& regionName, const word& regionName,
const word& AMIMethod,
const labelList& matchPatchIDs,
// Interface info // Interface info
const labelList& interfacePatches, const labelList& interfacePatches,
const labelList& faceToInterface, const labelList& faceToInterface,
@ -594,15 +710,16 @@ autoPtr<mapPolyMesh> createRegionMesh
fvMeshTools::createDummyFvMeshFiles(mesh, regionName, true); fvMeshTools::createDummyFvMeshFiles(mesh, regionName, true);
// Neighbour cellRegion. // Neighbour cellRegion.
labelList coupledRegion(mesh.nBoundaryFaces()); const labelList coupledRegion
(
forAll(coupledRegion, i) getMinBoundaryValue
{ (
label celli = mesh.faceOwner()[i+mesh.nInternalFaces()]; mesh,
coupledRegion[i] = cellRegion[celli]; AMIMethod,
} matchPatchIDs,
syncTools::swapBoundaryFaceList(mesh, coupledRegion); cellRegion
)
);
// Topology change container. Start off from existing mesh. // Topology change container. Start off from existing mesh.
polyTopoChange meshMod(mesh); polyTopoChange meshMod(mesh);
@ -621,20 +738,16 @@ autoPtr<mapPolyMesh> createRegionMesh
labelList exposedPatchIDs(exposedFaces.size()); labelList exposedPatchIDs(exposedFaces.size());
forAll(exposedFaces, i) forAll(exposedFaces, i)
{ {
label facei = exposedFaces[i]; const label facei = exposedFaces[i];
label interfacei = faceToInterface[facei]; const label interfacei = faceToInterface[facei];
label ownRegion = cellRegion[mesh.faceOwner()[facei]]; const label ownRegion = cellRegion[mesh.faceOwner()[facei]];
label neiRegion = -1; const label neiRegion
(
if (mesh.isInternalFace(facei)) mesh.isInternalFace(facei)
{ ? cellRegion[mesh.faceNeighbour()[facei]]
neiRegion = cellRegion[mesh.faceNeighbour()[facei]]; : coupledRegion[facei-mesh.nInternalFaces()]
} );
else
{
neiRegion = coupledRegion[facei-mesh.nInternalFaces()];
}
// Check which side is being kept - determines which of the two // Check which side is being kept - determines which of the two
@ -681,6 +794,62 @@ autoPtr<mapPolyMesh> createRegionMesh
meshMod meshMod
); );
// Do re-patching on non-removed cells ourselves. These are not exposed
// faces but are boundary faces
for (label bFacei = 0; bFacei < mesh.nBoundaryFaces(); bFacei++)
{
const label facei = mesh.nInternalFaces()+bFacei;
if (!meshMod.faceRemoved(facei))
{
const label interfacei = faceToInterface[facei];
const label ownRegion = cellRegion[mesh.faceOwner()[facei]];
const label neiRegion = coupledRegion[bFacei];
label exposedPatchID = -1;
if (ownRegion == regionI)
{
if (regionI < neiRegion)
{
exposedPatchID = interfacePatches[interfacei];
}
else if (regionI > neiRegion)
{
exposedPatchID = interfacePatches[interfacei]+1;
}
}
else if (neiRegion == regionI)
{
if (regionI < ownRegion)
{
exposedPatchID = interfacePatches[interfacei];
}
else if (regionI > ownRegion)
{
exposedPatchID = interfacePatches[interfacei]+1;
}
}
if (exposedPatchID != -1)
{
// In-place modify the patch
DynamicList<label>& patchID =
const_cast<DynamicList<label>&>(meshMod.region());
//Pout<< "For face:" << facei
// << " on interface:" << interfacei
// << " modifying from own:" << meshMod.faceOwner()[facei]
// << " nei:" << meshMod.faceNeighbour()[facei]
// << " verts:" << meshMod.faces()[facei]
// << " patch " << patchID[facei]
// << " to " << exposedPatchID << endl;
patchID[facei] = exposedPatchID;
}
}
}
autoPtr<mapPolyMesh> map = meshMod.makeMesh autoPtr<mapPolyMesh> map = meshMod.makeMesh
( (
newMesh, newMesh,
@ -705,6 +874,8 @@ void createAndWriteRegion
const labelList& cellRegion, const labelList& cellRegion,
const wordList& regionNames, const wordList& regionNames,
const bool prefixRegion, const bool prefixRegion,
const word& AMIMethod,
const labelList& matchPatchIDs,
const labelList& faceToInterface, const labelList& faceToInterface,
const labelList& interfacePatches, const labelList& interfacePatches,
const label regionI, const label regionI,
@ -721,6 +892,8 @@ void createAndWriteRegion
cellRegion, cellRegion,
regionI, regionI,
regionNames[regionI], regionNames[regionI],
AMIMethod,
matchPatchIDs,
interfacePatches, interfacePatches,
faceToInterface, faceToInterface,
newMesh newMesh
@ -1019,6 +1192,7 @@ labelList addRegionPatches
const wordList& regionNames, const wordList& regionNames,
const edgeList& interfaces, const edgeList& interfaces,
const List<Pair<word>>& interfaceNames const List<Pair<word>>& interfaceNames
//const List<mappedPatchBase::sampleMode>& interfaceModes
) )
{ {
Info<< nl << "Adding patches" << nl << endl; Info<< nl << "Adding patches" << nl << endl;
@ -1042,7 +1216,7 @@ labelList addRegionPatches
0, // overridden 0, // overridden
0, // overridden 0, // overridden
regionNames[e[1]], // sampleRegion regionNames[e[1]], // sampleRegion
mappedPatchBase::NEARESTPATCHFACE, mappedPatchBase::NEARESTPATCHFACE, //interfaceModes[interI]
names[1], // samplePatch names[1], // samplePatch
point::zero, // offset point::zero, // offset
mesh.boundaryMesh() mesh.boundaryMesh()
@ -1064,7 +1238,7 @@ labelList addRegionPatches
0, 0,
0, 0,
regionNames[e[0]], // sampleRegion regionNames[e[0]], // sampleRegion
mappedPatchBase::NEARESTPATCHFACE, mappedPatchBase::NEARESTPATCHFACE, //interfaceModes[interI]
names[0], names[0],
point::zero, // offset point::zero, // offset
mesh.boundaryMesh() mesh.boundaryMesh()
@ -1455,6 +1629,7 @@ int main(int argc, char *argv[])
"Split mesh into multiple regions (detected by walking across faces)" "Split mesh into multiple regions (detected by walking across faces)"
); );
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
argList::addBoolOption argList::addBoolOption
( (
@ -1521,6 +1696,18 @@ int main(int argc, char *argv[])
"useFaceZones", "useFaceZones",
"Use faceZones to patch inter-region faces instead of single patch" "Use faceZones to patch inter-region faces instead of single patch"
); );
argList::addOption
(
"autoPatch",
"lists of patches",
"Find overlapping faces to auto-generate interface patches"
);
argList::addOption
(
"AMIMethod",
"word",
"type of AMI matching method"
);
argList::addBoolOption argList::addBoolOption
( (
"prefixRegion", "prefixRegion",
@ -1533,6 +1720,12 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
// Note: could try to read multiple meshes and merge into one before
// operation but this would give problems with unique prefixes:
// - patches get renamed. So patchFields would need to be renamed.
// - what about e.g. 'samplePatch' in mapped patches?
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
word blockedFacesName; word blockedFacesName;
@ -1556,6 +1749,14 @@ int main(int argc, char *argv[])
const bool useFaceZones = args.found("useFaceZones"); const bool useFaceZones = args.found("useFaceZones");
const bool prefixRegion = args.found("prefixRegion"); const bool prefixRegion = args.found("prefixRegion");
labelList matchPatchIDs;
word AMIMethod(faceAreaWeightAMI2D::typeName);
if (args.found("autoPatch"))
{
const wordRes patchNames(args.getList<wordRe>("autoPatch"));
matchPatchIDs = mesh.boundaryMesh().indices(patchNames);
args.readIfPresent("AMIMethod", AMIMethod);
}
if if
( (
@ -1585,6 +1786,13 @@ int main(int argc, char *argv[])
} }
if (matchPatchIDs.size())
{
Info<< "Auto-detecting matching faces out of patches "
<< UIndirectList<word>(mesh.boundaryMesh().names(), matchPatchIDs)
<< nl << endl;
}
if (insidePoint && largestOnly) if (insidePoint && largestOnly)
{ {
@ -1652,8 +1860,8 @@ int main(int argc, char *argv[])
<< " This requires all" << " This requires all"
<< " cells to be in one and only one cellZone." << nl << endl; << " cells to be in one and only one cellZone." << nl << endl;
// Collect sets of zones into clusters. If no cluster is just an identity // Collect sets of zones into clusters. If no cluster is just an
// list (cluster 0 is cellZone 0 etc.) // identity list (cluster 0 is cellZone 0 etc.)
wordList clusterNames; wordList clusterNames;
labelListList clusterToZones; labelListList clusterToZones;
labelList zoneToCluster; labelList zoneToCluster;
@ -1829,7 +2037,7 @@ int main(int argc, char *argv[])
{ {
label ownCluster = clusterID[mesh.faceOwner()[facei]]; label ownCluster = clusterID[mesh.faceOwner()[facei]];
label neiCluster = clusterID[mesh.faceNeighbour()[facei]]; label neiCluster = clusterID[mesh.faceNeighbour()[facei]];
if (ownCluster != neiCluster) if (ownCluster != neiCluster)
{ {
blockedFace[facei] = true; blockedFace[facei] = true;
@ -1968,6 +2176,8 @@ int main(int argc, char *argv[])
( (
mesh, mesh,
useFaceZones, useFaceZones,
AMIMethod,
matchPatchIDs,
cellRegion, cellRegion,
regionNames, regionNames,
@ -2147,6 +2357,7 @@ int main(int argc, char *argv[])
regionNames, regionNames,
interfaces, interfaces,
interfaceNames interfaceNames
//interfaceModes
) )
); );
@ -2199,6 +2410,8 @@ int main(int argc, char *argv[])
cellRegion, cellRegion,
regionNames, regionNames,
prefixRegion, prefixRegion,
AMIMethod,
matchPatchIDs,
faceToInterface, faceToInterface,
interfacePatches, interfacePatches,
regionI, regionI,
@ -2220,6 +2433,8 @@ int main(int argc, char *argv[])
cellRegion, cellRegion,
regionNames, regionNames,
prefixRegion, prefixRegion,
AMIMethod,
matchPatchIDs,
faceToInterface, faceToInterface,
interfacePatches, interfacePatches,
regionI, regionI,
@ -2241,6 +2456,8 @@ int main(int argc, char *argv[])
cellRegion, cellRegion,
regionNames, regionNames,
prefixRegion, prefixRegion,
AMIMethod,
matchPatchIDs,
faceToInterface, faceToInterface,
interfacePatches, interfacePatches,
regionI, regionI,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,7 +55,7 @@ bool writeVolField
const tmp<GeoField>& tfield const tmp<GeoField>& tfield
) )
{ {
if (!tfield.valid()) if (!tfield)
{ {
return false; return false;
} }
@ -91,7 +91,7 @@ bool writeVolField
const tmp<GeoField>& tfield const tmp<GeoField>& tfield
) )
{ {
if (!tfield.valid()) if (!tfield)
{ {
return false; 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 | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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" "Generate a file of particle tracks for cases that were"
" computed using a tracked-parcel-type cloud" " computed using a tracked-parcel-type cloud"
); );
timeSelector::addOptions(); timeSelector::addOptions();
#include "addRegionOption.H" #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" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #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(); argList::noParallel();
timeSelector::addOptions(); timeSelector::addOptions();
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addDictOption.H" argList::addOption
(
"dict",
"file",
"Alternative particleTrackDict dictionary"
);
argList::addVerboseOption("Additional verbosity");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H" #include "createNamedMesh.H"
#include "createFields.H" #include "createControls.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ Documentation
( (
"$WM_PROJECT_USER_DIR/html" "$WM_PROJECT_USER_DIR/html"
"$WM_PROJECT_DIR/doc/Doxygen/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; isoSurfaceCell 0;
isoSurfacePoint 0; isoSurfacePoint 0;
isoSurfaceTopo 0; isoSurfaceTopo 0;
jplot 0;
jumpCyclic 0; jumpCyclic 0;
kEpsilon 0; kEpsilon 0;
kOmega 0; kOmega 0;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,8 +48,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef DictionaryBase_H #ifndef Foam_DictionaryBase_H
#define DictionaryBase_H #define Foam_DictionaryBase_H
#include "HashTable.H" #include "HashTable.H"
#include "wordList.H" #include "wordList.H"
@ -141,11 +141,11 @@ public:
// Editing // Editing
//- Add at head of dictionary //- Add to front of dictionary
void insert(const word& keyword, T*); void prepend(const word& keyword, T* ptr);
//- Add at tail of dictionary //- Add to back of dictionary
void append(const word& keyword, T*); void append(const word& keyword, T* ptr);
//- Remove and return entry specified by keyword. //- Remove and return entry specified by keyword.
// Return nullptr if the keyword was not found. // Return nullptr if the keyword was not found.
@ -189,7 +189,6 @@ public:
// Housekeeping // Housekeeping
//- Deprecated(2020-03) use cfind() //- Deprecated(2020-03) use cfind()
//
// \deprecated(2020-03) - use cfind() method // \deprecated(2020-03) - use cfind() method
FOAM_DEPRECATED_FOR(2020-03, "cfind() method") FOAM_DEPRECATED_FOR(2020-03, "cfind() method")
const T* lookupPtr(const word& keyword) const const T* lookupPtr(const word& keyword) const
@ -198,13 +197,18 @@ public:
} }
//- Deprecated(2020-03) use find() //- Deprecated(2020-03) use find()
//
// \deprecated(2020-03) - use find() method // \deprecated(2020-03) - use find() method
FOAM_DEPRECATED_FOR(2020-03, "find() method") FOAM_DEPRECATED_FOR(2020-03, "find() method")
T* lookupPtr(const word& keyword) T* lookupPtr(const word& keyword)
{ {
return this->find(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 @@
/*---------------------------------------------------------------------------*\ #warning File removed - left for old dependency check only
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PtrDictionary.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(const label size)
:
DictionaryBase<DLPtrList<T>, T>(size)
{}
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
:
DictionaryBase<DLPtrList<T>, T>(dict)
{}
template<class T>
template<class INew>
Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
:
DictionaryBase<DLPtrList<T>, T>(is, iNew)
{}
template<class T>
Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
:
DictionaryBase<DLPtrList<T>, T>(is)
{}
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ namespace Foam
const fileName::Type pathType = Foam::type(otherName, false); 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); Foam::rm(otherName);
} }
@ -60,7 +60,7 @@ namespace Foam
// Disallow writing into symlinked files. // Disallow writing into symlinked files.
// Eg, avoid problems with symlinked initial fields // 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); Foam::rm(targetName);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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