Loading...
Searching...
No Matches
TimeState Class Reference

The time value with time-stepping information, user-defined remapping, etc. More...

#include <TimeState.H>

Inheritance diagram for TimeState:
Collaboration diagram for TimeState:

Public Member Functions

 TimeState ()
 Construct a zero time state, using the current time formatting.
virtual ~TimeState ()=default
 Destructor.
virtual scalar userTimeToTime (const scalar theta) const
 Convert the user-time (e.g. CA deg) to real-time (s).
virtual scalar timeToUserTime (const scalar t) const
 Convert the real-time (s) into user-time (e.g. CA deg).
scalar timeOutputValue () const
 Return the current user-time value. (ie, after applying any timeToUserTime() conversion).
const wordtimeName () const noexcept
 Return the current time name.
label timeIndex () const noexcept
 Return the current time index.
scalar deltaTValue () const noexcept
 Return time step value.
scalar deltaT0Value () const noexcept
 Return old time step value.
dimensionedScalar deltaT () const
 Return time step.
dimensionedScalar deltaT0 () const
 Return old time step.
bool writeTime () const noexcept
 True if this is a write interval.
bool outputTime () const noexcept
 Deprecated(2016-05) return true if this is a write time.
Public Member Functions inherited from dimensioned< scalar >
 dimensioned ()
 A dimensionless Zero, named "0".
 dimensioned (const dimensionSet &dims)
 A dimensioned Zero, named "0".
 dimensioned (const dimensionSet &dims, const Foam::zero)
 A dimensioned Zero, named "0".
 dimensioned (const dimensionSet &dims, const Foam::one)
 A dimensioned pTraits::one, named "1".
 dimensioned (const scalar &val)
 Implicit construct dimensionless from given value.
 dimensioned (const dimensionSet &dims, const scalar &val)
 Construct dimensioned from given value.
 dimensioned (const word &name, const dimensionSet &dims, const scalar &val)
 Construct from components (name, dimensions, value).
 dimensioned (const word &name, const dimensioned< scalar > &dt)
 Copy construct dimensioned Type with a new name.
 dimensioned (const primitiveEntry &e)
 Construct from primitive entry with given name.
 dimensioned (const primitiveEntry &e, const dimensionSet &dims)
 Construct from primitive entry with given name and dimensions.
 dimensioned (const word &name, const dictionary &dict)
 Construct from dictionary lookup with a given name.
 dimensioned (const word &name, const dimensionSet &dims, const dictionary &dict)
 Construct from dictionary lookup with a given name and dimensions.
 dimensioned (const word &name, const dimensionSet &dims, const dictionary &dict, const word &entryName)
 Construct from dictionary lookup with a given name and dimensions.
 dimensioned (const word &name, const dimensionSet &dims, const scalar &val, const dictionary &dict)
 Construct from components (name, dimensions, value) with optional dictionary override.
const wordname () const noexcept
 Return const reference to name.
wordname () noexcept
 Return non-const reference to name.
const dimensionSetdimensions () const noexcept
 Return const reference to dimensions.
dimensionSetdimensions () noexcept
 Return non-const reference to dimensions.
const scalar & value () const noexcept
 Return const reference to value.
scalar & value () noexcept
 Return non-const reference to value.
dimensioned< cmptTypecomponent (const direction d) const
 Return a component as a dimensioned<cmptType>.
void replace (const direction d, const dimensioned< cmptType > &dc)
 Return a component with a dimensioned<cmptType>.
dimensioned< scalar > T () const
 Return transpose.
bool read (const dictionary &dict)
 Update the value of dimensioned<Type>, lookup in dictionary with the name().
bool readIfPresent (const dictionary &dict)
 Update the value of dimensioned<Type> if found in the dictionary, lookup in dictionary with the name().
bool read (const word &entryName, const dictionary &dict)
 Update the value of dimensioned<Type>, using an alternative entry name.
bool readIfPresent (const word &entryName, const dictionary &dict)
 Update the value of dimensioned<Type> if found in the dictionary, using an alternative entry name.
