diff --git a/Project.toml b/Project.toml index 1e1950d..034e2d6 100644 --- a/Project.toml +++ b/Project.toml @@ -14,6 +14,7 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" PhysicalParticles = "78724250-4eb2-11e9-0f34-13a7aab864c5" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" @@ -29,10 +30,11 @@ CSV = "0.9, 0.10" Combinatorics = "1" ConfParser = "0.1" FileIO = "1" -HDF5 = "0.15, 0.16" +HDF5 = "0.15, 0.16, 0.17" IterTools = "1.3" JLD2 = "0.4" PhysicalParticles = "1" +PrecompileTools = "1" ProgressMeter = "1" Reexport = "1" StaticArrays = "1" diff --git a/src/AstroIO.jl b/src/AstroIO.jl index afed729..eb51ef4 100644 --- a/src/AstroIO.jl +++ b/src/AstroIO.jl @@ -1,5 +1,6 @@ module AstroIO +using PrecompileTools using Reexport using Unitful, UnitfulAstro using FileIO, JLD2, HDF5 @@ -90,4 +91,5 @@ include("PrettyPrint.jl") include("Tools.jl") include("ConfParser.jl") +include("precompile.jl") end # module diff --git a/src/precompile.jl b/src/precompile.jl new file mode 100644 index 0000000..6751d1b --- /dev/null +++ b/src/precompile.jl @@ -0,0 +1,31 @@ +@setup_workload begin + @compile_workload begin + foldertest = joinpath(@__DIR__, "../test") + + h, d = read_gadget2(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro) + write_gadget2(joinpath(foldertest, "testGadget.gadget2"), h, d) + write_gadget2(joinpath(foldertest, "testGadgetHeaderGeneration.gadget2"), d) + pos = read_gadget2_pos(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro, uGadget2) + h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), uAstro, uGadget2) + h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), nothing, uGadget2) + h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), nothing, nothing) + pos = read_gadget2_pos(joinpath(foldertest, "pot_acc.format2.gadget2"), uGadget2) + + h, d = read_gadget2(joinpath(foldertest, "pot_acc.format2.gadget2"), uAstro, uGadget2) + write_gadget2_format2(joinpath(foldertest, "pot_acc.format2.test.gadget2"), h, d, acc = true, pot = true) + # h, d = load(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro) + stars2d = [Star2D() for i = 1:10] + write_csv(joinpath(foldertest, "testcsvStar2D"), stars2d, nothing) + stars = [Star(uAstro) for i = 1:10] + write_csv(joinpath(foldertest, "testcsvStar"), stars, uAstro) + data = [[Star() for i = 1:10]; [Ball() for i = 1:10]] + write_csv(joinpath(foldertest, "testcsvGeneral"), data, nothing) + write_ramses(joinpath(foldertest, "ramses.csv"), stars) + header, data = read_gadget2(joinpath(foldertest, "gassphere_littleendian.gadget2"), uAstro) + d = [Star2D() for i = 1:10] + write_gadget2_jld(joinpath(foldertest, "testjldGadget.jld2"), header, d) + h, d = read_gadget2_jld(joinpath(foldertest, "testjldGadget.jld2")) + write_jld(joinpath(foldertest, "testjldGeneral.jld2"), d) + d = read_jld(joinpath(foldertest, "testjldGadget.jld2")) + end +end