icl-utk-edu / heffte

BSD 3-Clause "New" or "Revised" License
20 stars 15 forks source link

Fix proc_setup_min_surface bugs in edge cases #51

Closed ahojukka5 closed 2 months ago

ahojukka5 commented 2 months ago

proc_setup_min_surface does not give correct grid configurations for edge cases, where one or two dimensions are equal to 1. With this modification, the algorithm respects the global domain size in iterations fixing the abovementioned problem.

Also, the initial grid configuration does not have to be valid, and depending on the problem dimensions, it's even hard to say any valid grid before doing any calculations, as the third dimension can be 1 in 2d problems. Thus in my proposal, it's enough to give any grid and have best_surface large enough that any valid grid that is found in the algorithm is better than the initial grid. Setting best_surface to std::numeric_limits<index>::max() should serve this purpose well.

This PR is related to issue #50.

mkstoyanov commented 2 months ago

I think we got it this time.