Programming Reference for VirtualLab Fusion  2026.1
Loading...
Searching...
No Matches
HarmonicFieldsSet Class Reference

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class containing a set of harmonic fields (i.e. of instances of class ComplexAmplitude). More...

Inheritance diagram for HarmonicFieldsSet:
HarmonicFieldBase IDocument

Public Member Functions

virtual int Add (ComplexAmplitude ca)
 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.
 
void Add (HarmonicFieldsSet hfsToAdd)
 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).
 
void ClearAdvancedIndexerCache ()
 public help method to clear the cache which is used for the advanced indexer
 
void CopyCoordinateSystemsFromOtherHFS (HarmonicFieldsSet hfsSource)
 support method to copy the coordinate system information from the source HFS to the current instance
 
new void DeserializationPostProcessing (ref List< System.Reflection.FieldInfo > unfindableFields, RemainingData remainingData)
 Method for doing post-processing after XML deserialization. Especially, handling of fields which have been altered since the version the data were saved with. But also additional operations (like filling caching variables etc.) can be done here.
 
CartesianCoordinateSystem GetCoordinateSystemForMember (int indexMember)
 public property to get the Cartesian coordinate system that is associated with the member at index #indexMember
 
int GetNumberOfIncoherentModesPerWavelength (double wavelength)
 Public support method which can be used to get the number of incoherent modes for a specified wavelength.
 
List< double > GetSortedListOfWavelength ()
 Public support method which provides a sorted list of all wavelengths present in the harmonic fields set.
 
 HarmonicFieldsSet ()
 Default Constructor.
 
 HarmonicFieldsSet (ComplexAmplitude[] fields)
 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.
 
 HarmonicFieldsSet (HarmonicFieldsSet sf)
 copy constructor.
 
HarmonicFieldsSet IndexWiseSummation (HarmonicFieldsSet hfs)
 Index wise summation of two harmonic fields, i.e. this[i] + hfs[i] (Complex Amplitude Summation)
 
virtual void Insert (int index, ComplexAmplitude ca)
 Insert a ComplexAmplitude into the list.
 
string ModeNumberString (int index, bool omitWavelength=false)
 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.
 
string ModeString (int indexWavelength, int indexIncoherentMode, bool omitWavelength=false)
 Generates a human-readable string describing the specified mode.
 
virtual void RemoveAt (int index)
 remove the specified ca file with the given index from the file list stored in RAM /Hard Disk.
 
override void RemoveSphericalPhaseFactor (CancellationToken? cancellationToken=null)
 Removes the Spherical Phase Factor of all member fields.
 
override void Save (string fileName)
 Saves current HarmonicFieldsSet into a file in binary format.
 
void SetCoordinateForMember (int indexMember, CartesianCoordinateSystem csToSet)
 public support method which can be used to set the coordinate system for a specific member
 
void SetSameCoordinateSystemToAllMembers (CartesianCoordinateSystem csToSet)
 public support method which set the coordinate system csToSet to all member of the harmonic fields set
 
- Public Member Functions inherited from HarmonicFieldBase
IEnumerable< ComplexAmplitudeGetFields ()
 Gets all member fields in the harmonic field.
 
 HarmonicFieldBase ()
 Default constructor to initialize a new instance of the HarmonicFieldBase class.
 
 HarmonicFieldBase (HarmonicFieldBase field)
 Copy constructor to initialize a new instance of the HarmonicFieldBase class.
 
 HarmonicFieldBase (SerializationInfo info, StreamingContext context)
 Deserialization constructor to initialize new instance of the HarmonicFieldBase class.
 
void RemoveSphericalPhaseFactor (CancellationToken? cancellationToken=null)
 Removes the Spherical Phase Factor(s) from the field.
 
- Public Member Functions inherited from IDocument
FormDocument GetNewDocumentWindow (Form formMain, string fileName)
 Gets a new document window containing this document.
 

Static Public Member Functions

static string ModeStringOneIndex (int index)
 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.
 
static string ModeStringTwoIndices (int indexWavelength, double wavelength, int indexIncoherentMode, int numberOfIncoherentModesForWavelength)
 Generates a human-readable string describing the specified mode.
 

Properties

int Count [get]
 Get the number of complex amplitude fields in the HarmonicFieldsSet.
 
virtual bool IsOneD [get]
 Returns true if the first member is one dimensional.
 
override bool IsSpatial [get, set]
 Gets and sets whether all member fields are in spatial domain (if true) or spectral domain (if false).
 
virtual ComplexAmplitude this[int index] [get, set]
 Indexer for access to the ComplexAmplitude object the harmonic fields set consists of with the possibility to check consistency.
 
ComplexAmplitude this[int wavelengthIndex, int incoherentIndex] [get, set]
 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.
 
- Properties inherited from HarmonicFieldBase
bool IsSpatial [get, set]
 Gets and sets whether the field is in spatial domain (if true) or spectral domain (if false).
 
bool PropagatesInPositiveZDirection [get, set]
 Gets or sets whether the sign of the z-component of the k-vector is positive or not.
 
- Properties inherited from IDocument
VirtualLabSession Session [get, set]
 every documents need to be handled in a session ==> default is the VirtualLab Mainsession
 
NodeVLExplorer TreeStructure [get]
 every document should have a node (maybe with subnodes) in the VirtualLab Explorer
 
DocumentType TypeOfDocument [get]
 Gets an enum entry specifying the type of the document.
 

Detailed Description

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class containing a set of harmonic fields (i.e. of instances of class ComplexAmplitude).

Constructor & Destructor Documentation

◆ HarmonicFieldsSet() [1/2]

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.

Parameters
fieldsEither a single ComplexAmplitude object or an array of ComplexAmplitude objects.

◆ HarmonicFieldsSet() [2/2]

copy constructor.

Parameters
sffield to copy.

Member Function Documentation

◆ Add() [1/2]

virtual int Add ( ComplexAmplitude ca)
virtual

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.

Parameters
ca
Returns
index of file

◆ Add() [2/2]

void Add ( HarmonicFieldsSet hfsToAdd)

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

Parameters
hfsToAddThe HarmonicFieldsSet object to add.

◆ CopyCoordinateSystemsFromOtherHFS()

void CopyCoordinateSystemsFromOtherHFS ( HarmonicFieldsSet hfsSource)

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

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

◆ DeserializationPostProcessing()

new void DeserializationPostProcessing ( ref List< System.Reflection.FieldInfo > unfindableFields,
RemainingData remainingData )

Method for doing post-processing after XML deserialization. Especially, handling of fields which have been altered since the version the data were saved with. But also additional operations (like filling caching variables etc.) can be done here.

Parameters
unfindableFieldsList of all those fields which are expected but could not be read from XML.
remainingDataData contained in XML but which haven't been read yet.

◆ GetCoordinateSystemForMember()

CartesianCoordinateSystem GetCoordinateSystemForMember ( int indexMember)

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

Parameters
indexMemberthe index for which the CS shall be evaluated
Returns
the Cartesian coordinate system for the member at index #indexMember

◆ GetNumberOfIncoherentModesPerWavelength()

int GetNumberOfIncoherentModesPerWavelength ( double wavelength)

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

Parameters
wavelengthThe wavelength for which the number of incoherent modes should be evaluated.
Returns
The number of incoherent modes which have the specified wavelength.

◆ GetSortedListOfWavelength()

List< double > GetSortedListOfWavelength ( )

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

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

◆ IndexWiseSummation()

HarmonicFieldsSet IndexWiseSummation ( HarmonicFieldsSet hfs)

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

Parameters
hfsThe second harmonic fields set to add to this harmonic fields set.
Returns
The resulting harmonic fields set.

◆ Insert()

virtual void Insert ( int index,
ComplexAmplitude ca )
virtual

Insert a ComplexAmplitude into the list.

Parameters
indexThe index at which the field shall be inserted.
caThe field to insert.

◆ ModeNumberString()

string ModeNumberString ( int index,
bool omitWavelength = false )

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.

Parameters
indexThe 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.
omitWavelengthIf 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
The formatted string.

◆ ModeString()

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

Generates a human-readable string describing the specified mode.

Parameters
indexWavelengthThe wavelength index of the mode.
indexIncoherentModeThe index of the incoherent mode.
omitWavelengthIf 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
The wavelength and the incoherent index. The indices start with 1. If there is only one incoherent mode, the incoherent index is not output.

◆ ModeStringOneIndex()

static string ModeStringOneIndex ( int index)
static

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.

Parameters
indexThe index of the mode. An index of 0 is converted to "Field #1", an index of 1 to "Field #2" and so on.
Returns
The formatted string.

◆ ModeStringTwoIndices()

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

Generates a human-readable string describing the specified mode.

Parameters
indexWavelengthThe wavelength index of the mode.
wavelengthThe wavelength itself.
indexIncoherentModeThe index of the incoherent mode.
numberOfIncoherentModesForWavelengthThe number of incoherent modes for the given wavelength.
Returns
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()

virtual void RemoveAt ( int index)
virtual

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

Parameters
index

◆ RemoveSphericalPhaseFactor()

override void RemoveSphericalPhaseFactor ( CancellationToken? cancellationToken = null)

Removes the Spherical Phase Factor of all member fields.

Parameters
cancellationTokenOptional token for cooperative task cancellation.

◆ Save()

override void Save ( string fileName)

Saves current HarmonicFieldsSet into a file in binary format.

Parameters
fileNameComplete path of file.

◆ SetCoordinateForMember()

void SetCoordinateForMember ( int indexMember,
CartesianCoordinateSystem csToSet )

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

Parameters
indexMemberthe index of the member for which the coordinate system shall be set
csToSetthe coordinate system that shall be set

◆ SetSameCoordinateSystemToAllMembers()

void SetSameCoordinateSystemToAllMembers ( CartesianCoordinateSystem csToSet)

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

Parameters
csToSetthe Cartesian coordinate system which shall be set

Property Documentation

◆ this[int wavelengthIndex, int incoherentIndex]

ComplexAmplitude this[int wavelengthIndex, int incoherentIndex]
getset

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.

Parameters
wavelengthIndexThe index value for the wavelength.
incoherentIndexThe index value for the incoherent mode.
Returns
The complex amplitude within the harmonic fields set for the wavelength index and the incoherent-mode index.