Programming Reference for VirtualLab Fusion  2022.1
Public Member Functions | Static Public Member Functions | Properties | List of all members
PhysicalValue Class Reference

class for a double value with a physical unit. More...

Inheritance diagram for PhysicalValue:
PhysicalValueBase

Public Member Functions

 PhysicalValue (double value, PhysicalProperty physicalProperty)
 Default constructor More...
 
 PhysicalValue (double value, PhysicalProperty physicalProperty, string comment)
 Constructor with a comment string. More...
 
 PhysicalValue (PhysicalValue physicalValue)
 Copy constructor More...
 
 PhysicalValue (SerializationInfo info, StreamingContext context)
 Deserialization constructor. See the ISerializable interface for more details. More...
 
override string ToString ()
 Overridden ToString function. The PhysicalValue is formatted like "1 nm". More...
 
override string ToString (int significantDigits)
 Overridden ToString function. The PhysicalValue is formatted like "1 nm". More...
 
override string ToString (string format, IFormatProvider formatProvider=null)
 Overridden ToString function provided by the IFormattable interface. Returns a System.String that represents this instance. More...
 
- Public Member Functions inherited from PhysicalValueBase
override bool Equals (object otherObject, EqualityIntent equalityIntent)
 Determines whether the specified Object is equal to this instance. More...
 
Complex GetComplexValue ()
 Gets the actual value as a complex number. More...
 
 PhysicalValueBase (PhysicalProperty physicalProperty)
 Standard constructor More...
 
 PhysicalValueBase (PhysicalProperty physicalProperty, string comment)
 Standard constructor More...
 
 PhysicalValueBase (PhysicalValueBase physicalValueBase)
 Copy constructor More...
 
 PhysicalValueBase (SerializationInfo info, StreamingContext context)
 Deserialization constructor. See the ISerializable interface for more details. More...
 
abstract string ToString (int significantDigits)
 Returns a System.String that represents this instance. More...
 
abstract string ToString (string format, IFormatProvider formatProvider=null)
 ToString function provided by the IFormattable interface. Returns a System.String that represents this instance. More...
 

Static Public Member Functions

static bool operator!= (PhysicalValue value1, PhysicalValue value2)
 Compares two PhysicalValue for inequality. The comparison will be done by comparing the values, units, and comments, respectively. More...
 
static bool operator== (PhysicalValue value1, PhysicalValue value2)
 Compares two PhysicalValue for equality. The comparison will be done by comparing the values, units, and comments, respectively. More...
 
- Static Public Member Functions inherited from PhysicalValueBase
static string GetFormatString (bool showPhysicalUnits, int numberOfDigits, ComplexToStringConversionFormat? complexNumberFormat=null)
 Gets the format string which can be used for the ToString method. More...
 

Properties

virtual double Value [get, set]
 The value of the PhysicalValue.
 
- Properties inherited from PhysicalValueBase
object ActualParameterRunResult [get]
 Gets the actual parameter run result.
 
string Comment [get, set]
 A comment specifying what the PhysicalValue actually is.
 
virtual PhysicalProperty PhysicalProperty [get, set]
 The unit of the PhysicalValue.
 

Detailed Description

class for a double value with a physical unit.

Constructor & Destructor Documentation

◆ PhysicalValue() [1/4]

PhysicalValue ( double  value,
PhysicalProperty  physicalProperty 
)

Default constructor

Parameters
valueThe value of the PhysicalValue.
physicalPropertyThe unit of the PhysicalValue.

◆ PhysicalValue() [2/4]

PhysicalValue ( double  value,
PhysicalProperty  physicalProperty,
string  comment 
)

Constructor with a comment string.

Parameters
valueThe value of the PhysicalValue.
physicalPropertyThe unit of the PhysicalValue.
commentA comment specifying what the PhysicalValue actually is.

◆ PhysicalValue() [3/4]

PhysicalValue ( PhysicalValue  physicalValue)

Copy constructor

Parameters
physicalValuePhysicalValue to copy

◆ PhysicalValue() [4/4]

PhysicalValue ( SerializationInfo  info,
StreamingContext  context 
)

Deserialization constructor. See the ISerializable interface for more details.

Parameters
infoSerializationInfo
contextStreamingContext

Member Function Documentation

◆ operator!=()

static bool operator!= ( PhysicalValue  value1,
PhysicalValue  value2 
)
static

Compares two PhysicalValue for inequality. The comparison will be done by comparing the values, units, and comments, respectively.

Parameters
value1First PhysicalValue object to compare.
value2Second PhysicalValue object to compare.
Returns
Returns true if the two objects are unequal.

◆ operator==()

static bool operator== ( PhysicalValue  value1,
PhysicalValue  value2 
)
static

Compares two PhysicalValue for equality. The comparison will be done by comparing the values, units, and comments, respectively.

Parameters
value1First PhysicalValue object to compare.
value2Second PhysicalValue object to compare.
Returns
Returns true if the two objects are equal.

◆ ToString() [1/3]

override string ToString ( )

Overridden ToString function. The PhysicalValue is formatted like "1 nm".

Returns
The formatted value.

◆ ToString() [2/3]

override string ToString ( int  significantDigits)
virtual

Overridden ToString function. The PhysicalValue is formatted like "1 nm".

Parameters
significantDigitsThe number of significant digits.
Returns
The formatted value.

Implements PhysicalValueBase.

◆ ToString() [3/3]

override string ToString ( string  format,
IFormatProvider  formatProvider = null 
)
virtual

Overridden ToString function provided by the IFormattable interface. Returns a System.String that represents this instance.

Parameters
formatThe format. "U" or an empty string means that the string is formatted with units (e.g. "1 nm"). "G" means that the string is formatted without units (e.g. "1e-9"). "F" means that the string is formatted as "{Comment} of {Value with units}" (e.g. "wavelength of 300 nm").

In all cases you can add a number to specify the number of digits that shall be used. E.g. "U3" results in "1.23 nm", while "U4" results in "1.234 nm". You can add further formatting commands after a comma, but these are ignored. This behavior ensures that the same formatting strings can be used for both PhysicalValue and PhysicalValueComplex.

For any other string the ToString(format, formatProvider) of the Value is used.

Parameters
formatProviderOptional culture specific format provider used for formatting the value (if format is not "U" or "F").
Returns
A System.String that represents this instance.

Implements PhysicalValueBase.