Update problem initializers to use AllocateGrids.

#404 Merged at 1ea6593
  1. dcollins4096

This swaps all the instances of BaryonField[field] = new float[size] with AllocateGrids(). The latter really only does the former, so this is not any change in functionality. But for a forthcoming pull request it will be useful to keep allocation consistent.

Comments (11)

  1. Brian OShea

    As of this morning (May 1), this PR passes the test suite (push suite), as compared to the tip of enzo-dev.

  2. Brian OShea

    The changes seem quite reasonable to me. Several of the files don't define the variable field inside the for statement, which might leave an unused variable definition elsewhere in those files. If they're not used for anything else, they should be removed. However, that's a minor issue and I am fine with accepting the PR as-is, except for the documentation suggestion.

  3. dcollins4096 author

    Thanks, those are useful suggestions. I changed the docs and removed all instances of field that weren't otherwise used. I also removed instances of size that aren't used, since they were often only used for that allocation.

  4. Philipp Grete

    Thanks for taking care of this tedious work, Dave! The changes proposed look good and I'm generally happy to approve the pull request. Two (quick) final questions:

    • In order to clean up this part of the code, I think we could also remove the commented code relating to these allocation in ./hydro_rk/Grid_MHD2DTestInitializeGrid.C:88:97
    • Do you think it's worth addressing the divB and phi allocations also in this pull request, see https://groups.google.com/forum/#!topic/enzo-dev/Eo0b1rWZLMs ? Never mind. I just saw the other pull request...
    1. dcollins4096 author

      I'll take that bit out, that's reasonable.

      The allocation you mentioned is taken care of in PR405. This was split into two to make the testing and verification easier.