You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trixi.jl example simulations contain a lot of duplicate code because many elixirs are almost identical.
In TrixiParticles.jl, we tried to avoid this by recursively calling trixi_include.
For example, we have a 3D version of a 2D example file, which looks like this:
In this case, defining 3D fluid and tank sizes, 3D acceleration and a 3D kernel are necessary to make the simulation 3D.
The other kwargs fluid_particle_spacing, tspan, maxiters, fluid_density_calculator and clip_negative_pressure are defining the same values as in the 2D file. We only added them to be able to overwrite these assignments when including the 3D file:
What's the disadvantage of option 1 - at least I cannot see anything.
Trixi.jl example simulations contain a lot of duplicate code because many elixirs are almost identical.
This is by design. Each elixir should be downloadable by the user as is, modified (in a semantically correct way of course), and then be able to run. There are, of course, downsides to this approach: as you correctly pointed out, we have a lot of redundancy.
Trixi.jl example simulations contain a lot of duplicate code because many elixirs are almost identical.
In TrixiParticles.jl, we tried to avoid this by recursively calling
trixi_include
.For example, we have a 3D version of a 2D example file, which looks like this:
In this case, defining 3D fluid and tank sizes, 3D acceleration and a 3D kernel are necessary to make the simulation 3D.
The other kwargs
fluid_particle_spacing
,tspan
,maxiters
,fluid_density_calculator
andclip_negative_pressure
are defining the same values as in the 2D file. We only added them to be able to overwrite these assignments when including the 3D file:It would be very convenient to either
trixi_include
recursive,trixi_include(..., recursive = true)
, ortrixi_include_recursive
.Option 2 conflicts with overwriting assignments with the same name
recursive
.Option 3 is a bit awkward.
Is there any reason against option 1?
I already implemented the logic for a recursive macro in #35.
The text was updated successfully, but these errors were encountered: