% GRIDFARFIELD - setup a grid and compute the far field on the grid.
%
% u = p.gridfarfield(opts) computes the far field u for the scattering 
% problem p. The far field is a function of observation angle theta for 
% theta in [0,2*pi) and the grid spacing is specified by opts.dtheta.
%
% [u, theta] = p.gridfarfield(opts) also returns the grid points.
%
% Copyright (C) 2014 Stuart C. Hawkins

function [u theta] = gridfarfield(self,opts,theta)

%-----------------------------------
% setup the grid... this is a set
% of points on the unit circle parametrised
% by theta
%-----------------------------------

% set theta points if not given
if nargin<3
    theta = linspace(0,2*pi,ceil(2*pi/opts.dtheta));
end

% get complex values points on the unit circle
z = exp(1i*theta);

%-----------------------------------
% compute the far field
%-----------------------------------

u = self.pointfarfield(z);