#include "nearfield.h" #include #include #ifdef _WIN32 #define isnan(x) _isnan(x) #define isinf(x) (!_finite(x)) #endif int bessjyv_sph(int v, double z, double &vm, double* cjv, double* cyv, double* cjvp, double* cyvp); nearfieldStruct::nearfieldStruct() { scalarSim = true; planeWave = false; lut_us = true; lut_uf = false; nWaves = 0; } void nearfieldStruct::init() { //set the field parameters U.scalarField = scalarSim; Uf.scalarField = scalarSim; //initialize dynamic memory U.init_gpu(); Uf.init_gpu(); } void nearfieldStruct::destroy() { U.kill_gpu(); Uf.kill_gpu(); } void nearfieldStruct::setPos(bsPoint pMin, bsPoint pMax, bsVector normal) { pos = rts::quad(pMin, pMax, normal); } void nearfieldStruct::setRes(int x_res, int y_res) { U.R[0] = Uf.R[0] = x_res; U.R[1] = Uf.R[1] = y_res; } std::string nearfieldStruct::toStr() { std::stringstream ss; ss<<"------Field Parameters-------"< n = mVector[imat](lambda); //calculate the scattering coefficients sVector[i].calcCoeff(lambda, n); //save the refractive index sVector[i].n = n; //if the LUT is used, calculate Usp(theta, r) if(lut_us) { sVector[i].calcUp(lambda, n, pos, max(U.R[0], U.R[1])); } } } void nearfieldStruct::calcUs() { if(scalarSim) { if(lut_us) scalarUpLut(); else scalarUs(); if(lut_us) std::cout<<"Using LUT for Us"<