From e7892f0f87a9258d3b45e9d0cf674ce142f761eb Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Fri, 18 Nov 2022 02:40:52 +1300 Subject: Refactored code into appropriate packages --- src/datatypes.ads | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/datatypes.ads (limited to 'src/datatypes.ads') diff --git a/src/datatypes.ads b/src/datatypes.ads new file mode 100644 index 0000000..50d21f9 --- /dev/null +++ b/src/datatypes.ads @@ -0,0 +1,33 @@ + +with + + Ada.Numerics.Generic_Complex_Types, + Ada.Containers.Vectors; + +package Datatypes is + + type Quantity is digits 18; + + package Plane is new Ada.Numerics.Generic_Complex_Types (Real => Quantity); + + type Particle is record + Place : Plane.Complex; + Solid : Boolean; + Density : Quantity := 0.0; + Acceleration : Plane.Complex := Plane.Compose_From_Cartesian (0.0, 0.0); + Velocity : Plane.Complex := Plane.Compose_From_Cartesian (0.0, 0.0); + end record; + + function Create + (X, Y : in Quantity; + Solid : in Boolean) + return Particle; + + package Particle_Vectors is new Ada.Containers.Vectors + (Index_Type => Positive, + Element_Type => Particle); + + subtype Particle_Vector is Particle_Vectors.Vector; + +end Datatypes; + -- cgit