Bad case style for consts, I suggest `const int DIM = dim;`
And generally I see little reason for defining these consts...