Cleanup
parent
267ab0aa4d
commit
1ae43cc5e7
|
@ -11,39 +11,37 @@ IN: benchmark.nbody
|
||||||
TUPLE: body
|
TUPLE: body
|
||||||
{ location float-array }
|
{ location float-array }
|
||||||
{ velocity float-array }
|
{ velocity float-array }
|
||||||
{ mass float } ;
|
{ mass float read-only } ;
|
||||||
|
|
||||||
: <body> ( -- body ) body new ; inline
|
: <body> ( location velocity mass -- body )
|
||||||
|
[ days-per-year v*n ] [ solar-mass * ] bi* body boa ; inline
|
||||||
|
|
||||||
: <jupiter> ( -- body )
|
: <jupiter> ( -- body )
|
||||||
<body>
|
F{ 4.84143144246472090e+00 -1.16032004402742839e+00 -1.03622044471123109e-01 }
|
||||||
F{ 4.84143144246472090e+00 -1.16032004402742839e+00 -1.03622044471123109e-01 } >>location
|
F{ 1.66007664274403694e-03 7.69901118419740425e-03 -6.90460016972063023e-05 }
|
||||||
F{ 1.66007664274403694e-03 7.69901118419740425e-03 -6.90460016972063023e-05 } days-per-year v*n >>velocity
|
9.54791938424326609e-04
|
||||||
9.54791938424326609e-04 solar-mass * >>mass ;
|
<body> ;
|
||||||
|
|
||||||
: <saturn> ( -- body )
|
: <saturn> ( -- body )
|
||||||
<body>
|
F{ 8.34336671824457987e+00 4.12479856412430479e+00 -4.03523417114321381e-01 }
|
||||||
F{ 8.34336671824457987e+00 4.12479856412430479e+00 -4.03523417114321381e-01 } >>location
|
F{ -2.76742510726862411e-03 4.99852801234917238e-03 2.30417297573763929e-05 }
|
||||||
F{ -2.76742510726862411e-03 4.99852801234917238e-03 2.30417297573763929e-05 } days-per-year v*n >>velocity
|
2.85885980666130812e-04
|
||||||
2.85885980666130812e-04 solar-mass * >>mass ;
|
<body> ;
|
||||||
|
|
||||||
: <uranus> ( -- body )
|
: <uranus> ( -- body )
|
||||||
<body>
|
F{ 1.28943695621391310e+01 -1.51111514016986312e+01 -2.23307578892655734e-01 }
|
||||||
F{ 1.28943695621391310e+01 -1.51111514016986312e+01 -2.23307578892655734e-01 } >>location
|
F{ 2.96460137564761618e-03 2.37847173959480950e-03 -2.96589568540237556e-05 }
|
||||||
F{ 2.96460137564761618e-03 2.37847173959480950e-03 -2.96589568540237556e-05 } days-per-year v*n >>velocity
|
4.36624404335156298e-05
|
||||||
4.36624404335156298e-05 solar-mass * >>mass ;
|
<body> ;
|
||||||
|
|
||||||
: <neptune> ( -- body )
|
: <neptune> ( -- body )
|
||||||
<body>
|
F{ 1.53796971148509165e+01 -2.59193146099879641e+01 1.79258772950371181e-01 }
|
||||||
F{ 1.53796971148509165e+01 -2.59193146099879641e+01 1.79258772950371181e-01 } >>location
|
F{ 2.68067772490389322e-03 1.62824170038242295e-03 -9.51592254519715870e-05 }
|
||||||
F{ 2.68067772490389322e-03 1.62824170038242295e-03 -9.51592254519715870e-05 } days-per-year v*n >>velocity
|
5.15138902046611451e-05
|
||||||
5.15138902046611451e-05 solar-mass * >>mass ;
|
<body> ;
|
||||||
|
|
||||||
: <sun> ( -- body )
|
: <sun> ( -- body )
|
||||||
<body>
|
F{ 0 0 0 } F{ 0 0 0 } 1 <body> ;
|
||||||
solar-mass >>mass
|
|
||||||
F{ 0 0 0 } >>location
|
|
||||||
F{ 0 0 0 } >>velocity ;
|
|
||||||
|
|
||||||
: offset-momentum ( body offset -- body )
|
: offset-momentum ( body offset -- body )
|
||||||
vneg solar-mass v/n >>velocity ; inline
|
vneg solar-mass v/n >>velocity ; inline
|
||||||
|
|
Loading…
Reference in New Issue