aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ansi_terminal.adb15
-rw-r--r--src/ansi_terminal.ads9
-rw-r--r--src/datatypes.adb8
-rw-r--r--src/datatypes.ads9
-rw-r--r--src/fluid_simulator.adb37
5 files changed, 63 insertions, 15 deletions
diff --git a/src/ansi_terminal.adb b/src/ansi_terminal.adb
index c356c21..8e47d06 100644
--- a/src/ansi_terminal.adb
+++ b/src/ansi_terminal.adb
@@ -1,10 +1,18 @@
+
+-- Programmed by Jedidiah Barber
+-- Licensed under the Sunset License v1.0
+
+-- See license.txt for further details
+
+
with
Ada.Characters.Latin_1,
Ada.Strings.Fixed,
Ada.Text_IO;
+
package body ANSI_Terminal is
package Latin renames Ada.Characters.Latin_1;
@@ -60,8 +68,10 @@ package body ANSI_Terminal is
X, Y : in Integer)
return String
is
- Average_Density : Natural := Integer (Quantity'Ceiling (Input (X, Y).Density / 4.0));
- Bit_Index : Positive := Integer (Input (X, Y).Index) + 1;
+ Average_Density : constant Natural :=
+ Integer (Quantity'Ceiling (Input (X, Y).Density / 4.0));
+ Bit_Index : constant Positive :=
+ Integer (Input (X, Y).Index) + 1;
Choice : Natural;
begin
case Average_Density is
@@ -121,3 +131,4 @@ package body ANSI_Terminal is
end ANSI_Terminal;
+
diff --git a/src/ansi_terminal.ads b/src/ansi_terminal.ads
index 027f771..9167f1f 100644
--- a/src/ansi_terminal.ads
+++ b/src/ansi_terminal.ads
@@ -1,8 +1,16 @@
+
+-- Programmed by Jedidiah Barber
+-- Licensed under the Sunset License v1.0
+
+-- See license.txt for further details
+
+
with
Datatypes;
+
package ANSI_Terminal is
function Clear_Screen
@@ -39,3 +47,4 @@ private
end ANSI_Terminal;
+
diff --git a/src/datatypes.adb b/src/datatypes.adb
index 64ff017..30f2d86 100644
--- a/src/datatypes.adb
+++ b/src/datatypes.adb
@@ -1,4 +1,11 @@
+
+-- Programmed by Jedidiah Barber
+-- Licensed under the Sunset License v1.0
+
+-- See license.txt for further details
+
+
package body Datatypes is
@@ -13,3 +20,4 @@ package body Datatypes is
end Datatypes;
+
diff --git a/src/datatypes.ads b/src/datatypes.ads
index 50d21f9..403bf0e 100644
--- a/src/datatypes.ads
+++ b/src/datatypes.ads
@@ -1,9 +1,17 @@
+
+-- Programmed by Jedidiah Barber
+-- Licensed under the Sunset License v1.0
+
+-- See license.txt for further details
+
+
with
Ada.Numerics.Generic_Complex_Types,
Ada.Containers.Vectors;
+
package Datatypes is
type Quantity is digits 18;
@@ -31,3 +39,4 @@ package Datatypes is
end Datatypes;
+
diff --git a/src/fluid_simulator.adb b/src/fluid_simulator.adb
index 4f33a2f..b13f107 100644
--- a/src/fluid_simulator.adb
+++ b/src/fluid_simulator.adb
@@ -1,4 +1,11 @@
+
+-- Programmed by Jedidiah Barber
+-- Licensed under the Sunset License v1.0
+
+-- See license.txt for further details
+
+
with
Datatypes,
@@ -14,6 +21,7 @@ use type
Datatypes.Plane.Complex;
+
procedure Fluid_Simulator is
package ANSI renames ANSI_Terminal;
@@ -87,19 +95,21 @@ procedure Fluid_Simulator is
Rij : Quantity;
begin
for P of Store loop
- P.Acceleration := Gravity_Factor;
- for Q of Store loop
- Displacement := P.Place - Q.Place;
- Rij := Plane.Modulus (Displacement);
- if Rij < Particle_Radius then
- Pressure := (P.Density + Q.Density - 2.0 * P0) *
- Pressure_Factor * Displacement;
- Viscosity := (P.Velocity - Q.Velocity) * Viscosity_Factor;
- P.Acceleration := P.Acceleration +
- Plane.Compose_From_Cartesian (1.0 - Rij / Particle_Radius) /
- P.Density * (Pressure - Viscosity);
- end if;
- end loop;
+ if not P.Solid then
+ P.Acceleration := Gravity_Factor;
+ for Q of Store loop
+ Displacement := P.Place - Q.Place;
+ Rij := Plane.Modulus (Displacement);
+ if Rij < Particle_Radius then
+ Pressure := (P.Density + Q.Density - 2.0 * P0) *
+ Pressure_Factor * Displacement;
+ Viscosity := (P.Velocity - Q.Velocity) * Viscosity_Factor;
+ P.Acceleration := P.Acceleration +
+ Plane.Compose_From_Cartesian (1.0 - Rij / Particle_Radius) /
+ P.Density * (Pressure - Viscosity);
+ end if;
+ end loop;
+ end if;
end loop;
end Calculate_Interaction;
@@ -150,3 +160,4 @@ begin
end Fluid_Simulator;
+