Skip to content

Commit

Permalink
Merge c7fec5e into e37f139
Browse files Browse the repository at this point in the history
  • Loading branch information
Brinky5678 committed Apr 18, 2018
2 parents e37f139 + c7fec5e commit c5879e9
Show file tree
Hide file tree
Showing 20 changed files with 215 additions and 180 deletions.
2 changes: 2 additions & 0 deletions src/SPICE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,6 @@ include("v.jl")
include("w.jl")
include("x.jl")



end # module
4 changes: 2 additions & 2 deletions src/b.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ Fetch from the kernel pool the double precision values of an item associated wit
- `bodynm`: Body name
- `item`: Item for which values are desired. ("RADII", "NUT_PREC_ANGLES", etc.)
- `maxn`: Maximum number of values that may be returned.
### Output ###
Expand All @@ -273,8 +274,7 @@ Fetch from the kernel pool the double precision values of an item associated wit
- [NAIF Documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodvrd_c.html)
"""
function bodvrd(bodynm, item)
maxn = 100
function bodvrd(bodynm, item, maxn = 100)
values = Array{SpiceDouble}(maxn)
dim = Ref{SpiceInt}()
ccall((:bodvrd_c, libcspice), Void, (Cstring, Cstring, SpiceInt, Ref{SpiceInt}, Ptr{SpiceDouble}),
Expand Down
7 changes: 6 additions & 1 deletion src/c.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export ccifrm, cidfrm, ckcls, ckopn, ckw01, ckgp, ckgpav
export ccifrm, cidfrm, ckcls, ckopn, ckw01, ckgp, ckgpav, clight

"""
ccifrm(frclss, clssid)
Expand Down Expand Up @@ -135,3 +135,8 @@ end
"""
function ckgpav()
end

"Returns the speed of light in vacuo (km/sec)."
function clight()
ccall((:clight_c, libcspice), Cdouble, ())
end
16 changes: 0 additions & 16 deletions src/constants.jl

This file was deleted.

20 changes: 18 additions & 2 deletions src/k.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export kclear
export kclear, ktotal

"""
kclear()
Expand All @@ -13,4 +13,20 @@ variables are retained.
function kclear()
ccall((:kclear_c, libcspice), Void, ())
handleerror()
end
end

"""
ktotal(kind)
Return the current number of kernels that have been loaded
via the KEEPER interface that are of a specified type.
[https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ktotal_c.html]
(https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ktotal_c.html)
"""
function ktotal(kind)
count = Ref{SpiceInt}()
ccall((:ktotal_c, libcspice), Void, (Cstring, Ref{SpiceInt}), kind, count)
handleerror()
Int(count[])
end
13 changes: 13 additions & 0 deletions src/m.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export mxvg

function mxvg(m1, v2)
lm1, lm2 = size(m1)
lv = length(v2)
if lm2 != lv
error("Dimension mismatch.")
end
vout = Array{Float64}(lm1)
ccall((:mxvg_c, libcspice), Void, (Ptr{Float64}, Ptr{Float64}, Cint, Cint, Ptr{Float64}), transpose(m1), v2, lm1, lm2, vout)
handleerror()
return vout
end
13 changes: 0 additions & 13 deletions src/math.jl

This file was deleted.

13 changes: 13 additions & 0 deletions src/p.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export pxform

"""
Return the matrix that transforms position vectors from one specified frame to another at a specified epoch.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pxform_c.html
"""
function pxform(from::String, to::String, et::Float64)
rot = Array{Cdouble}(3, 3)
ccall((:pxform_c, libcspice), Void, (Cstring, Cstring, Cdouble, Ptr{Cdouble}), from, to, et, rot)
handleerror()
return rot
end
47 changes: 0 additions & 47 deletions src/pck.jl

This file was deleted.

98 changes: 97 additions & 1 deletion src/s.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,104 @@
export str2et
export str2et, spkezr, spkpos, spkcpo, spkopn, spkcls, spkw13, spd, sxform

function str2et(string)
et = Ref{Cdouble}(0)
ccall((:str2et_c, libcspice), Void, (Cstring, Ref{Cdouble}), string, et)
handleerror()
return et[]
end

