Compare commits

...

66 Commits

Author SHA1 Message Date
874426562a BUG: incorrect startLineNumber for primitiveEntry (fixes #1706) 2020-05-14 17:18:00 +02:00
e0145b8555 BUG: Pair sort on construct did the opposite (fixes #1701) 2020-05-11 20:26:42 +02:00
9abf648acf CONFIG: provide separate default settings for clang/gcc (fixes #1566)
- the foamConfigurePaths script is quite simplistic and aggressive in
  what it changes. This was particularly evident when using it to
  change gcc/clang versions.

  Restructured the corresponding compiler settings to define default
  versions (eg, "default_gcc_version") that limits the scope of
  changes performed by foamConfigurePaths and makes it easier to
  understand if changing manually.
2020-02-03 11:05:04 +01:00
3fdc623901 CONFIG: bump patch level 2020-01-31 12:10:51 +01:00
3050636576 COMP: avoid -Wstringop-truncation warning 2020-01-31 12:08:31 +01:00
2e11ffc335 COMP: backport of updates for gcc-92 compilation
ENH: add typedefs for interpolation tables
2020-01-28 12:46:27 +01:00
6387af94b3 BUG: incorrect Nastran surface output and segmentation faults #1571
- indexing error in the output of values resulted in uniform output in
  most cases.

- allocation error for on-the-fly triangulation

ENH: changed decomposed storage from DynamicList to plain faceList for
clearer allocation control and better overhead
2020-01-27 11:04:25 +01:00
bdc3d457a7 COMP: silence gcc 8.2 memcpy warnings
- we know they have already protected by an is_contiguous check,
  so the class-memaccess warning/error can be suppressed.
2019-10-28 16:57:47 +01:00
79f96c0af5 CONFIG: adjust known gcc/clang compiler versions 2019-10-28 12:55:15 +01:00
a7fb5e6040 STYLE: use const reference for caught exceptions
BUG: PackedList return value from void method

BUG: non-const access to Reaction name
2019-01-23 09:03:06 +01:00
f24610ed95 CONFIG: reset maintenance version as v1712 2019-08-01 09:00:00 +02:00
8868b8da98 CONFIG: backport of META-INFO information (#1367) 2019-07-10 20:19:01 +02:00
daf4ba3139 BUG: Sf field ignored for sumDirection operation (fixes #1287) 2019-04-16 18:32:07 +02:00
be0f24ab3c COMP: fix conditional for VTK legacy rendering.
- was deprecated for removal with VTK 8.1.0
  definitely removed in VTK 8.2.0
2018-11-08 21:28:26 +01:00
cecdb88113 ENH: export FOAM_API in dictionary (issue #1158)
- uses the value of the OPENFOAM (OPENFOAM_PLUS) compiler define
2019-01-07 19:04:50 +01:00
d761374974 CONFIG: cannot pass additional arguments to foamEtcFile (closes #880)
- add support by using updated foamEtcFile from 1806, which also add
  the '-config' short-cut option.
2018-06-18 08:42:55 +02:00
1f0bc69223 BUG: dictionary lookup of embedded coordinateSystem fails (fixes #879)
- also fix incorrect documentation in forces functionObject and
  interRegionExplicitPorositySource fvOption.
2018-06-16 00:29:41 +02:00
854b5cec1e BUG: rigidBodyMotionState: not readable in binary. Fixes #871. 2018-06-13 14:55:20 +01:00
f7f29259f1 ENH: Updated example usage in header. Fixes #859 2018-06-13 14:11:51 +01:00
528d8a7e11 BUG: fftw: missing normalisation. See #867. 2018-06-13 14:09:37 +01:00
f0806d5d7c BUG: non-uniform distribution for Random::position<label> (closes #865)
- use floor/truncate instead of round. Backport of changes in the
  develop-pre-release branch.
2018-06-13 12:38:13 +02:00
9edc017a1e COMP: Added include file to enable derived code extensions 2018-06-13 10:52:08 +01:00
a9f92d4c90 BUG: decomposeParDict: ignores mesh region. Fixes #848. 2018-05-29 10:26:22 +01:00
5abff4c68e BUG: Corrected ConeNozzleInjection injected posisions in parallel operation. See #840 2018-05-30 14:05:53 +01:00
e00e7f82e0 BUG: Corrected header documentation - see #831 2018-05-29 15:28:44 +01:00
b6956f062a BUG: COxidationIntrinicRate - corrected eta. See #842 2018-05-29 15:10:19 +01:00
e9e4e11474 TUT: Updated input value 2018-05-18 09:57:12 +01:00
2084a43c4d BUG: ConeInjection - corrected number of parcels injected for multiple injector positions 2018-05-17 09:04:00 +01:00
381e96e509 BUG: wrong sizing index for VTK legacy polyhedrals (closes #829) 2018-05-16 15:57:49 +01:00
cdc4b90f76 BUG: compiler-specific INTELMPI not always found (closes #830)
- tie the MPI rules to the base compiler type *without* its version.
  Eg, linux64Gcc (which exists) instead of linux64Gcc81
2018-05-16 12:36:29 +01:00
ea2eb91f8c COMP: incorrect executable path sphereSurfactantFoam (closes #695) 2018-01-08 10:51:00 +01:00
2c76ae206e BUG: regionToCell: incorrect indexing of remote values. Fixes #818. 2018-05-02 10:55:47 +01:00
bcdb61bd45 BUG: wrong nanoseconds in highResLastModified (closes #794)
- was using st_atim instead of st_mtim for the nanoseconds

- value of followLink was being ignored (it was always being followed).
2018-04-11 10:27:41 +02:00
949e4d8cce BUG: mesh refinement crash with degenerate mesh distributions (closes #778)
- occurred when the initial mesh distribution was missing cells on
  some processors.
2018-03-21 21:54:40 +01:00
eb443647b0 BUG: corrected 'binned' distribution model 2018-03-20 10:17:33 +00:00
8322e6308f BUG: IsoAdvector - updated use of pos/neg as reported by Johan Roenby. See #775 2018-03-19 13:56:32 +00:00
209c8ccb64 BUG: Corrections to externalWallHeatFluxTemperature BC (ref EP624) 2018-03-14 15:34:53 +00:00
ec169b1eba BUG: surface proxy zone handling with dangling? reference (closes #757)
- using const reference to temporary was failing.  Remedy by using a
  direct copy, which is a reasonable solution since surfZone content
  is quite minimal.
2018-03-13 17:58:02 +01:00
08bf1c8fc5 ENH: Adding thermo using polynomial transport, JANAF and ideal gas.
This thermo is used with multiComponentMixture in rhoThermo type
2018-04-06 08:46:17 -07:00
726d478656 ENH: DPMFoam - extended RAS model selection. See #743 2018-03-13 12:48:16 +00:00
2a7555b565 TUT: Corrected turbulence Ck value - see #753 2018-03-13 12:32:16 +00:00
9bb236119c BUG: removed incorrect code from cyclicFaPatch referring to cyclicPolyPatch. See #761 2018-03-13 08:54:39 +00:00
1b892e5b32 TUT: Removed misleading comment in tutorial - see #746 2018-03-06 11:12:39 +00:00
19872f73f5 COMP: add -fpermissive to c++LESSWARN flags (closes #744)
- downgrades some diagnostics about nonconformant code from errors to
  warnings. Oddly enough, the errors actually arise from STL library
  elements shipped with gcc itself. Affects kahip compilation with
  gcc-6, gcc-7
2018-02-28 14:31:48 +01:00
418f40bf0a BUG: faceOnlySet sampling does not stop at 'end' (closes #745) 2018-02-28 11:23:59 +01:00
c67624cc75 GIT: merge artifact duplicate call to update mesh moving 2018-02-28 10:59:53 +01:00
34a776954c BUG: isoAdvection using 'vof2IsoTol' instead of 'isoFaceTol' (closes #740) 2018-02-23 15:11:24 +01:00
956014ef1a ENH: lagrangian injection - exposed minimum number of particles per parcel. See #728
The minimum number of particles per parcel can now be set in the
injection model input, e.g.:

    model1
    {
        type            ...;
        massTotal       ...;
        parcelBasisType ...;
        minParticlesPerParcel 1; <-- new optional entry
        SOI             ...;
        ...

Uses a value of 1 by default if the entry is not present.  The value of
1 is generally recommended and beneficial for coupled cases where small
time steps can lead to the injection of too many parcels and subsequently
greatly over-predict the particle source contributions (momentum, heat,
mass transfer etc)
2018-02-23 12:00:14 +00:00
eb7f123baa BUG: simpleCoalParcelFoam - corrected dimensions of Qdot. Fixes #742 2018-02-23 09:04:16 +00:00
1bd7b85581 ENH: Updating the header documentation for fanFvPatchField 2018-01-25 10:04:30 -08:00
0ac75a2015 ENH: Changing fanFvPatchField operation for non-dimensional mode.
The non-dimensional table takes non-dimensional U as entry, not flow rate
2018-01-25 08:46:48 -08:00
7156efc3c9 GIT: corrected incorrect merge artefacts 2018-01-25 11:12:42 +00:00
eb5a9fffb8 BUG: timeControlFunctionObject swallows dictionary modifications (closes #716)
- runTimeModifiable change to the dictionary not being propagated to
  the underlying functionObjects
2018-01-24 20:45:59 +01:00
137bfedc16 BUG: problems converting clouds to ensight or vtk format (closes #708)
- problems when the cloud was not available on all processors.

- NB: ensight measured data only allows a single cloud, but
  foamToEnsight writes all clouds.
2018-01-23 15:39:45 +01:00
d4bd01c489 BUG: noiseModel - added missing read of 'writePSDf' entry 2018-01-19 12:48:59 +00:00
c51cf4ae27 ENH: kOmegaSSTLM improved robustness 2018-01-18 12:09:06 +00:00
710a717c67 ENH: sixDoFRigidBodyState relocated and code improvements. Fixes #711 2018-01-18 09:26:22 +00:00
55182e74ee TUT: Updated Allrun scripts for tests. Fixes #710 2018-01-17 15:30:49 +00:00
218ca2f786 ENH: use main constant/triSurface directory for sampling surfaces (closes #704)
- these were previously taken from region-local directories
  (eg, constant/region/triSurface), but this becomes difficult to
  manage when there are many files and regions.
2018-01-17 14:47:38 +01:00
3fc9267650 BUG: reconstructPar ignores writeLagrangianPositions (fixes #702)
- The central InfoSwitch "writeLagrangianPositions" allows writing an
  additional Lagrangian "positions" file, but these were not being
  written by reconstructPar. These are now also written in reconstructPar
  if the central writeLagrangianPositions InfoSwitch is enabled.

NOTES

- "positions" are reconstructed from the processors "coordinates" file

- decomposePar will not attempt to create or redistribute any
  "positions" files
2018-01-17 13:38:24 +01:00
433288a908 DOC: Documentation updates 2018-01-11 14:32:39 +00:00
91079cddd8 ENH: interIsoFoam - added linkage against wave modelling library 2018-01-11 14:30:26 +00:00
bb52f239d4 COMP: mpi: const_cast because of incorrect mpi.h header. Fixes #697. 2018-01-10 09:10:30 +00:00
40bb7a5f6d SUBMODULE: cfmesh update for 64-bit labels 2018-01-08 14:50:52 +01:00
ecb29bc8f5 ENH: nutUBlended wall function - added protection for uTau. See #696 2018-01-08 10:33:56 +00:00
8e2ac04461 ENH: Updates to the k-omega SST decay control functionality - see #694 2018-01-05 14:15:32 +00:00
297 changed files with 2222 additions and 1676 deletions

9
META-INFO/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# Do not track build information
build-info
# Do not track time-stamp
time-stamp
# Do not track any manifest files
Manifest.txt
manifest.txt

5
META-INFO/README.md Normal file
View File

@ -0,0 +1,5 @@
# META-INFO
Meta-information is for OpenFOAM internal use only.
(Backport from 1812)

2
META-INFO/api-info Normal file
View File

@ -0,0 +1,2 @@
api=1712
patch=200131

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
fft::reverseTransform fft::reverseTransform
( (
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn() K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
) )*recRootN
); );
#include "globalProperties.H" #include "globalProperties.H"

View File

@ -19,3 +19,10 @@
Kmesh K(mesh); Kmesh K(mesh);
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties); UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);
label ntot = 1;
forAll(K.nn(), idim)
{
ntot *= K.nn()[idim];
}
const scalar recRootN = 1.0/Foam::sqrt(scalar(ntot));

View File

@ -1,3 +1,3 @@
surfactantFoam.C surfactantFoam.C
EXE = $(FOAM_USER_APPBIN)/sphereSurfactantFoam EXE = $(FOAM_APPBIN)/sphereSurfactantFoam

View File

@ -70,6 +70,12 @@ makeLaminarModel(Stokes);
#include "kEpsilon.H" #include "kEpsilon.H"
makeRASModel(kEpsilon); makeRASModel(kEpsilon);
#include "realizableKE.H"
makeRASModel(realizableKE);
#include "kOmegaSST.H"
makeRASModel(kOmegaSST);
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky); makeLESModel(Smagorinsky);

View File

@ -114,7 +114,7 @@ volScalarField Qdot
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar("Qdot", dimEnergy/dimTime, 0.0) dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
); );
#include "createMRF.H" #include "createMRF.H"

View File

@ -17,4 +17,5 @@ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lfvOptions \ -lfvOptions \
-lmeshTools \ -lmeshTools \
-lsampling -lsampling \
-lwaveModels

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
_FOAM_API $FOAM_API;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -55,7 +55,7 @@ int main(int argc, char *argv[])
<< "Error 2" << "Error 2"
<< exit(FatalError); << exit(FatalError);
} }
catch (Foam::error& fErr) catch (const Foam::error& fErr)
{ {
Serr<< "Caught Foam error " << fErr << nl << endl; Serr<< "Caught Foam error " << fErr << nl << endl;
} }
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
<< "Error# 3" << "Error# 3"
<< exit(FatalError); << exit(FatalError);
} }
catch (Foam::error& fErr) catch (const Foam::error& fErr)
{ {
Serr<< "Caught Foam error " << fErr << nl << endl; Serr<< "Caught Foam error " << fErr << nl << endl;
} }

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
labelledTri l1{ 1, 2, 3, 10, 24 }; labelledTri l1{ 1, 2, 3, 10, 24 };
Info<< "labelled:" << l1 << nl; Info<< "labelled:" << l1 << nl;
} }
catch (Foam::error& err) catch (const Foam::error& err)
{ {
WarningInFunction WarningInFunction
<< "Caught FatalError " << err << nl << endl; << "Caught FatalError " << err << nl << endl;

View File

@ -601,9 +601,27 @@ int main(int argc, char *argv[])
<< " controlDict => " << findEtcFile("controlDict") << nl << " controlDict => " << findEtcFile("controlDict") << nl
<< " badName => " << findEtcFile("badName") << endl; << " badName => " << findEtcFile("badName") << endl;
Info<< "This should emit a fatal error:" << endl; {
Info<< " badName(die) => " << findEtcFile("badName", true) << nl
<< endl; Info<< nl << "Expect a FatalError for findEtcFile() with a bad name:"
<< nl;
const bool throwingError = FatalError.throwExceptions();
try
{
Info<< " badName(die) => " << flush
<< findEtcFile("<very-badName>", true) << nl
<< endl;
}
catch (const Foam::error& err)
{
Info<< nl << "findEtcFile() Caught FatalError "
<< err << nl << endl;
}
FatalError.throwExceptions(throwingError);
}
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;
return 0; return 0;

View File

@ -75,7 +75,7 @@ unsigned testParsing
{ {
val = function (str); val = function (str);
} }
catch (Foam::error& err) catch (const Foam::error& err)
{ {
parsed = false; parsed = false;
errMsg = err.message(); errMsg = err.message();

View File

@ -141,6 +141,13 @@ public:
typedef indexedVertex<Gt,Vb2> Other; typedef indexedVertex<Gt,Vb2> Other;
}; };
// Generated Methods
//- Copy construct
indexedVertex(const indexedVertex&) = default;
// Constructors // Constructors
inline indexedVertex(); inline indexedVertex();

View File

@ -543,7 +543,7 @@ bool doCommand
} }
} }
} }
catch (Foam::IOerror& fIOErr) catch (const Foam::IOerror& fIOErr)
{ {
ok = false; ok = false;
@ -554,7 +554,7 @@ bool doCommand
Pout<< topoSetSource::usage(sourceType).c_str(); Pout<< topoSetSource::usage(sourceType).c_str();
} }
} }
catch (Foam::error& fErr) catch (const Foam::error& fErr)
{ {
ok = false; ok = false;

View File

@ -57,11 +57,23 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
word utilityName = argv[1]; word utilityName(argv[1]);
Foam::autoPtr<Foam::helpType> utility autoPtr<helpType> utility;
(
helpType::New(utilityName) const bool throwing = FatalError.throwExceptions();
); try
{
utility.reset(helpType::New(utilityName).ptr());
}
catch (const Foam::error& err)
{
utility.clear();
FatalError
<< err.message().c_str() << nl
<< exit(FatalError);
}
FatalError.throwExceptions(throwing);
utility().init(); utility().init();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -74,7 +74,7 @@ bool writeCloudField
template<class Type> template<class Type>
bool writeCloudField bool writeCloudField
( (
const IOobject& fieldObject, IOobject& fieldObject,
const bool exists, const bool exists,
autoPtr<ensightFile>& output autoPtr<ensightFile>& output
); );

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,8 +36,8 @@ License
template<class Type> template<class Type>
bool Foam::ensightCloud::writeCloudField bool Foam::ensightCloud::writeCloudField
( (
const Foam::IOField<Type>& field, const IOField<Type>& field,
Foam::ensightFile& os ensightFile& os
) )
{ {
const bool exists = (returnReduce(field.size(), sumOp<label>()) > 0); const bool exists = (returnReduce(field.size(), sumOp<label>()) > 0);
@ -125,14 +125,23 @@ bool Foam::ensightCloud::writeCloudField
template<class Type> template<class Type>
bool Foam::ensightCloud::writeCloudField bool Foam::ensightCloud::writeCloudField
( (
const Foam::IOobject& fieldObject, IOobject& fieldObject,
const bool exists, const bool exists,
Foam::autoPtr<Foam::ensightFile>& output autoPtr<ensightFile>& output
) )
{ {
if (exists) if (exists)
{ {
// when exists == true, it exists globally,
// but can still be missing on the local processor.
// Handle this by READ_IF_PRESENT instead.
const IOobject::readOption rOpt = fieldObject.readOpt();
fieldObject.readOpt() = IOobject::READ_IF_PRESENT;
IOField<Type> field(fieldObject); IOField<Type> field(fieldObject);
fieldObject.readOpt() = rOpt;
writeCloudField(field, output.rawRef()); writeCloudField(field, output.rawRef());
} }

View File

@ -7,7 +7,7 @@ HashTable<HashTable<word>> cloudFields;
if (timeDirs.size() && !noLagrangian) if (timeDirs.size() && !noLagrangian)
{ {
const fileName& baseDir = mesh.time().path(); const fileName& baseDir = mesh.time().path();
const fileName& cloudPrefix = regionPrefix/cloud::prefix; const fileName cloudPrefix(regionPrefix/cloud::prefix);
Info<< "Searching for lagrangian ... " << flush; Info<< "Searching for lagrangian ... " << flush;
@ -35,11 +35,12 @@ if (timeDirs.size() && !noLagrangian)
cloudPrefix/cloudName cloudPrefix/cloudName
); );
// Clouds always have "positions" (v1706 and lower) or "coordinates" // Clouds require "coordinates".
if (cloudObjs.found("positions") || cloudObjs.found("coordinates")) // The "positions" are for v1706 and lower.
if (cloudObjs.found("coordinates") || cloudObjs.found("positions"))
{ {
// Save the cloud fields on a per cloud basis // Save the cloud fields on a per cloud basis
auto fieldsPerCloud = cloudFields(cloudName); auto& fieldsPerCloud = cloudFields(cloudName);
forAllConstIters(cloudObjs, fieldIter) forAllConstIters(cloudObjs, fieldIter)
{ {
@ -59,6 +60,12 @@ if (timeDirs.size() && !noLagrangian)
cloudIter().erase("positions"); cloudIter().erase("positions");
} }
if (Pstream::parRun())
{
Pstream::mapCombineGather(cloudFields, HashTablePlusEqOp<word>());
Pstream::mapCombineScatter(cloudFields);
}
if (cloudFields.empty()) if (cloudFields.empty())
{ {
Info<< "none detected." << endl; Info<< "none detected." << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -72,6 +72,8 @@ Note
#include "IOobjectList.H" #include "IOobjectList.H"
#include "IOmanip.H" #include "IOmanip.H"
#include "OFstream.H" #include "OFstream.H"
#include "PstreamCombineReduceOps.H"
#include "HashTableOps.H"
#include "fvc.H" #include "fvc.H"
#include "volFields.H" #include "volFields.H"
@ -622,8 +624,13 @@ int main(int argc, char *argv[])
Info<< "Write " << cloudName << " ("; Info<< "Write " << cloudName << " (";
bool cloudExists = currentCloudDirs.found(cloudName); const bool cloudExists =
reduce(cloudExists, orOp<bool>()); returnReduce
(
currentCloudDirs.found(cloudName),
orOp<bool>()
);
{ {
autoPtr<ensightFile> os = ensCase.newCloud(cloudName); autoPtr<ensightFile> os = ensCase.newCloud(cloudName);
@ -643,10 +650,10 @@ int main(int argc, char *argv[])
} }
} }
forAllConstIter(HashTable<word>, theseCloudFields, fieldIter) forAllConstIters(theseCloudFields, fieldIter)
{ {
const word& fieldName = fieldIter.key(); const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter(); const word& fieldType = fieldIter.object();
IOobject fieldObject IOobject fieldObject
( (
@ -657,10 +664,13 @@ int main(int argc, char *argv[])
IOobject::MUST_READ IOobject::MUST_READ
); );
// cannot have field without cloud positions bool fieldExists = cloudExists; // No field without positions
bool fieldExists = cloudExists;
if (cloudExists) if (cloudExists)
{ {
// Want MUST_READ (globally) and valid=false (locally),
// but that combination does not work.
// So check the header and sync globally
fieldExists = fieldExists =
fieldObject.typeHeaderOk<IOField<scalar>>(false); fieldObject.typeHeaderOk<IOField<scalar>>(false);

View File

@ -8,8 +8,8 @@ HashTable<HashTable<word>> cloudFields;
if (timeDirs.size()) if (timeDirs.size())
{ {
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
const word& lastTimeName = timeDirs.last().name(); const word& lastTimeName = timeDirs.last().name();
const fileName cloudPrefix(regionPrefix/cloud::prefix);
IOobjectList objs(mesh, lastTimeName); IOobjectList objs(mesh, lastTimeName);
@ -28,7 +28,7 @@ if (timeDirs.size())
// //
// now check for lagrangian/<cloudName> // Now check for lagrangian/<cloudName>
// //
fileNameList cloudDirs; fileNameList cloudDirs;
if (!noLagrangian) if (!noLagrangian)
@ -46,48 +46,45 @@ if (timeDirs.size())
{ {
const word& cloudName = cloudDirs[cloudI]; const word& cloudName = cloudDirs[cloudI];
// Create a new hash table for each cloud IOobjectList cloudObjs
cloudFields.insert(cloudName, HashTable<word>());
// Identify the new cloud within the hash table
HashTable<HashTable<word>>::iterator cloudIter =
cloudFields.find(cloudName);
IOobjectList objs
( (
mesh, mesh,
lastTimeName, lastTimeName,
cloudPrefix/cloudName cloudPrefix/cloudName
); );
bool hasCoordinates = false; // Clouds require "coordinates".
forAllConstIter(IOobjectList, objs, fieldIter) // The "positions" are for v1706 and lower.
if (cloudObjs.found("coordinates") || cloudObjs.found("positions"))
{ {
const IOobject obj = *fieldIter(); // Save the cloud fields on a per cloud basis
const word& fieldName = obj.name(); auto& fieldsPerCloud = cloudFields(cloudName);
const word& fieldType = obj.headerClassName();
if (fieldName == "positions" || fieldName == "coordinates") forAllConstIters(cloudObjs, fieldIter)
{ {
hasCoordinates = true; const IOobject* obj = fieldIter();
}
else if (cloudFieldTypes.found(fieldType))
{
// simply ignore types that we don't handle
cloudIter().insert(fieldName, fieldType);
}
}
// drop this cloud if it has no positions or is otherwise empty const word& fieldName = obj->name();
if (!hasCoordinates || cloudIter().empty()) const word& fieldType = obj->headerClassName();
{
Info<< "removing cloud " << cloudName << endl; if (cloudFieldTypes.found(fieldType))
cloudFields.erase(cloudIter); {
// Field name/type - ignore types that we don't handle
fieldsPerCloud.insert(fieldName, fieldType);
}
}
} }
} }
// Only retain a cloud that actually has fields
cloudFields.filterValues
(
[](const HashTable<word>& v){ return v.size(); }
);
// //
// verify that the variable is present for all times // Verify that the variable is present for all times
// //
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i) for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
{ {
@ -114,3 +111,6 @@ if (timeDirs.size())
volumeFields.erase(missing); volumeFields.erase(missing);
} }
} }
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -275,10 +275,10 @@ int main(int argc, char *argv[])
Info<< "Write volume field (" << flush; Info<< "Write volume field (" << flush;
forAllConstIter(HashTable<word>, volumeFields, fieldIter) forAllConstIters(volumeFields, fieldIter)
{ {
const word& fieldName = fieldIter.key(); const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter(); const word& fieldType = fieldIter.object();
IOobject fieldObject IOobject fieldObject
( (
@ -364,10 +364,12 @@ int main(int argc, char *argv[])
Info<< " )" << endl; Info<< " )" << endl;
// Check for clouds // Check for clouds
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter) forAllConstIters(cloudFields, cloudIter)
{ {
const word& cloudName = cloudIter.key(); const word& cloudName = cloudIter.key();
const fileName& cloudPrefix = regionPrefix/cloud::prefix; const HashTable<word>& theseCloudFields = cloudIter.object();
const fileName cloudPrefix(regionPrefix/cloud::prefix);
if (!isDir(runTime.timePath()/cloudPrefix/cloudName)) if (!isDir(runTime.timePath()/cloudPrefix/cloudName))
{ {
@ -381,13 +383,15 @@ int main(int argc, char *argv[])
cloudPrefix/cloudName cloudPrefix/cloudName
); );
// Check that the positions/coordinates field is present for this // Clouds require "coordinates".
// time // The "positions" are for v1706 and lower.
if const bool cloudExists =
( (
!cloudObjs.found("positions") cloudObjs.found("coordinates")
|| !cloudObjs.found("coordinates") || cloudObjs.found("positions")
) );
if (!cloudExists)
{ {
continue; continue;
} }
@ -403,18 +407,17 @@ int main(int argc, char *argv[])
Info<< " positions"; Info<< " positions";
forAllConstIter(HashTable<word>, cloudIter(), fieldIter) forAllConstIters(theseCloudFields, fieldIter)
{ {
const word& fieldName = fieldIter.key(); const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter(); const word& fieldType = fieldIter.object();
IOobject *fieldObject = cloudObjs.lookup(fieldName); IOobject *fieldObject = cloudObjs.lookup(fieldName);
if (!fieldObject) if (!fieldObject)
{ {
Info<< "missing " Info<< "missing "
<< runTime.timeName()/cloudPrefix/cloudName << runTime.timeName()/cloudPrefix/cloudName/fieldName
/ fieldName
<< endl; << endl;
continue; continue;
} }

View File

@ -1,12 +1,12 @@
// check all time directories for the following: // check all time directories for the following:
// Any cloud names: // Any cloud names:
HashSet<fileName> allCloudDirs; HashSet<word> allCloudDirs;
if (timeDirs.size() && !noLagrangian) if (timeDirs.size() && !noLagrangian)
{ {
const fileName& baseDir = mesh.time().path(); const fileName& baseDir = mesh.time().path();
const fileName& cloudPrefix = regionPrefix/cloud::prefix; const fileName cloudPrefix(regionPrefix/cloud::prefix);
Info<< "Searching for lagrangian ... " << flush; Info<< "Searching for lagrangian ... " << flush;
@ -32,14 +32,15 @@ if (timeDirs.size() && !noLagrangian)
cloudPrefix/cloudName cloudPrefix/cloudName
); );
// Clouds always require "positions"/"coordinates" // Clouds require "coordinates".
if (cloudObjs.found("positions") || cloudObjs.found("coordinates")) // The "positions" are for v1706 and lower.
if (cloudObjs.found("coordinates") || cloudObjs.found("positions"))
{ {
if (allCloudDirs.insert(cloudName)) if (allCloudDirs.insert(cloudName))
{ {
Info<< "At time: " << timeName Info<< nl << " At time: " << timeName
<< " detected cloud directory : " << cloudName << " detected cloud directory : " << cloudName
<< endl; << flush;
} }
} }
} }
@ -49,14 +50,21 @@ if (timeDirs.size() && !noLagrangian)
{ {
Info<< "none detected." << endl; Info<< "none detected." << endl;
} }
if (Pstream::parRun())
{
Pstream::combineGather(allCloudDirs, HashSetPlusEqOp<word>());
Pstream::combineScatter(allCloudDirs);
}
} }
// sorted list of cloud names
const fileNameList cloudNames(allCloudDirs.sortedToc()); // Sorted list of cloud names
const wordList cloudNames(allCloudDirs.sortedToc());
if (cloudNames.size()) if (cloudNames.size())
{ {
// complete the echo information // Complete the echo information
Info<< "("; Info<< "(";
for (const word& cloudName : cloudNames) for (const word& cloudName : cloudNames)
{ {

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -146,6 +146,8 @@ Note
#include "pointMesh.H" #include "pointMesh.H"
#include "volPointInterpolation.H" #include "volPointInterpolation.H"
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "PstreamCombineReduceOps.H"
#include "HashTableOps.H"
#include "labelIOField.H" #include "labelIOField.H"
#include "scalarIOField.H" #include "scalarIOField.H"
#include "sphericalTensorIOField.H" #include "sphericalTensorIOField.H"
@ -156,7 +158,6 @@ Note
#include "passiveParticle.H" #include "passiveParticle.H"
#include "stringOps.H" #include "stringOps.H"
#include "areaFields.H" #include "areaFields.H"
#include "meshSubsetHelper.H" #include "meshSubsetHelper.H"
#include "readFields.H" #include "readFields.H"
#include "faceSet.H" #include "faceSet.H"
@ -190,13 +191,17 @@ void print(const char* msg, Ostream& os, const UPtrList<const GeoField>& flds)
} }
void print(Ostream& os, const wordList& flds) void print(const char* msg, Ostream& os, const wordList& flds)
{ {
forAll(flds, i) if (flds.size())
{ {
os << ' ' << flds[i]; os << msg;
forAll(flds, i)
{
os << ' ' << flds[i];
}
os << endl;
} }
os << endl;
} }
@ -617,6 +622,16 @@ int main(int argc, char *argv[])
pointTensorField::typeName pointTensorField::typeName
}; };
// Supported cloud (lagrangian) field types
const wordHashSet cFieldTypes
{
labelIOField::typeName,
scalarIOField::typeName,
vectorIOField::typeName,
symmTensorIOField::typeName,
tensorIOField::typeName
};
forAll(timeDirs, timei) forAll(timeDirs, timei)
{ {
runTime.setTime(timeDirs[timei], timei); runTime.setTime(timeDirs[timei], timei);
@ -879,7 +894,7 @@ int main(int argc, char *argv[])
{ {
aMeshPtr.reset(new faMesh(meshRef.baseMesh())); aMeshPtr.reset(new faMesh(meshRef.baseMesh()));
} }
catch (Foam::error& err) catch (const Foam::error& err)
{ {
aMeshPtr.clear(); aMeshPtr.clear();
} }
@ -1446,7 +1461,7 @@ int main(int argc, char *argv[])
// //
//--------------------------------------------------------------------- //---------------------------------------------------------------------
for (const fileName& cloudName : cloudNames) for (const word& cloudName : cloudNames)
{ {
// Always create the cloud directory. // Always create the cloud directory.
mkDir(fvPath/cloud::prefix/cloudName); mkDir(fvPath/cloud::prefix/cloudName);
@ -1459,50 +1474,84 @@ int main(int argc, char *argv[])
Info<< " Lagrangian: " Info<< " Lagrangian: "
<< relativeName(runTime, outputName) << nl; << relativeName(runTime, outputName) << nl;
IOobjectList sprayObjs IOobjectList cloudObjs
( (
mesh, mesh,
runTime.timeName(), runTime.timeName(),
cloud::prefix/cloudName cloud::prefix/cloudName
); );
if (sprayObjs.found("positions") || sprayObjs.found("coordinates")) // Clouds require "coordinates".
// The "positions" are for v1706 and lower.
bool cloudExists =
(
cloudObjs.found("coordinates")
|| cloudObjs.found("positions")
);
reduce(cloudExists, orOp<bool>());
if (cloudExists)
{ {
wordList labelNames(sprayObjs.names(labelIOField::typeName)); // Limited to types that we explicitly handle
Info<< " labels :"; HashTable<wordHashSet> cloudFields = cloudObjs.classes();
print(Info, labelNames); cloudFields.retain(cFieldTypes);
wordList scalarNames(sprayObjs.names(scalarIOField::typeName)); // The number of cloud fields (locally)
Info<< " scalars :"; label nCloudFields = 0;
print(Info, scalarNames); forAllConstIters(cloudFields, citer)
{
nCloudFields += citer.object().size();
}
wordList vectorNames(sprayObjs.names(vectorIOField::typeName)); // Ensure all processes have identical information
Info<< " vectors :"; if (Pstream::parRun())
print(Info, vectorNames); {
Pstream::mapCombineGather
wordList sphereNames
(
sprayObjs.names
( (
sphericalTensorIOField::typeName cloudFields,
) HashSetPlusEqOp<word>()
); );
Info<< " sphTensors :"; Pstream::mapCombineScatter(cloudFields);
print(Info, sphereNames); }
wordList symmNames
// Build lists of field names and echo some information
const wordList labelNames
( (
sprayObjs.names cloudFields(labelIOField::typeName).sortedToc()
(
symmTensorIOField::typeName
)
); );
Info<< " symmTensors :"; print(" labels :", Info, labelNames);
print(Info, symmNames);
wordList tensorNames(sprayObjs.names(tensorIOField::typeName)); const wordList scalarNames
Info<< " tensors :"; (
print(Info, tensorNames); cloudFields(scalarIOField::typeName).sortedToc()
);
print(" scalars :", Info, scalarNames);
const wordList vectorNames
(
cloudFields(vectorIOField::typeName).sortedToc()
);
print(" vectors :", Info, vectorNames);
const wordList sphNames
(
cloudFields(sphericalTensorIOField::typeName).sortedToc()
);
print(" sphTensors :", Info, sphNames);
const wordList symmNames
(
cloudFields(symmTensorIOField::typeName).sortedToc()
);
print(" symmTensors :", Info, symmNames);
const wordList tensorNames
(
cloudFields(tensorIOField::typeName).sortedToc()
);
print(" tensors :", Info, tensorNames);
vtk::lagrangianWriter writer vtk::lagrangianWriter writer
( (
@ -1512,22 +1561,14 @@ int main(int argc, char *argv[])
fmtType fmtType
); );
// Write number of fields // Write number of fields (on this processor)
writer.beginParcelData writer.beginParcelData(nCloudFields);
(
labelNames.size()
+ scalarNames.size()
+ vectorNames.size()
+ sphereNames.size()
+ symmNames.size()
+ tensorNames.size()
);
// Fields // Fields
writer.writeIOField<label>(labelNames); writer.writeIOField<label>(labelNames);
writer.writeIOField<scalar>(scalarNames); writer.writeIOField<scalar>(scalarNames);
writer.writeIOField<vector>(vectorNames); writer.writeIOField<vector>(vectorNames);
writer.writeIOField<sphericalTensor>(sphereNames); writer.writeIOField<sphericalTensor>(sphNames);
writer.writeIOField<symmTensor>(symmNames); writer.writeIOField<symmTensor>(symmNames);
writer.writeIOField<tensor>(tensorNames); writer.writeIOField<tensor>(tensorNames);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +65,8 @@ void Foam::vtk::lagrangianWriter::writePoints()
} }
else else
{ {
beginPiece(); // Tricky - hide in here beginPiece(); // Tricky - hide begin piece in here
if (!nParcels_) return; // No parcels? ... skip everything else
format().tag(vtk::fileTag::POINTS) format().tag(vtk::fileTag::POINTS)
.openDataArray<float,3>(vtk::dataArrayAttr::POINTS) .openDataArray<float,3>(vtk::dataArrayAttr::POINTS)
@ -219,16 +220,12 @@ Foam::vtk::lagrangianWriter::lagrangianWriter
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtk::lagrangianWriter::~lagrangianWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtk::lagrangianWriter::beginParcelData(label nFields) void Foam::vtk::lagrangianWriter::beginParcelData(label nFields)
{ {
if (!nParcels_) return; // Skip if there are no parcels
const vtk::fileTag dataType = const vtk::fileTag dataType =
( (
useVerts_ useVerts_
@ -249,6 +246,8 @@ void Foam::vtk::lagrangianWriter::beginParcelData(label nFields)
void Foam::vtk::lagrangianWriter::endParcelData() void Foam::vtk::lagrangianWriter::endParcelData()
{ {
if (!nParcels_) return; // Skip if there are no parcels
const vtk::fileTag dataType = const vtk::fileTag dataType =
( (
useVerts_ useVerts_

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ Class
Foam::vtk::lagrangianWriter Foam::vtk::lagrangianWriter
Description Description
Write fields (internal). Write lagrangian positions and fields (clouds).
SourceFiles SourceFiles
lagrangianWriter.C lagrangianWriter.C
@ -36,11 +36,11 @@ SourceFiles
#ifndef foamVtkLagrangianWriter_H #ifndef foamVtkLagrangianWriter_H
#define foamVtkLagrangianWriter_H #define foamVtkLagrangianWriter_H
#include "OFstream.H"
#include "Cloud.H" #include "Cloud.H"
#include "volFields.H" #include "volFields.H"
#include "pointFields.H" #include "pointFields.H"
#include "foamVtkOutputOptions.H" #include "foamVtkOutputOptions.H"
#include <fstream>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -115,7 +115,7 @@ public:
//- Destructor //- Destructor
~lagrangianWriter(); ~lagrangianWriter() = default;
// Member Functions // Member Functions
@ -135,15 +135,17 @@ public:
return nParcels_; return nParcels_;
} }
//- Begin parcel data (point data).
// The nFields parameter is only needed for legacy format.
void beginParcelData(label nFields); void beginParcelData(label nFields);
void endParcelData(); void endParcelData();
//- Write file footer //- Write file footer
void writeFooter(); void writeFooter();
//- Write IOField //- Write IOFields
template<class Type> template<class Type>
void writeIOField(const wordList& objectNames); void writeIOField(const wordList& fieldNames);
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,30 +29,48 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtk::lagrangianWriter::writeIOField void Foam::vtk::lagrangianWriter::writeIOField(const wordList& fieldNames)
(
const wordList& objectNames
)
{ {
const int nCmpt(pTraits<Type>::nComponents); const int nCmpt(pTraits<Type>::nComponents);
const bool useIntField = const bool useIntField =
std::is_integral<typename pTraits<Type>::cmptType>(); std::is_integral<typename pTraits<Type>::cmptType>();
for (const word& fldName : objectNames) const fileName cloudDir(cloud::prefix/cloudName_);
for (const word& fldName : fieldNames)
{ {
IOobject header // Globally the field is expected to exist (MUST_READ), but can
// be missing on a local processor.
//
// However, constructing IOField with MUST_READ and valid=false fails.
// Workaround: READ_IF_PRESENT and verify the header globally
IOobject fieldObject
( (
fldName, fldName,
mesh_.time().timeName(), mesh_.time().timeName(),
cloud::prefix/cloudName_, cloudDir,
mesh_, mesh_,
IOobject::MUST_READ, IOobject::READ_IF_PRESENT
IOobject::NO_WRITE,
false // no register
); );
IOField<Type> fld(header); // Check global existence - could make an error
const bool fieldExists =
returnReduce
(
fieldObject.typeHeaderOk<IOField<Type>>(false),
orOp<bool>()
);
if (!fieldExists)
{
continue;
}
IOField<Type> fld(fieldObject);
// NOTE: Could skip if there are no local parcels...
if (useIntField) if (useIntField)
{ {

View File

@ -310,6 +310,9 @@ Foam::vtkPVFoam::vtkPVFoam
fullCasePath = cwd(); fullCasePath = cwd();
} }
// OPENFOAM API
setEnv("FOAM_API", std::to_string(OPENFOAM_PLUS), true);
// The name of the executable, unless already present in the environment // The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false); setEnv("FOAM_EXECUTABLE", "paraview", false);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -206,6 +206,9 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
fullCasePath = cwd(); fullCasePath = cwd();
} }
// OPENFOAM API
setEnv("FOAM_API", std::to_string(OPENFOAM_PLUS), true);
// The name of the executable, unless already present in the environment // The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false); setEnv("FOAM_EXECUTABLE", "paraview", false);

View File

@ -55,8 +55,8 @@ Usage
} }
// Input file // Input files list
inputFile "postProcessing/faceSource1/surface/patch/patch.case"; files ("postProcessing/faceSource1/surface/patch/patch.case";)
// Surface reader // Surface reader
reader ensight; reader ensight;

View File

@ -217,9 +217,9 @@ int main(int argc, char *argv[])
// Report to output (avoid overwriting values from simulation) // Report to output (avoid overwriting values from simulation)
profiling::print(Info); profiling::print(Info);
} }
catch (Foam::IOerror& err) catch (const Foam::IOerror& err)
{ {
Warning<< err << endl; Warning << err << endl;
} }
Info<< endl; Info<< endl;

View File

@ -3,9 +3,11 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2008-2011, 2017-2018 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# | Copyright (C) 2011-2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
@ -46,7 +48,7 @@
printHelp() { printHelp() {
cat<<USAGE cat<<USAGE
Usage: foamEtcFile [OPTION] fileName Usage: foamEtcFile [OPTION] fileName [-- args]
foamEtcFile [OPTION] [-list|-list-test] [fileName] foamEtcFile [OPTION] [-list|-list-test] [fileName]
options: options:
@ -56,10 +58,15 @@ options:
-mode=MODE Any combination of u(user), g(group), o(other) -mode=MODE Any combination of u(user), g(group), o(other)
-prefix=DIR Specify an alternative installation prefix -prefix=DIR Specify an alternative installation prefix
-version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...) -version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
-csh Produce output suitable for a csh or sh 'eval' -csh Produce 'source FILE' output for a csh eval
-csh-verbose As per -csh with additional verbosity -sh Produce '. FILE' output for a sh eval
-sh Produce output suitable for a csh or sh 'eval' -csh-verbose As per -csh, with additional verbosity
-sh-verbose As per -sh with additional verbosity -sh-verbose As per -sh, with additional verbosity
-config Add config directory prefix for shell type:
with -csh* for a config.csh/ prefix
with -sh* for a config.sh/ prefix
-show-api Print api value from wmake/rules, or meta-info and exit
-show-patch Print patch value from meta-info and exit
-quiet (-q) Suppress all normal output -quiet (-q) Suppress all normal output
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output -silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
-help Print the usage -help Print the usage
@ -81,7 +88,6 @@ USAGE
exit 0 # A clean exit exit 0 # A clean exit
} }
unset optQuiet optSilent unset optQuiet optSilent
# Report error and exit # Report error and exit
die() die()
@ -182,8 +188,65 @@ setVersion()
} }
#-------------------------------------------------------------------------------
# The API locations. See wmake/wmakeBuildInfo
rulesFile="$projectDir/wmake/rules/General/general"
metaInfoDir="$projectDir/META-INFO"
# Get api from rules/General/general
#
# Failure modes:
# - No api information (can't find file etc).
# -> Fatal for building, but could be OK for a stripped down version
#
# Fallback. Get from api-info
#
getApi()
{
local value
value="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' $rulesFile 2>/dev/null)"
if [ -z "$value" ] && [ -f "$metaInfoDir/api-info" ]
then
# Fallback. Get from api-info
value="$(sed -ne 's@^ *api *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
fi
if [ -n "$value" ]
then
echo "$value"
else
return 1
fi
}
# Get patch from meta-info / api-info
#
# Failure modes:
# - No patch information (can't find file etc).
#
getPatchLevel()
{
local value
# Fallback. Get from api-info
value="$(sed -ne 's@^ *patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
if [ -n "$value" ]
then
echo "$value"
else
return 1
fi
}
#-------------------------------------------------------------------------------
optMode=ugo # Default mode is always 'ugo' optMode=ugo # Default mode is always 'ugo'
unset optAll optList optShell optVersion unset shellOutput verboseOutput
unset optAll optConfig optList optVersion
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -192,21 +255,36 @@ do
-h | -help*) -h | -help*)
printHelp printHelp
;; ;;
-show-api)
# Show API and exit
getApi
exit $?
;;
-show-patch)
# Show patch level and exit
getPatchLevel
exit $?
;;
-a | -all) -a | -all)
optAll=true optAll=true
unset optShell unset shellOutput verboseOutput
;; ;;
-l | -list) -l | -list)
optList=true optList=true
unset optShell
;; ;;
-list-test) -list-test)
optList='test' optList='test'
unset optShell
;; ;;
-csh | -sh | -csh-verbose | -sh-verbose) -csh | -sh)
optShell="${1#-}" shellOutput="${1#-}"
unset optAll unset verboseOutput
;;
-csh-verbose | -sh-verbose)
shellOutput="${1#-}"
verboseOutput="source " # Report: "source FILE"
;;
-config)
optConfig=true
;; ;;
-mode=[ugo]*) -mode=[ugo]*)
optMode="${1#*=}" optMode="${1#*=}"
@ -260,9 +338,33 @@ do
shift shift
done done
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Split arguments into filename (for searching) and trailing bits for shell eval
# Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile)
nArgs=$#
fileName="${1#~OpenFOAM/}"
unset evalArgs
if [ "$nArgs" -eq 1 ]
then
if [ "$1" = "--" ]
then
nArgs=0
unset fileName
fi
elif [ "$nArgs" -ge 2 ]
then
if [ "$2" = "--" ]
then
nArgs=1
shift 2
evalArgs="$@"
fi
fi
# Get version information
if [ -n "$optVersion" ] if [ -n "$optVersion" ]
then then
setVersion $optVersion setVersion $optVersion
@ -285,12 +387,6 @@ groupDir="${WM_PROJECT_SITE:-$prefixDir/site}"
# eval echo "$i=\$$i" 1>&2 # eval echo "$i=\$$i" 1>&2
# done # done
# Save the essential bits of information
# silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile)
nArgs=$#
fileName="${1#~OpenFOAM/}"
# Define the various places to be searched: # Define the various places to be searched:
unset dirList unset dirList
case "$optMode" in (*u*) # (U)ser case "$optMode" in (*u*) # (U)ser
@ -309,27 +405,61 @@ case "$optMode" in (*o*) # (O)ther == shipped
esac esac
set -- $dirList set -- $dirList
[ "$#" -ge 1 ] || die "No directories to scan. Programming error?"
exitCode=2 # Fallback is a FileNotFound error
#
# Preliminaries
#
# Special handling of config.sh/ , config.csh/ directories
if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ]
then
case "$shellOutput" in
csh*)
optConfig="config.csh/"
;;
sh*)
optConfig="config.sh/"
;;
*)
unset optConfig
;;
esac
if [ -n "$optConfig" ]
then
case "$fileName" in
/* | config.csh* | config.sh*)
# Does not need or cannot add a prefix
unset optConfig
;;
*)
fileName="$optConfig$fileName"
;;
esac
fi
fi
# #
# The main routine # The main routine
# #
exitCode=0
if [ -n "$optList" ] if [ -n "$optList" ]
then then
# List directories, or potential file locations # List directories, or potential file locations
[ "$nArgs" -le 1 ] || \ [ "$nArgs" -le 1 ] || \
die "-list expects 0 or 1 filename, but $nArgs provided" die "-list options expect 0 or 1 filename, but $nArgs provided"
# A silly combination, but -quiet does have precedence # A silly combination, but -quiet has absolute precedence
[ -n "$optQuiet" ] && exit 0 [ -n "$optQuiet" ] && exit 0
# Test for directory or file too? # Test for directory or file too?
if [ "$optList" = "test" ] if [ "$optList" = "test" ]
then then
exitCode=2 # Fallback to a general error (file not found)
if [ "$nArgs" -eq 1 ] if [ "$nArgs" -eq 1 ]
then then
for dir for dir
@ -352,6 +482,7 @@ then
done done
fi fi
else else
exitCode=0 # OK, already verified that $# != 0
for dir for dir
do do
echo "$dir${fileName:+/}$fileName" echo "$dir${fileName:+/}$fileName"
@ -362,35 +493,44 @@ else
[ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided" [ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided"
exitCode=2 # Fallback to a general error (file not found) # Output for sourcing files ("source" for csh, "." for POSIX shell)
# Only allow sourcing a single file (disallow combination with -all)
case "$shellOutput" in
csh*)
shellOutput="source " # eg, "source FILE"
;;
sh*)
shellOutput=". " # eg, ". FILE"
;;
esac
# Anti-pattern: -all disables shell commands
if [ -n "$optAll" ]
then
unset shellOutput verboseOutput
fi
for dir for dir
do do
if [ -f "$dir/$fileName" ] resolved="$dir/$fileName"
if [ -f "$resolved" ]
then then
exitCode=0 exitCode=0 # OK
[ -n "$optQuiet" ] && break if [ -n "$optQuiet" ]
then
case "$optShell" in
(*verbose)
echo "Using: $dir/$fileName" 1>&2
;;
esac
case "$optShell" in
csh*)
echo "source $dir/$fileName"
break break
;; elif [ -n "$verboseOutput" ]
sh*) then
echo ". $dir/$fileName" echo "$verboseOutput$resolved" 1>&2
break fi
;;
*) if [ -n "$shellOutput" ]
echo "$dir/$fileName" then
[ -n "$optAll" ] || break echo "$shellOutput$resolved $evalArgs"
;; else
esac echo "$resolved"
fi
[ -n "$optAll" ] || break
fi fi
done done

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -36,7 +36,8 @@ usage: ${0##*/}
-boost-path DIR specify 'BOOST_ARCH_PATH' -boost-path DIR specify 'BOOST_ARCH_PATH'
-cgal ver specify 'cgal_version' -cgal ver specify 'cgal_version'
-cgal-path DIR specify 'CGAL_ARCH_PATH' -cgal-path DIR specify 'CGAL_ARCH_PATH'
-clang VER specify 'clang_version' for ThirdParty Clang -clang VER specify 'default_clang_version' for ThirdParty Clang
-gcc VER specify 'default_gcc_version' for ThirdParty Gcc
-cmake VER specify 'cmake_version' -cmake VER specify 'cmake_version'
-fftw VER specify 'fffw_version' -fftw VER specify 'fffw_version'
-fftw-path DIR specify 'FFTW_ARCH_PATH' -fftw-path DIR specify 'FFTW_ARCH_PATH'
@ -325,9 +326,17 @@ do
;; ;;
-clang) -clang)
# Replace clang_version=... # Replace default_clang_version=...
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
replace etc/config.sh/compiler clang_version "$2" replace etc/config.sh/compiler default_clang_version "$2"
adjusted=true
shift
;;
-gcc)
# Replace default_gcc_version=...
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
replace etc/config.sh/compiler default_gcc_version "$2"
adjusted=true adjusted=true
shift shift
;; ;;
@ -466,19 +475,19 @@ do
gmp-[4-9]* | gmp-system) gmp-[4-9]* | gmp-system)
# gcc-related package # gcc-related package
replace etc/config.sh/compiler gmp_version "$1" replace etc/config.sh/compiler default_gmp_version "$1"
adjusted=true adjusted=true
;; ;;
mpfr-[2-9]* | mpfr-system) mpfr-[2-9]* | mpfr-system)
# gcc-related package # gcc-related package
replace etc/config.sh/compiler mpfr_version "$1" replace etc/config.sh/compiler default_mpfr_version "$1"
adjusted=true adjusted=true
;; ;;
mpc-[0-9]* | mpc-system) mpc-[0-9]* | mpc-system)
# gcc-related package # gcc-related package
replace etc/config.sh/compiler mpc_version "$1" replace etc/config.sh/compiler default_mpc_version "$1"
adjusted=true adjusted=true
;; ;;

