Compare commits
153 Commits
feature-re
...
feature-ld
| Author | SHA1 | Date | |
|---|---|---|---|
| 82c405882d | |||
| c46216e645 | |||
| 7da2a5e096 | |||
| 33b2e0df3d | |||
| 8d4ad0438d | |||
| a6cbfcb9ba | |||
| 510ffb3322 | |||
| 39f6618d3a | |||
| 6be31e3feb | |||
| af0b20779e | |||
| cad325f41f | |||
| de90b2b28e | |||
| 8ac0548c6a | |||
| c8db0d135f | |||
| b053e2214c | |||
| 0c20256be5 | |||
| ae555ec744 | |||
| ee955b19e5 | |||
| 5b61013cf5 | |||
| 1fca0d8d23 | |||
| 60f3d416a6 | |||
| 402bc0fef0 | |||
| 437ea6917a | |||
| ea9d424e24 | |||
| 6580f1bbef | |||
| 142fc55f44 | |||
| f67406ddb2 | |||
| e479f842b3 | |||
| b69ceb54a7 | |||
| 9e8fd66ed2 | |||
| eabafe5f9e | |||
| 9024441566 | |||
| c3c23c3cb2 | |||
| 638d1fe8f6 | |||
| fde3904796 | |||
| 698ff5eedc | |||
| efb187e3f7 | |||
| 8c98906780 | |||
| d7f7267165 | |||
| f19883c0c6 | |||
| aaf4f40bf7 | |||
| f6dfa76f6d | |||
| 90d62c33e4 | |||
| 3ef0d19ef4 | |||
| 0343d3d7e9 | |||
| ada3d1c77e | |||
| 86da88cdfd | |||
| 391c1eaa40 | |||
| 37a6fc8db3 | |||
| 96821f70cd | |||
| cac0bf856b | |||
| adf6869bba | |||
| 563456087c | |||
| 41b30af01a | |||
| f6ccd77d8c | |||
| 65bc8d1140 | |||
| b25e1486de | |||
| 810d0c72ee | |||
| 34b4770949 | |||
| 85b405206d | |||
| 0f155daf86 | |||
| 98c25d163a | |||
| e5267bf81d | |||
| 79fafda22c | |||
| f5f93e81d8 | |||
| 29f7fcc515 | |||
| 9a5125111e | |||
| 8624d65c5a | |||
| 27e57c29f7 | |||
| e09298092d | |||
| 49e26dd7d2 | |||
| 31a7c2a9cd | |||
| c7f30a0989 | |||
| bdf77bbdd1 | |||
| 939c335504 | |||
| e9054ec636 | |||
| ed5dee71a4 | |||
| e6f4ae927a | |||
| 8ed6a61106 | |||
| 78cc5f8676 | |||
| f7c7fa94a3 | |||
| b96cef1339 | |||
| 9cf26ac7c5 | |||
| 9833e614da | |||
| 6aa608cf33 | |||
| 53e9c8eb5a | |||
| 8fc4501c46 | |||
| 29c70e9bbb | |||
| 6abbcb3eac | |||
| 2880a54373 | |||
| c0adccf826 | |||
| 643763d258 | |||
| fc6239d96e | |||
| e6697edb52 | |||
| adbcd3a19f | |||
| adcf41bd13 | |||
| 30a2fa4b27 | |||
| 89ddc271c7 | |||
| ba45fb2cba | |||
| f6ee1811e7 | |||
| 098aec4962 | |||
| 889bc171d9 | |||
| c233961d45 | |||
| 9194cd5203 | |||
| 925a2e724b | |||
| f29eb55cee | |||
| b9b011f5ea | |||
| bc2b469f9d | |||
| 2c2310dc17 | |||
| 70b55be684 | |||
| c1a04abd96 | |||
| aeef96251f | |||
| b19e767b8f | |||
| f078643f8c | |||
| f459b11e24 | |||
| bcf8a48c68 | |||
| 1804d3fed5 | |||
| 55af2fc2c6 | |||
| ccb0fd9cf0 | |||
| 6712548137 | |||
| 27f4cee78d | |||
| 19f7825a04 | |||
| aaeddba466 | |||
| fd9670d4a3 | |||
| fbd7b78999 | |||
| 141403ed98 | |||
| d710bb6595 | |||
| bb7d8d0f4d | |||
| 39d244ad91 | |||
| 1af0380edc | |||
| 3d889b6dbf | |||
| bb771a3caf | |||
| 92d52243af | |||
| 96735dce20 | |||
| 4e59ad9d8d | |||
| 28800dcbbc | |||
| effd69a005 | |||
| 9c9d6c64b5 | |||
| adb01bddf4 | |||
| e62a260bdd | |||
| 8e887d3395 | |||
| 168c13c514 | |||
| ba93392f69 | |||
| 53e8f2a807 | |||
| ba95b89e5f | |||
| fd82f3e47a | |||
| 8638d82325 | |||
| 79e110aeb0 | |||
| a78e79908b | |||
| e8aa3aad25 | |||
| 5a121119e6 | |||
| c45c649d15 | |||
| 9371c517b9 |
@ -49,7 +49,7 @@
|
||||
|
||||
<!--
|
||||
Providing details of your set-up can help us identify any issues, e.g.
|
||||
OpenFOAM version : v1806|v1812|v1906|v1912|v2006|v2012|v2106 etc
|
||||
OpenFOAM version : v2112|v2106|v2012|v2006|v1912|v1906 etc
|
||||
Operating system : ubuntu|openSUSE|centos etc
|
||||
Hardware info : any info that may help?
|
||||
Compiler : gcc|intel|clang etc
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=2108
|
||||
api=2109
|
||||
patch=0
|
||||
|
||||
14
README.md
14
README.md
@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
|
||||
|
||||
If OpenFOAM has already been compiled on your system, simply source
|
||||
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
|
||||
For example, for the OpenFOAM-v2106 version:
|
||||
For example, for the OpenFOAM-v2112 version:
|
||||
```
|
||||
source /installation/path/OpenFOAM-v2106/etc/bashrc
|
||||
source /installation/path/OpenFOAM-v2112/etc/bashrc
|
||||
```
|
||||
|
||||
## Compiling OpenFOAM
|
||||
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
|
||||
to the OpenFOAM directory. For example,
|
||||
```
|
||||
/path/parent
|
||||
|-- OpenFOAM-v2106
|
||||
\-- ThirdParty-v2106
|
||||
|-- OpenFOAM-v2112
|
||||
\-- ThirdParty-v2112
|
||||
```
|
||||
There are, however, many cases where this simple convention is inadequate:
|
||||
|
||||
@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
|
||||
operating system or cluster installation provides it)
|
||||
|
||||
* When we have changed the OpenFOAM directory name to some arbitrary
|
||||
directory name, e.g. openfoam-sandbox2106, etc..
|
||||
directory name, e.g. openfoam-sandbox2112, etc..
|
||||
|
||||
* When we would like any additional 3rd party software to be located
|
||||
inside of the OpenFOAM directory to ensure that the installation is
|
||||
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
|
||||
2. PREFIX/ThirdParty-VERSION
|
||||
* this corresponds to the traditional approach
|
||||
3. PREFIX/ThirdParty-vAPI
|
||||
* allows for an updated value of VERSION, *eg*, `v2106-myCustom`,
|
||||
* allows for an updated value of VERSION, *eg*, `v2112-myCustom`,
|
||||
without requiring a renamed ThirdParty. The API value would still
|
||||
be `2106` and the original `ThirdParty-v2106/` would be found.
|
||||
be `2112` and the original `ThirdParty-v2112/` would be found.
|
||||
4. PREFIX/ThirdParty-API
|
||||
* same as the previous example, but using an unadorned API value.
|
||||
5. PREFIX/ThirdParty-common
|
||||
|
||||
@ -138,13 +138,6 @@ public:
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PDRDragModel();
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
// Update tho boundary values of the reciprocal time-step
|
||||
// Update the boundary values of the reciprocal time-step
|
||||
rDeltaT.correctBoundaryConditions();
|
||||
|
||||
Info<< "Flow time scale min/max = "
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#include "createRDeltaT.H"
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
|
||||
@ -81,6 +81,8 @@ Note
|
||||
#include "pimpleControl.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvOptions.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -107,6 +109,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
if (!LTS)
|
||||
{
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
@ -114,8 +122,16 @@ int main(int argc, char *argv[])
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readDyMControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
#include "setRDeltaT.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
}
|
||||
|
||||
++runTime;
|
||||
|
||||
|
||||
69
applications/solvers/incompressible/pimpleFoam/setRDeltaT.H
Normal file
69
applications/solvers/incompressible/pimpleFoam/setRDeltaT.H
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
volScalarField& rDeltaT = trDeltaT.ref();
|
||||
|
||||
const dictionary& pimpleDict = pimple.dict();
|
||||
|
||||
scalar maxCo
|
||||
(
|
||||
pimpleDict.getOrDefault<scalar>("maxCo", 0.8)
|
||||
);
|
||||
|
||||
scalar rDeltaTSmoothingCoeff
|
||||
(
|
||||
pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
|
||||
);
|
||||
|
||||
scalar rDeltaTDampingCoeff
|
||||
(
|
||||
pimpleDict.getOrDefault<scalar>("rDeltaTDampingCoeff", 1.0)
|
||||
);
|
||||
|
||||
scalar maxDeltaT
|
||||
(
|
||||
pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
|
||||
);
|
||||
|
||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||
|
||||
// Set the reciprocal time-step from the local Courant number
|
||||
rDeltaT.ref() = max
|
||||
(
|
||||
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
|
||||
fvc::surfaceSum(mag(phi))()()
|
||||
/((2*maxCo)*mesh.V())
|
||||
);
|
||||
|
||||
// Update the boundary values of the reciprocal time-step
|
||||
rDeltaT.correctBoundaryConditions();
|
||||
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
if (rDeltaTSmoothingCoeff < 1.0)
|
||||
{
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
// - only increase at a fraction of old time scale
|
||||
if
|
||||
(
|
||||
rDeltaTDampingCoeff < 1.0
|
||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
rDeltaT =
|
||||
rDeltaT0
|
||||
*max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
|
||||
|
||||
Info<< "Damped flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
|
||||
)
|
||||
:
|
||||
fv::cellSetOption(sourceName, modelType, dict, mesh),
|
||||
alphaSolidT_(Function1<scalar>::New("alphaSolidT", coeffs_)),
|
||||
alphaSolidT_(Function1<scalar>::New("alphaSolidT", coeffs_, &mesh)),
|
||||
L_("L", dimEnergy/dimMass, coeffs_),
|
||||
relax_(coeffs_.getOrDefault("relax", 0.9)),
|
||||
Cu_(coeffs_.getOrDefault<scalar>("Cu", 100000)),
|
||||
|
||||
@ -33,7 +33,7 @@ bool Foam::fv::VoFSolidificationMeltingSource::read(const dictionary& dict)
|
||||
{
|
||||
if (fv::cellSetOption::read(dict))
|
||||
{
|
||||
alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_);
|
||||
alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_, &mesh_);
|
||||
coeffs_.readEntry("L", L_);
|
||||
coeffs_.readIfPresent("relax", relax_);
|
||||
coeffs_.readIfPresent("Cu", Cu_);
|
||||
|
||||
@ -11,7 +11,6 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
|
||||
@ -343,12 +343,12 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
|
||||
focalLaserPosition_
|
||||
(
|
||||
Function1<point>::New("focalLaserPosition", *this)
|
||||
Function1<point>::New("focalLaserPosition", *this, &mesh_)
|
||||
),
|
||||
|
||||
laserDirection_
|
||||
(
|
||||
Function1<vector>::New("laserDirection", *this)
|
||||
Function1<vector>::New("laserDirection", *this, &mesh_)
|
||||
),
|
||||
|
||||
focalLaserRadius_(get<scalar>("focalLaserRadius")),
|
||||
@ -359,7 +359,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
|
||||
sigma_(0),
|
||||
I0_(0),
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this, &mesh_)),
|
||||
powerDistribution_(),
|
||||
|
||||
reflectionSwitch_(false),
|
||||
@ -441,11 +441,11 @@ Foam::radiation::laserDTRM::laserDTRM
|
||||
|
||||
focalLaserPosition_
|
||||
(
|
||||
Function1<point>::New("focalLaserPosition", *this)
|
||||
Function1<point>::New("focalLaserPosition", *this, &mesh_)
|
||||
),
|
||||
laserDirection_
|
||||
(
|
||||
Function1<vector>::New("laserDirection", *this)
|
||||
Function1<vector>::New("laserDirection", *this, &mesh_)
|
||||
),
|
||||
|
||||
focalLaserRadius_(get<scalar>("focalLaserRadius")),
|
||||
@ -456,7 +456,7 @@ Foam::radiation::laserDTRM::laserDTRM
|
||||
|
||||
sigma_(0),
|
||||
I0_(0),
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this, &mesh_)),
|
||||
powerDistribution_(),
|
||||
|
||||
reflectionSwitch_(false),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / O peration | Version: v2112 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -138,4 +138,53 @@ cosine6
|
||||
}
|
||||
|
||||
|
||||
expr1
|
||||
{
|
||||
type expression;
|
||||
|
||||
functions<scalar>
|
||||
{
|
||||
func1 constant 21;
|
||||
func2 constant 15;
|
||||
sin constant -5;
|
||||
}
|
||||
|
||||
functions<vector>
|
||||
{
|
||||
vfunc3 constant (1 2 3);
|
||||
vfunc4 constant (3 2 1);
|
||||
}
|
||||
|
||||
expression
|
||||
#{
|
||||
100 * fn:vfunc3() & fn:vfunc4() * (vector::z) .z()
|
||||
* (fn:sin(arg()) + fn:func1(fn:func2()))
|
||||
#};
|
||||
}
|
||||
|
||||
|
||||
expr2
|
||||
{
|
||||
type expression;
|
||||
|
||||
functions<scalar>
|
||||
{
|
||||
func1 constant 21;
|
||||
func2 constant 15;
|
||||
sin constant -5;
|
||||
}
|
||||
|
||||
functions<vector>
|
||||
{
|
||||
vfunc3 constant (1 2 3);
|
||||
vfunc4 constant (3 2 1);
|
||||
}
|
||||
|
||||
expression
|
||||
#{
|
||||
(fn:vfunc3() & vector::z) * arg()
|
||||
#};
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -121,6 +121,9 @@ int main(int argc, char *argv[])
|
||||
argList::addArgument("label");
|
||||
argList::noMandatoryArgs();
|
||||
|
||||
argList::addDryRunOption("Just for testing");
|
||||
argList::addVerboseOption("Increase verbosity");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
Pout<< "command-line ("
|
||||
@ -133,6 +136,10 @@ int main(int argc, char *argv[])
|
||||
<< "globalPath: " << args.globalPath() << nl
|
||||
<< nl;
|
||||
|
||||
Pout<< "dry-run: " << args.dryRun()
|
||||
<< " verbose: " << args.verbose() << nl;
|
||||
|
||||
|
||||
if (args.found("relative"))
|
||||
{
|
||||
Pout<< "input path: " << args["relative"] << nl
|
||||
|
||||
@ -57,9 +57,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addAllRegionOptions.H"
|
||||
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"more information about decomposition"
|
||||
);
|
||||
|
||||
@ -71,7 +70,6 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
|
||||
const auto decompFile = args.get<fileName>(1);
|
||||
const bool verbose = args.found("verbose");
|
||||
|
||||
// Set time from database
|
||||
#include "createTime.H"
|
||||
@ -146,7 +144,7 @@ int main(int argc, char *argv[])
|
||||
nDomains
|
||||
);
|
||||
|
||||
if (verbose)
|
||||
if (args.verbose())
|
||||
{
|
||||
info.printDetails(Info);
|
||||
Info<< nl;
|
||||
|
||||
@ -18,6 +18,8 @@ FoamFile
|
||||
#sinclude "$FOAM_CASE/someUnknownFile"
|
||||
#includeIfPresent "$FOAM_CASE/someUnknownFile-$FOAM_CASENAME"
|
||||
|
||||
zeroVelocity uniform (0 0 0);
|
||||
|
||||
internalField uniform 1;
|
||||
|
||||
// supply defaults
|
||||
@ -48,7 +50,7 @@ x 5;
|
||||
varName x;
|
||||
|
||||
|
||||
//Indirection for keys
|
||||
// Indirection for keys
|
||||
key inlet_9;
|
||||
|
||||
|
||||
@ -67,13 +69,17 @@ boundaryField
|
||||
inlet_5 { $inactive }
|
||||
inlet_6a { $...inactive } // Relative scoping - fairly horrible to use
|
||||
inlet_6b { $^inactive } // Absolute scoping
|
||||
inlet_6c { key ${/key}; } // Absolute scoping
|
||||
|
||||
inlet_7 { ${inactive}} // Test variable expansion
|
||||
inlet_8 { $inactive }
|
||||
|
||||
// Variable expansion for a keyword
|
||||
${key} { $inactive }
|
||||
|
||||
#include "testDictInc"
|
||||
|
||||
outlet
|
||||
outletBase
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
@ -83,16 +89,36 @@ boundaryField
|
||||
y 6;
|
||||
}
|
||||
|
||||
// this should have no effect
|
||||
outlet
|
||||
{
|
||||
$outletBase
|
||||
}
|
||||
|
||||
Default_Boundary_Region
|
||||
{
|
||||
valueOut $zeroVelocity;
|
||||
}
|
||||
|
||||
// this should have no effect (not in scope)
|
||||
#remove inactive
|
||||
|
||||
inlet_7 { ${${varType}}} // Test indirection/recursive expansion
|
||||
inlet_8 { $active }
|
||||
// But this should work to remove things in different scopes
|
||||
#remove "/zeroVelocity"
|
||||
|
||||
inlet_7 { ${inactive} } // Test variable expansion
|
||||
inlet_8 { $inactive }
|
||||
|
||||
inlet_7a { ${${varType}} } // Test indirection/recursive expansion
|
||||
inlet_7b { ${${varType}} } // Test indirection/recursive expansion
|
||||
|
||||
#overwrite inlet_8 { type none; }
|
||||
}
|
||||
|
||||
|
||||
// No patterns with scoped removal
|
||||
// #remove "/boundaryField/outletB.*"
|
||||
#remove "/boundaryField/outletBase"
|
||||
|
||||
#include "testDict2"
|
||||
|
||||
verbatim #{
|
||||
@ -123,10 +149,25 @@ baz
|
||||
$active
|
||||
}
|
||||
|
||||
// this should work
|
||||
#remove active
|
||||
// This should work
|
||||
#remove x
|
||||
|
||||
// this should work too
|
||||
// This should work too
|
||||
#remove ( bar baz )
|
||||
|
||||
// Remove a sub-dictionary entry
|
||||
#remove "/anynumber.*/value"
|
||||
|
||||
// Removal does not auto-vivify
|
||||
#remove "/nonExistentDict/value"
|
||||
|
||||
// Add into existing dictionary
|
||||
"/anynumber.*/someValue" 100;
|
||||
|
||||
// Auto-vivify
|
||||
// - but currently cannot auto-vivify entries with dictionary patterns
|
||||
"/abd/someValue" 100;
|
||||
"/def/'someValue.*" 100;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
3
applications/test/exprTraits/Make/files
Normal file
3
applications/test/exprTraits/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-exprTraits.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-exprTraits
|
||||
2
applications/test/exprTraits/Make/options
Normal file
2
applications/test/exprTraits/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
108
applications/test/exprTraits/Test-exprTraits.C
Normal file
108
applications/test/exprTraits/Test-exprTraits.C
Normal file
@ -0,0 +1,108 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
|
||||
Description
|
||||
Basic tests of expression traits
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "ITstream.H"
|
||||
#include "exprTraits.H"
|
||||
#include "uLabel.H"
|
||||
#include "error.H"
|
||||
#include "stringList.H"
|
||||
#include "exprScanToken.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void printTraits()
|
||||
{
|
||||
const auto typeCode = exprTypeTraits<T>::value;
|
||||
|
||||
Info<< "type " << pTraits<T>::typeName
|
||||
<< " code:" << int(typeCode)
|
||||
<< " name:" << exprTypeTraits<T>::name;
|
||||
|
||||
if (pTraits<T>::typeName != word(exprTypeTraits<T>::name))
|
||||
{
|
||||
Info<< " (UNSUPPORTED)";
|
||||
}
|
||||
|
||||
Info << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main()
|
||||
{
|
||||
Info<< nl << "Traits:" << nl;
|
||||
|
||||
printTraits<word>();
|
||||
printTraits<string>();
|
||||
printTraits<bool>();
|
||||
printTraits<label>();
|
||||
printTraits<scalar>();
|
||||
printTraits<vector>();
|
||||
printTraits<tensor>();
|
||||
printTraits<symmTensor>();
|
||||
printTraits<sphericalTensor>();
|
||||
|
||||
const auto getName = nameOp<expressions::valueTypeCode>();
|
||||
|
||||
Info<< nl;
|
||||
|
||||
Info<< "Name of typeCode: "
|
||||
<< Foam::name(expressions::valueTypeCode::type_scalar) << nl;
|
||||
|
||||
Info<< "Name of typeCode: "
|
||||
<< getName(expressions::valueTypeCode::type_bool) << nl;
|
||||
|
||||
|
||||
{
|
||||
expressions::scanToken tok;
|
||||
expressions::scanToken tok2;
|
||||
|
||||
Info<< nl << "sizeof(scanToken): "
|
||||
<< sizeof(tok) << nl;
|
||||
|
||||
Info<< " type:" << int(tok.type_) << nl;
|
||||
Info<< " ptr:" << Foam::name(tok.name_) << nl;
|
||||
|
||||
Info<< " type:" << int(tok2.type_) << nl;
|
||||
Info<< " ptr:" << Foam::name(tok2.name_) << nl;
|
||||
|
||||
tok.setWord("hello");
|
||||
|
||||
Info<< " type:" << int(tok.type_) << nl;
|
||||
Info<< " ptr:" << Foam::name(tok.name_) << nl;
|
||||
|
||||
tok2 = tok;
|
||||
Info<< " type:" << int(tok2.type_) << nl;
|
||||
Info<< " ptr:" << Foam::name(tok2.name_) << nl;
|
||||
|
||||
tok2.destroy();
|
||||
|
||||
Info<< " type:" << int(tok2.type_) << nl;
|
||||
Info<< " ptr:" << Foam::name(tok2.name_) << nl;
|
||||
}
|
||||
|
||||
Info<< nl << "Done" << nl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
||||
argList::noParallel();
|
||||
argList::noFunctionObjects();
|
||||
argList::addArgument("start size .. startN sizeN");
|
||||
argList::addOption("verbose");
|
||||
argList::addVerbose("enable labelRange::debug");
|
||||
argList::addNote
|
||||
(
|
||||
"The default is to add ranges, use 'add' and 'del' to toggle\n\n"
|
||||
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList args(argc, argv, false, true);
|
||||
|
||||
if (args.found("verbose"))
|
||||
if (args.verbose())
|
||||
{
|
||||
labelRange::debug = 1;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -146,6 +146,9 @@ int main(int argc, char *argv[])
|
||||
const objectRegistry& db = (optMesh ? mesh.thisDb() : runTime);
|
||||
|
||||
Info<<"## start ##" << nl;
|
||||
Info<< "db isTime:" << db.isTimeDb() << " addr:" << Foam::name(&db)
|
||||
<< " time: " << Foam::name(&(db.time())) << nl;
|
||||
|
||||
printRegistry(Info, db);
|
||||
Info<< nl;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -124,16 +124,13 @@ int main(int argc, char *argv[])
|
||||
"(vector angle)",
|
||||
"Rotate about the <vector> by <angle> degrees - eg, '((1 0 0) 45)'"
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity"
|
||||
"Report euler angles"
|
||||
);
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
const bool verbose = args.found("verbose");
|
||||
|
||||
|
||||
vector rotVector;
|
||||
|
||||
@ -327,7 +324,7 @@ int main(int argc, char *argv[])
|
||||
tensor rotQ(quaternion(order, angles).R());
|
||||
tensor rotE(euler::rotation(order, angles, false));
|
||||
|
||||
if (verbose)
|
||||
if (args.verbose())
|
||||
{
|
||||
Info<< "euler " << orderName << angles << nl;
|
||||
printRotation(rotE);
|
||||
|
||||
0
applications/test/reconstructedDistanceFunction/Test-reconstructedDistanceFunction.C
Executable file → Normal file
0
applications/test/reconstructedDistanceFunction/Test-reconstructedDistanceFunction.C
Executable file → Normal file
@ -32,14 +32,22 @@ struct myScalarField : public scalarField
|
||||
template<class T>
|
||||
void printInfo(const refPtr<T>& item, const bool verbose = false)
|
||||
{
|
||||
Info<< "refPtr valid:" << Switch::name(item.valid())
|
||||
Info<< "refPtr good:" << Switch::name(item.good())
|
||||
<< " pointer:" << Switch::name(item.is_pointer())
|
||||
<< " addr: " << name(item.get())
|
||||
<< " addr: " << Foam::name(item.get())
|
||||
<< " movable:" << Switch(item.movable());
|
||||
|
||||
Info<< nl;
|
||||
Info<< " move-constructible:"
|
||||
<< std::is_move_constructible<refPtr<T>>::value
|
||||
<< " move-assignable:"
|
||||
<< std::is_move_assignable<refPtr<T>>::value
|
||||
<< " nothrow:"
|
||||
<< std::is_nothrow_move_assignable<refPtr<T>>::value
|
||||
<< " trivially:"
|
||||
<< std::is_trivially_move_assignable<refPtr<T>>::value
|
||||
<< nl;
|
||||
|
||||
if (verbose && item.valid())
|
||||
if (verbose && item)
|
||||
{
|
||||
Info<< "content: " << item() << nl;
|
||||
}
|
||||
|
||||
@ -252,12 +252,16 @@ void testExpressions(const UList<regexTest>& tests)
|
||||
}
|
||||
else if (re.search(str))
|
||||
{
|
||||
Info<< "partial match";
|
||||
Info<< "partial";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "false";
|
||||
}
|
||||
if (re.negated())
|
||||
{
|
||||
Info<< " (negated)";
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
@ -329,6 +333,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
Info<< "sizeof std::regex: " << sizeof(std::regex) << nl;
|
||||
Info<< "sizeof regex C++11: " << sizeof(regExpCxx) << nl;
|
||||
#ifndef _WIN32
|
||||
Info<< "sizeof regex POSIX: " << sizeof(regExpPosix) << nl;
|
||||
#endif
|
||||
Info<< "sizeof word: " << sizeof(Foam::word) << nl;
|
||||
Info<< "sizeof wordRe: " << sizeof(Foam::wordRe) << nl;
|
||||
Info<< "sizeof keyType: " << sizeof(Foam::keyType) << nl;
|
||||
|
||||
if (!args.count({"cxx", "posix"}))
|
||||
{
|
||||
args.setOption("cxx");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / O peration | Version: v2112 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -12,6 +12,8 @@
|
||||
(
|
||||
( true "(U|k|epsilon)" "U" )
|
||||
( false "(U|k|epsilon)" "alpha" )
|
||||
( true "(?!)(U|k|epsilon)" "alpha" )
|
||||
( true "(?! *&)(U|k|epsilon)" "alpha" ) // Ignore unknown content
|
||||
( true "ab.*" "abc" )
|
||||
( true ".*" "abc" )
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ Description
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "IOobject.H"
|
||||
#include "scalarField.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -139,6 +140,8 @@ int main(int argc, char *argv[])
|
||||
cout<<"PstreamBuffers:" << sizeof(Foam::PstreamBuffers) << nl;
|
||||
cout<<"Time:" << sizeof(Foam::Time) << nl;
|
||||
|
||||
cout<<"tmp<>:" << sizeof(tmp<scalarField>) << nl;
|
||||
|
||||
Info << "---\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -32,18 +32,26 @@ struct myScalarField : public scalarField
|
||||
template<class T>
|
||||
void printInfo(const tmp<T>& item, const bool verbose = false)
|
||||
{
|
||||
Info<< "tmp valid:" << Switch::name(item.valid())
|
||||
Info<< "tmp good:" << Switch::name(item.good())
|
||||
<< " pointer:" << Switch::name(item.is_pointer())
|
||||
<< " addr: " << name(item.get())
|
||||
<< " addr: " << Foam::name(item.get())
|
||||
<< " movable:" << Switch(item.movable());
|
||||
|
||||
if (item.valid())
|
||||
if (item)
|
||||
{
|
||||
Info<< " refCount:" << item->count();
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
if (verbose && item.valid())
|
||||
Info<< " move-constructible:"
|
||||
<< std::is_move_constructible<tmp<T>>::value
|
||||
<< " move-assignable:"
|
||||
<< std::is_move_assignable<tmp<T>>::value
|
||||
<< " nothrow:"
|
||||
<< std::is_nothrow_move_assignable<tmp<T>>::value
|
||||
<< " trivially:"
|
||||
<< std::is_trivially_move_assignable<tmp<T>>::value
|
||||
<< nl;
|
||||
|
||||
if (verbose && item)
|
||||
{
|
||||
Info<< "content: " << item() << nl;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,18 +50,16 @@ int main(int argc, char *argv[])
|
||||
argList::addArgument("string .. stringN");
|
||||
argList::addOption("file", "name");
|
||||
argList::addOption("repeat", "count");
|
||||
argList::addBoolOption("verbose", "report for each repeat");
|
||||
argList::addVerboseOption("report each repeat");
|
||||
|
||||
argList args(argc, argv, false, true);
|
||||
|
||||
const label repeat = args.getOrDefault<label>("repeat", 1);
|
||||
|
||||
const bool optVerbose = args.found("verbose");
|
||||
|
||||
cpuTime timer;
|
||||
for (label count = 0; count < repeat; ++count)
|
||||
{
|
||||
const bool verbose = (optVerbose || count == 0);
|
||||
const bool verbose = (args.verbose() || count == 0);
|
||||
|
||||
for (label argI=1; argI < args.size(); ++argI)
|
||||
{
|
||||
@ -120,7 +118,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label count = 0; count < repeat; ++count)
|
||||
{
|
||||
const bool verbose = (optVerbose || count == 0);
|
||||
const bool verbose = (args.verbose() || count == 0);
|
||||
label nTokens = 0;
|
||||
|
||||
if (count)
|
||||
|
||||
@ -11,11 +11,11 @@ License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
|
||||
Description
|
||||
Decompose area fields, when mesh was generated in parallel
|
||||
Write proc addressing and decompose area fields (parallel only).
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (doDecompose && Pstream::parRun())
|
||||
{
|
||||
faMeshReconstructor reconstructor(aMesh);
|
||||
reconstructor.writeAddressing();
|
||||
@ -43,24 +43,42 @@ if (Pstream::parRun())
|
||||
|
||||
reconstructor.writeMesh();
|
||||
|
||||
const bool oldDistributed = fileHandler().distributed();
|
||||
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
||||
fileHandler().distributed(true);
|
||||
|
||||
IOobjectList objects(fullMesh.time(), runTime.timeName());
|
||||
|
||||
faFieldDecomposer::readFields(fullMesh, objects, areaScalarFields);
|
||||
faFieldDecomposer::readFields(fullMesh, objects, areaVectorFields);
|
||||
faFieldDecomposer::readFields(fullMesh, objects, areaSphTensorFields);
|
||||
faFieldDecomposer::readFields(fullMesh, objects, areaSymmTensorFields);
|
||||
faFieldDecomposer::readFields(fullMesh, objects, areaTensorFields);
|
||||
|
||||
// Restore old settings
|
||||
if (oldHandler)
|
||||
if (doDecompFields)
|
||||
{
|
||||
fileHandler(std::move(oldHandler));
|
||||
const bool oldDistributed = fileHandler().distributed();
|
||||
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
||||
fileHandler().distributed(true);
|
||||
|
||||
IOobjectList objects(fullMesh.time(), runTime.timeName());
|
||||
|
||||
faFieldDecomposer::readFields
|
||||
(
|
||||
fullMesh, objects, areaScalarFields
|
||||
);
|
||||
faFieldDecomposer::readFields
|
||||
(
|
||||
fullMesh, objects, areaVectorFields
|
||||
);
|
||||
faFieldDecomposer::readFields
|
||||
(
|
||||
fullMesh, objects, areaSphTensorFields
|
||||
);
|
||||
faFieldDecomposer::readFields
|
||||
(
|
||||
fullMesh, objects, areaSymmTensorFields
|
||||
);
|
||||
faFieldDecomposer::readFields
|
||||
(
|
||||
fullMesh, objects, areaTensorFields
|
||||
);
|
||||
|
||||
// Restore old settings
|
||||
if (oldHandler)
|
||||
{
|
||||
fileHandler(std::move(oldHandler));
|
||||
}
|
||||
fileHandler().distributed(oldDistributed);
|
||||
}
|
||||
fileHandler().distributed(oldDistributed);
|
||||
}
|
||||
|
||||
const label nAreaFields =
|
||||
@ -124,4 +142,5 @@ if (Pstream::parRun())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -71,10 +71,21 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
argList::addOption("dict", "file", "Alternative faMeshDefinition");
|
||||
|
||||
argList::addDryRunOption
|
||||
(
|
||||
"Create but do not write"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"dry-run",
|
||||
"Create but do not write"
|
||||
"no-decompose",
|
||||
"Suppress procAddressing creation and field decomposition"
|
||||
" (parallel)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-fields",
|
||||
"Suppress field decomposition"
|
||||
" (parallel)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
@ -93,7 +104,17 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
#include "createNamedPolyMesh.H"
|
||||
|
||||
const bool dryrun = args.found("dry-run");
|
||||
const bool doDecompose = !args.found("no-decompose");
|
||||
const bool doDecompFields = !args.found("no-fields");
|
||||
|
||||
if (!doDecompose)
|
||||
{
|
||||
Info<< "Skip decompose of finiteArea mesh/fields" << nl;
|
||||
}
|
||||
else if (!doDecompFields)
|
||||
{
|
||||
Info<< "Skip decompose of finiteArea fields" << nl;
|
||||
}
|
||||
|
||||
// Reading faMeshDefinition dictionary
|
||||
#include "findMeshDefinitionDict.H"
|
||||
@ -122,7 +143,7 @@ int main(int argc, char *argv[])
|
||||
#include "faMeshWriteVTK.H"
|
||||
}
|
||||
|
||||
if (dryrun)
|
||||
if (args.dryRun())
|
||||
{
|
||||
Info<< "\ndry-run: not writing mesh or decomposing fields\n" << nl;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -75,6 +75,7 @@ Usage
|
||||
|
||||
#include "blockMesh.H"
|
||||
#include "foamVtkInternalMeshWriter.H"
|
||||
#include "foamVtkSurfaceWriter.H"
|
||||
#include "attachPolyTopoChanger.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
@ -96,23 +97,24 @@ int main(int argc, char *argv[])
|
||||
argList::addNote
|
||||
(
|
||||
"Block mesh generator.\n"
|
||||
" \n"
|
||||
" The ordering of vertex and face labels within a block as shown "
|
||||
"below.\n"
|
||||
" For the local vertex numbering in the sequence 0 to 7:\n"
|
||||
" Faces 0, 1 (x-direction) are left, right.\n"
|
||||
" Faces 2, 3 (y-direction) are front, back.\n"
|
||||
" Faces 4, 5 (z-direction) are bottom, top.\n"
|
||||
"\n"
|
||||
" \n"
|
||||
" 7 ---- 6\n"
|
||||
" f5 |\\ |\\ f3\n"
|
||||
" f5 |\\ :\\ f3\n"
|
||||
" | | 4 ---- 5 \\\n"
|
||||
" | 3 |--- 2 | \\\n"
|
||||
" | 3.|....2 | \\\n"
|
||||
" | \\| \\| f2\n"
|
||||
" f4 0 ---- 1\n"
|
||||
" Y Z\n"
|
||||
" \\ | f0 ------ f1\n"
|
||||
" \\|\n"
|
||||
" O--- X\n"
|
||||
" o--- X\n"
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
@ -129,7 +131,11 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption
|
||||
(
|
||||
"write-vtk",
|
||||
"Write topology as VTK file and exit"
|
||||
"Write topology as VTU file and exit"
|
||||
);
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"Force verbose output. (Can be used multiple times)"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
@ -170,12 +176,12 @@ int main(int argc, char *argv[])
|
||||
const bool writeCellSets = args.found("sets");
|
||||
|
||||
// Default merge (topology), unless otherwise specified
|
||||
blockMesh::mergeStrategy strategy(blockMesh::DEFAULT_MERGE);
|
||||
|
||||
if (args.found("merge-points"))
|
||||
{
|
||||
strategy = blockMesh::MERGE_POINTS;
|
||||
}
|
||||
const blockMesh::mergeStrategy strategy =
|
||||
(
|
||||
args.found("merge-points")
|
||||
? blockMesh::MERGE_POINTS
|
||||
: blockMesh::DEFAULT_MERGE
|
||||
);
|
||||
|
||||
word regionName(polyMesh::defaultRegion);
|
||||
word regionPath;
|
||||
@ -216,7 +222,7 @@ int main(int argc, char *argv[])
|
||||
// Locate appropriate blockMeshDict
|
||||
#include "findBlockMeshDict.H"
|
||||
|
||||
blockMesh blocks(meshDict, regionName, strategy);
|
||||
blockMesh blocks(meshDict, regionName, strategy, args.verbose());
|
||||
|
||||
if (!blocks.valid())
|
||||
{
|
||||
|
||||
@ -13,22 +13,25 @@ License
|
||||
Description
|
||||
VTK output of blockMesh topology blocks
|
||||
|
||||
Always write in ASCII since the mesh is small and we want easily
|
||||
readable output for inspection.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Common
|
||||
|
||||
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
|
||||
const polyMesh& topoMesh = topoMeshPtr();
|
||||
|
||||
// Internal mesh - ie, the blocks
|
||||
{
|
||||
// Non-legacy and ASCII (mesh is small, want readable output)
|
||||
const vtk::outputOptions writeOpts = vtk::formatType::INLINE_ASCII;
|
||||
|
||||
refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
|
||||
const polyMesh& topoMesh = topoMeshPtr();
|
||||
|
||||
const vtk::vtuCells topoCells(topoMesh, writeOpts);
|
||||
const vtk::vtuCells topoCells(topoMesh, vtk::formatType::INLINE_ASCII);
|
||||
|
||||
vtk::internalMeshWriter writer
|
||||
(
|
||||
topoMesh,
|
||||
topoCells,
|
||||
writeOpts,
|
||||
vtk::formatType::INLINE_ASCII,
|
||||
runTime.path()/"blockTopology"
|
||||
);
|
||||
|
||||
@ -99,4 +102,64 @@ Description
|
||||
}
|
||||
|
||||
|
||||
// Block boundary faces
|
||||
{
|
||||
const label nIntFaces = topoMesh.nInternalFaces();
|
||||
const label nBndFaces = topoMesh.nBoundaryFaces();
|
||||
|
||||
faceList bndFaces
|
||||
(
|
||||
faceList::subList(topoMesh.faces(), nBndFaces, nIntFaces)
|
||||
);
|
||||
|
||||
vtk::surfaceWriter writer
|
||||
(
|
||||
topoMesh.points(),
|
||||
bndFaces,
|
||||
vtk::formatType::INLINE_ASCII,
|
||||
runTime.path()/"blockFaces"
|
||||
);
|
||||
|
||||
|
||||
labelList blockIds(nBndFaces, -1);
|
||||
labelList cellFaceIds(nBndFaces, -1);
|
||||
labelList patchIds(nBndFaces, -1);
|
||||
|
||||
{
|
||||
const labelList& own = topoMesh.faceOwner();
|
||||
const cellList& cells = topoMesh.cells();
|
||||
const polyPatchList& patches = topoMesh.boundaryMesh();
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
label bndFacei = pp.start() - nIntFaces;
|
||||
label meshFacei = pp.start();
|
||||
|
||||
forAll(pp, bfacei)
|
||||
{
|
||||
const label celli = own[meshFacei];
|
||||
const label cellFacei = cells[celli].find(meshFacei);
|
||||
|
||||
blockIds[bndFacei] = celli;
|
||||
cellFaceIds[bndFacei] = cellFacei;
|
||||
patchIds[bndFacei] = pp.index();
|
||||
|
||||
++bndFacei;
|
||||
++meshFacei;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Writing block boundary faces in vtk format: "
|
||||
<< args.relativePath(writer.output()).c_str() << endl;
|
||||
|
||||
writer.writeGeometry();
|
||||
|
||||
writer.beginCellData();
|
||||
writer.writeCellData("block", blockIds);
|
||||
writer.writeCellData("face", cellFaceIds);
|
||||
writer.writeCellData("patch", patchIds);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -125,6 +125,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#include "createNamedMeshes.H"
|
||||
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
@ -166,8 +168,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
#include "createNamedMeshes.H"
|
||||
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
|
||||
@ -78,9 +78,8 @@ int main(int argc, char *argv[])
|
||||
"detail",
|
||||
"Additional detail"
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity"
|
||||
);
|
||||
|
||||
@ -94,7 +93,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool testOr = args.found("or");
|
||||
const bool detail = args.found("detail");
|
||||
const bool verbose = args.found("verbose");
|
||||
|
||||
label ngood = 0;
|
||||
label nbad = 0;
|
||||
@ -127,7 +125,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
++ngood;
|
||||
|
||||
if (verbose)
|
||||
if (args.verbose())
|
||||
{
|
||||
const word addr(Foam::name(ptr));
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -101,9 +101,8 @@ int main(int argc, char *argv[])
|
||||
"rm",
|
||||
"Remove selected time directories"
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Report progress of -rm option"
|
||||
);
|
||||
profiling::disable(); // Disable profiling (and its output)
|
||||
@ -111,7 +110,7 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool removeFiles(args.found("rm"));
|
||||
bool verbose(args.found("verbose"));
|
||||
bool verbose(args.verbose());
|
||||
|
||||
|
||||
// Get times list from the master processor and subset based on
|
||||
|
||||
@ -232,9 +232,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"Report action without moving/renaming"
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity"
|
||||
);
|
||||
|
||||
@ -247,7 +246,7 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
|
||||
dryrun = args.dryRun();
|
||||
verbose = args.found("verbose");
|
||||
verbose = args.verbose();
|
||||
|
||||
|
||||
// Construct time
|
||||
|
||||
@ -141,11 +141,15 @@ Usage
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "OSspecific.H"
|
||||
#include "fvCFD.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
#include "decompositionModel.H"
|
||||
#include "domainDecomposition.H"
|
||||
#include "domainDecompositionDryRun.H"
|
||||
|
||||
#include "labelIOField.H"
|
||||
#include "labelFieldIOField.H"
|
||||
#include "scalarIOField.H"
|
||||
@ -165,9 +169,7 @@ Usage
|
||||
#include "fvFieldDecomposer.H"
|
||||
#include "pointFieldDecomposer.H"
|
||||
#include "lagrangianFieldDecomposer.H"
|
||||
#include "decompositionModel.H"
|
||||
|
||||
#include "faCFD.H"
|
||||
#include "emptyFaPatch.H"
|
||||
#include "faMeshDecomposition.H"
|
||||
#include "faFieldDecomposer.H"
|
||||
@ -306,6 +308,8 @@ void decomposeUniform
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -330,9 +334,8 @@ int main(int argc, char *argv[])
|
||||
"Test without writing the decomposition. "
|
||||
"Changes -cellDist to only write VTK output."
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity"
|
||||
);
|
||||
argList::addOption
|
||||
@ -385,6 +388,11 @@ int main(int argc, char *argv[])
|
||||
"fields",
|
||||
"Use existing geometry decomposition and convert fields only"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-fields",
|
||||
"Suppress conversion of fields (volume, finite-area, lagrangian)"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
@ -409,9 +417,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool dryrun = args.dryRun();
|
||||
const bool writeCellDist = args.found("cellDist");
|
||||
const bool verbose = args.found("verbose");
|
||||
|
||||
// Most of these are ignored for dry-run (not triggered anywhere)
|
||||
const bool copyZero = args.found("copyZero");
|
||||
@ -420,6 +426,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool decomposeIfRequired = args.found("ifRequired");
|
||||
|
||||
const bool doDecompFields = !args.found("no-fields");
|
||||
const bool doFiniteArea = !args.found("no-finite-area");
|
||||
const bool doLagrangian = !args.found("no-lagrangian");
|
||||
|
||||
@ -432,13 +439,25 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Allow override of time (unless dry-run)
|
||||
instantList times;
|
||||
if (dryrun)
|
||||
if (args.dryRun())
|
||||
{
|
||||
Info<< "\ndry-run: ignoring -copy*, -fields, -force, time selection"
|
||||
<< nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (decomposeFieldsOnly && !doDecompFields)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Options -fields and -no-fields are mutually exclusive"
|
||||
<< " ... giving up" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (!doDecompFields)
|
||||
{
|
||||
Info<< "Skip decompose of all fields" << nl;
|
||||
}
|
||||
if (!doFiniteArea)
|
||||
{
|
||||
Info<< "Skip decompose of finiteArea mesh/fields" << nl;
|
||||
@ -451,6 +470,7 @@ int main(int argc, char *argv[])
|
||||
times = timeSelector::selectIfPresent(runTime, args);
|
||||
}
|
||||
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile(args.get<fileName>("decomposeParDict", ""));
|
||||
if (!decompDictFile.empty() && !decompDictFile.isAbsolute())
|
||||
@ -477,7 +497,7 @@ int main(int argc, char *argv[])
|
||||
regionName == polyMesh::defaultRegion ? word::null : regionName
|
||||
);
|
||||
|
||||
if (dryrun)
|
||||
if (args.dryRun())
|
||||
{
|
||||
Info<< "dry-run: decomposing mesh " << regionName << nl << nl
|
||||
<< "Create mesh..." << flush;
|
||||
@ -498,7 +518,7 @@ int main(int argc, char *argv[])
|
||||
args.getOrDefault<word>("method", word::null)
|
||||
);
|
||||
|
||||
decompTest.execute(writeCellDist, verbose);
|
||||
decompTest.execute(writeCellDist, args.verbose());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -510,7 +530,8 @@ int main(int argc, char *argv[])
|
||||
Info<< nl << endl;
|
||||
|
||||
// Determine the existing processor count directly
|
||||
label nProcs = fileHandler().nProcs(runTime.path(), regionDir);
|
||||
const label nProcsOld =
|
||||
fileHandler().nProcs(runTime.path(), regionDir);
|
||||
|
||||
// Get requested numberOfSubdomains directly from the dictionary.
|
||||
// Note: have no mesh yet so cannot use decompositionModel::New
|
||||
@ -541,22 +562,22 @@ int main(int argc, char *argv[])
|
||||
if (decomposeFieldsOnly)
|
||||
{
|
||||
// Sanity check on previously decomposed case
|
||||
if (nProcs != nDomains)
|
||||
if (nProcsOld != nDomains)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Specified -fields, but the case was decomposed with "
|
||||
<< nProcs << " domains"
|
||||
<< nProcsOld << " domains"
|
||||
<< nl
|
||||
<< "instead of " << nDomains
|
||||
<< " domains as specified in decomposeParDict" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else if (nProcs)
|
||||
else if (nProcsOld)
|
||||
{
|
||||
bool procDirsProblem = true;
|
||||
|
||||
if (decomposeIfRequired && nProcs == nDomains)
|
||||
if (decomposeIfRequired && nProcsOld == nDomains)
|
||||
{
|
||||
// We can reuse the decomposition
|
||||
decomposeFieldsOnly = true;
|
||||
@ -574,7 +595,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (forceOverwrite)
|
||||
{
|
||||
Info<< "Removing " << nProcs
|
||||
Info<< "Removing " << nProcsOld
|
||||
<< " existing processor directories" << endl;
|
||||
|
||||
// Remove existing processors directory
|
||||
@ -617,8 +638,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (procDirsProblem)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Case is already decomposed with " << nProcs
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Case is already decomposed with " << nProcsOld
|
||||
<< " domains, use the -force option or manually" << nl
|
||||
<< "remove processor directories before decomposing. e.g.,"
|
||||
<< nl
|
||||
@ -647,7 +668,6 @@ int main(int argc, char *argv[])
|
||||
if (!decomposeFieldsOnly)
|
||||
{
|
||||
mesh.decomposeMesh();
|
||||
|
||||
mesh.writeDecomposition(decomposeSets);
|
||||
|
||||
if (writeCellDist)
|
||||
@ -750,7 +770,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
// Decompose the field files
|
||||
// Decompose field files, lagrangian, finite-area
|
||||
|
||||
// Cached processor meshes and maps. These are only preserved if
|
||||
// running with multiple times.
|
||||
@ -759,8 +779,9 @@ int main(int argc, char *argv[])
|
||||
PtrList<labelIOList> faceProcAddressingList(mesh.nProcs());
|
||||
PtrList<labelIOList> cellProcAddressingList(mesh.nProcs());
|
||||
PtrList<labelIOList> boundaryProcAddressingList(mesh.nProcs());
|
||||
PtrList<fvFieldDecomposer> fieldDecomposerList(mesh.nProcs());
|
||||
PtrList<labelIOList> pointProcAddressingList(mesh.nProcs());
|
||||
|
||||
PtrList<fvFieldDecomposer> fieldDecomposerList(mesh.nProcs());
|
||||
PtrList<pointFieldDecomposer> pointFieldDecomposerList
|
||||
(
|
||||
mesh.nProcs()
|
||||
@ -768,83 +789,139 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Loop over all times
|
||||
forAll(times, timeI)
|
||||
forAll(times, timei)
|
||||
{
|
||||
runTime.setTime(times[timeI], timeI);
|
||||
runTime.setTime(times[timei], timei);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
// Search for list of objects for this time
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
// Field objects at this time
|
||||
IOobjectList objects;
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
objects = IOobjectList(mesh, runTime.timeName());
|
||||
|
||||
// Ignore generated fields: (cellDist)
|
||||
objects.remove("cellDist");
|
||||
}
|
||||
|
||||
// Finite area handling
|
||||
autoPtr<faMeshDecomposition> faMeshDecompPtr;
|
||||
if (doFiniteArea)
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"faBoundary",
|
||||
mesh.time().findInstance
|
||||
(
|
||||
mesh.dbDir()/polyMesh::meshSubDir,
|
||||
"boundary"
|
||||
),
|
||||
faMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false // not registered
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<faBoundaryMesh>(true))
|
||||
{
|
||||
// Always based on the volume decomposition!
|
||||
faMeshDecompPtr.reset
|
||||
(
|
||||
new faMeshDecomposition
|
||||
(
|
||||
mesh,
|
||||
mesh.nProcs(),
|
||||
mesh.model()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct the vol fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Vol fields
|
||||
// ~~~~~~~~~~
|
||||
PtrList<volScalarField> volScalarFields;
|
||||
readFields(mesh, objects, volScalarFields, false);
|
||||
PtrList<volVectorField> volVectorFields;
|
||||
readFields(mesh, objects, volVectorFields, false);
|
||||
PtrList<volSphericalTensorField> volSphericalTensorFields;
|
||||
readFields(mesh, objects, volSphericalTensorFields, false);
|
||||
PtrList<volSphericalTensorField> volSphTensorFields;
|
||||
PtrList<volSymmTensorField> volSymmTensorFields;
|
||||
readFields(mesh, objects, volSymmTensorFields, false);
|
||||
PtrList<volTensorField> volTensorFields;
|
||||
readFields(mesh, objects, volTensorFields, false);
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
readFields(mesh, objects, volScalarFields, false);
|
||||
readFields(mesh, objects, volVectorFields, false);
|
||||
readFields(mesh, objects, volSphTensorFields, false);
|
||||
readFields(mesh, objects, volSymmTensorFields, false);
|
||||
readFields(mesh, objects, volTensorFields, false);
|
||||
}
|
||||
|
||||
// Construct the dimensioned fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Internal fields
|
||||
// ~~~~~~~~~~~~~~~
|
||||
PtrList<DimensionedField<scalar, volMesh>> dimScalarFields;
|
||||
readFields(mesh, objects, dimScalarFields);
|
||||
PtrList<DimensionedField<vector, volMesh>> dimVectorFields;
|
||||
readFields(mesh, objects, dimVectorFields);
|
||||
PtrList<DimensionedField<sphericalTensor, volMesh>>
|
||||
dimSphericalTensorFields;
|
||||
readFields(mesh, objects, dimSphericalTensorFields);
|
||||
dimSphTensorFields;
|
||||
PtrList<DimensionedField<symmTensor, volMesh>>
|
||||
dimSymmTensorFields;
|
||||
readFields(mesh, objects, dimSymmTensorFields);
|
||||
PtrList<DimensionedField<tensor, volMesh>> dimTensorFields;
|
||||
readFields(mesh, objects, dimTensorFields);
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
readFields(mesh, objects, dimScalarFields);
|
||||
readFields(mesh, objects, dimVectorFields);
|
||||
readFields(mesh, objects, dimSphTensorFields);
|
||||
readFields(mesh, objects, dimSymmTensorFields);
|
||||
readFields(mesh, objects, dimTensorFields);
|
||||
}
|
||||
|
||||
// Construct the surface fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Surface fields
|
||||
// ~~~~~~~~~~~~~~
|
||||
PtrList<surfaceScalarField> surfaceScalarFields;
|
||||
readFields(mesh, objects, surfaceScalarFields, false);
|
||||
PtrList<surfaceVectorField> surfaceVectorFields;
|
||||
readFields(mesh, objects, surfaceVectorFields, false);
|
||||
PtrList<surfaceSphericalTensorField>
|
||||
surfaceSphericalTensorFields;
|
||||
readFields(mesh, objects, surfaceSphericalTensorFields, false);
|
||||
surfaceSphTensorFields;
|
||||
PtrList<surfaceSymmTensorField> surfaceSymmTensorFields;
|
||||
readFields(mesh, objects, surfaceSymmTensorFields, false);
|
||||
PtrList<surfaceTensorField> surfaceTensorFields;
|
||||
readFields(mesh, objects, surfaceTensorFields, false);
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
readFields(mesh, objects, surfaceScalarFields, false);
|
||||
readFields(mesh, objects, surfaceVectorFields, false);
|
||||
readFields(mesh, objects, surfaceSphTensorFields, false);
|
||||
readFields(mesh, objects, surfaceSymmTensorFields, false);
|
||||
readFields(mesh, objects, surfaceTensorFields, false);
|
||||
}
|
||||
|
||||
|
||||
// Construct the point fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Point fields
|
||||
// ~~~~~~~~~~~~
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
|
||||
PtrList<pointScalarField> pointScalarFields;
|
||||
readFields(pMesh, objects, pointScalarFields, false);
|
||||
PtrList<pointVectorField> pointVectorFields;
|
||||
readFields(pMesh, objects, pointVectorFields, false);
|
||||
PtrList<pointSphericalTensorField> pointSphericalTensorFields;
|
||||
readFields(pMesh, objects, pointSphericalTensorFields, false);
|
||||
PtrList<pointSphericalTensorField> pointSphTensorFields;
|
||||
PtrList<pointSymmTensorField> pointSymmTensorFields;
|
||||
readFields(pMesh, objects, pointSymmTensorFields, false);
|
||||
PtrList<pointTensorField> pointTensorFields;
|
||||
readFields(pMesh, objects, pointTensorFields, false);
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
readFields(pMesh, objects, pointScalarFields, false);
|
||||
readFields(pMesh, objects, pointVectorFields, false);
|
||||
readFields(pMesh, objects, pointSphTensorFields, false);
|
||||
readFields(pMesh, objects, pointSymmTensorFields, false);
|
||||
readFields(pMesh, objects, pointTensorFields, false);
|
||||
}
|
||||
|
||||
|
||||
// Construct the Lagrangian fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Lagrangian fields
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
fileNameList cloudDirs;
|
||||
|
||||
if (doLagrangian)
|
||||
if (doDecompFields && doLagrangian)
|
||||
{
|
||||
cloudDirs = fileHandler().readDir
|
||||
(
|
||||
@ -892,13 +969,17 @@ int main(int argc, char *argv[])
|
||||
cloudDirs.size()
|
||||
);
|
||||
PtrList<PtrList<sphericalTensorIOField>>
|
||||
lagrangianSphericalTensorFields
|
||||
lagrangianSphTensorFields
|
||||
(
|
||||
cloudDirs.size()
|
||||
);
|
||||
PtrList<PtrList<sphericalTensorFieldCompactIOField>>
|
||||
lagrangianSphericalTensorFieldFields(cloudDirs.size());
|
||||
PtrList<PtrList<symmTensorIOField>> lagrangianSymmTensorFields
|
||||
lagrangianSphTensorFieldFields
|
||||
(
|
||||
cloudDirs.size()
|
||||
);
|
||||
PtrList<PtrList<symmTensorIOField>>
|
||||
lagrangianSymmTensorFields
|
||||
(
|
||||
cloudDirs.size()
|
||||
);
|
||||
@ -917,6 +998,7 @@ int main(int argc, char *argv[])
|
||||
cloudDirs.size()
|
||||
);
|
||||
|
||||
|
||||
label cloudI = 0;
|
||||
|
||||
for (const fileName& cloudDir : cloudDirs)
|
||||
@ -980,7 +1062,7 @@ int main(int argc, char *argv[])
|
||||
// Check
|
||||
if (celli < 0 || celli >= mesh.nCells())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Illegal cell number " << celli
|
||||
<< " for particle with index "
|
||||
<< p.index()
|
||||
@ -1062,14 +1144,14 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
cloudI,
|
||||
lagrangianObjects,
|
||||
lagrangianSphericalTensorFields
|
||||
lagrangianSphTensorFields
|
||||
);
|
||||
|
||||
lagrangianFieldDecomposer::readFieldFields
|
||||
(
|
||||
cloudI,
|
||||
lagrangianObjects,
|
||||
lagrangianSphericalTensorFieldFields
|
||||
lagrangianSphTensorFieldFields
|
||||
);
|
||||
|
||||
lagrangianFieldDecomposer::readFields
|
||||
@ -1100,29 +1182,34 @@ int main(int argc, char *argv[])
|
||||
lagrangianTensorFieldFields
|
||||
);
|
||||
|
||||
cloudI++;
|
||||
++cloudI;
|
||||
}
|
||||
}
|
||||
|
||||
lagrangianPositions.setSize(cloudI);
|
||||
cellParticles.setSize(cloudI);
|
||||
lagrangianLabelFields.setSize(cloudI);
|
||||
lagrangianLabelFieldFields.setSize(cloudI);
|
||||
lagrangianScalarFields.setSize(cloudI);
|
||||
lagrangianScalarFieldFields.setSize(cloudI);
|
||||
lagrangianVectorFields.setSize(cloudI);
|
||||
lagrangianVectorFieldFields.setSize(cloudI);
|
||||
lagrangianSphericalTensorFields.setSize(cloudI);
|
||||
lagrangianSphericalTensorFieldFields.setSize(cloudI);
|
||||
lagrangianSymmTensorFields.setSize(cloudI);
|
||||
lagrangianSymmTensorFieldFields.setSize(cloudI);
|
||||
lagrangianTensorFields.setSize(cloudI);
|
||||
lagrangianTensorFieldFields.setSize(cloudI);
|
||||
lagrangianPositions.resize(cloudI);
|
||||
cellParticles.resize(cloudI);
|
||||
lagrangianLabelFields.resize(cloudI);
|
||||
lagrangianLabelFieldFields.resize(cloudI);
|
||||
lagrangianScalarFields.resize(cloudI);
|
||||
lagrangianScalarFieldFields.resize(cloudI);
|
||||
lagrangianVectorFields.resize(cloudI);
|
||||
lagrangianVectorFieldFields.resize(cloudI);
|
||||
lagrangianSphTensorFields.resize(cloudI);
|
||||
lagrangianSphTensorFieldFields.resize(cloudI);
|
||||
lagrangianSymmTensorFields.resize(cloudI);
|
||||
lagrangianSymmTensorFieldFields.resize(cloudI);
|
||||
lagrangianTensorFields.resize(cloudI);
|
||||
lagrangianTensorFieldFields.resize(cloudI);
|
||||
|
||||
Info<< endl;
|
||||
|
||||
// split the fields over processors
|
||||
for (label proci = 0; proci < mesh.nProcs(); ++proci)
|
||||
for
|
||||
(
|
||||
label proci = 0;
|
||||
doDecompFields && proci < mesh.nProcs();
|
||||
++proci
|
||||
)
|
||||
{
|
||||
Info<< "Processor " << proci << ": field transfer" << endl;
|
||||
|
||||
@ -1210,22 +1297,19 @@ int main(int argc, char *argv[])
|
||||
const fvFieldDecomposer& fieldDecomposer =
|
||||
fieldDecomposerList[proci];
|
||||
|
||||
// vol fields
|
||||
// Vol fields
|
||||
fieldDecomposer.decomposeFields(volScalarFields);
|
||||
fieldDecomposer.decomposeFields(volVectorFields);
|
||||
fieldDecomposer.decomposeFields
|
||||
(
|
||||
volSphericalTensorFields
|
||||
);
|
||||
fieldDecomposer.decomposeFields(volSphTensorFields);
|
||||
fieldDecomposer.decomposeFields(volSymmTensorFields);
|
||||
fieldDecomposer.decomposeFields(volTensorFields);
|
||||
|
||||
// surface fields
|
||||
// Surface fields
|
||||
fieldDecomposer.decomposeFields(surfaceScalarFields);
|
||||
fieldDecomposer.decomposeFields(surfaceVectorFields);
|
||||
fieldDecomposer.decomposeFields
|
||||
(
|
||||
surfaceSphericalTensorFields
|
||||
surfaceSphTensorFields
|
||||
);
|
||||
fieldDecomposer.decomposeFields
|
||||
(
|
||||
@ -1236,7 +1320,7 @@ int main(int argc, char *argv[])
|
||||
// internal fields
|
||||
fieldDecomposer.decomposeFields(dimScalarFields);
|
||||
fieldDecomposer.decomposeFields(dimVectorFields);
|
||||
fieldDecomposer.decomposeFields(dimSphericalTensorFields);
|
||||
fieldDecomposer.decomposeFields(dimSphTensorFields);
|
||||
fieldDecomposer.decomposeFields(dimSymmTensorFields);
|
||||
fieldDecomposer.decomposeFields(dimTensorFields);
|
||||
|
||||
@ -1253,7 +1337,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
pointScalarFields.size()
|
||||
|| pointVectorFields.size()
|
||||
|| pointSphericalTensorFields.size()
|
||||
|| pointSphTensorFields.size()
|
||||
|| pointSymmTensorFields.size()
|
||||
|| pointTensorFields.size()
|
||||
)
|
||||
@ -1287,10 +1371,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
pointDecomposer.decomposeFields(pointScalarFields);
|
||||
pointDecomposer.decomposeFields(pointVectorFields);
|
||||
pointDecomposer.decomposeFields
|
||||
(
|
||||
pointSphericalTensorFields
|
||||
);
|
||||
pointDecomposer.decomposeFields(pointSphTensorFields);
|
||||
pointDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
pointDecomposer.decomposeFields(pointTensorFields);
|
||||
|
||||
@ -1354,12 +1435,12 @@ int main(int argc, char *argv[])
|
||||
fieldDecomposer.decomposeFields
|
||||
(
|
||||
cloudDirs[cloudI],
|
||||
lagrangianSphericalTensorFields[cloudI]
|
||||
lagrangianSphTensorFields[cloudI]
|
||||
);
|
||||
fieldDecomposer.decomposeFieldFields
|
||||
(
|
||||
cloudDirs[cloudI],
|
||||
lagrangianSphericalTensorFieldFields[cloudI]
|
||||
lagrangianSphTensorFieldFields[cloudI]
|
||||
);
|
||||
fieldDecomposer.decomposeFields
|
||||
(
|
||||
@ -1385,17 +1466,24 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// Decompose the "uniform" directory in the time region
|
||||
// directory
|
||||
decomposeUniform(copyUniform, mesh, processorDb, regionDir);
|
||||
|
||||
// For a multi-region case, also decompose the "uniform"
|
||||
// directory in the time directory
|
||||
if (regionNames.size() > 1 && regioni == 0)
|
||||
if (doDecompFields)
|
||||
{
|
||||
decomposeUniform(copyUniform, mesh, processorDb);
|
||||
// Decompose "uniform" directory in the time region
|
||||
// directory
|
||||
decomposeUniform
|
||||
(
|
||||
copyUniform, mesh, processorDb, regionDir
|
||||
);
|
||||
|
||||
// For a multi-region case, also decompose "uniform"
|
||||
// directory in the time directory
|
||||
if (regionNames.size() > 1 && regioni == 0)
|
||||
{
|
||||
decomposeUniform(copyUniform, mesh, processorDb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We have cached all the constant mesh data for the current
|
||||
// processor. This is only important if running with
|
||||
// multiple times, otherwise it is just extra storage.
|
||||
@ -1409,72 +1497,46 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Finite area mesh and field decomposition
|
||||
|
||||
IOobject faMeshBoundaryIOobj
|
||||
(
|
||||
"faBoundary",
|
||||
mesh.time().findInstance
|
||||
(
|
||||
mesh.dbDir()/polyMesh::meshSubDir,
|
||||
"boundary"
|
||||
),
|
||||
faMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false // not registered
|
||||
);
|
||||
|
||||
|
||||
if
|
||||
(
|
||||
doFiniteArea
|
||||
&& faMeshBoundaryIOobj.typeHeaderOk<faBoundaryMesh>(true)
|
||||
)
|
||||
if (faMeshDecompPtr)
|
||||
{
|
||||
Info<< "\nFinite area mesh decomposition" << endl;
|
||||
|
||||
// Always based on the volume decomposition!
|
||||
faMeshDecomposition aMesh
|
||||
(
|
||||
mesh,
|
||||
mesh.nProcs(),
|
||||
mesh.model()
|
||||
);
|
||||
faMeshDecomposition& aMesh = faMeshDecompPtr();
|
||||
|
||||
aMesh.decomposeMesh();
|
||||
aMesh.writeDecomposition();
|
||||
|
||||
|
||||
// Construct the area fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Area fields
|
||||
// ~~~~~~~~~~~
|
||||
PtrList<areaScalarField> areaScalarFields;
|
||||
readFields(aMesh, objects, areaScalarFields);
|
||||
|
||||
PtrList<areaVectorField> areaVectorFields;
|
||||
readFields(aMesh, objects, areaVectorFields);
|
||||
|
||||
PtrList<areaSphericalTensorField> areaSphericalTensorFields;
|
||||
readFields(aMesh, objects, areaSphericalTensorFields);
|
||||
|
||||
PtrList<areaSphericalTensorField> areaSphTensorFields;
|
||||
PtrList<areaSymmTensorField> areaSymmTensorFields;
|
||||
readFields(aMesh, objects, areaSymmTensorFields);
|
||||
|
||||
PtrList<areaTensorField> areaTensorFields;
|
||||
readFields(aMesh, objects, areaTensorFields);
|
||||
|
||||
|
||||
// Construct the edge fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Edge fields (limited number of types)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
PtrList<edgeScalarField> edgeScalarFields;
|
||||
readFields(aMesh, objects, edgeScalarFields);
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
readFields(aMesh, objects, areaScalarFields);
|
||||
readFields(aMesh, objects, areaVectorFields);
|
||||
readFields(aMesh, objects, areaSphTensorFields);
|
||||
readFields(aMesh, objects, areaSymmTensorFields);
|
||||
readFields(aMesh, objects, areaTensorFields);
|
||||
|
||||
readFields(aMesh, objects, edgeScalarFields);
|
||||
}
|
||||
|
||||
const label nAreaFields =
|
||||
(
|
||||
areaScalarFields.size()
|
||||
+ areaVectorFields.size()
|
||||
+ areaSphericalTensorFields.size()
|
||||
+ areaSphTensorFields.size()
|
||||
+ areaSymmTensorFields.size()
|
||||
+ areaTensorFields.size()
|
||||
+ edgeScalarFields.size()
|
||||
@ -1577,10 +1639,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fieldDecomposer.decomposeFields(areaScalarFields);
|
||||
fieldDecomposer.decomposeFields(areaVectorFields);
|
||||
fieldDecomposer.decomposeFields
|
||||
(
|
||||
areaSphericalTensorFields
|
||||
);
|
||||
fieldDecomposer.decomposeFields(areaSphTensorFields);
|
||||
fieldDecomposer.decomposeFields(areaSymmTensorFields);
|
||||
fieldDecomposer.decomposeFields(areaTensorFields);
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ void Foam::domainDecomposition::writeVolField
|
||||
false
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar(dimless, Zero),
|
||||
dimensionedScalar("cellDist", dimless, -1),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
|
||||
@ -44,13 +44,6 @@ void Foam::readFields
|
||||
// Search list of objects for fields of type GeoField
|
||||
IOobjectList fieldObjects(objects.lookupClass<GeoField>());
|
||||
|
||||
// Remove the cellDist field
|
||||
auto iter = fieldObjects.find("cellDist");
|
||||
if (iter.found())
|
||||
{
|
||||
fieldObjects.erase(iter);
|
||||
}
|
||||
|
||||
// Use sorted set of names
|
||||
// (different processors might read objects in different order)
|
||||
const wordList masterNames(fieldObjects.sortedNames());
|
||||
|
||||
@ -147,7 +147,7 @@ void createTimeDirs(const fileName& path)
|
||||
|
||||
// Just to make sure remove all state and re-scan
|
||||
fileHandler().flush();
|
||||
(void)fileHandler().findTimes(path, "constant");
|
||||
(void)Time::findTimes(path, "constant");
|
||||
}
|
||||
|
||||
|
||||
@ -2665,9 +2665,11 @@ int main(int argc, char *argv[])
|
||||
// e.g. latestTime will pick up a different time (which causes createTime.H
|
||||
// to abort). So for now make sure to have master times on all
|
||||
// processors
|
||||
Info<< "Creating time directories on all processors" << nl << endl;
|
||||
createTimeDirs(args.path());
|
||||
|
||||
if (!reconstruct)
|
||||
{
|
||||
Info<< "Creating time directories on all processors" << nl << endl;
|
||||
createTimeDirs(args.path());
|
||||
}
|
||||
|
||||
// Construct time
|
||||
// ~~~~~~~~~~~~~~
|
||||
@ -2932,6 +2934,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure all is finished writing until re-reading in pass2
|
||||
// below
|
||||
fileHandler().flush();
|
||||
|
||||
|
||||
// Pass2 : read mesh and addressing and reconstruct fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -15,4 +15,12 @@ const label sampleFrequency(propsDict.get<label>("sampleFrequency"));
|
||||
|
||||
const label maxPositions(propsDict.get<label>("maxPositions"));
|
||||
|
||||
const label maxTracks(propsDict.getOrDefault<label>("maxTracks", -1));
|
||||
|
||||
const word setFormat(propsDict.getOrDefault<word>("setFormat", "vtk"));
|
||||
|
||||
const wordRes fieldNames(propsDict.getOrDefault<wordRes>("fields", wordRes()));
|
||||
|
||||
const word UName(propsDict.getOrDefault<word>("U", "U"));
|
||||
|
||||
const dictionary formatOptions = propsDict.subOrEmptyDict("formatOptions");
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,8 +31,8 @@ Group
|
||||
grpPostProcessingUtilities
|
||||
|
||||
Description
|
||||
Generate a legacy VTK file of particle tracks for cases that were
|
||||
computed using a tracked-parcel-type cloud.
|
||||
Generate particle tracks for cases that were computed using a
|
||||
tracked-parcel-type cloud.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -44,16 +45,206 @@ Description
|
||||
#include "OFstream.H"
|
||||
#include "passiveParticleCloud.H"
|
||||
#include "writer.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
#define createTrack(field, trackValues) \
|
||||
createTrackField \
|
||||
( \
|
||||
field, \
|
||||
sampleFrequency, \
|
||||
maxPositions, \
|
||||
startIds, \
|
||||
allOrigProcs, \
|
||||
allOrigIds, \
|
||||
trackValues \
|
||||
);
|
||||
|
||||
#define setFields(fields, fieldNames) \
|
||||
setTrackFields \
|
||||
( \
|
||||
obr, \
|
||||
fields, \
|
||||
fieldNames, \
|
||||
nTracks, \
|
||||
startIds, \
|
||||
allOrigProcs, \
|
||||
allOrigIds, \
|
||||
maxPositions, \
|
||||
sampleFrequency \
|
||||
);
|
||||
|
||||
#define writeFields(fields, fieldNames, tracks, times, dirs) \
|
||||
writeTrackFields \
|
||||
( \
|
||||
fields, \
|
||||
fieldNames, \
|
||||
tracks, \
|
||||
times, \
|
||||
dirs, \
|
||||
setFormat, \
|
||||
formatOptions, \
|
||||
cloudName \
|
||||
);
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
template<class Type>
|
||||
void createTrackField
|
||||
(
|
||||
const Field<Type>& values,
|
||||
const label sampleFrequency,
|
||||
const label maxPositions,
|
||||
const labelList& startIds,
|
||||
const List<labelField>& allOrigProcs,
|
||||
const List<labelField>& allOrigIds,
|
||||
List<DynamicList<Type>>& trackValues
|
||||
)
|
||||
{
|
||||
List<Field<Type>> procField(Pstream::nProcs());
|
||||
procField[Pstream::myProcNo()] = values;
|
||||
Pstream::gatherList(procField);
|
||||
|
||||
if (!Pstream::master())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const label nTracks = trackValues.size();
|
||||
|
||||
forAll(procField, proci)
|
||||
{
|
||||
forAll(procField[proci], i)
|
||||
{
|
||||
const label globalId =
|
||||
startIds[allOrigProcs[proci][i]] + allOrigIds[proci][i];
|
||||
|
||||
if (globalId % sampleFrequency == 0)
|
||||
{
|
||||
const label trackId = globalId/sampleFrequency;
|
||||
|
||||
if
|
||||
(
|
||||
trackId < nTracks
|
||||
&& trackValues[trackId].size() < maxPositions
|
||||
)
|
||||
{
|
||||
trackValues[trackId].append(procField[proci][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void writeTrackFields
|
||||
(
|
||||
List<List<DynamicList<Type>>>& fieldValues,
|
||||
const wordList& fieldNames,
|
||||
const PtrList<coordSet>& tracks,
|
||||
const List<scalarField>& times,
|
||||
const List<vectorField>& dirs,
|
||||
const word& setFormat,
|
||||
const dictionary& formatOptions,
|
||||
const word& cloudName
|
||||
)
|
||||
{
|
||||
if (fieldValues.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto writerPtr = writer<Type>::New(setFormat, formatOptions);
|
||||
|
||||
const fileName outFile(writerPtr().getFileName(tracks[0], wordList(0)));
|
||||
|
||||
const fileName outPath
|
||||
(
|
||||
functionObject::outputPrefix/cloud::prefix/cloudName/"particleTracks"
|
||||
);
|
||||
mkDir(outPath);
|
||||
|
||||
OFstream os(outPath/(pTraits<Type>::typeName & "tracks." + outFile.ext()));
|
||||
|
||||
Info<< "Writing " << pTraits<Type>::typeName << " particle tracks in "
|
||||
<< setFormat << " format to " << os.name() << endl;
|
||||
|
||||
|
||||
List<List<Field<Type>>> fields(fieldValues.size());
|
||||
forAll(fields, fieldi)
|
||||
{
|
||||
fields[fieldi].setSize(fieldValues[fieldi].size());
|
||||
forAll(fields[fieldi], tracki)
|
||||
{
|
||||
fields[fieldi][tracki].transfer(fieldValues[fieldi][tracki]);
|
||||
}
|
||||
}
|
||||
|
||||
writerPtr().write(true, times, tracks, fieldNames, fields, os);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::label setTrackFields
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
List<List<DynamicList<Type>>>& fields,
|
||||
List<word>& fieldNames,
|
||||
const label nTracks,
|
||||
const labelList& startIds,
|
||||
const List<labelField>& allOrigProcs,
|
||||
const List<labelField>& allOrigIds,
|
||||
const label maxPositions,
|
||||
const label sampleFrequency
|
||||
)
|
||||
{
|
||||
const auto availableFieldPtrs = obr.lookupClass<IOField<Type>>();
|
||||
|
||||
fieldNames = availableFieldPtrs.toc();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::combineScatter(fieldNames);
|
||||
Foam::sort(fieldNames);
|
||||
}
|
||||
|
||||
const label nFields = fieldNames.size();
|
||||
|
||||
if (fields.empty())
|
||||
{
|
||||
fields.setSize(nFields);
|
||||
fieldNames.setSize(nFields);
|
||||
forAll(fields, i)
|
||||
{
|
||||
fields[i].setSize(nTracks);
|
||||
}
|
||||
}
|
||||
|
||||
forAll(fieldNames, fieldi)
|
||||
{
|
||||
const word& fieldName = fieldNames[fieldi];
|
||||
|
||||
const auto* fldPtr = obr.cfindObject<IOField<Type>>(fieldName);
|
||||
|
||||
createTrack
|
||||
(
|
||||
fldPtr ? static_cast<const Field<Type>>(*fldPtr) : Field<Type>(),
|
||||
fields[fieldi]
|
||||
);
|
||||
}
|
||||
|
||||
return nFields;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Generate a legacy VTK file of particle tracks for cases that were"
|
||||
"Generate a file of particle tracks for cases that were"
|
||||
" computed using a tracked-parcel-type cloud"
|
||||
);
|
||||
|
||||
@ -76,9 +267,9 @@ int main(int argc, char *argv[])
|
||||
<< nl << endl;
|
||||
|
||||
labelList maxIds(Pstream::nProcs(), -1);
|
||||
forAll(timeDirs, timeI)
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
Info<< " Reading particle positions" << endl;
|
||||
@ -92,6 +283,8 @@ int main(int argc, char *argv[])
|
||||
const label origId = p.origId();
|
||||
const label origProc = p.origProc();
|
||||
|
||||
// Handle case where we are processing particle data generated in
|
||||
// parallel using more cores than when running this application.
|
||||
if (origProc >= maxIds.size())
|
||||
{
|
||||
maxIds.setSize(origProc+1, -1);
|
||||
@ -124,7 +317,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Calculate starting ids for particles on each processor
|
||||
labelList startIds(numIds.size(), Zero);
|
||||
for (label i = 0; i < numIds.size()-1; i++)
|
||||
for (label i = 0; i < numIds.size()-1; ++i)
|
||||
{
|
||||
startIds[i+1] += startIds[i] + numIds[i];
|
||||
}
|
||||
@ -132,130 +325,135 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Number of tracks to generate
|
||||
label nTracks = nParticle/sampleFrequency;
|
||||
const label nTracks =
|
||||
maxTracks > 0
|
||||
? min(nParticle/sampleFrequency, maxTracks)
|
||||
: nParticle/sampleFrequency;
|
||||
|
||||
// Storage for all particle tracks
|
||||
List<DynamicList<vector>> allTracks(nTracks);
|
||||
List<DynamicList<scalar>> allTrackTimes(nTracks);
|
||||
|
||||
// Lists of field, tracki, trackValues
|
||||
//List<List<DynamicList<label>>> labelFields;
|
||||
List<List<DynamicList<scalar>>> scalarFields;
|
||||
List<List<DynamicList<vector>>> vectorFields;
|
||||
List<List<DynamicList<sphericalTensor>>> sphTensorFields;
|
||||
List<List<DynamicList<symmTensor>>> symTensorFields;
|
||||
List<List<DynamicList<tensor>>> tensorFields;
|
||||
//List<word> labelFieldNames;
|
||||
List<word> scalarFieldNames;
|
||||
List<word> vectorFieldNames;
|
||||
List<word> sphTensorFieldNames;
|
||||
List<word> symTensorFieldNames;
|
||||
List<word> tensorFieldNames;
|
||||
|
||||
Info<< "\nGenerating " << nTracks << " particle tracks for cloud "
|
||||
<< cloudName << nl << endl;
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
List<pointField> allPositions(Pstream::nProcs());
|
||||
List<labelField> allOrigIds(Pstream::nProcs());
|
||||
List<labelField> allOrigProcs(Pstream::nProcs());
|
||||
|
||||
// Read particles. Will be size 0 if no particles.
|
||||
Info<< " Reading particle positions" << endl;
|
||||
passiveParticleCloud myCloud(mesh, cloudName);
|
||||
|
||||
pointField localPositions(myCloud.size(), Zero);
|
||||
scalarField localTimes(myCloud.size(), Zero);
|
||||
|
||||
List<labelField> allOrigIds(Pstream::nProcs());
|
||||
List<labelField> allOrigProcs(Pstream::nProcs());
|
||||
|
||||
// Collect the track data on all processors that have positions
|
||||
allPositions[Pstream::myProcNo()].setSize
|
||||
(
|
||||
myCloud.size(),
|
||||
point::zero
|
||||
);
|
||||
allOrigIds[Pstream::myProcNo()].setSize(myCloud.size(), Zero);
|
||||
allOrigProcs[Pstream::myProcNo()].setSize(myCloud.size(), Zero);
|
||||
|
||||
label i = 0;
|
||||
for (const passiveParticle& p : myCloud)
|
||||
{
|
||||
allPositions[Pstream::myProcNo()][i] = p.position();
|
||||
allOrigIds[Pstream::myProcNo()][i] = p.origId();
|
||||
allOrigProcs[Pstream::myProcNo()][i] = p.origProc();
|
||||
localPositions[i] = p.position();
|
||||
localTimes[i] = runTime.value();
|
||||
++i;
|
||||
}
|
||||
|
||||
// Collect the track data on the master processor
|
||||
Pstream::gatherList(allPositions);
|
||||
Pstream::gatherList(allOrigIds);
|
||||
Pstream::gatherList(allOrigProcs);
|
||||
|
||||
Info<< " Constructing tracks" << nl << endl;
|
||||
if (Pstream::master())
|
||||
{
|
||||
forAll(allPositions, proci)
|
||||
{
|
||||
forAll(allPositions[proci], i)
|
||||
{
|
||||
label globalId =
|
||||
startIds[allOrigProcs[proci][i]]
|
||||
+ allOrigIds[proci][i];
|
||||
objectRegistry obr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cloudFields",
|
||||
runTime.timeName(),
|
||||
runTime
|
||||
)
|
||||
);
|
||||
|
||||
if (globalId % sampleFrequency == 0)
|
||||
{
|
||||
label trackId = globalId/sampleFrequency;
|
||||
if (allTracks[trackId].size() < maxPositions)
|
||||
{
|
||||
allTracks[trackId].append
|
||||
(
|
||||
allPositions[proci][i]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myCloud.readFromFiles(obr, fieldNames);
|
||||
|
||||
// Create track positions and track time fields
|
||||
// (not registered as IOFields)
|
||||
// Note: createTrack is a local #define to reduce arg count...
|
||||
createTrack(localPositions, allTracks);
|
||||
createTrack(localTimes, allTrackTimes);
|
||||
|
||||
// Create the track fields
|
||||
// Note: setFields is a local #define to reduce arg count...
|
||||
//setFields(labelFields, labelFieldNames);
|
||||
setFields(scalarFields, scalarFieldNames);
|
||||
setFields(vectorFields, vectorFieldNames);
|
||||
setFields(sphTensorFields, sphTensorFieldNames);
|
||||
setFields(symTensorFields, symTensorFieldNames);
|
||||
setFields(tensorFields, tensorFieldNames);
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
PtrList<coordSet> tracks(allTracks.size());
|
||||
forAll(allTracks, trackI)
|
||||
List<scalarField> times(tracks.size());
|
||||
forAll(tracks, tracki)
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
"distance"
|
||||
)
|
||||
tracki,
|
||||
new coordSet("track" + Foam::name(tracki), "distance")
|
||||
);
|
||||
tracks[trackI].transfer(allTracks[trackI]);
|
||||
tracks[tracki].transfer(allTracks[tracki]);
|
||||
times[tracki].transfer(allTrackTimes[tracki]);
|
||||
}
|
||||
|
||||
autoPtr<writer<scalar>> scalarFormatterPtr = writer<scalar>::New
|
||||
(
|
||||
setFormat
|
||||
);
|
||||
Info<< nl;
|
||||
|
||||
//OFstream vtkTracks(vtkPath/"particleTracks.vtk");
|
||||
fileName vtkFile
|
||||
(
|
||||
scalarFormatterPtr().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
wordList(0)
|
||||
)
|
||||
);
|
||||
const label Uid = vectorFieldNames.find(UName);
|
||||
List<vectorField> dirs(nTracks);
|
||||
|
||||
OFstream vtkTracks
|
||||
(
|
||||
vtkPath/("particleTracks." + vtkFile.ext())
|
||||
);
|
||||
if (Uid != -1)
|
||||
{
|
||||
const auto& UTracks = vectorFields[Uid];
|
||||
forAll(UTracks, tracki)
|
||||
{
|
||||
const auto& U = UTracks[tracki];
|
||||
dirs[tracki] = U/(mag(U) + ROOTVSMALL);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nWriting particle tracks in " << setFormat
|
||||
<< " format to " << vtkTracks.name()
|
||||
<< nl << endl;
|
||||
|
||||
scalarFormatterPtr().write
|
||||
(
|
||||
true,
|
||||
tracks,
|
||||
wordList(0),
|
||||
List<List<scalarField>>(0),
|
||||
vtkTracks
|
||||
);
|
||||
// Write track fields
|
||||
// Note: writeFields is a local #define to reduce arg count...
|
||||
//writeFields(allLabelFields, labelFieldNames, tracks);
|
||||
writeFields(scalarFields, scalarFieldNames, tracks, times, dirs);
|
||||
writeFields(vectorFields, vectorFieldNames, tracks, times, dirs);
|
||||
writeFields(sphTensorFields, sphTensorFieldNames, tracks, times, dirs);
|
||||
writeFields(symTensorFields, symTensorFieldNames, tracks, times, dirs);
|
||||
writeFields(tensorFields, tensorFieldNames, tracks, times, dirs);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
Info<< nl << "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ Application
|
||||
steadyParticleTracks
|
||||
|
||||
Group
|
||||
grpPostProcessingUtilitie
|
||||
grpPostProcessingUtilities
|
||||
|
||||
Description
|
||||
Generate a legacy VTK file of particle tracks for cases that were
|
||||
|
||||
@ -72,24 +72,19 @@ int main(int argc, char *argv[])
|
||||
"Suppress calculation/display of point interpolators"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity"
|
||||
);
|
||||
|
||||
#include "addRegionOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const bool noInterpolate = args.found("no-interpolate");
|
||||
|
||||
// const bool verbose = args.found("verbose");
|
||||
|
||||
args.readIfPresent("visual-length", lumpedPointState::visLength);
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
if (args.dryRun())
|
||||
{
|
||||
// Create without a mesh
|
||||
|
||||
@ -203,7 +203,8 @@ static inline scalar averageSurrounding
|
||||
template<class Type>
|
||||
static inline Ostream& putUniform(Ostream& os, const word& key, const Type& val)
|
||||
{
|
||||
os.writeKeyword(key) << word("uniform") << token::SPACE
|
||||
os.writeKeyword(key)
|
||||
<< word("uniform") << token::SPACE
|
||||
<< val << token::END_STATEMENT << nl;
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,7 +54,7 @@ void Foam::PDRparams::readDefaults(const dictionary& dict)
|
||||
|
||||
outer_orthog = dict.found("outer_orthog");
|
||||
|
||||
dict.readIfPresent("debugLevel", debugLevel);
|
||||
dict.readIfPresent("debug.level", debugLevel);
|
||||
dict.readIfPresent("nFacesToBlockC", nFacesToBlockC);
|
||||
dict.readIfPresent("nPairsToBlockC", nPairsToBlockC);
|
||||
dict.readIfPresent("overlaps", overlaps);
|
||||
|
||||
@ -16,7 +16,7 @@ const vector L(dict.get<vector>("L"));
|
||||
const Vector<label> N(dict.get<Vector<label>>("N"));
|
||||
|
||||
// Wave number vs energy profile
|
||||
autoPtr<Function1<scalar>> Ek(Function1<scalar>::New("Ek", dict));
|
||||
autoPtr<Function1<scalar>> Ek(Function1<scalar>::New("Ek", dict, &runTime));
|
||||
|
||||
// Number of modes
|
||||
const label nModes = dict.get<label>("nModes");
|
||||
|
||||
@ -137,7 +137,7 @@ composedFunctionImplicitFunction
|
||||
{
|
||||
FatalIOErrorInFunction(funcDict)
|
||||
<< "Entry " << key << " is not a dictionary" << endl
|
||||
<< exit(FatalError);
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
const dictionary& subdict = dEntry.dict();
|
||||
|
||||
@ -231,18 +231,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
dictionary& patchDict = boundaryFieldDict.subDict(patchName);
|
||||
|
||||
expressions::exprString expr
|
||||
auto valueExpr_
|
||||
(
|
||||
currDict.get<string>("expression"),
|
||||
currDict,
|
||||
true // strip comments
|
||||
expressions::exprString::getEntry
|
||||
(
|
||||
"expression",
|
||||
currDict,
|
||||
true // strip comments
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Set boundaryField/" << patchName << '/'
|
||||
<< targetName << nl
|
||||
<< "with expression" << nl
|
||||
<< "<<<<" << nl
|
||||
<< expr.c_str() << nl
|
||||
<< valueExpr_.c_str() << nl
|
||||
<< ">>>>" << nl;
|
||||
|
||||
expressions::patchExprDriver driver(currDict, mesh);
|
||||
@ -255,7 +258,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
driver.clearVariables();
|
||||
driver.parse(expr);
|
||||
driver.parse(valueExpr_);
|
||||
|
||||
// Serializing via Field::writeEntry etc
|
||||
OStringStream serialize;
|
||||
|
||||
@ -53,18 +53,17 @@ Note
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
using FieldAssociation = expressions::volumeExpr::FieldAssociation;
|
||||
using FieldAssociation = expressions::FieldAssociation;
|
||||
|
||||
word fieldGeoType(const FieldAssociation geoType)
|
||||
{
|
||||
switch (geoType)
|
||||
{
|
||||
case FieldAssociation::VOLUME_DATA : return "cells"; break;
|
||||
case FieldAssociation::SURFACE_DATA : return "faces"; break;
|
||||
case FieldAssociation::POINT_DATA : return "points"; break;
|
||||
case FieldAssociation::FACE_DATA : return "faces"; break;
|
||||
case FieldAssociation::VOLUME_DATA : return "cells"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
@ -75,7 +74,7 @@ struct setExprFieldsControl
|
||||
bool dryRun;
|
||||
bool debugParsing;
|
||||
bool cacheVariables;
|
||||
bool useDimensions;
|
||||
bool hasDimensions;
|
||||
bool createNew;
|
||||
bool keepPatches;
|
||||
bool correctPatches;
|
||||
@ -123,13 +122,12 @@ void doCorrectBoundaryConditions
|
||||
{}
|
||||
|
||||
|
||||
template<class GeoField, class Mesh>
|
||||
void setField
|
||||
template<class GeoField>
|
||||
bool setField
|
||||
(
|
||||
const word& fieldName,
|
||||
const Mesh& mesh,
|
||||
const GeoField& result,
|
||||
const scalarField& cond,
|
||||
const GeoField& evaluated,
|
||||
const boolField& fieldMask,
|
||||
const dimensionSet& dims,
|
||||
const wordList& valuePatches,
|
||||
|
||||
@ -139,6 +137,8 @@ void setField
|
||||
Info<< "setField(" << fieldName << "): "
|
||||
<< pTraits<GeoField>::typeName << endl;
|
||||
|
||||
const auto& mesh = evaluated.mesh();
|
||||
|
||||
tmp<GeoField> toutput;
|
||||
|
||||
if (ctrl.createNew)
|
||||
@ -171,55 +171,57 @@ void setField
|
||||
|
||||
auto& output = toutput.ref();
|
||||
|
||||
label setCells = 0;
|
||||
label numValuesChanged = 0;
|
||||
|
||||
if (cond.empty())
|
||||
// Internal field
|
||||
if (fieldMask.empty())
|
||||
{
|
||||
// No condition - set all
|
||||
output = result;
|
||||
// No field-mask - set entire internal field
|
||||
numValuesChanged = output.size();
|
||||
|
||||
setCells = output.size();
|
||||
output.primitiveFieldRef() = evaluated;
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(output, celli)
|
||||
auto& internal = output.primitiveFieldRef();
|
||||
|
||||
forAll(internal, idx)
|
||||
{
|
||||
if (expressions::boolOp<scalar>()(cond[celli]))
|
||||
if (fieldMask[idx])
|
||||
{
|
||||
output[celli] = result[celli];
|
||||
++setCells;
|
||||
internal[idx] = evaluated[idx];
|
||||
++numValuesChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const label totalCells = returnReduce(output.size(), plusOp<label>());
|
||||
reduce(setCells, plusOp<label>());
|
||||
|
||||
forAll(result.boundaryField(), patchi)
|
||||
// Boundary fields
|
||||
forAll(evaluated.boundaryField(), patchi)
|
||||
{
|
||||
auto& pf = output.boundaryFieldRef()[patchi];
|
||||
|
||||
if (pf.patch().coupled())
|
||||
{
|
||||
pf == result.boundaryField()[patchi];
|
||||
pf == evaluated.boundaryField()[patchi];
|
||||
}
|
||||
}
|
||||
|
||||
doCorrectBoundaryConditions(ctrl.correctBCs, output);
|
||||
|
||||
if (setCells == totalCells)
|
||||
const label numTotal = returnReduce(output.size(), plusOp<label>());
|
||||
reduce(numValuesChanged, plusOp<label>());
|
||||
|
||||
if (numValuesChanged == numTotal)
|
||||
{
|
||||
Info<< "Set all ";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Set " << setCells << " of ";
|
||||
Info<< "Set " << numValuesChanged << " of ";
|
||||
}
|
||||
Info<< totalCells << " cells" << endl;
|
||||
Info<< numTotal << " values" << endl;
|
||||
|
||||
|
||||
doCorrectBoundaryConditions(ctrl.correctBCs, output);
|
||||
|
||||
if (ctrl.useDimensions)
|
||||
if (ctrl.hasDimensions)
|
||||
{
|
||||
Info<< "Setting dimensions to " << dims << endl;
|
||||
output.dimensions().reset(dims);
|
||||
@ -234,6 +236,8 @@ void setField
|
||||
Info<< "Writing to " << output.name() << nl;
|
||||
output.writeObject(ctrl.streamOpt, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -241,8 +245,8 @@ void evaluate
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& fieldName,
|
||||
const expressions::exprString& expression,
|
||||
const expressions::exprString& condition,
|
||||
const expressions::exprString& valueExpr_,
|
||||
const expressions::exprString& maskExpr_,
|
||||
const dictionary& dict,
|
||||
const dimensionSet& dims,
|
||||
const wordList& valuePatches,
|
||||
@ -273,10 +277,8 @@ void evaluate
|
||||
if (oldFieldType == IOobject::typeName)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Field " << fieldName << " is "
|
||||
<< oldFieldType
|
||||
<< ". Seems that it does not exist. Use 'create'"
|
||||
<< nl
|
||||
<< "Field " << fieldName << "(type: " << oldFieldType
|
||||
<< ") seems to be missing. Use 'create'" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -284,17 +286,21 @@ void evaluate
|
||||
<< " (type " << oldFieldType << ')';
|
||||
}
|
||||
|
||||
|
||||
Info<< " time=" << mesh.thisDb().time().timeName() << nl
|
||||
<< "Expression:" << nl
|
||||
<< ">>>>" << nl
|
||||
<< expression.c_str() << nl
|
||||
<< valueExpr_.c_str() << nl
|
||||
<< "<<<<" << nl;
|
||||
|
||||
if (condition.size() && condition != "true")
|
||||
bool evalFieldMask =
|
||||
(maskExpr_.size() && maskExpr_ != "true" && maskExpr_ != "1");
|
||||
|
||||
if (evalFieldMask)
|
||||
{
|
||||
Info<< "Condition:" << nl
|
||||
Info<< "field-mask:" << nl
|
||||
<< ">>>>" << nl
|
||||
<< condition.c_str() << nl
|
||||
<< maskExpr_.c_str() << nl
|
||||
<< "<<<<" << nl;
|
||||
}
|
||||
|
||||
@ -318,128 +324,95 @@ void evaluate
|
||||
|
||||
if (ctrl.debugParsing)
|
||||
{
|
||||
Info<< "Parsing expression: " << expression << "\nand condition "
|
||||
<< condition << nl << endl;
|
||||
Info<< "Parsing expression: " << valueExpr_ << "\nand field-mask "
|
||||
<< maskExpr_ << nl << endl;
|
||||
driver.setDebugging(true, true);
|
||||
}
|
||||
|
||||
|
||||
driver.clearVariables();
|
||||
|
||||
scalarField conditionField;
|
||||
|
||||
bool evaluatedCondition = false;
|
||||
// Handle "field-mask" evaluation
|
||||
|
||||
FieldAssociation conditionDataType(FieldAssociation::VOLUME_DATA);
|
||||
boolField fieldMask;
|
||||
FieldAssociation maskFieldAssoc(FieldAssociation::NO_DATA);
|
||||
|
||||
if (condition.size() && condition != "true")
|
||||
if (evalFieldMask)
|
||||
{
|
||||
if (ctrl.debugParsing)
|
||||
{
|
||||
Info<< "Parsing condition:" << condition << endl;
|
||||
Info<< "Parsing field-mask:" << maskExpr_ << endl;
|
||||
}
|
||||
|
||||
driver.parse(condition);
|
||||
driver.parse(maskExpr_);
|
||||
if (ctrl.debugParsing)
|
||||
{
|
||||
Info<< "Parsed condition" << endl;
|
||||
Info<< "Parsed field-mask" << endl;
|
||||
}
|
||||
|
||||
// Process any/all scalar fields. May help with diagnosis
|
||||
|
||||
bool goodCond = true;
|
||||
while (goodCond)
|
||||
if (driver.isLogical())
|
||||
{
|
||||
// volScalarField
|
||||
auto& result = driver.result();
|
||||
if (result.is_bool())
|
||||
{
|
||||
const auto* ptr = driver.isResultType<volScalarField>();
|
||||
if (ptr)
|
||||
{
|
||||
conditionField = ptr->internalField();
|
||||
break;
|
||||
}
|
||||
fieldMask = result.getResult<bool>();
|
||||
maskFieldAssoc = driver.fieldAssociation();
|
||||
}
|
||||
|
||||
// surfaceScalarField
|
||||
{
|
||||
const auto* ptr = driver.isResultType<surfaceScalarField>();
|
||||
if (ptr)
|
||||
{
|
||||
conditionField = ptr->internalField();
|
||||
conditionDataType = FieldAssociation::SURFACE_DATA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// pointScalarField
|
||||
{
|
||||
const auto* ptr = driver.isResultType<pointScalarField>();
|
||||
if (ptr)
|
||||
{
|
||||
conditionField = ptr->internalField();
|
||||
conditionDataType = FieldAssociation::POINT_DATA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// No matching field types
|
||||
goodCond = false;
|
||||
}
|
||||
|
||||
// Verify that it also logical
|
||||
goodCond = goodCond && driver.isLogical();
|
||||
// Slightly pedantic...
|
||||
driver.clearField();
|
||||
driver.clearResult();
|
||||
|
||||
if (!goodCond)
|
||||
evalFieldMask = (maskFieldAssoc != FieldAssociation::NO_DATA);
|
||||
|
||||
if (!evalFieldMask)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " condition: " << condition
|
||||
<< " mask: " << maskExpr_
|
||||
<< " does not evaluate to a logical expression: "
|
||||
<< driver.resultType() << nl
|
||||
#ifdef FULLDEBUG
|
||||
<< "contents: " << conditionField
|
||||
<< "contents: " << fieldMask
|
||||
#endif
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (ctrl.debugParsing)
|
||||
{
|
||||
Info<< "Condition evaluates to "
|
||||
<< conditionField << nl;
|
||||
Info<< "Field-mask evaluates to "
|
||||
<< fieldMask << nl;
|
||||
}
|
||||
|
||||
evaluatedCondition = true;
|
||||
}
|
||||
|
||||
if (ctrl.debugParsing)
|
||||
{
|
||||
Info<< "Parsing expression:" << expression << endl;
|
||||
Info<< "Parsing expression:" << valueExpr_ << endl;
|
||||
}
|
||||
|
||||
driver.parse(expression);
|
||||
driver.parse(valueExpr_);
|
||||
|
||||
if (ctrl.debugParsing)
|
||||
{
|
||||
Info<< "Parsed expression" << endl;
|
||||
}
|
||||
|
||||
if (evaluatedCondition)
|
||||
if (evalFieldMask && maskFieldAssoc != driver.fieldAssociation())
|
||||
{
|
||||
if (conditionDataType != driver.fieldAssociation())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Mismatch between condition geometric type ("
|
||||
<< fieldGeoType(conditionDataType) << ") and" << nl
|
||||
<< "expression geometric type ("
|
||||
<< fieldGeoType(driver.fieldAssociation()) << ')' << nl
|
||||
<< nl
|
||||
<< "Expression: " << expression << nl
|
||||
<< "Condition: " << condition << nl
|
||||
<< nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
FatalErrorInFunction
|
||||
<< "Mismatch between field-mask geometric type ("
|
||||
<< fieldGeoType(maskFieldAssoc) << ") and" << nl
|
||||
<< "expression geometric type ("
|
||||
<< fieldGeoType(driver.fieldAssociation()) << ')' << nl
|
||||
<< nl
|
||||
<< "expression: " << valueExpr_ << nl
|
||||
<< "field-mask: " << maskExpr_ << nl
|
||||
<< nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (!ctrl.createNew && driver.resultType() != oldFieldType)
|
||||
if (!oldFieldType.empty() && driver.resultType() != oldFieldType)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Inconsistent types: " << fieldName << " is "
|
||||
@ -451,81 +424,69 @@ void evaluate
|
||||
|
||||
Info<< "Dispatch ... " << driver.resultType() << nl;
|
||||
|
||||
#undef setFieldDispatch
|
||||
#define setFieldDispatch(FieldType) \
|
||||
{ \
|
||||
/* FieldType */ \
|
||||
const auto* ptr = driver.isResultType<FieldType>(); \
|
||||
if (ptr) \
|
||||
{ \
|
||||
/* driver.getResult<FieldType>(correctPatches), */ \
|
||||
\
|
||||
setField \
|
||||
( \
|
||||
fieldName, \
|
||||
mesh, \
|
||||
*ptr, \
|
||||
conditionField, \
|
||||
dims, \
|
||||
valuePatches, \
|
||||
ctrl \
|
||||
); \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
|
||||
bool applied = false;
|
||||
switch (driver.fieldAssociation())
|
||||
{
|
||||
#undef doLocalCode
|
||||
#define doLocalCode(GeoField) \
|
||||
{ \
|
||||
const auto* ptr = driver.isResultType<GeoField>(); \
|
||||
if (ptr) \
|
||||
{ \
|
||||
applied = setField \
|
||||
( \
|
||||
fieldName, \
|
||||
*ptr, \
|
||||
fieldMask, \
|
||||
dims, \
|
||||
valuePatches, \
|
||||
ctrl \
|
||||
); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
setFieldDispatch(volScalarField);
|
||||
setFieldDispatch(volVectorField);
|
||||
setFieldDispatch(volTensorField);
|
||||
setFieldDispatch(volSymmTensorField);
|
||||
setFieldDispatch(volSphericalTensorField);
|
||||
case FieldAssociation::VOLUME_DATA:
|
||||
{
|
||||
doLocalCode(volScalarField);
|
||||
doLocalCode(volVectorField);
|
||||
doLocalCode(volTensorField);
|
||||
doLocalCode(volSymmTensorField);
|
||||
doLocalCode(volSphericalTensorField);
|
||||
break;
|
||||
}
|
||||
case FieldAssociation::FACE_DATA:
|
||||
{
|
||||
doLocalCode(surfaceScalarField);
|
||||
doLocalCode(surfaceVectorField);
|
||||
doLocalCode(surfaceTensorField);
|
||||
doLocalCode(surfaceSymmTensorField);
|
||||
doLocalCode(surfaceSphericalTensorField);
|
||||
break;
|
||||
}
|
||||
case FieldAssociation::POINT_DATA:
|
||||
{
|
||||
doLocalCode(pointScalarField);
|
||||
doLocalCode(pointVectorField);
|
||||
doLocalCode(pointTensorField);
|
||||
doLocalCode(pointSymmTensorField);
|
||||
doLocalCode(pointSphericalTensorField);
|
||||
break;
|
||||
}
|
||||
|
||||
setFieldDispatch(surfaceScalarField);
|
||||
setFieldDispatch(surfaceVectorField);
|
||||
setFieldDispatch(surfaceTensorField);
|
||||
setFieldDispatch(surfaceSymmTensorField);
|
||||
setFieldDispatch(surfaceSphericalTensorField);
|
||||
default: break;
|
||||
#undef doLocalCode
|
||||
}
|
||||
|
||||
#undef setFieldDispatch
|
||||
#define setFieldDispatch(FieldType) \
|
||||
{ \
|
||||
/* FieldType */ \
|
||||
const auto* ptr = driver.isResultType<FieldType>(); \
|
||||
\
|
||||
if (ptr) \
|
||||
{ \
|
||||
/* driver.getResult<FieldType>(correctPatches), */ \
|
||||
\
|
||||
setField \
|
||||
( \
|
||||
fieldName, \
|
||||
pointMesh::New(mesh), \
|
||||
*ptr, \
|
||||
conditionField, \
|
||||
dims, \
|
||||
valuePatches, \
|
||||
ctrl \
|
||||
); \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
|
||||
setFieldDispatch(pointScalarField);
|
||||
setFieldDispatch(pointVectorField);
|
||||
setFieldDispatch(pointTensorField);
|
||||
setFieldDispatch(pointSymmTensorField);
|
||||
setFieldDispatch(pointSphericalTensorField);
|
||||
|
||||
#undef setFieldDispatch
|
||||
|
||||
// Nothing dispatched?
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Expression evaluates to an unsupported type: "
|
||||
<< driver.resultType() << nl << nl
|
||||
<< "Expression " << expression << nl << endl
|
||||
<< exit(FatalError);
|
||||
if (!applied)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Expression evaluates to an unsupported type: "
|
||||
<< driver.resultType() << nl << nl
|
||||
<< "Expression " << valueExpr_ << nl << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -553,9 +514,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"Evaluate but do not write"
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity",
|
||||
true // Advanced option
|
||||
);
|
||||
@ -584,12 +544,13 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"condition",
|
||||
"field-mask",
|
||||
"logic",
|
||||
"The logical condition when to apply the expression"
|
||||
"The field mask (logical condition) when to apply the expression"
|
||||
" (command-line operation)",
|
||||
true // Advanced option
|
||||
);
|
||||
argList::addOptionCompat("field-mask", {"condition", 2106});
|
||||
argList::addOption
|
||||
(
|
||||
"dimensions",
|
||||
@ -662,9 +623,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
const bool dryrun = args.dryRun();
|
||||
const bool verbose = args.found("verbose");
|
||||
|
||||
const word dictName("setExprFieldsDict");
|
||||
|
||||
instantList times = timeSelector::select0(runTime, args);
|
||||
@ -729,7 +687,7 @@ int main(int argc, char *argv[])
|
||||
wordHashSet badOptions
|
||||
({
|
||||
"create", "keepPatches", "value-patches",
|
||||
"condition", "expression", "dimensions"
|
||||
"field-mask", "expression", "dimensions"
|
||||
});
|
||||
badOptions.retain(args.options());
|
||||
|
||||
@ -797,7 +755,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
setExprFieldsControl ctrl;
|
||||
|
||||
ctrl.dryRun = dryrun;
|
||||
ctrl.dryRun = args.dryRun();
|
||||
ctrl.debugParsing = args.found("debug-parser");
|
||||
ctrl.cacheVariables = !args.found("no-variable-caching");
|
||||
|
||||
@ -805,25 +763,24 @@ int main(int argc, char *argv[])
|
||||
ctrl.keepPatches = args.found("keepPatches");
|
||||
ctrl.correctPatches = !args.found("noCorrectPatches");
|
||||
ctrl.correctBCs = args.found("correctResultBoundaryFields");
|
||||
ctrl.useDimensions = args.found("dimensions");
|
||||
ctrl.hasDimensions = args.found("dimensions");
|
||||
ctrl.streamOpt.format(runTime.writeFormat());
|
||||
if (args.found("ascii"))
|
||||
{
|
||||
ctrl.streamOpt.format(IOstream::ASCII);
|
||||
}
|
||||
|
||||
expressions::exprString
|
||||
expression
|
||||
(
|
||||
args["expression"],
|
||||
dictionary::null
|
||||
);
|
||||
expressions::exprString valueExpr_
|
||||
(
|
||||
args["expression"],
|
||||
dictionary::null
|
||||
);
|
||||
|
||||
expressions::exprString condition;
|
||||
args.readIfPresent("condition", condition);
|
||||
expressions::exprString maskExpr_;
|
||||
args.readIfPresent("field-mask", maskExpr_);
|
||||
|
||||
dimensionSet dims;
|
||||
if (ctrl.useDimensions)
|
||||
if (ctrl.hasDimensions)
|
||||
{
|
||||
ITstream is(args.lookup("dimensions"));
|
||||
is >> dims;
|
||||
@ -833,8 +790,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
fieldName,
|
||||
expression,
|
||||
condition,
|
||||
valueExpr_,
|
||||
maskExpr_,
|
||||
dictionary::null,
|
||||
dims,
|
||||
args.getList<word>("value-patches", false),
|
||||
@ -869,7 +826,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
setExprFieldsControl ctrl;
|
||||
|
||||
ctrl.dryRun = dryrun;
|
||||
ctrl.dryRun = args.dryRun();
|
||||
ctrl.debugParsing = args.found("debug-parser");
|
||||
ctrl.cacheVariables = !args.found("no-variable-caching");
|
||||
|
||||
@ -902,22 +859,28 @@ int main(int argc, char *argv[])
|
||||
|
||||
const word fieldName(dict.get<word>("field"));
|
||||
|
||||
expressions::exprString expression
|
||||
auto valueExpr_
|
||||
(
|
||||
dict.get<string>("expression"),
|
||||
dict
|
||||
expressions::exprString::getEntry
|
||||
(
|
||||
"expression",
|
||||
dict
|
||||
)
|
||||
);
|
||||
|
||||
expressions::exprString condition;
|
||||
|
||||
if (dict.found("condition"))
|
||||
expressions::exprString maskExpr_;
|
||||
{
|
||||
condition =
|
||||
expressions::exprString
|
||||
(
|
||||
dict.get<string>("condition"),
|
||||
dict
|
||||
);
|
||||
const entry* eptr = dict.findCompat
|
||||
(
|
||||
"fieldMask", {{"condition", 2106}},
|
||||
keyType::LITERAL
|
||||
);
|
||||
|
||||
if (eptr)
|
||||
{
|
||||
maskExpr_.readEntry(eptr->keyword(), dict);
|
||||
maskExpr_.trim();
|
||||
}
|
||||
}
|
||||
|
||||
dimensionSet dims;
|
||||
@ -931,10 +894,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
dimPtr->stream() >> dims;
|
||||
}
|
||||
ctrl.useDimensions = bool(dimPtr);
|
||||
ctrl.hasDimensions = bool(dimPtr);
|
||||
}
|
||||
|
||||
if (verbose && !timei)
|
||||
if (args.verbose() && !timei)
|
||||
{
|
||||
// Report once
|
||||
Info<< "Processing" << dict << nl;
|
||||
@ -944,8 +907,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
fieldName,
|
||||
expression,
|
||||
condition,
|
||||
valueExpr_,
|
||||
maskExpr_,
|
||||
dict,
|
||||
dims,
|
||||
dict.getOrDefault<wordList>("valuePatches", wordList()),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / O peration | Version: v2112 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -31,7 +31,7 @@ expressions
|
||||
"radius = 0.1"
|
||||
);
|
||||
|
||||
condition
|
||||
fieldMask
|
||||
#{
|
||||
// Within the radius
|
||||
(mag(pos() - $[(vector)constants.centre]) < radius)
|
||||
|
||||
@ -308,9 +308,8 @@ int main(int argc, char *argv[])
|
||||
"Split surface along non-manifold edges "
|
||||
"(default split is fully disconnected)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
argList::addVerboseOption
|
||||
(
|
||||
"verbose",
|
||||
"Additional verbosity"
|
||||
);
|
||||
argList::addBoolOption
|
||||
|
||||
@ -46,6 +46,9 @@
|
||||
# The '-show-api' and '-show-patch' options extract values from
|
||||
# the "META-INFO/api-info" file
|
||||
#
|
||||
# The '-show-build' options extract values from
|
||||
# the "META-INFO/build-info" file
|
||||
#
|
||||
# SeeAlso
|
||||
# META-INFO/README.md for other routines that also use META-INFO.
|
||||
#
|
||||
@ -71,6 +74,7 @@ options:
|
||||
-etc=[DIR] set/unset FOAM_CONFIG_ETC for alternative etc directory
|
||||
-show-api Print META-INFO api value and exit
|
||||
-show-patch Print META-INFO patch value and exit
|
||||
-show-build Print META-INFO build value and exit
|
||||
-with-api=NUM Specify alternative api value to search with
|
||||
-quiet (-q) Suppress all normal output
|
||||
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
|
||||
@ -155,6 +159,14 @@ getApiInfo()
|
||||
}
|
||||
|
||||
|
||||
# Get 'build' from META-INFO/build-info
|
||||
getBuildValue()
|
||||
{
|
||||
value="$(sed -ne 's@^build *= *\([^ ]*\).*@\1@p' "$projectDir"/META-INFO/build-info 2>/dev/null)"
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
unset shellOutput verboseOutput
|
||||
unset optAll optConfig optList projectApi
|
||||
@ -177,6 +189,10 @@ do
|
||||
getApiInfo patch
|
||||
exit $?
|
||||
;;
|
||||
-show-build) # Show build information and exit
|
||||
getBuildValue
|
||||
exit $?
|
||||
;;
|
||||
-with-api=*)
|
||||
projectApi="${1#*=}"
|
||||
;;
|
||||
|
||||
@ -123,7 +123,7 @@ cleanCase()
|
||||
rm -rf system/machines
|
||||
|
||||
# Possible blockMesh output
|
||||
rm -f blockTopology.vtu blockTopology.obj blockCentres.obj
|
||||
rm -f blockTopology.vtu blockFaces.vtp blockTopology.obj blockCentres.obj
|
||||
|
||||
# From mpirunDebug
|
||||
rm -f gdbCommands mpirun.schema
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
# Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -39,16 +39,18 @@ fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -d "$projectDir" ]
|
||||
_com_openfoam_projectDir="$projectDir"
|
||||
if [ -d "$_com_openfoam_projectDir" ]
|
||||
then
|
||||
_foamSourceBashEnv="$projectDir/etc/bashrc"
|
||||
_com_openfoam_bashrcFile="${_com_openfoam_projectDir}/etc/bashrc"
|
||||
else
|
||||
unset _foamSourceBashEnv
|
||||
unset _com_openfoam_bashrcFile
|
||||
fi
|
||||
|
||||
|
||||
# Source the user bashrc first.
|
||||
# Simply hope that they don't unset/reset _foamSourceBashEnv !!
|
||||
# Source the user bashrc first. Improbable they use the following variables:
|
||||
# * _com_openfoam_bashrcFile
|
||||
# * _com_openfoam_projectDir
|
||||
|
||||
if [ -f "$HOME/.bashrc" ]
|
||||
then
|
||||
@ -58,40 +60,90 @@ fi
|
||||
|
||||
# Source the OpenFOAM etc/bashrc
|
||||
|
||||
if [ -f "$_foamSourceBashEnv" ]
|
||||
if [ -f "$_com_openfoam_bashrcFile" ]
|
||||
then
|
||||
. "$_foamSourceBashEnv" $FOAM_SETTINGS
|
||||
. "$_com_openfoam_bashrcFile" $FOAM_SETTINGS
|
||||
|
||||
# Avoid further inheritance
|
||||
unset FOAM_SETTINGS
|
||||
else
|
||||
echo "Missing OpenFOAM etc/bashrc in '${_com_openfoam_projectDir}'" 1>&2
|
||||
fi
|
||||
unset _com_openfoam_bashrcFile _com_openfoam_projectDir
|
||||
|
||||
# Some feedback
|
||||
if [ -n "$PS1" ] && [ -d "$WM_PROJECT_DIR" ]
|
||||
|
||||
# Welcome banner - format somewhat like Ubuntu welcome
|
||||
#----
|
||||
## Welcome to Ubuntu VER (GNU/Linux ... x86_64)
|
||||
##
|
||||
## * Documentation: ...
|
||||
#----
|
||||
|
||||
if [ -n "$PS1" ] ## Interactive
|
||||
then
|
||||
if [ -d "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
info="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch 2>/dev/null)"
|
||||
_foam_api="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-api 2>/dev/null)"
|
||||
_foam_patch="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-patch 2>/dev/null)"
|
||||
_foam_build="$("$WM_PROJECT_DIR"/bin/foamEtcFile -show-build 2>/dev/null)"
|
||||
|
||||
# echo "Using: OpenFOAM-$WM_PROJECT_VERSION ($FOAM_API${info:+ patch=$info}) - visit www.openfoam.com" 1>&2
|
||||
echo "Using: OpenFOAM-$WM_PROJECT_VERSION${info:+ (patch=$info)} - visit www.openfoam.com" 1>&2
|
||||
echo "Arch: $WM_OPTIONS (mpi=$FOAM_MPI)" 1>&2
|
||||
unset _foam_arch1
|
||||
case "$WM_OPTIONS" in # Or WM_LABEL_SIZE?
|
||||
(*Int32*) _foam_arch1="label=32" ;;
|
||||
(*Int64*) _foam_arch1="label=64" ;;
|
||||
esac
|
||||
|
||||
## echo "$WM_PROJECT_DIR" 1>&2
|
||||
## echo 1>&2
|
||||
unset _foam_arch2
|
||||
case "$WM_OPTIONS" in # Or WM_PRECISION_OPTION?
|
||||
(*SPDPInt*) _foam_arch2="scalar=32;solveScalar=64" ;;
|
||||
(*SPInt*) _foam_arch2="scalar=32" ;;
|
||||
(*DPInt*) _foam_arch2="scalar=64" ;;
|
||||
esac
|
||||
|
||||
if [ "${_foam_patch:-0}" = 0 ]
|
||||
then
|
||||
unset _foam_patch
|
||||
fi
|
||||
if [ -n "$_foam_build" ]
|
||||
then
|
||||
# Everything there - format like binary -help output
|
||||
_foam_build="${_foam_build}${_foam_patch:+ (patch=${_foam_patch})}"
|
||||
_foam_verinfo="${_foam_api}"
|
||||
else
|
||||
# Missing build info - combine api and patch info together
|
||||
_foam_verinfo="${_foam_api}${_foam_patch:+ patch=${_foam_patch}}"
|
||||
fi
|
||||
|
||||
echo "openfoam = $WM_PROJECT_DIR" 1>&2
|
||||
echo 1>&2
|
||||
echo " * Using: OpenFOAM-$WM_PROJECT_VERSION (${_foam_verinfo}) - visit www.openfoam.com" 1>&2
|
||||
if [ -n "$_foam_build" ]
|
||||
then
|
||||
echo " * Build: ${_foam_build}" 1>&2
|
||||
fi
|
||||
# Arch: LSB;label=32;scalar=64
|
||||
echo " * Arch: $_foam_arch1;$_foam_arch2" 1>&2
|
||||
echo " * Platform: $WM_OPTIONS (mpi=$FOAM_MPI)" 1>&2
|
||||
echo 1>&2
|
||||
|
||||
# Set prompt as reminder that this is a shell session
|
||||
|
||||
# Chalmers likes this one:
|
||||
# PS1="OpenFOAM${FOAM_API:+-$FOAM_API}:"'$(foamPwd)\n\u\$ '
|
||||
# PS1="openfoam${_foam_api}:"'$(foamPwd)\n\u\$ '
|
||||
|
||||
PS1="OpenFOAM${FOAM_API:+-$FOAM_API}:"'\w/\n\u\$ '
|
||||
PS1="openfoam${_foam_api}:"'\w/\n\u\$ '
|
||||
unset _foam_arch1 _foam_arch2
|
||||
unset _foam_api _foam_patch _foam_build _foam_verinfo
|
||||
else
|
||||
# Adjust prompt if not found - reminder that it is a shell session
|
||||
PS1="openfoam(not-found):"'\w/\n\u\$ '
|
||||
fi
|
||||
else
|
||||
echo "Could not locate OpenFOAM etc/bashrc in '$projectDir'" 1>&2
|
||||
|
||||
echo "OpenFOAM shell session - use 'exit' to quit" 1>&2
|
||||
echo 1>&2
|
||||
fi
|
||||
|
||||
echo "OpenFOAM shell session - use exit to quit" 1>&2
|
||||
echo 1>&2
|
||||
|
||||
# Cleanup variables (done as final statement for a clean exit code)
|
||||
unset _foamSourceBashEnv projectDir
|
||||
unset projectDir
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
## Known Build Issues (v2012, v2106)
|
||||
## Known Build Issues (v2012, v2106, v2112)
|
||||
|
||||
### Windows cross-compilation
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / O peration | Version: v2112 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -34,7 +34,7 @@ expressions
|
||||
"radius = 0.1"
|
||||
);
|
||||
|
||||
condition
|
||||
fieldMask
|
||||
#{
|
||||
// Within the radius
|
||||
(mag(pos() - $[(vector)constants.centre]) < radius)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Version: v2106
|
||||
\\ / O peration | Version: v2112
|
||||
\\ / A nd | Website: www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
@ -15,11 +15,12 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type dsmcFields;
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
type dsmcFields;
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
|
||||
fields (rhoNMean rhoMMean momentumMean linearKEMean internalEMean
|
||||
iDofMean fDMean);
|
||||
// Names for reference purposes only
|
||||
fields ( rhoNMean rhoMMean momentumMean linearKEMean internalEMean
|
||||
iDofMean fDMean );
|
||||
|
||||
executeControl writeTime;
|
||||
writeControl writeTime;
|
||||
|
||||
@ -78,7 +78,7 @@ CONSTRUCT
|
||||
scalarData_(dict.get<scalar>("scalarData")),
|
||||
data_(dict.get<TYPE>("data")),
|
||||
fieldData_("fieldData", dict, p.size()),
|
||||
timeVsData_(Function1<TYPE>::New("timeVsData", dict)),
|
||||
timeVsData_(Function1<TYPE>::New("timeVsData", dict, &this->db())),
|
||||
wordData_(dict.getOrDefault<word>("wordName", "wordDefault")),
|
||||
labelData_(-1),
|
||||
boolData_(false)
|
||||
|
||||
121
etc/codeTemplates/dynamicCode/codedFunction1Template.C
Normal file
121
etc/codeTemplates/dynamicCode/codedFunction1Template.C
Normal file
@ -0,0 +1,121 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) YEAR AUTHOR,AFFILIATION
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "codedFunction1Template.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
//}}} end codeInclude
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
//{{{ begin localCode
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
// dynamicCode:
|
||||
// SHA1 = ${SHA1sum}
|
||||
//
|
||||
// unique function name that can be checked if the correct library version
|
||||
// has been loaded
|
||||
extern "C" void ${typeName}_${SHA1sum}(bool load)
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
// Code that can be explicitly executed after loading
|
||||
}
|
||||
else
|
||||
{
|
||||
// Code that can be explicitly executed before unloading
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Function1Types
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
//makeFunction1(${typeName}Function1, ${TemplateType});
|
||||
defineTypeNameAndDebug
|
||||
(
|
||||
${typeName}Function1_${TemplateType},
|
||||
0
|
||||
);
|
||||
Function1<${TemplateType}>::addRemovabledictionaryConstructorToTable
|
||||
<${typeName}Function1_${TemplateType}>
|
||||
addRemovable${typeName}Function1_${TemplateType}ConstructorToTable_;
|
||||
|
||||
} // namespace Function1Types
|
||||
} // namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Function1Types::
|
||||
${typeName}Function1_${TemplateType}::
|
||||
${typeName}Function1_${TemplateType}
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const objectRegistry* obrPtr
|
||||
)
|
||||
:
|
||||
Function1<${TemplateType}>(entryName, dict, obrPtr)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
printMessage("Construct ${typeName} Function1 from dictionary");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::${TemplateType}
|
||||
Foam::Function1Types::${typeName}Function1_${TemplateType}::value
|
||||
(
|
||||
const scalar x
|
||||
) const
|
||||
{
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
119
etc/codeTemplates/dynamicCode/codedFunction1Template.H
Normal file
119
etc/codeTemplates/dynamicCode/codedFunction1Template.H
Normal file
@ -0,0 +1,119 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
Description
|
||||
Template for use with dynamic code generation of a Function1
|
||||
|
||||
SourceFiles
|
||||
codedFunction1Template.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef dynamicCode_codedFunction1_${typeName}_${TemplateType}_H
|
||||
#define dynamicCode_codedFunction1_${typeName}_${TemplateType}_H
|
||||
|
||||
#include "Function1.H"
|
||||
#include "dictionaryContent.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace Function1Types
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A coded version Function1
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}Function1_${TemplateType}
|
||||
:
|
||||
public Function1<${TemplateType}>,
|
||||
public dictionaryContent
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Report a message with the SHA1sum
|
||||
inline static void printMessage(const char* message)
|
||||
{
|
||||
Info<< message << " sha1: " << SHA1sum << '\n';
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//- SHA1 representation of the code content
|
||||
static constexpr const char* const SHA1sum = "${SHA1sum}";
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("${typeName}");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from entry name, dictionary and registry
|
||||
${typeName}Function1_${TemplateType}
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const objectRegistry* obrPtr = nullptr
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
${typeName}Function1_${TemplateType}
|
||||
(
|
||||
const ${typeName}Function1_${TemplateType}& rhs
|
||||
) = default;
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<Function1<${TemplateType}>> clone() const
|
||||
{
|
||||
return tmp<Function1<${TemplateType}>>
|
||||
(
|
||||
new ${typeName}Function1_${TemplateType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}Function1_${TemplateType}() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return value as a function of (scalar) independent variable
|
||||
virtual ${TemplateType} value(const scalar x) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Function1Types
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -83,9 +83,13 @@ addRemovableToRunTimeSelectionTable
|
||||
dictionary
|
||||
);
|
||||
|
||||
} // End namespace fv
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::
|
||||
${typeName}FvOption${SourceType}::
|
||||
${typeName}FvOption${SourceType}
|
||||
(
|
||||
@ -106,6 +110,7 @@ ${typeName}FvOption${SourceType}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fv::
|
||||
${typeName}FvOption${SourceType}::
|
||||
~${typeName}FvOption${SourceType}()
|
||||
{
|
||||
@ -119,6 +124,7 @@ ${typeName}FvOption${SourceType}::
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void
|
||||
Foam::fv::
|
||||
${typeName}FvOption${SourceType}::correct
|
||||
(
|
||||
GeometricField<${TemplateType}, fvPatchField, volMesh>& fld
|
||||
@ -136,6 +142,7 @@ ${typeName}FvOption${SourceType}::correct
|
||||
|
||||
|
||||
void
|
||||
Foam::fv::
|
||||
${typeName}FvOption${SourceType}::addSup
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
@ -147,13 +154,14 @@ ${typeName}FvOption${SourceType}::addSup
|
||||
Info<< "${typeName}FvOption${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
//{{{ begin code - warn/fatal if not implemented?
|
||||
${codeAddSup}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Foam::fv::
|
||||
${typeName}FvOption${SourceType}::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
@ -163,16 +171,17 @@ ${typeName}FvOption${SourceType}::addSup
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<< "${typeName}FvOption${SourceType}::addSup()\n";
|
||||
Info<< "${typeName}FvOption${SourceType}::addSup(rho)\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
${codeAddSup}
|
||||
//{{{ begin code - warn/fatal if not implemented?
|
||||
${codeAddSupRho}
|
||||
//}}} end code
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Foam::fv::
|
||||
${typeName}FvOption${SourceType}::constrain
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
@ -190,9 +199,4 @@ ${typeName}FvOption${SourceType}::constrain
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fv
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -35,7 +35,14 @@ Description
|
||||
|
||||
codeAddSup
|
||||
(
|
||||
fvMatrix<Type}>& eqn,
|
||||
fvMatrix<Type>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
|
||||
codeAddSupRho
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<Type>& eqn,
|
||||
const label fieldi
|
||||
)
|
||||
|
||||
@ -156,7 +163,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Code context as a dictionary
|
||||
const dictionary& codeContext() const
|
||||
const dictionary& codeContext() const noexcept
|
||||
{
|
||||
return dictionaryContent::dict();
|
||||
}
|
||||
|
||||
@ -80,14 +80,17 @@ defineTypeNameAndDebug
|
||||
${typeName}PatchFunction1${FieldType},
|
||||
0
|
||||
);
|
||||
PatchFunction1<${TemplateType}>::adddictionaryConstructorToTable
|
||||
PatchFunction1<${TemplateType}>::addRemovabledictionaryConstructorToTable
|
||||
<${typeName}PatchFunction1${FieldType}>
|
||||
add${typeName}PatchFunction1${FieldType}ConstructorToTable_;
|
||||
addRemovable${typeName}PatchFunction1${FieldType}ConstructorToTable_;
|
||||
|
||||
} // namespace PatchFunction1Types
|
||||
} // namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::PatchFunction1Types::
|
||||
${typeName}PatchFunction1${FieldType}::
|
||||
${typeName}PatchFunction1${FieldType}
|
||||
(
|
||||
@ -107,6 +110,7 @@ ${typeName}PatchFunction1${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::PatchFunction1Types::
|
||||
${typeName}PatchFunction1${FieldType}::
|
||||
${typeName}PatchFunction1${FieldType}
|
||||
(
|
||||
@ -121,7 +125,7 @@ ${typeName}PatchFunction1${FieldType}
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::Field<Foam::${TemplateType}>>
|
||||
${typeName}PatchFunction1${FieldType}::value
|
||||
Foam::PatchFunction1Types::${typeName}PatchFunction1${FieldType}::value
|
||||
(
|
||||
const scalar x
|
||||
) const
|
||||
@ -132,10 +136,4 @@ ${typeName}PatchFunction1${FieldType}::value
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace PatchFunction1Types
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -31,8 +31,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef codedPatchFunction1Template${FieldType}_H
|
||||
#define codedPatchFunction1Template${FieldType}_H
|
||||
#ifndef dynamicCode_codedPatchFunction1_${typeName}_${FieldType}_H
|
||||
#define dynamicCode_codedPatchFunction1_${typeName}_${FieldType}_H
|
||||
|
||||
#include "PatchFunction1.H"
|
||||
#include "dictionaryContent.H"
|
||||
@ -126,20 +126,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Is value uniform (i.e. independent of coordinate)
|
||||
virtual bool uniform() const { return false; }
|
||||
|
||||
//- Return value as a function of (scalar) independent variable
|
||||
virtual tmp<Field<${TemplateType}>> value(const scalar x) const;
|
||||
|
||||
//- Is value constant (i.e. independent of x)
|
||||
virtual bool constant() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Is value uniform (i.e. independent of coordinate)
|
||||
virtual bool uniform() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -75,10 +75,14 @@ extern "C" void ${typeName}_${SHA1sum}(bool load)
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}Points0MotionSolver::${typeName}Points0MotionSolver
|
||||
Foam::
|
||||
${typeName}Points0MotionSolver::
|
||||
${typeName}Points0MotionSolver
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const IOdictionary& dict
|
||||
@ -90,13 +94,16 @@ ${typeName}Points0MotionSolver::${typeName}Points0MotionSolver
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}Points0MotionSolver::~${typeName}Points0MotionSolver()
|
||||
Foam::
|
||||
${typeName}Points0MotionSolver::
|
||||
~${typeName}Points0MotionSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<pointField> ${typeName}Points0MotionSolver::curPoints() const
|
||||
Foam::tmp<Foam::pointField>
|
||||
Foam::${typeName}Points0MotionSolver::curPoints() const
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -109,8 +116,4 @@ tmp<pointField> ${typeName}Points0MotionSolver::curPoints() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Code context as a dictionary
|
||||
const dictionary& codeContext() const
|
||||
const dictionary& codeContext() const noexcept
|
||||
{
|
||||
return dictionaryContent::dict();
|
||||
}
|
||||
|
||||
@ -78,9 +78,12 @@ makeRemovablePatchTypeField
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -97,6 +100,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -115,6 +119,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -132,6 +137,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -147,6 +153,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -165,6 +172,7 @@ ${typeName}FixedValueFvPatch${FieldType}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::
|
||||
~${typeName}FixedValueFvPatch${FieldType}()
|
||||
{
|
||||
@ -178,6 +186,7 @@ ${typeName}FixedValueFvPatch${FieldType}::
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void
|
||||
Foam::
|
||||
${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
@ -198,8 +207,4 @@ ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -143,7 +143,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Code context as a dictionary
|
||||
const dictionary& codeContext() const
|
||||
const dictionary& codeContext() const noexcept
|
||||
{
|
||||
return dictionaryContent::dict();
|
||||
}
|
||||
|
||||
@ -77,9 +77,12 @@ makePointPatchTypeField
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
@ -96,6 +99,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
@ -114,6 +118,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
@ -132,6 +137,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
@ -147,6 +153,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
@ -165,6 +172,7 @@ ${typeName}FixedValuePointPatch${FieldType}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::
|
||||
~${typeName}FixedValuePointPatch${FieldType}()
|
||||
{
|
||||
@ -178,6 +186,7 @@ ${typeName}FixedValuePointPatch${FieldType}::
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void
|
||||
Foam::
|
||||
${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
@ -198,8 +207,4 @@ ${typeName}FixedValuePointPatch${FieldType}::updateCoeffs()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -144,7 +144,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Code context as a dictionary
|
||||
const dictionary& codeContext() const
|
||||
const dictionary& codeContext() const noexcept
|
||||
{
|
||||
return dictionaryContent::dict();
|
||||
}
|
||||
|
||||
@ -75,10 +75,13 @@ extern "C" void ${typeName}_${SHA1sum}(bool load)
|
||||
${localCode}
|
||||
//}}} end localCode
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
const fvMesh& ${typeName}FunctionObject::mesh() const
|
||||
const Foam::fvMesh&
|
||||
Foam::${typeName}FunctionObject::mesh() const
|
||||
{
|
||||
return refCast<const fvMesh>(obr_);
|
||||
}
|
||||
@ -86,7 +89,9 @@ const fvMesh& ${typeName}FunctionObject::mesh() const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FunctionObject::${typeName}FunctionObject
|
||||
Foam::
|
||||
${typeName}FunctionObject::
|
||||
${typeName}FunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
@ -101,13 +106,16 @@ ${typeName}FunctionObject::${typeName}FunctionObject
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FunctionObject::~${typeName}FunctionObject()
|
||||
Foam::
|
||||
${typeName}FunctionObject::
|
||||
~${typeName}FunctionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool
|
||||
Foam::
|
||||
${typeName}FunctionObject::read(const dictionary& dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
@ -124,6 +132,7 @@ ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
|
||||
|
||||
bool
|
||||
Foam::
|
||||
${typeName}FunctionObject::execute()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
@ -140,6 +149,7 @@ ${typeName}FunctionObject::execute()
|
||||
|
||||
|
||||
bool
|
||||
Foam::
|
||||
${typeName}FunctionObject::write()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
@ -156,6 +166,7 @@ ${typeName}FunctionObject::write()
|
||||
|
||||
|
||||
bool
|
||||
Foam::
|
||||
${typeName}FunctionObject::end()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
@ -171,8 +182,4 @@ ${typeName}FunctionObject::end()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -32,8 +32,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjectTemplate_H
|
||||
#define functionObjectTemplate_H
|
||||
#ifndef coded_functionObjectTemplate_H
|
||||
#define coded_functionObjectTemplate_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "dictionaryContent.H"
|
||||
@ -116,7 +116,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Code context as a dictionary
|
||||
const dictionary& codeContext() const
|
||||
const dictionary& codeContext() const noexcept
|
||||
{
|
||||
return dictionaryContent::dict();
|
||||
}
|
||||
|
||||
@ -77,9 +77,12 @@ makeRemovablePatchTypeField
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -96,6 +99,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -114,6 +118,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -131,6 +136,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -146,6 +152,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
}
|
||||
|
||||
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -164,6 +171,7 @@ ${typeName}MixedValueFvPatch${FieldType}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::
|
||||
~${typeName}MixedValueFvPatch${FieldType}()
|
||||
{
|
||||
@ -177,6 +185,7 @@ ${typeName}MixedValueFvPatch${FieldType}::
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void
|
||||
Foam::
|
||||
${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
@ -197,8 +206,4 @@ ${typeName}MixedValueFvPatch${FieldType}::updateCoeffs()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -143,7 +143,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Code context as a dictionary
|
||||
const dictionary& codeContext() const
|
||||
const dictionary& codeContext() const noexcept
|
||||
{
|
||||
return dictionaryContent::dict();
|
||||
}
|
||||
|
||||
@ -437,10 +437,10 @@ case SGIMPI:
|
||||
|
||||
|
||||
# ----
|
||||
# Also support any ending (eg, INTELMPI_custom) to allow custom wmake rules
|
||||
case intelmpi:
|
||||
case intelmpi-[1-9]*:
|
||||
case INTELMPI:
|
||||
case INTELMPI-[1-9]*:
|
||||
case INTELMPI*: ## Also includes (INTELMPI | INTELMPI-[1-9]*)
|
||||
setenv FOAM_MPI intelmpi
|
||||
|
||||
## Add version embedded in the naming
|
||||
|
||||
@ -99,7 +99,7 @@ case "none":
|
||||
breaksw
|
||||
|
||||
case "system":
|
||||
# Obtain major.minor from `paraview --version`
|
||||
# Obtain (major.minor) from `paraview --version`
|
||||
set pv_api=`paraview --version | sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'`
|
||||
|
||||
if ("${pv_api}" == "") then
|
||||
@ -183,7 +183,7 @@ default:
|
||||
set pvLibDir="${libDir}/paraview-${pv_api}"
|
||||
if ( -d "${ParaView_DIR}/${pvLibDir}" ) then
|
||||
switch ("$pv_api")
|
||||
case 5.[0-4]*:
|
||||
case 5.[0-4]:
|
||||
set libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
|
||||
breaksw
|
||||
endsw
|
||||
@ -203,8 +203,8 @@ default:
|
||||
|
||||
|
||||
# Any extra library directories
|
||||
if ( -n "$pv_libdirs" != "" ) then
|
||||
switch "WM_ARCH" in
|
||||
if ( "$pv_libdirs" != "" ) then
|
||||
switch ("$WM_ARCH")
|
||||
case darwin*:
|
||||
setenv DYLD_LIBRARY_PATH "${pv_libdirs}:$DYLD_LIBRARY_PATH"
|
||||
breaksw
|
||||
|
||||
@ -106,6 +106,11 @@ unsetenv FOAM_USER_APPBIN
|
||||
unsetenv FOAM_USER_LIBBIN
|
||||
unsetenv FOAM_UTILITIES
|
||||
|
||||
# Build related
|
||||
unsetenv FOAM_BUILDROOT
|
||||
unsetenv FOAM_THIRD_PARTY_BUILDROOT
|
||||
unsetenv FOAM_THIRD_PARTY_SOURCES
|
||||
|
||||
# Older, unused variables
|
||||
|
||||
# Before 1812
|
||||
|
||||
@ -442,8 +442,9 @@ SGIMPI)
|
||||
|
||||
|
||||
# ----
|
||||
# Also support any ending (eg, INTELMPI_custom) to allow custom wmake rules
|
||||
intelmpi | intelmpi-[1-9]* |\
|
||||
INTELMPI | INTELMPI-[1-9]* )
|
||||
INTELMPI*) # Also includes (INTELMPI | INTELMPI-[1-9]*)
|
||||
export FOAM_MPI=intelmpi
|
||||
|
||||
_foamMpiEmbedVersion intelmpi INTELMPI
|
||||
|
||||
@ -118,7 +118,7 @@ case "$ParaView_VERSION" in
|
||||
;;
|
||||
|
||||
([0-9]*)
|
||||
# Extract API from VERSION
|
||||
# Extract API (major.minor) from VERSION
|
||||
pv_api=$(echo "$ParaView_VERSION" | \
|
||||
sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p')
|
||||
;;
|
||||
@ -162,7 +162,7 @@ case "$ParaView_VERSION" in
|
||||
if [ -d "$ParaView_DIR/$pvLibDir" ]
|
||||
then
|
||||
case "$pv_api" in
|
||||
(5.[0-4]*)
|
||||
(5.[0-4])
|
||||
libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -264,7 +264,7 @@ GCC_NOT_FOUND
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})"
|
||||
echo " ${gccDir##*/} (${gmpDir##*/} ${mpfrDir##*/} ${mpcDir##*/})"
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
@ -130,22 +130,19 @@ then
|
||||
;;
|
||||
(*=)
|
||||
# name= -> unset name
|
||||
[ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
|
||||
&& echo "unset ${foamVar_eval%=}" 1>&2
|
||||
_foamEcho "unset ${foamVar_eval%=}"
|
||||
eval "unset ${foamVar_eval%=}"
|
||||
;;
|
||||
(*=*)
|
||||
# name=value -> export name=value
|
||||
[ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
|
||||
&& echo "export $foamVar_eval" 1>&2
|
||||
_foamEcho "export $foamVar_eval"
|
||||
eval "export $foamVar_eval"
|
||||
;;
|
||||
(*)
|
||||
# Filename: source it
|
||||
if [ -f "$foamVar_eval" ]
|
||||
then
|
||||
[ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ] \
|
||||
&& echo "Using: $foamVar_eval" 1>&2
|
||||
_foamEcho "Use file: $foamVar_eval"
|
||||
. "$foamVar_eval"
|
||||
elif [ -n "$foamVar_eval" ]
|
||||
then
|
||||
@ -229,7 +226,7 @@ then
|
||||
_foamAddMan "$WM_PROJECT_DIR/doc"
|
||||
fi
|
||||
|
||||
# Interactive shell (use PS1, not tty)
|
||||
# Interactive shell
|
||||
if [ -n "$PS1" ]
|
||||
then
|
||||
_foamEtc -config aliases
|
||||
|
||||
@ -95,6 +95,11 @@ unset FOAM_USER_APPBIN
|
||||
unset FOAM_USER_LIBBIN
|
||||
unset FOAM_UTILITIES
|
||||
|
||||
# Build related
|
||||
unset FOAM_BUILDROOT
|
||||
unset FOAM_THIRD_PARTY_BUILDROOT
|
||||
unset FOAM_THIRD_PARTY_SOURCES
|
||||
|
||||
# Older, unused variables
|
||||
|
||||
# Before 1812
|
||||
|
||||
54
etc/openfoam
54
etc/openfoam
@ -107,7 +107,8 @@ getApiInfo()
|
||||
# - No inheritance of FOAM_SETTINGS
|
||||
# - No default verbosity (only as command-line option)
|
||||
unset FOAM_CONFIG_ETC FOAM_SETTINGS FOAM_VERBOSE
|
||||
unset _foamEtcDir _foamSettings _foamScriptCommand _foamSourceBashEnv
|
||||
unset _foam_config_etc _foam_bashrcFile
|
||||
unset _foamSettings _foamScriptCommand
|
||||
unset optTestTut
|
||||
|
||||
# Parse options
|
||||
@ -162,9 +163,14 @@ do
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_LABEL_SIZE=${1#-int}"
|
||||
;;
|
||||
|
||||
#TDB: -etc-*)
|
||||
#TDB: # Define FOAM_CONFIG_ETC for finding files
|
||||
#TDB: _foam_config_etc="${1#*-}"
|
||||
#TDB: ;;
|
||||
|
||||
-etc=*)
|
||||
# Define FOAM_CONFIG_ETC for finding files
|
||||
_foamEtcDir="${1#*=}"
|
||||
_foam_config_etc="${1#*=}"
|
||||
;;
|
||||
|
||||
-prefix=*)
|
||||
@ -172,7 +178,7 @@ do
|
||||
;;
|
||||
|
||||
-init=*)
|
||||
_foamSourceBashEnv="${1#*=}"
|
||||
_foam_bashrcFile="${1#*=}"
|
||||
;;
|
||||
|
||||
-verbose)
|
||||
@ -227,28 +233,48 @@ then
|
||||
interactive=true
|
||||
fi
|
||||
|
||||
if [ -z "$_foamSourceBashEnv" ]
|
||||
if [ -z "$_foam_bashrcFile" ]
|
||||
then
|
||||
if [ -n "$interactive" ]
|
||||
then
|
||||
# Interactive shell, chain off via a file
|
||||
_foamSourceBashEnv="$projectDir/bin/tools/source-bashrc"
|
||||
_foam_bashrcFile="$projectDir/bin/tools/source-bashrc"
|
||||
else
|
||||
# Default: OPENFOAM etc/bashrc
|
||||
_foamSourceBashEnv="$projectDir/etc/bashrc"
|
||||
_foam_bashrcFile="$projectDir/etc/bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
[ -f "$_foamSourceBashEnv" ] || {
|
||||
echo "Error: file not found: $_foamSourceBashEnv" 1>&2
|
||||
[ -f "$_foam_bashrcFile" ] || {
|
||||
echo "Error: file not found: $_foam_bashrcFile" 1>&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
if [ -n "$_foamEtcDir" ] && [ -d "$_foamEtcDir" ]
|
||||
|
||||
# FOAM_CONFIG_ETC: additional etc directory
|
||||
case "$_foam_config_etc" in
|
||||
('') # Empty - ignore
|
||||
;;
|
||||
|
||||
(/*) # Absolute
|
||||
[ -d "$_foam_config_etc" ] || unset _foam_config_etc
|
||||
;;
|
||||
|
||||
(*) # Relative
|
||||
if [ -d "$_foam_config_etc" ]
|
||||
then
|
||||
# Qualify local dir
|
||||
_foam_config_etc="$PWD/$_foam_config_etc"
|
||||
else
|
||||
[ -d "$projectDir/$_foam_config_etc" ] || unset _foam_config_etc
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$_foam_config_etc" ]
|
||||
then
|
||||
# Additional etc directory
|
||||
export FOAM_CONFIG_ETC="$_foamEtcDir"
|
||||
export FOAM_CONFIG_ETC="$_foam_config_etc"
|
||||
fi
|
||||
|
||||
if [ -n "$interactive" ]
|
||||
@ -266,10 +292,10 @@ then
|
||||
export FOAM_SETTINGS="$_foamSettings"
|
||||
fi
|
||||
|
||||
## echo "Source with $_foamSourceBashEnv with '$FOAM_SETTINGS'" 1>&2
|
||||
## echo "Source with $_foam_bashrcFile with '$FOAM_SETTINGS'" 1>&2
|
||||
|
||||
# Newer bash can use --init-file instead of --rcfile
|
||||
exec bash --rcfile "$_foamSourceBashEnv" -i
|
||||
exec bash --rcfile "$_foam_bashrcFile" -i
|
||||
exit $? # Safety
|
||||
fi
|
||||
|
||||
@ -281,7 +307,7 @@ fi
|
||||
# Suppresses aliases as a side-effect, but non-interactive anyhow.
|
||||
sourceBashrc()
|
||||
{
|
||||
. "$_foamSourceBashEnv" $_foamSettings
|
||||
. "$_foam_bashrcFile" $_foamSettings
|
||||
}
|
||||
|
||||
|
||||
|
||||
Submodule modules/adios updated: 0d904f910d...fc510265d9
Submodule modules/avalanche updated: 686121d116...63b6dc47e0
Submodule modules/cfmesh updated: 9e9f32c6f7...f362ee6533
Submodule modules/visualization updated: 746ea53991...17632c2a24
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,16 +49,98 @@ static inline bool fullMatch(const regmatch_t& m, const regoff_t len)
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::regExpPosix::set_pattern
|
||||
(
|
||||
const char* pattern,
|
||||
size_t len,
|
||||
bool ignoreCase
|
||||
)
|
||||
{
|
||||
clear(); // Also sets ctrl_ = 0
|
||||
|
||||
const char* pat = pattern;
|
||||
bool doNegate = false;
|
||||
|
||||
// Handle known embedded prefixes
|
||||
if (len > 2 && pat[0] == '(' && pat[1] == '?')
|
||||
{
|
||||
pat += 2;
|
||||
len -= 2;
|
||||
|
||||
for (bool done = false; !done && len; ++pat, --len)
|
||||
{
|
||||
switch (*pat)
|
||||
{
|
||||
case '!':
|
||||
{
|
||||
// Negated (inverted) match
|
||||
doNegate = true;
|
||||
break;
|
||||
}
|
||||
case 'i':
|
||||
{
|
||||
// Ignore-case
|
||||
ignoreCase = true;
|
||||
break;
|
||||
}
|
||||
case ')':
|
||||
{
|
||||
// End of prefix parsing
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Avoid zero-length patterns
|
||||
if (len)
|
||||
{
|
||||
int flags = REG_EXTENDED;
|
||||
if (ignoreCase)
|
||||
{
|
||||
flags |= REG_ICASE;
|
||||
}
|
||||
|
||||
{
|
||||
preg_ = new regex_t;
|
||||
int err = regcomp(preg_, pat, flags);
|
||||
|
||||
if (err == 0)
|
||||
{
|
||||
ctrl_ = (doNegate ? ctrlType::NEGATED : ctrlType::NORMAL);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
char errbuf[200];
|
||||
regerror(err, preg_, errbuf, sizeof(errbuf));
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Failed to compile regular expression '"
|
||||
<< pattern << "'\n" << errbuf
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::regExpPosix::clear()
|
||||
{
|
||||
ctrl_ = 0;
|
||||
|
||||
if (preg_)
|
||||
{
|
||||
regfree(preg_);
|
||||
delete preg_;
|
||||
preg_ = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -66,71 +148,40 @@ bool Foam::regExpPosix::clear()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::regExpPosix::set(const char* pattern, bool ignoreCase)
|
||||
{
|
||||
clear();
|
||||
|
||||
// Avoid nullptr and zero-length patterns
|
||||
if (pattern && *pattern)
|
||||
{
|
||||
int cflags = REG_EXTENDED;
|
||||
if (ignoreCase)
|
||||
{
|
||||
cflags |= REG_ICASE;
|
||||
}
|
||||
|
||||
const char* pat = pattern;
|
||||
|
||||
// Check for embedded prefix for ignore-case
|
||||
// this is the only embedded prefix we support
|
||||
// - a simple check is sufficient
|
||||
if (!strncmp(pattern, "(?i)", 4))
|
||||
{
|
||||
cflags |= REG_ICASE;
|
||||
pat += 4;
|
||||
|
||||
// avoid zero-length patterns
|
||||
if (!*pat)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
preg_ = new regex_t;
|
||||
int err = regcomp(preg_, pat, cflags);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[200];
|
||||
regerror(err, preg_, errbuf, sizeof(errbuf));
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Failed to compile regular expression '" << pattern << "'"
|
||||
<< nl << errbuf
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // Was cleared and nothing was set
|
||||
}
|
||||
|
||||
|
||||
bool Foam::regExpPosix::set(const std::string& pattern, bool ignoreCase)
|
||||
{
|
||||
return set(pattern.c_str(), ignoreCase);
|
||||
}
|
||||
|
||||
|
||||
std::string::size_type Foam::regExpPosix::find(const std::string& text) const
|
||||
{
|
||||
if (preg_ && !text.empty())
|
||||
// Find with negated is probably not very reliable...
|
||||
if (!preg_ || !ctrl_)
|
||||
{
|
||||
// Undefined: never matches
|
||||
return std::string::npos;
|
||||
}
|
||||
else if (text.empty())
|
||||
{
|
||||
if (ctrl_ == ctrlType::NEGATED)
|
||||
{
|
||||
return 0; // No match - pretend it starts at position 0
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string::npos;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t nmatch = 1;
|
||||
regmatch_t pmatch[1];
|
||||
|
||||
if (regexec(preg_, text.c_str(), nmatch, pmatch, 0) == 0)
|
||||
const bool ok = (regexec(preg_, text.c_str(), nmatch, pmatch, 0) == 0);
|
||||
|
||||
if (ctrl_ == ctrlType::NEGATED)
|
||||
{
|
||||
if (!ok)
|
||||
{
|
||||
return 0; // No match - claim that is starts at position 0
|
||||
}
|
||||
}
|
||||
else if (ok)
|
||||
{
|
||||
return pmatch[0].rm_so;
|
||||
}
|
||||
@ -142,23 +193,31 @@ std::string::size_type Foam::regExpPosix::find(const std::string& text) const
|
||||
|
||||
bool Foam::regExpPosix::match(const std::string& text) const
|
||||
{
|
||||
const auto len = text.size();
|
||||
bool ok = false;
|
||||
|
||||
if (preg_ && len)
|
||||
if (!preg_ || !ctrl_)
|
||||
{
|
||||
// Undefined: never matches
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto len = text.length();
|
||||
|
||||
if (len)
|
||||
{
|
||||
const size_t nmatch = 1;
|
||||
regmatch_t pmatch[1];
|
||||
|
||||
// Verify that the entire string was matched
|
||||
// - [0] is the entire match result
|
||||
return
|
||||
ok =
|
||||
(
|
||||
regexec(preg_, text.c_str(), nmatch, pmatch, 0) == 0
|
||||
&& fullMatch(pmatch[0], len)
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
return (ctrl_ == ctrlType::NEGATED ? !ok : ok);
|
||||
}
|
||||
|
||||
|
||||
@ -170,6 +229,12 @@ bool Foam::regExpPosix::match
|
||||
{
|
||||
matches.clear();
|
||||
|
||||
// Probably does not make sense for negated pattern...
|
||||
if (negated())
|
||||
{
|
||||
return match(text);
|
||||
}
|
||||
|
||||
const auto len = text.size();
|
||||
if (preg_ && len)
|
||||
{
|
||||
|
||||
@ -28,10 +28,20 @@ Class
|
||||
Foam::regExpPosix
|
||||
|
||||
Description
|
||||
Wrapper around POSIX extended regular expressions.
|
||||
Wrapper around POSIX extended regular expressions
|
||||
with some additional prefix-handling. The prefix-handling is
|
||||
loosely oriented on PCRE regular expressions and provides a
|
||||
simple means of tuning the expressions.
|
||||
|
||||
The PCRE '(?i)' extension is provided to compile the regular expression
|
||||
as being case-insensitive.
|
||||
The prefixes are detected as \c (?...) at the beginning of
|
||||
the regular expression. Any unknown/unsupported prefixes are silently
|
||||
ignored.
|
||||
|
||||
- "(?!i)" :
|
||||
one or more embedded pattern-match modifiers for the entire pattern.
|
||||
- the \c 'i' indicates ignore-case
|
||||
- the \c '!' (exclamation) indicates negated (inverted) matching
|
||||
.
|
||||
|
||||
SeeAlso
|
||||
The manpage regex(7) for more information about POSIX regular expressions.
|
||||
@ -49,8 +59,8 @@ Warning
|
||||
for regular expressions continues to improve.
|
||||
|
||||
SourceFiles
|
||||
regExpPosixI.H
|
||||
regExpPosix.C
|
||||
regExpPosixI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -74,11 +84,27 @@ template<class StringType> class SubStrings;
|
||||
|
||||
class regExpPosix
|
||||
{
|
||||
// Data Types
|
||||
|
||||
//- Simple control types
|
||||
enum ctrlType { EMPTY = 0, NORMAL = 1, NEGATED = 2 };
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Compiled regular expression
|
||||
regex_t* preg_;
|
||||
|
||||
//- Track if input pattern is non-empty, negated etc.
|
||||
unsigned char ctrl_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Assign pattern
|
||||
bool set_pattern(const char* pattern, size_t len, bool ignoreCase);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Public Types
|
||||
@ -158,7 +184,14 @@ public:
|
||||
//- Return true if a precompiled expression exists
|
||||
inline bool exists() const noexcept;
|
||||
|
||||
//- The number of capture groups for a non-empty expression
|
||||
//- True if pattern matching is negated
|
||||
inline bool negated() const noexcept;
|
||||
|
||||
//- Change pattern negation, return previous value
|
||||
inline bool negate(bool on) noexcept;
|
||||
|
||||
//- The number of capture groups for a non-empty,
|
||||
//- non-negated expressions
|
||||
inline unsigned ngroups() const;
|
||||
|
||||
|
||||
@ -173,17 +206,19 @@ public:
|
||||
|
||||
//- Compile pattern into a regular expression, optionally ignore case.
|
||||
// \return True if the pattern was compiled
|
||||
bool set(const char* pattern, bool ignoreCase=false);
|
||||
inline bool set(const char* pattern, bool ignoreCase=false);
|
||||
|
||||
//- Compile pattern into a regular expression, optionally ignore case.
|
||||
// \return True if the pattern was compiled
|
||||
bool set(const std::string& pattern, bool ignoreCase=false);
|
||||
inline bool set(const std::string& pattern, bool ignoreCase=false);
|
||||
|
||||
|
||||
// Matching/Searching
|
||||
|
||||
//- Find position within the text.
|
||||
// \return The index where it begins or string::npos if not found
|
||||
//
|
||||
// \note does not properly work with negated regex!
|
||||
std::string::size_type find(const std::string& text) const;
|
||||
|
||||
//- True if the regex matches the entire text.
|
||||
@ -193,6 +228,8 @@ public:
|
||||
//- True if the regex matches the text, set the matches.
|
||||
// The first group starts at index 1 (0 is the entire match).
|
||||
// The begin-of-line (^) and end-of-line ($) anchors are implicit
|
||||
//
|
||||
// \note does not properly work with negated regex!
|
||||
bool match(const std::string& text, results_type& matches) const;
|
||||
|
||||
//- Return true if the regex was found within the text
|
||||
|
||||
@ -31,15 +31,18 @@ License
|
||||
|
||||
inline Foam::regExpPosix::regExpPosix() noexcept
|
||||
:
|
||||
preg_(nullptr)
|
||||
preg_(nullptr),
|
||||
ctrl_(0)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::regExpPosix::regExpPosix(regExpPosix&& rgx) noexcept
|
||||
:
|
||||
preg_(rgx.preg_)
|
||||
preg_(rgx.preg_),
|
||||
ctrl_(rgx.ctrl_)
|
||||
{
|
||||
rgx.preg_ = nullptr;
|
||||
rgx.ctrl_ = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +52,8 @@ inline Foam::regExpPosix::regExpPosix
|
||||
const bool ignoreCase
|
||||
)
|
||||
:
|
||||
preg_(nullptr)
|
||||
preg_(nullptr),
|
||||
ctrl_(0)
|
||||
{
|
||||
set(pattern, ignoreCase);
|
||||
}
|
||||
@ -61,7 +65,8 @@ inline Foam::regExpPosix::regExpPosix
|
||||
const bool ignoreCase
|
||||
)
|
||||
:
|
||||
preg_(nullptr)
|
||||
preg_(nullptr),
|
||||
ctrl_(0)
|
||||
{
|
||||
set(pattern, ignoreCase);
|
||||
}
|
||||
@ -89,14 +94,72 @@ inline bool Foam::regExpPosix::exists() const noexcept
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::regExpPosix::negated() const noexcept
|
||||
{
|
||||
return (ctrl_ == ctrlType::NEGATED);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::regExpPosix::negate(bool on) noexcept
|
||||
{
|
||||
bool old(ctrl_ == ctrlType::NEGATED);
|
||||
|
||||
if (on)
|
||||
{
|
||||
if (ctrl_)
|
||||
{
|
||||
ctrl_ = ctrlType::NEGATED;
|
||||
}
|
||||
}
|
||||
else if (old)
|
||||
{
|
||||
ctrl_ = ctrlType::NORMAL;
|
||||
}
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned Foam::regExpPosix::ngroups() const
|
||||
{
|
||||
return preg_ ? preg_->re_nsub : 0;
|
||||
return (preg_ && ctrl_ == ctrlType::NORMAL) ? preg_->re_nsub : 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::regExpPosix::set(const char* pattern, bool ignoreCase)
|
||||
{
|
||||
// Silently handle nullptr
|
||||
return set_pattern
|
||||
(
|
||||
pattern,
|
||||
(pattern ? std::char_traits<char>::length(pattern) : 0),
|
||||
ignoreCase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::regExpPosix::set(const std::string& pattern, bool ignoreCase)
|
||||
{
|
||||
return set_pattern
|
||||
(
|
||||
pattern.data(),
|
||||
pattern.length(),
|
||||
ignoreCase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::regExpPosix::search(const std::string& text) const
|
||||
{
|
||||
if (!ctrl_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (text.empty())
|
||||
{
|
||||
return (ctrl_ == ctrlType::NEGATED);
|
||||
}
|
||||
|
||||
return std::string::npos != find(text);
|
||||
}
|
||||
|
||||
@ -107,6 +170,7 @@ inline void Foam::regExpPosix::swap(regExpPosix& rgx)
|
||||
{
|
||||
// Self-swap is a no-op
|
||||
std::swap(preg_, rgx.preg_);
|
||||
std::swap(ctrl_, rgx.ctrl_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -162,9 +162,13 @@ $(expr)/exprResult/exprResultStored.C
|
||||
$(expr)/exprResult/exprResultStoredStack.C
|
||||
$(expr)/exprString/exprString.C
|
||||
$(expr)/exprTools/exprTools.C
|
||||
$(expr)/scanToken/exprScanToken.C
|
||||
|
||||
$(expr)/traits/exprTraits.C
|
||||
|
||||
$(expr)/exprDriver/exprDriver.C
|
||||
$(expr)/exprDriver/exprDriverFields.C
|
||||
$(expr)/exprDriver/exprDriverFunctions.C
|
||||
$(expr)/exprDriver/exprDriverIO.C
|
||||
|
||||
fieldExpr = $(expr)/fields
|
||||
@ -301,13 +305,15 @@ $(functionEntries)/calcEntry/calcEntry.C
|
||||
$(functionEntries)/codeStream/codeStream.C
|
||||
$(functionEntries)/evalEntry/evalEntry.C
|
||||
$(functionEntries)/functionEntry/functionEntry.C
|
||||
$(functionEntries)/ifEntry/ifEntry.C
|
||||
$(functionEntries)/ifeqEntry/ifeqEntry.C
|
||||
$(functionEntries)/includeEntry/includeEntry.C
|
||||
$(functionEntries)/includeEtcEntry/includeEtcEntry.C
|
||||
$(functionEntries)/includeFuncEntry/includeFuncEntry.C
|
||||
$(functionEntries)/inputMode/inputMode.C
|
||||
$(functionEntries)/message/messageDirective.C
|
||||
$(functionEntries)/removeEntry/removeEntry.C
|
||||
$(functionEntries)/ifeqEntry/ifeqEntry.C
|
||||
$(functionEntries)/ifEntry/ifEntry.C
|
||||
$(functionEntries)/word/wordDirective.C
|
||||
|
||||
IOdictionary = db/IOobjects/IOdictionary
|
||||
$(IOdictionary)/baseIOdictionary.C
|
||||
@ -350,6 +356,7 @@ $(dll)/codedBase/codedBase.C
|
||||
funcObjs = db/functionObjects
|
||||
|
||||
$(funcObjs)/functionObject/functionObject.C
|
||||
$(funcObjs)/functionObjectProperties/functionObjectProperties.C
|
||||
$(funcObjs)/functionObjectList/functionObjectList.C
|
||||
$(funcObjs)/stateFunctionObject/stateFunctionObject.C
|
||||
$(funcObjs)/timeFunctionObject/timeFunctionObject.C
|
||||
@ -451,6 +458,8 @@ $(GAMGInterfaces)/GAMGInterface/GAMGInterfaceNew.C
|
||||
$(GAMGInterfaces)/processorGAMGInterface/processorGAMGInterface.C
|
||||
$(GAMGInterfaces)/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C
|
||||
$(GAMGInterfaces)/cyclicGAMGInterface/cyclicGAMGInterface.C
|
||||
$(GAMGInterfaces)/primitiveGAMGInterface/primitiveGAMGInterface.C
|
||||
|
||||
|
||||
GAMGInterfaceFields = $(GAMG)/interfaceFields
|
||||
$(GAMGInterfaceFields)/GAMGInterfaceField/GAMGInterfaceField.C
|
||||
|
||||
@ -52,7 +52,7 @@ Typedef
|
||||
Foam::wordHashSet
|
||||
|
||||
Description
|
||||
A HashSet with (the default) word keys.
|
||||
A HashSet with word keys and string hasher.
|
||||
|
||||
Typedef
|
||||
Foam::labelHashSet
|
||||
@ -75,12 +75,22 @@ namespace Foam
|
||||
|
||||
// Forward Declarations
|
||||
template<class T> class MinMax;
|
||||
template<class Key, class Hash> class HashSet;
|
||||
|
||||
// Common hash-set types
|
||||
|
||||
//- A HashSet of words, uses string hasher.
|
||||
typedef HashSet<word, Hash<word>> wordHashSet;
|
||||
|
||||
//- A HashSet of labels, uses label hasher.
|
||||
typedef HashSet<label, Hash<label>> labelHashSet;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class HashSet Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Key=word, class Hash=Foam::Hash<Key>>
|
||||
template<class Key, class Hash=Foam::Hash<Key>>
|
||||
class HashSet
|
||||
:
|
||||
public HashTable<zero::null, Key, Hash>
|
||||
@ -401,14 +411,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// Typedefs
|
||||
|
||||
//- A HashSet with word keys.
|
||||
typedef HashSet<word> wordHashSet;
|
||||
|
||||
//- A HashSet with label keys and label hasher.
|
||||
typedef HashSet<label, Hash<label>> labelHashSet;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Global Functions
|
||||
|
||||
|
||||
@ -39,9 +39,10 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Key, class Hash> class HashSet;
|
||||
|
||||
template<class T, class Key, class Hash> class HashTable;
|
||||
template<class T, class Key, class Hash> class HashPtrTable;
|
||||
template<class Key, class Hash> class HashSet;
|
||||
|
||||
template<class T> class Map;
|
||||
template<class T> class PtrMap;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -327,7 +327,7 @@ Foam::labelList Foam::sortedOrder
|
||||
const UList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
sortedOrder(input, order, typename UList<T>::less(input));
|
||||
return order;
|
||||
}
|
||||
@ -352,15 +352,8 @@ void Foam::sortedOrder
|
||||
const ListComparePredicate& comp
|
||||
)
|
||||
{
|
||||
const label len = input.size();
|
||||
|
||||
// List lengths must be identical
|
||||
if (order.size() != len)
|
||||
{
|
||||
// Avoid copying elements, they are overwritten anyhow
|
||||
order.clear();
|
||||
order.resize(len);
|
||||
}
|
||||
// List lengths must be identical. Old content is overwritten
|
||||
order.resize_nocopy(input.size());
|
||||
|
||||
ListOps::identity(order);
|
||||
|
||||
@ -374,7 +367,7 @@ Foam::labelList Foam::duplicateOrder
|
||||
const UList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
duplicateOrder(input, order, typename UList<T>::less(input));
|
||||
return order;
|
||||
}
|
||||
@ -427,7 +420,7 @@ Foam::labelList Foam::uniqueOrder
|
||||
const UList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
uniqueOrder(input, order, typename UList<T>::less(input));
|
||||
return order;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::labelList Foam::sortedOrder
|
||||
const UPtrList<T>& input
|
||||
)
|
||||
{
|
||||
labelList order(input.size());
|
||||
labelList order;
|
||||
sortedOrder(input, order, typename PtrListOps::less<T>(input));
|
||||
return order;
|
||||
}
|
||||
@ -60,15 +60,8 @@ void Foam::sortedOrder
|
||||
const ListComparePredicate& comp
|
||||
)
|
||||
{
|
||||
const label len = input.size();
|
||||
|
||||
// List lengths must be identical
|
||||
if (order.size() != len)
|
||||
{
|
||||
// Avoid copying elements, they are overwritten anyhow
|
||||
order.clear();
|
||||
order.resize(len);
|
||||
}
|
||||
// List lengths must be identical. Old content is overwritten
|
||||
order.resize_nocopy(input.size());
|
||||
|
||||
ListOps::identity(order);
|
||||
|
||||
@ -79,7 +72,7 @@ void Foam::sortedOrder
|
||||
template<class T>
|
||||
void Foam::sort(UPtrList<T>& list)
|
||||
{
|
||||
labelList order(list.size());
|
||||
labelList order;
|
||||
sortedOrder(list, order);
|
||||
list.sortOrder(order, false); // false = allow nullptr
|
||||
}
|
||||
@ -88,7 +81,7 @@ void Foam::sort(UPtrList<T>& list)
|
||||
template<class T, class Compare>
|
||||
void Foam::sort(UPtrList<T>& list, const Compare& comp)
|
||||
{
|
||||
labelList order(list.size());
|
||||
labelList order;
|
||||
sortedOrder(list, order, comp);
|
||||
list.sortOrder(order, false); // false = allow nullptr
|
||||
}
|
||||
|
||||
@ -314,9 +314,12 @@ public:
|
||||
static word member(const word& name);
|
||||
|
||||
//- Create scope:name or scope_name string
|
||||
// An empty scope or name is ignored.
|
||||
template<class StringType>
|
||||
static inline word scopedName(StringType scope, const word& name);
|
||||
// An empty scope is ignored.
|
||||
static inline word scopedName
|
||||
(
|
||||
const std::string& scope,
|
||||
const word& name
|
||||
);
|
||||
|
||||
//- Return the IOobject, but also consider an alternative file name.
|
||||
//
|
||||
|
||||
@ -43,18 +43,13 @@ inline Foam::word Foam::IOobject::groupName
|
||||
}
|
||||
|
||||
|
||||
template<class StringType>
|
||||
inline Foam::word Foam::IOobject::scopedName
|
||||
(
|
||||
StringType scope,
|
||||
const std::string& scope,
|
||||
const word& name
|
||||
)
|
||||
{
|
||||
if (name.empty())
|
||||
{
|
||||
return scope;
|
||||
}
|
||||
else if (scope.empty())
|
||||
if (scope.empty())
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -106,12 +106,6 @@ public:
|
||||
//- Construct by transferring the Field contents
|
||||
CompactIOField(const IOobject& io, Field<T>&& content);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
return regIOobject::DeepClone(*this);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~CompactIOField() = default;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user