Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::CaseOptionSimpleT< T > Class Template Reference

Simple data set option (real, integer, boolean, ...). More...

#include <arcane/core/CaseOptionSimple.h>

Public Types

typedef CaseOptionSimpleT< T > ThatClass
typedef CaseOptionTraitsT< T >::ContainerType Type
 Option type.

Public Member Functions

 CaseOptionSimpleT (const CaseOptionBuildInfo &cob)
 CaseOptionSimpleT (const CaseOptionBuildInfo &cob, const String &physical_unit)
virtual void print (const String &lang, std::ostream &o) const
 Prints the option value in the language lang, to the stream o.
const Typevalue () const
 Returns the value of the option.
 operator const Type & () const
 Value of the option.
Type valueAtParameter (Real t) const
 Returns the value of the option for the real parameter t.
Type valueAtParameter (Integer t) const
 Returns the value of the option for the integer parameter t.
const Typeoperator() () const
 Returns the value of the option.
ARCANE_DEPRECATED Type operator() (Real t) const
 Returns the value of the option for the real parameter t.
ARCANE_DEPRECATED Type operator() (Integer t) const
 Returns the value of the option for the integer parameter t.
virtual void updateFromFunction (Real current_time, Integer current_iteration)
void setDefaultValue (const Type &def_value)
 Sets the default value of the option.
const TypevalueIfPresentOrArgument (const Type &arg_value)
 Returns the value of the option if isPresent()==true or otherwise arg_value.
Public Member Functions inherited from Arcane::CaseOptionSimple
 CaseOptionSimple (const CaseOptionBuildInfo &cob)
 CaseOptionSimple (const CaseOptionBuildInfo &cob, const String &physical_unit)
bool isPresent () const
 Returns true if the option is present.
 ARCANE_DEPRECATED_LONG_TERM ("Y2022: Do not access XML item from option") XmlNode element() const
 Returns the element of the option.
ICaseFunctionfunction () const override
 Function associated with this option (0 if none).
virtual IStandardFunctionstandardFunction () const
 Standard function associated with this option (0 if none).
bool hasChangedSinceLastIteration () const
 Indicates if the value has changed since the last iteration.
String xpathFullName () const
 Full name in the format provided by the XPath standard.
String defaultPhysicalUnit () const
 Default physical unit for this option (null if no unit), specified in the .axl file.
String physicalUnit () const
 Physical unit specified in the data set (null if no unit).
IPhysicalUnitConverterphysicalUnitConverter () const
 Physical unit converter.
bool isOptional () const
 Indicates if the option is optional.
bool hasValidValue () const
 Indicates if the option has an invalid value.
void visit (ICaseDocumentVisitor *visitor) const override
 Applies the visitor to this option.
Public Member Functions inherited from Arcane::CaseOptionBase
String trueName () const
 Returns the true name (untranslated) of the option.
String name () const
 Returns the option name corresponding to the data set language.
String translatedName (const String &lang) const
 Name of the option in the language lang. Returns name() if no translation exists.
void search (bool is_phase1)
 Retrieves the value from the configuration file for the variable.
ICaseMngcaseMng () const
 Case manager.
ICaseOptionListparentOptionList () const
 Parent OptionList.
ITraceMngtraceMng () const
 Trace manager.
ISubDomainsubDomain () const
 Sub-domain manager.
ICaseDocumentcaseDocument () const
 Returns the document manager.
ICaseDocumentFragmentcaseDocumentFragment () const
 Returns the document associated with this option.
void setRootElement (const XmlNode &root_element)
 Positions the root element at root_element.
XmlNode rootElement () const
 Returns the root element of the DOM.
Integer minOccurs () const
 Minimum number of occurrences (for a multiple option).
Integer maxOccurs () const
 Maximum number of occurrences (for a multiple option) (-1 == unbounded).
bool isOptional () const
 Allows knowing if an option is optional.
void addAlternativeNodeName (const String &lang, const String &name)
 Adds a translation for the option name.
void addDefaultValue (const String &category, const String &value)
 Adds the default value value to the category category.
void checkIsInitialized () const
 Throws an exception if the option has not been initialized.

Protected Member Functions

virtual void _search (bool is_phase1)
 Searches for the option value in the data set.
virtual bool _allowPhysicalUnit ()
Protected Member Functions inherited from Arcane::CaseOptionSimple
void _setChangedSinceLastIteration (bool has_changed)
void _searchFunction (XmlNode &velem)
void _setPhysicalUnit (const String &value)
void _setHasValidValue (bool v)
XmlNode _element () const
Protected Member Functions inherited from Arcane::CaseOptionBase
 CaseOptionBase (const CaseOptionBuildInfo &cob)
String _defaultValue () const
 Returns the default value of the option or 0 if none exists.
void _setDefaultValue (const String &def_value)
void _setIsInitialized ()
bool _isInitialized () const
void _checkIsInitialized () const
void _checkMinMaxOccurs (Integer nb_occur)
String _xpathFullName () const

Additional Inherited Members

Static Protected Member Functions inherited from Arcane::CaseOptionSimple
static String _convertFunctionRealToString (ICaseFunction *func, Real t)
static String _convertFunctionIntegerToString (ICaseFunction *func, Integer t)

Detailed Description