"""
Returns the state of a target body relative to an observing body.
[NAIF documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkezr_c.html)
"""
function spkezr(targ::AbstractString, et::Float64, ref::AbstractString, obs::AbstractString; abcorr::AbstractString="NONE")
starg = Array{Cdouble}(6)
lt = Ref{Cdouble}(0)
ccall((:spkezr_c, libcspice), Void, (Cstring, Cdouble, Cstring, Cstring, Cstring, Ptr{Cdouble}, Ref{Cdouble}), targ, et, ref, abcorr, obs, starg, lt)
handleerror()
return starg, lt[]
end
spkezr(targ::Int, et::Float64, ref::AbstractString, obs::Int; abcorr::AbstractString="NONE") = spkezr(string(targ), et, ref, string(obs), abcorr=abcorr)
spkezr(targ::AbstractString, et::Float64, ref::AbstractString, obs::Int; abcorr::AbstractString="NONE") = spkezr(targ, et, ref, string(obs), abcorr=abcorr)
spkezr(targ::Int, et::Float64, ref::AbstractString, obs::AbstractString; abcorr::AbstractString="NONE") = spkezr(string(targ), et, ref, obs, abcorr=abcorr)

"""
Returns the state of a target body relative to an observing body.
[NAIF documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkpos_c.html)
"""
function spkpos(targ::AbstractString, et::Float64, ref::AbstractString, obs::AbstractString; abcorr::AbstractString="NONE")
starg = Array{Cdouble}(3)
lt = Ref{Cdouble}(0)
ccall((:spkpos_c, libcspice), Void, (Cstring, Cdouble, Cstring, Cstring, Cstring, Ptr{Cdouble}, Ref{Cdouble}), targ, et, ref, abcorr, obs, starg, lt)
handleerror()
return starg, lt[]
end
spkpos(targ::Int, et::Float64, ref::AbstractString, obs::Int; abcorr::AbstractString="NONE") = spkpos(string(targ), et, ref, string(obs), abcorr=abcorr)
spkpos(targ::AbstractString, et::Float64, ref::AbstractString, obs::Int; abcorr::AbstractString="NONE") = spkpos(targ, et, ref, string(obs), abcorr=abcorr)
spkpos(targ::Int, et::Float64, ref::AbstractString, obs::AbstractString; abcorr::AbstractString="NONE") = spkpos(string(targ), et, ref, obs, abcorr=abcorr)

"""
Returns the state of a target body relative to a constant-position observer location.
[https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcpo_c.html]
(https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcpo_c.html)
"""
function spkcpo(target, et, outref, refloc, obspos, obsctr, obsref; abcorr="NONE")
state = Array{Cdouble}(6)
lt = Ref{Cdouble}(0)
ccall(
(:spkcpo_c, libcspice), Void,
(Cstring, Cdouble, Cstring, Cstring, Cstring, Ptr{Cdouble}, Cstring, Cstring, Ptr{Cdouble}, Ref{Cdouble}),
target, et, outref, refloc, abcorr, obspos, obsctr, obsref, state, lt
)
handleerror()
return state, lt[]
end

function spkopn(name, ifname, ncomch)
handle = Ref{SpiceInt}(0)
ccall(
(:spkopn_c, libcspice), Void,
(Cstring, Cstring, Cint, Ref{Cint}), name, ifname, ncomch, handle
)
handleerror()
return handle[]
end

function spkcls(handle)
ccall(
(:spkcls_c, libcspice), Void,
(SpiceInt,), handle
)
handleerror()
return handle
end

function spkw13(handle, body, center, frame, first, last, segid, degree, states, epochs)
n = length(epochs)
ccall(
(:spkw13_c, libcspice), Void,
(Cint, Cint, Cint, Cstring, Cdouble, Cdouble, Cstring, Cint, Cint, Ptr{Cdouble}, Ptr{Cdouble}),
handle[], body, center, frame, first, last, segid, degree, n, states, epochs
)
handleerror()
end

"Returns the number of seconds in a day."
function spd()
ccall((:spd_c, libcspice), Cdouble, ())
end

"""
Return the state transformation matrix from one frame to another at a specified epoch.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sxform_c.html
"""
function sxform(from::String, to::String, et::Float64)
rot = Array{Cdouble}(6, 6)
ccall((:sxform_c, libcspice), Void, (Cstring, Cstring, Cdouble, Ptr{Cdouble}), from, to, et, rot)
handleerror()
return rot
end
80 changes: 0 additions & 80 deletions src/spk.jl

This file was deleted.

7 changes: 6 additions & 1 deletion src/t.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export timout, tisbod
export timout, tisbod, tyear

function timout(et, pictur)
string = Array{UInt8}(128)
Expand All @@ -15,3 +15,8 @@ function tisbod(ref, body, et)
handleerror()
tsipm'
end

"Returns the number of seconds per tropical year."
function tyear()
ccall((:tyear_c, libcspice), Cdouble, ())
end
16 changes: 0 additions & 16 deletions src/time.jl

This file was deleted.

Loading

0 comments on commit c5879e9

Please sign in to comment.