Skip to content

Some type hierarchy suggestions #3

@adamslc

Description

@adamslc

Hi @Beforerr, I wanted to offer a few suggestions for the type hierarchy that this package implements. This would help me to incorporate this into the JuliaPlasma/ParticleInCell.jl.

At it's core, I suggest making the type hierarchy something like:

AbstractParticle{M,Z}
└─ Particle{M,Z}

This will allow for dispatch based on the mass number and charge state of the particle. Additionally, I wonder if it would be worth supporting a field in the Particle struct to specify the exact mass of the particle:

struct Particle{M,Z,T} <: AbstractParticle{M,Z,T}
    symbol::Symbol
    mass::T
end

If storing this information is not desired, the T=Nothing.

Aside: I suggest renaming ChargedParticleImpl to Particle regardless. In my (very) humble opinion, this is a more Julian way to name the type. You could also consider ChargedParticle, but since Z=0 is allowed, I don`t think it makes as much sense.

Regardless of if you accept my suggestions, thanks for the great package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions