Programming Reference for VirtualLab Fusion  2022.1
Public Member Functions | Static Public Member Functions | Properties | List of all members
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 FieldRepresentationObject 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. More...
 
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). More...
 
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 More...
 
CartesianCoordinateSystem GetCoordinateSystemForMember (int indexMember)
 public property to get the Cartesian coordinate system that is associated with the member at index #indexMember More...
 
int GetNumberOfIncoherentModesPerWavelength (double wavelength)
 Public support method which can be used to get the number of incoherent modes for a specified wavelength. More...
 
List< double > GetSortedListOfWavelength ()
 Public support method which provides a sorted list of all wavelengths present in the harmonic fields set. More...
 
 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. More...
 
 HarmonicFieldsSet (HarmonicFieldsSet sf)
 copy constructor. More...
 
HarmonicFieldsSet IndexWiseSummation (HarmonicFieldsSet hfs)
 Index wise summation of two harmonic fields, i.e. this[i] + hfs[i] (Complex Amplitude Summation) More...
 
virtual void Insert (int index, ComplexAmplitude ca)
 Insert a ComplexAmplitude into the list. More...
 
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. More...
 
string ModeString (int indexWavelength, int indexIncoherentMode, bool omitWavelength=false)
 Generates a human-readable string describing the specified mode. More...
 
virtual void RemoveAt (int index)
 remove the specified ca file with the given index from the file list stored in RAM /Hard Disk. More...
 
override void RemoveSphericalPhaseFactor ()
 Removes the Spherical Phase Factor of all member fields.
 
override void Save (string fileName)
 Saves current HarmonicFieldsSet into a file in binary format. More...
 
void SetCoordinateForMember (int indexMember, CartesianCoordinateSystem csToSet)
 public support method which can be used to set the coordinate system for a specific member More...
 
void SetSameCoordinateSystemToAllMembers (CartesianCoordinateSystem csToSet)
 public support method which set the coordinate system csToSet to all member of the harmonic fields set More...
 
- Public Member Functions inherited from HarmonicFieldBase
 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. More...
 
 HarmonicFieldBase (SerializationInfo info, StreamingContext context)
 Deserialization constructor to initialize new instance of the HarmonicFieldBase class. More...
 
abstract void RemoveSphericalPhaseFactor ()
 Removes the Spherical Phase Factor(s) from the field.
 
- Public Member Functions inherited from FieldRepresentationObject
override object Clone ()
 Clones the current object. More...
 
override bool Equals (object otherObject, EqualityIntent equalityIntent)
 Determines whether the specified Object is equal to this instance. More...
 
 FieldRepresentationObject ()
 Standard constructor.
 
 FieldRepresentationObject (FieldRepresentationObject fro)
 Copy constructor. More...
 
 FieldRepresentationObject (SerializationInfo info, StreamingContext context)
 Deserialization constructor. See the ISerializable interface for more details. More...
 
abstract void Save (string filename)
 Implementation of the IDocument Save function. More...
 
- Public Member Functions inherited from IDocument
void Reload ()
 Reload function for the 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. More...
 
static string ModeStringTwoIndices (int indexWavelength, double wavelength, int indexIncoherentMode, int numberOfIncoherentModesForWavelength)
 Generates a human-readable string describing the specified mode. More...
 

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). More...
 
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. More...
 
- Properties inherited from HarmonicFieldBase
abstract bool IsSpatial [get, set]
 Gets and sets whether the field is in spatial domain (if true) or spectral domain (if false).
 
- Properties inherited from FieldRepresentationObject
OpticalSystems.HomogeneousMedium EmbeddingMedium [get, set]
 Medium the light field object is located in
 
abstract FieldRepresentation FieldRepresentation [get]
 Get field representation. More...
 
abstract string FileExtension [get]
 File extension More...
 
abstract DocumentType TypeOfDocument [get]
 The type of the document.
 
- 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

◆ 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

◆ Save()

override void Save ( string  fileName)
virtual

Saves current HarmonicFieldsSet into a file in binary format.

Parameters
fileNameComplete path of file.

Implements FieldRepresentationObject.

◆ 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

◆ IsSpatial

override bool IsSpatial
getset

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


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