MERGE: Clean-up of time classes

This commit is contained in:
Hrvoje Jasak 2018-05-15 16:44:42 +01:00
parent b76f2a810e
commit e3af38c8d7
5 changed files with 30 additions and 13 deletions

View file

@ -54,7 +54,7 @@ Foam::TimePaths::TimePaths
} }
else else
{ {
globalCaseName_ = caseName(pos-1); globalCaseName_ = caseName(pos - 1);
} }
} }
else else

View file

@ -110,6 +110,12 @@ public:
return rootPath_; return rootPath_;
} }
//- Return global case name
const fileName& globalCaseName() const
{
return globalCaseName_;
}
//- Return case name //- Return case name
const fileName& caseName() const const fileName& caseName() const
{ {

View file

@ -61,6 +61,7 @@ protected:
bool deltaTchanged_; bool deltaTchanged_;
label outputTimeIndex_; label outputTimeIndex_;
//- Is outputTime because of primary? //- Is outputTime because of primary?
bool primaryOutputTime_; bool primaryOutputTime_;
@ -88,10 +89,10 @@ public:
virtual scalar timeToUserTime(const scalar t) const; virtual scalar timeToUserTime(const scalar t) const;
//- Return current time value //- Return current time value
scalar timeOutputValue() const; virtual scalar timeOutputValue() const;
//- Return current time index //- Return current time index
label timeIndex() const; virtual label timeIndex() const;
//- Return time step value //- Return time step value
inline scalar deltaTValue() const inline scalar deltaTValue() const
@ -106,16 +107,16 @@ public:
} }
//- Return time step //- Return time step
dimensionedScalar deltaT() const; virtual dimensionedScalar deltaT() const;
//- Return old time step //- Return old time step
dimensionedScalar deltaT0() const; virtual dimensionedScalar deltaT0() const;
// Check // Check
//- Return true if this is an output time (primary or secondary) //- Return true if this is an output time
bool outputTime() const; virtual bool outputTime() const;
}; };

View file

@ -94,7 +94,7 @@ void Foam::Time::adjustDeltaT()
adjustTime = true; adjustTime = true;
timeToNextWrite = max timeToNextWrite = max
( (
0.0, scalar(0),
(outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_) (outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_)
); );
} }

View file

@ -109,8 +109,8 @@ public:
//- Supported time directory name formats //- Supported time directory name formats
enum fmtflags enum fmtflags
{ {
general = 0, general = 0,
fixed = ios_base::fixed, fixed = ios_base::fixed,
scientific = ios_base::scientific scientific = ios_base::scientific
}; };
@ -132,10 +132,10 @@ protected:
scalar startTime_; scalar startTime_;
//- End time //- End time
scalar endTime_; mutable scalar endTime_;
//- Stop at //- Stop at
stopAtControls stopAt_; mutable stopAtControls stopAt_;
//- Write control //- Write control
writeControls writeControl_; writeControls writeControl_;
@ -143,6 +143,14 @@ protected:
//- Write interval //- Write interval
scalar writeInterval_; scalar writeInterval_;
// Additional writing
//- Secondary write control
writeControls secondaryWriteControl_;
//- Secondary write interval
scalar secondaryWriteInterval_;
//- Purge write //- Purge write
label purgeWrite_; label purgeWrite_;
mutable FIFOStack<word> previousOutputTimes_; mutable FIFOStack<word> previousOutputTimes_;
@ -162,6 +170,7 @@ protected:
//- If time is being sub-cycled this is the previous TimeState //- If time is being sub-cycled this is the previous TimeState
autoPtr<TimeState> prevTimeState_; autoPtr<TimeState> prevTimeState_;
//- Time directory name format //- Time directory name format
static fmtflags format_; static fmtflags format_;
@ -395,7 +404,8 @@ public:
IOstream::compressionType IOstream::compressionType
) const; ) const;
//- Write the objects now and continue the run //- Write the objects now (not at end of iteration) and continue
// the run
bool writeNow(); bool writeNow();
//- Write the objects now (not at end of iteration) and end the run //- Write the objects now (not at end of iteration) and end the run