[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-499-gb2cd01e
ontologiae
ontologiae at ordinateur-de-ontologiae.local
Tue Sep 22 22:36:16 UTC 2009
The following commit has been merged in the master branch:
commit b2cd01ec038db0ccd4c83b96b1aaf9668190c016
Author: ontologiae <ontologiae at ordinateur-de-ontologiae.local>
Date: Wed Sep 23 00:35:17 2009 +0200
more high level
diff --git a/example/shootout/nbody/nbody.li b/example/shootout/nbody/nbody.li
index ff902d4..083f933 100644
--- a/example/shootout/nbody/nbody.li
+++ b/example/shootout/nbody/nbody.li
@@ -20,13 +20,9 @@ Section Private
- bodies:NATIVE_ARRAY[Expanded PLANET];
- - b:Strict PLANET;
- - b2:Strict PLANET;
- - dx:REAL_64;
- - dy:REAL_64;
- - dz:REAL_64;
- - distance:REAL_64;
- - mag : REAL_64;
+ - (b,b2) :Strict PLANET;
+ - b2:Strict PLANET;
+ - (dx,dy,dz,distance,mag):REAL_64;
Section External
@@ -39,38 +35,26 @@ Section External
b2 := bodies.item j.this;
- dx := b.x - b2.x;
- dy := b.y - b2.y;
- dz := b.z - b2.z;
+ (dx,dy,dz) := (b.x - b2.x, b.y - b2.y, b.z - b2.z);
distance := (dx * dx + dy * dy + dz * dz).sqrt;
mag := dt / (distance * distance * distance);
- b.set_vx (b.vx - dx * b2.mass * mag);
- b.set_vy (b.vy - dy * b2.mass * mag);
- b.set_vz (b.vz - dz * b2.mass * mag);
-
- b2.set_vx (b2.vx + dx * b.mass * mag);
- b2.set_vy (b2.vy + dy * b.mass * mag);
- b2.set_vz (b2.vz + dz * b.mass * mag);
+ b.set_vx (b.vx - dx * b2.mass * mag) vy (b.vy - dy * b2.mass * mag) vz (b.vz - dz * b2.mass * mag);
+ b2.set_vx (b2.vx + dx * b.mass * mag) vy (b2.vy + dy * b.mass * mag) vz (b2.vz + dz * b.mass * mag);
};
};
0.to n do { i : INTEGER;
b := bodies.item i.this;
- b.set_x (b.x + dt * b.vx);
- b.set_y (b.y + dt * b.vy);
- b.set_z (b.z + dt * b.vz);
+ b.set_x (b.x + dt * b.vx) y (b.y + dt * b.vy) z (b.z + dt * b.vz);
};
);
- energy n:INTEGER :REAL_64 <-
- ( + e : REAL_64;
- + b : Strict PLANET;
- + b2 : Strict PLANET;
- + dx, dy, dz : REAL_64;
- + distance : REAL_64;
+ ( + (b,b2) : Strict PLANET;
+ + e, dx, dy, dz , distance : REAL_64;
0.to nbodies do { i : INTEGER;
b := bodies.item i.this;
@@ -79,9 +63,7 @@ Section External
(i + 1).to nbodies do { j : INTEGER;
b2 := bodies.item j.this;
- dx := b.x - b2.x;
- dy := b.y - b2.y;
- dz := b.z - b2.z;
+ (dx,dy,dz) := (b.x - b2.x , b.y - b2.y ,b.z - b2.z);
distance := (dx * dx + dy * dy + dz * dz).sqrt;
@@ -97,9 +79,7 @@ Section External
+ b : Strict PLANET;
0.to n do { i : INTEGER;
b := bodies.item i.this;
- px := px + b.vx * b.mass;
- py := py + b.vy * b.mass;
- pz := pz + b.vz * b.mass;
+ (px,py,pz) := (px + b.vx * b.mass, py + b.vy * b.mass , pz + b.vz * b.mass);
};
bodies.first.set_speed_to (
--
Lisaac compiler
More information about the Lisaac-commits
mailing list