-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
decouple GraphStructure from other modules through accessors #59
Conversation
The goal of this is to have a clear interface how to interact with the GraphData which doesn't depend on the concrete implementation.
Looks good! |
This is a bad solution since it is allocating. But is it actually needed by PD.jl?
Codecov Report
@@ Coverage Diff @@
## dev-0.5 #59 +/- ##
==========================================
Coverage ? 67.46%
==========================================
Files ? 7
Lines ? 375
Branches ? 0
==========================================
Hits ? 253
Misses ? 122
Partials ? 0 Continue to review full report at Codecov.
|
Yes, PD uses StaticEdgeFunction, so we have to either rewrite that part of PD or get rid of the allocations again: https://github.com/JuliaEnergy/PowerDynamics.jl/search?q=StaticEdgeFunction. Btw, it looks like it was allocating before, since it returns a tuple. Did allocations increase? |
Tuples are of known length and size and can be stack allocated. Before it was returning a tuple containing of two pointers to heap allocatet Arrays Now it is composing a tuple (non allocating) of to pointers but the pointers refer to arrays which will be created in the function call through these iterators (allocating). But the PD packages doesn't seem to be interested in the full arrays anyway (see my comment) |
Should not be merged yet. I'll try to decouple the |
Test ensures that it is not possible to change the type of the arrays.
This removes the recursive typing and makes the whole Graph Data business quite a bit more straightforward to read.
Nice to see tests for the modules and for allocations. Did you do the benchmarks yet? Also I think |
Yes, no perfomance hit compared to master (i think everything boils down to the same machine code anyway due to inlining).
I guess because of the type of nd = network_dynamics(nd_diffusion_vertex, nd_diffusion_edge, g)
typeof(nd) ## isa ODEFunction
typeof(nd.f) ## isa nd_ODE_Static The function getGD(nd::ODEFunction{true, T}) where T<:nd_ODE_Static
nd.f.graph_data
end (in case you are wondering, the first type parameter I think this not high priority but certainly something to think about (#35). |
decouple GraphStructure from other modules through accessors
this is an resolves #58. Not meant for merging right now.