View File

@ -33,7 +33,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=plus export WM_PROJECT_VERSION=v1712
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation. # [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines # \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines

View File

@ -2,12 +2,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# File # File
# etc/config.csh/compiler # etc/config.csh/compiler
@ -20,67 +22,117 @@
switch ("$WM_COMPILER_TYPE") switch ("$WM_COMPILER_TYPE")
case ThirdParty: case ThirdParty:
# Default versions of GMP, MPFR, MPC - override as necessary # Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
set gmp_version=gmp-system
set mpfr_version=mpfr-system set default_clang_version=llvm-3.7.1
set mpc_version=mpc-system set default_gcc_version=gcc-4.8.5
set default_gmp_version=gmp-system
set default_mpfr_version=mpfr-system
set default_mpc_version=mpc-system
switch ("$WM_COMPILER") switch ("$WM_COMPILER")
case Gcc: case Gcc:
case Gcc48: set gcc_version="$default_gcc_version"
breaksw
case Gcc48*:
set gcc_version=gcc-4.8.5 set gcc_version=gcc-4.8.5
breaksw breaksw
case Gcc49: case Gcc49*:
set gcc_version=gcc-4.9.4 set gcc_version=gcc-4.9.4
breaksw breaksw
case Gcc51: case Gcc51*:
set gcc_version=gcc-5.1.0 set gcc_version=gcc-5.1.0
breaksw breaksw
case Gcc52: case Gcc52*:
set gcc_version=gcc-5.2.0 set gcc_version=gcc-5.2.0
breaksw breaksw
case Gcc53: case Gcc53*:
set gcc_version=gcc-5.3.0 set gcc_version=gcc-5.3.0
breaksw breaksw
case Gcc54: case Gcc54*:
set gcc_version=gcc-5.4.0 set gcc_version=gcc-5.4.0
breaksw breaksw
case Gcc55: case Gcc55*:
set gcc_version=gcc-5.5.0 set gcc_version=gcc-5.5.0
breaksw breaksw
case Gcc61: case Gcc61*:
set gcc_version=gcc-6.1.0 set gcc_version=gcc-6.1.0
breaksw breaksw
case Gcc62: case Gcc62*:
set gcc_version=gcc-6.2.0 set gcc_version=gcc-6.2.0
breaksw breaksw
case Gcc63: case Gcc63*:
set gcc_version=gcc-6.3.0 set gcc_version=gcc-6.3.0
breaksw breaksw
case Gcc64: case Gcc64*:
set gcc_version=gcc-6.4.0 set gcc_version=gcc-6.4.0
breaksw breaksw
case Gcc71: case Gcc65*:
set gcc_version=gcc-6.5.0
breaksw
case Gcc71*:
set gcc_version=gcc-7.1.0 set gcc_version=gcc-7.1.0
breaksw breaksw
case Gcc72: case Gcc72*:
set gcc_version=gcc-7.2.0 set gcc_version=gcc-7.2.0
breaksw breaksw
case Gcc73*:
set gcc_version=gcc-7.3.0
breaksw
case Gcc74*:
set gcc_version=gcc-7.4.0
breaksw
case Gcc81*:
set gcc_version=gcc-8.1.0
breaksw
case Gcc82*:
set gcc_version=gcc-8.2.0
breaksw
case Gcc83*:
set gcc_version=gcc-8.3.0
breaksw
case Gcc91*:
set gcc_version=gcc-9.1.0
breaksw
case Gcc92*:
set gcc_version=gcc-9.2.0
breaksw
case Clang: case Clang:
set clang_version="$default_clang_version"
breaksw
case Clang37*:
set clang_version=llvm-3.7.1 set clang_version=llvm-3.7.1
breaksw breaksw
case Clang38: case Clang38*:
set clang_version=llvm-3.8.1 set clang_version=llvm-3.8.1
breaksw breaksw
case Clang39: case Clang39*:
set clang_version=llvm-3.9.1 set clang_version=llvm-3.9.1
breaksw breaksw
case Clang40: case Clang40*:
set clang_version=llvm-4.0.1 set clang_version=llvm-4.0.1
breaksw breaksw
case Clang50: case Clang50*:
set clang_version=llvm-5.0.0 set clang_version=llvm-5.0.2
breaksw breaksw
case Clang60*:
set clang_version=llvm-6.0.1
breaksw
case Clang70*:
set clang_version=llvm-7.0.1
breaksw
case Clang71*:
set clang_version=llvm-7.1.0
breaksw
case Clang80*:
set clang_version=llvm-8.0.1
breaksw
case Clang90*:
set clang_version=llvm-9.0.0
breaksw
default: default:
/bin/cat << UNKNOWN_COMPILER /bin/cat << UNKNOWN_COMPILER
=============================================================================== ===============================================================================
@ -92,7 +144,11 @@ Please check your settings
UNKNOWN_COMPILER UNKNOWN_COMPILER
breaksw breaksw
endsw endsw
breaksw breaksw
endsw endsw
unset default_gcc_version default_clang_version
unset default_gmp_version default_mpfr_version default_mpc_version
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -72,6 +72,7 @@ unsetenv WM_THIRD_PARTY_DIR
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset FOAM_* environment variables # Unset FOAM_* environment variables
unsetenv FOAM_API
unsetenv FOAM_APPBIN unsetenv FOAM_APPBIN
unsetenv FOAM_APP unsetenv FOAM_APP
unsetenv FOAM_CODE_TEMPLATES unsetenv FOAM_CODE_TEMPLATES

