FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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

#include <OpenFOAM/timeSelector.H>


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 <OpenFOAM/setRootCase.H>
#include <OpenFOAM/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 90 of file timeSelector.H.

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.

Constructor & Destructor Documentation

timeSelector (  )

Construct Null.

Definition at line 34 of file timeSelector.C.

timeSelector ( Istream &   is  )

Construct from Istream.

Definition at line 40 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 48 of file timeSelector.C.

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

Referenced by timeSelector::select().

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 54 of file timeSelector.C.

References forAll, Foam::name(), and List< T >::size().

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

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

Definition at line 101 of file timeSelector.C.

References Foam::subset().

Referenced by timeSelector::select0().

void inplaceSelect ( List< instant > &   Times  ) const

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

Definition at line 110 of file timeSelector.C.

References Foam::inplaceSubset().

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

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

Parameters:
constantAdd the -constant option to include the constant/ directory
zeroTimeEnable 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 119 of file timeSelector.C.

References HashTable< T, Key, Hash >::insert(), and argList::validOptions.

Referenced by main().

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 139 of file timeSelector.C.

References forAll, Foam::name(), argList::optionFound(), argList::optionLookup(), timeSelector::selected(), List< T >::size(), Foam::subset(), and argList::validOptions.

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 231 of file timeSelector.C.

References args, UList< T >::empty(), argList::executable(), Foam::exit(), Foam::FatalError, FatalErrorIn, timeSelector::select(), Time::setTime(), and Time::times().

Referenced by main().


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