summaryrefslogtreecommitdiff
path: root/js/Misc/CONSTRAINT2_c.js
diff options
context:
space:
mode:
authorSunil Shetye2018-06-25 12:08:56 +0530
committerSunil Shetye2018-06-25 12:45:27 +0530
commit7c70459c10aed0d74ee03896abaf47fefdbf7c8f (patch)
tree6f6acc6a5087295c6e59f0f94bfda5025049d5fa /js/Misc/CONSTRAINT2_c.js
parent870479a2e4b932426a904b2ebae7e4ee72037326 (diff)
downloadsci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.gz
sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.bz2
sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.zip
separate out code for getvalue
Diffstat (limited to 'js/Misc/CONSTRAINT2_c.js')
-rw-r--r--js/Misc/CONSTRAINT2_c.js90
1 files changed, 45 insertions, 45 deletions
diff --git a/js/Misc/CONSTRAINT2_c.js b/js/Misc/CONSTRAINT2_c.js
index d0f0a2ca..4d755545 100644
--- a/js/Misc/CONSTRAINT2_c.js
+++ b/js/Misc/CONSTRAINT2_c.js
@@ -1,70 +1,70 @@
/* autogenerated from "macros/Misc/CONSTRAINT2_c.sci" */
function CONSTRAINT2_c() {
CONSTRAINT2_c.prototype.define = function CONSTRAINT2_c() {
-x0=[0];
-xd0=[0];
-id=[0];
-model=scicos_model();
-model.sim=list("constraint_c",10004);
-model.in1=1;
-model.out=[[1],[1]];
-model.state=[[x0],[xd0]];
-model.ipar=id;
-model.blocktype="c";
-model.dep_ut=[false,true];
-exprs=list(strcat(sci2exp(x0)),strcat(sci2exp(xd0)),strcat(sci2exp(id)));
-gr_i=[];
-x=standard_define([3,2],model,exprs,gr_i);
+ x0 = [0];
+ xd0 = [0];
+ id = [0];
+ model = scicos_model();
+ model.sim = list("constraint_c",10004);
+ model.in1 = 1;
+ model.out = [[1],[1]];
+ model.state = [[x0],[xd0]];
+ model.ipar = id;
+ model.blocktype = "c";
+ model.dep_ut = [false,true];
+ exprs = list(strcat(sci2exp(x0)),strcat(sci2exp(xd0)),strcat(sci2exp(id)));
+ gr_i = [];
+ x = standard_define([3,2],model,exprs,gr_i);
}
CONSTRAINT2_c.prototype.details = function CONSTRAINT2_c() {
}
CONSTRAINT2_c.prototype.get = function CONSTRAINT2_c() {
}
CONSTRAINT2_c.prototype.set = function CONSTRAINT2_c() {
-x=arg1;
-graphics=arg1.graphics;
-exprs=graphics.exprs;
-model=arg1.model;
-while (true) {
-ask_again=false;
-[ok,x0,xd0,id,exprs]=scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs);
-if (!ok) {
+ x = arg1;
+ graphics = arg1.graphics;
+ exprs = graphics.exprs;
+ model = arg1.model;
+ while (true) {
+ ask_again = false;
+ [ok,x0,xd0,id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs);
+ if (!ok) {
break;
}
-x0=x0.slice();
-N=size(x0,"*");
-xd0=xd0.slice();
-Nxd=size(xd0,"*");
-id=id.slice();
-Nid=size(id,"*");
-if ((N!=Nxd)||(N!=Nid)) {
+ x0 = x0.slice();
+ N = size(x0,"*");
+ xd0 = xd0.slice();
+ Nxd = size(xd0,"*");
+ id = id.slice();
+ Nid = size(id,"*");
+ if ((N!=Nxd)||(N!=Nid)) {
message("incompatible sizes, states, their derivatives, and ID should be the same size ");
-ask_again=true;
+ ask_again = true;
}
-if ((N<=0&&!ask_again)) {
+ if ((N<=0&&!ask_again)) {
x_message("number of states (constraints) must be > 0 ");
-ask_again=true;
+ ask_again = true;
}
-if ((!ask_again)) {
+ if ((!ask_again)) {
for (i=1;i<=N;i+=1) {
-if (!((id[i-1]==0)||(id[i-1]==1))) {
-ask_again=true;
+ if (!((id[i-1]==0)||(id[i-1]==1))) {
+ ask_again = true;
x_message([["Id(i) must be either"],["0 when x\'(i) is not present in the feedback"],["1: when x\'(i) is present in the feedback"]]);
break;
}
-if ((id[i-1]==0)) {
-id[i-1]=-1;
+ if ((id[i-1]==0)) {
+ id[i-1] = -1;
}
}
}
-if (!ask_again) {
-graphics.exprs=exprs;
-model.state=[[x0],[xd0]];
-model.out=[[N],[N]];
-model.in1=N;
-model.ipar=id;
-x.graphics=graphics;
-x.model=model;
+ if (!ask_again) {
+ graphics.exprs = exprs;
+ model.state = [[x0],[xd0]];
+ model.out = [[N],[N]];
+ model.in1 = N;
+ model.ipar = id;
+ x.graphics = graphics;
+ x.model = model;
break;
}
}