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
-
ObjectBaseSerializableObjectBaseManualSerializationHarmonicFieldsSet
- 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
fieldsComplexAmplitude[]Either a single ComplexAmplitude object or an array of ComplexAmplitude objects.
HarmonicFieldsSet(HarmonicFieldsSet)
Copy constructor.
public HarmonicFieldsSet(HarmonicFieldsSet sf)
Parameters
sfHarmonicFieldsSetfield to copy.
Properties
Count
Get the number of complex amplitude fields in the HarmonicFieldsSet.
public int Count { get; }
Property Value
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
HasAtLeastOneGloballyPolarizedField
Gets whether at least one member field is globally polarized.
public bool HasAtLeastOneGloballyPolarizedField { get; }
Property Value
HasAtLeastOneSphericalPhaseRadius
Gets whether at least one member field has an analytical spherical phase radius.
public bool HasAtLeastOneSphericalPhaseRadius { get; }
Property Value
HasAtLeatOneLocallyPolarizedField
Gets whether at least one member field is locally polarized.
public bool HasAtLeatOneLocallyPolarizedField { get; }
Property Value
IsOneD
Returns true if the first member is one dimensional.
public virtual bool IsOneD { get; }
Property Value
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
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
indexint
Property Value
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
wavelengthIndexintThe index value for the wavelength.
incoherentIndexintThe 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
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
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
hfsToAddHarmonicFieldsSetThe 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
CopyCoordinateSystemsFromOtherHFS(HarmonicFieldsSet)
support method to copy the coordinate system information from the source HFS to the current instance
public void CopyCoordinateSystemsFromOtherHFS(HarmonicFieldsSet hfsSource)
Parameters
hfsSourceHarmonicFieldsSetthe 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
otherObjectobjectThe object to compare with this instance.
equalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.
Returns
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
indexMemberintthe 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
wavelengthdoubleThe 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
IndexWiseSummation(HarmonicFieldsSet)
Index wise summation of two harmonic fields, i.e. this[i] + hfs[i] (Complex Amplitude Summation)
public HarmonicFieldsSet IndexWiseSummation(HarmonicFieldsSet hfs)
Parameters
hfsHarmonicFieldsSetThe 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
indexintThe index at which the field shall be inserted.
caComplexAmplitudeThe 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
fileNamestringName 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
indexintThe 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.
omitWavelengthboolIf this optional parameter is set to
truethe 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
indexWavelengthintThe wavelength index of the mode.
indexIncoherentModeintThe index of the incoherent mode.
omitWavelengthboolIf this optional parameter is set to
truethe 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
indexWavelengthintThe wavelength index of the mode.
wavelengthdoubleThe wavelength itself.
indexIncoherentModeintThe index of the incoherent mode.
numberOfIncoherentModesForWavelengthintThe 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
indexint
RemoveSphericalPhaseFactor(CancellationToken?)
Removes the Spherical Phase Factor of all member fields.
public override void RemoveSphericalPhaseFactor(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?Optional token for cooperative task cancellation.
Save(string)
Saves current HarmonicFieldsSet into a file.
public override void Save(string fileName)
Parameters
fileNamestringComplete 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
indexMemberintthe index of the member for which the coordinate system shall be set
csToSetCartesianCoordinateSystemthe 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
csToSetCartesianCoordinateSystemthe 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.