Add second constructor to RandomEngine for CPU
Summary
#4443 deleted the default constructor of RandomEngine for GPU. However for CPU still the default constructor must be used, forcing #ifdef to be used in code that uses the constructor. This PR adds a second constructor to the CPU version of RandomEngine to match the GPU one. Note the only use for RandomEngine on CPU is to make GPU code work on CPU.
Additional background
Checklist
The proposed changes:
- [ ] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX users
- [ ] include documentation in the code and/or rst files, if appropriate
The original intention was to make it really hard for people to write this type of code.
If one wants to avoid ifdef, one should use ParallelForRNG and then use the RandomEngine provided by the function. Of course, I understand this makes some existing Particle functions hard to use.
One might argue that RandomEngine{nullptr} does not look right on GPU. But I also did not expect that people would have used RandomEnginre{} on GPU and expected it to work.
I changed it so now it is getInvalidRandomEngine() to make it more clear.