View File

@ -2,12 +2,14 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# File # File
# etc/config.sh/compiler # etc/config.sh/compiler
@ -20,66 +22,56 @@
case "$WM_COMPILER_TYPE" in case "$WM_COMPILER_TYPE" in
ThirdParty) ThirdParty)
# Default versions of GMP, MPFR, MPC - override as necessary # Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
gmp_version=gmp-system
mpfr_version=mpfr-system default_clang_version=llvm-3.7.1
mpc_version=mpc-system default_gcc_version=gcc-4.8.5
default_gmp_version=gmp-system
default_mpfr_version=mpfr-system
default_mpc_version=mpc-system
gmp_version="$default_gmp_version"
mpfr_version="$default_mpfr_version"
mpc_version="$default_mpc_version"
case "$WM_COMPILER" in case "$WM_COMPILER" in
Gcc | Gcc48) Gcc) gcc_version="$default_gcc_version" ;;
gcc_version=gcc-4.8.5 Gcc48*) gcc_version=gcc-4.8.5 ;;
;; Gcc49*) gcc_version=gcc-4.9.4 ;;
Gcc49) Gcc51*) gcc_version=gcc-5.1.0 ;;
gcc_version=gcc-4.9.4 Gcc52*) gcc_version=gcc-5.2.0 ;;
;; Gcc53*) gcc_version=gcc-5.3.0 ;;
Gcc51) Gcc54*) gcc_version=gcc-5.4.0 ;;
gcc_version=gcc-5.1.0 Gcc55*) gcc_version=gcc-5.5.0 ;;
;; Gcc61*) gcc_version=gcc-6.1.0 ;;
Gcc52) Gcc62*) gcc_version=gcc-6.2.0 ;;
gcc_version=gcc-5.2.0 Gcc63*) gcc_version=gcc-6.3.0 ;;
;; Gcc64*) gcc_version=gcc-6.4.0 ;;
Gcc53) Gcc65*) gcc_version=gcc-6.5.0 ;;
gcc_version=gcc-5.3.0 Gcc71*) gcc_version=gcc-7.1.0 ;;
;; Gcc72*) gcc_version=gcc-7.2.0 ;;
Gcc54) Gcc73*) gcc_version=gcc-7.3.0 ;;
gcc_version=gcc-5.4.0 Gcc74*) gcc_version=gcc-7.4.0 ;;
;; Gcc75*) gcc_version=gcc-7.5.0 ;;
Gcc55) Gcc81*) gcc_version=gcc-8.1.0 ;;
gcc_version=gcc-5.5.0 Gcc82*) gcc_version=gcc-8.2.0 ;;
;; Gcc83*) gcc_version=gcc-8.3.0 ;;
Gcc61) Gcc91*) gcc_version=gcc-9.1.0 ;;
gcc_version=gcc-6.1.0 Gcc92*) gcc_version=gcc-9.2.0 ;;
;;
Gcc62) Clang) clang_version="$default_clang_version" ;;
gcc_version=gcc-6.2.0 Clang37*) clang_version=llvm-3.7.1 ;;
;; Clang38*) clang_version=llvm-3.8.1 ;;
Gcc63) Clang39*) clang_version=llvm-3.9.1 ;;
gcc_version=gcc-6.3.0 Clang40*) clang_version=llvm-4.0.1 ;;
;; Clang50*) clang_version=llvm-5.0.2 ;;
Gcc64) Clang60*) clang_version=llvm-6.0.1 ;;
gcc_version=gcc-6.4.0 Clang70*) clang_version=llvm-7.0.1 ;;
;; Clang71*) clang_version=llvm-7.1.0 ;;
Gcc71) Clang80*) clang_version=llvm-8.0.1 ;;
gcc_version=gcc-7.1.0 Clang90*) clang_version=llvm-9.0.0 ;;
;;
Gcc72)
gcc_version=gcc-7.2.0
;;
Clang)
clang_version=llvm-3.7.1
;;
Clang38)
clang_version=llvm-3.8.1
;;
Clang39)
clang_version=llvm-3.9.1
;;
Clang40)
clang_version=llvm-4.0.1
;;
Clang50)
clang_version=llvm-5.0.0
;;
*) *)
/bin/cat << UNKNOWN_COMPILER 1>&2 /bin/cat << UNKNOWN_COMPILER 1>&2
=============================================================================== ===============================================================================
@ -94,4 +86,7 @@ UNKNOWN_COMPILER
;; ;;
esac esac
unset default_gcc_version default_clang_version
unset default_gmp_version default_mpfr_version default_mpc_version
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -63,6 +63,7 @@ unset WM_THIRD_PARTY_DIR
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset FOAM_* environment variables # Unset FOAM_* environment variables
unset FOAM_API
unset FOAM_APPBIN unset FOAM_APPBIN
unset FOAM_APP unset FOAM_APP
unset FOAM_CODE_TEMPLATES unset FOAM_CODE_TEMPLATES

