Open ranocha opened 3 years ago
Here are my initial thoughts on this issue:
raw_copy!
, invalidate!
etc. for the DG containers (https://github.com/trixi-framework/Trixi.jl/blob/master/src/auxiliary/containers.jl#L6-L10). However, the surface data structures (interfaces, mortars, and so on) are just too much of a hassle to keep in sync - I think it's better to throw them away and rebuild them each time.You're definitely right - we should do some careful benchmarks before trying to optimize stuff that isn't worth it.I just thought that allocation 679MiB on average per call looks like it might be worth the effort to reduce the allocations.
allocation 679MiB on average per call looks like it might be worth
No, you're right. This should at least be motivation enough to be investigated once. The downside is that it would require the elements container to be larger than strictly necessary to account for future growth. Thus, e.g., nelements(elements::ElementContainer2D) = length(elements.cell_ids)
will not be possible anymore. This might be OK, but we'd have to make sure that anywhere any of the element variables are accessed, no slicing with :
, or size(dg.elements.u, <index_for_element_ids>)
is used.
Moreover, we allocate some temporary arrays - we could also move them to some cache.
Currently, we create completely new solution arrays when refining and coarsening (the solver).