- 
                Notifications
    
You must be signed in to change notification settings  - Fork 45
 
Clean up main model: migrate out "prepare calculation" related stuff #1168
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
        
          
                power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp
          
            Show resolved
            Hide resolved
        
              
          
                power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a global review, not an in-depth one. Awesome cleanup!
        
          
                power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                power_grid_model_c/power_grid_model/include/power_grid_model/main_model_impl.hpp
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | namespace power_grid_model { | ||
| struct SolverPreparationContext { | ||
| main_core::MathState math_state; | ||
| Idx n_math_solvers{0}; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to keep n_math_solvers?
Is it ever not equivalent to math_state.topology.size()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it (in 4f0d589) in favor of a helper function that does the calling from state.math_topology.size() indeed. It should be fine and
assert(n_math_solvers == static_cast<Idx>(main_core::get_y_bus<sym>(solver_context.math_state).size()));|
still remains as a sanity check.
Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is indeed legacy from the era when we would re-use a math solver when our amount of connected components in the grid remained the same, even when our topology changed (i.e. we would reuse preallocated math solver memory, but it doesn't make sense because the elephant in the room is not the math solver but the y bus structure/topology. therefore, we changed that)
as long as our cache invalidation works correctly, with the current state of the code base, that should work as intended
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
Signed-off-by: Santiago Figueroa Manrique <[email protected]>
          
 | 
    



This PR is aimed to remove all the stuff related to preparing the calculation/solvers out of the main model. This PR should be an enabler to unit test the touched logic more easily, keep trimming the main model, and get it ready to remove everything related to the calculation logic in a followup.