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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Controllers - Add Output Controller #11509

Merged
merged 23 commits into from
Sep 5, 2023

Conversation

sunethwarna
Copy link
Member

@sunethwarna sunethwarna commented Aug 27, 2023

馃摑 Description
Currently, the Controller::Evaluate method is made non-const which makes it to have multiple responsibilities such as evaluating a given controller and returning a bool, and changing the state of the controller. This becomes problematic if someone wants to evaluate multiple times in the same state which is not possible without hackish ways. In this PR, I would like to seperate these two responsibilities, so one can evaluate multiple times in the same state, and if required to change state, they can do it seperately.

  1. The Controller::Evaluate method is made const so that, now one can only do evaluation, not changing the state of the controller.
  2. Controller::Update method is introduced which allows changing the state of the Controller.

I introduced controllers:

  1. OutputController -> This has the exact same logic which is used in VtkOutputProcess and VtuOutputProcess (Which will be used in HDF5OutputProcess as well.

TODO

  • Add tests if agreed upon.

馃啎 Changelog

  • Add OutputController
  • Add tests
  • Updated VtuOutputProcess, VtkOutputProcess, GidOutputProcess, UnvOutputProcess

Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

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

I think that thes changes in the base controller really make sense. My unique comment is the new DefaultController, why is it required?

EDIT: I'd take the chance to also update the GiD output process accordingly.

@sunethwarna
Copy link
Member Author

sunethwarna commented Aug 27, 2023

@rubenzorrilla Removed the DefaultController.

I will change the gid_output process as well.

@ddiezrod
Copy link
Contributor

I agree with the changes in the base class, it makes complete sense to separate it into two methods 馃憤

mModelPartName = Settings["model_part_name"].GetString();

const auto& output_control_type = Settings["output_control_type"].GetString();
if (output_control_type == "step") {
Copy link
Member

Choose a reason for hiding this comment

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

Agree with the changes, but tbh, if we are going to derive different controllers from the base, I would move this to a different one (Time for time, StepController for steps, etc...).

But I would understand leaving this for historical reasons...

Copy link
Member Author

Choose a reason for hiding this comment

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

It is for the historical reasons :/

Copy link
Member

Choose a reason for hiding this comment

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

I thought the same. Maybe we can call it OutputController to make clear that this is for the output and save the Time keyword for an eventual time-based cotroller (same argument applies to the step keyword).

Copy link
Member Author

Choose a reason for hiding this comment

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

Make sense. I will do it :)

Copy link
Member Author

Choose a reason for hiding this comment

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

done :) can somebody approve this?

@sunethwarna sunethwarna requested a review from a team as a code owner August 29, 2023 09:18
@sunethwarna sunethwarna changed the title [Core] Controllers - Add temporal controller [Core] Controllers - Add Output Controller Aug 29, 2023
@sunethwarna sunethwarna removed the request for review from a team August 29, 2023 09:21
@sunethwarna
Copy link
Member Author

Can someone approve this? @rubenzorrilla @roigcarlo @ddiezrod ?

Copy link
Member

@rubenzorrilla rubenzorrilla left a comment

Choose a reason for hiding this comment

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

Thanks for the implementation.

@sunethwarna sunethwarna merged commit c3ed8fd into master Sep 5, 2023
11 checks passed
@sunethwarna sunethwarna deleted the core/controllers/temporal_controller branch September 5, 2023 10:16
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.

None yet

4 participants