IntegerValue#
- class ansys.tools.variableinterop.scalar_values.IntegerValue#
Bases:
numpy.int64,ansys.tools.variableinterop.variable_value.IVariableValueStores a value as an
IntegerValuevariable type.In Python, the
IntegerValuetype is implemented by extending NumPy’s int64 type. This means that they will decay naturally intonumpy.int64objects when using NumPy’s arithmetic operators. It also means that they inherit many of the NumPy behaviors, which may be slightly different from the behaviors specified in the variable interop standards. For example, when converting from real to integer, the value is floored instead of rounded. If you want the variable interop standard conversions, use theto_real_value()method on this class to get aRealValue type, which is rounded according to the variable interop standards and decomposes naturally into anumpy.float64type. Other conversions to analogous Python or NumPy types are identical between the variable interop standards and the default Python and NumPy behaviors.
Overview#
Invoke the visitor pattern of this object using the passed-in visitor |
|
Convert the value to an API string. |
|
Convert this |
|
Convert the value to a formatted string. |
Variable type of the object. |
Create an |
Import detail#
from ansys.tools.variableinterop.scalar_values import IntegerValue
Property detail#
- property IntegerValue.variable_type: ansys.tools.variableinterop.variable_type.VariableType#
Variable type of the object.
- Returns:
VariableTypeVariable type of the object.
Method detail#
- IntegerValue.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:
- visitor
IVariableValueVisitor Visitor object to call.
- visitor
- Returns:
TResults of the visitor invocation.
- IntegerValue.to_api_string(context: ansys.tools.variableinterop.isave_context.ISaveContext | None = None) str#
Convert the value to an API string.
- Returns:
strString appropriate for use in files and APIs.
- IntegerValue.to_real_value() RealValue#
Convert this
IntegerValuetype to aRealValuetype.Because a
RealValuetype is a 64-bit floating point number, it has a 52-bit mantissa. That means that a portion of the range of 64-bitIntegerValuetypes cannot be completely accurately represented byRealValuetypes. This conversion is sometimes lossy forIntegerValuetypes of sufficient magnitude.- Returns:
RealValueRealValuetype with the same numeric value as theIntegerValuetype.
- static IntegerValue.from_api_string(value: str) IntegerValue#
Create an
IntegerValuetype from an API string.Leading and trailing whitespace is ignored. Values that can be correctly parsed as floating-point numbers are parsed in that manner and then rounded to integers. When rounding, values with a 5 in the tenths place are rounded away from zero.
- Parameters:
- value
str String to parse.
- value
- Returns:
IntegerValueIntegerValuetype parsed from the API string.