Fix segfaults created by recently lowered value of MAX_SONS
Previously, the value of MAX_SONS for 2d grids was larger than necessary. Some parts of the code relied on this: They assumed that there would always be a nullptr entry that would mark the end of the array.
Commit 71300a76 changed this: The number MAX_SONS was reduced for 2d grids to 4, which is the actual maximum number of sons a 2d element may have. As a consequence, some loops now have to be told explicitly to not loop farther than MAX_SONS entries.
This fixes #62 (closed)
Edited by Oliver Sander