Converted header guards to pragma once.

This is apparantly supported by all of the major compilers.
Added simple grid partition function.