Table of Contents

Class HarmonicFieldMode

Namespace
VirtualLabAPI.Core.FieldRepresentations
Assembly
VirtualLabAPI.dll

Class to represent a harmonic field mode

public class HarmonicFieldMode : ObjectBase, IEquatable<IObjectBase>, ICloneable
Inheritance
ObjectBase
HarmonicFieldMode
Implements
IEquatable<IObjectBase>
Inherited Members

Constructors

HarmonicFieldMode(HarmonicFieldMode)

copy constructor of the harmonic field mode

public HarmonicFieldMode(HarmonicFieldMode modeToCopy)

Parameters

modeToCopy HarmonicFieldMode

the mode to be copied

HarmonicFieldMode(ComplexField, ComplexField, VectorD, VectorD, VectorD[], double[], VectorD[], ComplexField, HomogeneousMedium, double, CartesianCoordinateSystem, bool, double, int)

standard constructor of the Harmonic Field Mode class (using rudimentary type data definitions)

public HarmonicFieldMode(ComplexField equidistantFieldDataEx, ComplexField equidistantFieldDataEy, VectorD samplingDistanceEquidistantFieldData, VectorD centerPositionEquidistantFieldData, VectorD[] coordinatesWavefrontPhase, double[] valuesWavefrontPhase, VectorD[] gradientWavefrontPhase, ComplexField meshInformation, HomogeneousMedium mediumOfMode, double wavelength, CartesianCoordinateSystem coordinateSystemOfMode, bool modeGivenInKDomain, double runTime, int modeIndex = -1)

Parameters

equidistantFieldDataEx ComplexField

complex field which contains the equidistant field information of the Ex component

equidistantFieldDataEy ComplexField

complex field which contains the equidistant field information of the Ey component

samplingDistanceEquidistantFieldData VectorD

the sampling distance of the equidistantly sampled field data

centerPositionEquidistantFieldData VectorD

the center position of the equidistantly field data

coordinatesWavefrontPhase VectorD[]

the coordinates for the gridless wavefront data

valuesWavefrontPhase double[]

the values of the wavefront data (stored in gridless format)

gradientWavefrontPhase VectorD[]

the gradients of the wavefront data (stored in gridless format)

meshInformation ComplexField

