Programming Reference for VirtualLab Fusion  2025.1
Loading...
Searching...
No Matches
PhysicalValue Class Reference

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

Inheritance diagram for PhysicalValue:
PhysicalValueBase

Public Member Functions

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

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.
 
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.
 
- 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.
 

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.
 
MeasuredQuantity MeasuredQuantity [get, set]
 Gets and sets the measured quantity (e.g. length) of the physical value.
 
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/6]

PhysicalValue ( double  value,
PhysicalProperty  physicalProperty 
)

Default constructor.

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

◆ PhysicalValue() [2/6]

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/6]

PhysicalValue ( double  value,
MeasuredQuantity  measuredQuantity 
)

Default constructor.

Parameters
valueThe value of the PhysicalValue.
measuredQuantityThe measured quantity of the physical value (e.g. length).

◆ PhysicalValue() [4/6]

PhysicalValue ( double  value,
MeasuredQuantity  measuredQuantity,
string  comment 
)

Constructor with a comment string.

Parameters
valueThe value of the PhysicalValue.
measuredQuantityThe measured quantity of the physical value (e.g. length).
commentA comment specifying what the PhysicalValue actually is.

◆ PhysicalValue() [5/6]

PhysicalValue ( PhysicalValue  physicalValue)

Copy constructor.

Parameters
physicalValuePhysicalValue to copy

◆ PhysicalValue() [6/6]

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)

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

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

◆ ToString() [3/3]

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

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.