RealValue#

class RealValue(value)#

Bases: numpy.float64, ansys.tools.variableinterop.variable_value.IVariableValue

Stores a value as a RealValue variable type.

Overview#

accept

Invoke the visitor pattern of this object using the passed-in visitor

to_api_string

Convert the value to an API string.

to_int_value

Convert this RealValue type to an IntegerValue type.

to_boolean_value

Convert this RealValue``type to a ``BooleanValue type.

to_display_string

Convert the value to a formatted string.

variable_type

Variable type of the object.

from_api_string

Convert an API string back into a RealValue type.

__str__

Return str(self).

Import detail#

from ansys.tools.variableinterop.scalar_values import RealValue

Property detail#

property RealValue.variable_type: VariableType#

Variable type of the object.

Returns:
VariableType

Variable type of the object.

Method detail#

RealValue.accept(visitor: ansys.tools.variableinterop.ivariable_visitor.IVariableValueVisitor[ansys.tools.variableinterop.ivariable_visitor.T]) ansys.tools.variableinterop.ivariable_visitor.T#

Invoke the visitor pattern of this object using the passed-in visitor implementation.

Parameters:
visitorIVariableValueVisitor

Visitor object to call.

Returns:
T

Results of the visitor invocation.

RealValue.to_api_string(context: ansys.tools.variableinterop.isave_context.ISaveContext | None = None) str#

Convert the value to an API string.

Returns:
str

String appropriate for use in files and APIs.

RealValue.__str__() str#

Return str(self).

static RealValue.from_api_string(value: str) RealValue#

Convert an API string back into a RealValue type.

Parameters:
valuestr

String to convert.

RealValue.to_int_value() IntegerValue#

Convert this RealValue type to an IntegerValue type.

The conversion is performed according to the type interoperability specifications. The value is rounded to the nearest integer, where values with a 5 in the tenths place are always rounded away from zero. (Note that this is different from the default Python rounding behavior.)

Returns:
IntegerValue

IntegerValue type that is the result of rounding this value to the nearest integer. (Values with a 5 in the tenths place are rounded away from zero.)

RealValue.to_boolean_value() BooleanValue#

Convert this RealValue``type to a ``BooleanValue type.

The conversion is performed according to the type interoperability specifications. Any value other than exactly 0 is considered to be True.

Returns:
BooleanValue

BooleanValue type that is the result of converting the RealValue type.

RealValue.to_display_string(locale_name: str) str#

Convert the value to a formatted string.

Parameters:
locale_namestr

Locale to format the string in.

Returns:
str

String appropriate for use in user-facing areas.