Planet v0.1.1 GEOF.Planet.SphereServer

The main server for running computations over the Sphere.

## Naming conventions:

In all servers for GEOF.Planet, the names panel and field are equivalent to panel_index and field_index respectively for the sake of brevity. The data belonging to a field is always field_data, and a group of such data is sphere_data, whether it’s data for just part of the sphere or for the entire sphere.

In the servers’ APIs, get is always a call, and send and receive are always casts.

Atoms surrounded with double-underscores indicate messages and state keys that are intended only to be used by methods internal to SphereServer and PanelServer. Once an iteration is complete, no remaining messages or state keys should be present in the system.

Link to this section Summary

Types

An arbitrary set of unique Field indices

A mapping for Field indices belonging to each Panel index

A reference to a function to be called for each field during a compute frame

A Panel index. Spheres will manage a limited number of Panels, so this is just a non-negative integer

Information about a particular Sphere, including its geometry

A mapping for Field data belonging to each Field index in a Sphere

A Sphere reference. Any number of Spheres could be running, so this is a reference

Functions

Returns a specification to start this module under a supervisor

Gets the data for each Field in the Sphere

Starts a compute frame. The SphereServer will send frame_complete when finished

Starts a SphereServer. This will automatically divide the Sphere into Panels (contiguous subsets of the Sphere’s Fields) based on the number of cores available and spawn the servers needed to run compute frames

Link to this section Types

An arbitrary set of unique Field indices.

Link to this type fields_at_panels()
fields_at_panels() :: %{optional(panel_index()) => fields()}

A mapping for Field indices belonging to each Panel index.

Link to this type fn_ref()
fn_ref() :: {module(), function_name :: atom()}

A reference to a function to be called for each field during a compute frame.

Link to this type panel_index()
panel_index() :: non_neg_integer()

A Panel index. Spheres will manage a limited number of Panels, so this is just a non-negative integer.

Information about a particular Sphere, including its geometry.

Link to this type sphere_data()
sphere_data() :: %{optional(GEOF.Planet.Field.index()) => any()}

A mapping for Field data belonging to each Field index in a Sphere.

Link to this type sphere_id()
sphere_id() :: reference()

A Sphere reference. Any number of Spheres could be running, so this is a reference.

Link to this section Functions

Link to this function child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function get_all_field_data(sphere_id)
get_all_field_data(sphere_id()) :: sphere_data()

Gets the data for each Field in the Sphere.

Link to this function init_sphere(divisions, sphere_id)
Link to this function start_frame(sphere_id, arg, from)
start_frame(sphere_id(), fn_ref(), pid()) :: :ok

Starts a compute frame. The SphereServer will send frame_complete when finished.

Link to this function start_link(divisions, sphere_id)

Starts a SphereServer. This will automatically divide the Sphere into Panels (contiguous subsets of the Sphere’s Fields) based on the number of cores available and spawn the servers needed to run compute frames.