Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::TimeUnitBehavior Class Reference

#include <gromacs/options/timeunitmanager.h>

+ Inheritance diagram for gmx::TimeUnitBehavior:
+ Collaboration diagram for gmx::TimeUnitBehavior:

Description

Options behavior to add a time unit option.

This class provides functionality to add a time unit option that affects the input unit for time options (specified with FloatOption::timeValue() or DoubleOption::timeValue()). When options are finished, it scales each time option such that any user-given values are interpreted as given in the time unit specified by the user, and scaled to picoseconds. Programmatically given values (e.g., as default values for the options) are not scaled.

Public Member Functions

TimeUnit timeUnit () const
 Returns the current time unit.
 
void setTimeUnit (TimeUnit unit)
 Sets the time unit.
 
void setTimeUnitStore (TimeUnit *store)
 Sets a storage location for the selected time unit. More...
 
void setTimeUnitFromEnvironment ()
 Sets the default time unit from an environment variable. More...
 
void addTimeUnitOption (IOptionsContainer *options, const char *name)
 Adds a common option for selecting the time unit. More...
 
void initBehavior (Options *) override
 Called when the behavior is associated with an options object. More...
 
void optionsFinishing (Options *options) override
 Called when all option values have been assigned. More...
 
void optionsFinished () override
 Called when all option values have been processed. More...
 

Member Function Documentation

void gmx::TimeUnitBehavior::addTimeUnitOption ( IOptionsContainer options,
const char *  name 
)

Adds a common option for selecting the time unit.

Parameters
[in,out]optionsOptions to which the common option is added.
[in]nameName of the option to add.

Adds an enum option to options to select the time unit for this behavior.

void gmx::TimeUnitBehavior::initBehavior ( Options options)
inlineoverridevirtual

Called when the behavior is associated with an options object.

This method can, e.g., use Options::addManager() to associate managers with the options object.

Implements gmx::IOptionsBehavior.

void gmx::TimeUnitBehavior::optionsFinished ( )
inlineoverridevirtual

Called when all option values have been processed.

This is called after Options::finish() (and typically after higher-level optionsFinished() methods, such as that in ICommandLineOptionsModule). This can add behavior that performs tasks based on the option values provided.

Implements gmx::IOptionsBehavior.

void gmx::TimeUnitBehavior::optionsFinishing ( Options options)
overridevirtual

Called when all option values have been assigned.

This is called just before Options::finish(), and can, e.g., do operations that still influence the option values.

Implements gmx::IOptionsBehavior.

void gmx::TimeUnitBehavior::setTimeUnitFromEnvironment ( )

Sets the default time unit from an environment variable.

This should be called before addTimeUnitOption() for consistent behavior.

void gmx::TimeUnitBehavior::setTimeUnitStore ( TimeUnit store)

Sets a storage location for the selected time unit.

Parameters
[in]storeLocation that will receive the selected time unit.

*store will be set to the time unit selected by the user (or programmatically). The value is guaranteed to be set once the options have been finished.


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