summaryrefslogtreecommitdiff
path: root/setup.js
blob: e1527fbe7b3056ccae112dfdab2098c2b116b495 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var finalIntegrationTime = 1.0E05;
var integratorAbsoluteTolerance = 1.0E-06;
var integratorRelativeTolerance = 1.0E-06;
var maximumStepSize = 0.0E00;
var realTimeScaling = 0.0E00;
var toleranceOnTime = 1.0E-10;
var maxIntegrationTimeInterval = 1.00001E05;
var solver = 0.0;
var defaultProperties = null;

var expressionArray = [""];

var solver_kind_array = ["LSodar", "Sundials/CVODE - BDF - NEWTON",
    "Sundials/CVODE - BDF - FUNCTIONAL",
    "Sundials/CVODE - ADAMS - NEWTON",
    "Sundials/CVODE - ADAMS - FUNCTIONAL",
    "DOPRI5 - Dormand-Prince 4(5)",
    "RK45 - Runge-Kutta 4(5)",
    "Implicit RK45 - Implicit Runge-Kutta 4(5)",
    "CRANI - Crank-Nicolson 2(3)",
    "Sundials/IDA",
    "DDaskr - Newton",
    "DDaskr - GMRes"
];

function setup() {

    if (arguments[0] == "get") {
        defaultProperties = {
            i_time: ["Final Integration Time", "finalIntegrationTime", finalIntegrationTime],
            ab_tolerance: ["Integrator Absolute Tolerance", "integratorAbsoluteTolerance", integratorAbsoluteTolerance],
            rl_tolerance: ["Integrator Relative Tolerance", "integratorRelativeTolerance", integratorRelativeTolerance],
            max_step_sze: ["Maximum step size(0 means no limit)", "maximumStepSize", maximumStepSize],
            rt_scale: ["Real Time Scaling", "realTimeScaling", realTimeScaling],
            tm_tolerance: ["Tolerance on Time", "toleranceOnTime", toleranceOnTime],
            max_integ_time_interval: ["Maximum Integration Time Interval", "maxIntegrationTimeInterval", maxIntegrationTimeInterval],
            solv_kind: ["Solver Kind", "solver", solver]
        };
        return defaultProperties;
    } else if (arguments[0] == "set") {
        var properties = arguments[1];
        for (key in properties) {
            window[key] = properties[key];
        }

    } else if (arguments[0] == "getArray") {
        return solver_kind_array;
    }
}

function handleContext() {
    if (arguments[0] == "get") {
        return expressionArray;
    } else if (arguments[0] == "set") {
        expressionArray = arguments[1];
    }
}