trixi-framework / trixi-framework/TrixiParticles.jl

Move fields that are only sometimes needed to the cache?

Open
#676 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
83
Forks
24
Avg merge
8d 18h
Merged PRs (30d)
3

Description

Okay, how about this?
We reduce fields to the minimum, and everything that is only needed when some method is used goes to the cache. Then we define

@inline function color(system)
    @assert haskey(system.cache, :color) "`color` of a `$(nameof(typeof(system)))` accessed, but there is no color method defined for this system"
    return system.cache.color
end

We could do the same for example with buffer, which is only needed by open boundaries and set to nothing in most simulations. I think this could make the system structs more readable.
What do you think, @LasNikas?

Originally posted by @efaulhaber in https://github.com/trixi-framework/TrixiParticles.jl/pull/539#discussion_r1856702070

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the system structs and existing cache usage, then trace where color and buffer are consumed, especially by open boundaries. Resolve the proposed minimum-field and cache design with maintainers before changing anything; done means the affected structs and cache behavior are agreed and covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.