information on the mesh/triangle (this could be extracted from ex

mediumOfMode HomogeneousMedium

the medium of the harmonic field mode

wavelength double

the wavelength of the harmonic field mode

coordinateSystemOfMode CartesianCoordinateSystem

the coordinate system of the harmonic field mode

modeGivenInKDomain bool

boolean flag whether mode is present in k-domain

runTime double

double value that contains the runtime information of the harmonic field mode

modeIndex int

the index of the harmonic field mode (if no index is defined, -1 is used)

Exceptions

ArgumentException

input data is not consistent

HarmonicFieldMode(DataArray2D, DataArray2D, HomogeneousMedium, double, CartesianCoordinateSystem, double, int, int, int)

Constructor for harmonic field mode which takes the equidistant sampled U field as well as equidistant sampled wavefront phase information and generates a harmonic field with gridless sampling points (which still form a rectangle of x × y sampling points).

public HarmonicFieldMode(DataArray2D griddedData_V, DataArray2D griddedData_WavefrontPhase, HomogeneousMedium mediumOfMode, double wavelength, CartesianCoordinateSystem coordinateSystemOfMode, double runTime, int modeIndex = 0, int numberGridlessPointsX = 31, int numberGridlessPointsY = 31)

Parameters

griddedData_V DataArray2D

the equidistantly sampled data for U

griddedData_WavefrontPhase DataArray2D

the gridded data to define the wavefront phase

mediumOfMode HomogeneousMedium

the medium of the mode

wavelength double

the wavelength of the mode

coordinateSystemOfMode CartesianCoordinateSystem

the coordinate system of the mode

runTime double

run time to store at the mode

modeIndex int

optional parameters for

numberGridlessPointsX int

The resulting number of sampling points in x-direction.

numberGridlessPointsY int

The resulting number of sampling points in y-direction.

Exceptions

ArgumentException

HarmonicFieldMode(DataArray2D, DataArrayGridLess, HomogeneousMedium, double, CartesianCoordinateSystem, bool, double, int)

standard constructor of the Harmonic Field Mode class (using complex VirtualLab type data definitions).

public HarmonicFieldMode(DataArray2D griddedData_V, DataArrayGridLess gridlessData_Wavefront, HomogeneousMedium mediumOfMode, double wavelength, CartesianCoordinateSystem coordinateSystemOfMode, bool modeGivenInKDomain, double runTime, int modeIndex = 0)

Parameters

griddedData_V DataArray2D

Gridded data to define the field components.

gridlessData_Wavefront DataArrayGridLess

Gridless data for the definition of wavefront (and gradient).

mediumOfMode HomogeneousMedium

The medium of the harmonic field mode.

wavelength double

The wavelength of the harmonic field mode.

coordinateSystemOfMode CartesianCoordinateSystem

The coordinate system of the harmonic field mode.

modeGivenInKDomain bool

Boolean flag whether mode is present in k-domain.

runTime double

Double value that contains the runtime information of the harmonic field mode.

modeIndex int

The index of the harmonic field mode (if no index is defined, 0 is used).

Exceptions

ArgumentException

Input data is not consistent.

Properties

CenterOfFieldData

public property to get the center of stored equidistant field data

public VectorD CenterOfFieldData { get; }

Property Value

VectorD

the center of the equidistant sampled field data

CenterOfGridlessWavefrontData

public property to get the center of the given gridless wavefront data

public VectorD CenterOfGridlessWavefrontData { get; }

Property Value

VectorD

CoordinateSystem

public property to get the coordinate system of the harmonic field mode

public CartesianCoordinateSystem CoordinateSystem { get; }

Property Value

CartesianCoordinateSystem

EmbeddingMedium

public property to set and get the embedding medium of the harmonic field mode

public HomogeneousMedium EmbeddingMedium { get; set; }

Property Value

HomogeneousMedium

ModeGivenInKDomain

public property to get whether harmonic field mode is given in k-domain (true) or x-domain (false)

public bool ModeGivenInKDomain { get; }

Property Value

bool

ModeIndex

public property to set and get the index of the harmonic mode object

public int ModeIndex { get; set; }

Property Value

int

NumberOfGridlessWavefrontPhaseSamples

public property to get the number of gridless data points stored for gridless data

public int NumberOfGridlessWavefrontPhaseSamples { get; }

Property Value

int

NumberOfSamplingPointsFieldData

public property to get the number of sampling points for the equidistant field data

public Vector NumberOfSamplingPointsFieldData { get; }

Property Value

Vector

RunTime

public property to set and get the runtime of the harmonic field mode object

public double RunTime { get; set; }

Property Value

double

SamplingDistanceFieldData

public property to get the sampling distance of the equidistant sampled field data

public VectorD SamplingDistanceFieldData { get; }

Property Value

VectorD

SizeOfFieldData

public property to get the size of the equidistant sampled field data

public VectorD SizeOfFieldData { get; }

Property Value

VectorD

SizeOfGridlessWavefrontData

public property to get the size of the given gridless wavefront data

public VectorD SizeOfGridlessWavefrontData { get; }

Property Value

VectorD

Wavelength

public property to get the wavelength of the harmonic field mode

public double Wavelength { get; }

Property Value

double

Methods

Clone()

clone method of the harmonic field mode

public override object Clone()

Returns

object

a copy of the current class

EmbedExtractEquidistantFieldData(Vector)

public support method to embed/extract the equidistant field data matrix to new number of pixels defined by the user

public void EmbedExtractEquidistantFieldData(Vector newNumberOfPoints)

Parameters

newNumberOfPoints Vector

the number of pixels to be used for embed/extract operation

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.

ExtractQuadraticPhaseFromEquidistantFieldData()

public support function to extract/fit a quadratic phase from equidistant 2PI modulo data

public QuadraticFunction ExtractQuadraticPhaseFromEquidistantFieldData()

Returns

QuadraticFunction

the extracted/fitted quadratic phase function from 2PI modulo data

GenerateDefaultHarmonicFieldMode(HomogeneousMedium, double, VectorD, bool, int, int, double, double)

static support function to generate a default harmonic field mode (Ex component will be set to 1/Ey to 0 & wavefront will be set to planar) default number of sampling points are used.

public static HarmonicFieldMode GenerateDefaultHarmonicFieldMode(HomogeneousMedium mediumOfMode, double wavelength, VectorD sizeOfField, bool generateFieldInKDomain, int numberOfGriddedPointsX = 101, int numberOfGriddedPointsY = 101, double defaultConstantValueEx = 1, double defaultConstantValueEy = 0)

Parameters

mediumOfMode HomogeneousMedium

the medium of the harmonic field mode to be generated

wavelength double

the wavelength to be used for generation of default harmonic field mode

sizeOfField VectorD

the size to use for generation of default harmonic field mode

generateFieldInKDomain bool

boolean flag, whether harmonic field mode shall be generated in k-domain (true) or x-domain

numberOfGriddedPointsX int

optional parameter for the number of points in x-direction

numberOfGriddedPointsY int

optional parameter for the number of points in y-direction

defaultConstantValueEx double
defaultConstantValueEy double

Returns

HarmonicFieldMode

generated default harmonic field mode object

GenerateGridlessDataArrayWavefrontInformationHexapolar(int, double, VectorD, bool)

static support method to generate a gridless data array for storage of wavefront information (wavefront values and gradients) on a hexapolar grid

public static DataArrayGridLess GenerateGridlessDataArrayWavefrontInformationHexapolar(int density, double radius, VectorD centerOfCoordiantes, bool generateInKDomain)

Parameters

density int

the density (defines the number of rings to be generated)

radius double

the radius on which the coordinates shall be generated

centerOfCoordiantes VectorD

the coordinate center for the coordinate generation

generateInKDomain bool

boolean flag whether data array information shall be given in k (true) or x (false) domain

Returns

DataArrayGridLess

the generated data array

GenerateGridlessDataArrayWavefrontInformationOnXYGrid(Vector, VectorD, VectorD, bool)

static support method to generate a gridless data array for storage of wavefront information (wavefront values and gradients) on a regular x/y grid

public static DataArrayGridLess GenerateGridlessDataArrayWavefrontInformationOnXYGrid(Vector numberOfPoint, VectorD size, VectorD centerOfCoordiantes, bool generateInKDomain)

Parameters

numberOfPoint Vector

the number of grid points in x- and y-direction

size VectorD

the size on which the coordinates shall be generated

centerOfCoordiantes VectorD

the coordinate center for the coordinate generation

generateInKDomain bool

boolean flag whether data array information shall be given in k (true) or x (false) domain

Returns

DataArrayGridLess

the generated data array

GenerateNonEquidistantCoordinateHexapolar(int, double, VectorD, out ComplexField)

static support method to generate mesh information (containing coordinates and triangle information) for a hexapolar grid

public static VectorD[] GenerateNonEquidistantCoordinateHexapolar(int density, double radius, VectorD centerOfCoordinates, out ComplexField meshInformation)

Parameters

density int

the density (defines the number of rings to be generated)

radius double

radius of the hexapolar mesh to generate

centerOfCoordinates VectorD

the center of the coordinates to generate

meshInformation ComplexField

out parameter for the triangle information

Returns

VectorD[]

an array that contains the stored coordinates

GenerateNonEquidistantCoordinateOnXYGrid(Vector, VectorD, VectorD, out ComplexField)

static support method to generate mesh information (containing coordinates and triangle information) for a XY grid

public static VectorD[] GenerateNonEquidistantCoordinateOnXYGrid(Vector numberOfPoint, VectorD size, VectorD centerOfCoordiantes, out ComplexField meshInformation)

Parameters

numberOfPoint Vector

number of points to generate

size VectorD

the size of the mesh to be generated

centerOfCoordiantes VectorD

the center of the coordinates to generate

meshInformation ComplexField

out parameter for the triangle information

Returns

VectorD[]

an array that contains the stored coordinates

GetComplexRefractiveIndexOfEmbeddingMedium()

Public property to get the complex refractive index of the embedding medium for the stored wavelength.

public Complex GetComplexRefractiveIndexOfEmbeddingMedium()

Returns

Complex

The complex refractive index of the embedding medium for the stored wavelength.

GetEquidistantExData()

public support method to get the equidistant data for the Ex field component

public ComplexField GetEquidistantExData()

Returns

ComplexField

the complex field containing the information of Ex

GetEquidistantEyData()

public support method to get the equidistant data for the Ey field component

public ComplexField GetEquidistantEyData()

Returns

ComplexField

the complex field containing the information of Ey

GetGridlessWavefrontData(out VectorD[], out VectorD[])

public support method get the gridless information stored in the harmonic field mode object for describing the wavefront phase

public double[] GetGridlessWavefrontData(out VectorD[] gridlessCoordinates, out VectorD[] gradientWavefrontPhase)

Parameters

gridlessCoordinates VectorD[]

out parameter for the list of coordinates on which the data is defined

gradientWavefrontPhase VectorD[]

out parameter for list of gradients of the wavefront phase (on associated coordinate)

Returns

double[]

list of wavefront phase values (on associated coordinate)

GetMeshInformationOfGridlessWavefrontData()

public support method to get the mesh information stored on the gridless wavefront data object

public ComplexField GetMeshInformationOfGridlessWavefrontData()

Returns

ComplexField

the mesh information of the gridless data array

GetPhysicalCoordinateOfSamplingPointForFieldData(Vector)

public support method to get the physical coordinate (of the equidistant sampled field data) for given pixel index

public VectorD GetPhysicalCoordinateOfSamplingPointForFieldData(Vector pixelCoordinate)

Parameters

pixelCoordinate Vector

the pixel coordinate for which the physical coordinate shall be evaluated

Returns

VectorD

calculated physical position of current pixel

Exceptions

ArgumentException

if pixel index is smaller 0 or larger then number of given sampling points, an ArgumentException is thrown

GetRealRefractiveIndexOfEmbeddingMedium()

Public property to get the real refractive index of the embedding medium for the stored wavelength.

public double GetRealRefractiveIndexOfEmbeddingMedium()

Returns

double

The real refractive index of the embedding medium for the stored wavelength.

InterpolateGradientOfWavefrontDataAtPoint(VectorD)

public property to interpolate the wavefront phase value at specified position

public VectorD InterpolateGradientOfWavefrontDataAtPoint(VectorD position)

Parameters

position VectorD

position information on which the wavefront phase data shall be interpolated

Returns

VectorD

interpolated wavefront phase value at specified position

InterpolateWavefrontDataAtPoint(VectorD)

public property to interpolate the wavefront phase value at specified position

public double InterpolateWavefrontDataAtPoint(VectorD position)

Parameters

position VectorD

position information on which the wavefront phase data shall be interpolated

Returns

double

interpolated wavefront phase value at specified position

IsEmptyFieldGiven()

public support method to check whether field values are all zero / meaning field is not given

public bool IsEmptyFieldGiven()

Returns

bool

true if all field values are 0, otherwise false is returned

PerformFastFourierTransform(double)

public support method to perform fast Fourier transform (FFT) to change domain from x to k or vice versa

public HarmonicFieldMode PerformFastFourierTransform(double oversamplingFactorWavefrontDowngrade = 1)

Parameters

oversamplingFactorWavefrontDowngrade double

optional parameter that shall be used for phase downgrade

Returns

HarmonicFieldMode

the harmonic field mode in the counter domain after FFT

PerformSemiAnalyticalFourierTransform(double)

public support method to perform semi-analytical Fourier transform (SFT) to change domain from x to k or vice versa

public HarmonicFieldMode PerformSemiAnalyticalFourierTransform(double oversamplingFactorWavefrontDowngrade = 1)

Parameters

oversamplingFactorWavefrontDowngrade double

optional parameter that shall be used for phase downgrade

Returns

HarmonicFieldMode

the harmonic field mode in the counter domain after SFT

PhaseDowngradeFullWavefrontPhase(double)

public support method to perform a phase downgrade. The wavefront phase information will be fully transferred to the phase information of the field data. This function will handle an automatically resampling of the equidistant field data.

public void PhaseDowngradeFullWavefrontPhase(double oversamplingFactor)

Parameters

oversamplingFactor double

The user can define an additional oversampling factor, which will be applied to the automatically evaluated sampling distance necessary to resolve the wavefront phase in 2PI modulo format.

PhaseDowngradeWithoutLinearPhase(double)

public support method to perform a phase downgrade. The wavefront phase information will be transfered to the phase information of the field data, besides a fitted linear phase. The linear phase fit is handled internally inside the support method. This function will handle an automatically resampling of the equidistant field data.

public void PhaseDowngradeWithoutLinearPhase(double oversamplingFactor)

Parameters

oversamplingFactor double

The user can define an additional oversampling factor, which will be applied to the automatically evaluated sampling distance necessary to resolve the wavefront phase in 2PI modulo format.

PhaseDowngradeWithoutQuadraticAndLinearPhase(double)

public void PhaseDowngradeWithoutQuadraticAndLinearPhase(double oversamplingFactor)

Parameters

oversamplingFactor double

PointInterpolationEquidistantFieldData(VectorD)

public support method to perform a point interpolation on the equidistant sampled field data

public VectorC PointInterpolationEquidistantFieldData(VectorD position)

Parameters

position VectorD

the position to evaluate

Returns

VectorC

the interpolated value for Ex and Ey

ResampleFieldDataViaSamplingDistance(VectorD)

public support method to resample the equidistant field data to new sampling parameters

public void ResampleFieldDataViaSamplingDistance(VectorD newSamplingDistance)

Parameters

newSamplingDistance VectorD

the sampling distance of the equidistantly sample field data that shall be used for interpolation

ResampleFieldDataViaSamplingPoints(Vector)

public support method to resample the equidistant field data to new number of sampling points

public void ResampleFieldDataViaSamplingPoints(Vector newNumberOfPoints)

Parameters

newNumberOfPoints Vector

the sampling points of the equidistantly sample field data that shall be used for interpolation

SetEquidistantExData(ComplexField)

public support method to set the data matrix for the equidistant field data Ex

public void SetEquidistantExData(ComplexField newExData)

Parameters

newExData ComplexField

the new data matrix for Ex to set

Exceptions

ArgumentException

in case number of pixel does not match, ArgumentException is thrown

SetEquidistantEyData(ComplexField)

public support method to set the data matrix for the equidistant field data Ey

public void SetEquidistantEyData(ComplexField newEyData)

Parameters

newEyData ComplexField

the new data matrix for Ey to set

Exceptions

ArgumentException

in case number of pixel does not match, ArgumentException is thrown

SetGridlessWavefrontData(double[], VectorD[])

public property to set the gridless wavefront phase data to the internal stored data

public void SetGridlessWavefrontData(double[] wavefrontPhaseValues, VectorD[] gradientWavefrontPhase)

Parameters

wavefrontPhaseValues double[]

array of wavefront phase data values to be set

gradientWavefrontPhase VectorD[]

array of wavefront phase gradient values to be set

Exceptions

ArgumentException

in case the number of input values does not match to the internal data structures, an argument exception will be thrown

SetGridlessWavefrontData(VectorD[], double[], VectorD[], ComplexField)

public support method to set the gridless wavefront data (including its gradients) on a newly set of mesh (defined by set of coordinate and mesh/triangle information

public void SetGridlessWavefrontData(VectorD[] coordinates, double[] wavefrontPhaseValues, VectorD[] gradientWavefrontPhase, ComplexField triangleInformation)

Parameters

coordinates VectorD[]

the coordinates to set

wavefrontPhaseValues double[]

the wavefront phase samples to set

gradientWavefrontPhase VectorD[]

the wavefront phase gradient samples to set

triangleInformation ComplexField

the mesh/triangle information

Exceptions

ArgumentException

in case any input parameter is not initialized, or the number of values does not match with the number of coordinates, an argument exception is thrown

ShowGriddedFieldData(string)

public support method to show the gridded field data

public void ShowGriddedFieldData(string caption)

Parameters

caption string

caption for output

ShowGridlessWavefrontData(string)

public support method to show the gridless wavefront data

public void ShowGridlessWavefrontData(string caption)

Parameters

caption string

caption for output