View File

@ -33,7 +33,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
setenv WM_PROJECT OpenFOAM setenv WM_PROJECT OpenFOAM
setenv WM_PROJECT_VERSION plus setenv WM_PROJECT_VERSION v1712
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation. # [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# \- When this file is located as $WM_PROJECT_DIR/etc/cshrc, the next lines # \- When this file is located as $WM_PROJECT_DIR/etc/cshrc, the next lines

View File

@ -79,6 +79,7 @@ functionObjects/Allwmake $targetType $*
wmake $targetType lumpedPointMotion wmake $targetType lumpedPointMotion
wmake $targetType sixDoFRigidBodyMotion wmake $targetType sixDoFRigidBodyMotion
wmake $targetType sixDoFRigidBodyState
wmake $targetType rigidBodyDynamics wmake $targetType rigidBodyDynamics
wmake $targetType rigidBodyMeshMotion wmake $targetType rigidBodyMeshMotion

View File

@ -57,10 +57,10 @@ Description
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <link.h> #include <link.h>
#include <netinet/in.h>
#ifdef USE_RANDOM #ifdef USE_RANDOM
#include <climits> #include <climits>
#if INT_MAX != 2147483647 #if INT_MAX != 2147483647
@ -708,12 +708,12 @@ double Foam::highResLastModified(const fileName& name, const bool followLink)
// Ignore an empty name // Ignore an empty name
if (!name.empty()) if (!name.empty())
{ {
fileStat fileStatus(name); fileStat fileStatus(name, followLink);
if (fileStatus.isValid()) if (fileStatus.isValid())
{ {
return return
fileStatus.status().st_mtime fileStatus.status().st_mtime
+ 1e-9*fileStatus.status().st_atim.tv_nsec; + 1e-9*fileStatus.status().st_mtim.tv_nsec;
} }
} }
@ -1301,7 +1301,7 @@ bool Foam::ping
} }
// Fill sockaddr_in structure with dest address and port // Fill sockaddr_in structure with dest address and port
memset(reinterpret_cast<char *>(&destAddr), '\0', sizeof(destAddr)); std::memset(reinterpret_cast<char *>(&destAddr), '\0', sizeof(destAddr));
destAddr.sin_family = AF_INET; destAddr.sin_family = AF_INET;
destAddr.sin_port = htons(ushort(destPort)); destAddr.sin_port = htons(ushort(destPort));
destAddr.sin_addr.s_addr = addr; destAddr.sin_addr.s_addr = addr;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -2560,6 +2560,11 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
template<class Type> template<class Type>
Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const
{ {
if (nodes_.empty())
{
return -1;
}
labelBits index = findNode(0, sample); labelBits index = findNode(0, sample);
const node& nod = nodes_[getNode(index)]; const node& nod = nodes_[getNode(index)];
@ -2592,6 +2597,11 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
const point& sample const point& sample
) const ) const
{ {
if (nodes_.empty())
{
return emptyList<label>();
}
labelBits index = findNode(0, sample); labelBits index = findNode(0, sample);
const node& nod = nodes_[getNode(index)]; const node& nod = nodes_[getNode(index)];
@ -2603,10 +2613,8 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
{ {
return contents_[getContent(contentIndex)]; return contents_[getContent(contentIndex)];
} }
else
{ return emptyList<label>();
return emptyList<label>();
}
} }
@ -2688,18 +2696,21 @@ void Foam::indexedOctree<Type>::findNear
CompareOp& cop CompareOp& cop
) const ) const
{ {
findNear if (!nodes_.empty())
( {
nearDist, findNear
true, (
*this, nearDist,
nodePlusOctant(0, 0), true,
bb(), *this,
tree2, nodePlusOctant(0, 0),
nodePlusOctant(0, 0), bb(),
tree2.bb(), tree2,
cop nodePlusOctant(0, 0),
); tree2.bb(),
cop
);
}
} }
@ -2711,6 +2722,11 @@ void Foam::indexedOctree<Type>::print
const label nodeI const label nodeI
) const ) const
{ {
if (nodes_.empty())
{
return;
}
const node& nod = nodes_[nodeI]; const node& nod = nodes_[nodeI];
const treeBoundBox& bb = nod.bb_; const treeBoundBox& bb = nod.bb_;

View File

@ -784,8 +784,8 @@ public:
// Constructors // Constructors
//- Construct null (end iterator) //- Default construct (end iterator)
inline iterator() {} iterator() = default;
//- Copy construct from similar access type //- Copy construct from similar access type
inline explicit iterator(const Iterator<false>& iter) inline explicit iterator(const Iterator<false>& iter)
@ -828,8 +828,11 @@ public:
// Constructors // Constructors
//- Construct null (end iterator) //- Default construct (end iterator)
inline const_iterator() {} const_iterator() = default;
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Copy construct from similar access type //- Copy construct from similar access type
inline explicit const_iterator(const Iterator<true>& iter) inline explicit const_iterator(const Iterator<true>& iter)

View File

@ -0,0 +1,92 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
InNamspace
Foam
Description
Various functions to operate on HashTables.
SourceFiles
HashTableOps.H
\*---------------------------------------------------------------------------*/
#ifndef HashTableOps_H
#define HashTableOps_H
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//- Combine HashSet operation. Equivalent to 'a += b'
template<class Key=word, class Hash=string::hash>
struct HashSetPlusEqOp
{
typedef HashSet<Key, Hash> value_type;
void operator()(value_type& a, const value_type& b) const
{
a += b;
}
};
//- Combine HashTable operation. Equivalent to 'a += b'
template<class T, class Key=word, class Hash=string::hash>
struct HashTablePlusEqOp
{
typedef HashTable<T, Key, Hash> value_type;
void operator()(value_type& a, const value_type& b) const
{
if (b.size())
{
if (a.size())
{
forAllConstIters(b, citer)
{
a.insert(citer.key(), citer.object());
}
}
else
{
a = b;
}
}
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -200,6 +200,9 @@ public:
public: public:
//- Copy construct
iterator(const iterator&) = default;
//- Construct for a given DLListBase and link //- Construct for a given DLListBase and link
inline iterator(DLListBase&, link*); inline iterator(DLListBase&, link*);
@ -240,6 +243,9 @@ public:
//- Construct from a non-const iterator //- Construct from a non-const iterator
inline const_iterator(const DLListBase::iterator& iter); inline const_iterator(const DLListBase::iterator& iter);
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Currently pointing at a valid entry //- Currently pointing at a valid entry
inline bool found() const; inline bool found() const;
@ -277,6 +283,9 @@ public:
//- Construct for a given DLListBase and link //- Construct for a given DLListBase and link
inline const_reverse_iterator(const DLListBase& lst, const link*); inline const_reverse_iterator(const DLListBase& lst, const link*);
//- Copy construct
const_reverse_iterator(const const_reverse_iterator&) = default;
//- Currently pointing at a valid entry //- Currently pointing at a valid entry
inline bool found() const; inline bool found() const;

View File

@ -182,6 +182,9 @@ public:
public: public:
//- Copy construct
iterator(const iterator&) = default;
//- Construct for a given SLListBase and link //- Construct for a given SLListBase and link
inline iterator(SLListBase&, link*); inline iterator(SLListBase&, link*);
@ -222,6 +225,9 @@ public:
//- Construct from a non-const iterator //- Construct from a non-const iterator
inline const_iterator(const SLListBase::iterator& iter); inline const_iterator(const SLListBase::iterator& iter);
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Currently pointing at a valid entry //- Currently pointing at a valid entry
inline bool found() const; inline bool found() const;

View File

@ -108,21 +108,26 @@ Foam::List<T>::List(const List<T>& a)
: :
UList<T>(nullptr, a.size_) UList<T>(nullptr, a.size_)
{ {
if (this->size_) const label len = this->size_;
if (len)
{ {
alloc(); alloc();
#ifdef USEMEMCPY #ifdef USEMEMCPY
if (contiguous<T>()) if (contiguous<T>())
{ {
memcpy(this->v_, a.v_, this->byteSize()); std::memcpy
(
static_cast<void*>(this->v_), a.v_, this->byteSize()
);
} }
else else
#endif #endif
{ {
List_ACCESS(T, (*this), vp); List_ACCESS(T, (*this), vp);
List_CONST_ACCESS(T, a, ap); List_CONST_ACCESS(T, a, ap);
List_FOR_ALL((*this), i) for (label i = 0; i < len; ++i)
{ {
vp[i] = ap[i]; vp[i] = ap[i];
} }
@ -137,7 +142,9 @@ Foam::List<T>::List(const List<T2>& a)
: :
UList<T>(nullptr, a.size()) UList<T>(nullptr, a.size())
{ {
if (this->size_) const label len = this->size_;
if (len)
{ {
alloc(); alloc();
@ -162,22 +169,29 @@ Foam::List<T>::List(List<T>& a, bool reuse)
this->v_ = a.v_; this->v_ = a.v_;
a.v_ = nullptr; a.v_ = nullptr;
a.size_ = 0; a.size_ = 0;
return;
} }
else if (this->size_)
const label len = this->size_;
if (len)
{ {
alloc(); alloc();
#ifdef USEMEMCPY #ifdef USEMEMCPY
if (contiguous<T>()) if (contiguous<T>())
{ {
memcpy(this->v_, a.v_, this->byteSize()); std::memcpy
(
static_cast<void*>(this->v_), a.v_, this->byteSize()
);
} }
else else
#endif #endif
{ {
List_ACCESS(T, (*this), vp); List_ACCESS(T, (*this), vp);
List_CONST_ACCESS(T, a, ap); List_CONST_ACCESS(T, a, ap);
List_FOR_ALL((*this), i) for (label i = 0; i < len; ++i)
{ {
vp[i] = ap[i]; vp[i] = ap[i];
} }
@ -338,7 +352,7 @@ void Foam::List<T>::setSize(const label newSize)
#ifdef USEMEMCPY #ifdef USEMEMCPY
if (contiguous<T>()) if (contiguous<T>())
{ {
memcpy(nv, this->v_, overlap*sizeof(T)); std::memcpy(nv, this->v_, overlap*sizeof(T));
} }
else else
#endif #endif
@ -420,19 +434,24 @@ void Foam::List<T>::operator=(const UList<T>& a)
{ {
reAlloc(a.size_); reAlloc(a.size_);
if (this->size_) const label len = this->size_;
if (len)
{ {
#ifdef USEMEMCPY #ifdef USEMEMCPY
if (contiguous<T>()) if (contiguous<T>())
{ {
memcpy(this->v_, a.v_, this->byteSize()); std::memcpy
(
static_cast<void*>(this->v_), a.v_, this->byteSize()
);
} }
else else
#endif #endif
{ {
List_ACCESS(T, (*this), vp); List_ACCESS(T, (*this), vp);
List_CONST_ACCESS(T, a, ap); List_CONST_ACCESS(T, a, ap);
List_FOR_ALL((*this), i) for (label i = 0; i < len; ++i)
{ {
vp[i] = ap[i]; vp[i] = ap[i];
} }

View File

@ -544,8 +544,6 @@ inline void Foam::PackedList<nBits>::const_iterator::operator=
{ {
this->index_ = this->list_->size_; this->index_ = this->list_->size_;
} }
return *this;
} }

View File

@ -64,6 +64,12 @@ public:
inline static const SubList<T>& null(); inline static const SubList<T>& null();
// Generated Methods
//- Copy construct
SubList(const SubList&) = default;
// Constructors // Constructors
//- Construct from UList and sub-list size //- Construct from UList and sub-list size

View File

@ -80,6 +80,12 @@ public:
const labelUList& addr const labelUList& addr
); );
//- Copy construct (shallow copy of values and addressing arrays)
UIndirectList(const UIndirectList<T>& list)
:
UIndirectList<T>(list.completeList_, list.addressing_)
{}
// Member Functions // Member Functions

View File

@ -137,7 +137,10 @@ void Foam::UList<T>::deepCopy(const UList<T>& a)
#ifdef USEMEMCPY #ifdef USEMEMCPY
if (contiguous<T>()) if (contiguous<T>())
{ {
memcpy(this->v_, a.v_, this->byteSize()); std::memcpy
(
static_cast<void*>(this->v_), list.v_, this->byteSize()
);
} }
else else
#endif #endif

View File

@ -174,6 +174,12 @@ public:
}; };
// Generated Methods
//- Copy construct
UList(const UList<T>&) = default;
// Constructors // Constructors
//- Null constructor //- Null constructor

View File

@ -340,12 +340,6 @@ Foam::IOobject::IOobject
{} {}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::IOobject::~IOobject()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::objectRegistry& Foam::IOobject::db() const const Foam::objectRegistry& Foam::IOobject::db() const

View File

@ -220,6 +220,15 @@ public:
static inline word groupName(StringType name, const word& group); static inline word groupName(StringType name, const word& group);
// Generated Methods
//- Copy construct
IOobject(const IOobject&) = default;
//- Destructor
virtual ~IOobject() = default;
// Constructors // Constructors
//- Construct from name, instance, registry, io options //- Construct from name, instance, registry, io options
@ -289,10 +298,6 @@ public:
} }
//- Destructor
virtual ~IOobject();
// Member Functions // Member Functions
// General access // General access

View File

@ -171,10 +171,9 @@ Foam::IOobjectList::IOobjectList
// Use object with local scope and current instance (no searching) // Use object with local scope and current instance (no searching)
ok = objectPtr->typeHeaderOk<IOList<label>>(false, false); ok = objectPtr->typeHeaderOk<IOList<label>>(false, false);
} }
catch (Foam::IOerror& err) catch (const Foam::IOerror& err)
{ {
Warning Warning << err << nl << endl;
<< err << nl << endl;
} }
FatalIOError.throwExceptions(throwingIOerr); FatalIOError.throwExceptions(throwingIOerr);

View File

@ -169,14 +169,6 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::CompactIOField<T, BaseType>::~CompactIOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType> template<class T, class BaseType>

View File

@ -85,6 +85,9 @@ public:
// Constructors // Constructors
//- Default copy construct
CompactIOField(const CompactIOField&) = default;
//- Construct from IOobject //- Construct from IOobject
CompactIOField(const IOobject&); CompactIOField(const IOobject&);
@ -103,7 +106,7 @@ public:
// Destructor // Destructor
virtual ~CompactIOField(); virtual ~CompactIOField() = default;
// Member functions // Member functions

View File

@ -91,13 +91,6 @@ Foam::GlobalIOField<Type>::GlobalIOField
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOField<Type>::~GlobalIOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>

View File

@ -61,6 +61,9 @@ public:
// Constructors // Constructors
//- Default copy construct
GlobalIOField(const GlobalIOField&) = default;
//- Construct from IOobject //- Construct from IOobject
GlobalIOField(const IOobject&); GlobalIOField(const IOobject&);
@ -75,7 +78,7 @@ public:
//- Destructor //- Destructor
virtual ~GlobalIOField(); virtual ~GlobalIOField() = default;
// Member functions // Member functions

View File

@ -87,13 +87,6 @@ Foam::GlobalIOList<Type>::GlobalIOList
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::GlobalIOList<Type>::~GlobalIOList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>

View File

@ -61,6 +61,9 @@ public:
// Constructors // Constructors
//- Default copy construct
GlobalIOList(const GlobalIOList&) = default;
//- Construct from IOobject //- Construct from IOobject
GlobalIOList(const IOobject&); GlobalIOList(const IOobject&);
@ -75,7 +78,7 @@ public:
//- Destructor //- Destructor
virtual ~GlobalIOList(); virtual ~GlobalIOList() = default;
// Member functions // Member functions

View File

@ -166,12 +166,6 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type>>& f)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class Type>
Foam::IOField<Type>::~IOField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>

View File

@ -61,6 +61,9 @@ public:
// Constructors // Constructors
//- Default copy construct
IOField(const IOField&) = default;
//- Construct from IOobject //- Construct from IOobject
IOField(const IOobject&); IOField(const IOobject&);
@ -78,7 +81,7 @@ public:
//- Destructor //- Destructor
virtual ~IOField(); virtual ~IOField() = default;
// Member functions // Member functions

View File

@ -129,13 +129,6 @@ Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T>>& list)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOList<T>::~IOList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>

View File

@ -62,6 +62,9 @@ public:
// Constructors // Constructors
//- Default copy construct
IOList(const IOList&) = default;
//- Construct from IOobject //- Construct from IOobject
IOList(const IOobject&); IOList(const IOobject&);
@ -76,7 +79,7 @@ public:
//- Destructor //- Destructor
virtual ~IOList(); virtual ~IOList() = default;
// Member functions // Member functions

View File

@ -128,13 +128,6 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Xfer<Map<T>>& map)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOMap<T>::~IOMap()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>

View File

@ -63,6 +63,9 @@ public:
// Constructors // Constructors
//- Default copy construct
IOMap(const IOMap&) = default;
//- Construct from IOobject //- Construct from IOobject
IOMap(const IOobject&); IOMap(const IOobject&);
@ -77,7 +80,7 @@ public:
//- Destructor //- Destructor
virtual ~IOMap(); virtual ~IOMap() = default;
// Member functions // Member functions

View File

@ -141,13 +141,6 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T>>& list)
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T>
Foam::IOPtrList<T>::~IOPtrList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>

View File

@ -62,6 +62,9 @@ public:
// Constructors // Constructors
//- Default copy construct
IOPtrList(const IOPtrList&) = default;
//- Construct from IOobject using given Istream constructor class //- Construct from IOobject using given Istream constructor class
template<class INew> template<class INew>
IOPtrList(const IOobject&, const INew&); IOPtrList(const IOobject&, const INew&);
@ -80,7 +83,7 @@ public:
//- Destructor //- Destructor
virtual ~IOPtrList(); virtual ~IOPtrList() = default;
// Member functions // Member functions

View File

@ -75,12 +75,6 @@ Foam::baseIOdictionary::baseIOdictionary
} }
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::baseIOdictionary::~baseIOdictionary()
{}
// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * //
const Foam::word& Foam::baseIOdictionary::name() const const Foam::word& Foam::baseIOdictionary::name() const

View File

@ -66,6 +66,18 @@ public:
TypeName("dictionary"); TypeName("dictionary");
// Generated Methods
//- Copy construct
baseIOdictionary(const baseIOdictionary&) = default;
//- Move construct
baseIOdictionary(baseIOdictionary&&) = default;
//- Destructor
virtual ~baseIOdictionary() = default;
// Constructors // Constructors
//- Construct given an IOobject //- Construct given an IOobject
@ -78,11 +90,7 @@ public:
baseIOdictionary(const IOobject&, Istream&); baseIOdictionary(const IOobject&, Istream&);
//- Destructor // Member Functions
virtual ~baseIOdictionary();
// Member functions
//- Return complete path + object name if the file exists //- Return complete path + object name if the file exists
// either in the case/processor or case otherwise null // either in the case/processor or case otherwise null

View File

@ -177,7 +177,7 @@ void Foam::IFstream::rewind()
{ {
gzPtr = dynamic_cast<igzstream*>(allocatedPtr_); gzPtr = dynamic_cast<igzstream*>(allocatedPtr_);
} }
catch (std::bad_cast) catch (const std::bad_cast&)
{ {
gzPtr = nullptr; gzPtr = nullptr;
} }

View File

@ -263,6 +263,15 @@ protected:
public: public:
// Generated Methods
//- Copy construct
IOstream(const IOstream&) = default;
//- Destructor
virtual ~IOstream() = default;
// Constructors // Constructors
//- Construct setting format and version //- Construct setting format and version
@ -284,11 +293,6 @@ public:
} }
//- Destructor
virtual ~IOstream()
{}
// Member functions // Member functions
// Access // Access

View File

@ -70,6 +70,15 @@ class Istream
public: public:
// Generated Methods
//- Copy construct
Istream(const Istream&) = default;
//- Destructor
virtual ~Istream() = default;
// Constructors // Constructors
//- Construct and set stream status //- Construct and set stream status
@ -85,12 +94,7 @@ public:
{} {}
//- Destructor // Member Functions
virtual ~Istream()
{}
// Member functions
// Read functions // Read functions

View File

@ -72,6 +72,15 @@ protected:
public: public:
// Generated Methods
//- Copy construct
Ostream(const Ostream&) = default;
//- Destructor
virtual ~Ostream() = default;
// Constructors // Constructors
//- Construct and set stream status //- Construct and set stream status
@ -87,12 +96,7 @@ public:
{} {}
//- Destructor // Member Functions
virtual ~Ostream()
{}
// Member functions
// Write functions // Write functions

View File

@ -59,14 +59,17 @@ class OSstream
std::ostream& os_; std::ostream& os_;
// Private Member Functions public:
// Generated Methods
//- Copy construct
OSstream(const OSstream&) = default;
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const OSstream&) = delete; void operator=(const OSstream&) = delete;
public:
// Constructors // Constructors
//- Construct as wrapper around std::ostream and set stream status //- Construct as wrapper around std::ostream and set stream status

View File

@ -301,4 +301,32 @@ void Foam::ITstream::rewind()
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::ITstream::operator=(const ITstream& is)
{
Istream::operator=(is);
tokenList::operator=(is);
name_ = is.name_;
rewind();
}
void Foam::ITstream::operator=(const tokenList& toks)
{
tokenList::operator=(toks);
rewind();
}
void Foam::ITstream::operator=(tokenList&& toks)
{
tokenList::operator=(std::move(toks));
rewind();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -271,10 +271,22 @@ public:
} }
// Print // Output
//- Print description of stream to Ostream //- Print stream description to Ostream
void print(Ostream& os) const; void print(Ostream& os) const;
// Member Operators
//- Copy assignment, with rewind()
void operator=(const ITstream& is);
//- Copy assignment of tokens, with rewind()
void operator=(const tokenList& toks);
//- Move assignment of tokens, with rewind()
void operator=(tokenList&& toks);
}; };

View File

@ -168,7 +168,7 @@ Foam::label Foam::primitiveEntry::startLineNumber() const
if (tokens.size()) if (tokens.size())
{ {
tokens.first().lineNumber(); return tokens.first().lineNumber();
} }
return -1; return -1;

View File

@ -52,7 +52,7 @@ Foam::IOerror::IOerror(const dictionary& errDict)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::IOerror::~IOerror() throw() Foam::IOerror::~IOerror() noexcept
{} {}

View File

@ -129,7 +129,7 @@ Foam::error::error(const error& err)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::error::~error() throw() Foam::error::~error() noexcept
{ {
delete messageStreamPtr_; delete messageStreamPtr_;
} }

View File

@ -97,7 +97,7 @@ public:
//- Destructor //- Destructor
virtual ~error() throw(); virtual ~error() noexcept;
// Static Member Functions // Static Member Functions
@ -247,7 +247,7 @@ public:
//- Destructor //- Destructor
virtual ~IOerror() throw(); virtual ~IOerror() noexcept;
// Member functions // Member functions

View File

@ -828,12 +828,12 @@ bool Foam::functionObjectList::read()
foPtr = functionObject::New(key, time_, dict); foPtr = functionObject::New(key, time_, dict);
} }
} }
catch (Foam::IOerror& ioErr) catch (const Foam::IOerror& ioErr)
{ {
Info<< ioErr << nl << endl; Info<< ioErr << nl << endl;
::exit(1); ::exit(1);
} }
catch (Foam::error& err) catch (const Foam::error& err)
{ {
// Bit of trickery to get the original message // Bit of trickery to get the original message
err.write(Warning, false); err.write(Warning, false);

View File

@ -147,7 +147,7 @@ if (argList::postProcess(argc, argv))
// Report to output (avoid overwriting values from simulation) // Report to output (avoid overwriting values from simulation)
profiling::print(Info); profiling::print(Info);
} }
catch (IOerror& err) catch (const IOerror& err)
{ {
Warning<< err << endl; Warning<< err << endl;
} }

