TransformGridCoordinates:

--------------------------------------------------------------------------
   Transforms between 2D and 1D coordinates.
   Assumes at square grid that is n by n.
--------------------------------------------------------------------------
   Form:
   [k,j] = TransformCoord( p, n    ) 1D to 2D
   k     = TransformCoord( p, q, n ) 2D to 1D
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   1D to 2D
   p          (1,:) Node
   n          (1,:) Number of rows or columns in the grid
   2D to 1D
   p          (1,:) Row
   q          (1,:) Column
   n          (1,1) Number of rows or columns in the grid
                    

   -------
   Outputs
   -------
   1D to 2D
   k          (1,:) Row
   j          (1,:) Column
   2D to 1D
   k          (1,:) Node

--------------------------------------------------------------------------