Istreamread (Istream &is, const bool readName=true)
 Read (name, dimensions, value) from stream, using units from system table.
Istreamread (Istream &is, const dictionary &readSet)
 Read (name, dimensions, value) from stream, using units from dictionary.
Istreamread (Istream &is, const HashTable< dimensionedScalar > &readSet)
 Read (name, dimensions, value) from stream, using units from table.
void writeEntry (const word &keyword, Ostream &os) const
 Write as a dictionary entry with keyword.
dimensioned< cmptTypeoperator[] (const direction d) const
 Return a component as a dimensioned<cmptType>.
void operator+= (const dimensioned< scalar > &dt)
void operator-= (const dimensioned< scalar > &dt)
void operator*= (const scalar s)
void operator/= (const scalar s)
 dimensioned (Istream &is)
 Deprecated(2018-11) Construct from Istream (expects name, dimensions, value).
 dimensioned (const word &name, Istream &is)
 Deprecated(2018-11) Construct from Istream with given name (expects dimensions, value).
 dimensioned (const word &name, const dimensionSet &dims, Istream &is)
 Deprecated(2018-11) Construct from Istream with given name and expected dimensions.
auto expr (const label size) const
 Wrap value as constant-value List expression.
auto expr (const GeoField &fld) const
 Wrap value as constant-value GeometricField expression. Supplied.

Protected Member Functions

void resetTimeState (const word &newName, const scalar newValue, const label newIndex)
 Reset some of TimeState (name, value, index).

Protected Attributes

label timeIndex_
label writeTimeIndex_
scalar deltaT_
scalar deltaT0_
scalar deltaTSave_
bool deltaTchanged_
bool writeTime_

Additional Inherited Members

Public Types inherited from dimensioned< scalar >
typedef scalar value_type
 The underlying data type.
typedef pTraits< scalar >::cmptType cmptType
 Component type.
Static Public Member Functions inherited from dimensioned< scalar >
static dimensioned< scalar > getOrDefault (const word &name, const dictionary &dict, const dimensionSet &dims=dimless, const scalar &deflt=scalar(Zero))
 Construct dimensioned from dictionary, with default value.
static dimensioned< scalar > getOrDefault (const word &name, const dictionary &dict, const scalar &deflt=scalar(Zero))
 Construct dimensionless from dictionary, with default value.
static dimensioned< scalar > getOrAddToDict (const word &name, dictionary &dict, const dimensionSet &dims=dimless, const scalar &deflt=scalar(Zero))
 Construct dimensioned from dictionary, with default value.
static dimensioned< scalar > getOrAddToDict (const word &name, dictionary &dict, const scalar &deflt=scalar(Zero))
 Construct dimensionless from dictionary, with default value.
static dimensioned< scalar > lookupOrDefault (const word &name, const dictionary &dict, const dimensionSet &dims=dimless, const scalar &deflt=scalar(Zero))
 Same as getOrDefault().
static dimensioned< scalar > lookupOrDefault (const word &name, const dictionary &dict, const scalar &deflt=scalar(Zero))
 Same as getOrDefault().
static dimensioned< scalar > lookupOrAddToDict (const word &name, dictionary &dict, const dimensionSet &dims=dimless, const scalar &deflt=scalar(Zero))
 Same as getOrAddToDict().
static dimensioned< scalar > lookupOrAddToDict (const word &name, dictionary &dict, const scalar &deflt=scalar(Zero))
 Same as getOrAddToDict().

Detailed Description

The time value with time-stepping information, user-defined remapping, etc.

Source files

Definition at line 47 of file TimeState.H.

Constructor & Destructor Documentation

◆ TimeState()

TimeState ( )

Construct a zero time state, using the current time formatting.

Definition at line 27 of file TimeState.C.

References deltaT0_, deltaT_, deltaTchanged_, deltaTSave_, Foam::dimTime, timeIndex_, timeName(), writeTime_, and writeTimeIndex_.

Referenced by Time::prevTimeState(), and Time::subCycle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~TimeState()

virtual ~TimeState ( )
virtualdefault

