Module Streamlines__.Core

Copyright (C) 2017-2018,  Colin P Stark and Gavin J Stark.  All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @file   core.ml
 * @brief  Core data, Info, and Workflow handling
 *
module ODM = Owl.Dense.Matrix.Generic
module ODN = Owl.Dense.Ndarray.Generic

Info module

The Info module provides name/value pairs, with the value being of a variant type permitting strings, ints and floats. The module is used to create the OpenCL compiler '#define' options.

module Info : sig ... end

Data and results structures

Core data structures and results, used throughout the processing stages.

type t_core_data = {
properties : Streamlines.Properties.t_props;
info : Info.t;
mutable roi_nx : int;
mutable roi_ny : int;
mutable roi_pixel_size : float;
mutable roi_region : float array;
mutable pad_width : int;
mutable roi_array : Streamlines.Globals.t_ba_floats;
mutable basin_fatmask_array : Streamlines.Globals.t_ba_chars;
mutable basin_mask_array : Streamlines.Globals.t_ba_chars;
mutable x_roi_n_pixel_centers : Streamlines.Globals.t_ba_floats;
mutable y_roi_n_pixel_centers : Streamlines.Globals.t_ba_floats;
mutable u_array : Streamlines.Globals.t_ba_floats;
mutable v_array : Streamlines.Globals.t_ba_floats;
mutable seeds : Streamlines.Globals.t_ba_floats;
}

t_core_data

This is the data structure used to contain the data used throughout the processing stages.

The properties covers all the workflows; the info is built from those properties with some short-term adaptations (since it is used for OpenCL compiler options, which vary slightly on invocation).

The arrays are filled in by individual workflows; they are initialized to small arrays, before they are modified at the appropriate point in the workflow.

type t_trace_results = {
mutable streamline_arrays : bytes array array;
traj_nsteps_array : Streamlines.Globals.t_ba_int16s;
traj_lengths_array : Streamlines.Globals.t_ba_floats;
slc_array : Streamlines.Globals.t_ba_ints;
slt_array : Streamlines.Globals.t_ba_floats;
sla_array : Streamlines.Globals.t_ba_floats;
}

t_trace_results

The trace results are produced by the trace workflow, and are consumed by later workflow stages.

Core toplevel functions

val create : Streamlines.Properties.t_props ‑> t_core_data

create properties

Create the core data structure from the given properties, initializing arrays minimally.

val set_roi : t_core_data ‑> int array ‑> unit

set_roi t roi

Allocate empty arrays for the Region-of-Interest