Objects

Properties

Methods

# Quantity Object

Properties

Methods

## Summary

The integral field quantity.

## Details

The Quantity object is used for storing an integral field quantity. You get a Quantity object using the GetIntegral method of the Result object.

The exact type of the integral quantity depends upon the problem kind and integral type. The Quantity object is only a thin wrapper of the value, providing run-time type information and the characteristic value as Double - usually an absolute value.

The QuantityType property returns the exact type of the integral value as QfQuantityType enum.

The Value property returns the value of an integral as a Variant. The Value property is a default property for the Quantity object, so you can omit its name.

The following example shows an integral calculation for the time-harmonic magnetics problem. The problem is formulated and solved beyond this example's bounds.

Dim res As QuickField.Result

..................

Dim resWin As FieldWindow
Dim cont As QuickField.Contour

Set resWin = res.Windows(1)
Set cont = resWin.Contour
' Here we build the contour as a circle with radius = 5 around the origin
With cont
.Delete
End With

' Calculate the contour length
length = res.GetIntegral(qfInt_Length)
'     and cross section square
Square = res.GetIntegral(qfInt_CrossSect)
' Now calculate the total current through the contour
' We use the Quantity object to get the exact type of the value

Dim q As QuickField.Quantity
Set q = res.GetIntegral(qfInt_Jtotal)
' The total current should be a ComplexValue
If q.QuantityType = qfComplex Then
Dim jTotal As ComplexValue
Set jTotal = q.Value
Peak = jTotal.Peak        ' The word Value is defaulted and can be omitted
Effective = jTotal.RMS
End If

Starting from the version QuickField 6.2 the Quantity object is used not only for storing the calculated integral value, but also to calculate the custom user-defined integrand function using the GetValue method of the UserFunction interface. Following methods are used to define the type and value of the physical quantity:

 SetAsScalar method with a real type parameter Assigns the real type value to the object. Type signature - qfScalar. SetAsVector method with two real type parameters Assigns the value of the Point (2D real vector) type to the object. Quantity type is >> qfVector. SetAsComplex method with two real type parameters Assigns the value of the ComplexValue type to the object. Quantity type is >> qfComplex. SetAsComplexVector method with four real type parameters Assigns the value of the ComplexVector type to the object. This type defines a complex vector, 2D vector where both x and y components are complex numbers. Quantity type is >> qfComplexVector. SetAsOscillated method with three real type parameters Assigns the value of the OscillatedValue type to the object, This type defines the scalar physical quantity, which oscillates with double frequency and having non-zero average value per period. Quantity type is qfOscillatedValue. SetAsOscillatedVector method with six real type parameters Assigns the value of the OscillatedVector type to the object.This type defines the vector physical quantity, which oscillates with double frequency and having non-zero average value per period. Quantity type is qfOscillatedVector.