postProcess: Updated to allow functionObjects to access fields on construction
This commit is contained in:
@ -92,42 +92,12 @@ if (argList::postProcess(argc, argv))
|
||||
#include INCLUDE_FILE(CREATE_CONTROL)
|
||||
#endif
|
||||
|
||||
// Externally stored dictionary for functionObjectList
|
||||
// if not constructed from runTime
|
||||
dictionary functionsControlDict("controlDict");
|
||||
|
||||
HashSet<word> selectedFields;
|
||||
|
||||
// Construct functionObjectList
|
||||
autoPtr<functionObjectList> functionsPtr
|
||||
(
|
||||
functionObjectList::New
|
||||
(
|
||||
args,
|
||||
runTime,
|
||||
functionsControlDict,
|
||||
selectedFields
|
||||
)
|
||||
);
|
||||
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
if (mesh.readUpdate() != polyMesh::UNCHANGED)
|
||||
{
|
||||
// Update functionObjects if mesh changes
|
||||
functionsPtr = functionObjectList::New
|
||||
(
|
||||
args,
|
||||
runTime,
|
||||
functionsControlDict,
|
||||
selectedFields
|
||||
);
|
||||
}
|
||||
|
||||
FatalIOError.throwExceptions();
|
||||
|
||||
try
|
||||
@ -142,13 +112,25 @@ if (argList::postProcess(argc, argv))
|
||||
#include INCLUDE_FILE(CREATE_FIELDS_3)
|
||||
#endif
|
||||
|
||||
functionsPtr->execute();
|
||||
// Externally stored dictionary for functionObjectList
|
||||
// if not constructed from runTime
|
||||
dictionary functionsControlDict("controlDict");
|
||||
|
||||
// Execute the functionObject 'end()' function for the last time
|
||||
if (timei == timeDirs.size()-1)
|
||||
{
|
||||
functionsPtr->end();
|
||||
}
|
||||
HashSet<word> selectedFields;
|
||||
|
||||
// Construct functionObjectList
|
||||
autoPtr<functionObjectList> functionsPtr
|
||||
(
|
||||
functionObjectList::New
|
||||
(
|
||||
args,
|
||||
runTime,
|
||||
functionsControlDict,
|
||||
selectedFields
|
||||
)
|
||||
);
|
||||
|
||||
functionsPtr->execute();
|
||||
}
|
||||
catch (IOerror& err)
|
||||
{
|
||||
|
||||
@ -84,9 +84,7 @@ Foam::moleFractions<ThermoType>::moleFractions
|
||||
(
|
||||
"X_" + Y[i].name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("X", dimless, 0)
|
||||
@ -136,6 +134,11 @@ bool Foam::moleFractions<ThermoType>::execute()
|
||||
template<class ThermoType>
|
||||
bool Foam::moleFractions<ThermoType>::write()
|
||||
{
|
||||
forAll(X_, i)
|
||||
{
|
||||
X_[i].write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user