summaryrefslogtreecommitdiff
path: root/js/Misc/fortran_block.js
blob: 6d2825747fa2491599202f275834290761287864 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* autogenerated from "macros/Misc/fortran_block.sci" */
function fortran_block() {
    fortran_block.prototype.define = function fortran_block() {
        this.model = scicos_model();
        this.model.sim = list(new ScilabString([" "]), new ScilabDouble([1001]));
        this.model.in = new ScilabDouble([1]);
        this.model.out = new ScilabDouble([1]);
        this.model.evtin = new ScilabDouble([]);
        this.model.evtout = new ScilabDouble([]);
        this.model.state = new ScilabDouble([]);
        this.model.dstate = new ScilabDouble([]);
        this.model.rpar = new ScilabDouble([]);
        this.model.ipar = new ScilabDouble([0]);
        this.model.blocktype = new ScilabString(["c"]);
        this.model.firing = new ScilabDouble([]);
        this.model.dep_ut = new ScilabBoolean([true,false]);
        this.funam = "forty";
        var label = list([[sci2exp(this.model.in)],[sci2exp(this.model.out)],[strcat(sci2exp(this.model.rpar))],[this.funam]],list([]));
        var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"fortran_block\",sz(1),sz(2));"]);
        this.x = new standard_define(new ScilabDouble([4,2]),this.model,label,gr_i);
        return new BasicBlock(this.x);
    }
    fortran_block.prototype.details = function fortran_block() {
        return this.x;
    }
    fortran_block.prototype.get = function fortran_block() {
        var options = {
            i:["input ports sizes",this.i],
            o:["output port sizes",this.o],
            rpar:["System parameters vector",this.rpar],
            funam:["function name",this.funam],
        }
        return options;
    }
    fortran_block.prototype.set = function fortran_block() {
        var label = this.graphics.exprs;
        while (true) {
            var ok = true;
            this.i = parseFloat(arguments[0]["i"]);
            this.o = parseFloat(arguments[0]["o"]);
            this.rpar = inverse(arguments[0]["rpar"]);
            this.funam = arguments[0]["funam"];
            this.lab = arguments[0]["lab"];
            if (!ok) {
                break;
            }
            if (this.funam==" ") {
                break;
            }
            label[1-1] = this.lab;
            this.rpar = this.rpar.slice();
            this.i = int(this.i.slice());
            var ni = size(this.i,1);
            this.o = int(this.o.slice());
            var no = size(this.o,1);
            var tt = label[2-1];
            if (this.model.sim[1-1]!=this.funam||size(this.model.in,"*")!=size(this.i,"*")||size(this.model.out,"*")!=size(this.o,"*")) {
                var tt = [];
            }
            var tmpvar0 = FORTR(this.funam,tt,this.i,this.o);
            var ok = tmpvar0[0];
            var tt = tmpvar0[1];
            if (!ok) {
                break;
            }
            var tmpvar1 = check_io(this.model,this.graphics,this.i,this.o,[],[]);
            this.model = tmpvar1[0];
            this.graphics = tmpvar1[1];
            var ok = tmpvar1[2];
            if (ok) {
                this.model.sim[1-1] = new ScilabString([this.funam]);
                this.model.rpar = new ScilabDouble(this.rpar);
                label[2-1] = tt;
                this.x.model = this.model;
                this.graphics.exprs = new ScilabDouble([label]);
                this.x.graphics = this.graphics;
                break;
            }
        }
        return new BasicBlock(this.x);
    }
}