Table of Contents

Class HarmonicFieldsSet

Namespace
VirtualLabAPI.Core.FieldRepresentations
Assembly
VirtualLabAPI.dll

Class containing a set of harmonic fields (i.e. of instances of class ComplexAmplitude).

[Serializable]
public class HarmonicFieldsSet : HarmonicFieldBase, IDeserializationCallback, IDisposable, IDocument, IEquatable<IObjectBase>, ICloneable, ISerializable
Inheritance
ObjectBase
SerializableObjectBase
ManualSerialization
HarmonicFieldsSet
Implements
IEquatable<IObjectBase>
Inherited Members
Extension Methods

Constructors

HarmonicFieldsSet()

Default Constructor

public HarmonicFieldsSet()

HarmonicFieldsSet(params ComplexAmplitude[])

Constructor for generating a HarmonicFieldsSet out of list of harmonic field. All harmonic fields must be of the same type, must have the same dimensionality, polarization, and embedding medium - otherwise an ArgumentException is raised.

public HarmonicFieldsSet(params ComplexAmplitude[] fields)

Parameters

fields ComplexAmplitude[]

Either a single ComplexAmplitude object or an array of ComplexAmplitude objects.

HarmonicFieldsSet(HarmonicFieldsSet)

Copy constructor.

public HarmonicFieldsSet(HarmonicFieldsSet sf)

Parameters

sf HarmonicFieldsSet

field to copy.

Properties

Count

Get the number of complex amplitude fields in the HarmonicFieldsSet.

public int Count { get; }

Property Value

int

FieldRepresentation

Returns HarmonicFieldsSet as field representation.

public override FieldRepresentation FieldRepresentation { get; }

Property Value

FieldRepresentation

FileExtension

Gets the file extension.

public override string FileExtension { get; }

Property Value

string

HasAtLeastOneGloballyPolarizedField

Gets whether at least one member field is globally polarized.

public bool HasAtLeastOneGloballyPolarizedField { get; }

Property Value

bool

HasAtLeastOneSphericalPhaseRadius

Gets whether at least one member field has an analytical spherical phase radius.

public bool HasAtLeastOneSphericalPhaseRadius { get; }

Property Value

bool

HasAtLeatOneLocallyPolarizedField

Gets whether at least one member field is locally polarized.

public bool HasAtLeatOneLocallyPolarizedField { get; }

Property Value

bool

IsOneD

Returns true if the first member is one dimensional.

public virtual bool IsOneD { get; }

Property Value

bool

IsSpatial

Gets and sets whether all member fields are in spatial domain (if true) or spectral domain (if false).

public override bool IsSpatial { get; set; }

Property Value

bool

this[int]

Indexer for access to the ComplexAmplitude object the harmonic fields set consists of with the possibility to check consistency.

public virtual ComplexAmplitude this[int index] { get; set; }

Parameters

index int

Property Value

ComplexAmplitude

this[int, int]

Advanced indexer for the harmonic fields set The indexer is two-dimensional. The first index value is the index of the wavelength which shall be investigated. The (sorted) list of wavelengths can be evaluated by the method GetSortedListOfWavelength(). The second index value is the indexer for the incoherent mode of the specified wavelength index. The number of incoherent modes for a specific wavelength can be investigated by the method GetNumberOfIncoherentModesPerWavelength(double wavelength). In case that the index which shall be investigated is not valid, an ArgumentException is thrown, which contains additional information.

public ComplexAmplitude this[int wavelengthIndex, int incoherentIndex] { get; set; }

Parameters

wavelengthIndex int

The index value for the wavelength.

incoherentIndex int

The index value for the incoherent mode.

Property Value

ComplexAmplitude

The complex amplitude within the harmonic fields set for the wavelength index and the incoherent-mode index.

PropagatesInPositiveZDirection

Gets or sets whether the sign of the z-component of the k-vector is positive or not.

public override bool PropagatesInPositiveZDirection { get; set; }

Property Value

bool

TypeOfDocument

Gets an enum entry specifying the type of the document.

public override DocumentType TypeOfDocument { get; }

Property Value

DocumentType

Methods

Add(ComplexAmplitude)

Checks whether the passed parameter is a complexAmplitudeField type and adds it to either file list in RAM or file list in hard disk and returns index.

public virtual int Add(ComplexAmplitude ca)

Parameters

ca ComplexAmplitude

Returns

int

index of file

Add(HarmonicFieldsSet)

Adds all member fields of a given harmonic fields set. The same consistency rules as for adding single fields apply (for example a spectral harmonic fields set cannot be added to a spatial one).

public void Add(HarmonicFieldsSet hfsToAdd)

Parameters

hfsToAdd HarmonicFieldsSet

The HarmonicFieldsSet object to add.

ClearAdvancedIndexerCache()

public help method to clear the cache which is used for the advanced indexer

public void ClearAdvancedIndexerCache()

Clone()

Clones the present Harmonic Fields Set object.

public override object Clone()

Returns

object

CopyCoordinateSystemsFromOtherHFS(HarmonicFieldsSet)

support method to copy the coordinate system information from the source HFS to the current instance

public void CopyCoordinateSystemsFromOtherHFS(HarmonicFieldsSet hfsSource)

Parameters

hfsSource HarmonicFieldsSet

the harmonic fields set from which the coordinate information shall be copied

Equals(object, EqualityIntent)

Determines whether the specified object is equal to this instance.

public override bool Equals(object otherObject, EqualityIntent equalityIntent)

Parameters

otherObject object

The object to compare with this instance.

equalityIntent EqualityIntent

Defines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

GetCoordinateSystemForMember(int)

public property to get the Cartesian coordinate system that is associated with the member at index #indexMember

public CartesianCoordinateSystem GetCoordinateSystemForMember(int indexMember)

Parameters

indexMember int

the index for which the CS shall be evaluated

Returns

CartesianCoordinateSystem

the Cartesian coordinate system for the member at index #indexMember

GetFields()

Gets all member fields in the harmonic field.

public override IEnumerable<ComplexAmplitude> GetFields()

Returns

IEnumerable<ComplexAmplitude>

Collection of the member fields.

GetNumberOfIncoherentModesPerWavelength(double)

Public support method which can be used to get the number of incoherent modes for a specified wavelength.

public int GetNumberOfIncoherentModesPerWavelength(double wavelength)

Parameters

wavelength double

The wavelength for which the number of incoherent modes should be evaluated.

Returns

int

The number of incoherent modes which have the specified wavelength.

GetSortedListOfWavelength()

Public support method which provides a sorted list of all wavelengths present in the harmonic fields set.

public List<double> GetSortedListOfWavelength()

Returns

List<double>

A sorted list of the wavelengths which are stored within the harmonic fields set.

IndexWiseSummation(HarmonicFieldsSet)

Index wise summation of two harmonic fields, i.e. this[i] + hfs[i] (Complex Amplitude Summation)

public HarmonicFieldsSet IndexWiseSummation(HarmonicFieldsSet hfs)

Parameters

hfs HarmonicFieldsSet

The second harmonic fields set to add to this harmonic fields set.

Returns

HarmonicFieldsSet

The resulting harmonic fields set.

Insert(int, ComplexAmplitude)

Insert a ComplexAmplitude into the list.

public virtual void Insert(int index, ComplexAmplitude ca)

Parameters

index int

The index at which the field shall be inserted.

ca ComplexAmplitude

The field to insert.

Load(string)

Loads the specified file name. Works independently from whether the document has been saved without view settings (as prior to VirtualLab 6.0) or with view settings.

public static HarmonicFieldsSet Load(string fileName)

Parameters

fileName string

Name of the file.

Returns

HarmonicFieldsSet

The specified document.

ModeNumberString(int, bool)

Creates a string like "Field #1" to ensure the correct sorting in the parameter run. The number of digits is determined from the number of member fields in the harmonic fields set.

public string ModeNumberString(int index, bool omitWavelength = false)

Parameters

index int

The index of the mode. It is converted to two indices (wavelength and incoherent index) and then something like "Wavelength #1: 532 nm; Incoherent Mode #1" is returned.

omitWavelength bool

If this optional parameter is set to true the actual wavelength is not written to the mode string (only the wavelength index). This is necessary for e.g. the Parameter Run as then the wavelength might change with every iteration.

Returns

string

The formatted string.

ModeString(int, int, bool)

Generates a human-readable string describing the specified mode.

public string ModeString(int indexWavelength, int indexIncoherentMode, bool omitWavelength = false)

Parameters

indexWavelength int

The wavelength index of the mode.

indexIncoherentMode int

The index of the incoherent mode.

omitWavelength bool

If this optional parameter is set to true the actual wavelength is not written to the mode string (only the wavelength index). This is necessary for e.g. the Parameter Run as then the wavelength might change with every iteration.

Returns

string

The wavelength and the incoherent index. The indices start with 1. If there is only one incoherent mode, the incoherent index is not output.

ModeStringTwoIndices(int, double, int, int)

Generates a human-readable string describing the specified mode.

public static string ModeStringTwoIndices(int indexWavelength, double wavelength, int indexIncoherentMode, int numberOfIncoherentModesForWavelength)

Parameters

indexWavelength int

The wavelength index of the mode.

wavelength double

The wavelength itself.

indexIncoherentMode int

The index of the incoherent mode.

numberOfIncoherentModesForWavelength int

The number of incoherent modes for the given wavelength.

Returns

string

The wavelength and the incoherent index. The indices start with 1. If there is only one incoherent mode, the incoherent index is not output.

RemoveAt(int)

remove the specified ca file with the given index from the file list stored in RAM /Hard Disk.

public virtual void RemoveAt(int index)

Parameters

index int

RemoveSphericalPhaseFactor(CancellationToken?)

Removes the Spherical Phase Factor of all member fields.

public override void RemoveSphericalPhaseFactor(CancellationToken? cancellationToken = null)

Parameters

cancellationToken CancellationToken?

Optional token for cooperative task cancellation.

Save(string)

Saves current HarmonicFieldsSet into a file.

public override void Save(string fileName)

Parameters

fileName string

Complete path of file.

SetCoordinateForMember(int, CartesianCoordinateSystem)

public support method which can be used to set the coordinate system for a specific member

public void SetCoordinateForMember(int indexMember, CartesianCoordinateSystem csToSet)

Parameters

indexMember int

the index of the member for which the coordinate system shall be set

csToSet CartesianCoordinateSystem

the coordinate system that shall be set

SetSameCoordinateSystemToAllMembers(CartesianCoordinateSystem)

public support method which set the coordinate system csToSet to all member of the harmonic fields set

public void SetSameCoordinateSystemToAllMembers(CartesianCoordinateSystem csToSet)

Parameters

csToSet CartesianCoordinateSystem

the Cartesian coordinate system which shall be set

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.