/*
calcFar2d.c

calculate far2d field
*/

#include "oth.h"
#include "oth_prototype.h"

void calcFar2d(double *ffctr, d_complex_t ***etheta, d_complex_t ***ephi)
{
	for (int ifreq = 0; ifreq < NFrequency; ifreq++) {
		int itheta;
#ifdef _OPENMP
#pragma omp parallel for
#endif
		for (itheta = 0; itheta <= Far2d.divtheta; itheta++) {
			for (int iphi = 0; iphi <= Far2d.divphi; iphi++) {
				double theta = 180.0 * itheta / Far2d.divtheta;
				double phi = 360.0 * iphi / Far2d.divphi;
				farfield(ifreq, theta, phi, ffctr[ifreq], &etheta[ifreq][itheta][iphi], &ephi[ifreq][itheta][iphi]);
			}
		}
	}
}
