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

Feature/oo adaptivity #289

Closed
wants to merge 112 commits into from
Closed

Feature/oo adaptivity #289

wants to merge 112 commits into from

Conversation

drreynolds
Copy link
Collaborator

@drreynolds drreynolds commented Jun 19, 2023

New object-oriented infrastructure for time step adaptivity controllers, and time step heuristic constraints. These are currently used in ARKODE. In the not-distant future, we can implement additional step/order controllers within this existing infrastructure to support CVODE(S) and IDA(S) (and maybe even ARKODE).

Rendered docs can be viewed here: https://sundials.readthedocs.io/en/feature-oo-adaptivity/index.html

drreynolds added 30 commits June 9, 2023 13:19
…DE. Code builds, but still needs work/debugging.
@drreynolds
Copy link
Collaborator Author

I believe that I've addressed all PR comments (modulo some answers I provided to questions that may require further discussion, and modulo changing any "default" behavior as Steven requested). The automated tests are currently failing because of differences in runtime statistics (some improved, others not). While I work through those test result differences, I would appreciate it if @gardner48, @balos1, and @Steven-Roberts could look back through this PR to see if their previous requests/questions have been satisfied, and to see if my new changes pass their approval.

Copy link
Member

@balos1 balos1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really good. I have one request which is that we do not use NULL as a valid option for the controller and heuristic objects. Instead, I suggest we implement versions that just do not do anything and call them "noop" or "identity" variants.

The enumerated type :c:type:`SUNAdaptController_Type` defines the enumeration
constants for SUNDIALS error controller types

.. c:enumerator:: SUN_ADAPTCONTROLLER_NONE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this type necessary? Can't we implement a SUN_ADAPTCONTROLLER_H that does not change the value of h, i.e., an identity controller.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you happen to apply clang-format to all of the new source files? If not, we should going forward, but I will update these later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not run clang-format.


typedef enum
{
SUN_TIMESTEPHEURISTICS_STD,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we prefer to call them standard, or default? I think this should match how we talk about them in the docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the implementation is called "default", so we should change this enum name to "default".


SUNAdaptController_Type SUNAdaptController_GetType(SUNAdaptController C)
{
if (C == NULL) { return SUN_ADAPTCONTROLLER_NONE; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to be very careful about purposefully making NULL to be a valid object, which is what we seem to be doing here. This could lead to some hard to debug issues I imagine. I think the better approach would be to implement a controller that does not change the step size (as I recommended in a different comment).


SUNTimestepHeuristics_ID SUNTimestepHeuristics_GetID(SUNTimestepHeuristics H)
{
if (H == NULL) { return SUN_TIMESTEPHEURISTICS_NULL; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as on the controller. I dont think we want to make NULL a valid "object."

@drreynolds
Copy link
Collaborator Author

Closing this PR, and replacing with #358

@drreynolds drreynolds closed this Oct 26, 2023
@gardner48 gardner48 deleted the feature/oo-adaptivity branch November 9, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants