Escolar Documentos
Profissional Documentos
Cultura Documentos
Clone();
Globals.DataDisplay.LogMessage("ca_centraldirection:" + ca.CentralDirection.ToString());
//ComplexAmplitude ca = ExtractLinearPhaseInSpatialDomain_LT(ca_0);
//Globals.DataDisplay.ShowDocument(ca_0, "ca_0");
//Globals.DataDisplay.ShowDocument(ca, "ca");
double lambda = ca.Wavelength;
double k_0 = MathFunctions.TwoPi / lambda;
//Define a new DataArray2D to record the ux, uy, uz
SamplingParameters SP = new SamplingParameters(new Vector((int)Sx, (int)Sy), new
VectorD(Thickness / Sx, Width / Sy));
PhysicalProperty[] unit = new PhysicalProperty[] { PhysicalProperty.NoUnit,
PhysicalProperty.NoUnit, PhysicalProperty.NoUnit };
string[] label = new string[] { "Ex", "Ey", "Ez" };
ComplexField ux = new ComplexField(SP.SamplingPoints);
ComplexField uy = new ComplexField(SP.SamplingPoints);
ComplexField uz = new ComplexField(SP.SamplingPoints);
ComplexField Ex = new ComplexField(SP.SamplingPoints);
ComplexField Ey = new ComplexField(SP.SamplingPoints);
ComplexField Ez = new ComplexField(SP.SamplingPoints);
//
List<Complex> TransferMatrix = TransferMatrix_WithCoating(plane, n_before,
n_GRIN, lambda, s_0, true);
Vector3C E = new Vector3C();
E.X = TransferMatrix[4] * E_0.X + TransferMatrix[5] * E_0.Y;
E.Y = TransferMatrix[6] * E_0.X + TransferMatrix[7] * E_0.Y;
E.Z = -(s.X * E.X + s.Y * E.Y) / s.Z;
Vector3C u = new Vector3C(E);
u.Normalize();
double I = E.Norm() * s.Z;
//T_0
Vector3C T = GRIN.GetComplexRefractiveIndex(r, lambda) * (Vector3C)s;
//OPL_0
Complex OPL = (s.X * StartingPoint.X + s.Y * StartingPoint.Y) * n_GRIN;
if (ca.HasSphericalPhaseRadius == true)
{ OPL += k_0 * n_GRIN * Math.Sqrt(StartingPoint.Norm() + ca.SphericalPhaseRadius
* ca.SphericalPhaseRadius); }
Vector3C k_1, k_2, k_3, k_4;
Vector3D r_prime, s_prime;
Vector3C T_prime;
Complex OPL_prime;
Complex n_1, n_2, n_3;
for (int ti = 1; r.Z < Thickness; ti++)
{
//Globals.DataDisplay.LogMessage(r.ToString());
intermediatePoints.Add(r);
n_1 = GRIN.GetComplexRefractiveIndex(r, lambda);
k_1 = -(u | D(r, GRIN, lambda)) / n_1 * T / n_1;
RK4_RayEquation(r, T, OPL, dt / 2, GRIN, lambda, out r_prime, out T_prime, out
s_prime, out OPL_prime);
n_2 = GRIN.GetComplexRefractiveIndex(r_prime, lambda);
k_2 = -((u + dt / 2 * k_1) | D(r_prime, GRIN, lambda)) / n_2 * T_prime / n_2;
k_3 = -((u + dt / 2 * k_2) | D(r_prime, GRIN, lambda)) / n_2 * T_prime / n_2;
RK4_RayEquation(r_prime, T_prime, OPL_prime, dt / 2, GRIN, lambda, out r, out T,
out s, out OPL);
n_3 = GRIN.GetComplexRefractiveIndex(r, lambda);
k_4 = -((u + dt * k_3) | D(r, GRIN, lambda)) / n_3 * T / n_3;
u += dt / 6 * (k_1 + 2 * k_2 + 2 * k_3 + k_4);
u.Normalize();
//output
if (r.Y == 0)
{
Vector SampIndex =
CoordinateTransformations.PointFromPhysicalToPixelCoordinates(new VectorD(r.X, r.Y), new
SamplingParameters(new Vector(SP.SamplingPointsY, SP.SamplingPointsY), new
VectorD(SP.SamplingDistance.Y, SP.SamplingDistanceY)));