summaryrefslogtreecommitdiff
path: root/js/PDE/PDE.js
blob: cd1f48e1b2bdcb73b45d6ee6b15156334049b38b (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* autogenerated from "macros/PDE/PDE.sci" */
function PDE() {
    PDE.prototype.define = function PDE() {
        this.model = scicos_model();
        this.model.state = new ScilabDouble([zeros(10,1)]);
        this.model.sim = list(new ScilabString(["PDE"]), new ScilabDouble([0]));
        this.model.in1 = [[1],[1],[1],[1],[1]];
        this.model.out = [[10],[0]];
        this.model.blocktype = new ScilabString(["c"]);
        this.model.dep_ut = [false,true];
        params_pde = tlist([["paramspde"],["a"],["b"],["txt_exp"],["check_op1"],["a1"],["b1"],["check_op2"],["a2"],["b2"],["check_op3"],["a3"],["b3"],["check_op4"],["a4"],["b4"],["check_op5"],["a5"],["b5"],["check_op6"],["a6"],["b6"],["check_op7"],["a7"],["b7"],["discr_cst"],["discr_non_cst"],["signe"],["rad_automatique"],["rad_manuel"],["methode"],["ord1"],["ord2"],["ord3"],["degre"],["nnode"],["txt_pas"],["CI"],["dCI"],["CLa"],["CLa_exp"],["CLb"],["CLb_exp"],["points"]],"","","","0","","IN_EDP1(t)","0","","IN_EDP2(t)","0","","IN_EDP3(t)","0","","IN_EDP4(t)","0","","IN_EDP5(t)","0","","IN_EDP6(t)","0","","IN_EDP7(t)","0","0","0","0","0","0","","","","","","","","","0","IN_CL1(t)","0","IN_CL2(t)","");
        label = list(params_pde,[],"");
        gr_i = [];
        this.x = standard_define([3,3],this.model,label,gr_i);
        return new BasicBlock(this.x);
    }
    PDE.prototype.details = function PDE() {
        return this.x;
    }
    PDE.prototype.get = function PDE() {
        var options = {
        }
        return options;
    }
    PDE.prototype.set = function PDE() {
        this.okk = parseBoolean(arguments[0]["okk"])
        this.rdnom = arguments[0]["rdnom"]
        this.lab = arguments[0]["lab"]
        this.x = arg1;
        graphics = arg1.graphics;
        label = graphics.exprs;
        this.model = arg1.model;
        params_pde = label[1-1];
        while (true) {
            [ln,fun]=where()
            if (!or(fun=="do_eval")) {
                [ok,a_domaine,b_domaine,discr,signe,choix,type_meth,degre,Nbr_maillage,CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,k,mesures,params_pde] = IHM_EDP(params_pde);
                if (ok) {
                    return;
                }
            } else {
                if (exists("%scicos_context")) {
                    [ok,a_domaine,b_domaine,discr,signe,choix,type_meth,degre,Nbr_maillage,CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,k,mesures,params_pde] = setvalue_IHM_EDP(params_pde);
                }
            }
            this.okk = false;
            this.rdnom = "PDE";
            ok1 = true;
            while (true) {
                [this.okk,this.rdnom,this.lab] = scicos_getvalue("PLEASE, GIVE US THE BLOCK\'s NAME. ","New block\'s name :",list("str",1),label[3-1]);
                if (this.okk==false) {
                    ok1 = false;
                    return;
                }
                label[3-1] = this.lab;
                this.rdnom = stripblanks(this.rdnom);
                if (this.rdnom==emptystr()) {
                    ok1 = false;
                    x_message("sorry C file name not defined");
                }
                if (ok1) {
                    break;
                }
            }
            if ((choix==0)) {
                ind4 = strindex(a4,"x");
                ind1 = strindex(a1,"x");
                ind2 = strindex(a2,"x");
                if ((ind4!=[]||ind1!=[]||ind2!=[])) {
                    if ((signe==1)) {
                        delta = 1;
                    } else if ((signe==2)) {
                        delta = -1;
                    } else if ((signe==0)) {
                        delta = 0;
                    } else {
                        x_message([["le discriminant n\'est pas constant,"],["Vous devez choisir son signe dans l\'IHM"]]);
                        return;
                    }
                } else {
                    delta = evstr(a4)^2-4*evstr(a1)*evstr(a2);
                }
                if ((delta==[])) {
                    delta = 0;
                }
                type_meth = this.arbre_decision[delta-1];
            }
            [flag_type,this.rdnom,DF_type,tt] = translate(CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,type_meth,degre,a_domaine,b_domaine,Nbr_maillage,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,this.rdnom,mesures);
            Nbr = Nbr_maillage;
            if (((CLa_type==1)&&(DF_type==0||DF_type==1))||((CLb_type==1)&&(DF_type==0||DF_type==2))) {
                Nbr = Nbr+1;
            }
            if ((mesures==[])) {
                out = Nbr_maillage;
            } else {
                out = [[Nbr_maillage],[size(mesures,"*")]];
            }
            if ((flag_type==1)) {
                this.model.sim = list(new ScilabDouble([this.rdnom]), new ScilabDouble([2004]));
                if ((find(oper==1)!=[])) {
                    this.model.state = new ScilabDouble([zeros(2*Nbr_maillage,1)]);
                } else {
                    this.model.state = new ScilabDouble([zeros(Nbr_maillage,1)]);
                }
            } else if ((flag_type==2)) {
                this.model.sim = list(new ScilabDouble([this.rdnom]), new ScilabDouble([12004]));
                if ((find(oper==1)!=[])) {
                    if ((type_meth==3&&(find(oper==2)!=[]||find(oper==4)!=[]))) {
                        this.model.state = new ScilabDouble([zeros(6*Nbr_maillage,1)]);
                    } else if ((type_meth==1)) {
                        this.model.state = new ScilabDouble([zeros(4*Nbr,1)]);
                    } else {
                        this.model.state = new ScilabDouble([zeros(4*Nbr_maillage,1)]);
                    }
                } else {
                    if ((type_meth==3&&(find(oper==2)!=[]||find(oper==4)!=[]))) {
                        this.model.state = new ScilabDouble([zeros(4*Nbr_maillage,1)]);
                    } else if ((type_meth==1)) {
                        this.model.state = new ScilabDouble([zeros(2*Nbr,1)]);
                    } else {
                        this.model.state = new ScilabDouble([zeros(2*Nbr_maillage,1)]);
                    }
                }
            }
            [ok1] = CFORTREDP(this.rdnom,tt);
            if (!ok1) {
                break;
            }
            if (!ok) {
                [this.model,graphics,ok] = check_io(this.model,graphics,ones(k,1),out.slice(),[],[]);
            }
            label[1-1] = params_pde;
            label[2-1] = tt;
            graphics.exprs = label;
            this.x.graphics = graphics;
            this.x.model = this.model;
            break;
        }
        return new BasicBlock(this.x);
    }
}