Same as 2D_grains, but with cpp declarations and implementation. Allows the use of classes and better libraries