JuliaAstroSim / AstroIO.jl

I/O interface for astrophysical simulation codes
GNU General Public License v3.0
5 stars 1 forks source link

Add a more general way to read gadget2 file blocks #9

Open elehcim opened 3 years ago

elehcim commented 3 years ago

If a non standard block is present into the file, read it and put it into the relative StructArray with the correct Collection label.

For example blocks relative to the chemical composition of the gas particles...

islent commented 3 years ago

Could you provide a test file?

I've got an unrefined idea to read non-standard blocks if not eof, in https://github.com/JuliaAstroSim/AstroIO.jl/blob/d219923fcf8fdbe5324253e263512f05fe5ced34/src/Gadget.jl#L312-L347

However, these non-standard data would be orgnized outside the particle array. It also need users to define the data type.

So I suggest that, user should provide two things, which could be packed in a Dict for multiple non-standard fields:

    function read_CHEM!(...)   # constrain data type here
        ...
    end

    arg = Dict("CHEM" => read_CHEM!, ...)  # provide to read_gadget2_particle_format2