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

Refactor Equationcomponent and all children of it #240

Open
eike-fokken opened this issue Sep 16, 2021 · 1 comment
Open

Refactor Equationcomponent and all children of it #240

eike-fokken opened this issue Sep 16, 2021 · 1 comment

Comments

@eike-fokken
Copy link
Owner

eike-fokken commented Sep 16, 2021

At the moment the Networkproblem holds two vectors of pointers to Equationcomponents (and Statecomponents respectively), which are traversed all the time.

But in large parts the actual type of the Equationcomponents are the same.
E.g. usually there are a lot of pipes in a problem and so during traversal of the Statecomponent vector, the dynamic type doesn't change.

Up to now this is maybe a bit inelegant but not much of a problem.
Now that I'm starting on controllable elements the current way of doing things will imply that every Equationcomponent will have a virtual function get_control_derivative() which will most of the time do nothing just to fulfill the interface.

This could be better, if each actual type (like Pipe) holds an array of pipe data instead, so that
Networkproblem would just iterate over the types and each type would iterate over the concrete components.

Then we only would have one function (of the type holding the pipe array) that does nothing instead of such a function for every component.

For now I will go with the old design. Hopefully someone eventually finds time for this rather big refactoring.

@eike-fokken
Copy link
Owner Author

The issue still stands but at least now not every Equationcomponent has this empty function.
Rather, now Networkproblem also holds pointers to Controlcomponent, which has the control derivative functions.

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

No branches or pull requests

1 participant