Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::CaseTable Class Reference

Data set function. More...

#include <arcane/core/CaseTable.h>

Inheritance diagram for Arcane::CaseTable:
Collaboration diagram for Arcane::CaseTable:

Public Types

enum  eError {
  ErrNo , ErrBadRange , ErrCanNotConvertParamToRightType , ErrCanNotConvertValueToRightType ,
  ErrNotGreaterThanPrevious , ErrNotLesserThanNext
}
 Types of errors returned by the class. More...
enum  eCurveType { CurveUnknown = 0 , CurveConstant = 1 , CurveLinear = 2 }
 Type of the table curve. More...
Public Types inherited from Arcane::ICaseFunction
enum  eParamType { ParamUnknown = 0 , ParamReal = 1 , ParamInteger = 2 }
 Type of a function parameter. More...
enum  eValueType {
  ValueUnknown = 0 , ValueReal = 1 , ValueInteger = 2 , ValueBool = 3 ,
  ValueString = 4 , ValueReal3 = 5
}
 Type of a function value. More...

Public Member Functions

 CaseTable (const CaseFunctionBuildInfo &info, eCurveType curve_type)
 Constructs a lookup table from the data set.
virtual Integer nbElement () const
 Number of elements in the function.
virtual void valueToString (Integer id, String &str) const
 The i-th value in the string str.
virtual void paramToString (Integer id, String &param) const
 The i-th parameter in the string str.
virtual eError setParam (Integer id, const String &value)
 Modifies the parameter of element id.
virtual eError setValue (Integer id, const String &value)
 Modifies the value of element id.
virtual eError appendElement (const String &param, const String &value)
 Adds an element to the table.
virtual void insertElement (Integer id)
 Inserts a couple (parameter,value) into the function.
virtual void removeElement (Integer id)
 Removes a couple (parameter,value) from the function.
template<typename ParamType, typename ValueType>
void _findValue (ParamType param, ValueType &avalue) const
 Calculates the curve value for the parameter param. The value is stored in value.
Public Member Functions inherited from Arcane::CaseFunction
 CaseFunction (const CaseFunctionBuildInfo &info)
 Constructs a dataset function.
String name () const override
 function name
void setName (const String &new_name) override
 Sets the function name to new_name.
eParamType paramType () const override
 Function parameter type.
eValueType valueType () const override
 Function value type.
void setValueType (eValueType type) override
 Sets the function value type.
void setTransformValueFunction (const String &str) override
 Sets a value transformation function. For now, this is just a multiplicative coefficient. The string str must be convertible to the value type.
String transformValueFunction () const override
 Returns the value transformation function.
void setTransformParamFunction (const String &str) override
 Sets a parameter transformation function. For now, this is just a multiplicative coefficient. It is only applied to real parameters. The string str must be convertible to a real number.
String transformParamFunction () const override
 Parameter transformation function.
void setDeltatCoef (Real v) override
 Sets the value of the deltat multiplier coefficient.
Real deltatCoef () const override
 Value of the deltat multiplier coefficient.
Ref< ICaseFunctiontoReference ()
ITraceMngtraceMng () const
Public Member Functions inherited from Arcane::ICaseFunction
virtual ~ICaseFunction ()=default
 Releases resources.
Public Member Functions inherited from Arcane::ReferenceCounterImpl
void addReference ()
void removeReference ()
void _internalAddReference ()
bool _internalRemoveReference ()

Curve Type

CaseTableParamsm_param_list
UniqueArray< SmallVariantm_value_list
 List of values.
eCurveType m_curve_type
 Curve type.
bool m_use_fast_search = true
virtual eCurveType curveType () const
 Returns the curve type of the function.
virtual void setParamType (eParamType type)
 Sets the function parameter type.
virtual bool checkIfValid () const
 Checks the validity of the function.
virtual void value (Real param, Real &v) const
 Value v of the option for parameter param.
virtual void value (Real param, Integer &v) const
 Value v of the option for parameter param.
virtual void value (Real param, bool &v) const
 Value v of the option for parameter param.
virtual void value (Real param, String &v) const
 Value v of the option for parameter param.
virtual void value (Real param, Real3 &v) const
 Value v of the option for parameter param.
virtual void value (Integer param, Real &v) const
 Value v of the option for parameter param.
virtual void value (Integer param, Integer &v) const
 Value v of the option for parameter param.
virtual void value (Integer param, bool &v) const
virtual void value (Integer param, String &v) const
 Value v of the option for parameter param.
virtual void value (Integer param, Real3 &v) const
 Value v of the option for parameter param.
