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
(
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
)
)*recRootN
);
#include "globalProperties.H"

View File

@ -19,3 +19,10 @@
Kmesh K(mesh);
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
EXE = $(FOAM_USER_APPBIN)/sphereSurfactantFoam
EXE = $(FOAM_APPBIN)/sphereSurfactantFoam

View File

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

View File

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

View File

@ -17,4 +17,5 @@ EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-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"
<< exit(FatalError);
}
catch (Foam::error& fErr)
catch (const Foam::error& fErr)
{
Serr<< "Caught Foam error " << fErr << nl << endl;
}
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
<< "Error# 3"
<< exit(FatalError);
}
catch (Foam::error& fErr)
catch (const Foam::error& fErr)
{
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 };
Info<< "labelled:" << l1 << nl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
WarningInFunction
<< "Caught FatalError " << err << nl << endl;

View File

@ -601,9 +601,27 @@ int main(int argc, char *argv[])
<< " controlDict => " << findEtcFile("controlDict") << nl
<< " 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;
return 0;

View File

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

View File

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

View File

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

View File

@ -57,11 +57,23 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
word utilityName = argv[1];
Foam::autoPtr<Foam::helpType> utility
(
helpType::New(utilityName)
);
word utilityName(argv[1]);
autoPtr<helpType> utility;
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();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -728,7 +728,7 @@ int main(int argc, char *argv[])
)
{
Info << "Reconstructing FA fields" << nl << endl;
faMesh aMesh(mesh);
processorFaMeshes procFaMeshes(procMeshes.meshes());
@ -748,7 +748,7 @@ int main(int argc, char *argv[])
.reconstructFaAreaFields<sphericalTensor>(objects);
faReconstructor.reconstructFaAreaFields<symmTensor>(objects);
faReconstructor.reconstructFaAreaFields<tensor>(objects);
faReconstructor.reconstructFaEdgeFields<scalar>(objects);
}
else

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -36,8 +36,8 @@ License
template<class Type>
bool Foam::ensightCloud::writeCloudField
(
const Foam::IOField<Type>& field,
Foam::ensightFile& os
const IOField<Type>& field,
ensightFile& os
)
{
const bool exists = (returnReduce(field.size(), sumOp<label>()) > 0);
@ -125,14 +125,23 @@ bool Foam::ensightCloud::writeCloudField
template<class Type>
bool Foam::ensightCloud::writeCloudField
(
const Foam::IOobject& fieldObject,
IOobject& fieldObject,
const bool exists,
Foam::autoPtr<Foam::ensightFile>& output
autoPtr<ensightFile>& output
)
{
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);
fieldObject.readOpt() = rOpt;
writeCloudField(field, output.rawRef());
}

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -72,6 +72,8 @@ Note
#include "IOobjectList.H"
#include "IOmanip.H"
#include "OFstream.H"
#include "PstreamCombineReduceOps.H"
#include "HashTableOps.H"
#include "fvc.H"
#include "volFields.H"
@ -622,8 +624,13 @@ int main(int argc, char *argv[])
Info<< "Write " << cloudName << " (";
bool cloudExists = currentCloudDirs.found(cloudName);
reduce(cloudExists, orOp<bool>());
const bool cloudExists =
returnReduce
(
currentCloudDirs.found(cloudName),
orOp<bool>()
);
{
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& fieldType = fieldIter();
const word& fieldType = fieldIter.object();
IOobject fieldObject
(
@ -657,10 +664,13 @@ int main(int argc, char *argv[])
IOobject::MUST_READ
);
// cannot have field without cloud positions
bool fieldExists = cloudExists;
bool fieldExists = cloudExists; // No field without positions
if (cloudExists)
{
// Want MUST_READ (globally) and valid=false (locally),
// but that combination does not work.
// So check the header and sync globally
fieldExists =
fieldObject.typeHeaderOk<IOField<scalar>>(false);

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -146,6 +146,8 @@ Note
#include "pointMesh.H"
#include "volPointInterpolation.H"
#include "emptyPolyPatch.H"
#include "PstreamCombineReduceOps.H"
#include "HashTableOps.H"
#include "labelIOField.H"
#include "scalarIOField.H"
#include "sphericalTensorIOField.H"
@ -156,7 +158,6 @@ Note
#include "passiveParticle.H"
#include "stringOps.H"
#include "areaFields.H"
#include "meshSubsetHelper.H"
#include "readFields.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
};
// Supported cloud (lagrangian) field types
const wordHashSet cFieldTypes
{
labelIOField::typeName,
scalarIOField::typeName,
vectorIOField::typeName,
symmTensorIOField::typeName,
tensorIOField::typeName
};
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timei], timei);
@ -879,7 +894,7 @@ int main(int argc, char *argv[])
{
aMeshPtr.reset(new faMesh(meshRef.baseMesh()));
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
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.
mkDir(fvPath/cloud::prefix/cloudName);
@ -1459,50 +1474,84 @@ int main(int argc, char *argv[])
Info<< " Lagrangian: "
<< relativeName(runTime, outputName) << nl;
IOobjectList sprayObjs
IOobjectList cloudObjs
(
mesh,
runTime.timeName(),
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));
Info<< " labels :";
print(Info, labelNames);
// Limited to types that we explicitly handle
HashTable<wordHashSet> cloudFields = cloudObjs.classes();
cloudFields.retain(cFieldTypes);
wordList scalarNames(sprayObjs.names(scalarIOField::typeName));
Info<< " scalars :";
print(Info, scalarNames);
// The number of cloud fields (locally)
label nCloudFields = 0;
forAllConstIters(cloudFields, citer)
{
nCloudFields += citer.object().size();
}
wordList vectorNames(sprayObjs.names(vectorIOField::typeName));
Info<< " vectors :";
print(Info, vectorNames);
wordList sphereNames
(
sprayObjs.names
// Ensure all processes have identical information
if (Pstream::parRun())
{
Pstream::mapCombineGather
(
sphericalTensorIOField::typeName
)
);
Info<< " sphTensors :";
print(Info, sphereNames);
cloudFields,
HashSetPlusEqOp<word>()
);
Pstream::mapCombineScatter(cloudFields);
}
wordList symmNames
// Build lists of field names and echo some information
const wordList labelNames
(
sprayObjs.names
(
symmTensorIOField::typeName
)
cloudFields(labelIOField::typeName).sortedToc()
);
Info<< " symmTensors :";
print(Info, symmNames);
print(" labels :", Info, labelNames);
wordList tensorNames(sprayObjs.names(tensorIOField::typeName));
Info<< " tensors :";
print(Info, tensorNames);
const wordList scalarNames
(
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
(
@ -1512,22 +1561,14 @@ int main(int argc, char *argv[])
fmtType
);
// Write number of fields
writer.beginParcelData
(
labelNames.size()
+ scalarNames.size()
+ vectorNames.size()
+ sphereNames.size()
+ symmNames.size()
+ tensorNames.size()
);
// Write number of fields (on this processor)
writer.beginParcelData(nCloudFields);
// Fields
writer.writeIOField<label>(labelNames);
writer.writeIOField<scalar>(scalarNames);
writer.writeIOField<vector>(vectorNames);
writer.writeIOField<sphericalTensor>(sphereNames);
writer.writeIOField<sphericalTensor>(sphNames);
writer.writeIOField<symmTensor>(symmNames);
writer.writeIOField<tensor>(tensorNames);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -65,7 +65,8 @@ void Foam::vtk::lagrangianWriter::writePoints()
}
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)
.openDataArray<float,3>(vtk::dataArrayAttr::POINTS)
@ -219,16 +220,12 @@ Foam::vtk::lagrangianWriter::lagrangianWriter
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtk::lagrangianWriter::~lagrangianWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtk::lagrangianWriter::beginParcelData(label nFields)
{
if (!nParcels_) return; // Skip if there are no parcels
const vtk::fileTag dataType =
(
useVerts_
@ -249,6 +246,8 @@ void Foam::vtk::lagrangianWriter::beginParcelData(label nFields)
void Foam::vtk::lagrangianWriter::endParcelData()
{
if (!nParcels_) return; // Skip if there are no parcels
const vtk::fileTag dataType =
(
useVerts_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,9 +3,11 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2008-2011, 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2011-2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
@ -46,7 +48,7 @@
printHelp() {
cat<<USAGE
Usage: foamEtcFile [OPTION] fileName
Usage: foamEtcFile [OPTION] fileName [-- args]
foamEtcFile [OPTION] [-list|-list-test] [fileName]
options:
@ -56,10 +58,15 @@ options:
-mode=MODE Any combination of u(user), g(group), o(other)
-prefix=DIR Specify an alternative installation prefix
-version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
-csh Produce output suitable for a csh or sh 'eval'
-csh-verbose As per -csh with additional verbosity
-sh Produce output suitable for a csh or sh 'eval'
-sh-verbose As per -sh with additional verbosity
-csh Produce 'source FILE' output for a csh eval
-sh Produce '. FILE' output for a sh eval
-csh-verbose As per -csh, 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
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
-help Print the usage
@ -81,7 +88,6 @@ USAGE
exit 0 # A clean exit
}
unset optQuiet optSilent
# Report error and exit
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'
unset optAll optList optShell optVersion
unset shellOutput verboseOutput
unset optAll optConfig optList optVersion
# Parse options
while [ "$#" -gt 0 ]
@ -192,21 +255,36 @@ do
-h | -help*)
printHelp
;;
-show-api)
# Show API and exit
getApi
exit $?
;;
-show-patch)
# Show patch level and exit
getPatchLevel
exit $?
;;
-a | -all)
optAll=true
unset optShell
unset shellOutput verboseOutput
;;
-l | -list)
optList=true
unset optShell
;;
-list-test)
optList='test'
unset optShell
;;
-csh | -sh | -csh-verbose | -sh-verbose)
optShell="${1#-}"
unset optAll
-csh | -sh)
shellOutput="${1#-}"
unset verboseOutput
;;
-csh-verbose | -sh-verbose)
shellOutput="${1#-}"
verboseOutput="source " # Report: "source FILE"
;;
-config)
optConfig=true
;;
-mode=[ugo]*)
optMode="${1#*=}"
@ -260,9 +338,33 @@ do
shift
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" ]
then
setVersion $optVersion
@ -285,12 +387,6 @@ groupDir="${WM_PROJECT_SITE:-$prefixDir/site}"
# eval echo "$i=\$$i" 1>&2
# 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:
unset dirList
case "$optMode" in (*u*) # (U)ser
@ -309,27 +405,61 @@ case "$optMode" in (*o*) # (O)ther == shipped
esac
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
#
exitCode=0
if [ -n "$optList" ]
then
# List directories, or potential file locations
[ "$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
# Test for directory or file too?
if [ "$optList" = "test" ]
then
exitCode=2 # Fallback to a general error (file not found)
if [ "$nArgs" -eq 1 ]
then
for dir
@ -352,6 +482,7 @@ then
done
fi
else
exitCode=0 # OK, already verified that $# != 0
for dir
do
echo "$dir${fileName:+/}$fileName"
@ -362,35 +493,44 @@ else
[ "$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
do
if [ -f "$dir/$fileName" ]
resolved="$dir/$fileName"
if [ -f "$resolved" ]
then
exitCode=0
[ -n "$optQuiet" ] && break
case "$optShell" in
(*verbose)
echo "Using: $dir/$fileName" 1>&2
;;
esac
case "$optShell" in
csh*)
echo "source $dir/$fileName"
exitCode=0 # OK
if [ -n "$optQuiet" ]
then
break
;;
sh*)
echo ". $dir/$fileName"
break
;;
*)
echo "$dir/$fileName"
[ -n "$optAll" ] || break
;;
esac
elif [ -n "$verboseOutput" ]
then
echo "$verboseOutput$resolved" 1>&2
fi
if [ -n "$shellOutput" ]
then
echo "$shellOutput$resolved $evalArgs"
else
echo "$resolved"
fi
[ -n "$optAll" ] || break
fi
done

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / 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
# 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'
-cgal ver specify 'cgal_version'
-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'
-fftw VER specify 'fffw_version'
-fftw-path DIR specify 'FFTW_ARCH_PATH'
@ -325,9 +326,17 @@ do
;;
-clang)
# Replace clang_version=...
# Replace default_clang_version=...
[ "$#" -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
shift
;;
@ -466,19 +475,19 @@ do
gmp-[4-9]* | gmp-system)
# gcc-related package
replace etc/config.sh/compiler gmp_version "$1"
replace etc/config.sh/compiler default_gmp_version "$1"
adjusted=true
;;
mpfr-[2-9]* | mpfr-system)
# gcc-related package
replace etc/config.sh/compiler mpfr_version "$1"
replace etc/config.sh/compiler default_mpfr_version "$1"
adjusted=true
;;
mpc-[0-9]* | mpc-system)
# gcc-related package
replace etc/config.sh/compiler mpc_version "$1"
replace etc/config.sh/compiler default_mpc_version "$1"
adjusted=true
;;