template<class T>
class Arcane::CaseOptionSimpleT< T >

Simple data set option (real, integer, boolean, ...).

The most used method of this class is the operator()() which allows retrieving the option's value. If a function (ICaseFunction) is associated with the option, it is possible to retrieve the option's value at the physical time or at the iteration passed as a parameter to the method valueAtParameter().

CaseOptionSimpleT<Real> real_option;
Real v = real_option(); // uses operator()
Real v = real_option; // uses implicit cast operator
Real v = real_option.valueAtParameter(0.3); // value at physical time 0.3
Type valueAtParameter(Real t) const
Returns the value of the option for the real parameter t.
double Real
Type representing a real number.

Definition at line 210 of file CaseOptionSimple.h.

Member Typedef Documentation

◆ ThatClass

template<class T>
typedef CaseOptionSimpleT<T> Arcane::CaseOptionSimpleT< T >::ThatClass

Definition at line 215 of file CaseOptionSimple.h.

◆ Type

template<class T>
typedef CaseOptionTraitsT<T>::ContainerType Arcane::CaseOptionSimpleT< T >::Type

Option type.

Definition at line 217 of file CaseOptionSimple.h.

Constructor & Destructor Documentation

◆ CaseOptionSimpleT() [1/2]

template<typename T>
Arcane::CaseOptionSimpleT< T >::CaseOptionSimpleT ( const CaseOptionBuildInfo & cob)

Definition at line 367 of file CaseOptionSimple.cc.

◆ CaseOptionSimpleT() [2/2]

template<typename T>
Arcane::CaseOptionSimpleT< T >::CaseOptionSimpleT ( const CaseOptionBuildInfo & cob,
const String & physical_unit )

Definition at line 377 of file CaseOptionSimple.cc.

Member Function Documentation

◆ _allowPhysicalUnit()

template<typename T>
bool Arcane::CaseOptionSimpleT< T >::_allowPhysicalUnit ( )
protectedvirtual

Implements Arcane::CaseOptionSimple.

Definition at line 387 of file CaseOptionSimple.cc.

◆ _search()

template<typename T>
void Arcane::CaseOptionSimpleT< T >::_search ( bool is_phase1)
protectedvirtual

◆ operator const Type &()

template<class T>
Arcane::CaseOptionSimpleT< T >::operator const Type & ( ) const
inline

Value of the option.

Definition at line 238 of file CaseOptionSimple.h.

◆ operator()() [1/3]

template<class T>
const Type & Arcane::CaseOptionSimpleT< T >::operator() ( ) const
inline

Returns the value of the option.

Definition at line 248 of file CaseOptionSimple.h.

◆ operator()() [2/3]

template<class T>
ARCANE_DEPRECATED Type Arcane::CaseOptionSimpleT< T >::operator() ( Integer t) const
inline

Returns the value of the option for the integer parameter t.

Definition at line 267 of file CaseOptionSimple.h.

◆ operator()() [3/3]

template<class T>
ARCANE_DEPRECATED Type Arcane::CaseOptionSimpleT< T >::operator() ( Real t) const
inline

Returns the value of the option for the real parameter t.

Definition at line 261 of file CaseOptionSimple.h.

◆ print()

template<typename T>
void Arcane::CaseOptionSimpleT< T >::print ( const String & lang,
std::ostream & o ) const
virtual

Prints the option value in the language lang, to the stream o.

Implements Arcane::CaseOptionBase.

Definition at line 643 of file CaseOptionSimple.cc.

References Arcane::CaseOptionSimple::hasValidValue().

◆ setDefaultValue()

template<typename T>
void Arcane::CaseOptionSimpleT< T >::setDefaultValue ( const Type & def_value)

Sets the default value of the option.

If the option is not present in the data set, its value will be that specified by the argument def_value; otherwise, calling this method has no effect.

Definition at line 474 of file CaseOptionSimple.cc.

References ARCANE_FATAL, Arcane::builtInPutValue(), and Arcane::CaseOptionSimple::isPresent().

◆ updateFromFunction()

◆ value()

template<class T>
const Type & Arcane::CaseOptionSimpleT< T >::value ( ) const
inline

Returns the value of the option.

Definition at line 231 of file CaseOptionSimple.h.

Referenced by Arcane::CaseOptionSimpleT< Real >::operator const Type &(), and Arcane::CaseOptionSimpleT< Real >::operator()().

◆ valueAtParameter() [1/2]

template<typename T>
CaseOptionSimpleT< T >::Type Arcane::CaseOptionSimpleT< T >::valueAtParameter ( Integer t) const

Returns the value of the option for the integer parameter t.

Definition at line 600 of file CaseOptionSimple.cc.

References Arcane::CaseOptionSimple::function(), and Arcane::CaseOptionSimple::physicalUnitConverter().

◆ valueAtParameter() [2/2]

template<typename T>
CaseOptionSimpleT< T >::Type Arcane::CaseOptionSimpleT< T >::valueAtParameter ( Real t) const

◆ valueIfPresentOrArgument()

template<class T>
const Type & Arcane::CaseOptionSimpleT< T >::valueIfPresentOrArgument ( const Type & arg_value)
inline

Returns the value of the option if isPresent()==true or otherwise arg_value.

Definition at line 288 of file CaseOptionSimple.h.


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