template<typename U, typename V>
void _findValue (U param, V &value) const
template<typename U, typename V>
void _findValueAndApplyTransform (U param, V &value) const
bool _isValidIndex (Integer index) const
eError _setValue (Integer index, const String &value_str)

Additional Inherited Members

Protected Member Functions inherited from Arcane::CaseFunction
template<typename ParamType>
void _applyParamTransform2 (ParamType &param) const
Real _applyValueComulTransform (Real v, Real comul) const
Integer _applyValueComulTransform (Integer v, Integer comul) const
String _applyValueComulTransform (const String &v, const String &comul) const
bool _applyValueComulTransform (bool v, bool comul) const
Real3 _applyValueComulTransform (Real3 v, Real3 comul) const
void _applyValueTransform (Real &value) const
void _applyValueTransform (Integer &value) const
void _applyValueTransform (String &value) const
void _applyValueTransform (Real3 &value) const
void _applyValueTransform (bool &value) const
template<typename ValueType>
void _applyValueTransform2 (ValueType &value) const
void _applyParamTransform (Real &value) const
void _applyParamTransform (Integer &value) const

Detailed Description

Data set function.

Definition at line 39 of file CaseTable.h.

Member Enumeration Documentation

◆ eCurveType

Type of the table curve.

Enumerator
CurveUnknown 

Unknown curve type.

CurveConstant 

Piecewise constant curve.

CurveLinear 

Piecewise linear curve.

Definition at line 64 of file CaseTable.h.

◆ eError

Types of errors returned by the class.

Enumerator
ErrBadRange 

Indicates that an element index is not valid.

ErrCanNotConvertParamToRightType 

Indicates that converting the parameter to the desired type is impossible.

ErrCanNotConvertValueToRightType 

Indicates that converting the value to the desired type is impossible.

ErrNotGreaterThanPrevious 

Indicates that the parameter is not greater than the previous one.

ErrNotLesserThanNext 

Indicates that the parameter is not less than the next one.

Definition at line 47 of file CaseTable.h.

Constructor & Destructor Documentation

◆ CaseTable()

Arcane::CaseTable::CaseTable ( const CaseFunctionBuildInfo & info,
eCurveType curve_type )

Constructs a lookup table from the data set.

Parameters
curve_typetype of the lookup table curve

Definition at line 45 of file CaseTable.cc.

References Arcane::CaseFunction::CaseFunction(), m_curve_type, and Arcane::CaseFunctionBuildInfo::m_param_type.

Here is the call graph for this function:

◆ ~CaseTable()

Arcane::CaseTable::~CaseTable ( )
virtual

Definition at line 59 of file CaseTable.cc.

Member Function Documentation

◆ _findValue()

template<typename ParamType, typename ValueType>
void Arcane::CaseTable::_findValue ( ParamType param,
ValueType & avalue ) const

Calculates the curve value for the parameter param. The value is stored in value.

Return values
falseon success
trueif error

Definition at line 357 of file CaseTable.cc.

References ARCANE_FATAL, CurveConstant, CurveLinear, Arcane::math::isEqual(), Arcane::math::isZero(), m_curve_type, m_value_list, Arcane::CaseFunction::name(), and nbElement().

Here is the call graph for this function:

◆ _findValueAndApplyTransform()

template<class U, class V>
void Arcane::CaseTable::_findValueAndApplyTransform ( U param,
V & value ) const
private

Definition at line 311 of file CaseTable.cc.

◆ _isValidIndex()

bool Arcane::CaseTable::_isValidIndex ( Integer index) const
private

Definition at line 68 of file CaseTable.cc.

◆ _setValue()

CaseTable::eError Arcane::CaseTable::_setValue ( Integer index,
const String & value_str )
private

Definition at line 186 of file CaseTable.cc.

◆ appendElement()

CaseTable::eError Arcane::CaseTable::appendElement ( const String & param,
const String & value )
virtual

Adds an element to the table.

Adds the element (param,value) to the table.

Returns
the error value, ErrNo otherwise.
Todo
In case of an error in either, do not change the value of the other.

Definition at line 240 of file CaseTable.cc.

References m_value_list, and value().

Here is the call graph for this function:

◆ checkIfValid()

bool Arcane::CaseTable::checkIfValid ( ) const
virtual

Checks the validity of the function.

Return values
trueif the function is valid,
falseotherwise.

Reimplemented from Arcane::CaseFunction.

Definition at line 302 of file CaseTable.cc.

◆ curveType()

virtual eCurveType Arcane::CaseTable::curveType ( ) const
inlinevirtual

Returns the curve type of the function.

Definition at line 142 of file CaseTable.h.

References m_curve_type.

◆ insertElement()

void Arcane::CaseTable::insertElement ( Integer id)
virtual

Inserts a couple (parameter,value) into the function.

Inserts a couple (parameter,value) identical to the one found at position id. Subsequent parameters are shifted by one position. It is then possible to modify this couple using the methods setParam() or setValue().

If id is greater than the number of elements in the function, an element is added to the end with the same value as the last element of the function.

Definition at line 253 of file CaseTable.cc.

References m_value_list, and nbElement().

Here is the call graph for this function:

◆ nbElement()

Integer Arcane::CaseTable::nbElement ( ) const
virtual

Number of elements in the function.

Definition at line 293 of file CaseTable.cc.

Referenced by _findValue(), and insertElement().

Here is the caller graph for this function:

◆ paramToString()

void Arcane::CaseTable::paramToString ( Integer id,
String & param ) const
virtual

The i-th parameter in the string str.

Definition at line 94 of file CaseTable.cc.

◆ removeElement()

void Arcane::CaseTable::removeElement ( Integer id)
virtual

Removes a couple (parameter,value) from the function.

If id is greater than the number of elements in the function, no operation is performed.

Definition at line 280 of file CaseTable.cc.

References m_value_list.

◆ setParam()

CaseTable::eError Arcane::CaseTable::setParam ( Integer id,
const String & value )
virtual

Modifies the parameter of element id.

Uses value as the new value for the parameter. value must be convertible to the parameter type.

Returns
the error value, ErrNo otherwise.

Definition at line 166 of file CaseTable.cc.

◆ setParamType()

void Arcane::CaseTable::setParamType ( eParamType type)
virtual

Sets the function parameter type.

Reimplemented from Arcane::CaseFunction.

Definition at line 225 of file CaseTable.cc.

References Arcane::CaseFunction::paramType(), and Arcane::CaseFunction::setParamType().

Here is the call graph for this function:

◆ setValue()

CaseTable::eError Arcane::CaseTable::setValue ( Integer id,
const String & value )
virtual

Modifies the value of element id.

Uses value as the new value. value must be convertible to the value type.

Returns
the error value, ErrNo otherwise.

Definition at line 175 of file CaseTable.cc.

◆ value() [1/10]

void Arcane::CaseTable::value ( Integer param,
bool & v ) const
virtual

Implements Arcane::ICaseFunction.

Definition at line 145 of file CaseTable.cc.

◆ value() [2/10]

void Arcane::CaseTable::value ( Integer param,
Integer & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 139 of file CaseTable.cc.

◆ value() [3/10]

void Arcane::CaseTable::value ( Integer param,
Real & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 133 of file CaseTable.cc.

◆ value() [4/10]

void Arcane::CaseTable::value ( Integer param,
Real3 & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 157 of file CaseTable.cc.

◆ value() [5/10]

void Arcane::CaseTable::value ( Integer param,
String & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 151 of file CaseTable.cc.

◆ value() [6/10]

void Arcane::CaseTable::value ( Real param,
bool & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 115 of file CaseTable.cc.

◆ value() [7/10]

void Arcane::CaseTable::value ( Real param,
Integer & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 109 of file CaseTable.cc.

◆ value() [8/10]

void Arcane::CaseTable::value ( Real param,
Real & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 103 of file CaseTable.cc.

Referenced by appendElement().

Here is the caller graph for this function:

◆ value() [9/10]

void Arcane::CaseTable::value ( Real param,
Real3 & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 127 of file CaseTable.cc.

◆ value() [10/10]

void Arcane::CaseTable::value ( Real param,
String & v ) const
virtual

Value v of the option for parameter param.

Implements Arcane::ICaseFunction.

Definition at line 121 of file CaseTable.cc.

◆ valueToString()

void Arcane::CaseTable::valueToString ( Integer id,
String & str ) const
virtual

The i-th value in the string str.

Definition at line 82 of file CaseTable.cc.

References m_value_list.

Member Data Documentation

◆ m_curve_type

eCurveType Arcane::CaseTable::m_curve_type
private

Curve type.

Definition at line 165 of file CaseTable.h.

Referenced by _findValue(), CaseTable(), and curveType().

◆ m_param_list

CaseTableParams* Arcane::CaseTable::m_param_list
private

Definition at line 163 of file CaseTable.h.

◆ m_use_fast_search

bool Arcane::CaseTable::m_use_fast_search = true
private

Definition at line 166 of file CaseTable.h.

◆ m_value_list

UniqueArray<SmallVariant> Arcane::CaseTable::m_value_list
private

List of values.

Definition at line 164 of file CaseTable.h.

Referenced by _findValue(), appendElement(), insertElement(), removeElement(), and valueToString().


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