//****************************************************************************** //** SCATMECH: Polarized Light Scattering C++ Class Library //** //** File: miescat.cpp //** //** Thomas A. Germer //** Sensor Science Division, National Institute of Standards and Technology //** 100 Bureau Dr. Stop 8443; Gaithersburg, MD 20899-8443 //** Phone: (301) 975-2876 //** Email: thomas.germer@nist.gov //** //****************************************************************************** #include "scatmech.h" #include "miescat.h" // // These routines are loosely based upon the program BHMIE found // in C. F. Bohren and D. R. Huffman, "Absorption and Scattering of Light by // Small Particles," (Wiley, New York, 1983), as modified by // B.T.Draine. // // This version was further modified to place it in the context of a // SphericalScatterer C++ object class. This change necessitated the // following modifications: // * Calculate the coeffs. A[i], B[i], E[i], and F[i] at class construction. // * Place calculation of so s1(angle) and s2(angle) in their own routines. // * Arrays changed to scalars, and vice versa, to accomodate these changes. // // T.A.Germer (15 NOV 99) // using namespace std; namespace SCATMECH { MieScatterer:: MieScatterer() { NSTOP=0; NMX=0; } void MieScatterer:: setup() { SphericalScatterer::setup(); //COMPLEX REFREL=refrel; COMPLEX REFREL = m; COMPLEX Y=x*REFREL; double ymod=abs(Y); //C //C*** Series expansion terminated after NSTOP terms //C Logarithmic derivatives calculated from NMX on down double XSTOP=x+4.*pow(x,0.3333)+2.; // Typecaste to int added to prevent warning (TAG 22 JAN 2001) NMX=(int)(((XSTOP>ymod)? XSTOP : ymod )+15); // Typecaste to int added to prevent warning (TAG 22 JAN 2001) NSTOP=(int)(XSTOP); // The following were changed to use the SCATMEM functions... //A = new COMPLEX[NMX]; //B = new COMPLEX[NMX]; //E = new double[NMX]; //F = new double[NMX]; A.resize(NMX); B.resize(NMX); E.resize(NMX); F.resize(NMX); //Logarithmic derivative D(J) calculated by downward recurrence //beginning with initial value (0.,0.) at J=NMX vector D; D.resize(NMX); D[NMX-1]=COMPLEX(0.,0.); int NN=NMX-1; int N; for (N=0; N