OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

timeSelector Class Reference

A List of scalarRange for selecting times. More...

Inheritance diagram for timeSelector:
Collaboration diagram for timeSelector:

List of all members.


Public Member Functions

 timeSelector ()
 Construct Null.
 timeSelector (Istream &)
 Construct from Istream.
bool selected (const instant &) const
 Return true if the given instant is within the ranges.
List< bool > selected (const List< instant > &) const
 Return the set of selected instants in the given list that are.
List< instant > select (const List< instant > &) const
 Select a list of Time values that are within the ranges.
void inplaceSelect (List< instant > &) const
 Select a list of Time values that are within the ranges.

Static Public Member Functions

static void addOptions (const bool constant=true, const bool zeroTime=false)
 Add the options handled by timeSelector to argList::validOptions.
static List< instant > select (const List< instant > &, const argList &args)
 Return the set of times selected based on the argList options.
static List< instant > select0 (Time &runTime, const argList &args)
 Return the set of times selected based on the argList options.

Detailed Description

A List of scalarRange for selecting times.

The timeSelector provides a convenient means of selecting multiple times. A typical use would be the following:

timeSelector::addOptions();
// add other options
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
...
forAll(timeDirs, timeI)
{
    ...
}

The result program would receive -time, -latestTime, -constant and -noZero options. The -constant option explicitly includes the constant/ directory in the time list and the -noZero option explicitly excludes the 0/ directory from the time list.

There may however also be many cases in which neither the constant/ directory nor the 0/ directory contain particularly relevant information. This might occur, for example, when post-processing results. In this case, addOptions is called with optional boolean arguments.

timeSelector::addOptions(false, true);

The first argument avoids adding the -constant option. The second argument adds an additional -zeroTime option and also prevents the 0/ directory from being included in the default time range and in the -latestTime selection.

Source files

Definition at line 85 of file timeSelector.H.


Constructor & Destructor Documentation

timeSelector (  ) 

Construct Null.

Definition at line 26 of file timeSelector.C.

timeSelector ( Istream &  is  ) 

Construct from Istream.

Definition at line 32 of file timeSelector.C.


Member Function Documentation

bool selected ( const instant &  value  )  const

Return true if the given instant is within the ranges.

Definition at line 40 of file timeSelector.C.

Referenced by timeSelector::selected().

Here is the caller graph for this function:

Foam::List< bool > selected ( const List< instant > &  Times  )  const

Return the set of selected instants in the given list that are.

within the ranges

Definition at line 46 of file timeSelector.C.

References timeSelector::selected(), and instant::value().

Here is the call graph for this function:

Foam::List< Foam::instant > select ( const List< instant > &  Times  )  const

Select a list of Time values that are within the ranges.

Definition at line 93 of file timeSelector.C.

void inplaceSelect ( List< instant > &  Times  )  const

Select a list of Time values that are within the ranges.

Definition at line 102 of file timeSelector.C.

References Foam::subset().

Here is the call graph for this function:

void addOptions ( const bool  constant = true,
const bool  zeroTime = false 
) [static]

Add the options handled by timeSelector to argList::validOptions.

Parameters:
constant Add the -constant option to include the constant/ directory
zeroTime Enable the -zeroTime option and alter the normal time selection behaviour (and -latestTime behaviour) to exclude the 0/ directory. The 0/ directory will only be included when -zeroTime is specified. The -noZero option has precedence over the -zeroTime option.

Definition at line 111 of file timeSelector.C.

References Foam::inplaceSubset().

Here is the call graph for this function:

Foam::List< Foam::instant > select ( const List< instant > &  timeDirs,
const argList &  args 
) [static]

Return the set of times selected based on the argList options.

Definition at line 131 of file timeSelector.C.

Foam::List< Foam::instant > select0 ( Time &  runTime,
const argList &  args 
) [static]

Return the set of times selected based on the argList options.

also set the runTime to the first instance

Definition at line 223 of file timeSelector.C.


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd