Implemented 2nd and 4th order Neumann and Dirichlet boundary conditions, however have not tested yet. Also fixed the old Neumann implementation which had a bug if set to a non-zero value on the y boundaries (it set the grid spacing as dx regardless of whether it was an x or a y boundary).
Bugfix to upgraded boundary conditions: apparently the solver does not like to have NAN values even if it does not have to evolve them; changed the '#ifdef CHECK' values in the 2nd order routines to be 1.e60 instead of NAN.
Another bug fix: BoundaryRegionYDown::next1d() needed x++ instead of x--
Added option to use free boundary conditions: If any field has free boundary conditions on a boundary (xin, xout, ydown or yup) it sets a bool in Mesh to true (mesh->freeboundary_*); the derivatives in the guard cells of that boundary are then calculated using non-centred differences so that ddt(*) in the guard cells can be calculated. The free boundary condition then just refrains from setting either the field or the time-derivative in the guard cells on the boundary or boundaries where it applies, thus allowing them to evolve. The implementation does not yet extend to flux- or upwinding-derivatives and the interaction with staggered grids is almost certainly not correct. Also it is probably not as neat as it could be, derivs.cxx in particular could probably use tidying up somewhat.
Free boundary conditions upgrade: tidied up derivs.cxx somewhat, added implementation to 4th derivatives
Changed names of BoundaryRegion* objects in boutmesh.cxx from "target" to "upper_target" and "lower_target" to fix bug where Field3D::applyBoundary(const string &region, const string &condition) would only apply the boundary condition on one boundary when called with region="target" if both targets were on the same processor.
Changed dirichlet boundary conditions for laplacian inversion to the case where the bndry is half way between the first guard cell and the first actual grid point
boundary_conditions_upgrade bug fix: was passing doubles instead of ints in boundary_standard.cxx.
reverted to original dirichlet boundary conditions to fix broken test_laplace
boundary_conditions_upgrade: Fixed neumann_4thorder, second guard cell equation's indices were wrong
Merge branch 'boundary_conditions_upgrade' of http://github.com/boutproject/BOUT-dev into boundary_conditions_upgrade
Changed BoundaryDirichlet_2ndOrder to calculate the guard cell from a 3rd order accurate interpolation, so that (first) derivatives should be second order accurate. Added a preprocessor flag which, if set, calculates by extrapolation a value for the second guard cells rather than setting them to 1.e60 (#ifdef CHECK) or not setting them at all (#else).
Added C2 and C4 options for staggered upwinding derivative.
Change to implementation of boundary conditions: Boundary conditions on the values of the fields are set before each evaluation of the RHS function if the new flag BoundaryOp::apply_to_ddt is false. Boundary conditions are applied in solver::add() regardless of apply_to_ddt so that the initial profiles always obey the boundary conditions. Some evaluations of applyTDerivBoundary() are now redundant (when apply_to_ddt is false), but the error checking needs re-writing as well so that they do not get set to NAN.
Added applyBoundary(const char* condition) { applyBoundary(string(condition)); } to Field2D and Field3D because otherwise, e.g. applyBoundary("dirichlet") would be evaluated by applyBoundary(bool init) instead of applyBoundary(const string condition) because of the type conversion ("dirichlet" has type const char*).
Added generator functions to FieldFactory

Take a user-supplied value, and return a FieldGenerator
object. Can be used to extend the FieldFactory class by
adding additional symbols.
Changes to FieldFactory

1. Put lexer information (current token etc.) into a private structure
   This allows FieldFactory::parse to be called recursively

2. Parse takes an Options pointer, which is used to find
   any unresolved symbols. This allows expressions to be broken into pieces

   -> The scoping rules, options sections etc. need to be worked out.

3. FieldFactory::parse caches the results, to speed up evaluation of functions,
   or where expressions are used in multiple places.

4. To handle deletion of FieldGenerator objects, each is added to
   a list as it is created. When FieldFactory is deleted,
   all the FieldGenerator objects it created are also deleted.
Added "power" function to FieldFactory

Power(x,y) performs exponent x^y. Added for
compatibility with Mathematica scripts
Merge branch 'boundary_conditions_upgrade' into mms
Refactoring of FieldFactory

Trying to separate BOUT++ specific part, from back-end parser.
Aim is to be able to test the parser without Mesh, Fields etc.