Destructor.

References deltaT(), deltaT0(), deltaT0Value(), deltaTValue(), Foam::noexcept, timeIndex(), and writeTime().

Here is the call graph for this function:

Member Function Documentation

◆ resetTimeState()

void resetTimeState ( const word & newName,
const scalar newValue,
const label newIndex )
inlineprotected

Reset some of TimeState (name, value, index).

Definition at line 80 of file TimeState.H.

References dimensioned< scalar >::name(), timeIndex_, and dimensioned< scalar >::value().

Referenced by Time::setTime(), Time::setTime(), and Time::setTime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ userTimeToTime()

◆ timeToUserTime()

Foam::scalar timeToUserTime ( const scalar t) const
virtual

Convert the real-time (s) into user-time (e.g. CA deg).

Reimplemented in crankConRod.

Definition at line 48 of file TimeState.C.

Referenced by Time::operator++(), Time::setTime(), timeOutputValue(), and Time::writeTimeDict().

Here is the caller graph for this function:

◆ timeOutputValue()

Foam::scalar timeOutputValue ( ) const
inline

Return the current user-time value. (ie, after applying any timeToUserTime() conversion).

Definition at line 24 of file TimeStateI.H.

References timeToUserTime(), and dimensioned< scalar >::value().

Referenced by atmEpsilonWallFunctionFvPatchScalarField::calculate(), atmOmegaWallFunctionFvPatchScalarField::calculate(), Time::findInstance(), linearSpringDamper::restrain(), triSurface::triSurfInstance(), and uniformInterpolatedDisplacementPointPatchVectorField::updateCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeName()

const Foam::word & timeName ( ) const
inlinenoexcept

Return the current time name.

Definition at line 30 of file TimeStateI.H.

References dimensioned< scalar >::name(), and Foam::noexcept.

Referenced by Time::globalTimePath(), Time::timePath(), Time::timePath(), TimeState(), and Time::TypeName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeIndex()

◆ deltaTValue()

◆ deltaT0Value()

Foam::scalar deltaT0Value ( ) const
inlinenoexcept

Return old time step value.

Definition at line 55 of file TimeStateI.H.

References deltaT0_, and Foam::noexcept.

Referenced by sixDoFRigidBodyMotionSolver::solve(), sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs(), uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs(), and ~TimeState().

Here is the caller graph for this function:

◆ deltaT()

◆ deltaT0()

Foam::dimensionedScalar deltaT0 ( ) const
inline

Return old time step.

Definition at line 67 of file TimeStateI.H.

References deltaT0_, and Foam::dimTime.

Referenced by ~TimeState().

Here is the caller graph for this function:

◆ writeTime()

bool writeTime ( ) const
inlinenoexcept

True if this is a write interval.

Definition at line 73 of file TimeStateI.H.

References Foam::noexcept, and writeTime_.

Referenced by outputTime(), Time::writeObject(), and ~TimeState().

Here is the caller graph for this function:

◆ outputTime()

bool outputTime ( ) const
inlinenoexcept

Deprecated(2016-05) return true if this is a write time.

Deprecated
(2016-05) - use writeTime() method

Definition at line 175 of file TimeState.H.

References Foam::noexcept, outputTime(), and writeTime().

Referenced by outputTime().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ timeIndex_

label timeIndex_
protected

◆ writeTimeIndex_

label writeTimeIndex_
protected

Definition at line 65 of file TimeState.H.

Referenced by Time::adjustDeltaT(), Time::operator++(), Time::readDict(), and TimeState().

◆ deltaT_

◆ deltaT0_

◆ deltaTSave_

scalar deltaTSave_
protected

◆ deltaTchanged_

bool deltaTchanged_
protected

Definition at line 71 of file TimeState.H.

Referenced by Time::readDict(), Time::setDeltaT(), and TimeState().

◆ writeTime_

bool writeTime_
protected

Definition at line 72 of file TimeState.H.

Referenced by Time::operator++(), TimeState(), Time::writeNow(), Time::writeObject(), and writeTime().


The documentation for this class was generated from the following files: