Handling of controlSwitches. Modifications for handling commsType which is basically an enum.

This commit is contained in:
Martin Beaudoin 2014-07-09 14:08:02 -04:00
parent b21d148a4f
commit 02e9364872
18 changed files with 431 additions and 127 deletions

View file

@ -173,7 +173,7 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
@ -185,7 +185,7 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send

View file

@ -77,7 +77,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -112,7 +112,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
newValues_ = nbrField.boundaryField()[nbrPatchID];
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -144,7 +144,7 @@ void directMappedFixedValueFvPatchField<Type>::mapField()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),

View file

@ -198,7 +198,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -209,7 +209,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -231,7 +231,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
@ -243,7 +243,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),

View file

@ -120,6 +120,13 @@ public:
return names[e];
}
//- Return the name of the given enumeration element
// where e is specified as a int
const char* operator[](const int e) const
{
return names[e];
}
// Friend operators

View file

@ -244,9 +244,16 @@ Foam::Pstream::nProcsSimpleSum
);
// Default commsType
Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType
Foam::Pstream::commsTypes Foam::Pstream::defaultCommsType_
(
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
);
const Foam::debug::optimisationSwitch
Foam::Pstream::defaultCommsType
(
"commsType",
"blocking"
);
// ************************************************************************* //

View file

@ -232,8 +232,9 @@ public:
static const Foam::debug::optimisationSwitch nProcsSimpleSum;
//- Default commsType
static commsTypes defaultCommsType;
static commsTypes defaultCommsType_;
static const Foam::debug::optimisationSwitch defaultCommsType;
// Constructors

View file

@ -293,7 +293,10 @@ evaluate()
{
forAll(*this, patchi)
{
this->operator[](patchi).initEvaluate(Pstream::defaultCommsType);
this->operator[](patchi).initEvaluate
(
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
// Block for any outstanding requests
@ -305,7 +308,10 @@ evaluate()
forAll(*this, patchi)
{
this->operator[](patchi).evaluate(Pstream::defaultCommsType);
this->operator[](patchi).evaluate
(
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -331,7 +337,7 @@ evaluate()
{
FatalErrorIn("GeometricBoundaryField::evaluate()")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}
@ -360,7 +366,7 @@ evaluateCoupled()
{
this->operator[](patchi).initEvaluate
(
Pstream::defaultCommsType
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
}
@ -376,7 +382,10 @@ evaluateCoupled()
{
if (this->operator[](patchi).coupled())
{
this->operator[](patchi).evaluate(Pstream::defaultCommsType);
this->operator[](patchi).evaluate
(
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType())
);
}
}
}
@ -415,7 +424,7 @@ evaluateCoupled()
{
FatalErrorIn("GeometricBoundaryField::evaluateCoupled()")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}

View file

@ -586,7 +586,7 @@ Foam::argList::argList
<< " floatTransfer : " << Pstream::floatTransfer << nl
<< " nProcsSimpleSum : " << Pstream::nProcsSimpleSum() << nl
<< " commsType : "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< endl;
}
}

View file

@ -90,6 +90,9 @@ class controlSwitches
//- Switch name
std::string switchName_;
//- Switch Description
std::string switchDescription_;
//- Switch value
T switchValue_;
@ -145,7 +148,7 @@ public:
const T operator&(const T&);
// == operator
bool operator==(const T&);
bool operator==(const T&) const;
// >= operator
bool operator>=(const T&);
@ -161,6 +164,17 @@ public:
{
return switchValue_;
}
// Return switch name
std::string switchName()
{
return switchName_;
}
// Return switch description
std::string switchDescription()
{
return switchDescription_;
}
};

View file

@ -25,9 +25,6 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T>
@ -43,7 +40,7 @@ inline const T Foam::debug::controlSwitches<T>::operator&(const T& rhs)
}
template<class T>
inline bool Foam::debug::controlSwitches<T>::operator==(const T& rhs)
inline bool Foam::debug::controlSwitches<T>::operator==(const T& rhs) const
{
return switchValue_ == rhs;
}
@ -66,13 +63,6 @@ inline bool Foam::debug::controlSwitches<T>::operator<(const T& rhs)
return switchValue_ < rhs;
}
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -72,6 +72,23 @@ public:
)
{}
// This constructor is essentially for 'commsType'
optimisationSwitch
(
const std::string& switchName,
const std::string& switchValue
)
:
controlSwitches<int>
(
switchName,
debug::optimisationSwitchFromDict(switchName, switchValue),
debug::OPTIMISATIONSWITCHES,
&optimisationSwitchValues_
)
{}
virtual ~optimisationSwitch()
{
}
@ -82,6 +99,20 @@ public:
controlSwitches<int>::operator=(rhs);
}
bool operator==(const int& rhs) const
{
return controlSwitches<int>::operator==(rhs);
}
#if 0
// Cannot use a conversion operator for Pstream::commsTypes
// since including Pstream.H generates compilation errors.
// MB 06/2014
operator Pstream::commsTypes () const
{
return static_cast<Pstream::commsTypes>(operator()());
}
#endif
};

View file

@ -192,7 +192,11 @@ int Foam::debug::infoSwitchFromDict(const char* name, const int defaultValue)
}
int Foam::debug::optimisationSwitchFromDict(const char* name, const int defaultValue)
int Foam::debug::optimisationSwitchFromDict
(
const char* name,
const int defaultValue
)
{
return optimisationSwitches().lookupOrAddDefault
(
@ -201,7 +205,38 @@ int Foam::debug::optimisationSwitchFromDict(const char* name, const int defaultV
}
double Foam::debug::tolerancesFromDict(const char* name, const double defaultValue)
// This is essentially for reading 'commsType'
int Foam::debug::optimisationSwitchFromDict
(
const Foam::string name,
const Foam::word defaultValueStr
)
{
int retValue = 0;
if (name == "commsType")
{
Foam::string valueStr = optimisationSwitches().lookupOrAddDefault
(
name, defaultValueStr, false, false
);
retValue = Pstream::commsTypeNames[valueStr];
}
else
{
// Need a warning here...
}
return retValue;
}
double Foam::debug::tolerancesFromDict
(
const char* name,
const double defaultValue
)
{
return tolerances().lookupOrAddDefault
(
@ -209,7 +244,11 @@ double Foam::debug::tolerancesFromDict(const char* name, const double defaultVal
);
}
double Foam::debug::constantsFromDict(const char* name, const double defaultValue)
double Foam::debug::constantsFromDict
(
const char* name,
const double defaultValue
)
{
return tolerances().lookupOrAddDefault
(
@ -217,7 +256,11 @@ double Foam::debug::constantsFromDict(const char* name, const double defaultValu
);
}
void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet globalControlDictSwitchSetName, Foam::string keyValues)
void Foam::debug::updateCentralDictVars
(
Foam::debug::globalControlDictSwitchSet globalControlDictSwitchSetName,
Foam::string keyValues
)
{
Foam::word token;
@ -241,50 +284,82 @@ void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet
{
if (debugSwitchValues_)
{
ListDebugControlSwitches& runTimeDebugSwitchValues = *debugSwitchValues_;
ListDebugControlSwitches& debugSwitchValues =
*debugSwitchValues_;
label oldDebugValue;
label newDebugValue;
isskv >> newDebugValue;
if(Foam::debug::debugSwitches().readIfPresent(key, oldDebugValue))
if (Foam::debug::debugSwitches().readIfPresent
(
key,
oldDebugValue
)
)
{
Info << endl
<< "Warning: Modification of DebugSwitch: " << key << endl
<< "Warning: Modification of DebugSwitch: "
<< key << endl
<< " Old value: " << oldDebugValue << endl
<< " New value: " << newDebugValue << endl
<< endl;
Foam::debug::debugSwitches().set(key, newDebugValue);
Foam::debug::debugSwitches().set
(
key,
newDebugValue
);
std::list<controlSwitches<int> *> curList = runTimeDebugSwitchValues[key];
std::list<controlSwitches<int> *> curList =
debugSwitchValues[key];
// Modify all entries for this key
forAllIter(std::list<controlSwitches<int> *>, curList, iterI)
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());
// Usage of non-existent DebugSwitches: best to
// abort right away
SortableList<Foam::word> sortedValidKeys
(
debugSwitchValues.size()
);
int i=0;
forAllIter(ListDebugControlSwitches, runTimeDebugSwitchValues, iterI)
forAllIter
(
ListDebugControlSwitches,
debugSwitchValues,
iterI
)
{
sortedValidKeys[i++] = iterI->first;
}
sortedValidKeys.sort();
FatalError
<< "Usage of non-existent DebugSwitches: " << key
<< "Usage of non-existent DebugSwitches name: "
<< key
<< endl << endl
<< "Valid entries for this application are: " << sortedValidKeys
<< "Valid entries for this application are: "
<< sortedValidKeys
<< exit(FatalError);
}
}
else
{
FatalError
<< "No DebugSwitches values are available for this application."
<< "No DebugSwitches values are available for "
<< "this application."
<< exit(FatalError);
}
}
@ -293,50 +368,78 @@ void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet
{
if (infoSwitchValues_)
{
ListInfoControlSwitches& runTimeInfoSwitchValues = *infoSwitchValues_;
ListInfoControlSwitches& infoSwitchValues =
*infoSwitchValues_;
label oldInfoValue;
label newInfoValue;
isskv >> newInfoValue;
if(Foam::debug::infoSwitches().readIfPresent(key, oldInfoValue))
if (Foam::debug::infoSwitches().readIfPresent
(
key,
oldInfoValue
)
)
{
Info << endl
<< "Warning: Modification of InfoSwitch: " << key << 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];
std::list<controlSwitches<int> *> curList =
infoSwitchValues[key];
// Modify all entries for this key
forAllIter(std::list<controlSwitches<int> *>, curList, iterI)
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());
// Usage of non-existent InfoSwitches: best to
// abort right away
SortableList<Foam::word> sortedValidKeys
(
infoSwitchValues.size()
);
int i=0;
forAllIter(ListInfoControlSwitches, runTimeInfoSwitchValues, iterI)
forAllIter
(
ListInfoControlSwitches,
infoSwitchValues,
iterI
)
{
sortedValidKeys[i++] = iterI->first;
}
sortedValidKeys.sort();
FatalError
<< "Usage of non-existent InfoSwitches: " << key
<< "Usage of non-existent InfoSwitches name: "
<< key
<< endl << endl
<< "Valid entries for this application are: " << sortedValidKeys
<< "Valid entries for this application are: "
<< sortedValidKeys
<< exit(FatalError);
}
}
else
{
FatalError
<< "No InfoSwitches values are available for this application."
<< "No InfoSwitches values are available for "
<< "this application."
<< exit(FatalError);
}
}
@ -345,50 +448,122 @@ void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet
{
if (optimisationSwitchValues_)
{
ListOptimisationControlSwitches& runTimeOptimisationSwitchValues = *optimisationSwitchValues_;
label oldOptimisationValue;
ListOptimisationControlSwitches&
optimisationSwitchValues = *optimisationSwitchValues_;
label newOptimisationValue;
isskv >> newOptimisationValue;
label oldOptimisationValue;
word newOptimisationValueStr;
word oldOptimisationValueStr;
bool keyIsPresent(false);
if(Foam::debug::optimisationSwitches().readIfPresent(key, oldOptimisationValue))
// We need to check if the switch 'commsType' is being
// overriden. This switch is coded as an enum, but will
// be specified using a string like "blocking",
// "scheduled, etc. Some additional logic is needed.
if (key == "commsType")
{
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;
// Handle a string value, then convert to enum
isskv >> newOptimisationValueStr;
newOptimisationValue =
Pstream::commsTypeNames[newOptimisationValueStr];
keyIsPresent =
Foam::debug::optimisationSwitches().readIfPresent
(
key,
oldOptimisationValueStr
);
}
else
{
// Usage of non-existent OptimisationSwitches: best to abort right away
SortableList<Foam::word> sortedValidKeys(runTimeOptimisationSwitchValues.size());
// Handling label values
isskv >> newOptimisationValue;
keyIsPresent =
Foam::debug::optimisationSwitches().readIfPresent
(
key,
oldOptimisationValue
);
std::ostringstream newOptimisationValueOstream;
newOptimisationValueOstream << newOptimisationValue;
newOptimisationValueStr =
newOptimisationValueOstream.str();
std::ostringstream oldOptimisationValueOstream;
oldOptimisationValueOstream << oldOptimisationValue;
oldOptimisationValueStr =
oldOptimisationValueOstream.str();
}
if(keyIsPresent)
{
Info << endl
<< "Warning: Modification of "
<< "OptimisationSwitch: "
<< key << endl
<< " Old value: "
<< oldOptimisationValueStr << endl
<< " New value: "
<< newOptimisationValueStr << endl
<< endl;
Foam::debug::optimisationSwitches().set
(
key,
newOptimisationValue
);
std::list<controlSwitches<int> *> curList =
optimisationSwitchValues[key];
std::cout << "curList.size(): " << curList.size() << std::endl;
// 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
(
optimisationSwitchValues.size()
);
int i=0;
forAllIter(ListOptimisationControlSwitches, runTimeOptimisationSwitchValues, iterI)
forAllIter
(
ListOptimisationControlSwitches,
optimisationSwitchValues,
iterI
)
{
sortedValidKeys[i++] = iterI->first;
}
sortedValidKeys.sort();
FatalError
<< "Usage of non-existent OptimisationSwitches value: " << key
<< "Usage of non-existent "
<< " OptimisationSwitches name: " << key
<< endl << endl
<< "Valid entries for this application are: " << sortedValidKeys
<< "Valid entries for this application are: "
<< sortedValidKeys
<< exit(FatalError);
}
}
else
{
FatalError
<< "No OptimisationSwitches values are available for this application."
<< "No OptimisationSwitches values are available "
<< "for this application."
<< exit(FatalError);
}
}
@ -397,50 +572,84 @@ void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet
{
if (tolerancesSwitchValues_)
{
ListTolerancesControlSwitches& runTimeTolerancesSwitchValues = *tolerancesSwitchValues_;
ListTolerancesControlSwitches& tolerancesSwitchValues =
*tolerancesSwitchValues_;
scalar oldTolerancesValue;
scalar newTolerancesValue;
isskv >> newTolerancesValue;
if(Foam::debug::tolerances().readIfPresent(key, oldTolerancesValue))
if (Foam::debug::tolerances().readIfPresent
(
key,
oldTolerancesValue
)
)
{
Info << endl
<< "Warning: Modification of Tolerance value: " << key << endl
<< " Old value: " << oldTolerancesValue << endl
<< " New value: " << newTolerancesValue << endl
<< "Warning: Modification of Tolerance: "
<< key << endl
<< " Old value: "
<< oldTolerancesValue << endl
<< " New value: "
<< newTolerancesValue << endl
<< endl;
Foam::debug::tolerances().set(key, newTolerancesValue);
Foam::debug::tolerances().set
(
key,
newTolerancesValue
);
std::list<controlSwitches<scalar> *> curList = runTimeTolerancesSwitchValues[key];
std::list<controlSwitches<scalar> *> curList =
tolerancesSwitchValues[key];
// Modify all entries for this key
forAllIter(std::list<controlSwitches<scalar> *>, curList, iterI)
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());
// Usage of non-existent Tolerances: best to
// abort right away
SortableList<Foam::word> sortedValidKeys
(
tolerancesSwitchValues.size()
);
int i=0;
forAllIter(ListTolerancesControlSwitches, runTimeTolerancesSwitchValues, iterI)
forAllIter
(
ListTolerancesControlSwitches,
tolerancesSwitchValues,
iterI
)
{
sortedValidKeys[i++] = iterI->first;
}
sortedValidKeys.sort();
FatalError
<< "Usage of non-existent Tolerances value: " << key
<< "Usage of non-existent Tolerances name: "
<< key
<< endl << endl
<< "Valid entries for this application are: " << sortedValidKeys
<< "Valid entries for this application are: "
<< sortedValidKeys
<< exit(FatalError);
}
}
else
{
FatalError
<< "No Tolerances values are available for this application."
<< "No Tolerances values are available for "
<< "this application."
<< exit(FatalError);
}
}
@ -449,50 +658,85 @@ void Foam::debug::updateCentralDictVars(Foam::debug::globalControlDictSwitchSet
{
if (constantsSwitchValues_)
{
ListConstantsControlSwitches& runTimeConstantsSwitchValues = *constantsSwitchValues_;
ListConstantsControlSwitches& constantsSwitchValues =
*constantsSwitchValues_;
scalar oldDimensionedConstantsValue;
scalar newDimensionedConstantsValue;
isskv >> newDimensionedConstantsValue;
if(Foam::dimensionedConstants().readIfPresent(key, oldDimensionedConstantsValue))
if (Foam::dimensionedConstants().readIfPresent
(
key,
oldDimensionedConstantsValue
)
)
{
Info << endl
<< "Warning: Modification of DimensionedConstant: " << key << endl
<< " Old value: " << oldDimensionedConstantsValue << endl
<< " New value: " << newDimensionedConstantsValue << endl
<< "Warning: Modification of DimensionedConstant: "
<< key << endl
<< " Old value: "
<< oldDimensionedConstantsValue << endl
<< " New value: "
<< newDimensionedConstantsValue << endl
<< endl;
Foam::dimensionedConstants().set(key, newDimensionedConstantsValue);
Foam::dimensionedConstants().set
(
key,
newDimensionedConstantsValue
);
std::list<controlSwitches<scalar> *> curList = runTimeConstantsSwitchValues[key];
std::list<controlSwitches<scalar> *> curList =
constantsSwitchValues[key];
// Modify all entries for this key
forAllIter(std::list<controlSwitches<scalar> *>, curList, iterI)
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());
// Usage of non-existent DimensionedConstants: best to
// abort right away
SortableList<Foam::word> sortedValidKeys
(
constantsSwitchValues.size()
);
int i=0;
forAllIter(ListConstantsControlSwitches, runTimeConstantsSwitchValues, iterI)
forAllIter
(
ListConstantsControlSwitches,
constantsSwitchValues,
iterI
)
{
sortedValidKeys[i++] = iterI->first;
}
sortedValidKeys.sort();
FatalError
<< "Usage of non-existent DimensionedConstants: " << key
<< "Usage of non-existent "
<< "DimensionedConstants name: "
<< key
<< endl << endl
<< "Valid entries for this application are: " << sortedValidKeys
<< "Valid entries for this application are: "
<< sortedValidKeys
<< exit(FatalError);
}
}
else
{
FatalError
<< "No DimensionedConstants values are available for this application."
<< "No DimensionedConstants values are available "
<< "for this application."
<< exit(FatalError);
}
}

View file

@ -85,6 +85,7 @@ namespace debug
//- Lookup optimisation switch or add default value.
int optimisationSwitchFromDict(const char* name, const int defaultValue = 0);
int optimisationSwitchFromDict(const Foam::string name, const Foam::word defaultValue);
//- Lookup tolerances switch or add default value.
double tolerancesFromDict(const char* name, const double defaultValue = 0);

View file

@ -55,7 +55,7 @@ void Foam::BlockLduMatrix<Type>::initInterfaces
result,
*this,
interfaceCoeffs[interfaceI],
Pstream::defaultCommsType,
static_cast<const Pstream::commsTypes>(Pstream::defaultCommsType()),
switchToLhs
);
}
@ -92,7 +92,7 @@ void Foam::BlockLduMatrix<Type>::initInterfaces
{
FatalErrorIn("BlockLduMatrix<Type>::initMatrixInterfaces")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}
@ -130,7 +130,7 @@ void Foam::BlockLduMatrix<Type>::updateInterfaces
result,
*this,
interfaceCoeffs[interfaceI],
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
switchToLhs
);
}
@ -201,7 +201,7 @@ void Foam::BlockLduMatrix<Type>::updateInterfaces
{
FatalErrorIn("BlockLduMatrix<Type>::updateInterfaces")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}

View file

@ -39,8 +39,8 @@ void Foam::lduMatrix::initMatrixInterfaces
{
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
Pstream::defaultCommsType() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking
)
{
forAll (interfaces, interfaceI)
@ -54,13 +54,13 @@ void Foam::lduMatrix::initMatrixInterfaces
*this,
coupleCoeffs[interfaceI],
cmpt,
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
switchToLhs
);
}
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
else if (Pstream::defaultCommsType() == Pstream::scheduled)
{
const lduSchedule& patchSchedule = this->patchSchedule();
@ -92,7 +92,7 @@ void Foam::lduMatrix::initMatrixInterfaces
{
FatalErrorIn("lduMatrix::initMatrixInterfaces")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}
@ -110,12 +110,12 @@ void Foam::lduMatrix::updateMatrixInterfaces
{
if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
Pstream::defaultCommsType() == Pstream::blocking
|| Pstream::defaultCommsType() == Pstream::nonBlocking
)
{
// Block until all sends/receives have been finished
if (Pstream::defaultCommsType == Pstream::nonBlocking)
if (Pstream::defaultCommsType() == Pstream::nonBlocking)
{
IPstream::waitRequests();
OPstream::waitRequests();
@ -132,13 +132,13 @@ void Foam::lduMatrix::updateMatrixInterfaces
*this,
coupleCoeffs[interfaceI],
cmpt,
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
switchToLhs
);
}
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
else if (Pstream::defaultCommsType() == Pstream::scheduled)
{
const lduSchedule& patchSchedule = this->patchSchedule();
@ -206,7 +206,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
{
FatalErrorIn("lduMatrix::updateMatrixInterfaces")
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
<< exit(FatalError);
}
}

View file

@ -127,7 +127,7 @@ void tetFemMatrix<Type>::check()
*this,
coupledBouCoeffs[interfaceI],
0,
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
false // Do not switch to lhs
);
}
@ -145,7 +145,7 @@ void tetFemMatrix<Type>::check()
*this,
coupledBouCoeffs[interfaceI],
0,
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
false // Do not switch to lhs
);
}

View file

@ -274,7 +274,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
@ -286,7 +286,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
@ -307,7 +307,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
// Distribute back and assign to neighbour
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
nbrField.size(),
distMap.constructMap(), // reverse : what to send

View file

@ -233,7 +233,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
@ -245,7 +245,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
static_cast<Pstream::commsTypes>(Pstream::defaultCommsType()),
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send