Class HarmonicFieldMode
- Namespace
- VirtualLabAPI.Core.FieldRepresentations
- Assembly
- VirtualLabAPI.dll
Class to represent a harmonic field mode
public class HarmonicFieldMode : ObjectBase, IEquatable<IObjectBase>, ICloneable
- Inheritance
-
ObjectBaseHarmonicFieldMode
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
Constructors
HarmonicFieldMode(HarmonicFieldMode)
copy constructor of the harmonic field mode
public HarmonicFieldMode(HarmonicFieldMode modeToCopy)
Parameters
modeToCopyHarmonicFieldModethe 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
equidistantFieldDataExComplexFieldcomplex field which contains the equidistant field information of the Ex component
equidistantFieldDataEyComplexFieldcomplex field which contains the equidistant field information of the Ey component
samplingDistanceEquidistantFieldDataVectorDthe sampling distance of the equidistantly sampled field data
centerPositionEquidistantFieldDataVectorDthe center position of the equidistantly field data
coordinatesWavefrontPhaseVectorD[]the coordinates for the gridless wavefront data
valuesWavefrontPhasedouble[]the values of the wavefront data (stored in gridless format)
gradientWavefrontPhaseVectorD[]the gradients of the wavefront data (stored in gridless format)
meshInformationComplexFieldinformation on the mesh/triangle (this could be extracted from ex
mediumOfModeHomogeneousMediumthe medium of the harmonic field mode
wavelengthdoublethe wavelength of the harmonic field mode
coordinateSystemOfModeCartesianCoordinateSystemthe coordinate system of the harmonic field mode
modeGivenInKDomainboolboolean flag whether mode is present in k-domain
runTimedoubledouble value that contains the runtime information of the harmonic field mode
modeIndexintthe 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_VDataArray2Dthe equidistantly sampled data for U
griddedData_WavefrontPhaseDataArray2Dthe gridded data to define the wavefront phase
mediumOfModeHomogeneousMediumthe medium of the mode
wavelengthdoublethe wavelength of the mode
coordinateSystemOfModeCartesianCoordinateSystemthe coordinate system of the mode
runTimedoublerun time to store at the mode
modeIndexintoptional parameters for
numberGridlessPointsXintThe resulting number of sampling points in x-direction.
numberGridlessPointsYintThe resulting number of sampling points in y-direction.
Exceptions
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_VDataArray2DGridded data to define the field components.
gridlessData_WavefrontDataArrayGridLessGridless data for the definition of wavefront (and gradient).
mediumOfModeHomogeneousMediumThe medium of the harmonic field mode.
wavelengthdoubleThe wavelength of the harmonic field mode.
coordinateSystemOfModeCartesianCoordinateSystemThe coordinate system of the harmonic field mode.
modeGivenInKDomainboolBoolean flag whether mode is present in k-domain.
runTimedoubleDouble value that contains the runtime information of the harmonic field mode.
modeIndexintThe 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
CoordinateSystem
public property to get the coordinate system of the harmonic field mode
public CartesianCoordinateSystem CoordinateSystem { get; }
Property Value
EmbeddingMedium
public property to set and get the embedding medium of the harmonic field mode
public HomogeneousMedium EmbeddingMedium { get; set; }
Property Value
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
ModeIndex
public property to set and get the index of the harmonic mode object
public int ModeIndex { get; set; }
Property Value
NumberOfGridlessWavefrontPhaseSamples
public property to get the number of gridless data points stored for gridless data
public int NumberOfGridlessWavefrontPhaseSamples { get; }
Property Value
NumberOfSamplingPointsFieldData
public property to get the number of sampling points for the equidistant field data
public Vector NumberOfSamplingPointsFieldData { get; }
Property Value
RunTime
public property to set and get the runtime of the harmonic field mode object
public double RunTime { get; set; }
Property Value
SamplingDistanceFieldData
public property to get the sampling distance of the equidistant sampled field data
public VectorD SamplingDistanceFieldData { get; }
Property Value
SizeOfFieldData
public property to get the size of the equidistant sampled field data
public VectorD SizeOfFieldData { get; }
Property Value
SizeOfGridlessWavefrontData
public property to get the size of the given gridless wavefront data
public VectorD SizeOfGridlessWavefrontData { get; }
Property Value
Wavelength
public property to get the wavelength of the harmonic field mode
public double Wavelength { get; }
Property Value
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
newNumberOfPointsVectorthe 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
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
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
mediumOfModeHomogeneousMediumthe medium of the harmonic field mode to be generated
wavelengthdoublethe wavelength to be used for generation of default harmonic field mode
sizeOfFieldVectorDthe size to use for generation of default harmonic field mode
generateFieldInKDomainboolboolean flag, whether harmonic field mode shall be generated in k-domain (true) or x-domain
numberOfGriddedPointsXintoptional parameter for the number of points in x-direction
numberOfGriddedPointsYintoptional parameter for the number of points in y-direction
defaultConstantValueExdoubledefaultConstantValueEydouble
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
densityintthe density (defines the number of rings to be generated)
radiusdoublethe radius on which the coordinates shall be generated
centerOfCoordiantesVectorDthe coordinate center for the coordinate generation
generateInKDomainboolboolean 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
numberOfPointVectorthe number of grid points in x- and y-direction
sizeVectorDthe size on which the coordinates shall be generated
centerOfCoordiantesVectorDthe coordinate center for the coordinate generation
generateInKDomainboolboolean 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
densityintthe density (defines the number of rings to be generated)
radiusdoubleradius of the hexapolar mesh to generate
centerOfCoordinatesVectorDthe center of the coordinates to generate
meshInformationComplexFieldout 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
numberOfPointVectornumber of points to generate
sizeVectorDthe size of the mesh to be generated
centerOfCoordiantesVectorDthe center of the coordinates to generate
meshInformationComplexFieldout 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
gridlessCoordinatesVectorD[]out parameter for the list of coordinates on which the data is defined
gradientWavefrontPhaseVectorD[]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
pixelCoordinateVectorthe 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
positionVectorDposition 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
positionVectorDposition 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
oversamplingFactorWavefrontDowngradedoubleoptional 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
oversamplingFactorWavefrontDowngradedoubleoptional 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
oversamplingFactordoubleThe 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
oversamplingFactordoubleThe 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
oversamplingFactordouble
PointInterpolationEquidistantFieldData(VectorD)
public support method to perform a point interpolation on the equidistant sampled field data
public VectorC PointInterpolationEquidistantFieldData(VectorD position)
Parameters
positionVectorDthe 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
newSamplingDistanceVectorDthe 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
newNumberOfPointsVectorthe 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
newExDataComplexFieldthe 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
newEyDataComplexFieldthe 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
wavefrontPhaseValuesdouble[]array of wavefront phase data values to be set
gradientWavefrontPhaseVectorD[]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
coordinatesVectorD[]the coordinates to set
wavefrontPhaseValuesdouble[]the wavefront phase samples to set
gradientWavefrontPhaseVectorD[]the wavefront phase gradient samples to set
triangleInformationComplexFieldthe 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
captionstringcaption for output
ShowGridlessWavefrontData(string)
public support method to show the gridless wavefront data
public void ShowGridlessWavefrontData(string caption)
Parameters
captionstringcaption for output