View File

@ -736,7 +736,8 @@ bool Foam::functionObjects::timeControl::read(const dictionary& dict)
executeControl_.read(dict); executeControl_.read(dict);
readControls(); readControls();
return true; // Forward to underlying function object
return foPtr_->read(dict);
} }
return false; return false;

View File

@ -88,7 +88,7 @@ inline To& dynamicCast(From& r)
{ {
return dynamic_cast<To&>(r); return dynamic_cast<To&>(r);
} }
catch (std::bad_cast) catch (const std::bad_cast&)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Attempt to cast type " << typeid(r).name() << "Attempt to cast type " << typeid(r).name()
@ -109,7 +109,7 @@ inline To& refCast(From& r)
{ {
return dynamic_cast<To&>(r); return dynamic_cast<To&>(r);
} }
catch (std::bad_cast) catch (const std::bad_cast&)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Attempt to cast type " << r.type() << "Attempt to cast type " << r.type()

View File

@ -63,6 +63,12 @@ public:
TypeName("value"); TypeName("value");
// Generated Methods
//- Copy construct
valuePointPatchField(const valuePointPatchField&) = default;
// Constructors // Constructors
//- Construct from patch and internal field //- Construct from patch and internal field

View File

@ -585,6 +585,9 @@ void Foam::argList::getRootCase()
// The name of the executable, unless already present in the environment // The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", executable_, false); setEnv("FOAM_EXECUTABLE", executable_, false);
// OPENFOAM API
setEnv("FOAM_API", std::to_string(OPENFOAM_PLUS), true);
// Set the case and case-name as an environment variable // Set the case and case-name as an environment variable
if (rootPath_.isAbsolute()) if (rootPath_.isAbsolute())
{ {

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,6 +57,8 @@ Description
may be present for some solvers or utilities. may be present for some solvers or utilities.
Environment variables set by argList or by Time: Environment variables set by argList or by Time:
- \par FOAM_API
The value of the OPENFOAM compiler define
- \par FOAM_CASE - \par FOAM_CASE
The path of the global case. The path of the global case.
It is the same for serial and parallel jobs. It is the same for serial and parallel jobs.

View File

@ -2,8 +2,11 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | www.openfoam.com
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,7 +56,7 @@ void Foam::interpolation2DTable<Type>::readTable()
template<class Type> template<class Type>
Foam::interpolation2DTable<Type>::interpolation2DTable() Foam::interpolation2DTable<Type>::interpolation2DTable()
: :
List<Tuple2<scalar, List<Tuple2<scalar, Type>>>>(), List<value_type>(),
bounding_(bounds::normalBounding::WARN), bounding_(bounds::normalBounding::WARN),
fileName_("fileNameIsUndefined"), fileName_("fileNameIsUndefined"),
reader_(nullptr) reader_(nullptr)
@ -68,7 +71,7 @@ Foam::interpolation2DTable<Type>::interpolation2DTable
const fileName& fName const fileName& fName
) )
: :
List<Tuple2<scalar, List<Tuple2<scalar, Type>>>>(values), List<value_type>(values),
bounding_(bounding), bounding_(bounding),
fileName_(fName), fileName_(fName),
reader_(nullptr) reader_(nullptr)
@ -78,7 +81,7 @@ Foam::interpolation2DTable<Type>::interpolation2DTable
template<class Type> template<class Type>
Foam::interpolation2DTable<Type>::interpolation2DTable(const fileName& fName) Foam::interpolation2DTable<Type>::interpolation2DTable(const fileName& fName)
: :
List<Tuple2<scalar, List<Tuple2<scalar, Type>>>>(), List<value_type>(),
bounding_(bounds::normalBounding::WARN), bounding_(bounds::normalBounding::WARN),
fileName_(fName), fileName_(fName),
reader_(new openFoamTableReader<Type>(dictionary())) reader_(new openFoamTableReader<Type>(dictionary()))
@ -90,7 +93,7 @@ Foam::interpolation2DTable<Type>::interpolation2DTable(const fileName& fName)
template<class Type> template<class Type>
Foam::interpolation2DTable<Type>::interpolation2DTable(const dictionary& dict) Foam::interpolation2DTable<Type>::interpolation2DTable(const dictionary& dict)
: :
List<Tuple2<scalar, List<Tuple2<scalar, Type>>>>(), List<value_type>(),
bounding_ bounding_
( (
bounds::normalBoundingNames.lookupOrFailsafe bounds::normalBoundingNames.lookupOrFailsafe
@ -110,17 +113,16 @@ Foam::interpolation2DTable<Type>::interpolation2DTable(const dictionary& dict)
template<class Type> template<class Type>
Foam::interpolation2DTable<Type>::interpolation2DTable Foam::interpolation2DTable<Type>::interpolation2DTable
( (
const interpolation2DTable& interpTable const interpolation2DTable& tbl
) )
: :
List<Tuple2<scalar, List<Tuple2<scalar, Type>>>>(interpTable), List<value_type>(tbl),
bounding_(interpTable.bounding_), bounding_(tbl.bounding_),
fileName_(interpTable.fileName_), fileName_(tbl.fileName_),
reader_(interpTable.reader_) // note: steals reader. Used in write(). reader_(tbl.reader_, false) // clone
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -308,6 +310,29 @@ Foam::label Foam::interpolation2DTable<Type>::Xi
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::interpolation2DTable<Type>::operator=
(
const interpolation2DTable<Type>& rhs
)
{
if (this == &rhs)
{
return;
}
static_cast<List<value_type>&>(*this) = rhs;
bounding_ = rhs.bounding_;
fileName_ = rhs.fileName_;
// reader_.reset(rhs.reader_.clone());
reader_.reset();
if (rhs.reader_.valid())
{
reader_.reset(rhs.reader_().clone().ptr()); // clone
}
}
template<class Type> template<class Type>
Type Foam::interpolation2DTable<Type>::operator() Type Foam::interpolation2DTable<Type>::operator()
( (

View File

@ -2,8 +2,11 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,17 +58,7 @@ class interpolation2DTable
: :
public List<Tuple2<scalar, List<Tuple2<scalar, Type>>>> public List<Tuple2<scalar, List<Tuple2<scalar, Type>>>>
{ {
public: // Private Data
// Public data types
//- Convenience typedef
typedef List<Tuple2<scalar, List<Tuple2<scalar, Type>>>> table;
private:
// Private data
//- Handling for out-of-bound values //- Handling for out-of-bound values
bounds::normalBounding bounding_; bounds::normalBounding bounding_;
@ -101,6 +94,15 @@ private:
public: public:
// Public Data Types
//- The element data type
typedef Tuple2<scalar, List<Tuple2<scalar, Type>>> value_type;
//- Convenience typedef
typedef List<Tuple2<scalar, List<Tuple2<scalar, Type>>>> table;
// Constructors // Constructors
//- Construct null //- Construct null
@ -120,8 +122,8 @@ public:
//- Construct by reading file name and outOfBounds from dictionary //- Construct by reading file name and outOfBounds from dictionary
interpolation2DTable(const dictionary& dict); interpolation2DTable(const dictionary& dict);
//- Construct copy //- Copy construct
interpolation2DTable(const interpolation2DTable& interpTable); interpolation2DTable(const interpolation2DTable& tbl);
// Member Functions // Member Functions
@ -139,6 +141,9 @@ public:
//- Return an element of constant List<Tuple2<scalar, Type>> //- Return an element of constant List<Tuple2<scalar, Type>>
const List<Tuple2<scalar, Type>>& operator[](const label) const; const List<Tuple2<scalar, Type>>& operator[](const label) const;
//- Copy assignment
void operator=(const interpolation2DTable<Type>& rhs);
//- Return an interpolated value //- Return an interpolated value
Type operator()(const scalar valueX, const scalar valueY) const; Type operator()(const scalar valueX, const scalar valueY) const;
}; };

View File

@ -2,8 +2,11 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,7 +60,7 @@ void Foam::interpolationTable<Type>::readTable()
template<class Type> template<class Type>
Foam::interpolationTable<Type>::interpolationTable() Foam::interpolationTable<Type>::interpolationTable()
: :
List<Tuple2<scalar, Type>>(), List<value_type>(),
bounding_(bounds::repeatableBounding::WARN), bounding_(bounds::repeatableBounding::WARN),
fileName_("fileNameIsUndefined"), fileName_("fileNameIsUndefined"),
reader_(nullptr) reader_(nullptr)
@ -72,7 +75,7 @@ Foam::interpolationTable<Type>::interpolationTable
const fileName& fName const fileName& fName
) )
: :
List<Tuple2<scalar, Type>>(values), List<value_type>(values),
bounding_(bounding), bounding_(bounding),
fileName_(fName), fileName_(fName),
reader_(nullptr) reader_(nullptr)
@ -82,7 +85,7 @@ Foam::interpolationTable<Type>::interpolationTable
template<class Type> template<class Type>
Foam::interpolationTable<Type>::interpolationTable(const fileName& fName) Foam::interpolationTable<Type>::interpolationTable(const fileName& fName)
: :
List<Tuple2<scalar, Type>>(), List<value_type>(),
bounding_(bounds::repeatableBounding::WARN), bounding_(bounds::repeatableBounding::WARN),
fileName_(fName), fileName_(fName),
reader_(new openFoamTableReader<Type>(dictionary())) reader_(new openFoamTableReader<Type>(dictionary()))
@ -94,7 +97,7 @@ Foam::interpolationTable<Type>::interpolationTable(const fileName& fName)
template<class Type> template<class Type>
Foam::interpolationTable<Type>::interpolationTable(const dictionary& dict) Foam::interpolationTable<Type>::interpolationTable(const dictionary& dict)
: :
List<Tuple2<scalar, Type>>(), List<value_type>(),
bounding_ bounding_
( (
bounds::repeatableBoundingNames.lookupOrFailsafe bounds::repeatableBoundingNames.lookupOrFailsafe
@ -114,17 +117,16 @@ Foam::interpolationTable<Type>::interpolationTable(const dictionary& dict)
template<class Type> template<class Type>
Foam::interpolationTable<Type>::interpolationTable Foam::interpolationTable<Type>::interpolationTable
( (
const interpolationTable& interpTable const interpolationTable& tbl
) )
: :
List<Tuple2<scalar, Type>>(interpTable), List<value_type>(tbl),
bounding_(interpTable.bounding_), bounding_(tbl.bounding_),
fileName_(interpTable.fileName_), fileName_(tbl.fileName_),
reader_(interpTable.reader_) // note: steals reader. Used in write(). reader_(tbl.reader_, false) // clone
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -315,6 +317,29 @@ Type Foam::interpolationTable<Type>::rateOfChange(const scalar value) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void Foam::interpolationTable<Type>::operator=
(
const interpolationTable<Type>& rhs
)
{
if (this == &rhs)
{
return;
}
static_cast<List<value_type>&>(*this) = rhs;
bounding_ = rhs.bounding_;
fileName_ = rhs.fileName_;
// reader_.reset(rhs.reader_.clone());
reader_.reset();
if (rhs.reader_.valid())
{
reader_.reset(rhs.reader_().clone().ptr()); // clone
}
}
template<class Type> template<class Type>
const Foam::Tuple2<Foam::scalar, Type>& const Foam::Tuple2<Foam::scalar, Type>&
Foam::interpolationTable<Type>::operator[](const label i) const Foam::interpolationTable<Type>::operator[](const label i) const

View File

@ -2,8 +2,10 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -102,6 +104,15 @@ class interpolationTable
public: public:
// Public Data Types
//- The element data type
typedef Tuple2<scalar, Type> value_type;
//- The mapped data type
typedef Type mapped_type;
// Constructors // Constructors
//- Construct null //- Construct null
@ -123,8 +134,8 @@ public:
// This is a specialised constructor used by patchFields // This is a specialised constructor used by patchFields
interpolationTable(const dictionary& dict); interpolationTable(const dictionary& dict);
//- Construct copy //- Copy construct
interpolationTable(const interpolationTable& interpTable); interpolationTable(const interpolationTable& tbl);
// Member Functions // Member Functions
@ -143,6 +154,9 @@ public:
// Member Operators // Member Operators
//- Copy assignment
void operator=(const interpolationTable<Type>& rhs);
//- Return an element of constant Tuple2<scalar, Type> //- Return an element of constant Tuple2<scalar, Type>
const Tuple2<scalar, Type>& operator[](const label) const; const Tuple2<scalar, Type>& operator[](const label) const;

View File

@ -48,7 +48,7 @@ void Foam::processorLduInterface::send
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
reinterpret_cast<const char*>(f.begin()), reinterpret_cast<const char*>(f.cdata()),
nBytes, nBytes,
tag(), tag(),
comm() comm()
@ -62,20 +62,23 @@ void Foam::processorLduInterface::send
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.data(),
nBytes, nBytes,
tag(), tag(),
comm() comm()
); );
resizeBuf(sendBuf_, nBytes); resizeBuf(sendBuf_, nBytes);
memcpy(sendBuf_.begin(), f.begin(), nBytes); std::memcpy
(
static_cast<void*>(sendBuf_.data()), f.cdata(), nBytes
);
OPstream::write OPstream::write
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
sendBuf_.begin(), sendBuf_.cdata(),
nBytes, nBytes,
tag(), tag(),
comm() comm()
@ -107,7 +110,7 @@ void Foam::processorLduInterface::receive
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
reinterpret_cast<char*>(f.begin()), reinterpret_cast<char*>(f.data()),
f.byteSize(), f.byteSize(),
tag(), tag(),
comm() comm()
@ -115,7 +118,10 @@ void Foam::processorLduInterface::receive
} }
else if (commsType == Pstream::commsTypes::nonBlocking) else if (commsType == Pstream::commsTypes::nonBlocking)
{ {
memcpy(f.begin(), receiveBuf_.begin(), f.byteSize()); std::memcpy
(
static_cast<void*>(f.data()), receiveBuf_.cdata(), f.byteSize()
);
} }
else else
{ {
@ -154,10 +160,10 @@ void Foam::processorLduInterface::compressedSend
label nFloats = nm1 + nlast; label nFloats = nm1 + nlast;
label nBytes = nFloats*sizeof(float); label nBytes = nFloats*sizeof(float);
const scalar *sArray = reinterpret_cast<const scalar*>(f.begin()); const scalar *sArray = reinterpret_cast<const scalar*>(f.cdata());
const scalar *slast = &sArray[nm1]; const scalar *slast = &sArray[nm1];
resizeBuf(sendBuf_, nBytes); resizeBuf(sendBuf_, nBytes);
float *fArray = reinterpret_cast<float*>(sendBuf_.begin()); float *fArray = reinterpret_cast<float*>(sendBuf_.data());
for (label i=0; i<nm1; i++) for (label i=0; i<nm1; i++)
{ {
@ -176,7 +182,7 @@ void Foam::processorLduInterface::compressedSend
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
sendBuf_.begin(), sendBuf_.cdata(),
nBytes, nBytes,
tag(), tag(),
comm() comm()
@ -190,7 +196,7 @@ void Foam::processorLduInterface::compressedSend
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.data(),
nBytes, nBytes,
tag(), tag(),
comm() comm()
@ -200,7 +206,7 @@ void Foam::processorLduInterface::compressedSend
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
sendBuf_.begin(), sendBuf_.cdata(),
nBytes, nBytes,
tag(), tag(),
comm() comm()
@ -246,7 +252,7 @@ void Foam::processorLduInterface::compressedReceive
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.data(),
nBytes, nBytes,
tag(), tag(),
comm() comm()
@ -260,9 +266,9 @@ void Foam::processorLduInterface::compressedReceive
} }
const float *fArray = const float *fArray =
reinterpret_cast<const float*>(receiveBuf_.begin()); reinterpret_cast<const float*>(receiveBuf_.cdata());
f.last() = reinterpret_cast<const Type&>(fArray[nm1]); f.last() = reinterpret_cast<const Type&>(fArray[nm1]);
scalar *sArray = reinterpret_cast<scalar*>(f.begin()); scalar *sArray = reinterpret_cast<scalar*>(f.data());
const scalar *slast = &sArray[nm1]; const scalar *slast = &sArray[nm1];
for (label i=0; i<nm1; i++) for (label i=0; i<nm1; i++)

View File

@ -72,12 +72,6 @@ Foam::patchIdentifier::patchIdentifier
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchIdentifier::~patchIdentifier()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::patchIdentifier::inGroup(const word& name) const bool Foam::patchIdentifier::inGroup(const word& name) const

View File

@ -73,6 +73,18 @@ class patchIdentifier
public: public:
// Generated Methods
//- Copy construct
patchIdentifier(const patchIdentifier&) = default;
//- Copy assignment
patchIdentifier& operator=(const patchIdentifier&) = default;
//- Destructor
virtual ~patchIdentifier() = default;
// Constructors // Constructors
//- Construct from components //- Construct from components
@ -100,10 +112,6 @@ public:
); );
//- Destructor
virtual ~patchIdentifier();
// Member Functions // Member Functions
//- Return the patch name //- Return the patch name

View File

@ -80,6 +80,15 @@ public:
static const word emptyType; static const word emptyType;
// Generated Methods
//- Copy construct
surfZoneIdentifier(const surfZoneIdentifier&) = default;
//- Copy assignment
surfZoneIdentifier& operator=(const surfZoneIdentifier&) = default;
// Constructors // Constructors
//- Construct null //- Construct null

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