Gromacs
2024.4
|
#include <gromacs/options/timeunitmanager.h>
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... | |
void gmx::TimeUnitBehavior::addTimeUnitOption | ( | IOptionsContainer * | options, |
const char * | name | ||
) |
Adds a common option for selecting the time unit.
[in,out] | options | Options to which the common option is added. |
[in] | name | Name of the option to add. |
Adds an enum option to options
to select the time unit for this behavior.
|
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.
|
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.
|
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.
[in] | store | Location 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.