Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less surprising behavior for the ok() method of FabArray. #1223

Merged
merged 2 commits into from
Aug 3, 2020

Conversation

atmyers
Copy link
Member

@atmyers atmyers commented Aug 3, 2020

This makes the ok() method of FabArray return false instead of crashing if the define() method has yet to be called.

We allow FabArray and its derived classes to be default constructed, which places them in a unusable state until the the define method has been called. We also provide an ok() method, which according to its doxygen strings returns whether the FabArray is well-defined. Currently, this method will crash with a not-particularly instructive error message if it is called on a default-constructed-but-not-defined FabArray. This pull request changes it to return false instead, which I'd argue is more intuitive - if it's legal to construct a FabArray and define it later, then it should be legal to test whether that has been done or not. I have also updated the doxygen string for the method in question.

Even if we want this to crash instead of returning false, it should do so with its own assertion and a clear error message.

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
  • are described in the proposed changes to the AMReX documentation, if appropriate

@atmyers atmyers requested review from WeiqunZhang and mic84 August 3, 2020 20:23
@WeiqunZhang WeiqunZhang merged commit 294435b into AMReX-Codes:development Aug 3, 2020
dwillcox pushed a commit to dwillcox/amrex that referenced this pull request Oct 3, 2020
…s#1223)

This makes the `ok()` method of FabArray return `false` instead of crashing if the `define()` method has yet to be called.

We allow FabArray and its derived classes to be default constructed, which places them in a unusable state until the the `define` method has been called. We also provide an `ok()` method, which according to its doxygen strings returns whether the FabArray is well-defined. Currently, this method will crash with a not-particularly instructive error message if it is called on a default-constructed-but-not-defined FabArray. This pull request changes it to return `false` instead, which I'd argue is more intuitive - if it's legal to construct a FabArray and define it later, then it should be legal to test whether that has been done or not. I have also updated the doxygen string for the method in question. 

Even if we want this to crash instead of returning `false`, it should do so with its own assertion and a clear error message.

The proposed changes:
- [x] 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
- [x] are described in the proposed changes to the AMReX documentation, if appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants