Module Streamlines

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   globals.ml
 * @brief  Globally useful functions and statics for the streamlines analysis
 *

The code is structured as follows:

  1. Basic infrastructure (dependent in this order):

    Globals; Properties; Core; Pocl

  2. Workflows (independent of each other, dependent on basic infrastructure)

  3. Streamlines dependent on all the other modules

The main data structure for the global vectors and ROI DTM are held in the 'Core' data structure. This also keeps the properties tree, which is read and filled in by 'Properties'.

The data is filled out by 'Geodata', which uses its properties to read in a Geotiff file, filling out the ROI DTM, and padding as appropriate, producing also the basin masks.

The 'Preprocess' workflow is a pure Ocaml stage that takes the ROI DTM and masks and produces the U/V array vector field upon which the rest of the work is done.

'Pocl' is a library that provides the access to the OpenCL subsystem, enabling programs and hence kernels to be compiled and invoked.

Module aliases

module Globals : sig ... end

Globals - types and support functions used throughout

module Properties : sig ... end

Properties - modules for verbosity, workflows and their properties. This contains structures common to all workflows

module Core : sig ... end

Core - module to manage the core data structures (and the Info for some reason)

module Pocl : sig ... end

Pocl - OpenCL abstraction layer, as a workflow (but using global properties)

module Geodata : sig ... end

Geodata - Workflow module that reads in DTM, sets up ROI and mask, filling out the core data

module Preprocess : sig ... end

Preprocess - Workflow module that takes an ROI and generates the vector field, filling blockages and fixing loops if required

module Integration : sig ... end

Integration - Used only by trace workflow, invokes GPU to trace streamlines and count flows through ROI pixels

module Trace : sig ... end

Trace - Workflow module that traces streamlines

module Plot : sig ... end

Plot - Workflow module that produces plots of DTM, ROI, and processed results

Function calls

val set_root : string ‑> unit

set_root root_dir - set the root directory for all relative filenames.

val str2bool : string ‑> bool

str2bool s - parse a string as a bool: t, true, yes, y, 1 all indicate true; no, n, f, false all indicate false. Everything else forces an exception

val verbosity_of_string : string ‑> int

verbosity_of_string s - get an integer verbosity level from a string; if the string is an integer, then use that, otherwise try it as a 'boolean' using str2bool

val parse_arguments : 'a ‑> string * Properties.t_cmdline_overrides

parse_arguments _

Parse the command line arguments using the system Arg module.

val process : string ‑> string ‑> Properties.t_cmdline_overrides ‑> unit

process json_dir parameters_filename cmdline_overrides

Read in the properties and set up the workflows, then perform the workflow stages required.