View File

@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=plus
export WM_PROJECT_VERSION=v1712
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# \- 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
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/compiler
@ -20,67 +22,117 @@
switch ("$WM_COMPILER_TYPE")
case ThirdParty:
# Default versions of GMP, MPFR, MPC - override as necessary
set gmp_version=gmp-system
set mpfr_version=mpfr-system
set mpc_version=mpc-system
# Default versions (CLANG, GCC, GMP, MPFR, MPC) - override as necessary
set default_clang_version=llvm-3.7.1
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")
case Gcc:
case Gcc48:
set gcc_version="$default_gcc_version"
breaksw
case Gcc48*:
set gcc_version=gcc-4.8.5
breaksw
case Gcc49:
case Gcc49*:
set gcc_version=gcc-4.9.4
breaksw
case Gcc51:
case Gcc51*:
set gcc_version=gcc-5.1.0
breaksw
case Gcc52:
case Gcc52*:
set gcc_version=gcc-5.2.0
breaksw
case Gcc53:
case Gcc53*:
set gcc_version=gcc-5.3.0
breaksw
case Gcc54:
case Gcc54*:
set gcc_version=gcc-5.4.0
breaksw
case Gcc55:
case Gcc55*:
set gcc_version=gcc-5.5.0
breaksw
case Gcc61:
case Gcc61*:
set gcc_version=gcc-6.1.0
breaksw
case Gcc62:
case Gcc62*:
set gcc_version=gcc-6.2.0
breaksw
case Gcc63:
case Gcc63*:
set gcc_version=gcc-6.3.0
breaksw
case Gcc64:
case Gcc64*:
set gcc_version=gcc-6.4.0
breaksw
case Gcc71:
case Gcc65*:
set gcc_version=gcc-6.5.0
breaksw
case Gcc71*:
set gcc_version=gcc-7.1.0
breaksw
case Gcc72:
case Gcc72*:
set gcc_version=gcc-7.2.0
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:
set clang_version="$default_clang_version"
breaksw
case Clang37*:
set clang_version=llvm-3.7.1
breaksw
case Clang38:
case Clang38*:
set clang_version=llvm-3.8.1
breaksw
case Clang39:
case Clang39*:
set clang_version=llvm-3.9.1
breaksw
case Clang40:
case Clang40*:
set clang_version=llvm-4.0.1
breaksw
case Clang50:
set clang_version=llvm-5.0.0
case Clang50*:
set clang_version=llvm-5.0.2
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:
/bin/cat << UNKNOWN_COMPILER
===============================================================================
@ -92,7 +144,11 @@ Please check your settings
UNKNOWN_COMPILER
breaksw
endsw
breaksw
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
# \\ / O peration |
# \\ / 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
# 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
unsetenv FOAM_API
unsetenv FOAM_APPBIN
unsetenv FOAM_APP
unsetenv FOAM_CODE_TEMPLATES

View File

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

View File

@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
setenv WM_PROJECT OpenFOAM
setenv WM_PROJECT_VERSION plus
setenv WM_PROJECT_VERSION v1712
# [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation.
# \- 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 sixDoFRigidBodyMotion
wmake $targetType sixDoFRigidBodyState
wmake $targetType rigidBodyDynamics
wmake $targetType rigidBodyMeshMotion

View File

@ -57,10 +57,10 @@ Description
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <dlfcn.h>
#include <link.h>
#include <netinet/in.h>
#ifdef USE_RANDOM
#include <climits>
#if INT_MAX != 2147483647
@ -708,12 +708,12 @@ double Foam::highResLastModified(const fileName& name, const bool followLink)
// Ignore an empty name
if (!name.empty())
{
fileStat fileStatus(name);
fileStat fileStatus(name, followLink);
if (fileStatus.isValid())
{
return
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
memset(reinterpret_cast<char *>(&destAddr), '\0', sizeof(destAddr));
std::memset(reinterpret_cast<char *>(&destAddr), '\0', sizeof(destAddr));
destAddr.sin_family = AF_INET;
destAddr.sin_port = htons(ushort(destPort));
destAddr.sin_addr.s_addr = addr;

View File

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

View File

@ -784,8 +784,8 @@ public:
// Constructors
//- Construct null (end iterator)
inline iterator() {}
//- Default construct (end iterator)
iterator() = default;
//- Copy construct from similar access type
inline explicit iterator(const Iterator<false>& iter)
@ -828,8 +828,11 @@ public:
// Constructors
//- Construct null (end iterator)
inline const_iterator() {}
//- Default construct (end iterator)
const_iterator() = default;
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Copy construct from similar access type
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:
//- Copy construct
iterator(const iterator&) = default;
//- Construct for a given DLListBase and link
inline iterator(DLListBase&, link*);
@ -240,6 +243,9 @@ public:
//- Construct from a non-const iterator
inline const_iterator(const DLListBase::iterator& iter);
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Currently pointing at a valid entry
inline bool found() const;
@ -277,6 +283,9 @@ public:
//- Construct for a given DLListBase and 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
inline bool found() const;

View File

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

View File

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

View File

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

View File

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

View File

@ -80,6 +80,12 @@ public:
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

View File

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

View File

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

View File

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

View File

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

View File

@ -171,10 +171,9 @@ Foam::IOobjectList::IOobjectList
// Use object with local scope and current instance (no searching)
ok = objectPtr->typeHeaderOk<IOList<label>>(false, false);
}
catch (Foam::IOerror& err)
catch (const Foam::IOerror& err)
{
Warning
<< err << nl << endl;
Warning << err << nl << endl;
}
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 * * * * * * * * * * * * * //
template<class T, class BaseType>

View File

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

View File

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

View File

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

View File

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

View File

@ -61,6 +61,9 @@ public:
// Constructors
//- Default copy construct
GlobalIOList(const GlobalIOList&) = default;
//- Construct from IOobject
GlobalIOList(const IOobject&);
@ -75,7 +78,7 @@ public:
//- Destructor
virtual ~GlobalIOList();
virtual ~GlobalIOList() = default;
// 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 * * * * * * * * * * * * * //
template<class Type>

View File

@ -61,6 +61,9 @@ public:
// Constructors
//- Default copy construct
IOField(const IOField&) = default;
//- Construct from IOobject
IOField(const IOobject&);
@ -78,7 +81,7 @@ public:
//- Destructor
virtual ~IOField();
virtual ~IOField() = default;
// 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 * * * * * * * * * * * * * //
template<class T>

View File

@ -62,6 +62,9 @@ public:
// Constructors
//- Default copy construct
IOList(const IOList&) = default;
//- Construct from IOobject
IOList(const IOobject&);
@ -76,7 +79,7 @@ public:
//- Destructor
virtual ~IOList();
virtual ~IOList() = default;
// 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 * * * * * * * * * * * * * //
template<class T>

View File

@ -63,6 +63,9 @@ public:
// Constructors
//- Default copy construct
IOMap(const IOMap&) = default;
//- Construct from IOobject
IOMap(const IOobject&);
@ -77,7 +80,7 @@ public:
//- Destructor
virtual ~IOMap();
virtual ~IOMap() = default;
// 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 * * * * * * * * * * * * * //
template<class T>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,14 +59,17 @@ class OSstream
std::ostream& os_;
// Private Member Functions
public:
// Generated Methods
//- Copy construct
OSstream(const OSstream&) = default;
//- Disallow default bitwise assignment
void operator=(const OSstream&) = delete;
public:
// Constructors
//- 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
void print(Ostream& os) const;
//- Print stream description to Ostream
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())
{
tokens.first().lineNumber();
return tokens.first().lineNumber();
}
return -1;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -63,6 +63,12 @@ public:
TypeName("value");
// Generated Methods
//- Copy construct
valuePointPatchField(const valuePointPatchField&) = default;
// Constructors
//- 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
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
if (rootPath_.isAbsolute())
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / 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
This file is part of OpenFOAM.
@ -57,6 +57,8 @@ Description
may be present for some solvers or utilities.
Environment variables set by argList or by Time:
- \par FOAM_API
The value of the OPENFOAM compiler define
- \par FOAM_CASE
The path of the global case.
It is the same for serial and parallel jobs.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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