Add options for modifying the global controlDict values/switches from the command-line
The following command-line options are available: -DebugSwitches key=value -DimensionedConstants key=value -InfoSwitches key=value -OptimisationSwitches key=value -Tolerances key=value In order to modify more than one key/value pair for a given category, you will need to specify a given option more than once. If an invalid/unknown key is specified, a complete list of valid keys for the application will be written at the console. Martin Beaudoin 05/2014
This commit is contained in:
parent
7832d77bf2
commit
6f1102cb5d
129 changed files with 1779 additions and 412 deletions
|
@ -943,7 +943,7 @@ Tolerances
|
|||
slidingEdgeEndCutoffTol 0.0001;
|
||||
slidingEdgeCoPlanarTol 0.8;
|
||||
|
||||
// GGIAreaErrorTol 1e-8;
|
||||
GGIAreaErrorTol 1e-8;
|
||||
}
|
||||
|
||||
DimensionedConstants
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Pstream::nProcs() <= Pstream::nProcsSimpleSum)
|
||||
if (Pstream::nProcs() <= Pstream::nProcsSimpleSum())
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
|
|||
template<> \
|
||||
int fvPatchTypeField::disallowGenericFvPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowGenericFvPatchField", 0) \
|
||||
debug::debugSwitchFromDict("disallowGenericFvPatchField", 0) \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
|
|||
template<> \
|
||||
int fvsPatchTypeField::disallowDefaultFvsPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFvsPatchField", 0) \
|
||||
debug::debugSwitchFromDict("disallowDefaultFvsPatchField", 0) \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -393,7 +393,7 @@ void Foam::autoRefineDriver::removeInsideCells
|
|||
{
|
||||
Pout<< "Writing subsetted mesh to time "
|
||||
<< meshRefiner_.timeName() << '.' << endl;
|
||||
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
|
||||
meshRefiner_.write(debug(), mesh.time().path()/meshRefiner_.timeName());
|
||||
Pout<< "Dumped mesh in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ void Foam::autoRefineDriver::zonify
|
|||
<< meshRefiner_.timeName() << '.' << endl;
|
||||
meshRefiner_.write
|
||||
(
|
||||
debug,
|
||||
debug(),
|
||||
mesh.time().path()/meshRefiner_.timeName()
|
||||
);
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
|||
{
|
||||
Pout<< "Writing handleProblemCells mesh to time "
|
||||
<< meshRefiner_.timeName() << '.' << endl;
|
||||
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
|
||||
meshRefiner_.write(debug(), mesh.time().path()/meshRefiner_.timeName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1499,13 +1499,13 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||
Info<< "Created baffles in = "
|
||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
|
||||
printMeshInfo(debug, "After introducing baffles");
|
||||
printMeshInfo(debug(), "After introducing baffles");
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Writing baffled mesh to time " << timeName()
|
||||
<< endl;
|
||||
write(debug, runTime.path()/"baffles");
|
||||
write(debug(), runTime.path()/"baffles");
|
||||
Pout<< "Dumped debug data in = "
|
||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
}
|
||||
|
@ -1581,13 +1581,13 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||
Info<< "Created baffles in = "
|
||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
|
||||
printMeshInfo(debug, "After introducing baffles");
|
||||
printMeshInfo(debug(), "After introducing baffles");
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Writing extra baffled mesh to time "
|
||||
<< timeName() << endl;
|
||||
write(debug, runTime.path()/"extraBaffles");
|
||||
write(debug(), runTime.path()/"extraBaffles");
|
||||
Pout<< "Dumped debug data in = "
|
||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
}
|
||||
|
@ -1617,13 +1617,13 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||
Info<< "Split mesh in = "
|
||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
|
||||
printMeshInfo(debug, "After subsetting");
|
||||
printMeshInfo(debug(), "After subsetting");
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Writing subsetted mesh to time " << timeName()
|
||||
<< endl;
|
||||
write(debug, runTime.path()/timeName());
|
||||
write(debug(), runTime.path()/timeName());
|
||||
Pout<< "Dumped debug data in = "
|
||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||
}
|
||||
|
|
|
@ -1269,7 +1269,7 @@ Foam::meshRefinement::refineAndBalance
|
|||
<< " mesh to time " << timeName() << endl;
|
||||
write
|
||||
(
|
||||
debug,
|
||||
debug(),
|
||||
mesh_.time().path()
|
||||
/timeName()
|
||||
);
|
||||
|
@ -1282,7 +1282,7 @@ Foam::meshRefinement::refineAndBalance
|
|||
|
||||
Info<< "Refined mesh in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
printMeshInfo(debug, "After refinement " + msg);
|
||||
printMeshInfo(debug(), "After refinement " + msg);
|
||||
|
||||
|
||||
// Load balancing
|
||||
|
@ -1324,7 +1324,7 @@ Foam::meshRefinement::refineAndBalance
|
|||
Info<< "Balanced mesh in = "
|
||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
printMeshInfo(debug, "After balancing " + msg);
|
||||
printMeshInfo(debug(), "After balancing " + msg);
|
||||
|
||||
|
||||
if (debug)
|
||||
|
@ -1333,7 +1333,7 @@ Foam::meshRefinement::refineAndBalance
|
|||
<< " mesh to time " << timeName() << endl;
|
||||
write
|
||||
(
|
||||
debug,
|
||||
debug(),
|
||||
mesh_.time().path()/timeName()
|
||||
);
|
||||
Pout<< "Dumped debug data in = "
|
||||
|
@ -1447,7 +1447,7 @@ Foam::meshRefinement::balanceAndRefine
|
|||
// Info<< endl;
|
||||
//}
|
||||
|
||||
printMeshInfo(debug, "After balancing " + msg);
|
||||
printMeshInfo(debug(), "After balancing " + msg);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
@ -1455,7 +1455,7 @@ Foam::meshRefinement::balanceAndRefine
|
|||
<< " mesh to time " << timeName() << endl;
|
||||
write
|
||||
(
|
||||
debug,
|
||||
debug(),
|
||||
mesh_.time().path()/timeName()
|
||||
);
|
||||
Pout<< "Dumped debug data in = "
|
||||
|
@ -1478,7 +1478,7 @@ Foam::meshRefinement::balanceAndRefine
|
|||
<< " mesh to time " << timeName() << endl;
|
||||
write
|
||||
(
|
||||
debug,
|
||||
debug(),
|
||||
mesh_.time().path()
|
||||
/timeName()
|
||||
);
|
||||
|
@ -1504,7 +1504,7 @@ Foam::meshRefinement::balanceAndRefine
|
|||
// Info<< endl;
|
||||
//}
|
||||
|
||||
printMeshInfo(debug, "After refinement " + msg);
|
||||
printMeshInfo(debug(), "After refinement " + msg);
|
||||
|
||||
return distMap;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ Author
|
|||
#include "processorPolyPatch.H"
|
||||
#include "decompositionMethod.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
@ -4894,7 +4895,11 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
bool sizeError = false, misMatchError = false;
|
||||
|
||||
// Check if a geometric tolerance has been specified.
|
||||
scalar gTol = debug::tolerances("processorMatchTol", 1e-4);
|
||||
const Foam::debug::tolerancesSwitch gTol
|
||||
(
|
||||
"processorMatchTol",
|
||||
1e-4
|
||||
);
|
||||
|
||||
// Maintain a list of master / neighbour anchors
|
||||
List<vectorField> mAnchors(boundary.size());
|
||||
|
@ -5053,7 +5058,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
scalar rMagSf = mag(half1Areas[faceI]);
|
||||
scalar avSf = 0.5 * (fMagSf + rMagSf);
|
||||
|
||||
if (mag(fMagSf - rMagSf)/avSf > gTol)
|
||||
if (mag(fMagSf - rMagSf)/avSf > gTol())
|
||||
{
|
||||
misMatchError = true;
|
||||
|
||||
|
@ -5071,7 +5076,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
Foam::max
|
||||
(
|
||||
pTol,
|
||||
gTol * mag(lP[lF[faceI][0]] - lC[faceI])
|
||||
gTol() * mag(lP[lF[faceI][0]] - lC[faceI])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -5217,7 +5222,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
scalar nbrMagSf = mag(fAreas[pI][faceI]);
|
||||
scalar avSf = 0.5 * (magSf + nbrMagSf);
|
||||
|
||||
if (mag(magSf - nbrMagSf)/avSf > gTol)
|
||||
if (mag(magSf - nbrMagSf)/avSf > gTol())
|
||||
{
|
||||
misMatchError = true;
|
||||
|
||||
|
@ -5236,7 +5241,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const
|
|||
Foam::max
|
||||
(
|
||||
pTol,
|
||||
gTol *
|
||||
gTol() *
|
||||
mag
|
||||
(
|
||||
myPoints[myFaces[faceI][0]]
|
||||
|
@ -6116,10 +6121,14 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps()
|
|||
|
||||
// Check if a geometric tolerance has been specified.
|
||||
const boundBox& box = polyMesh::bounds();
|
||||
scalar relTol = debug::tolerances("patchFaceMatchTol", 1e-4);
|
||||
const Foam::debug::tolerancesSwitch relTol
|
||||
(
|
||||
"patchFaceMatchTol",
|
||||
1e-4
|
||||
);
|
||||
|
||||
// Compute tolerance
|
||||
scalar tol = relTol * box.mag();
|
||||
scalar tol = relTol() * box.mag();
|
||||
|
||||
const polyBoundaryMesh& boundary = boundaryMesh();
|
||||
|
||||
|
@ -6181,7 +6190,7 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps()
|
|||
FatalErrorIn("void dynamicTopoFvMesh::buildLocalCoupledMaps()")
|
||||
<< " Failed to match all points"
|
||||
<< " within a tolerance of: " << tol << nl
|
||||
<< " relTol: " << relTol << nl
|
||||
<< " relTol: " << relTol() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
@ -6843,10 +6852,14 @@ void dynamicTopoFvMesh::buildProcessorCoupledMaps()
|
|||
const Map<label>& pMap = cMap.entityMap(coupleMap::POINT);
|
||||
|
||||
// Fetch relative tolerance
|
||||
scalar relTol = debug::tolerances("processorMatchTol", 1e-4);
|
||||
const Foam::debug::tolerancesSwitch relTol
|
||||
(
|
||||
"processorMatchTol",
|
||||
1e-4
|
||||
);
|
||||
|
||||
// Compute tolerance
|
||||
scalar tol = relTol * box.mag();
|
||||
scalar tol = relTol() * box.mag();
|
||||
|
||||
forAllConstIter(Map<label>, pMap, pIter)
|
||||
{
|
||||
|
@ -8028,7 +8041,11 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
|
|||
bool anyChange = false, failedPatchMatch = false;
|
||||
|
||||
// Fetch tolerance
|
||||
scalar matchTol = Foam::debug::tolerances("patchFaceMatchTol", 1e-4);
|
||||
const Foam::debug::tolerancesSwitch matchTol
|
||||
(
|
||||
"patchFaceMatchTol",
|
||||
1e-4
|
||||
);
|
||||
|
||||
// Calculate centres and tolerances for any slave patches
|
||||
List<scalarField> slaveTols(nPatches_);
|
||||
|
@ -8090,7 +8107,7 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
|
|||
maxLen = max(maxLen, mag(points_[sFace[fpI]] - sfc));
|
||||
}
|
||||
|
||||
slaveTols[slavePatch][fI] = matchTol*maxLen;
|
||||
slaveTols[slavePatch][fI] = matchTol()*maxLen;
|
||||
}
|
||||
|
||||
// For cyclics, additionally test for halves,
|
||||
|
@ -8442,7 +8459,7 @@ bool dynamicTopoFvMesh::syncCoupledBoundaryOrdering
|
|||
maxLen = max(maxLen, mag(points_[checkFace[fpI]] - fc));
|
||||
}
|
||||
|
||||
slaveTols[pI][fI] = matchTol*maxLen;
|
||||
slaveTols[pI][fI] = matchTol()*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 "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -261,28 +262,28 @@ private:
|
|||
// Static data members
|
||||
|
||||
//- Point merge tolerance
|
||||
static const scalar pointMergeTol_;
|
||||
static const Foam::debug::tolerancesSwitch pointMergeTol_;
|
||||
|
||||
//- Edge merge tolerance
|
||||
static const scalar edgeMergeTol_;
|
||||
static const Foam::debug::tolerancesSwitch edgeMergeTol_;
|
||||
|
||||
//- Estimated number of faces an edge goes through
|
||||
static const label nFacesPerSlaveEdge_;
|
||||
static const Foam::label nFacesPerSlaveEdge_;
|
||||
|
||||
//- Edge-face interaction escape limit
|
||||
static const label edgeFaceEscapeLimit_;
|
||||
static const Foam::label edgeFaceEscapeLimit_;
|
||||
|
||||
//- Integral match point adjustment tolerance
|
||||
static const scalar integralAdjTol_;
|
||||
static const Foam::debug::tolerancesSwitch integralAdjTol_;
|
||||
|
||||
//- Edge intersection master catch fraction
|
||||
static const scalar edgeMasterCatchFraction_;
|
||||
static const Foam::debug::tolerancesSwitch edgeMasterCatchFraction_;
|
||||
|
||||
//- Edge intersection co-planar tolerance
|
||||
static const scalar edgeCoPlanarTol_;
|
||||
static const Foam::debug::tolerancesSwitch edgeCoPlanarTol_;
|
||||
|
||||
//- Edge end cut-off tolerance
|
||||
static const scalar edgeEndCutoffTol_;
|
||||
static const Foam::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;
|
||||
}
|
||||
|
@ -358,7 +375,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)
|
||||
|
@ -576,7 +593,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
|
||||
// Calculate the tolerance
|
||||
const scalar mergeTol =
|
||||
pointMergeTol_*
|
||||
pointMergeTol_()*
|
||||
min
|
||||
(
|
||||
minSlavePointLength[pointI],
|
||||
|
@ -678,7 +695,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
minMasterFaceLength[slavePointFaceHits[pointI].hitObject()]
|
||||
);
|
||||
|
||||
const scalar mergeTol = pointMergeTol_*mergeLength;
|
||||
const scalar mergeTol = pointMergeTol_()*mergeLength;
|
||||
|
||||
scalar minDistance = GREAT;
|
||||
|
||||
|
@ -739,7 +756,7 @@ bool Foam::slidingInterface::projectPoints() const
|
|||
|
||||
// Calculate the tolerance
|
||||
const scalar mergeTol =
|
||||
pointMergeTol_*
|
||||
pointMergeTol_()*
|
||||
min
|
||||
(
|
||||
minSlavePointLength[pointI],
|
||||
|
@ -1051,7 +1068,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
|
||||
|
@ -1144,9 +1161,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
|
||||
(
|
||||
|
|
|
@ -36,7 +36,7 @@ const Foam::label Foam::polyTopoChange::cellFraction = 10;
|
|||
|
||||
int Foam::polyTopoChange::debug
|
||||
(
|
||||
Foam::debug::debugSwitch("polyTopoChange", 0)
|
||||
Foam::debug::debugSwitchFromDict("polyTopoChange", 0)
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ License
|
|||
#include "processorPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "polyMesh.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
#include "matchPoints.H"
|
||||
#include "DimensionedField.H"
|
||||
|
@ -1872,10 +1873,14 @@ void mesquiteMotionSolver::initParallelSurfaceSmoothing()
|
|||
const boundBox& box = mesh().bounds();
|
||||
|
||||
// Fetch relative tolerance
|
||||
scalar relTol = debug::tolerances("processorMatchTol", 1e-4);
|
||||
const Foam::debug::tolerancesSwitch relTol
|
||||
(
|
||||
"processorMatchTol",
|
||||
1e-4
|
||||
);
|
||||
|
||||
// Compute tolerance
|
||||
scalar tol = relTol * box.mag();
|
||||
scalar tol = relTol() * box.mag();
|
||||
|
||||
// Wait for all transfers to complete.
|
||||
OPstream::waitRequests();
|
||||
|
|
|
@ -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,7 @@ class faMesh
|
|||
|
||||
// Static Private Data
|
||||
|
||||
static const bool quadricsFit_;
|
||||
static const Foam::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 "controlSwitches.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
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(faPatchTypeField, 0); \
|
|||
template<> \
|
||||
int faPatchTypeField::disallowDefaultFaPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFaPatchField", 0) \
|
||||
debug::debugSwitchFromDict("disallowDefaultFaPatchField", 0) \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(faPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -41,7 +41,7 @@ defineNamedTemplateTypeNameAndDebug(faePatchTypeField, 0); \
|
|||
template<> \
|
||||
int faePatchTypeField::disallowDefaultFaePatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFaePatchField", 0) \
|
||||
debug::debugSwitchFromDict("disallowDefaultFaePatchField", 0) \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(faePatchTypeField, patchMapper); \
|
||||
|
|
|
@ -35,7 +35,7 @@ Description
|
|||
namespace Foam
|
||||
{
|
||||
|
||||
int faSchemes::debug(Foam::debug::debugSwitch("faSchemes", false));
|
||||
int faSchemes::debug(Foam::debug::debugSwitchFromDict("faSchemes", false));
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -29,6 +29,7 @@ License
|
|||
#include "processorFvsPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
#include "fvc.H"
|
||||
#include "controlSwitches.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 Foam::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();
|
||||
|
|
|
@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \
|
|||
template<> \
|
||||
int fvPatchTypeField::disallowGenericFvPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowGenericFvPatchField", 0) \
|
||||
debug::debugSwitchFromDict("disallowGenericFvPatchField", 0) \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \
|
|||
template<> \
|
||||
int fvsPatchTypeField::disallowDefaultFvsPatchField \
|
||||
( \
|
||||
debug::debugSwitch("disallowDefaultFvsPatchField", 0) \
|
||||
debug::debugSwitchFromDict("disallowDefaultFvsPatchField", 0) \
|
||||
); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \
|
||||
defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \
|
||||
|
|
|
@ -29,7 +29,7 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
|
||||
int Foam::fvSchemes::debug(Foam::debug::debugSwitchFromDict("fvSchemes", false));
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -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,7 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::cellPointWeight::debug(debug::debugSwitch("cellPointWeight", 0));
|
||||
int Foam::cellPointWeight::debug(debug::debugSwitchFromDict("cellPointWeight", 0));
|
||||
Foam::scalar Foam::cellPointWeight::tol(SMALL);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
|
|
@ -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 "controlSwitches.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 "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -69,7 +70,7 @@ class octreeDataBoundBox
|
|||
// Static data
|
||||
|
||||
//- Tolerance on linear dimensions
|
||||
static scalar tol;
|
||||
static const Foam::debug::tolerancesSwitch tol;
|
||||
|
||||
|
||||
// Private data
|
||||
|
|
|
@ -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 "controlSwitches.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;
|
||||
}
|
||||
|
|
|
@ -227,16 +227,20 @@ 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
|
||||
|
@ -245,5 +249,4 @@ Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType
|
|||
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -45,6 +45,7 @@ SourceFiles
|
|||
#include "HashTable.H"
|
||||
#include "string.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -224,11 +225,11 @@ 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 Foam::debug::optimisationSwitch floatTransfer;
|
||||
|
||||
//- Number of processors at which the sum algorithm changes from linear
|
||||
// to tree
|
||||
static int nProcsSimpleSum;
|
||||
static const Foam::debug::optimisationSwitch nProcsSimpleSum;
|
||||
|
||||
//- Default commsType
|
||||
static commsTypes defaultCommsType;
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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,7 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2));
|
||||
int Foam::messageStream::level(Foam::debug::debugSwitchFromDict("level", 2));
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -30,7 +30,7 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineRunTimeSelectionTable(Foam::functionObject, dictionary);
|
||||
int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0));
|
||||
int Foam::functionObject::debug(Foam::debug::debugSwitchFromDict("functionObject", 0));
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -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 "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -93,7 +94,7 @@ public:
|
|||
//- Runtime type information
|
||||
TypeName("regIOobject");
|
||||
|
||||
static int fileModificationSkew;
|
||||
static const Foam::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,7 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::scalarRange::debug(::Foam::debug::debugSwitch("scalarRange", 0));
|
||||
int Foam::scalarRange::debug(::Foam::debug::debugSwitchFromDict("scalarRange", 0));
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -31,6 +31,7 @@ Description
|
|||
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include "controlSwitches.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.
|
||||
|
@ -133,21 +134,23 @@ public: \
|
|||
|
||||
//- Define the debug information, lookup as @a Name
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||
::Foam::debug::debugSwitch \
|
||||
Type::debug(std::string(Name), DebugSwitch)
|
||||
|
||||
//- Define the debug information
|
||||
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch);
|
||||
|
||||
#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
|
||||
|
|
|
@ -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 "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -70,7 +71,7 @@ class JobInfo
|
|||
public:
|
||||
|
||||
static bool constructed;
|
||||
static bool writeJobInfo;
|
||||
static Foam::debug::infoSwitch writeJobInfo;
|
||||
|
||||
// Constructors
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ License
|
|||
#include "IOobject.H"
|
||||
#include "JobInfo.H"
|
||||
#include "labelList.H"
|
||||
#include "SortableList.H"
|
||||
//#include "dimensionedConstants.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
@ -39,8 +41,32 @@ License
|
|||
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);
|
||||
|
||||
template<>
|
||||
const char*
|
||||
Foam::NamedEnum
|
||||
<
|
||||
Foam::debug::globalControlDictSwitchSet,
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"DebugSwitches",
|
||||
"InfoSwitches",
|
||||
"OptimisationSwitches",
|
||||
"Tolerances",
|
||||
"DimensionedConstants"
|
||||
};
|
||||
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::debug::globalControlDictSwitchSet,
|
||||
5
|
||||
>
|
||||
Foam::argList::globalControlDictSwitchSetNames_;
|
||||
|
||||
|
||||
Foam::argList::initValidTables::initValidTables()
|
||||
{
|
||||
|
@ -48,7 +74,11 @@ Foam::argList::initValidTables::initValidTables()
|
|||
validOptions.set("parallel", "");
|
||||
validParOptions.set("parallel", "");
|
||||
validOptions.set("noFunctionObjects", "");
|
||||
|
||||
validOptions.set("DebugSwitches", "key=value");
|
||||
validOptions.set("InfoSwitches", "key=value");
|
||||
validOptions.set("OptimisationSwitches", "key=value");
|
||||
validOptions.set("Tolerances", "key=value");
|
||||
validOptions.set("DimensionedConstants", "key=value");
|
||||
Pstream::addValidParOptions(validParOptions);
|
||||
}
|
||||
|
||||
|
@ -308,6 +338,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();
|
||||
|
@ -328,6 +359,19 @@ Foam::argList::argList
|
|||
<< endl;
|
||||
}
|
||||
|
||||
// Command-line override for central controlDict's variables
|
||||
forAll(globalControlDictSwitchSetNames_, cI)
|
||||
{
|
||||
word switchSetName = globalControlDictSwitchSetNames_.names[cI];
|
||||
|
||||
if( optionFound(switchSetName) )
|
||||
Foam::debug::updateCentralDictVars
|
||||
(
|
||||
globalControlDictSwitchSetNames_[switchSetName],
|
||||
option(switchSetName)
|
||||
);
|
||||
}
|
||||
|
||||
jobInfo.add("startDate", dateString);
|
||||
jobInfo.add("startTime", timeString);
|
||||
jobInfo.add("userName", userName());
|
||||
|
@ -540,7 +584,7 @@ Foam::argList::argList
|
|||
Info<< "Slaves : " << slaveProcs << nl
|
||||
<< "Pstream initialized with:" << nl
|
||||
<< " floatTransfer : " << Pstream::floatTransfer << nl
|
||||
<< " nProcsSimpleSum : " << Pstream::nProcsSimpleSum << nl
|
||||
<< " nProcsSimpleSum : " << Pstream::nProcsSimpleSum() << nl
|
||||
<< " commsType : "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
|
||||
<< endl;
|
||||
|
@ -568,6 +612,13 @@ 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 +659,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
|
||||
|
|
|
@ -126,6 +126,9 @@ public:
|
|||
|
||||
// Static data members
|
||||
|
||||
//- Central dictionary switchSet names
|
||||
static const NamedEnum<Foam::debug::globalControlDictSwitchSet, 5> globalControlDictSwitchSetNames_;
|
||||
|
||||
//- A list of valid (mandatory) arguments
|
||||
static SLList<string> validArgs;
|
||||
|
||||
|
@ -135,6 +138,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 +269,11 @@ public:
|
|||
return readList<T>(optionLookup(opt)());
|
||||
}
|
||||
|
||||
//- Return appDictName_
|
||||
const word appDictName() const
|
||||
{
|
||||
return appDictName_;
|
||||
}
|
||||
|
||||
// Edit
|
||||
|
||||
|
@ -290,8 +301,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_);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
145
src/foam/global/controlSwitches/controlSwitches.C
Normal file
145
src/foam/global/controlSwitches/controlSwitches.C
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
template<class Type>
|
||||
Foam::debug::controlSwitches<Type>::controlSwitches()
|
||||
:
|
||||
switchValue_(Type(0))
|
||||
{
|
||||
}
|
||||
|
||||
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,
|
||||
globalControlDictSwitchSet switchSet,
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >** switchValuesTable
|
||||
)
|
||||
:
|
||||
switchSet_(switchSet),
|
||||
switchName_(switchName),
|
||||
switchValue_(switchValue)
|
||||
{
|
||||
// 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 Foam::debug::controlSwitches<T>& csw)
|
||||
:
|
||||
switchName_(csw.switchName_),
|
||||
switchValue_(csw.switchValue_)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::debug::controlSwitches<T>::~controlSwitches()
|
||||
{
|
||||
// Unregister the switch from its list
|
||||
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_].size() == 0)
|
||||
{
|
||||
switchValuesTable.erase(switchName_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void Foam::debug::controlSwitches<T>::operator=(const Foam::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_;
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
358
src/foam/global/controlSwitches/controlSwitches.H
Normal file
358
src/foam/global/controlSwitches/controlSwitches.H
Normal file
|
@ -0,0 +1,358 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 safe_bool 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 "safe_bool.H"
|
||||
|
||||
#include "scalar.H"
|
||||
#include "debug.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace debug
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class T> class controlSwitches;
|
||||
|
||||
// Typedefs
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime debug/info/optimisation/tolerances values
|
||||
typedef std::map<std::string, std::list<controlSwitches<int> *> > ListDebugControlSwitches;
|
||||
typedef std::map<std::string, std::list<controlSwitches<int> *> > ListInfoControlSwitches;
|
||||
typedef std::map<std::string, std::list<controlSwitches<int> *> > ListOptimisationControlSwitches;
|
||||
typedef std::map<std::string, std::list<controlSwitches<Foam::scalar> *> > ListTolerancesControlSwitches;
|
||||
typedef std::map<std::string, std::list<controlSwitches<Foam::scalar> *> > ListConstantsControlSwitches;
|
||||
|
||||
extern ListDebugControlSwitches* debugSwitchValues_;
|
||||
extern ListInfoControlSwitches* infoSwitchValues_;
|
||||
extern ListOptimisationControlSwitches* optimisationSwitchValues_;
|
||||
extern ListTolerancesControlSwitches* tolerancesSwitchValues_;
|
||||
extern ListConstantsControlSwitches* constantsSwitchValues_;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class controlSwitches Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T>
|
||||
class controlSwitches
|
||||
: public safe_bool<controlSwitches<T> > // using the CRTP idiom
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Switch section
|
||||
globalControlDictSwitchSet switchSet_;
|
||||
|
||||
//- Switch name
|
||||
std::string switchName_;
|
||||
|
||||
//- Switch value
|
||||
T switchValue_;
|
||||
|
||||
//- Handle to runTime switches list
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >* switchValuesTable_ ;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
controlSwitches();
|
||||
|
||||
//- Construct from components
|
||||
controlSwitches(const T& data);
|
||||
|
||||
controlSwitches
|
||||
(
|
||||
const std::string& switchName,
|
||||
const T& switchValue,
|
||||
globalControlDictSwitchSet switchSet,
|
||||
std::map<std::string, std::list<controlSwitches<T> *> >** switchesValues
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
controlSwitches(const controlSwitches&);
|
||||
|
||||
//- Destructor
|
||||
~controlSwitches();
|
||||
|
||||
|
||||
// Member Functions
|
||||
// Access
|
||||
|
||||
// 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&);
|
||||
|
||||
// == operator
|
||||
bool operator==(const T&);
|
||||
|
||||
// >= operator
|
||||
bool operator>=(const T&);
|
||||
|
||||
// > operator
|
||||
bool operator>(const T&);
|
||||
|
||||
// < operator
|
||||
bool operator<(const T&);
|
||||
|
||||
// Return value
|
||||
T operator()() const
|
||||
{
|
||||
return switchValue_;
|
||||
}
|
||||
};
|
||||
|
||||
// Utility classes
|
||||
class debugSwitch
|
||||
: public controlSwitches<int>
|
||||
{
|
||||
public:
|
||||
debugSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const int& switchValue
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::debugSwitchFromDict(switchName.c_str(), switchValue),
|
||||
debug::DEBUGSWITCHES,
|
||||
&debugSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
virtual ~debugSwitch()
|
||||
{
|
||||
}
|
||||
|
||||
// Assignement operator
|
||||
void operator=(const int& rhs)
|
||||
{
|
||||
controlSwitches<int>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
class infoSwitch
|
||||
: public controlSwitches<int>
|
||||
{
|
||||
public:
|
||||
infoSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const int& switchValue
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::infoSwitchFromDict(switchName.c_str(), switchValue),
|
||||
debug::INFOSWITCHES,
|
||||
&infoSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
virtual ~infoSwitch()
|
||||
{
|
||||
}
|
||||
|
||||
// Assignement operator
|
||||
void operator=(const int& rhs)
|
||||
{
|
||||
controlSwitches<int>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
class optimisationSwitch
|
||||
: public controlSwitches<int>
|
||||
{
|
||||
public:
|
||||
optimisationSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const int& switchValue
|
||||
)
|
||||
:
|
||||
controlSwitches<int>
|
||||
(
|
||||
switchName,
|
||||
debug::optimisationSwitchFromDict(switchName.c_str(), switchValue),
|
||||
debug::OPTIMISATIONSWITCHES,
|
||||
&optimisationSwitchValues_
|
||||
)
|
||||
{}
|
||||
|
||||
virtual ~optimisationSwitch()
|
||||
{
|
||||
}
|
||||
|
||||
// Assignement operator
|
||||
void operator=(const int& rhs)
|
||||
{
|
||||
controlSwitches<int>::operator=(rhs);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
class tolerancesSwitch
|
||||
: public controlSwitches<Foam::scalar>
|
||||
{
|
||||
public:
|
||||
tolerancesSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const Foam::scalar& switchValue
|
||||
)
|
||||
:
|
||||
controlSwitches<Foam::scalar>
|
||||
(
|
||||
switchName,
|
||||
debug::tolerancesFromDict(switchName.c_str(), switchValue),
|
||||
debug::TOLERANCES,
|
||||
&tolerancesSwitchValues_
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~tolerancesSwitch()
|
||||
{
|
||||
}
|
||||
|
||||
// Assignement operator
|
||||
void operator=(const Foam::scalar& rhs)
|
||||
{
|
||||
controlSwitches<Foam::scalar>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
class constantsSwitch
|
||||
: public controlSwitches<Foam::scalar>
|
||||
{
|
||||
public:
|
||||
constantsSwitch
|
||||
(
|
||||
const std::string& switchName,
|
||||
const Foam::scalar& switchValue
|
||||
)
|
||||
:
|
||||
controlSwitches<Foam::scalar>
|
||||
(
|
||||
switchName,
|
||||
debug::constantsFromDict(switchName.c_str(), switchValue),
|
||||
debug::DIMENSIONEDCONSTANTS,
|
||||
&constantsSwitchValues_
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~constantsSwitch()
|
||||
{
|
||||
}
|
||||
|
||||
// Assignement operator
|
||||
void operator=(const Foam::scalar& rhs)
|
||||
{
|
||||
controlSwitches<Foam::scalar>::operator=(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "controlSwitchesI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "controlSwitches.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
79
src/foam/global/controlSwitches/controlSwitchesI.H
Normal file
79
src/foam/global/controlSwitches/controlSwitchesI.H
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * 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;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::debug::controlSwitches<T>::operator==(const T& rhs)
|
||||
{
|
||||
return switchValue_ == rhs;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::debug::controlSwitches<T>::operator>=(const T& rhs)
|
||||
{
|
||||
return switchValue_ >= rhs;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::debug::controlSwitches<T>::operator>(const T& rhs)
|
||||
{
|
||||
return switchValue_ > rhs;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::debug::controlSwitches<T>::operator<(const T& rhs)
|
||||
{
|
||||
return switchValue_ < rhs;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
100
src/foam/global/controlSwitches/safe_bool.H
Normal file
100
src/foam/global/controlSwitches/safe_bool.H
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::safe_bool
|
||||
|
||||
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 safe_bool_H
|
||||
#define safe_bool_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class safe_bool_base Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
class safe_bool_base
|
||||
{
|
||||
public:
|
||||
typedef void (safe_bool_base::*bool_type)() const;
|
||||
void this_type_does_not_support_comparisons() const {}
|
||||
|
||||
protected:
|
||||
|
||||
safe_bool_base() {}
|
||||
safe_bool_base(const safe_bool_base&) {}
|
||||
safe_bool_base& operator=(const safe_bool_base&) {return *this;}
|
||||
~safe_bool_base() {}
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class safe_bool Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template <typename T=void>
|
||||
class safe_bool
|
||||
:
|
||||
private safe_bool_base
|
||||
{
|
||||
// private or protected inheritance is very important here as it triggers the
|
||||
// access control violation in main.
|
||||
|
||||
public:
|
||||
operator bool_type() const
|
||||
{
|
||||
return (static_cast<const T*>(this))->boolean_test()
|
||||
? &safe_bool_base::this_type_does_not_support_comparisons : 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
//- Destructor
|
||||
~safe_bool()
|
||||
{}
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "safe_boolI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
79
src/foam/global/controlSwitches/safe_boolI.H
Normal file
79
src/foam/global/controlSwitches/safe_boolI.H
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::safe_bool<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::safe_bool<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::safe_bool<T>& lhs,const Foam::safe_bool<U>& rhs)
|
||||
{
|
||||
lhs.this_type_does_not_support_comparisons();
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T,typename U>
|
||||
inline bool operator!=(const Foam::safe_bool<T>& lhs,const Foam::safe_bool<U>& rhs)
|
||||
{
|
||||
lhs.this_type_does_not_support_comparisons();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -30,6 +30,9 @@ Description
|
|||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "OSspecific.H"
|
||||
#include "dimensionedConstants.H"
|
||||
#include "SortableList.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -44,6 +47,18 @@ dictionary* debugSwitchesPtr_(NULL);
|
|||
dictionary* infoSwitchesPtr_(NULL);
|
||||
dictionary* optimisationSwitchesPtr_(NULL);
|
||||
dictionary* tolerancesPtr_(NULL);
|
||||
dictionary* constantsPtr_(NULL);
|
||||
|
||||
// Hashtables to static class attributes addresses holding the
|
||||
// runtime debug/info/optimisation/tolerances values
|
||||
// This needs to go on the heap so the destructor will not get
|
||||
// called before the object's destructor it is overseeing
|
||||
ListDebugControlSwitches* debugSwitchValues_(NULL);
|
||||
ListInfoControlSwitches* infoSwitchValues_(NULL);
|
||||
ListOptimisationControlSwitches* optimisationSwitchValues_(NULL);
|
||||
ListTolerancesControlSwitches* tolerancesSwitchValues_(NULL);
|
||||
ListConstantsControlSwitches* constantsSwitchValues_(NULL);
|
||||
|
||||
|
||||
// to ensure controlDictPtr_ is deleted at the end of the run
|
||||
class deleteControlDictPtr
|
||||
|
@ -149,8 +164,13 @@ Foam::dictionary& Foam::debug::tolerances()
|
|||
return switchSet("Tolerances", tolerancesPtr_);
|
||||
}
|
||||
|
||||
Foam::dictionary& Foam::debug::constants()
|
||||
{
|
||||
return switchSet("DimensionedConstants", constantsPtr_);
|
||||
}
|
||||
|
||||
int Foam::debug::debugSwitch(const char* name, const int defaultValue)
|
||||
|
||||
int Foam::debug::debugSwitchFromDict(const char* name, const int defaultValue)
|
||||
{
|
||||
return debugSwitches().lookupOrAddDefault
|
||||
(
|
||||
|
@ -159,7 +179,7 @@ int Foam::debug::debugSwitch(const char* name, const int defaultValue)
|
|||
}
|
||||
|
||||
|
||||
int Foam::debug::infoSwitch(const char* name, const int defaultValue)
|
||||
int Foam::debug::infoSwitchFromDict(const char* name, const int defaultValue)
|
||||
{
|
||||
return infoSwitches().lookupOrAddDefault
|
||||
(
|
||||
|
@ -168,7 +188,7 @@ int Foam::debug::infoSwitch(const char* name, const int defaultValue)
|
|||
}
|
||||
|
||||
|
||||
int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
||||
int Foam::debug::optimisationSwitchFromDict(const char* name, const int defaultValue)
|
||||
{
|
||||
return optimisationSwitches().lookupOrAddDefault
|
||||
(
|
||||
|
@ -177,11 +197,7 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
|||
}
|
||||
|
||||
|
||||
double Foam::debug::tolerances
|
||||
(
|
||||
const char* name,
|
||||
const double defaultValue
|
||||
)
|
||||
double Foam::debug::tolerancesFromDict(const char* name, const double defaultValue)
|
||||
{
|
||||
return tolerances().lookupOrAddDefault
|
||||
(
|
||||
|
@ -189,5 +205,299 @@ double Foam::debug::tolerances
|
|||
);
|
||||
}
|
||||
|
||||
double Foam::debug::constantsFromDict(const char* name, const double defaultValue)
|
||||
{
|
||||
return tolerances().lookupOrAddDefault
|
||||
(
|
||||
name, defaultValue, false, false
|
||||
);
|
||||
}
|
||||
|
||||
void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet globalControlDictSwitchSetName, Foam::string keyValues)
|
||||
{
|
||||
Foam::word token;
|
||||
|
||||
// Extract the multiple keyValues, separated by ','
|
||||
std::istringstream issmkvs(keyValues);
|
||||
while ( getline(issmkvs, token, ',') )
|
||||
{
|
||||
// Cleanup
|
||||
Foam::string::stripInvalid<word>(token);
|
||||
|
||||
// Extract the keyValue pair, separated by '='
|
||||
std::istringstream isskv(token);
|
||||
|
||||
while ( getline(isskv, token, '=') )
|
||||
{
|
||||
Foam::word key = token;
|
||||
|
||||
switch(globalControlDictSwitchSetName)
|
||||
{
|
||||
case DEBUGSWITCHES:
|
||||
{
|
||||
if (debugSwitchValues_)
|
||||
{
|
||||
ListDebugControlSwitches& runTimeDebugSwitchValues = *debugSwitchValues_;
|
||||
label oldDebugValue;
|
||||
label newDebugValue;
|
||||
isskv >> newDebugValue;
|
||||
|
||||
if(Foam::debug::debugSwitches().readIfPresent(key, oldDebugValue))
|
||||
{
|
||||
Info << endl
|
||||
<< "Warning: Modification of DebugSwitch: " << key << endl
|
||||
<< " Old value: " << oldDebugValue << endl
|
||||
<< " New value: " << newDebugValue << endl
|
||||
<< endl;
|
||||
|
||||
Foam::debug::debugSwitches().set(key, newDebugValue);
|
||||
|
||||
std::list<controlSwitches<int> *> curList = runTimeDebugSwitchValues[key];
|
||||
|
||||
// Modify all entries for this key
|
||||
forAllIter(std::list<controlSwitches<int> *>, curList, iterI)
|
||||
*(*iterI) = newDebugValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Usage of non-existent DebugSwitches: best to abort right away
|
||||
SortableList<Foam::word> sortedValidKeys(runTimeDebugSwitchValues.size());
|
||||
|
||||
int i=0;
|
||||
forAllIter(ListDebugControlSwitches, runTimeDebugSwitchValues, iterI)
|
||||
{
|
||||
sortedValidKeys[i++] = iterI->first;
|
||||
}
|
||||
sortedValidKeys.sort();
|
||||
|
||||
FatalError
|
||||
<< "Usage of non-existent DebugSwitches: " << key
|
||||
<< endl << endl
|
||||
<< "Valid entries for this application are: " << sortedValidKeys
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "No DebugSwitches values are available for this application."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INFOSWITCHES:
|
||||
{
|
||||
if (infoSwitchValues_)
|
||||
{
|
||||
ListInfoControlSwitches& runTimeInfoSwitchValues = *infoSwitchValues_;
|
||||
label oldInfoValue;
|
||||
label newInfoValue;
|
||||
isskv >> newInfoValue;
|
||||
|
||||
if(Foam::debug::infoSwitches().readIfPresent(key, oldInfoValue))
|
||||
{
|
||||
Info << endl
|
||||
<< "Warning: Modification of InfoSwitch: " << key << endl
|
||||
<< " Old value: " << oldInfoValue << endl
|
||||
<< " New value: " << newInfoValue << endl
|
||||
<< endl;
|
||||
|
||||
Foam::debug::infoSwitches().set(key, newInfoValue);
|
||||
|
||||
std::list<controlSwitches<int> *> curList = runTimeInfoSwitchValues[key];
|
||||
|
||||
// Modify all entries for this key
|
||||
forAllIter(std::list<controlSwitches<int> *>, curList, iterI)
|
||||
*(*iterI) = newInfoValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Usage of non-existent InfoSwitches: best to abort right away
|
||||
SortableList<Foam::word> sortedValidKeys(runTimeInfoSwitchValues.size());
|
||||
|
||||
int i=0;
|
||||
forAllIter(ListInfoControlSwitches, runTimeInfoSwitchValues, iterI)
|
||||
{
|
||||
sortedValidKeys[i++] = iterI->first;
|
||||
}
|
||||
sortedValidKeys.sort();
|
||||
|
||||
FatalError
|
||||
<< "Usage of non-existent InfoSwitches: " << key
|
||||
<< endl << endl
|
||||
<< "Valid entries for this application are: " << sortedValidKeys
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "No InfoSwitches values are available for this application."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OPTIMISATIONSWITCHES:
|
||||
{
|
||||
if (optimisationSwitchValues_)
|
||||
{
|
||||
ListOptimisationControlSwitches& runTimeOptimisationSwitchValues = *optimisationSwitchValues_;
|
||||
label oldOptimisationValue;
|
||||
label newOptimisationValue;
|
||||
isskv >> newOptimisationValue;
|
||||
|
||||
if(Foam::debug::optimisationSwitches().readIfPresent(key, oldOptimisationValue))
|
||||
{
|
||||
Info << endl
|
||||
<< "Warning: Modification of OptimisationSwitch value: " << key << endl
|
||||
<< " Old value: " << oldOptimisationValue << endl
|
||||
<< " New value: " << newOptimisationValue << endl
|
||||
<< endl;
|
||||
|
||||
Foam::debug::optimisationSwitches().set(key, newOptimisationValue);
|
||||
|
||||
std::list<controlSwitches<int> *> curList = runTimeOptimisationSwitchValues[key];
|
||||
|
||||
// Modify all entries for this key
|
||||
forAllIter(std::list<controlSwitches<int> *>, curList, iterI)
|
||||
*(*iterI) = newOptimisationValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Usage of non-existent OptimisationSwitches: best to abort right away
|
||||
SortableList<Foam::word> sortedValidKeys(runTimeOptimisationSwitchValues.size());
|
||||
|
||||
int i=0;
|
||||
forAllIter(ListOptimisationControlSwitches, runTimeOptimisationSwitchValues, iterI)
|
||||
{
|
||||
sortedValidKeys[i++] = iterI->first;
|
||||
}
|
||||
sortedValidKeys.sort();
|
||||
|
||||
FatalError
|
||||
<< "Usage of non-existent OptimisationSwitches value: " << key
|
||||
<< endl << endl
|
||||
<< "Valid entries for this application are: " << sortedValidKeys
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "No OptimisationSwitches values are available for this application."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TOLERANCES:
|
||||
{
|
||||
if (tolerancesSwitchValues_)
|
||||
{
|
||||
ListTolerancesControlSwitches& runTimeTolerancesSwitchValues = *tolerancesSwitchValues_;
|
||||
scalar oldTolerancesValue;
|
||||
scalar newTolerancesValue;
|
||||
isskv >> newTolerancesValue;
|
||||
|
||||
if(Foam::debug::tolerances().readIfPresent(key, oldTolerancesValue))
|
||||
{
|
||||
Info << endl
|
||||
<< "Warning: Modification of Tolerance value: " << key << endl
|
||||
<< " Old value: " << oldTolerancesValue << endl
|
||||
<< " New value: " << newTolerancesValue << endl
|
||||
<< endl;
|
||||
|
||||
Foam::debug::tolerances().set(key, newTolerancesValue);
|
||||
|
||||
std::list<controlSwitches<scalar> *> curList = runTimeTolerancesSwitchValues[key];
|
||||
|
||||
// Modify all entries for this key
|
||||
forAllIter(std::list<controlSwitches<scalar> *>, curList, iterI)
|
||||
*(*iterI) = newTolerancesValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Usage of non-existent Tolerances: best to abort right away
|
||||
SortableList<Foam::word> sortedValidKeys(runTimeTolerancesSwitchValues.size());
|
||||
|
||||
int i=0;
|
||||
forAllIter(ListTolerancesControlSwitches, runTimeTolerancesSwitchValues, iterI)
|
||||
{
|
||||
sortedValidKeys[i++] = iterI->first;
|
||||
}
|
||||
sortedValidKeys.sort();
|
||||
|
||||
FatalError
|
||||
<< "Usage of non-existent Tolerances value: " << key
|
||||
<< endl << endl
|
||||
<< "Valid entries for this application are: " << sortedValidKeys
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "No Tolerances values are available for this application."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DIMENSIONEDCONSTANTS:
|
||||
{
|
||||
if (constantsSwitchValues_)
|
||||
{
|
||||
ListConstantsControlSwitches& runTimeConstantsSwitchValues = *constantsSwitchValues_;
|
||||
scalar oldDimensionedConstantsValue;
|
||||
scalar newDimensionedConstantsValue;
|
||||
isskv >> newDimensionedConstantsValue;
|
||||
|
||||
if(Foam::dimensionedConstants().readIfPresent(key, oldDimensionedConstantsValue))
|
||||
{
|
||||
Info << endl
|
||||
<< "Warning: Modification of DimensionedConstant: " << key << endl
|
||||
<< " Old value: " << oldDimensionedConstantsValue << endl
|
||||
<< " New value: " << newDimensionedConstantsValue << endl
|
||||
<< endl;
|
||||
|
||||
Foam::dimensionedConstants().set(key, newDimensionedConstantsValue);
|
||||
|
||||
std::list<controlSwitches<scalar> *> curList = runTimeConstantsSwitchValues[key];
|
||||
|
||||
// Modify all entries for this key
|
||||
forAllIter(std::list<controlSwitches<scalar> *>, curList, iterI)
|
||||
*(*iterI) = newDimensionedConstantsValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Usage of non-existent DimensionedConstants: best to abort right away
|
||||
SortableList<Foam::word> sortedValidKeys(runTimeConstantsSwitchValues.size());
|
||||
|
||||
int i=0;
|
||||
forAllIter(ListConstantsControlSwitches, runTimeConstantsSwitchValues, iterI)
|
||||
{
|
||||
sortedValidKeys[i++] = iterI->first;
|
||||
}
|
||||
sortedValidKeys.sort();
|
||||
|
||||
FatalError
|
||||
<< "Usage of non-existent DimensionedConstants: " << key
|
||||
<< endl << endl
|
||||
<< "Valid entries for this application are: " << sortedValidKeys
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError
|
||||
<< "No DimensionedConstants values are available for this application."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -47,6 +47,16 @@ class dictionary;
|
|||
|
||||
namespace debug
|
||||
{
|
||||
//- Define central control dictionary switchSet
|
||||
enum globalControlDictSwitchSet
|
||||
{
|
||||
DEBUGSWITCHES,
|
||||
INFOSWITCHES,
|
||||
OPTIMISATIONSWITCHES,
|
||||
TOLERANCES,
|
||||
DIMENSIONEDCONSTANTS
|
||||
};
|
||||
|
||||
//- The central control dictionary.
|
||||
// Located in $WM_PROJECT_DIR/etc
|
||||
// @sa Foam::findEtcFile()
|
||||
|
@ -64,21 +74,35 @@ 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);
|
||||
|
||||
//- 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);
|
||||
|
||||
//- Lookup tolerances switch or add default value.
|
||||
double constantsFromDict(const char* name, const double defaultValue = 0);
|
||||
|
||||
//- Internal function to lookup a sub-dictionary from controlDict.
|
||||
dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
|
||||
|
||||
//- Update central controlDict variables
|
||||
// supported keyValues format: key1=value1,key2=value2
|
||||
void updateCentralDictVars
|
||||
(
|
||||
globalControlDictSwitchSet centralDictSwitchSetName,
|
||||
Foam::string keyValues
|
||||
);
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ SourceFiles
|
|||
#include "intersection.H"
|
||||
#include "point2D.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -188,13 +189,13 @@ class GGIInterpolation
|
|||
// Private static data
|
||||
|
||||
//- Facet area error tolerance
|
||||
static const scalar areaErrorTol_;
|
||||
static const debug::tolerancesSwitch areaErrorTol_;
|
||||
|
||||
//- Facet normal featureCos criteria
|
||||
static const scalar featureCosTol_;
|
||||
static const debug::tolerancesSwitch featureCosTol_;
|
||||
|
||||
//- Facet bound box extension factor
|
||||
static const scalar faceBoundBoxExtendSpanFraction_;
|
||||
static const debug::tolerancesSwitch faceBoundBoxExtendSpanFraction_;
|
||||
|
||||
//- The next 3 attributes are parameters controlling the creation
|
||||
// of an octree search engine for the GGI facets neighbourhood
|
||||
|
@ -218,13 +219,13 @@ class GGIInterpolation
|
|||
//
|
||||
|
||||
//- Octree search: minNlevel parameter for octree constructor
|
||||
static const label octreeSearchMinNLevel_;
|
||||
static const Foam::debug::optimisationSwitch octreeSearchMinNLevel_;
|
||||
|
||||
//- Octree search: maxLeafRatio parameter for octree constructor
|
||||
static const scalar octreeSearchMaxLeafRatio_;
|
||||
static const Foam::debug::optimisationSwitch octreeSearchMaxLeafRatio_;
|
||||
|
||||
//- Octree search: maxShapeRatio parameter for octree constructor
|
||||
static const scalar octreeSearchMaxShapeRatio_;
|
||||
static const Foam::debug::optimisationSwitch octreeSearchMaxShapeRatio_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
|
|
@ -184,8 +184,8 @@ GGIInterpolation<MasterPatch, SlavePatch>::polygonIntersection
|
|||
|
||||
if
|
||||
(
|
||||
mag(intersectionArea/clippingArea) < areaErrorTol_
|
||||
|| mag(intersectionArea/subjectArea) < areaErrorTol_
|
||||
mag(intersectionArea/clippingArea) < areaErrorTol_()
|
||||
|| mag(intersectionArea/subjectArea) < areaErrorTol_()
|
||||
)
|
||||
{
|
||||
WarningIn
|
||||
|
@ -232,7 +232,7 @@ GGIInterpolation<MasterPatch, SlavePatch>::isVertexInsidePolygon
|
|||
// We use distErrorTol_ to evaluate a distance factor called
|
||||
// epsilon. That epsilon factor will be used to detect if a point
|
||||
// is on a vertex or an edge.
|
||||
const scalar distErrorTol = sqrt(areaErrorTol_);
|
||||
const scalar distErrorTol = sqrt(areaErrorTol_());
|
||||
|
||||
HormannAgathos pip(clippingPolygon, distErrorTol);
|
||||
|
||||
|
@ -303,7 +303,7 @@ GGIInterpolation<MasterPatch, SlavePatch>::clipPolygon2DSutherlandHodgman
|
|||
(
|
||||
clippingPolygon,
|
||||
subjectPolygon,
|
||||
sqrt(areaErrorTol_) // = distErrorTol
|
||||
sqrt(areaErrorTol_()) // = distErrorTol
|
||||
).evaluate();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,31 +44,35 @@ namespace Foam
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
const scalar
|
||||
const Foam::debug::tolerancesSwitch
|
||||
GGIInterpolation<MasterPatch, SlavePatch>::faceBoundBoxExtendSpanFraction_
|
||||
(
|
||||
debug::tolerances("GGIFaceBoundBoxExtendSpanFraction", 1.0e-2)
|
||||
"GGIFaceBoundBoxExtendSpanFraction",
|
||||
1.0e-2
|
||||
);
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
const label
|
||||
const Foam::debug::optimisationSwitch
|
||||
GGIInterpolation<MasterPatch, SlavePatch>::octreeSearchMinNLevel_
|
||||
(
|
||||
debug::optimisationSwitch("GGIOctreeSearchMinNLevel", 3)
|
||||
"GGIOctreeSearchMinNLevel",
|
||||
3
|
||||
);
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
const scalar
|
||||
const Foam::debug::optimisationSwitch
|
||||
GGIInterpolation<MasterPatch, SlavePatch>::octreeSearchMaxLeafRatio_
|
||||
(
|
||||
debug::optimisationSwitch("GGIOctreeSearchMaxLeafRatio", 3)
|
||||
"GGIOctreeSearchMaxLeafRatio",
|
||||
3
|
||||
);
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
const scalar
|
||||
const Foam::debug::optimisationSwitch
|
||||
GGIInterpolation<MasterPatch, SlavePatch>::octreeSearchMaxShapeRatio_
|
||||
(
|
||||
debug::optimisationSwitch("GGIOctreeSearchMaxShapeRatio", 1)
|
||||
"GGIOctreeSearchMaxShapeRatio",
|
||||
1
|
||||
);
|
||||
|
||||
|
||||
|
@ -397,7 +401,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::findNeighboursAABB
|
|||
scalar featureCos =
|
||||
masterFaceNormals[faceMi] & slaveNormals[faceSi];
|
||||
|
||||
if (mag(featureCos) > featureCosTol_)
|
||||
if (mag(featureCos) > featureCosTol_())
|
||||
{
|
||||
candidateMasterNeighbors[faceMi].append(faceSi);
|
||||
}
|
||||
|
@ -440,7 +444,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::findNeighboursBBOctree
|
|||
treeBoundBox bbFaceMaster(facePoints);
|
||||
|
||||
lmasterFaceBB[faceMi] =
|
||||
bbFaceMaster.extend(faceBoundBoxExtendSpanFraction_);
|
||||
bbFaceMaster.extend(faceBoundBoxExtendSpanFraction_());
|
||||
}
|
||||
|
||||
// Initialize the list of slave patch faces bounding box
|
||||
|
@ -484,7 +488,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::findNeighboursBBOctree
|
|||
treeBoundBox bbFaceSlave(facePoints);
|
||||
|
||||
lslaveFaceBB[faceSi] =
|
||||
bbFaceSlave.extend(faceBoundBoxExtendSpanFraction_);
|
||||
bbFaceSlave.extend(faceBoundBoxExtendSpanFraction_());
|
||||
}
|
||||
|
||||
// Create the slave octreeData, using the boundBox flavor
|
||||
|
@ -499,9 +503,9 @@ void GGIInterpolation<MasterPatch, SlavePatch>::findNeighboursBBOctree
|
|||
(
|
||||
slaveOverallBB, // overall search domain
|
||||
slaveDataBB,
|
||||
octreeSearchMinNLevel_, // min number of levels
|
||||
octreeSearchMaxLeafRatio_, // max avg. size of leaves
|
||||
octreeSearchMaxShapeRatio_ // max avg. duplicity.
|
||||
octreeSearchMinNLevel_(), // min number of levels
|
||||
octreeSearchMaxLeafRatio_(), // max avg. size of leaves
|
||||
octreeSearchMaxShapeRatio_() // max avg. duplicity.
|
||||
);
|
||||
|
||||
const vectorField& masterFaceNormals = masterPatch_.faceNormals();
|
||||
|
@ -538,7 +542,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::findNeighboursBBOctree
|
|||
scalar featureCos =
|
||||
masterFaceNormals[faceMi] & slaveNormals[faceSi];
|
||||
|
||||
if (mag(featureCos) > featureCosTol_)
|
||||
if (mag(featureCos) > featureCosTol_())
|
||||
{
|
||||
candidateMasterNeighbors[faceMi].append(faceSi);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ Modification by:
|
|||
#include "objectHit.H"
|
||||
#include "boolList.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
#include "dimensionedConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -48,19 +47,21 @@ namespace Foam
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
const scalar GGIInterpolation<MasterPatch, SlavePatch>::areaErrorTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
GGIInterpolation<MasterPatch, SlavePatch>::areaErrorTol_
|
||||
(
|
||||
debug::tolerances("GGIAreaErrorTol", 1.0e-8)
|
||||
"GGIAreaErrorTol",
|
||||
1.0e-8
|
||||
);
|
||||
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
const scalar GGIInterpolation<MasterPatch, SlavePatch>::featureCosTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
GGIInterpolation<MasterPatch, SlavePatch>::featureCosTol_
|
||||
(
|
||||
debug::tolerances("GGIFeatureCosTol", 0.8)
|
||||
"GGIFeatureCosTol",
|
||||
0.8
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class MasterPatch, class SlavePatch>
|
||||
|
@ -354,7 +355,7 @@ void GGIInterpolation<MasterPatch, SlavePatch>::calcAddressing() const
|
|||
(
|
||||
masterPointsInUV,
|
||||
neighbPointsInUV,
|
||||
sqrt(areaErrorTol_) // distErrorTol
|
||||
sqrt(areaErrorTol_()) // distErrorTol
|
||||
)
|
||||
)
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcPointAddressing() const
|
|||
// Grab hit point
|
||||
hitPoint = curHit.hitPoint();
|
||||
}
|
||||
else if (projectionTol_ > SMALL)
|
||||
else if (projectionTol_() > SMALL)
|
||||
{
|
||||
// Check for a near miss
|
||||
pointHit ph =
|
||||
|
@ -162,7 +162,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcPointAddressing() const
|
|||
);
|
||||
}
|
||||
|
||||
if (dist < minEdgeLength*projectionTol_)
|
||||
if (dist < minEdgeLength*projectionTol_())
|
||||
{
|
||||
// This point is being corrected
|
||||
doWeights = true;
|
||||
|
@ -304,7 +304,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcFaceAddressing() const
|
|||
|
||||
if
|
||||
(
|
||||
m < directHitTol_ // Direct hit
|
||||
m < directHitTol_() // Direct hit
|
||||
|| neighbours.empty()
|
||||
)
|
||||
{
|
||||
|
|
|
@ -38,19 +38,21 @@ namespace Foam
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class FromPatch, class ToPatch>
|
||||
scalar PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol_
|
||||
(
|
||||
debug::tolerances("patchToPatchDirectHit", 1e-5)
|
||||
"patchToPatchDirectHit",
|
||||
1e-5
|
||||
);
|
||||
|
||||
|
||||
template<class FromPatch, class ToPatch>
|
||||
scalar PatchToPatchInterpolation<FromPatch, ToPatch>::projectionTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
PatchToPatchInterpolation<FromPatch, ToPatch>::projectionTol_
|
||||
(
|
||||
debug::tolerances("patchToPatchProjectionTol", 0.05)
|
||||
"patchToPatchProjectionTol",
|
||||
0.05
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class FromPatch, class ToPatch>
|
||||
|
@ -109,7 +111,8 @@ PatchToPatchInterpolation<FromPatch, ToPatch>::PatchToPatchInterpolation
|
|||
faceAddressingPtr_(NULL),
|
||||
faceWeightsPtr_(NULL),
|
||||
faceDistancePtr_(NULL)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Construct as copy
|
||||
|
|
|
@ -45,6 +45,7 @@ SourceFiles
|
|||
#include "FieldFields.H"
|
||||
#include "faceList.H"
|
||||
#include "intersection.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -86,10 +87,10 @@ class PatchToPatchInterpolation
|
|||
|
||||
//- Relative merge tolerance for projected points missing the target
|
||||
// Expressed as the fraction of min involved edge size
|
||||
static scalar projectionTol_;
|
||||
static const Foam::debug::tolerancesSwitch projectionTol_;
|
||||
|
||||
//- Direct hit tolerance
|
||||
static scalar directHitTol_;
|
||||
static const Foam::debug::tolerancesSwitch directHitTol_;
|
||||
|
||||
|
||||
// Point addressing
|
||||
|
|
|
@ -38,9 +38,11 @@ Description
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::label Foam::BlockLduMatrix<Type>::fixFillIn
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::BlockLduMatrix<Type>::fixFillIn
|
||||
(
|
||||
debug::optimisationSwitch("matrixConstraintFillIn", 4)
|
||||
"matrixConstraintFillIn",
|
||||
4
|
||||
);
|
||||
|
||||
|
||||
|
@ -56,7 +58,7 @@ Foam::BlockLduMatrix<Type>::BlockLduMatrix(const lduMesh& ldu)
|
|||
interfaces_(ldu.interfaces().size()),
|
||||
coupleUpper_(ldu.lduAddr().nPatches()),
|
||||
coupleLower_(ldu.lduAddr().nPatches()),
|
||||
fixedEqns_(ldu.lduAddr().size()/fixFillIn)
|
||||
fixedEqns_(ldu.lduAddr().size()/fixFillIn())
|
||||
{
|
||||
const lduAddressing& addr = ldu.lduAddr();
|
||||
|
||||
|
@ -65,6 +67,7 @@ Foam::BlockLduMatrix<Type>::BlockLduMatrix(const lduMesh& ldu)
|
|||
coupleUpper_.set(i, new CoeffField<Type>(addr.patchAddr(i).size()));
|
||||
coupleLower_.set(i, new CoeffField<Type>(addr.patchAddr(i).size()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ SourceFiles
|
|||
#include "HashSet.H"
|
||||
#include "BlockLduInterfaceFieldPtrsList.H"
|
||||
#include "Map.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -135,7 +136,7 @@ private:
|
|||
|
||||
//- Matrix constraint fill-in
|
||||
// Equals to the estimated fraction of fixed nodes in the matrix
|
||||
static const label fixFillIn;
|
||||
static const Foam::debug::optimisationSwitch fixFillIn;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
|
|
@ -33,7 +33,7 @@ License
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
int Foam::solution::debug(::Foam::debug::debugSwitch("solution", 0));
|
||||
int Foam::solution::debug(::Foam::debug::debugSwitchFromDict("solution", 0));
|
||||
|
||||
// List of sub-dictionaries to rewrite
|
||||
//! @cond localScope
|
||||
|
|
|
@ -30,7 +30,7 @@ License
|
|||
|
||||
const char* const Foam::cell::typeName = "cell";
|
||||
|
||||
int Foam::cell::debug(debug::debugSwitch("cell", 0));
|
||||
int Foam::cell::debug(debug::debugSwitchFromDict("cell", 0));
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -42,9 +42,11 @@ License
|
|||
defineTypeNameAndDebug(Foam::globalMeshData, 0);
|
||||
|
||||
// Geometric matching tolerance. Factor of mesh bounding box.
|
||||
const Foam::scalar Foam::globalMeshData::matchTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::globalMeshData::matchTol_
|
||||
(
|
||||
debug::tolerances("globalMeshDataMatchTol", 1e-8)
|
||||
"globalMeshDataMatchTol",
|
||||
1e-8
|
||||
);
|
||||
|
||||
|
||||
|
@ -661,7 +663,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
|
|||
combineReduce(sharedPoints, plusEqOp<pointField>());
|
||||
|
||||
// Merge tolerance
|
||||
scalar tolDim = matchTol_*bb_.mag();
|
||||
scalar tolDim = matchTol_()*bb_.mag();
|
||||
|
||||
// And see how many are unique
|
||||
labelList pMap;
|
||||
|
@ -729,7 +731,7 @@ void Foam::globalMeshData::updateMesh()
|
|||
// Note: boundBox does reduce
|
||||
bb_ = boundBox(mesh_.points());
|
||||
|
||||
scalar tolDim = matchTol_*bb_.mag();
|
||||
scalar tolDim = matchTol_()*bb_.mag();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
|
|
@ -75,6 +75,7 @@ SourceFiles
|
|||
#include "Switch.H"
|
||||
#include "processorTopology.H"
|
||||
#include "labelPair.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -230,7 +231,7 @@ public:
|
|||
// Static data members
|
||||
|
||||
//- Geomtric tolerance (fraction of bounding box)
|
||||
static const Foam::scalar matchTol_;
|
||||
static const Foam::debug::tolerancesSwitch matchTol_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -82,7 +82,7 @@ protected:
|
|||
const vectorField& nf,
|
||||
const vectorField& nr,
|
||||
const scalarField& smallDist,
|
||||
const scalar absTol = matchTol_
|
||||
const scalar absTol = matchTol_()
|
||||
) const;
|
||||
|
||||
//- Initialise the calculation of the patch addressing
|
||||
|
|
|
@ -165,7 +165,7 @@ void Foam::cyclicPolyPatch::calcTransforms() const
|
|||
else if
|
||||
(
|
||||
mag(magSf - nbrMagSf)/avSf
|
||||
> polyPatch::matchTol_
|
||||
> polyPatch::matchTol_()
|
||||
)
|
||||
{
|
||||
// Error in area matching. Find largest error
|
||||
|
@ -280,7 +280,7 @@ void Foam::cyclicPolyPatch::calcTransforms() const
|
|||
}
|
||||
|
||||
// Check for error in face matching
|
||||
if (maxMatchError > polyPatch::matchTol_)
|
||||
if (maxMatchError > polyPatch::matchTol_())
|
||||
{
|
||||
label nbrFacei = errorFace + size()/2;
|
||||
scalar magSf = mag(half0Normals[errorFace]);
|
||||
|
@ -298,7 +298,7 @@ void Foam::cyclicPolyPatch::calcTransforms() const
|
|||
<< "patch:" << name()
|
||||
<< " my area:" << magSf
|
||||
<< " neighbour area:" << nbrMagSf
|
||||
<< " matching tolerance:" << polyPatch::matchTol_
|
||||
<< " matching tolerance:" << polyPatch::matchTol_()
|
||||
<< endl
|
||||
<< "Mesh face:" << start() + errorFace
|
||||
<< " vertices:"
|
||||
|
@ -384,7 +384,7 @@ void Foam::cyclicPolyPatch::calcTransforms() const
|
|||
|
||||
// Check max distance between face centre and
|
||||
// transformed face centre
|
||||
if (maxRelDistance > sqrt(polyPatch::matchTol_))
|
||||
if (maxRelDistance > sqrt(polyPatch::matchTol_()))
|
||||
{
|
||||
SeriousErrorIn
|
||||
(
|
||||
|
@ -633,7 +633,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
|
|||
}
|
||||
}
|
||||
|
||||
if (mag(n0 & n1) < 1 - polyPatch::matchTol_)
|
||||
if (mag(n0 & n1) < 1 - polyPatch::matchTol_())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
|
|
@ -209,7 +209,7 @@ void Foam::processorPolyPatch::calcGeometry()
|
|||
faceNormals[facei] = point(1, 0, 0);
|
||||
nbrFaceNormals[facei] = faceNormals[facei];
|
||||
}
|
||||
else if (mag(magSf - nbrMagSf)/avSf > polyPatch::matchTol_)
|
||||
else if (mag(magSf - nbrMagSf)/avSf > polyPatch::matchTol_())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
@ -220,7 +220,7 @@ void Foam::processorPolyPatch::calcGeometry()
|
|||
<< "patch: " << name()
|
||||
<< " my area: " << magSf
|
||||
<< " neighbour area: " << nbrMagSf
|
||||
<< " matching tolerance: " << polyPatch::matchTol_
|
||||
<< " matching tolerance: " << polyPatch::matchTol_()
|
||||
<< endl
|
||||
<< "Mesh face: " << start()+facei
|
||||
<< " vertices: "
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Foam
|
|||
|
||||
int polyPatch::disallowGenericPolyPatch
|
||||
(
|
||||
debug::debugSwitch("disallowGenericPolyPatch", 0)
|
||||
debug::debugSwitchFromDict("disallowGenericPolyPatch", 0)
|
||||
);
|
||||
|
||||
defineRunTimeSelectionTable(polyPatch, word);
|
||||
|
@ -52,12 +52,13 @@ namespace Foam
|
|||
}
|
||||
|
||||
|
||||
const Foam::scalar Foam::polyPatch::matchTol_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::polyPatch::matchTol_
|
||||
(
|
||||
debug::tolerances("patchFaceMatchTol", 1e-3)
|
||||
"patchFaceMatchTol",
|
||||
1e-3
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::polyPatch::movePoints(const pointField& p)
|
||||
|
@ -253,7 +254,7 @@ Foam::scalarField Foam::polyPatch::calcFaceTol
|
|||
maxLen = max(maxLen, mag(points[f[fp]] - cc));
|
||||
}
|
||||
|
||||
tols[faceI] = matchTol_*maxLen;
|
||||
tols[faceI] = matchTol_()*maxLen;
|
||||
}
|
||||
|
||||
return tols;
|
||||
|
|
|
@ -51,6 +51,7 @@ SourceFiles
|
|||
#include "primitivePatch.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -230,8 +231,7 @@ public:
|
|||
//- Relative tolerance (for geometric matching)
|
||||
// Calculated as a factor of maximum edge length per face.
|
||||
// HJ, 21/Dec/2006
|
||||
static const scalar matchTol_;
|
||||
|
||||
static const Foam::debug::tolerancesSwitch matchTol_;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
|
|
@ -24,6 +24,7 @@ License
|
|||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Map.H"
|
||||
#include "debug.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -34,11 +35,12 @@ template
|
|||
class PointField,
|
||||
class PointType
|
||||
>
|
||||
const bool
|
||||
const Foam::debug::optimisationSwitch
|
||||
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
|
||||
nSquaredProjection_
|
||||
(
|
||||
debug::optimisationSwitch("nSquaredProjection", 0) > 0
|
||||
"nSquaredProjection",
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
|
@ -77,7 +79,8 @@ PrimitivePatch
|
|||
faceCentresPtr_(NULL),
|
||||
faceNormalsPtr_(NULL),
|
||||
pointNormalsPtr_(NULL)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
|
|
|
@ -57,6 +57,7 @@ SourceFiles
|
|||
#include "point.H"
|
||||
#include "intersection.H"
|
||||
#include "HashSet.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -177,7 +178,7 @@ private:
|
|||
|
||||
// Static Private Data
|
||||
|
||||
static const bool nSquaredProjection_;
|
||||
static const Foam::debug::optimisationSwitch nSquaredProjection_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
|
|
@ -399,7 +399,7 @@ projectFaceCentres
|
|||
|
||||
// Force the full search for the first point to ensure good
|
||||
// starting face
|
||||
if (faceI == 0 || nSquaredProjection_)
|
||||
if (faceI == 0 || nSquaredProjection_() > 0)
|
||||
{
|
||||
doNSquaredSearch = true;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ SourceFiles
|
|||
#include "HashSet.H"
|
||||
#include "Map.H"
|
||||
#include "EdgeMap.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -321,22 +322,22 @@ public:
|
|||
|
||||
//- Cell closedness warning threshold
|
||||
// set as the fraction of un-closed area to closed area
|
||||
static scalar closedThreshold_;
|
||||
static const Foam::debug::tolerancesSwitch closedThreshold_;
|
||||
|
||||
//- Aspect ratio warning threshold
|
||||
static scalar aspectThreshold_;
|
||||
static const Foam::debug::tolerancesSwitch aspectThreshold_;
|
||||
|
||||
//- Non-orthogonality warning threshold in deg
|
||||
static scalar nonOrthThreshold_;
|
||||
static Foam::debug::tolerancesSwitch nonOrthThreshold_;
|
||||
|
||||
//- Skewness warning threshold
|
||||
static scalar skewThreshold_;
|
||||
static const Foam::debug::tolerancesSwitch skewThreshold_;
|
||||
|
||||
//- Face angle threshold
|
||||
static scalar faceAngleThreshold_;
|
||||
static Foam::debug::tolerancesSwitch faceAngleThreshold_;
|
||||
|
||||
//- Face flatness threshold
|
||||
static scalar faceFlatnessThreshold_;
|
||||
static const Foam::debug::tolerancesSwitch faceFlatnessThreshold_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -31,35 +31,46 @@ License
|
|||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::primitiveMesh::closedThreshold_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::primitiveMesh::closedThreshold_
|
||||
(
|
||||
debug::tolerances("primitiveMeshClosedThreshold", 1e-6)
|
||||
"primitiveMeshClosedThreshold",
|
||||
1e-6
|
||||
);
|
||||
|
||||
Foam::scalar Foam::primitiveMesh::aspectThreshold_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::primitiveMesh::aspectThreshold_
|
||||
(
|
||||
debug::tolerances("primitiveMeshAspectThreshold", 1000)
|
||||
"primitiveMeshAspectThreshold",
|
||||
1000
|
||||
);
|
||||
|
||||
Foam::scalar Foam::primitiveMesh::nonOrthThreshold_ // deg
|
||||
Foam::debug::tolerancesSwitch
|
||||
Foam::primitiveMesh::nonOrthThreshold_ // deg
|
||||
(
|
||||
debug::tolerances("primitiveMeshNonOrthThreshold", 70)
|
||||
"primitiveMeshNonOrthThreshold",
|
||||
70
|
||||
);
|
||||
|
||||
Foam::scalar Foam::primitiveMesh::skewThreshold_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::primitiveMesh::skewThreshold_
|
||||
(
|
||||
debug::tolerances("primitiveMeshSkewThreshold", 4)
|
||||
"primitiveMeshSkewThreshold",
|
||||
4
|
||||
);
|
||||
|
||||
Foam::scalar Foam::primitiveMesh::faceAngleThreshold_
|
||||
Foam::debug::tolerancesSwitch
|
||||
Foam::primitiveMesh::faceAngleThreshold_
|
||||
(
|
||||
debug::tolerances("primitiveMeshFaceAngleThreshold", 10)
|
||||
"primitiveMeshFaceAngleThreshold",
|
||||
10
|
||||
);
|
||||
|
||||
Foam::scalar Foam::primitiveMesh::faceFlatnessThreshold_
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::primitiveMesh::faceFlatnessThreshold_
|
||||
(
|
||||
debug::tolerances("primitiveMeshFaceFlatnessThreshold", 0.8)
|
||||
"primitiveMeshFaceFlatnessThreshold",
|
||||
0.8
|
||||
);
|
||||
|
||||
|
||||
|
@ -93,12 +104,12 @@ bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const
|
|||
|
||||
vector openness = sumClosed/(sumMagClosedBoundary + VSMALL);
|
||||
|
||||
if (cmptMax(cmptMag(openness)) > closedThreshold_)
|
||||
if (cmptMax(cmptMag(openness)) > closedThreshold_())
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " ***Boundary openness " << openness
|
||||
<< " Threshold = " << closedThreshold_
|
||||
<< " Threshold = " << closedThreshold_()
|
||||
<< " possible hole in boundary description."
|
||||
<< endl;
|
||||
}
|
||||
|
@ -110,7 +121,7 @@ bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const
|
|||
if (debug || report)
|
||||
{
|
||||
Info<< " Boundary openness " << openness
|
||||
<< " Threshold = " << closedThreshold_
|
||||
<< " Threshold = " << closedThreshold_()
|
||||
<< " OK."
|
||||
<< endl;
|
||||
}
|
||||
|
@ -245,7 +256,7 @@ bool Foam::primitiveMesh::checkClosedCells
|
|||
|
||||
maxOpennessCell = max(maxOpennessCell, maxOpenness);
|
||||
|
||||
if (maxOpenness > closedThreshold_)
|
||||
if (maxOpenness > closedThreshold_())
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
|
@ -267,7 +278,7 @@ bool Foam::primitiveMesh::checkClosedCells
|
|||
|
||||
maxAspectRatio = max(maxAspectRatio, aspectRatio);
|
||||
|
||||
if (aspectRatio > aspectThreshold_)
|
||||
if (aspectRatio > aspectThreshold_())
|
||||
{
|
||||
if (aspectSetPtr)
|
||||
{
|
||||
|
@ -291,7 +302,7 @@ bool Foam::primitiveMesh::checkClosedCells
|
|||
{
|
||||
Info<< " ***Open cells found, max cell openness: "
|
||||
<< maxOpennessCell << ", number of open cells " << nOpen
|
||||
<< " Threshold = " << closedThreshold_
|
||||
<< " Threshold = " << closedThreshold_()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -305,7 +316,7 @@ bool Foam::primitiveMesh::checkClosedCells
|
|||
Info<< " ***High aspect ratio cells found, Max aspect ratio: "
|
||||
<< maxAspectRatio
|
||||
<< ", number of cells " << nAspect
|
||||
<< " Threshold = " << aspectThreshold_
|
||||
<< " Threshold = " << aspectThreshold_()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -471,7 +482,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
|||
|
||||
// Severe nonorthogonality threshold
|
||||
const scalar severeNonorthogonalityThreshold =
|
||||
::cos(nonOrthThreshold_/180.0*mathematicalConstant::pi);
|
||||
::cos(nonOrthThreshold_()/180.0*mathematicalConstant::pi);
|
||||
|
||||
scalar minDDotS = GREAT;
|
||||
|
||||
|
@ -536,7 +547,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
|||
<< ::acos(minDDotS)/mathematicalConstant::pi*180.0
|
||||
<< " average: " <<
|
||||
::acos(sumDDotS/neiSize)/mathematicalConstant::pi*180.0
|
||||
<< " Threshold = " << nonOrthThreshold_
|
||||
<< " Threshold = " << nonOrthThreshold_()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
@ -707,7 +718,7 @@ bool Foam::primitiveMesh::checkFaceSkewness
|
|||
|
||||
// Check if the skewness vector is greater than the PN vector.
|
||||
// This does not cause trouble but is a good indication of a poor mesh.
|
||||
if (skewness > skewThreshold_)
|
||||
if (skewness > skewThreshold_())
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
|
@ -755,7 +766,7 @@ bool Foam::primitiveMesh::checkFaceSkewness
|
|||
|
||||
// Check if the skewness vector is greater than the PN vector.
|
||||
// This does not cause trouble but is a good indication of a poor mesh.
|
||||
if (skewness > skewThreshold_)
|
||||
if (skewness > skewThreshold_())
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
|
@ -781,7 +792,7 @@ bool Foam::primitiveMesh::checkFaceSkewness
|
|||
{
|
||||
Info<< " ***Max skewness = " << maxSkew
|
||||
<< ", " << nWarnSkew << " highly skew faces detected"
|
||||
<< " Threshold = " << skewThreshold_
|
||||
<< " Threshold = " << skewThreshold_()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -890,18 +901,18 @@ bool Foam::primitiveMesh::checkFaceAngles
|
|||
<< "checking face angles" << endl;
|
||||
}
|
||||
|
||||
if (faceAngleThreshold_ < -SMALL || faceAngleThreshold_ > 180 + SMALL)
|
||||
if (faceAngleThreshold_() < -SMALL || faceAngleThreshold_() > 180 + SMALL)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"primitiveMesh::checkFaceAngles(const bool, labelHashSet*)"
|
||||
) << "faceAngleThreshold_ should be [0..180] but is now "
|
||||
<< faceAngleThreshold_
|
||||
<< faceAngleThreshold_()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const scalar maxSin =
|
||||
Foam::sin(faceAngleThreshold_/180.0*mathematicalConstant::pi);
|
||||
Foam::sin(faceAngleThreshold_()/180.0*mathematicalConstant::pi);
|
||||
|
||||
const pointField& p = points();
|
||||
const faceList& fcs = faces();
|
||||
|
@ -1018,14 +1029,14 @@ bool Foam::primitiveMesh::checkFaceFlatness
|
|||
<< "checking face flatness" << endl;
|
||||
}
|
||||
|
||||
if (faceFlatnessThreshold_ < 0 || faceFlatnessThreshold_ > 1)
|
||||
if (faceFlatnessThreshold_() < 0 || faceFlatnessThreshold_() > 1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"primitiveMesh::checkFaceFlatness"
|
||||
"(const bool, labelHashSet*)"
|
||||
) << "faceFlatnessThreshold_ should be [0..1] but is now "
|
||||
<< faceFlatnessThreshold_
|
||||
<< faceFlatnessThreshold_()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1085,7 @@ bool Foam::primitiveMesh::checkFaceFlatness
|
|||
|
||||
minFlatness = min(minFlatness, flatness);
|
||||
|
||||
if (flatness < faceFlatnessThreshold_)
|
||||
if (flatness < faceFlatnessThreshold_())
|
||||
{
|
||||
nWarped++;
|
||||
|
||||
|
@ -1109,7 +1120,7 @@ bool Foam::primitiveMesh::checkFaceFlatness
|
|||
{
|
||||
Info<< " *There are " << nWarped
|
||||
<< " faces with ratio between projected and actual area < "
|
||||
<< faceFlatnessThreshold_ << endl;
|
||||
<< faceFlatnessThreshold_() << endl;
|
||||
|
||||
Info<< " Minimum ratio (minimum flatness, maximum warpage) = "
|
||||
<< minFlatness << endl;
|
||||
|
|
|
@ -29,18 +29,22 @@ Description
|
|||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::intersection::planarTol_
|
||||
//Foam::debug::controlSwitches<Foam::scalar>
|
||||
Foam::debug::tolerancesSwitch
|
||||
Foam::intersection::planarTol_
|
||||
(
|
||||
debug::tolerances("intersectionPlanarTol", 0.2)
|
||||
"intersectionPlanarTol",
|
||||
0.2
|
||||
);
|
||||
|
||||
|
||||
const Foam::scalar Foam::intersection::missTol_
|
||||
//const Foam::debug::controlSwitches<Foam::scalar>
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::intersection::missTol_
|
||||
(
|
||||
debug::tolerances("intersectionMissTol", SMALL)
|
||||
"intersectionMissTol",
|
||||
SMALL
|
||||
);
|
||||
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum<Foam::intersection::direction, 2>::names[] =
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ SourceFiles
|
|||
|
||||
#include "scalar.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "controlSwitches.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -59,10 +60,11 @@ public:
|
|||
// intersects the triangle or not.
|
||||
// Adjusting the tolerance from the code does not allow it to be const
|
||||
// HJ, 5/Jan/2008
|
||||
static const scalar planarTol_;
|
||||
//static Foam::debug::controlSwitches<scalar> planarTol_;
|
||||
static Foam::debug::tolerancesSwitch planarTol_;
|
||||
|
||||
//- Intersection miss tolerance, of the order of 1e-15
|
||||
static const scalar missTol_;
|
||||
static const Foam::debug::tolerancesSwitch missTol_;
|
||||
|
||||
|
||||
enum direction
|
||||
|
@ -101,9 +103,14 @@ public:
|
|||
|
||||
// Ugly violence to allow tolerance to remain a const scalar
|
||||
// HJ, 7/Sep/2008
|
||||
scalar oldTol = planarTol_;
|
||||
scalar* ptPtr = const_cast<scalar*>(&planarTol_);
|
||||
(*ptPtr) = t;
|
||||
scalar oldTol = planarTol_();
|
||||
|
||||
// Is this still necessary? If not a const, then it is not a const.
|
||||
// MB 18/05_2014
|
||||
//scalar* ptPtr = const_cast<scalar*>(&planarTol_);
|
||||
//(*ptPtr) = t;
|
||||
|
||||
planarTol_ = t;
|
||||
|
||||
return oldTol;
|
||||
}
|
||||
|
|
|
@ -100,20 +100,20 @@ bool triangle<Point, PointRef>::intersection
|
|||
|
||||
// User-controlled projection tolerance
|
||||
// HJ, 23/Oct/2007
|
||||
if (Foam::mag(u1) < intersection::missTol_)
|
||||
if (Foam::mag(u1) < intersection::missTol_())
|
||||
{
|
||||
beta = u0/u2;
|
||||
if
|
||||
(
|
||||
(beta > -intersection::missTol_)
|
||||
&& (beta < 1 + intersection::missTol_)
|
||||
(beta > -intersection::missTol_())
|
||||
&& (beta < 1 + intersection::missTol_())
|
||||
)
|
||||
{
|
||||
alpha = (v0 - beta*v2)/v1;
|
||||
hit =
|
||||
(
|
||||
(alpha > -intersection::missTol_)
|
||||
&& ((alpha + beta) < 1 + intersection::missTol_)
|
||||
(alpha > -intersection::missTol_())
|
||||
&& ((alpha + beta) < 1 + intersection::missTol_())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -122,15 +122,15 @@ bool triangle<Point, PointRef>::intersection
|
|||
beta = (v0*u1 - u0*v1)/det;
|
||||
if
|
||||
(
|
||||
(beta > -intersection::missTol_)
|
||||
&& (beta < 1 + intersection::missTol_)
|
||||
(beta > -intersection::missTol_())
|
||||
&& (beta < 1 + intersection::missTol_())
|
||||
)
|
||||
{
|
||||
alpha = (u0 - beta*u2)/u1;
|
||||
hit =
|
||||
(
|
||||
(alpha > -intersection::missTol_)
|
||||
&& ((alpha + beta) < 1 + intersection::missTol_)
|
||||
(alpha > -intersection::missTol_())
|
||||
&& ((alpha + beta) < 1 + intersection::missTol_())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ inline pointHit triangle<Point, PointRef>::ray
|
|||
Foam::mag(E1)
|
||||
),
|
||||
Foam::mag(c_ - b_)
|
||||
)*intersection::planarTol_;
|
||||
)*intersection::planarTol_();
|
||||
|
||||
bool eligible =
|
||||
alg == intersection::FULL_RAY
|
||||
|
|
|
@ -32,7 +32,7 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::fileName::typeName = "fileName";
|
||||
int Foam::fileName::debug(debug::debugSwitch(fileName::typeName, 0));
|
||||
int Foam::fileName::debug(debug::debugSwitchFromDict(fileName::typeName, 0));
|
||||
const Foam::fileName Foam::fileName::null;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
|
|
@ -29,7 +29,7 @@ License
|
|||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
const char* const Foam::string::typeName = "string";
|
||||
int Foam::string::debug(debug::debugSwitch(string::typeName, 0));
|
||||
int Foam::string::debug(debug::debugSwitchFromDict(string::typeName, 0));
|
||||
const Foam::string Foam::string::null;
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
|
|
@ -29,7 +29,7 @@ License
|
|||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::word::typeName = "word";
|
||||
int Foam::word::debug(Foam::debug::debugSwitch(word::typeName, 0));
|
||||
int Foam::word::debug(Foam::debug::debugSwitchFromDict(word::typeName, 0));
|
||||
const Foam::word Foam::word::null;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -489,7 +489,8 @@ public:
|
|||
template<> \
|
||||
const Foam::word Particle<Type>::typeName(#Type); \
|
||||
template<> \
|
||||
int Particle<Type>::debug(Foam::debug::debugSwitch(#Type, DebugSwitch));
|
||||
Foam::debug::debugSwitch \
|
||||
Particle<Type>::debug(std::string(#Type), DebugSwitch);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
|
|
@ -134,13 +134,13 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
|
|||
const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);
|
||||
|
||||
// Kinetic rate
|
||||
const scalar Rk = C2_*exp(-E_/(specie::RR*Tc));
|
||||
const scalar Rk = C2_*exp(-E_/(specie::RR()*Tc));
|
||||
|
||||
// Particle surface area
|
||||
const scalar Ap = mathematicalConstant::pi*sqr(d);
|
||||
|
||||
// Change in C mass [kg]
|
||||
scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk);
|
||||
scalar dmC = Ap*rhoc*specie::RR()*Tc*YO2/WO2_*D0*Rk/(D0 + Rk);
|
||||
|
||||
// Limit mass transfer by availability of C
|
||||
dmC = min(mass*fComb, dmC);
|
||||
|
|
|
@ -140,10 +140,10 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
|
|||
const scalar D = D0_*(rho0_/rhoc)*pow(Tc/T0_, Dn_);
|
||||
|
||||
// Far field partial pressure O2 [Pa]
|
||||
const scalar ppO2 = rhoO2/WO2_*specie::RR*Tc;
|
||||
const scalar ppO2 = rhoO2/WO2_*specie::RR()*Tc;
|
||||
|
||||
// Total molar concentration of the carrier phase [kmol/m^3]
|
||||
const scalar C = pc/(specie::RR*Tc);
|
||||
const scalar C = pc/(specie::RR()*Tc);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
|
|||
{
|
||||
qCsOld = qCs;
|
||||
const scalar PO2Surface = ppO2*exp(-(qCs + N)*d/(2*C*D));
|
||||
qCs = A_*exp(-E_/(specie::RR*T))*pow(PO2Surface, n_);
|
||||
qCs = A_*exp(-E_/(specie::RR()*T))*pow(PO2Surface, n_);
|
||||
qCs = (100.0*qCs + iter*qCsOld)/(100.0 + iter);
|
||||
qCs = min(qCs, qCsLim);
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void parcel::setRelaxationTimes
|
|||
// Assume equilibrium at drop-surface => pressure @ surface
|
||||
// = vapour pressure to calculate fuel-vapour density @ surface
|
||||
scalar pressureAtSurface = fuels.pv(pressure, T(), X());
|
||||
scalar rhoFuelVap = pressureAtSurface*fuels.W(X())/(specie::RR*Tf);
|
||||
scalar rhoFuelVap = pressureAtSurface*fuels.W(X())/(specie::RR()*Tf);
|
||||
|
||||
scalarField Xs(sDB.fuels().Xs(pressure, temperature, T(), Xf, X()));
|
||||
scalarField Ys(Nf, 0.0);
|
||||
|
|
|
@ -98,7 +98,7 @@ void LISA::atomizeParcel
|
|||
Winv += Y[i][cellI]/spray_.gasProperties()[i].W();
|
||||
}
|
||||
|
||||
scalar R = specie::RR*Winv;
|
||||
scalar R = specie::RR()*Winv;
|
||||
|
||||
// ideal gas law to evaluate density
|
||||
scalar rhoAverage = pressure/R/Taverage;
|
||||
|
|
|
@ -94,7 +94,7 @@ void blobsSheetAtomization::atomizeParcel
|
|||
{
|
||||
Winv += Y[i][cellI]/spray_.gasProperties()[i].W();
|
||||
}
|
||||
scalar R = specie::RR*Winv;
|
||||
scalar R = specie::RR()*Winv;
|
||||
|
||||
// ideal gas law to evaluate density
|
||||
scalar rhoAverage = pressure/R/Taverage;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue