Commit c4423506 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: runTimeControl - deactivate for -postProcess operation

parent a5bebad3
......@@ -83,78 +83,91 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
if (functionObject::postProcess)
{
Info<< "Deactivated " << name()
<< " function object for post-processing"
<< endl;
return false;
}
const dictionary& conditionsDict = dict.subDict("conditions");
const wordList conditionNames(conditionsDict.toc());
conditions_.setSize(conditionNames.size());
label uniqueGroupi = 0;
forAll(conditionNames, conditioni)
if (fvMeshFunctionObject::read(dict))
{
const word& conditionName = conditionNames[conditioni];
const dictionary& dict = conditionsDict.subDict(conditionName);
const dictionary& conditionsDict = dict.subDict("conditions");
const wordList conditionNames(conditionsDict.toc());
conditions_.setSize(conditionNames.size());
conditions_.set
(
conditioni,
runTimeCondition::New(conditionName, obr_, dict, *this)
);
label uniqueGroupi = 0;
forAll(conditionNames, conditioni)
{
const word& conditionName = conditionNames[conditioni];
const dictionary& dict = conditionsDict.subDict(conditionName);
label groupi = conditions_[conditioni].groupID();
conditions_.set
(
conditioni,
runTimeCondition::New(conditionName, obr_, dict, *this)
);
if (groupMap_.insert(groupi, uniqueGroupi))
{
++uniqueGroupi;
label groupi = conditions_[conditioni].groupID();
if (groupMap_.insert(groupi, uniqueGroupi))
{
++uniqueGroupi;
}
}
}
dict.readIfPresent("nWriteStep", nWriteStep_);
dict.readIfPresent("nWriteStep", nWriteStep_);
// Check that some conditions are set
if (conditions_.empty())
{
Info<< type() << " " << name() << " output:" << nl
<< " No conditions present" << nl
<< endl;
}
else
{
// Check that at least one condition is active
bool check = false;
for (const auto& condition : conditions_)
// Check that some conditions are set
if (conditions_.empty())
{
Info<< type() << " " << name() << " output:" << nl
<< " No conditions present" << nl
<< endl;
}
else
{
if (condition.active())
// Check that at least one condition is active
bool check = false;
for (const auto& condition : conditions_)
{
check = true;
break;
if (condition.active())
{
check = true;
break;
}
}
if (!check)
{
Info<< type() << " " << name() << " output:" << nl
<< " All conditions are inactive" << nl
<< endl;
}
}
if (!check)
// Set the action to perform when all conditions are satisfied
// - set to end fro backwards compatibility with v1806
satisfiedAction_ =
satisfiedActionNames.lookupOrDefault
(
"satisfiedAction",
dict,
satisfiedAction::END
);
if (satisfiedAction_ == satisfiedAction::SET_TRIGGER)
{
Info<< type() << " " << name() << " output:" << nl
<< " All conditions are inactive" << nl
<< endl;
triggerIndex_ = readLabel(dict.lookup("trigger"));
}
}
// Set the action to perform when all conditions are satisfied
// - set to end fro backwards compatibility with v1806
satisfiedAction_ =
satisfiedActionNames.lookupOrDefault
(
"satisfiedAction",
dict,
satisfiedAction::END
);
if (satisfiedAction_ == satisfiedAction::SET_TRIGGER)
{
triggerIndex_ = readLabel(dict.lookup("trigger"));
return true;
}
return true;
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment