FEATURE: Global control switches can now be used as command line parameters (see full commit description). Author: Martin Beaudoin (contribution by Hrvoje Jasak). Merge: Dominik Christ.
This is a major modification to the definition and handling of global control switches, namely the DebugSwitches, InfoSwitches, OptimisationSwitches, Tolerances and DimensionedConstants defined in the Those values are now defined as objects, and are no longer defined using simple types like scalar or int. It is now possible to override any of those control switches from the command-line, like this: simpleFoam -help Usage: simpleFoam [-DebugSwitches key1=val1,key2=val2,...] [-DimensionedConstants key1=val1,key2=val2,...] [-InfoSwitches key1=val1,key2=val2,...] [-OptimisationSwitches key1=val1,key2=val2,...] [-Tol or simpleFoam -DebugSwitches fvVectorMatrix=1,fvScalarMatrix=1 The 'banana' test is also implemented in order to dump the list of all the known control switches for a given application. One can use any bogus key name in order to get the list: simpleFoam -DebugSwitches banana=1 The global controlDict file '$WM_PROJECT_DIR/etc/controlDict' is gone. One can still use a file to override a whole bunch of control switches by using the environment variable FOAM_GLOBAL_CONTROLDICT One can also override case specific controlSwitches by using the case system/controlDict file. Here is the order of precedence for the definition/overriding of the control switches, from lowest to highest: - source code definitions from the various libraries/solvers - file specified by the env. variable FOAM_GLOBAL_CONTROLDICT - case's system/controlDict file - command-line parameters The application 'foamDebugSwitches' is gone. Instead, one can use the command-line option '-dumpControlSwitches' to print at the console the full list of control switches for a given application. The At the source code level, when creating a control switch object, one can now add an optional description string in order to document its behaviour or purpose. That string description will be written a Martin Beaudoin Reorganisation of global controlDict by Hrvoje Jasak.
This commit is contained in:
commit
aaf37ce513
198 changed files with 5255 additions and 1077 deletions
|
@ -29,7 +29,7 @@
|
|||
|
||||
// Bound the energy using TMin and TMax
|
||||
{
|
||||
dimensionedScalar Tstd("Tstd", dimTemperature, specie::Tstd);
|
||||
dimensionedScalar Tstd("Tstd", dimTemperature, specie::Tstd());
|
||||
|
||||
volScalarField Cv = thermo.Cv();
|
||||
volScalarField R = thermo.Cp() - Cv;
|
||||
|
|
|
@ -173,7 +173,7 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
|||
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
|
@ -185,7 +185,7 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
|||
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
foamDebugSwitches.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/foamDebugSwitches
|
|
@ -1,46 +0,0 @@
|
|||
EXE_LIBS = \
|
||||
-lbasicThermophysicalModels \
|
||||
-lchemistryModel \
|
||||
-lreactionThermophysicalModels \
|
||||
-lcompressibleLESModels \
|
||||
-ldecompositionMethods \
|
||||
-ldieselSpray \
|
||||
-ldynamicFvMesh \
|
||||
-ldynamicMesh \
|
||||
-ledgeMesh \
|
||||
-lengine \
|
||||
-lerrorEstimation \
|
||||
-lfiniteVolume \
|
||||
-lfiniteArea \
|
||||
-lfoam \
|
||||
-ltetFiniteElement \
|
||||
-ltetMotionSolver \
|
||||
-lforces \
|
||||
-lfvMotionSolver \
|
||||
-lincompressibleLESModels \
|
||||
-lincompressibleTransportModels \
|
||||
-lcompressibleRASModels \
|
||||
-lincompressibleRASModels \
|
||||
-linterfaceProperties \
|
||||
-llagrangianIntermediate \
|
||||
-llagrangian \
|
||||
-llaminarFlameSpeedModels \
|
||||
-lLESdeltas \
|
||||
-lLESfilters \
|
||||
-lliquidMixture \
|
||||
-lliquids \
|
||||
-lmeshTools \
|
||||
-lODE \
|
||||
-lpdf \
|
||||
-lphaseModel \
|
||||
-lradiation \
|
||||
-lrandomProcesses \
|
||||
-lsampling \
|
||||
-lsolidMixture \
|
||||
-lsolids \
|
||||
-lspecie \
|
||||
-lthermophysicalFunctions \
|
||||
-ltopoChangerFvMesh \
|
||||
-ltriSurface \
|
||||
-lautoMesh \
|
||||
-L$(MESQUITE_LIB_DIR) -lmesquite
|
|
@ -1,152 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Write out all library debug switches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "IOobject.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
argList::validOptions.insert("new", "");
|
||||
argList::validOptions.insert("old", "");
|
||||
|
||||
Foam::argList args(argc, argv);
|
||||
|
||||
wordList currDebug(debug::debugSwitches().toc());
|
||||
wordList currInfo(debug::infoSwitches().toc());
|
||||
wordList currOpt(debug::optimisationSwitches().toc());
|
||||
|
||||
if (args.optionFound("old") || args.optionFound("new"))
|
||||
{
|
||||
dictionary controlDict(IFstream(findEtcFile("controlDict", true))());
|
||||
|
||||
wordHashSet oldDebug
|
||||
(
|
||||
controlDict.subDict("DebugSwitches").toc()
|
||||
);
|
||||
|
||||
wordHashSet oldInfo
|
||||
(
|
||||
controlDict.subDict("InfoSwitches").toc()
|
||||
);
|
||||
|
||||
wordHashSet oldOpt
|
||||
(
|
||||
controlDict.subDict("OptimisationSwitches").toc()
|
||||
);
|
||||
|
||||
|
||||
wordHashSet hashset;
|
||||
wordList listing;
|
||||
|
||||
|
||||
// list old switches - but this can't work since the (old) inserted
|
||||
// switches are in both sets
|
||||
// Workaround:
|
||||
// 1. run without any options (get complete list)
|
||||
// 2. comment out DebugSwitches, run again with -new to find new ones
|
||||
// and do a diff
|
||||
if (args.optionFound("old"))
|
||||
{
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
hashset = wordHashSet(oldDebug);
|
||||
hashset -= wordHashSet(currDebug);
|
||||
listing = hashset.toc();
|
||||
sort(listing);
|
||||
Info<< "old DebugSwitches: " << listing << endl;
|
||||
|
||||
hashset = wordHashSet(oldInfo);
|
||||
hashset -= wordHashSet(currInfo);
|
||||
listing = hashset.toc();
|
||||
sort(listing);
|
||||
Info<< "old InfoSwitches: " << listing << endl;
|
||||
|
||||
hashset = wordHashSet(oldOpt);
|
||||
hashset -= wordHashSet(currOpt);
|
||||
listing = hashset.toc();
|
||||
sort(listing);
|
||||
Info<< "old OptimisationSwitches: " << listing << endl;
|
||||
}
|
||||
|
||||
// list new switches
|
||||
if (args.optionFound("new"))
|
||||
{
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
hashset = wordHashSet(currDebug);
|
||||
hashset -= wordHashSet(oldDebug);
|
||||
|
||||
listing = hashset.toc();
|
||||
sort(listing);
|
||||
Info<< "new DebugSwitches: " << listing << endl;
|
||||
|
||||
hashset = wordHashSet(currInfo);
|
||||
hashset -= wordHashSet(oldInfo);
|
||||
listing = hashset.toc();
|
||||
sort(listing);
|
||||
Info<< "new InfoSwitches: " << listing << endl;
|
||||
|
||||
hashset = wordHashSet(currOpt);
|
||||
hashset -= wordHashSet(oldOpt);
|
||||
listing = hashset.toc();
|
||||
sort(listing);
|
||||
Info<< "new OptimisationSwitches: " << listing << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
sort(currDebug);
|
||||
Info<< "DebugSwitches: " << currDebug << endl;
|
||||
|
||||
sort(currInfo);
|
||||
Info<< "InfoSwitches: " << currInfo << endl;
|
||||
|
||||
sort(currOpt);
|
||||
Info<< "OptimisationSwitches: " << currOpt << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Info<< "done" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -943,7 +943,7 @@ Tolerances
|
|||
slidingEdgeEndCutoffTol 0.0001;
|
||||
slidingEdgeCoPlanarTol 0.8;
|
||||
|
||||
// GGIAreaErrorTol 1e-8;
|
||||
GGIAreaErrorTol 1e-8;
|
||||
}
|
||||
|
||||
DimensionedConstants
|
||||
|
@ -960,7 +960,7 @@ DimensionedConstants
|
|||
Tstd 298.15;
|
||||
|
||||
//- Stefan-Boltzmann constant [J/(K4 m2 s)]
|
||||
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08;
|
||||
sigmaSB 5.670e-08;
|
||||
|
||||
/* USCS units
|
||||
|
|
@ -320,7 +320,7 @@ bool Pstream::init(int& argc, char**& argv)
|
|||
|
||||
Info<< "GAMMA Pstream initialized with:" << nl
|
||||
<< " floatTransfer : " << floatTransfer << nl
|
||||
<< " nProcsSimpleSum : " << nProcsSimpleSum << nl
|
||||
<< " nProcsSimpleSum : " << nProcsSimpleSum() << nl
|
||||
<< " scheduledTransfer : " << Pstream::scheduledTransfer << nl
|
||||
<< Foam::endl;
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Pstream::nProcs() <= Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() <= Pstream::nProcsSimpleSum())
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
|
|
|
@ -217,8 +217,8 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
{
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::blocking
|
||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
Pstream::defaultCommsType() == Pstream::blocking
|
||||
|| Pstream::defaultCommsType() == Pstream::nonBlocking
|
||||
)
|
||||
{
|
||||
forAll (interfaces[rowI], interfaceI)
|
||||
|
@ -240,7 +240,10 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
matrices[rowI],
|
||||
coupleCoeffs[rowI][interfaceI],
|
||||
cmpt,
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<const Pstream::commsTypes>
|
||||
(
|
||||
Pstream::defaultCommsType()
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
@ -265,8 +268,8 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
{
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::blocking
|
||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
Pstream::defaultCommsType() == Pstream::blocking
|
||||
|| Pstream::defaultCommsType() == Pstream::nonBlocking
|
||||
)
|
||||
{
|
||||
forAll (interfaces[rowI], interfaceI)
|
||||
|
@ -288,7 +291,10 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
matrices[rowI],
|
||||
coupleCoeffs[rowI][interfaceI],
|
||||
cmpt,
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<const Pstream::commsTypes>
|
||||
(
|
||||
Pstream::defaultCommsType()
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,14 +42,16 @@ extern "C"
|
|||
defineTypeNameAndDebug(Foam::mgMeshLevel, 0);
|
||||
|
||||
|
||||
Foam::label Foam::mgMeshLevel::mgMinClusterSize_
|
||||
const Foam::debug::optimisationSwitch Foam::mgMeshLevel::mgMinClusterSize_
|
||||
(
|
||||
debug::optimisationSwitch("mgMinClusterSize", 2)
|
||||
"mgMinClusterSize",
|
||||
2
|
||||
);
|
||||
|
||||
Foam::label Foam::mgMeshLevel::mgMaxClusterSize_
|
||||
const Foam::debug::optimisationSwitch Foam::mgMeshLevel::mgMaxClusterSize_
|
||||
(
|
||||
debug::optimisationSwitch("mgMaxClusterSize", 8)
|
||||
"mgMaxClusterSize",
|
||||
8
|
||||
);
|
||||
|
||||
|
||||
|
@ -173,8 +175,8 @@ void Foam::mgMeshLevel::makeChild() const
|
|||
const_cast<scalar*>(boundaryAreas.begin()),
|
||||
cellCells.begin(),
|
||||
faceWeights.begin(),
|
||||
mgMinClusterSize_,
|
||||
mgMaxClusterSize_,
|
||||
mgMinClusterSize_(),
|
||||
mgMaxClusterSize_(),
|
||||
options.begin(),
|
||||
&nMoves,
|
||||
&nCoarseCells,
|
||||
|
|
|
@ -90,10 +90,10 @@ public:
|
|||
// Coarsening parameters
|
||||
|
||||
//- Minimum cluster size
|
||||
static label mgMinClusterSize_;
|
||||
static const debug::optimisationSwitch mgMinClusterSize_;
|
||||
|
||||
//- Maximum cluster size
|
||||
static label mgMaxClusterSize_;
|
||||
static const debug::optimisationSwitch mgMaxClusterSize_;
|
||||
|
||||
|
||||
// Constructor
|
||||
|
|
|
@ -67,7 +67,11 @@ defineTypeNameAndDebug(coupleMap, 0);
|
|||
|
||||
//! \cond fileScope
|
||||
// Geometric relative match tolerance
|
||||
static scalar geomMatchTol_ = 1e-4;
|
||||
static const Foam::debug::tolerancesSwitch geomMatchTol_
|
||||
(
|
||||
"geomMatchTol",
|
||||
1e-4
|
||||
);
|
||||
|
||||
// Priority scheme enumerants
|
||||
enum priorityScheme
|
||||
|
@ -1789,7 +1793,7 @@ const changeMap dynamicTopoFvMesh::insertCells(const label mIndex)
|
|||
{
|
||||
scalar dist = mag(fC - pts[ptI]);
|
||||
|
||||
if (dist < (geomMatchTol_ * tol))
|
||||
if (dist < (geomMatchTol_() * tol))
|
||||
{
|
||||
// Face was converted before
|
||||
if (debug > 3)
|
||||
|
@ -1938,7 +1942,7 @@ const changeMap dynamicTopoFvMesh::insertCells(const label mIndex)
|
|||
// Specify a merge tolerance for insertion points
|
||||
scalar mergeTol =
|
||||
(
|
||||
is2D() ? 0.0 : geomMatchTol_ * magSqr(edges_[mIndex].vec(points_))
|
||||
is2D() ? 0.0 : geomMatchTol_() * magSqr(edges_[mIndex].vec(points_))
|
||||
);
|
||||
|
||||
// Check for point / edge processor connections
|
||||
|
@ -3228,7 +3232,7 @@ const changeMap dynamicTopoFvMesh::insertCells(const label mIndex)
|
|||
scalar tol = mag(mesh.points_[fCheck[0]] - fC);
|
||||
scalar dist = mag(fC - newCentre);
|
||||
|
||||
if (dist < (geomMatchTol_ * tol))
|
||||
if (dist < (geomMatchTol_() * tol))
|
||||
{
|
||||
replaceFace = faceI;
|
||||
break;
|
||||
|
@ -5270,7 +5274,7 @@ void dynamicTopoFvMesh::syncCoupledPatches(labelHashSet& entities)
|
|||
scalar tol = mag(points_[fCheck[0]] - fC);
|
||||
scalar dist = mag(fC - newCentre);
|
||||
|
||||
if (dist < (geomMatchTol_ * tol))
|
||||
if (dist < (1e-4 * tol))
|
||||
{
|
||||
localIndex = faceI;
|
||||
break;
|
||||
|
@ -5320,7 +5324,7 @@ void dynamicTopoFvMesh::syncCoupledPatches(labelHashSet& entities)
|
|||
scalar dist = mag(fC - newCentre);
|
||||
|
||||
// Ensure a face-match
|
||||
if (dist > (geomMatchTol_ * tol))
|
||||
if (dist > (geomMatchTol_() * tol))
|
||||
{
|
||||
Pout<< " * * * Sync Operations * * * " << nl
|
||||
<< " Convert patch Op failed." << nl
|
||||
|
@ -5330,7 +5334,7 @@ void dynamicTopoFvMesh::syncCoupledPatches(labelHashSet& entities)
|
|||
<< " faceCentre: " << fC << nl
|
||||
<< " Master processor: " << proc << nl
|
||||
<< " procPatch: " << procPatch << nl
|
||||
<< " tolerance: " << (geomMatchTol_ * tol) << nl
|
||||
<< " tolerance: " << (geomMatchTol_() * tol) << nl
|
||||
<< " distance: " << dist << nl
|
||||
<< " pointCounter: " << pointCounter << nl
|
||||
<< " newCentre: " << newCentre << nl
|
||||
|
@ -5695,7 +5699,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
scalar rMagSf = mag(half1Areas[faceI]);
|
||||
scalar avSf = 0.5 * (fMagSf + rMagSf);
|
||||
|
||||
if (mag(fMagSf - rMagSf)/avSf > geomMatchTol_)
|
||||
if (mag(fMagSf - rMagSf)/avSf > geomMatchTol_())
|
||||
{
|
||||
misMatchError = true;
|
||||
|
||||
|
@ -5713,7 +5717,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
Foam::max
|
||||
(
|
||||
pTol,
|
||||
geomMatchTol_ * mag(lP[lF[faceI][0]] - lC[faceI])
|
||||
geomMatchTol_() * mag(lP[lF[faceI][0]] - lC[faceI])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -5859,7 +5863,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
scalar nbrMagSf = mag(fAreas[pI][faceI]);
|
||||
scalar avSf = 0.5 * (magSf + nbrMagSf);
|
||||
|
||||
if (mag(magSf - nbrMagSf)/avSf > geomMatchTol_)
|
||||
if (mag(magSf - nbrMagSf)/avSf > geomMatchTol_())
|
||||
{
|
||||
misMatchError = true;
|
||||
|
||||
|
@ -5878,7 +5882,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
Foam::max
|
||||
(
|
||||
pTol,
|
||||
geomMatchTol_ *
|
||||
geomMatchTol_() *
|
||||
mag
|
||||
(
|
||||
myPoints[myFaces[faceI][0]]
|
||||
|
@ -6739,7 +6743,7 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps()
|
|||
const boundBox& box = polyMesh::bounds();
|
||||
|
||||
// Compute tolerance
|
||||
scalar tol = geomMatchTol_ * box.mag();
|
||||
scalar tol = geomMatchTol_()*box.mag();
|
||||
|
||||
const polyBoundaryMesh& boundary = boundaryMesh();
|
||||
|
||||
|
@ -6801,7 +6805,7 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps()
|
|||
FatalErrorIn("void dynamicTopoFvMesh::buildLocalCoupledMaps()")
|
||||
<< " Failed to match all points"
|
||||
<< " within a tolerance of: " << tol << nl
|
||||
<< " matchTol: " << geomMatchTol_ << nl
|
||||
<< " matchTol: " << geomMatchTol_() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
@ -7464,7 +7468,7 @@ void dynamicTopoFvMesh::buildProcessorCoupledMaps()
|
|||
const Map<label>& pMap = cMap.entityMap(coupleMap::POINT);
|
||||
|
||||
// Compute tolerance
|
||||
scalar tol = geomMatchTol_ * box.mag();
|
||||
scalar tol = geomMatchTol_()*box.mag();
|
||||
|
||||
forAllConstIter(Map<label>, pMap, pIter)
|
||||
{
|
||||
|
@ -8761,7 +8765,7 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
|
|||
maxLen = max(maxLen, mag(points_[sFace[fpI]] - sfc));
|
||||
}
|
||||
|
||||
slaveTols[slavePatch][fI] = geomMatchTol_ * maxLen;
|
||||
slaveTols[slavePatch][fI] = geomMatchTol_()*maxLen;
|
||||
}
|
||||
|
||||
// For cyclics, additionally test for halves,
|
||||
|
@ -9115,7 +9119,7 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
|
|||
maxLen = max(maxLen, mag(points_[checkFace[fpI]] - fc));
|
||||
}
|
||||
|
||||
slaveTols[pI][fI] = geomMatchTol_ * maxLen;
|
||||
slaveTols[pI][fI] = geomMatchTol_()*maxLen;
|
||||
}
|
||||
|
||||
// Write out my centres to disk
|
||||
|
|
|
@ -47,12 +47,13 @@ Author
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::slidingInterface::edgeCoPlanarTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::slidingInterface::edgeCoPlanarTol_
|
||||
(
|
||||
debug::tolerances("slidingEdgeCoPlanarTol", 0.8)
|
||||
"slidingEdgeCoPlanarTol",
|
||||
0.8
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Index of debug signs:
|
||||
|
@ -636,8 +637,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||
|
||||
if
|
||||
(
|
||||
cutOnMaster > edgeEndCutoffTol_
|
||||
&& cutOnMaster < 1.0 - edgeEndCutoffTol_
|
||||
cutOnMaster > edgeEndCutoffTol_()
|
||||
&& cutOnMaster < 1.0 - edgeEndCutoffTol_()
|
||||
)
|
||||
{
|
||||
// Master is cut, check the slave
|
||||
|
@ -663,7 +664,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||
// Calculate merge tolerance from the
|
||||
// target edge length
|
||||
scalar mergeTol =
|
||||
edgeCoPlanarTol_*mag(b - a);
|
||||
edgeCoPlanarTol_()*mag(b - a);
|
||||
// Pout<< "cutOnMaster: " << cutOnMaster
|
||||
// << " masterCutPoint: " << masterCutPoint
|
||||
// << " slaveCutPoint: " << slaveCut.hitPoint()
|
||||
|
@ -676,8 +677,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||
// << endl;
|
||||
if
|
||||
(
|
||||
cutOnSlave > edgeEndCutoffTol_
|
||||
&& cutOnSlave < 1.0 - edgeEndCutoffTol_
|
||||
cutOnSlave > edgeEndCutoffTol_()
|
||||
&& cutOnSlave < 1.0 - edgeEndCutoffTol_()
|
||||
&& slaveCut.distance() < mergeTol
|
||||
)
|
||||
{
|
||||
|
|
|
@ -631,8 +631,8 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const
|
|||
|
||||
if
|
||||
(
|
||||
cutOnMaster > edgeEndCutoffTol_
|
||||
&& cutOnMaster < 1.0 - edgeEndCutoffTol_
|
||||
cutOnMaster > edgeEndCutoffTol_()
|
||||
&& cutOnMaster < 1.0 - edgeEndCutoffTol_()
|
||||
)
|
||||
{
|
||||
// Master is cut, check the slave
|
||||
|
@ -658,12 +658,12 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const
|
|||
// Calculate merge tolerance from the
|
||||
// target edge length
|
||||
scalar mergeTol =
|
||||
edgeCoPlanarTol_*mag(b - a);
|
||||
edgeCoPlanarTol_()*mag(b - a);
|
||||
|
||||
if
|
||||
(
|
||||
cutOnSlave > edgeEndCutoffTol_
|
||||
&& cutOnSlave < 1.0 - edgeEndCutoffTol_
|
||||
cutOnSlave > edgeEndCutoffTol_()
|
||||
&& cutOnSlave < 1.0 - edgeEndCutoffTol_()
|
||||
&& slaveCut.distance() < mergeTol
|
||||
)
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ SourceFiles
|
|||
#include "ZoneIDs.H"
|
||||
#include "intersection.H"
|
||||
#include "Pair.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -261,10 +262,10 @@ private:
|
|||
// Static data members
|
||||
|
||||
//- Point merge tolerance
|
||||
static const scalar pointMergeTol_;
|
||||
static const debug::tolerancesSwitch pointMergeTol_;
|
||||
|
||||
//- Edge merge tolerance
|
||||
static const scalar edgeMergeTol_;
|
||||
static const debug::tolerancesSwitch edgeMergeTol_;
|
||||
|
||||
//- Estimated number of faces an edge goes through
|
||||
static const label nFacesPerSlaveEdge_;
|
||||
|
@ -273,16 +274,16 @@ private:
|
|||
static const label edgeFaceEscapeLimit_;
|
||||
|
||||
//- Integral match point adjustment tolerance
|
||||
static const scalar integralAdjTol_;
|
||||
static const debug::tolerancesSwitch integralAdjTol_;
|
||||
|
||||
//- Edge intersection master catch fraction
|
||||
static const scalar edgeMasterCatchFraction_;
|
||||
static const debug::tolerancesSwitch edgeMasterCatchFraction_;
|
||||
|
||||
//- Edge intersection co-planar tolerance
|
||||
static const scalar edgeCoPlanarTol_;
|
||||
static const debug::tolerancesSwitch edgeCoPlanarTol_;
|
||||
|
||||
//- Edge end cut-off tolerance
|
||||
static const scalar edgeEndCutoffTol_;
|
||||
static const debug::tolerancesSwitch edgeEndCutoffTol_;
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -44,31 +44,42 @@ Author
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::slidingInterface::pointMergeTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::slidingInterface::pointMergeTol_
|
||||
(
|
||||
debug::tolerances("slidingPointMergeTol", 0.2)
|
||||
"slidingPointMergeTol",
|
||||
0.2
|
||||
);
|
||||
|
||||
const Foam::scalar Foam::slidingInterface::edgeMergeTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::slidingInterface::edgeMergeTol_
|
||||
(
|
||||
debug::tolerances("slidingEdgeMergeTol", 0.05)
|
||||
"slidingEdgeMergeTol",
|
||||
0.05
|
||||
);
|
||||
|
||||
const Foam::scalar Foam::slidingInterface::integralAdjTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::slidingInterface::integralAdjTol_
|
||||
(
|
||||
debug::tolerances("slidingIntegralAdjTol", 0.15)
|
||||
"slidingIntegralAdjTol",
|
||||
0.15
|
||||
);
|
||||
|
||||
const Foam::scalar Foam::slidingInterface::edgeMasterCatchFraction_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::slidingInterface::edgeMasterCatchFraction_
|
||||
(
|
||||
debug::tolerances("slidingEdgeMasterCatchFraction", 0.4)
|
||||
"slidingEdgeMasterCatchFraction",
|
||||
0.4
|
||||
);
|
||||
|
||||
const Foam::scalar Foam::slidingInterface::edgeEndCutoffTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::slidingInterface::edgeEndCutoffTol_
|
||||
(
|
||||
debug::tolerances("slidingEdgeEndCutoffTol", 0.0001)
|
||||
"slidingEdgeEndCutoffTol",
|
||||
0.0001
|
||||
);
|
||||
|
||||
|
||||
const Foam::label Foam::slidingInterface::nFacesPerSlaveEdge_ = 5;
|
||||
|
||||
// Increased limit for extreme 20-1 cutting. HJ, 19/Dec/2008
|
||||
|
@ -105,7 +116,13 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
<< name() << " : "
|
||||
<< "Projecting slave points onto master surface using ";
|
||||
|
||||
if (debug::optimisationSwitch("nSquaredProjection", 0) > 0)
|
||||
const Foam::debug::optimisationSwitch nSquaredProjection
|
||||
(
|
||||
"nSquaredProjection",
|
||||
0
|
||||
);
|
||||
|
||||
if (nSquaredProjection() > 0)
|
||||
{
|
||||
Pout<< "N-squared point projection" << endl;
|
||||
}
|
||||
|
@ -361,7 +378,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
|
||||
// Calculate the tolerance
|
||||
const scalar mergeTol =
|
||||
integralAdjTol_*minSlavePointLength[pointI];
|
||||
integralAdjTol_()*minSlavePointLength[pointI];
|
||||
|
||||
// Adjust the hit
|
||||
if (mag(nearPoint - missPoint) < mergeTol)
|
||||
|
@ -579,7 +596,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
|
||||
// Calculate the tolerance
|
||||
const scalar mergeTol =
|
||||
pointMergeTol_*
|
||||
pointMergeTol_()*
|
||||
min
|
||||
(
|
||||
minSlavePointLength[pointI],
|
||||
|
@ -681,7 +698,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
minMasterFaceLength[slavePointFaceHits[pointI].hitObject()]
|
||||
);
|
||||
|
||||
const scalar mergeTol = pointMergeTol_*mergeLength;
|
||||
const scalar mergeTol = pointMergeTol_()*mergeLength;
|
||||
|
||||
scalar minDistance = GREAT;
|
||||
|
||||
|
@ -742,7 +759,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
|
||||
// Calculate the tolerance
|
||||
const scalar mergeTol =
|
||||
pointMergeTol_*
|
||||
pointMergeTol_()*
|
||||
min
|
||||
(
|
||||
minSlavePointLength[pointI],
|
||||
|
@ -1054,7 +1071,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
// Calculated as a combination of travel distance in projection and
|
||||
// edge length
|
||||
scalar slaveCatchDist =
|
||||
edgeMasterCatchFraction_*edgeMag
|
||||
edgeMasterCatchFraction_()*edgeMag
|
||||
+ 0.5*
|
||||
(
|
||||
mag
|
||||
|
@ -1147,9 +1164,9 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
// Not a point hit, check for edge
|
||||
if
|
||||
(
|
||||
cutOnSlave > edgeEndCutoffTol_
|
||||
&& cutOnSlave < 1.0 - edgeEndCutoffTol_ // check edge cut
|
||||
&& distInEdgePlane < edgeMergeTol_*edgeMag // merge plane
|
||||
cutOnSlave > edgeEndCutoffTol_()
|
||||
&& cutOnSlave < 1.0 - edgeEndCutoffTol_() // check edge cut
|
||||
&& distInEdgePlane < edgeMergeTol_()*edgeMag // merge plane
|
||||
&& edgeLineHit.distance()
|
||||
< min
|
||||
(
|
||||
|
|
|
@ -34,9 +34,11 @@ const Foam::label Foam::polyTopoChange::pointFraction = 10;
|
|||
const Foam::label Foam::polyTopoChange::faceFraction = 10;
|
||||
const Foam::label Foam::polyTopoChange::cellFraction = 10;
|
||||
|
||||
int Foam::polyTopoChange::debug
|
||||
Foam::debug::debugSwitch
|
||||
Foam::polyTopoChange::debug
|
||||
(
|
||||
Foam::debug::debugSwitch("polyTopoChange", 0)
|
||||
"polyTopoChange",
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class polyTopoChange
|
|||
|
||||
public:
|
||||
|
||||
static int debug;
|
||||
static debug::debugSwitch debug;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -38,6 +38,7 @@ Description
|
|||
#include "wedgeFaPatch.H"
|
||||
#include "faPatchData.H"
|
||||
#include "SortableList.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -48,11 +49,14 @@ namespace Foam
|
|||
|
||||
Foam::word Foam::faMesh::meshSubDir = "faMesh";
|
||||
|
||||
const bool Foam::faMesh::quadricsFit_
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::faMesh::quadricsFit_
|
||||
(
|
||||
debug::optimisationSwitch("quadricsFit", 0) > 0
|
||||
"quadricsFit",
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faMesh::setPrimitiveMeshData()
|
||||
|
@ -1189,7 +1193,7 @@ const Foam::vectorField& Foam::faMesh::pointAreaNormals() const
|
|||
{
|
||||
calcPointAreaNormals();
|
||||
|
||||
if (quadricsFit_)
|
||||
if (quadricsFit_() > 0)
|
||||
{
|
||||
calcPointAreaNormalsByQuadricsFit();
|
||||
}
|
||||
|
|
|
@ -174,7 +174,8 @@ class faMesh
|
|||
|
||||
// Static Private Data
|
||||
|
||||
static const bool quadricsFit_;
|
||||
//- Use quadrics fit
|
||||
static const debug::optimisationSwitch quadricsFit_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
|
|
@ -38,9 +38,10 @@ namespace Foam
|
|||
defineTypeNameAndDebug(cyclicFaPatch, 0);
|
||||
addToRunTimeSelectionTable(faPatch, cyclicFaPatch, dictionary);
|
||||
|
||||
const scalar cyclicFaPatch::matchTol_
|
||||
const Foam::debug::tolerancesSwitch cyclicFaPatch::matchTol_
|
||||
(
|
||||
debug::tolerances("patchFaceMatchTol", 1e-3)
|
||||
"patchFaceMatchTol",
|
||||
1e-3
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
@ -86,7 +87,7 @@ void Foam::cyclicFaPatch::calcTransforms()
|
|||
else if
|
||||
(
|
||||
mag(magLe - nbrMagLe)/avLe
|
||||
> matchTol_
|
||||
> matchTol_()
|
||||
)
|
||||
{
|
||||
// Error in area matching. Find largest error
|
||||
|
@ -102,7 +103,7 @@ void Foam::cyclicFaPatch::calcTransforms()
|
|||
}
|
||||
|
||||
// Check for error in edge matching
|
||||
if (maxMatchError > matchTol_)
|
||||
if (maxMatchError > matchTol_())
|
||||
{
|
||||
label nbrEdgei = errorEdge + size()/2;
|
||||
scalar magLe = mag(half0Normals[errorEdge]);
|
||||
|
@ -120,7 +121,7 @@ void Foam::cyclicFaPatch::calcTransforms()
|
|||
<< "patch:" << name()
|
||||
<< " my area:" << magLe
|
||||
<< " neighbour area:" << nbrMagLe
|
||||
<< " matching tolerance:" << matchTol_
|
||||
<< " matching tolerance:" << matchTol_()
|
||||
<< endl
|
||||
<< "Mesh edge:" << start() + errorEdge
|
||||
<< endl
|
||||
|
@ -175,7 +176,7 @@ void cyclicFaPatch::makeWeights(scalarField& w) const
|
|||
if
|
||||
(
|
||||
mag(magL[edgei] - magL[edgei + sizeby2])/avL
|
||||
> matchTol_
|
||||
> matchTol_()
|
||||
)
|
||||
{
|
||||
// Found error. Look for largest matching error
|
||||
|
@ -197,7 +198,7 @@ void cyclicFaPatch::makeWeights(scalarField& w) const
|
|||
}
|
||||
|
||||
// Check for error in matching
|
||||
if (maxMatchError > polyPatch::matchTol_)
|
||||
if (maxMatchError > polyPatch::matchTol_())
|
||||
{
|
||||
scalar avL = (magL[errorEdge] + magL[errorEdge + sizeby2])/2.0;
|
||||
|
||||
|
@ -207,7 +208,7 @@ void cyclicFaPatch::makeWeights(scalarField& w) const
|
|||
<< 100*mag(magL[errorEdge] - magL[errorEdge + sizeby2])/avL
|
||||
<< "% -- possible edge ordering problem." << nl
|
||||
<< "Cyclic area match tolerance = "
|
||||
<< polyPatch::matchTol_ << " patch: " << name()
|
||||
<< polyPatch::matchTol_() << " patch: " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ SourceFiles
|
|||
#include "coupledFaPatch.H"
|
||||
#include "cyclicLduInterface.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -65,7 +66,7 @@ protected:
|
|||
|
||||
//- Relative tolerance (for geometric matching). Is factor of
|
||||
// maximum edge length per face.
|
||||
static const scalar matchTol_;
|
||||
static const debug::tolerancesSwitch matchTol_;
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ SourceFiles
|
|||
|
||||
#include "faPatch.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -96,7 +97,7 @@ public:
|
|||
TypeName("faPatchField");
|
||||
|
||||
//- Debug switch to disallow the use of
|
||||
static int disallowDefaultFaPatchField;
|
||||
static debug::debugSwitch disallowDefaultFaPatchField;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Foam
|
|||
\
|
||||
defineNamedTemplateTypeNameAndDebug(faPatchTypeField, 0); \
|
||||
template<> \
|
||||
int faPatchTypeField::disallowDefaultFaPatchField \
|
||||
Foam::debug::debugSwitch \
|
||||
faPatchTypeField::disallowDefaultFaPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFaPatchField", 0) \
|
||||
"disallowDefaultFaPatchField", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -43,6 +43,7 @@ SourceFiles
|
|||
|
||||
#include "faPatch.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -93,7 +94,7 @@ public:
|
|||
TypeName("faePatchField");
|
||||
|
||||
//- Debug switch to disallow the use of
|
||||
static int disallowDefaultFaePatchField;
|
||||
static debug::debugSwitch disallowDefaultFaePatchField;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
|
|
@ -39,9 +39,11 @@ namespace Foam
|
|||
\
|
||||
defineNamedTemplateTypeNameAndDebug(faePatchTypeField, 0); \
|
||||
template<> \
|
||||
int faePatchTypeField::disallowDefaultFaePatchField \
|
||||
Foam::debug::debugSwitch \
|
||||
faePatchTypeField::disallowDefaultFaePatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFaePatchField", 0) \
|
||||
"disallowDefaultFaePatchField", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, patchMapper); \
|
||||
|
|
|
@ -35,7 +35,12 @@ Description
|
|||
namespace Foam
|
||||
{
|
||||
|
||||
int faSchemes::debug(Foam::debug::debugSwitch("faSchemes", false));
|
||||
Foam::debug::debugSwitch
|
||||
faSchemes::debug
|
||||
(
|
||||
"faSchemes",
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -38,6 +38,7 @@ SourceFiles
|
|||
#define faSchemes_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -90,7 +91,7 @@ private:
|
|||
public:
|
||||
|
||||
//- Debug switch
|
||||
static int debug;
|
||||
static debug::debugSwitch debug;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -29,6 +29,7 @@ License
|
|||
#include "processorFvsPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
#include "fvc.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -115,8 +116,11 @@ bool Foam::adjustPhi
|
|||
|
||||
scalar massCorr = 1.0;
|
||||
|
||||
static const scalar closedDomainTol =
|
||||
debug::tolerances("closedDomainTol", 1e-10);
|
||||
static const debug::tolerancesSwitch closedDomainTol
|
||||
(
|
||||
"closedDomainTol",
|
||||
1e-10
|
||||
);
|
||||
|
||||
if (mag(adjustableMassOut) > SMALL)
|
||||
{
|
||||
|
@ -125,7 +129,7 @@ bool Foam::adjustPhi
|
|||
else if
|
||||
(
|
||||
mag(fixedMassOut - massIn)
|
||||
> closedDomainTol*Foam::max(1.0, mag(massIn))
|
||||
> closedDomainTol()*Foam::max(1.0, mag(massIn))
|
||||
)
|
||||
{
|
||||
phi.write();
|
||||
|
|
|
@ -213,7 +213,7 @@ void basicSymmetryFvPatchField<vector>::evaluate(const Pstream::commsTypes)
|
|||
{
|
||||
// Local typedefs
|
||||
typedef vector Type;
|
||||
typedef outerProduct<vector, Type>::type gradType;
|
||||
typedef typename outerProduct<vector, Type>::type gradType;
|
||||
typedef GeometricField<gradType, fvPatchField, volMesh> gradFieldType;
|
||||
|
||||
if (!updated())
|
||||
|
|
|
@ -77,7 +77,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
|
|||
}
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
@ -112,7 +112,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
|
|||
newValues_ = nbrField.boundaryField()[nbrPatchID];
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
@ -144,7 +144,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
|
|||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
|
|
@ -198,7 +198,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
|||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
@ -209,7 +209,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
|||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
@ -231,7 +231,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
|||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
@ -243,7 +243,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
|||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
|
|
|
@ -46,6 +46,7 @@ SourceFiles
|
|||
|
||||
#include "fvPatch.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -114,7 +115,7 @@ public:
|
|||
TypeName("fvPatchField");
|
||||
|
||||
//- Debug switch to disallow the use of genericFvPatchField
|
||||
static int disallowGenericFvPatchField;
|
||||
static debug::debugSwitch disallowGenericFvPatchField;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Foam
|
|||
\
|
||||
defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
|
||||
template<> \
|
||||
int fvPatchTypeField::disallowGenericFvPatchField \
|
||||
Foam::debug::debugSwitch \
|
||||
fvPatchTypeField::disallowGenericFvPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowGenericFvPatchField", 0) \
|
||||
"disallowGenericFvPatchField", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Foam
|
|||
\
|
||||
defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
|
||||
template<> \
|
||||
int fvPatchTypeField::disallowGenericFvPatchField \
|
||||
debug::debugSwitch \
|
||||
fvPatchTypeField::disallowGenericFvPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowGenericFvPatchField", 0) \
|
||||
"disallowGenericFvPatchField", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
TypeName("fvsPatchField");
|
||||
|
||||
//- Debug switch to disallow the use of
|
||||
static int disallowDefaultFvsPatchField;
|
||||
static debug::debugSwitch disallowDefaultFvsPatchField;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Foam
|
|||
\
|
||||
defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
|
||||
template<> \
|
||||
int fvsPatchTypeField::disallowDefaultFvsPatchField \
|
||||
Foam::debug::debugSwitch \
|
||||
fvsPatchTypeField::disallowDefaultFvsPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFvsPatchField", 0) \
|
||||
"disallowDefaultFvsPatchField", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Foam
|
|||
\
|
||||
defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
|
||||
template<> \
|
||||
int fvsPatchTypeField::disallowDefaultFvsPatchField \
|
||||
Foam::debug::debugSwitch \
|
||||
fvsPatchTypeField::disallowDefaultFvsPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFvsPatchField", 0) \
|
||||
"disallowDefaultFvsPatchField", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -29,7 +29,12 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
|
||||
Foam::debug::debugSwitch
|
||||
Foam::fvSchemes::debug
|
||||
(
|
||||
"fvSchemes",
|
||||
false
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ SourceFiles
|
|||
#define fvSchemes_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -96,7 +97,7 @@ class fvSchemes
|
|||
public:
|
||||
|
||||
//- Debug switch
|
||||
static int debug;
|
||||
static debug::debugSwitch debug;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -36,9 +36,11 @@ namespace Foam
|
|||
}
|
||||
|
||||
|
||||
const Foam::scalar Foam::leastSquaresVectors::smallDotProdTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::leastSquaresVectors::smallDotProdTol_
|
||||
(
|
||||
debug::tolerances("leastSquaresSmallDotProdTol", 0.1)
|
||||
"leastSquaresSmallDotProdTol",
|
||||
0.1
|
||||
);
|
||||
|
||||
|
||||
|
@ -112,7 +114,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||
// Set up temporary storage for the dd tensor (before inversion)
|
||||
symmTensorField dd(mesh().nCells(), symmTensor::zero);
|
||||
|
||||
forAll (owner, faceI)
|
||||
forAll(owner, faceI)
|
||||
{
|
||||
label own = owner[faceI];
|
||||
label nei = neighbour[faceI];
|
||||
|
@ -124,18 +126,18 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||
dd[nei] += wdd;
|
||||
}
|
||||
|
||||
forAll (lsP.boundaryField(), patchI)
|
||||
forAll(lsP.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatch& p = mesh().boundary()[patchI];
|
||||
const unallocLabelList& fc = p.patch().faceCells();
|
||||
const unallocLabelList& faceCells = p.patch().faceCells();
|
||||
|
||||
// Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010
|
||||
const vectorField pd = p.delta();
|
||||
|
||||
forAll (pd, pFaceI)
|
||||
forAll(pd, patchFaceI)
|
||||
{
|
||||
const vector& d = pd[pFaceI];
|
||||
dd[fc[pFaceI]] += (1.0/magSqr(d))*sqr(d);
|
||||
const vector& d = pd[patchFaceI];
|
||||
dd[faceCells[patchFaceI]] += (1.0/magSqr(d))*sqr(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,25 +155,14 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||
),
|
||||
mesh(),
|
||||
dimensionedSymmTensor("zero", dimless, symmTensor::zero),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
"zeroGradient"
|
||||
);
|
||||
symmTensorField& invDd = volInvDd.internalField();
|
||||
|
||||
// Invert least squares matrix using Householder transformations to avoid
|
||||
// badly posed cells
|
||||
// invDd = inv(dd);
|
||||
invDd = hinv(dd);
|
||||
|
||||
// Evaluate coupled to exchange coupled neighbour field data
|
||||
// across coupled boundaries. HJ, 18/Mar/2015
|
||||
volInvDd.boundaryField().evaluateCoupled();
|
||||
|
||||
// Revisit all faces and calculate the lsP and lsN vectors
|
||||
vectorField& lsPIn = lsP.internalField();
|
||||
vectorField& lsNIn = lsN.internalField();
|
||||
|
||||
// Least squares vectors on internal faces
|
||||
forAll (owner, faceI)
|
||||
forAll(owner, faceI)
|
||||
{
|
||||
label own = owner[faceI];
|
||||
label nei = neighbour[faceI];
|
||||
|
@ -179,17 +170,16 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||
vector d = C[nei] - C[own];
|
||||
scalar magSfByMagSqrd = 1.0/magSqr(d);
|
||||
|
||||
lsPIn[faceI] = magSfByMagSqrd*(invDd[own] & d);
|
||||
lsNIn[faceI] = -magSfByMagSqrd*(invDd[nei] & d);
|
||||
lsP[faceI] = magSfByMagSqrd*(invDd[own] & d);
|
||||
lsN[faceI] = -magSfByMagSqrd*(invDd[nei] & d);
|
||||
}
|
||||
|
||||
// Least squares vectors on boundary faces
|
||||
forAll (lsP.boundaryField(), patchI)
|
||||
forAll(lsP.boundaryField(), patchI)
|
||||
{
|
||||
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
|
||||
fvsPatchVectorField& patchLsN = lsN.boundaryField()[patchI];
|
||||
const fvPatch& p = mesh().boundary()[patchI];
|
||||
const unallocLabelList& fc = p.faceCells();
|
||||
const unallocLabelList& faceCells = p.faceCells();
|
||||
|
||||
// Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010
|
||||
const vectorField pd = p.delta();
|
||||
|
@ -199,215 +189,29 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
|
|||
const symmTensorField invDdNei =
|
||||
volInvDd.boundaryField()[patchI].patchNeighbourField();
|
||||
|
||||
forAll (pd, pFaceI)
|
||||
forAll(pd, patchFaceI)
|
||||
{
|
||||
const vector& d = pd[pFaceI];
|
||||
const vector& d = pd[patchFaceI];
|
||||
|
||||
patchLsP[pFaceI] = (1.0/magSqr(d))*(invDd[fc[pFaceI]] & d);
|
||||
patchLsP[patchFaceI] = (1.0/magSqr(d))
|
||||
*(invDd[faceCells[patchFaceI]] & d);
|
||||
|
||||
patchLsN[pFaceI] = - (1.0/magSqr(d))*(invDdNei[pFaceI] & d);
|
||||
patchLsN[patchFaceI] = - (1.0/magSqr(d))
|
||||
*(invDdNei[faceCells[patchFaceI]] & d);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll (pd, pFaceI)
|
||||
forAll(pd, patchFaceI)
|
||||
{
|
||||
const vector& d = pd[pFaceI];
|
||||
const vector& d = pd[patchFaceI];
|
||||
|
||||
patchLsP[pFaceI] = (1.0/magSqr(d))*(invDd[fc[pFaceI]] & d);
|
||||
patchLsP[patchFaceI] = (1.0/magSqr(d))
|
||||
*(invDd[faceCells[patchFaceI]] & d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if 0
|
||||
|
||||
// Coefficient sign correction on least squares vectors
|
||||
// The sign of the coefficient must be positive to ensure correct
|
||||
// behaviour in coupled systems. This is checked by evaluating
|
||||
// dot-product of the P/N vectors with the face area vector.
|
||||
// If the dot-product is negative, cell is marked for use with the
|
||||
// Gauss gradient, which is unconditionally positive
|
||||
// HJ, 21/Apr/2015
|
||||
|
||||
// First loop: detect cells with bad least squares vectors
|
||||
Info<< "NEW LEAST SQUARES VECTORS" << endl;
|
||||
// Use Gauss Gradient field: set to 1 if Gauss is needed
|
||||
volScalarField useGaussGrad
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"useGaussGrad",
|
||||
mesh().pointsInstance(),
|
||||
mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh(),
|
||||
dimensionedScalar("zero", dimVolume, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
const surfaceVectorField& Sf = mesh().Sf();
|
||||
const surfaceScalarField& w = mesh().weights();
|
||||
|
||||
const vectorField& SfIn = Sf.internalField();
|
||||
const scalarField& wIn = w.internalField();
|
||||
scalarField& uggIn = useGaussGrad.internalField();
|
||||
|
||||
// Check internal faces
|
||||
forAll (owner, faceI)
|
||||
{
|
||||
if
|
||||
(
|
||||
(lsPIn[faceI] & SfIn[faceI])/(mag(lsPIn[faceI])*mag(SfIn[faceI]))
|
||||
< smallDotProdTol_
|
||||
)
|
||||
{
|
||||
// Least square points in the wrong direction for owner
|
||||
// Use Gauss gradient
|
||||
uggIn[owner[faceI]] = 1;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
(lsNIn[faceI] & SfIn[faceI])/(mag(lsNIn[faceI])*mag(SfIn[faceI]))
|
||||
> -smallDotProdTol_
|
||||
)
|
||||
{
|
||||
// Least square points in the wrong direction for owner.
|
||||
// Note that Sf points into neighbour cell
|
||||
// Use Gauss gradient
|
||||
uggIn[neighbour[faceI]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
forAll (lsP.boundaryField(), patchI)
|
||||
{
|
||||
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
|
||||
const vectorField& pSf = Sf.boundaryField()[patchI];
|
||||
const fvPatch& p = mesh().boundary()[patchI];
|
||||
const unallocLabelList& fc = p.faceCells();
|
||||
|
||||
// Same check for coupled and uncoupled
|
||||
forAll (patchLsP, pFaceI)
|
||||
{
|
||||
if
|
||||
(
|
||||
(patchLsP[pFaceI] & pSf[pFaceI])/
|
||||
(mag(patchLsP[pFaceI])*mag(pSf[pFaceI]))
|
||||
< smallDotProdTol_
|
||||
)
|
||||
{
|
||||
uggIn[fc[pFaceI]] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update boundary conditions for coupled boundaries. This synchronises
|
||||
// the Gauss grad indication field
|
||||
useGaussGrad.boundaryField().evaluateCoupled();
|
||||
|
||||
// Replace least square vectors with weighted Gauss gradient vectors
|
||||
// for marked cells
|
||||
|
||||
// Prepare cell volumes with parallel communications
|
||||
volScalarField cellV
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cellV",
|
||||
mesh().pointsInstance(),
|
||||
mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh(),
|
||||
dimensionedScalar("zero", dimVolume, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
cellV.internalField() = mesh().V();
|
||||
|
||||
// Evaluate coupled to exchange coupled neighbour field data
|
||||
// across coupled boundaries. HJ, 18/Mar/2015
|
||||
cellV.boundaryField().evaluateCoupled();
|
||||
|
||||
const scalarField& cellVIn = cellV.internalField();
|
||||
|
||||
// Internal faces
|
||||
forAll (owner, faceI)
|
||||
{
|
||||
label own = owner[faceI];
|
||||
label nei = neighbour[faceI];
|
||||
|
||||
if (uggIn[own] > SMALL)
|
||||
{
|
||||
// Gauss gradient for owner cell
|
||||
lsPIn[faceI] = (1 - wIn[faceI])*SfIn[faceI]/cellVIn[own];
|
||||
}
|
||||
|
||||
if (uggIn[nei] > SMALL)
|
||||
{
|
||||
// Gauss gradient for neighbour cell
|
||||
lsNIn[faceI] = -wIn[faceI]*SfIn[faceI]/cellVIn[nei];
|
||||
}
|
||||
}
|
||||
|
||||
// Boundary faces
|
||||
forAll (lsP.boundaryField(), patchI)
|
||||
{
|
||||
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
|
||||
fvsPatchVectorField& patchLsN = lsN.boundaryField()[patchI];
|
||||
const fvPatch& p = mesh().boundary()[patchI];
|
||||
const unallocLabelList& fc = p.faceCells();
|
||||
|
||||
const fvsPatchScalarField& pw = w.boundaryField()[patchI];
|
||||
const vectorField& pSf = Sf.boundaryField()[patchI];
|
||||
|
||||
// Get indicator for local side
|
||||
const fvPatchScalarField& ugg = useGaussGrad.boundaryField()[patchI];
|
||||
const scalarField pUgg = ugg.patchInternalField();
|
||||
|
||||
if (p.coupled())
|
||||
{
|
||||
const scalarField cellVInNei =
|
||||
cellV.boundaryField()[patchI].patchNeighbourField();
|
||||
|
||||
// Get indicator for neighbour side
|
||||
const scalarField nUgg = ugg.patchNeighbourField();
|
||||
|
||||
forAll (pUgg, pFaceI)
|
||||
{
|
||||
if (pUgg[pFaceI] > SMALL)
|
||||
{
|
||||
// Gauss grad for owner cell
|
||||
patchLsP[pFaceI] =
|
||||
(1 - pw[pFaceI])*pSf[pFaceI]/cellVIn[fc[pFaceI]];
|
||||
}
|
||||
|
||||
if (nUgg[pFaceI] > SMALL)
|
||||
{
|
||||
// Gauss gradient for neighbour cell
|
||||
patchLsN[pFaceI] =
|
||||
-pw[pFaceI]*pSf[pFaceI]/cellVInNei[pFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll (pUgg, pFaceI)
|
||||
{
|
||||
if (pUgg[pFaceI] > SMALL)
|
||||
{
|
||||
// Gauss grad for owner cell
|
||||
patchLsP[pFaceI] =
|
||||
(1 - pw[pFaceI])*pSf[pFaceI]/cellVIn[fc[pFaceI]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "leastSquaresVectors::makeLeastSquaresVectors() :"
|
||||
|
@ -453,15 +257,12 @@ bool Foam::leastSquaresVectors::movePoints() const
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::leastSquaresVectors::updateMesh(const mapPolyMesh& mpm) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoIn
|
||||
(
|
||||
"bool leastSquaresVectors::updateMesh(const mapPolyMesh&) const"
|
||||
) << "Clearing least square data" << endl;
|
||||
InfoIn("bool leastSquaresVectors::updateMesh(const mapPolyMesh&) const")
|
||||
<< "Clearing least square data" << endl;
|
||||
}
|
||||
|
||||
deleteDemandDrivenData(pVectorsPtr_);
|
||||
|
|
|
@ -39,6 +39,7 @@ SourceFiles
|
|||
#include "fvMesh.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "labelPair.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -77,7 +78,7 @@ public:
|
|||
// Static data members
|
||||
|
||||
//- Point merge tolerance
|
||||
static const scalar smallDotProdTol_;
|
||||
static const debug::tolerancesSwitch smallDotProdTol_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -63,7 +63,7 @@ void cyclicFvPatch::makeWeights(scalarField& w) const
|
|||
if
|
||||
(
|
||||
mag(magFa[facei] - magFa[facei + sizeby2])/avFa
|
||||
> polyPatch::matchTol_
|
||||
> polyPatch::matchTol_()
|
||||
)
|
||||
{
|
||||
// Found error. Look for largest matching error
|
||||
|
@ -85,7 +85,7 @@ void cyclicFvPatch::makeWeights(scalarField& w) const
|
|||
}
|
||||
|
||||
// Check for error in matching
|
||||
if (maxMatchError > polyPatch::matchTol_)
|
||||
if (maxMatchError > polyPatch::matchTol_())
|
||||
{
|
||||
scalar avFa = (magFa[errorFace] + magFa[errorFace + sizeby2])/2.0;
|
||||
|
||||
|
@ -95,7 +95,7 @@ void cyclicFvPatch::makeWeights(scalarField& w) const
|
|||
<< 100*mag(magFa[errorFace] - magFa[errorFace + sizeby2])/avFa
|
||||
<< "% -- possible face ordering problem." << nl
|
||||
<< "Cyclic area match tolerance = "
|
||||
<< polyPatch::matchTol_ << " patch: " << name()
|
||||
<< polyPatch::matchTol_() << " patch: " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::cellPointWeight::debug(debug::debugSwitch("cellPointWeight", 0));
|
||||
Foam::debug::debugSwitch
|
||||
Foam::cellPointWeight::debug
|
||||
(
|
||||
"cellPointWeight",
|
||||
0
|
||||
);
|
||||
Foam::scalar Foam::cellPointWeight::tol(SMALL);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
|
|
@ -84,7 +84,7 @@ protected:
|
|||
public:
|
||||
|
||||
//- Debug switch
|
||||
static int debug;
|
||||
static debug::debugSwitch debug;
|
||||
|
||||
//- Tolerance used in calculating barycentric co-ordinates
|
||||
// (applied to normailised values)
|
||||
|
|
|
@ -3,6 +3,12 @@ global/dimensionedConstants/dimensionedConstants.C
|
|||
global/argList/argList.C
|
||||
global/clock/clock.C
|
||||
|
||||
global/controlSwitches/debugSwitch.C
|
||||
global/controlSwitches/infoSwitch.C
|
||||
global/controlSwitches/optimisationSwitch.C
|
||||
global/controlSwitches/tolerancesSwitch.C
|
||||
global/controlSwitches/constantsSwitch.C
|
||||
|
||||
global/profiling/profilingInfo.C
|
||||
global/profiling/profilingPool.C
|
||||
global/profiling/profilingStack.C
|
||||
|
|
|
@ -36,15 +36,17 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
Foam::scalar Foam::FaceCellWave<Type>::geomTol_
|
||||
Foam::debug::tolerancesSwitch Foam::FaceCellWave<Type>::geomTol_
|
||||
(
|
||||
debug::tolerances("FaceCellWaveGeomTol", 1e-6)
|
||||
"FaceCellWaveGeomTol",
|
||||
1e-6
|
||||
);
|
||||
|
||||
template <class Type>
|
||||
Foam::scalar Foam::FaceCellWave<Type>::propagationTol_
|
||||
Foam::debug::tolerancesSwitch Foam::FaceCellWave<Type>::propagationTol_
|
||||
(
|
||||
debug::tolerances("FaceCellWavePropagationTol", 0.01)
|
||||
"FaceCellWavePropagationTol",
|
||||
0.01
|
||||
);
|
||||
|
||||
// Write to ostream
|
||||
|
@ -264,7 +266,7 @@ void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const
|
|||
label i1 = patch.start() + patchFaceI;
|
||||
label i2 = i1 + cycOffset;
|
||||
|
||||
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_))
|
||||
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_()))
|
||||
{
|
||||
FatalErrorIn("FaceCellWave<Type>::checkCyclic(const polyPatch&)")
|
||||
<< "problem: i:" << i1 << " otheri:" << i2
|
||||
|
@ -359,7 +361,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo
|
|||
(
|
||||
meshFaceI,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
propagationTol_(),
|
||||
currentWallInfo
|
||||
);
|
||||
}
|
||||
|
@ -934,7 +936,7 @@ Foam::label Foam::FaceCellWave<Type>::faceToCell()
|
|||
cellI,
|
||||
faceI,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
propagationTol_(),
|
||||
currentWallInfo
|
||||
);
|
||||
}
|
||||
|
@ -952,7 +954,7 @@ Foam::label Foam::FaceCellWave<Type>::faceToCell()
|
|||
cellI,
|
||||
faceI,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
propagationTol_(),
|
||||
currentWallInfo2
|
||||
);
|
||||
}
|
||||
|
@ -1018,7 +1020,7 @@ Foam::label Foam::FaceCellWave<Type>::cellToFace()
|
|||
faceI,
|
||||
cellI,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
propagationTol_(),
|
||||
currentWallInfo
|
||||
);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ SourceFiles
|
|||
#include "boolList.H"
|
||||
#include "labelList.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -267,9 +268,8 @@ class FaceCellWave
|
|||
|
||||
// Private static data
|
||||
|
||||
static scalar geomTol_;
|
||||
static scalar propagationTol_;
|
||||
|
||||
static debug::tolerancesSwitch geomTol_;
|
||||
static debug::tolerancesSwitch propagationTol_;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -278,7 +278,7 @@ public:
|
|||
//- Access to tolerance
|
||||
static scalar propagationTol()
|
||||
{
|
||||
return propagationTol_;
|
||||
return propagationTol_();
|
||||
}
|
||||
|
||||
//- Change tolerance
|
||||
|
|
|
@ -35,12 +35,13 @@ License
|
|||
|
||||
defineTypeNameAndDebug(Foam::octreeDataBoundBox, 0);
|
||||
|
||||
Foam::scalar Foam::octreeDataBoundBox::tol
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::octreeDataBoundBox::tol
|
||||
(
|
||||
debug::tolerances("octreeDataBoundBoxTol", 1e-6)
|
||||
"octreeDataBoundBoxTol",
|
||||
1e-6
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::octreeDataBoundBox::octreeDataBoundBox
|
||||
|
|
|
@ -49,6 +49,7 @@ Author
|
|||
#include "point.H"
|
||||
#include "className.H"
|
||||
#include "linePointRef.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -69,7 +70,7 @@ class octreeDataBoundBox
|
|||
// Static data
|
||||
|
||||
//- Tolerance on linear dimensions
|
||||
static scalar tol;
|
||||
static const debug::tolerancesSwitch tol;
|
||||
|
||||
|
||||
// Private data
|
||||
|
|
|
@ -120,6 +120,13 @@ public:
|
|||
return names[e];
|
||||
}
|
||||
|
||||
//- Return the name of the given enumeration element
|
||||
// where e is specified as a int
|
||||
const char* operator[](const int e) const
|
||||
{
|
||||
return names[e];
|
||||
}
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
|
|
|
@ -36,8 +36,13 @@ namespace Foam
|
|||
|
||||
const IOstream::versionNumber IOstream::originalVersion(0.5);
|
||||
const IOstream::versionNumber IOstream::currentVersion(2.0);
|
||||
unsigned int IOstream::precision_(debug::infoSwitch("writePrecision", 6));
|
||||
|
||||
Foam::debug::infoSwitch
|
||||
IOstream::precision_
|
||||
(
|
||||
"writePrecision",
|
||||
6
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Global IO streams
|
||||
|
|
|
@ -49,9 +49,13 @@ SourceFiles
|
|||
#include "scalar.H"
|
||||
#include "fileName.H"
|
||||
#include "InfoProxy.H"
|
||||
#include "infoSwitch.H"
|
||||
|
||||
#include "debug.H"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#if __GNUC__ < 3
|
||||
# define ios_base ios
|
||||
#endif
|
||||
|
@ -211,8 +215,7 @@ public:
|
|||
static const versionNumber currentVersion;
|
||||
|
||||
//- Default precision
|
||||
static unsigned int precision_;
|
||||
|
||||
static Foam::debug::infoSwitch precision_;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -466,13 +469,13 @@ public:
|
|||
//- Return the default precision
|
||||
static unsigned int defaultPrecision()
|
||||
{
|
||||
return precision_;
|
||||
return precision_();
|
||||
}
|
||||
|
||||
//- Reset the default precision (and return old precision)
|
||||
static unsigned int defaultPrecision(unsigned int p)
|
||||
{
|
||||
unsigned int precision0 = precision_;
|
||||
unsigned int precision0 = precision_();
|
||||
precision_ = p;
|
||||
return precision0;
|
||||
}
|
||||
|
|
|
@ -209,40 +209,68 @@ void Foam::Pstream::initCommunicationSchedule()
|
|||
// Initialise my process number to 0 (the master)
|
||||
int Foam::Pstream::myProcNo_(0);
|
||||
|
||||
|
||||
// By default this is not a parallel run
|
||||
bool Foam::Pstream::parRun_(false);
|
||||
|
||||
|
||||
// List of process IDs
|
||||
Foam::List<int> Foam::Pstream::procIDs_(1, 0);
|
||||
|
||||
|
||||
// Standard transfer message type
|
||||
const int Foam::Pstream::msgType_(1);
|
||||
|
||||
|
||||
// Linear communication schedule
|
||||
Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::linearCommunication_(0);
|
||||
|
||||
|
||||
// Multi level communication schedule
|
||||
Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::treeCommunication_(0);
|
||||
|
||||
|
||||
// Should compact transfer be used in which floats replace doubles
|
||||
// reducing the bandwidth requirement at the expense of some loss
|
||||
// in accuracy
|
||||
bool Foam::Pstream::floatTransfer
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::Pstream::floatTransfer
|
||||
(
|
||||
debug::optimisationSwitch("floatTransfer", 0)
|
||||
"floatTransfer",
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
// Number of processors at which the reduce algorithm changes from linear to
|
||||
// tree
|
||||
int Foam::Pstream::nProcsSimpleSum
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::Pstream::nProcsSimpleSum
|
||||
(
|
||||
debug::optimisationSwitch("nProcsSimpleSum", 16)
|
||||
"nProcsSimpleSum",
|
||||
16
|
||||
);
|
||||
|
||||
|
||||
// Default commsType
|
||||
Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType
|
||||
// Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType
|
||||
// (
|
||||
// commsTypeNames
|
||||
// [
|
||||
// debug::optimisationSwitches().lookupOrAddDefault
|
||||
// (
|
||||
// "commsType",
|
||||
// word("blocking")
|
||||
// )
|
||||
// ]
|
||||
// );
|
||||
|
||||
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::Pstream::defaultCommsType
|
||||
(
|
||||
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
|
||||
"commsType",
|
||||
"blocking",
|
||||
"blocking, nonBlocking, scheduled"
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ SourceFiles
|
|||
#include "HashTable.H"
|
||||
#include "string.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "optimisationSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -224,14 +225,14 @@ public:
|
|||
//- Should compact transfer be used in which floats replace doubles
|
||||
// reducing the bandwidth requirement at the expense of some loss
|
||||
// in accuracy
|
||||
static bool floatTransfer;
|
||||
static const debug::optimisationSwitch floatTransfer;
|
||||
|
||||
//- Number of processors at which the sum algorithm changes from linear
|
||||
// to tree
|
||||
static int nProcsSimpleSum;
|
||||
static const debug::optimisationSwitch nProcsSimpleSum;
|
||||
|
||||
//- Default commsType
|
||||
static commsTypes defaultCommsType;
|
||||
static const debug::optimisationSwitch defaultCommsType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -62,7 +62,7 @@ void combineReduce
|
|||
template <class T, class CombineOp>
|
||||
void combineReduce(T& Value, const CombineOp& cop)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
Pstream::combineGather(Pstream::linearCommunication(), Value, cop);
|
||||
Pstream::combineScatter(Pstream::linearCommunication(), Value);
|
||||
|
|
|
@ -58,7 +58,7 @@ void reduce
|
|||
const BinaryOp& bop
|
||||
)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
reduce(Pstream::linearCommunication(), Value, bop);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ T returnReduce
|
|||
{
|
||||
T WorkValue(Value);
|
||||
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
reduce(Pstream::linearCommunication(), WorkValue, bop);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ void Pstream::combineGather
|
|||
template <class T, class CombineOp>
|
||||
void Pstream::combineGather(T& Value, const CombineOp& cop)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
combineGather(Pstream::linearCommunication(), Value, cop);
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ void Pstream::combineScatter(const List<Pstream::commsStruct>& comms, T& Value)
|
|||
template <class T>
|
||||
void Pstream::combineScatter(T& Value)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
combineScatter(Pstream::linearCommunication(), Value);
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void Pstream::listCombineGather
|
|||
template <class T, class CombineOp>
|
||||
void Pstream::listCombineGather(List<T>& Values, const CombineOp& cop)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
listCombineGather(Pstream::linearCommunication(), Values, cop);
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ void Pstream::listCombineScatter
|
|||
template <class T>
|
||||
void Pstream::listCombineScatter(List<T>& Values)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
listCombineScatter(Pstream::linearCommunication(), Values);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ void Pstream::mapCombineGather
|
|||
template <class Container, class CombineOp>
|
||||
void Pstream::mapCombineGather(Container& Values, const CombineOp& cop)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
mapCombineGather(Pstream::linearCommunication(), Values, cop);
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ void Pstream::mapCombineScatter
|
|||
template <class Container>
|
||||
void Pstream::mapCombineScatter(Container& Values)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
mapCombineScatter(Pstream::linearCommunication(), Values);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ void Pstream::gather
|
|||
template <class T, class BinaryOp>
|
||||
void Pstream::gather(T& Value, const BinaryOp& bop)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
gather(Pstream::linearCommunication(), Value, bop);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void Pstream::scatter(const List<Pstream::commsStruct>& comms, T& Value)
|
|||
template <class T>
|
||||
void Pstream::scatter(T& Value)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
scatter(Pstream::linearCommunication(), Value);
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ void Pstream::gatherList
|
|||
template <class T>
|
||||
void Pstream::gatherList(List<T>& Values)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
gatherList(Pstream::linearCommunication(), Values);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ void Pstream::scatterList
|
|||
template <class T>
|
||||
void Pstream::scatterList(List<T>& Values)
|
||||
{
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() < Pstream::nProcsSimpleSum())
|
||||
{
|
||||
scatterList(Pstream::linearCommunication(), Values);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ inline Foam::OSstream::OSstream
|
|||
{
|
||||
setOpened();
|
||||
setGood();
|
||||
os_.precision(precision_);
|
||||
os_.precision(precision_());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,6 +33,9 @@ License
|
|||
|
||||
void Foam::Time::readDict()
|
||||
{
|
||||
if (debug)
|
||||
Info << "Time::readDict(): reading " << controlDict_.name() << endl;
|
||||
|
||||
if (!deltaTchanged_)
|
||||
{
|
||||
deltaT_ = readScalar(controlDict_.lookup("deltaT"));
|
||||
|
|
|
@ -205,7 +205,8 @@ public:
|
|||
// A null pointer is treated like an empty dictionary.
|
||||
dictionary(const dictionary*);
|
||||
|
||||
//- Construct by transferring parameter contents given parent dictionary
|
||||
//- Construct by transferring parameter contents from
|
||||
// given parent dictionary
|
||||
dictionary(const dictionary& parentDict, const Xfer<dictionary>&);
|
||||
|
||||
//- Construct top-level dictionary by transferring parameter contents
|
||||
|
@ -245,7 +246,7 @@ public:
|
|||
|
||||
//- Search dictionary for given keyword
|
||||
// If recursive, search parent dictionaries
|
||||
bool found(const word&, bool recursive=false) const;
|
||||
bool found(const word&, bool recursive = false) const;
|
||||
|
||||
//- Find and return an entry data stream pointer if present
|
||||
// otherwise return NULL.
|
||||
|
@ -269,7 +270,8 @@ public:
|
|||
bool patternMatch
|
||||
);
|
||||
|
||||
//- Find and return an entry data stream if present otherwise error.
|
||||
//- Find and return an entry data stream
|
||||
// if present otherwise error.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
const entry& lookupEntry
|
||||
|
@ -285,8 +287,8 @@ public:
|
|||
ITstream& lookup
|
||||
(
|
||||
const word&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
bool recursive = false,
|
||||
bool patternMatch = true
|
||||
) const;
|
||||
|
||||
//- Find and return a T,
|
||||
|
@ -298,8 +300,8 @@ public:
|
|||
(
|
||||
const word&,
|
||||
const T&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
bool recursive = false,
|
||||
bool patternMatch = true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, if not found return the given
|
||||
|
@ -311,8 +313,8 @@ public:
|
|||
(
|
||||
const word&,
|
||||
const T&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
bool recursive = false,
|
||||
bool patternMatch = true
|
||||
);
|
||||
|
||||
//- Find an entry if present, and assign to T
|
||||
|
@ -324,8 +326,8 @@ public:
|
|||
(
|
||||
const word&,
|
||||
T&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
bool recursive = false,
|
||||
bool patternMatch = true
|
||||
) const;
|
||||
|
||||
//- Check if entry is a sub-dictionary
|
||||
|
@ -349,7 +351,7 @@ public:
|
|||
wordList toc() const;
|
||||
|
||||
//- Return the list of available keys or patterns
|
||||
List<keyType> keys(bool patterns=false) const;
|
||||
List<keyType> keys(bool patterns = false) const;
|
||||
|
||||
|
||||
// Editing
|
||||
|
@ -361,28 +363,28 @@ public:
|
|||
//- Add a new entry
|
||||
// With the merge option, dictionaries are interwoven and
|
||||
// primitive entries are overwritten
|
||||
bool add(entry*, bool mergeEntry=false);
|
||||
bool add(entry*, bool mergeEntry = false);
|
||||
|
||||
//- Add an entry
|
||||
// With the merge option, dictionaries are interwoven and
|
||||
// primitive entries are overwritten
|
||||
void add(const entry&, bool mergeEntry=false);
|
||||
void add(const entry&, bool mergeEntry = false);
|
||||
|
||||
//- Add a word entry
|
||||
// optionally overwrite an existing entry
|
||||
void add(const keyType&, const word&, bool overwrite=false);
|
||||
void add(const keyType&, const word&, bool overwrite = false);
|
||||
|
||||
//- Add a string entry
|
||||
// optionally overwrite an existing entry
|
||||
void add(const keyType&, const string&, bool overwrite=false);
|
||||
void add(const keyType&, const string&, bool overwrite = false);
|
||||
|
||||
//- Add a label entry
|
||||
// optionally overwrite an existing entry
|
||||
void add(const keyType&, const label, bool overwrite=false);
|
||||
void add(const keyType&, const label, bool overwrite = false);
|
||||
|
||||
//- Add a scalar entry
|
||||
// optionally overwrite an existing entry
|
||||
void add(const keyType&, const scalar, bool overwrite=false);
|
||||
void add(const keyType&, const scalar, bool overwrite = false);
|
||||
|
||||
//- Add a dictionary entry
|
||||
// optionally merge with an existing sub-dictionary
|
||||
|
@ -390,13 +392,13 @@ public:
|
|||
(
|
||||
const keyType&,
|
||||
const dictionary&,
|
||||
bool mergeEntry=false
|
||||
bool mergeEntry = false
|
||||
);
|
||||
|
||||
//- Add a T entry
|
||||
// optionally overwrite an existing entry
|
||||
template<class T>
|
||||
void add(const keyType&, const T&, bool overwrite=false);
|
||||
void add(const keyType&, const T&, bool overwrite = false);
|
||||
|
||||
//- Assign a new entry, overwrite any existing entry
|
||||
void set(entry*);
|
||||
|
@ -420,7 +422,7 @@ public:
|
|||
(
|
||||
const keyType& oldKeyword,
|
||||
const keyType& newKeyword,
|
||||
bool forceOverwrite=false
|
||||
bool forceOverwrite = false
|
||||
);
|
||||
|
||||
//- Merge entries from the given dictionary.
|
||||
|
@ -445,7 +447,7 @@ public:
|
|||
|
||||
// Write
|
||||
|
||||
void write(Ostream&, bool subDict=true) const;
|
||||
void write(Ostream&, bool subDict = true) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
|
|
@ -37,7 +37,12 @@ const Foam::word Foam::functionEntries::includeEntry::typeName
|
|||
|
||||
// Don't lookup the debug switch here as the debug switch dictionary
|
||||
// might include includeEntry
|
||||
int Foam::functionEntries::includeEntry::debug(0);
|
||||
Foam::debug::debugSwitch
|
||||
Foam::functionEntries::includeEntry::debug
|
||||
(
|
||||
"includeEntry",
|
||||
0
|
||||
);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
|
|
@ -37,7 +37,12 @@ const Foam::word Foam::functionEntries::includeIfPresentEntry::typeName
|
|||
|
||||
// Don't lookup the debug switch here as the debug switch dictionary
|
||||
// might include includeIfPresentEntry
|
||||
int Foam::functionEntries::includeIfPresentEntry::debug(0);
|
||||
Foam::debug::debugSwitch
|
||||
Foam::functionEntries::includeIfPresentEntry::debug
|
||||
(
|
||||
"includeIfPresentEntry",
|
||||
0
|
||||
);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
|
|
@ -36,7 +36,12 @@ const Foam::word Foam::functionEntries::inputModeEntry::typeName
|
|||
|
||||
// Don't lookup the debug switch here as the debug switch dictionary
|
||||
// might include inputModeEntries
|
||||
int Foam::functionEntries::inputModeEntry::debug(0);
|
||||
Foam::debug::debugSwitch
|
||||
Foam::functionEntries::inputModeEntry::debug
|
||||
(
|
||||
"inputModeEntry",
|
||||
0
|
||||
);
|
||||
|
||||
Foam::functionEntries::inputModeEntry::inputMode
|
||||
Foam::functionEntries::inputModeEntry::mode_(MERGE);
|
||||
|
|
|
@ -39,7 +39,12 @@ const Foam::word Foam::functionEntries::removeEntry::typeName
|
|||
|
||||
// Don't lookup the debug switch here as the debug switch dictionary
|
||||
// might include removeEntry
|
||||
int Foam::functionEntries::removeEntry::debug(0);
|
||||
Foam::debug::debugSwitch
|
||||
Foam::functionEntries::removeEntry::debug
|
||||
(
|
||||
"removeEntry",
|
||||
0
|
||||
);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
|
|
@ -29,7 +29,12 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
|
||||
Foam::debug::debugSwitch
|
||||
Foam::messageStream::level
|
||||
(
|
||||
"level",
|
||||
2
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -48,6 +48,7 @@ SourceFiles
|
|||
|
||||
#include "label.H"
|
||||
#include "string.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -93,7 +94,7 @@ public:
|
|||
|
||||
// Debug switches
|
||||
|
||||
static int level;
|
||||
static debug::debugSwitch level;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -30,7 +30,13 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineRunTimeSelectionTable(Foam::functionObject, dictionary);
|
||||
int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0));
|
||||
|
||||
Foam::debug::debugSwitch
|
||||
Foam::functionObject::debug
|
||||
(
|
||||
"functionObject",
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -41,6 +41,7 @@ SourceFiles
|
|||
#include "typeInfo.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -76,7 +77,7 @@ public:
|
|||
//- Runtime type information
|
||||
virtual const word& type() const = 0;
|
||||
|
||||
static int debug;
|
||||
static debug::debugSwitch debug;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
|
|
@ -31,12 +31,13 @@ License
|
|||
|
||||
defineTypeNameAndDebug(Foam::regIOobject, 0);
|
||||
|
||||
int Foam::regIOobject::fileModificationSkew
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::regIOobject::fileModificationSkew
|
||||
(
|
||||
Foam::debug::optimisationSwitch("fileModificationSkew", 30)
|
||||
"fileModificationSkew",
|
||||
30
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from IOobject
|
||||
|
|
|
@ -41,6 +41,7 @@ SourceFiles
|
|||
#include "IOobject.H"
|
||||
#include "typeInfo.H"
|
||||
#include "OSspecific.H"
|
||||
#include "optimisationSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -93,7 +94,8 @@ public:
|
|||
//- Runtime type information
|
||||
TypeName("regIOobject");
|
||||
|
||||
static int fileModificationSkew;
|
||||
//- File modification skew
|
||||
static const debug::optimisationSwitch fileModificationSkew;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -154,7 +154,7 @@ bool Foam::regIOobject::modified() const
|
|||
return
|
||||
(
|
||||
lastModified_
|
||||
&& lastModified(filePath()) > (lastModified_ + fileModificationSkew)
|
||||
&& lastModified(filePath()) > (lastModified_ + fileModificationSkew())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ bool Foam::regIOobject::readIfModified()
|
|||
|
||||
bool readFile = false;
|
||||
|
||||
if (newTimeStamp > (lastModified_ + fileModificationSkew))
|
||||
if (newTimeStamp > (lastModified_ + fileModificationSkew()))
|
||||
{
|
||||
readFile = true;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::scalarRange::debug(::Foam::debug::debugSwitch("scalarRange", 0));
|
||||
Foam::debug::debugSwitch
|
||||
Foam::scalarRange::debug
|
||||
(
|
||||
"scalarRange",
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -40,6 +40,7 @@ SourceFiles
|
|||
#define scalarRange_H
|
||||
|
||||
#include "scalar.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -82,7 +83,7 @@ class scalarRange
|
|||
|
||||
public:
|
||||
|
||||
static int debug;
|
||||
static debug::debugSwitch debug;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -31,6 +31,7 @@ Description
|
|||
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include "debugSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -72,13 +73,13 @@ public: \
|
|||
// Also declares debug information.
|
||||
#define ClassName(TypeNameString) \
|
||||
ClassNameNoDebug(TypeNameString); \
|
||||
static int debug
|
||||
static Foam::debug::debugSwitch debug;
|
||||
|
||||
//- Add typeName information from argument @a TypeNameString to a namespace.
|
||||
// Also declares debug information.
|
||||
#define NamespaceName(TypeNameString) \
|
||||
NamespaceNameNoDebug(TypeNameString); \
|
||||
extern int debug
|
||||
extern Foam::debug::debugSwitch debug;
|
||||
|
||||
//- Add typeName information from argument @a TypeNameString to a template class.
|
||||
// Also declares debug information.
|
||||
|
@ -132,22 +133,24 @@ public: \
|
|||
|
||||
|
||||
//- Define the debug information, lookup as @a Name
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch, SwitchDescr) \
|
||||
::Foam::debug::debugSwitch \
|
||||
Type::debug(std::string(Name), DebugSwitch, SwitchDescr)
|
||||
|
||||
//- Define the debug information
|
||||
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
#define defineDebugSwitch(Type, DebugSwitch, SwitchDescr) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch, SwitchDescr);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
//- Define the debug information for templates, lookup as @a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch, "");
|
||||
|
||||
#else
|
||||
//- Define the debug information for templates, lookup as @a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch, "");
|
||||
#endif
|
||||
|
||||
//- Define the debug information for templates
|
||||
|
@ -169,7 +172,12 @@ public: \
|
|||
//- Define the typeName and debug information
|
||||
#define defineTypeNameAndDebug(Type, DebugSwitch) \
|
||||
defineTypeName(Type); \
|
||||
defineDebugSwitch(Type, DebugSwitch)
|
||||
defineDebugSwitch(Type, DebugSwitch, "")
|
||||
|
||||
//- Define the typeName and debug information + description
|
||||
#define defineTypeNameAndDebugWithDescription(Type, DebugSwitch, SwitchDescr) \
|
||||
defineTypeName(Type); \
|
||||
defineDebugSwitch(Type, DebugSwitch, SwitchDescr)
|
||||
|
||||
//- Define the typeName and debug information, lookup as @a Name
|
||||
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \
|
||||
|
|
|
@ -287,17 +287,20 @@ evaluate()
|
|||
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::blocking
|
||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
Pstream::defaultCommsType() == Pstream::blocking
|
||||
|| Pstream::defaultCommsType() == Pstream::nonBlocking
|
||||
)
|
||||
{
|
||||
forAll(*this, patchi)
|
||||
{
|
||||
this->operator[](patchi).initEvaluate(Pstream::defaultCommsType);
|
||||
this->operator[](patchi).initEvaluate
|
||||
(
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
|
||||
);
|
||||
}
|
||||
|
||||
// Block for any outstanding requests
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
if (Pstream::defaultCommsType() == Pstream::nonBlocking)
|
||||
{
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
|
@ -305,10 +308,13 @@ evaluate()
|
|||
|
||||
forAll(*this, patchi)
|
||||
{
|
||||
this->operator[](patchi).evaluate(Pstream::defaultCommsType);
|
||||
this->operator[](patchi).evaluate
|
||||
(
|
||||
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
else if (Pstream::defaultCommsType() == Pstream::scheduled)
|
||||
{
|
||||
const lduSchedule& patchSchedule =
|
||||
bmesh_.mesh().globalData().patchSchedule();
|
||||
|
@ -331,7 +337,7 @@ evaluate()
|
|||
{
|
||||
FatalErrorIn("GeometricBoundaryField::evaluate()")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
@ -350,8 +356,8 @@ evaluateCoupled()
|
|||
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::blocking
|
||||
|| Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
Pstream::defaultCommsType() == Pstream::blocking
|
||||
|| Pstream::defaultCommsType() == Pstream::nonBlocking
|
||||
)
|
||||
{
|
||||
forAll(*this, patchi)
|
||||
|
@ -360,13 +366,16 @@ evaluateCoupled()
|
|||
{
|
||||
this->operator[](patchi).initEvaluate
|
||||
(
|
||||
Pstream::defaultCommsType
|
||||
static_cast<Pstream::commsTypes>
|
||||
(
|
||||
Pstream::defaultCommsType()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Block for any outstanding requests
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
if (Pstream::defaultCommsType() == Pstream::nonBlocking)
|
||||
{
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
|
@ -376,11 +385,17 @@ evaluateCoupled()
|
|||
{
|
||||
if (this->operator[](patchi).coupled())
|
||||
{
|
||||
this->operator[](patchi).evaluate(Pstream::defaultCommsType);
|
||||
this->operator[](patchi).evaluate
|
||||
(
|
||||
static_cast<Pstream::commsTypes>
|
||||
(
|
||||
Pstream::defaultCommsType()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
else if (Pstream::defaultCommsType() == Pstream::scheduled)
|
||||
{
|
||||
const lduSchedule& patchSchedule =
|
||||
bmesh_.mesh().globalData().patchSchedule();
|
||||
|
@ -415,7 +430,7 @@ evaluateCoupled()
|
|||
{
|
||||
FatalErrorIn("GeometricBoundaryField::evaluateCoupled()")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1156,7 +1156,7 @@ void GlobalPointPatchField
|
|||
|
||||
// Requires global sync points to flush buffers before gather-scatter
|
||||
// communications. Reconsider. HJ, 29/Mar/2011
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
if (Pstream::defaultCommsType() == Pstream::nonBlocking)
|
||||
{
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
|
@ -1284,7 +1284,7 @@ void GlobalPointPatchField
|
|||
|
||||
// Requires global sync points to flush buffers before gather-scatter
|
||||
// communications. Reconsider. HJ, 29/Mar/2011
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
if (Pstream::defaultCommsType() == Pstream::nonBlocking)
|
||||
{
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
|
|
|
@ -31,7 +31,13 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::JobInfo::writeJobInfo(Foam::debug::infoSwitch("writeJobInfo", 0));
|
||||
Foam::debug::infoSwitch
|
||||
Foam::JobInfo::writeJobInfo
|
||||
(
|
||||
"writeJobInfo",
|
||||
0
|
||||
);
|
||||
|
||||
Foam::JobInfo Foam::jobInfo;
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ SourceFiles
|
|||
#include "dictionary.H"
|
||||
#include "fileName.H"
|
||||
#include "cpuTime.H"
|
||||
#include "infoSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -70,7 +71,7 @@ class JobInfo
|
|||
public:
|
||||
|
||||
static bool constructed;
|
||||
static bool writeJobInfo;
|
||||
static debug::infoSwitch writeJobInfo;
|
||||
|
||||
// Constructors
|
||||
|
||||
|
|
|
@ -32,13 +32,14 @@ License
|
|||
#include "IOobject.H"
|
||||
#include "JobInfo.H"
|
||||
#include "labelList.H"
|
||||
|
||||
#include "SortableList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::SLList<Foam::string> Foam::argList::validArgs;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
||||
Foam::word Foam::argList::appDictName_("");
|
||||
bool Foam::argList::bannerEnabled(true);
|
||||
|
||||
|
||||
|
@ -49,6 +50,25 @@ Foam::argList::initValidTables::initValidTables()
|
|||
validParOptions.set("parallel", "");
|
||||
validOptions.set("noFunctionObjects", "");
|
||||
|
||||
// Add the parameters for modifying the controlDict
|
||||
// switches from the command-line
|
||||
|
||||
// Instantiate a NamedEnum for the controlDict switches names
|
||||
const NamedEnum
|
||||
<
|
||||
debug::globalControlDictSwitchSet,
|
||||
debug::DIM_GLOBAL_CONTROL_DICT_SWITCH_SET
|
||||
>
|
||||
globalControlDictSwitchSetNames;
|
||||
|
||||
forAll (globalControlDictSwitchSetNames, gI)
|
||||
{
|
||||
word switchSetName = globalControlDictSwitchSetNames.names[gI];
|
||||
validOptions.set(switchSetName, "key1=val1,key2=val2,...");
|
||||
}
|
||||
|
||||
validOptions.set("dumpControlSwitches", "");
|
||||
|
||||
Pstream::addValidParOptions(validParOptions);
|
||||
}
|
||||
|
||||
|
@ -308,6 +328,7 @@ Foam::argList::argList
|
|||
FatalError.exit();
|
||||
}
|
||||
|
||||
// From here, we consider the command-line arguments to be valid
|
||||
|
||||
string dateString = clock::date();
|
||||
string timeString = clock::clockTime();
|
||||
|
@ -323,8 +344,7 @@ Foam::argList::argList
|
|||
<< "Date : " << dateString.c_str() << nl
|
||||
<< "Time : " << timeString.c_str() << nl
|
||||
<< "Host : " << hostName() << nl
|
||||
<< "PID : " << pid() << nl
|
||||
<< "CtrlDict : " << ctrlDictString.c_str()
|
||||
<< "PID : " << pid()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -496,6 +516,80 @@ Foam::argList::argList
|
|||
case_ = globalCase_;
|
||||
}
|
||||
|
||||
// Managing the overrides for the global control switches:
|
||||
//
|
||||
// Here is the order of precedence for the definition/overriding of the
|
||||
// control switches, from lowest to highest:
|
||||
// - source code definitions from the various libraries/solvers
|
||||
// - file specified by the env. variable FOAM_GLOBAL_CONTROLDICT
|
||||
// - case's system/controlDict file
|
||||
// - command-line parameters
|
||||
//
|
||||
// First, we allow the users to specify the location of a centralized
|
||||
// global controlDict dictionary using the environment variable
|
||||
// FOAM_GLOBAL_CONTROLDICT.
|
||||
fileName optionalGlobControlDictFileName =
|
||||
getEnv("FOAM_GLOBAL_CONTROLDICT");
|
||||
|
||||
if (optionalGlobControlDictFileName.size() )
|
||||
{
|
||||
debug::updateCentralDictVars
|
||||
(
|
||||
optionalGlobControlDictFileName,
|
||||
Pstream::master() && bannerEnabled
|
||||
);
|
||||
}
|
||||
|
||||
// Now that the rootPath_/globalCase_ directory is known (following the
|
||||
// call to getRootCase()), we grab any global control switches overrides
|
||||
// from the current case's controlDict.
|
||||
|
||||
debug::updateCentralDictVars
|
||||
(
|
||||
rootPath_/globalCase_/"system/controlDict",
|
||||
Pstream::master() && bannerEnabled
|
||||
);
|
||||
|
||||
// Finally, a command-line override for central controlDict's variables.
|
||||
// This is the ultimate override for the global control switches.
|
||||
|
||||
// Instantiate a NamedEnum for the controlDict switches names
|
||||
const NamedEnum
|
||||
<
|
||||
debug::globalControlDictSwitchSet,
|
||||
debug::DIM_GLOBAL_CONTROL_DICT_SWITCH_SET
|
||||
>
|
||||
globalControlDictSwitchSetNames;
|
||||
|
||||
forAll (globalControlDictSwitchSetNames, gI)
|
||||
{
|
||||
word switchSetName = globalControlDictSwitchSetNames.names[gI];
|
||||
|
||||
if (optionFound(switchSetName))
|
||||
{
|
||||
debug::updateCentralDictVars
|
||||
(
|
||||
globalControlDictSwitchSetNames[switchSetName],
|
||||
option(switchSetName)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( optionFound("dumpControlSwitches") )
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Dumping the application's control switches.
|
||||
// We dump the full information to the console using a standard
|
||||
// dictionary format, so one can copy/paste this information
|
||||
// directly into a case's system/controlDict file to
|
||||
// override some switches values without having to always
|
||||
// use the command-line options.
|
||||
debug::dumpControlSwitchesToConsole();
|
||||
}
|
||||
|
||||
::exit(0);
|
||||
}
|
||||
|
||||
wordList slaveProcs;
|
||||
|
||||
|
@ -539,10 +633,12 @@ Foam::argList::argList
|
|||
{
|
||||
Info<< "Slaves : " << slaveProcs << nl
|
||||
<< "Pstream initialized with:" << nl
|
||||
<< " floatTransfer : " << Pstream::floatTransfer << nl
|
||||
<< " nProcsSimpleSum : " << Pstream::nProcsSimpleSum << nl
|
||||
<< " floatTransfer : "
|
||||
<< Pstream::floatTransfer << nl
|
||||
<< " nProcsSimpleSum : "
|
||||
<< Pstream::nProcsSimpleSum() << nl
|
||||
<< " commsType : "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
@ -568,6 +664,14 @@ Foam::argList::argList
|
|||
Info<< endl;
|
||||
IOobject::writeDivider(Info);
|
||||
}
|
||||
|
||||
// If the macro AppSpecificDictionary is used, one can
|
||||
// modify the application-specific dictionnary using the
|
||||
// command-line parameter -appDict
|
||||
if (appDictName_ != "")
|
||||
{
|
||||
optionReadIfPresent("appDict", appDictName_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -608,22 +712,31 @@ void Foam::argList::printUsage() const
|
|||
Info<< " <" << iter().c_str() << '>';
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
SortableList<Foam::string> sortedValidOptions(validOptions.size());
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<string>::iterator iter = validOptions.begin();
|
||||
iter != validOptions.end();
|
||||
++iter
|
||||
++iter, ++i
|
||||
)
|
||||
{
|
||||
Info<< " [-" << iter.key();
|
||||
OStringStream keyValuePair;
|
||||
keyValuePair << "[-" << iter.key();
|
||||
|
||||
if (iter().size())
|
||||
{
|
||||
Info<< ' ' << iter().c_str();
|
||||
keyValuePair<< ' ' << iter().c_str();
|
||||
}
|
||||
|
||||
Info<< ']';
|
||||
keyValuePair<< ']';
|
||||
sortedValidOptions[i]= keyValuePair.str();
|
||||
}
|
||||
sortedValidOptions.sort();
|
||||
|
||||
forAll (sortedValidOptions, sI)
|
||||
Info << " " << sortedValidOptions[sI].c_str();
|
||||
|
||||
// place help/doc/srcDoc options of the way at the end,
|
||||
// but with an extra space to separate it a little
|
||||
|
@ -640,7 +753,7 @@ void Foam::argList::displayDoc(bool source) const
|
|||
// for source code: change foo_8C.html to foo_8C_source.html
|
||||
if (source)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
forAll (docExts, extI)
|
||||
{
|
||||
docExts[extI].replace(".", "_source.");
|
||||
}
|
||||
|
@ -649,9 +762,9 @@ void Foam::argList::displayDoc(bool source) const
|
|||
fileName docFile;
|
||||
bool found = false;
|
||||
|
||||
forAll(docDirs, dirI)
|
||||
forAll (docDirs, dirI)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
forAll (docExts, extI)
|
||||
{
|
||||
docFile = docDirs[dirI]/executable_ + docExts[extI];
|
||||
docFile.expand();
|
||||
|
|
|
@ -135,6 +135,9 @@ public:
|
|||
//- A list of valid parallel options
|
||||
static HashTable<string> validParOptions;
|
||||
|
||||
//- Name of the application-specific dictionary
|
||||
static word appDictName_;
|
||||
|
||||
//! @cond ignoreDocumentation
|
||||
class initValidTables
|
||||
{
|
||||
|
@ -263,6 +266,11 @@ public:
|
|||
return readList<T>(optionLookup(opt)());
|
||||
}
|
||||
|
||||
//- Return appDictName_
|
||||
const word appDictName() const
|
||||
{
|
||||
return appDictName_;
|
||||
}
|
||||
|
||||
// Edit
|
||||
|
||||
|
@ -290,8 +298,21 @@ public:
|
|||
|
||||
//- Check root path and case path
|
||||
bool checkRootCase() const;
|
||||
|
||||
};
|
||||
|
||||
// Allow overriding the application-specific dictionary using the command-line
|
||||
// parameter -appDict. The dictionary file must still be located in the case's
|
||||
// "system" directory, or accessible using a path relative to the case's
|
||||
// "system" directory.
|
||||
// Example:
|
||||
// cellSet # Default will be cellSetDict
|
||||
// cellSet -appDict cellSetDict # Same as above
|
||||
// cellSet -appDict cellSetDict.rotorOnly
|
||||
//
|
||||
#define AppSpecificDictionary(DefaultAppDict) \
|
||||
argList::appDictName_ = (DefaultAppDict); \
|
||||
argList::validOptions.insert("appDict", argList::appDictName_);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
56
src/foam/global/controlSwitches/constantsSwitch.C
Normal file
56
src/foam/global/controlSwitches/constantsSwitch.C
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "constantsSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime constantsSwitch values.
|
||||
// This needs to go on the heap so the destructor will not get
|
||||
// called before the objects' destructor it is overseeing
|
||||
ListConstantsControlSwitches* constantsSwitchValues_(NULL);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
112
src/foam/global/controlSwitches/constantsSwitch.H
Normal file
112
src/foam/global/controlSwitches/constantsSwitch.H
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::infoSwitch
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
Description
|
||||
Handling of runtime controlSwitches.
|
||||
Specialization of controlSwitches class for dimensionedConstant switches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef constantsSwitch_H
|
||||
#define constantsSwitch_H
|
||||
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// Typedefs
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime dimensionedConstants values
|
||||
typedef std::map<std::string, std::list<controlSwitches<Foam::scalar> *> >
|
||||
ListConstantsControlSwitches;
|
||||
|
||||
extern ListConstantsControlSwitches* constantsSwitchValues_;
|
||||
|
||||
|
||||
class constantsSwitch
|
||||
:
|
||||
public controlSwitches<scalar>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name and value
|
||||
constantsSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const Foam::scalar& switchValue,
|
||||
const std::string& switchDescription = ""
|
||||
)
|
||||
:
|
||||
controlSwitches<scalar>
|
||||
(
|
||||
switchName,
|
||||
debug::constantsFromDict(switchName.c_str(), switchValue),
|
||||
switchDescription,
|
||||
debug::DIMENSIONED_CONSTANTS,
|
||||
&constantsSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~constantsSwitch()
|
||||
{}
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Assignement operator
|
||||
void operator=(const Foam::scalar& rhs)
|
||||
{
|
||||
controlSwitches<Foam::scalar>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
293
src/foam/global/controlSwitches/controlSwitches.C
Normal file
293
src/foam/global/controlSwitches/controlSwitches.C
Normal file
|
@ -0,0 +1,293 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "controlSwitches.H"
|
||||
#include <iomanip>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::debug::controlSwitches<Type>::controlSwitches()
|
||||
:
|
||||
switchValue_(Type(0)),
|
||||
switchDescription_("")
|
||||
{}
|
||||
|
||||
template<class T>
|
||||
Foam::debug::controlSwitches<T>::controlSwitches(const T& switchValue)
|
||||
:
|
||||
switchValue_(switchValue)
|
||||
{}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::debug::controlSwitches<T>::controlSwitches
|
||||
(
|
||||
const std::string& switchName,
|
||||
const T& switchValue,
|
||||
const std::string& switchDescription,
|
||||
globalControlDictSwitchSet switchSet,
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >** switchValuesTable
|
||||
)
|
||||
:
|
||||
switchSet_(switchSet),
|
||||
switchName_(switchName),
|
||||
switchValue_(switchValue),
|
||||
switchDescription_(switchDescription)
|
||||
{
|
||||
// Register the switch in its list
|
||||
if (*switchValuesTable == NULL)
|
||||
{
|
||||
*switchValuesTable =
|
||||
new std::map<std::string, std::list<controlSwitches<T> *> >();
|
||||
}
|
||||
|
||||
switchValuesTable_ = *switchValuesTable;
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >&
|
||||
switchValues = *switchValuesTable_;
|
||||
|
||||
// Memorize this switch object address
|
||||
if (switchValues.find(switchName) != switchValues.end())
|
||||
{
|
||||
switchValues[switchName].push_back(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::list<controlSwitches<T>* > pList;
|
||||
pList.push_back(this);
|
||||
|
||||
switchValues.insert
|
||||
(
|
||||
std::pair<std::string, std::list<controlSwitches<T>* > >
|
||||
(
|
||||
switchName,
|
||||
pList
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::debug::controlSwitches<T>::controlSwitches
|
||||
(
|
||||
const debug::controlSwitches<T>& csw
|
||||
)
|
||||
:
|
||||
switchName_(csw.switchName_),
|
||||
switchValue_(csw.switchValue_),
|
||||
switchDescription_(csw.switchDescription_)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::debug::controlSwitches<T>::~controlSwitches()
|
||||
{
|
||||
// Unregister the switch from its list
|
||||
if (switchValuesTable_)
|
||||
{
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >&
|
||||
switchValuesTable = *switchValuesTable_;
|
||||
|
||||
// Remove entry or key if pointers list is empty
|
||||
switchValuesTable[switchName_].remove(this);
|
||||
|
||||
// Replace the updated list
|
||||
if (switchValuesTable[switchName_].empty())
|
||||
{
|
||||
switchValuesTable.erase(switchName_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void Foam::debug::controlSwitches<T>::operator=
|
||||
(
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
std::cerr
|
||||
<< "Foam::debug::controlSwitches<T>::operator="
|
||||
<< "(const Foam::controlSwitches<T>&)"
|
||||
<< "--> FOAM FATAL ERROR: "
|
||||
<< "Attempted assignment to self"
|
||||
<< std::endl;
|
||||
|
||||
std::abort();
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
switchValue_ = rhs.switchValue_;
|
||||
switchDescription_ = rhs.switchDescription_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void printControlSwitches
|
||||
(
|
||||
const std::string& dictName,
|
||||
const std::map
|
||||
<
|
||||
std::string,
|
||||
std::list<Foam::debug::controlSwitches<T> *>
|
||||
>* mapListSwitchesPtr,
|
||||
const char* commsTypesNames[]
|
||||
)
|
||||
{
|
||||
std::cout << dictName << "\n{\n";
|
||||
|
||||
if (mapListSwitchesPtr)
|
||||
{
|
||||
const std::map
|
||||
<
|
||||
std::string,
|
||||
std::list<Foam::debug::controlSwitches<T> *>
|
||||
>& mapListSwitches = *mapListSwitchesPtr;
|
||||
|
||||
typename std::map
|
||||
<
|
||||
std::string,
|
||||
std::list<Foam::debug::controlSwitches<T> *>
|
||||
>::const_iterator it;
|
||||
|
||||
// Compute the maximum length of the switches names.
|
||||
// Trying to make things pretty with std::setw by lining-up the values.
|
||||
// Useful for the debugSwitches because non-zero flags will be much
|
||||
// easier to spot.
|
||||
std::size_t maxLengthKey = 0;
|
||||
|
||||
for (it = mapListSwitches.begin(); it != mapListSwitches.end(); it++)
|
||||
{
|
||||
std::string switchName = it->first;
|
||||
maxLengthKey = std::max(maxLengthKey, switchName.length());
|
||||
}
|
||||
|
||||
// Still, we clip at 60 characters max.
|
||||
maxLengthKey = std::min(maxLengthKey, size_t(60));
|
||||
|
||||
for (it = mapListSwitches.begin(); it != mapListSwitches.end(); it++)
|
||||
{
|
||||
// Switch name
|
||||
std::string switchName = it->first;
|
||||
|
||||
// Switches list, all identical values, but from
|
||||
// different instances.
|
||||
// So we only need to echo the first switch of the list.
|
||||
std::list<Foam::debug::controlSwitches<T> *> swList = it->second;
|
||||
Foam::debug::controlSwitches<T>& value = *(swList.front());
|
||||
|
||||
std::cout
|
||||
<< " " << std::left << std::setw(maxLengthKey)
|
||||
<< switchName << " ";
|
||||
|
||||
// Special handling for commsTypes from optimisationSwitches
|
||||
if (commsTypesNames && switchName.compare("commsType") == 0)
|
||||
{
|
||||
int valEnumAsIndex = value();
|
||||
|
||||
std::cout << commsTypesNames[valEnumAsIndex] << ";";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << value() << ";";
|
||||
}
|
||||
|
||||
// Now, for the switch description, since numerous switches might
|
||||
// be defined with identical names, but different descriptions
|
||||
// eg: ggi debugSwitch, we will concatenate all the non-empty
|
||||
// switches descriptions for a given switch
|
||||
|
||||
std::string switchDescription("");
|
||||
|
||||
typename
|
||||
std::list<Foam::debug::controlSwitches<T> *>::iterator itL;
|
||||
|
||||
for (itL = swList.begin(); itL != swList.end(); itL++)
|
||||
{
|
||||
debug::controlSwitches<T>& sw = *(*itL);
|
||||
std::string thisSwitchDescr = sw.switchDescription();
|
||||
|
||||
if
|
||||
(
|
||||
!thisSwitchDescr.empty()
|
||||
&& switchDescription.find(thisSwitchDescr) ==
|
||||
std::string::npos
|
||||
)
|
||||
{
|
||||
switchDescription += thisSwitchDescr + ". ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!switchDescription.empty())
|
||||
{
|
||||
std::cout << "\t// " << switchDescription;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout
|
||||
<< " // No switches of this type for this application"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::cout << "}\n\n";
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
342
src/foam/global/controlSwitches/controlSwitches.H
Normal file
342
src/foam/global/controlSwitches/controlSwitches.H
Normal file
|
@ -0,0 +1,342 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::controlSwitches
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
Description
|
||||
Handling of runtime controlSwitches
|
||||
- Debug switches
|
||||
- Info switches
|
||||
- Optimisation switches
|
||||
- Tolerances switches
|
||||
- DimensionedConstants values
|
||||
|
||||
This class is a specialization of the safeBool class, where additional
|
||||
boolean operators are allowed. This class is also offering access to
|
||||
information like the switch name, etc.
|
||||
|
||||
Note:
|
||||
We will be using std::map and std::list for the containers for this class.
|
||||
In some sections of the code where controlSwitches are being used, we are
|
||||
at a relatively low level, so we cannot use HashTable and DynamicList.
|
||||
MB 23/05/2014
|
||||
|
||||
SourceFiles
|
||||
controlSwitchesI.H
|
||||
controlSwitches.C
|
||||
controlSwitchesIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef controlSwitches_H
|
||||
#define controlSwitches_H
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "safeBool.H"
|
||||
|
||||
#include "scalar.H"
|
||||
#include "debug.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
namespace debug
|
||||
{
|
||||
template<class T> class controlSwitches;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool operator==
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator==
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator==
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator!=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator!=
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator!=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator>=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator>=
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator>=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator>
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator>
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator>
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator<=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator<=
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator<=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator<
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator<
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
);
|
||||
|
||||
template<class T>
|
||||
inline bool operator<
|
||||
(
|
||||
const debug::controlSwitches<T>&lhs,
|
||||
const T& rhs
|
||||
);
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class controlSwitches Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class controlSwitches
|
||||
:
|
||||
public safeBool<controlSwitches<T> > // using the CRTP idiom
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Switch section
|
||||
globalControlDictSwitchSet switchSet_;
|
||||
|
||||
//- Switch name
|
||||
std::string switchName_;
|
||||
|
||||
//- Switch value
|
||||
T switchValue_;
|
||||
|
||||
//- Switch Description
|
||||
std::string switchDescription_;
|
||||
|
||||
//- Handle to runTime switches list
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >*
|
||||
switchValuesTable_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
controlSwitches();
|
||||
|
||||
//- Construct from components
|
||||
explicit controlSwitches(const T& data);
|
||||
|
||||
controlSwitches
|
||||
(
|
||||
const std::string& switchName,
|
||||
const T& switchValue,
|
||||
const std::string& switchDescription,
|
||||
globalControlDictSwitchSet switchSet,
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >**
|
||||
switchesValues
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
controlSwitches(const controlSwitches&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~controlSwitches();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Check
|
||||
bool boolean_test() const
|
||||
{
|
||||
// Perform Boolean logic here
|
||||
return switchValue_ != 0;
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assignement operator
|
||||
void operator=(const T&);
|
||||
|
||||
//- Assignement operator
|
||||
void operator=(const controlSwitches&);
|
||||
|
||||
//- & operator
|
||||
const T operator&(const T&);
|
||||
|
||||
//- Return value
|
||||
T operator()() const
|
||||
{
|
||||
return switchValue_;
|
||||
}
|
||||
|
||||
// Return switch name
|
||||
std::string switchName()
|
||||
{
|
||||
return switchName_;
|
||||
}
|
||||
|
||||
//- Return switch description
|
||||
std::string switchDescription()
|
||||
{
|
||||
return switchDescription_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
// Print the content of a controlSwitches list to the console.
|
||||
// We are forced to pass the string descriptions of the Pstream::commsTypes
|
||||
// when dealing with the optimisationSwitches group because this switch is in
|
||||
// fact an enum but we need to specify its corresponding string equivalent in
|
||||
// a controlDict dictionary. And at the low level we are playing, including
|
||||
// Pstream.H is out of the question.
|
||||
// MB 2015
|
||||
template<class T>
|
||||
void printControlSwitches
|
||||
(
|
||||
const std::string&,
|
||||
const std::map<std::string, std::list<debug::controlSwitches<T> *> >*,
|
||||
const char* commsTypesNames[] = NULL
|
||||
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "controlSwitchesI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "controlSwitches.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
242
src/foam/global/controlSwitches/controlSwitchesI.H
Normal file
242
src/foam/global/controlSwitches/controlSwitchesI.H
Normal file
|
@ -0,0 +1,242 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline void Foam::debug::controlSwitches<T>::operator=(const T& rhs)
|
||||
{
|
||||
switchValue_ = rhs;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T Foam::debug::controlSwitches<T>::operator&(const T& rhs)
|
||||
{
|
||||
return switchValue_ & rhs;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator==
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs() == rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator==
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs == rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator==
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
)
|
||||
{
|
||||
return lhs() == rhs;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator!=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs() != rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator!=
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs != rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator!=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
)
|
||||
{
|
||||
return lhs() != rhs;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator>=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs() >= rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator>=
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs >= rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator>=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
)
|
||||
{
|
||||
return lhs() >= rhs;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator>
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs() > rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator>
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs > rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator>
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
)
|
||||
{
|
||||
return lhs() > rhs;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator<=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs() <= rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator<=
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs <= rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator<=
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
)
|
||||
{
|
||||
return lhs() <= rhs;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator<
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs() < rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator<
|
||||
(
|
||||
const T& lhs,
|
||||
const debug::controlSwitches<T>& rhs
|
||||
)
|
||||
{
|
||||
return lhs < rhs();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::operator<
|
||||
(
|
||||
const debug::controlSwitches<T>& lhs,
|
||||
const T& rhs
|
||||
)
|
||||
{
|
||||
return lhs() < rhs;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
55
src/foam/global/controlSwitches/debugSwitch.C
Normal file
55
src/foam/global/controlSwitches/debugSwitch.C
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "debugSwitch.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime debug values.
|
||||
// This needs to go on the heap so the destructor will not get
|
||||
// called before the objects' destructor it is overseeing
|
||||
ListDebugControlSwitches* debugSwitchValues_(NULL);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
111
src/foam/global/controlSwitches/debugSwitch.H
Normal file
111
src/foam/global/controlSwitches/debugSwitch.H
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::debugSwitch
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
Description
|
||||
Handling of runtime controlSwitches.
|
||||
Specialization of controlSwitches class for debug switches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef debugSwitch_H
|
||||
#define debugSwitch_H
|
||||
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// Typedefs
|
||||
// Hashtable to static class attributes addresses holding the
|
||||
// runtime debug switch values
|
||||
typedef std::map<std::string, std::list<controlSwitches<int> *> >
|
||||
ListDebugControlSwitches;
|
||||
|
||||
extern ListDebugControlSwitches* debugSwitchValues_;
|
||||
|
||||
class debugSwitch
|
||||
:
|
||||
public controlSwitches<int>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name and value
|
||||
debugSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const int& switchValue,
|
||||
const std::string& switchDescription = ""
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::debugSwitchFromDict(switchName.c_str(), switchValue),
|
||||
switchDescription,
|
||||
debug::DEBUG_SWITCHES,
|
||||
&debugSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~debugSwitch()
|
||||
{}
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Assignement operator
|
||||
void operator=(const int& rhs)
|
||||
{
|
||||
controlSwitches<int>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
55
src/foam/global/controlSwitches/infoSwitch.C
Normal file
55
src/foam/global/controlSwitches/infoSwitch.C
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "infoSwitch.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime InfoSwitches values.
|
||||
// This needs to go on the heap so the destructor will not get
|
||||
// called before the objects' destructor it is overseeing
|
||||
ListInfoControlSwitches* infoSwitchValues_(NULL);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
109
src/foam/global/controlSwitches/infoSwitch.H
Normal file
109
src/foam/global/controlSwitches/infoSwitch.H
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::infoSwitch
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
Description
|
||||
Handling of runtime controlSwitches.
|
||||
Specialization of controlSwitches class for info switches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef infoSwitch_H
|
||||
#define infoSwitch_H
|
||||
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
// Typedefs
|
||||
// Hashtable to static class attributes addresses holding the
|
||||
// runtime info switch values
|
||||
typedef std::map<std::string, std::list<controlSwitches<int> *> >
|
||||
ListInfoControlSwitches;
|
||||
|
||||
extern ListInfoControlSwitches* infoSwitchValues_;
|
||||
|
||||
class infoSwitch
|
||||
: public controlSwitches<int>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name and value
|
||||
infoSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const int& switchValue,
|
||||
const std::string& switchDescription = ""
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::infoSwitchFromDict(switchName.c_str(), switchValue),
|
||||
switchDescription,
|
||||
debug::INFO_SWITCHES,
|
||||
&infoSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~infoSwitch()
|
||||
{}
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Assignement operator
|
||||
void operator=(const int& rhs)
|
||||
{
|
||||
controlSwitches<int>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
56
src/foam/global/controlSwitches/optimisationSwitch.C
Normal file
56
src/foam/global/controlSwitches/optimisationSwitch.C
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "optimisationSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime optimisationSwitch values.
|
||||
// This needs to go on the heap so the destructor will not get
|
||||
// called before the objects' destructor it is overseeing
|
||||
ListOptimisationControlSwitches* optimisationSwitchValues_(NULL);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
138
src/foam/global/controlSwitches/optimisationSwitch.H
Normal file
138
src/foam/global/controlSwitches/optimisationSwitch.H
Normal file
|
@ -0,0 +1,138 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::infoSwitch
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
Description
|
||||
Handling of runtime controlSwitches.
|
||||
Specialization of controlSwitches class for optimisation switches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef optimisationSwitch_H
|
||||
#define optimisationSwitch_H
|
||||
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// Typedefs
|
||||
// Hashtable to static class attributes addresses holding the
|
||||
// runtime optimisation switch values
|
||||
typedef std::map<std::string, std::list<controlSwitches<int> *> >
|
||||
ListOptimisationControlSwitches;
|
||||
|
||||
extern ListOptimisationControlSwitches* optimisationSwitchValues_;
|
||||
|
||||
|
||||
class optimisationSwitch
|
||||
:
|
||||
public controlSwitches<int>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name and value
|
||||
optimisationSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const int& switchValue,
|
||||
const std::string& switchDescription = ""
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::optimisationSwitchFromDict
|
||||
(
|
||||
switchName.c_str(),
|
||||
switchValue
|
||||
),
|
||||
switchDescription,
|
||||
debug::OPTIMISATION_SWITCHES,
|
||||
&optimisationSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- This constructor is essentially for 'commsType'
|
||||
optimisationSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const std::string& switchValue,
|
||||
const std::string& switchDescription = ""
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::optimisationSwitchFromDict
|
||||
(
|
||||
switchName.c_str(),
|
||||
switchValue
|
||||
),
|
||||
switchDescription,
|
||||
debug::OPTIMISATION_SWITCHES,
|
||||
&optimisationSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~optimisationSwitch()
|
||||
{}
|
||||
|
||||
// Member operators
|
||||
|
||||
// Assignement operator
|
||||
void operator=(const int& rhs)
|
||||
{
|
||||
controlSwitches<int>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
105
src/foam/global/controlSwitches/safeBool.H
Normal file
105
src/foam/global/controlSwitches/safeBool.H
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::safeBool
|
||||
|
||||
Description
|
||||
Implementation of the Safe Bool Idiom.
|
||||
This is the version without virtual functions.
|
||||
|
||||
Author: Bjorn Karlsson
|
||||
http://www.artima.com/cppsource/safebool.html
|
||||
|
||||
SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef safeBool_H
|
||||
#define safeBool_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class safeBool_base Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class safeBoolBase
|
||||
{
|
||||
public:
|
||||
typedef void (safeBoolBase::*boolType)() const;
|
||||
void thisTypeDoesNotSupportComparisons() const {}
|
||||
|
||||
protected:
|
||||
|
||||
safeBoolBase() {}
|
||||
safeBoolBase(const safeBoolBase&) {}
|
||||
safeBoolBase& operator=(const safeBoolBase&) {return *this;}
|
||||
~safeBoolBase() {}
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class safeBool Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template <typename T=void>
|
||||
class safeBool
|
||||
:
|
||||
private safeBoolBase
|
||||
{
|
||||
// private or protected inheritance is very important here as it triggers the
|
||||
// access control violation in main.
|
||||
|
||||
public:
|
||||
|
||||
operator boolType() const
|
||||
{
|
||||
return (static_cast<const T*>(this))->boolean_test()
|
||||
? &safeBoolBase::thisTypeDoesNotSupportComparisons : 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//- Destructor
|
||||
~safeBool()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "safeBoolI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
109
src/foam/global/controlSwitches/safeBoolI.H
Normal file
109
src/foam/global/controlSwitches/safeBoolI.H
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template <typename T>
|
||||
inline bool operator==(const Foam::safeBool<T>& lhs, bool b)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
if (lhs)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lhs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool operator==(bool b, const Foam::safeBool<T>& rhs)
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
if (rhs)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rhs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U>
|
||||
inline bool operator==
|
||||
(
|
||||
const Foam::safeBool<T>& lhs,
|
||||
const Foam::safeBool<U>& rhs
|
||||
)
|
||||
{
|
||||
lhs.this_type_does_not_support_comparisons();
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T,typename U>
|
||||
inline bool operator!=
|
||||
(
|
||||
const Foam::safeBool<T>& lhs,
|
||||
const Foam::safeBool<U>& rhs
|
||||
)
|
||||
{
|
||||
lhs.this_type_does_not_support_comparisons();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
56
src/foam/global/controlSwitches/tolerancesSwitch.C
Normal file
56
src/foam/global/controlSwitches/tolerancesSwitch.C
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime tolerancesSwitch values.
|
||||
// This needs to go on the heap so the destructor will not get
|
||||
// called before the objects' destructor it is overseeing
|
||||
ListTolerancesControlSwitches* tolerancesSwitchValues_(NULL);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
111
src/foam/global/controlSwitches/tolerancesSwitch.H
Normal file
111
src/foam/global/controlSwitches/tolerancesSwitch.H
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | foam-extend: Open Source CFD
|
||||
\\ / O peration |
|
||||
\\ / A nd | For copyright notice see file Copyright
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of foam-extend.
|
||||
|
||||
foam-extend 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.
|
||||
|
||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::infoSwitch
|
||||
|
||||
Author
|
||||
Martin Beaudoin, Hydro-Quebec, 2014. All rights reserved
|
||||
|
||||
Description
|
||||
Handling of runtime controlSwitches.
|
||||
Specialization of controlSwitches class for tolerances switches
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef tolerancesSwitch_H
|
||||
#define tolerancesSwitch_H
|
||||
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// Typedefs
|
||||
// Hashtable to static class attributes addresses holding the
|
||||
// runtime tolerances switch values
|
||||
typedef std::map<std::string, std::list<controlSwitches<Foam::scalar> *> >
|
||||
ListTolerancesControlSwitches;
|
||||
|
||||
extern ListTolerancesControlSwitches* tolerancesSwitchValues_;
|
||||
|
||||
class tolerancesSwitch
|
||||
:
|
||||
public controlSwitches<scalar>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name and value
|
||||
tolerancesSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const Foam::scalar& switchValue,
|
||||
const std::string& switchDescription = ""
|
||||
)
|
||||
:
|
||||
controlSwitches<scalar>
|
||||
(
|
||||
switchName,
|
||||
debug::tolerancesFromDict(switchName.c_str(), switchValue),
|
||||
switchDescription,
|
||||
debug::TOLERANCES,
|
||||
&tolerancesSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~tolerancesSwitch()
|
||||
{}
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Assignement operator
|
||||
void operator=(const Foam::scalar& rhs)
|
||||
{
|
||||
controlSwitches<Foam::scalar>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -42,14 +42,32 @@ namespace Foam
|
|||
|
||||
// Forward declaration of classes
|
||||
class dictionary;
|
||||
class fileName;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace debug
|
||||
{
|
||||
//- Define central control dictionary switchSet
|
||||
enum globalControlDictSwitchSet
|
||||
{
|
||||
DEBUG_SWITCHES,
|
||||
INFO_SWITCHES,
|
||||
OPTIMISATION_SWITCHES,
|
||||
TOLERANCES,
|
||||
DIMENSIONED_CONSTANTS
|
||||
};
|
||||
|
||||
// Number of global controlDict switches sets
|
||||
// Currently, we have:
|
||||
// DebugSwitches
|
||||
// InfoSwitches
|
||||
// OptimisationSwitches
|
||||
// Tolerances,
|
||||
// DimensionedConstants
|
||||
static const int DIM_GLOBAL_CONTROL_DICT_SWITCH_SET = 5;
|
||||
|
||||
//- The central control dictionary.
|
||||
// Located in $WM_PROJECT_DIR/etc
|
||||
// @sa Foam::findEtcFile()
|
||||
dictionary& controlDict();
|
||||
|
||||
//- The DebugSwitches sub-dictionary in the central controlDict.
|
||||
|
@ -64,20 +82,62 @@ namespace debug
|
|||
//- The Tolerances sub-dictionary in the central controlDict.
|
||||
dictionary& tolerances();
|
||||
|
||||
//- The DimensionedConstants sub-dictionary in the central controlDict.
|
||||
dictionary& constants();
|
||||
|
||||
//- Lookup debug switch or add default value.
|
||||
int debugSwitch(const char* name, const int defaultValue = 0);
|
||||
int debugSwitchFromDict(const char* name, const int defaultValue = 0);
|
||||
|
||||
//- Lookup info switch or add default value.
|
||||
int infoSwitch(const char* name, const int defaultValue = 0);
|
||||
int infoSwitchFromDict(const char* name, const int defaultValue = 0);
|
||||
|
||||
//- Lookup optimisation switch or add default value.
|
||||
int optimisationSwitch(const char* name, const int defaultValue = 0);
|
||||
int optimisationSwitchFromDict
|
||||
(
|
||||
const char* name,
|
||||
const int defaultValue = 0
|
||||
);
|
||||
|
||||
int optimisationSwitchFromDict
|
||||
(
|
||||
const Foam::string name,
|
||||
const Foam::word defaultValue
|
||||
);
|
||||
|
||||
//- Lookup tolerances switch or add default value.
|
||||
double tolerances(const char* name, const double defaultValue = 0);
|
||||
double tolerancesFromDict
|
||||
(
|
||||
const char* name,
|
||||
const double defaultValue = 0
|
||||
);
|
||||
|
||||
//- Internal function to lookup a sub-dictionary from controlDict.
|
||||
dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
|
||||
//- Lookup dimensionedConstants switch or add default value.
|
||||
double constantsFromDict
|
||||
(
|
||||
const char* name,
|
||||
const double defaultValue = 0
|
||||
);
|
||||
|
||||
//- Update central controlDict variables
|
||||
// supported keyValues format: key1=value1,key2=value2
|
||||
void updateCentralDictVars
|
||||
(
|
||||
const globalControlDictSwitchSet centralDictSwitchSetName,
|
||||
const Foam::string& keyValues,
|
||||
const bool verbose = true
|
||||
);
|
||||
|
||||
//- Update central controlDict variables from a file
|
||||
void updateCentralDictVars
|
||||
(
|
||||
const Foam::fileName& file,
|
||||
const bool verbose = true
|
||||
);
|
||||
|
||||
//- Dump the central controlDict variables to the console using a standard
|
||||
// dictionary format. If a description is available for a given switch, a
|
||||
// comment will be added just besides the switch name and value.
|
||||
void dumpControlSwitchesToConsole();
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue