89 |
vok = var_apply_filter(v,&integrator_ida_nonderiv); |
vok = var_apply_filter(v,&integrator_ida_nonderiv); |
90 |
|
|
91 |
if(vok && !var_incident(v)){ |
if(vok && !var_incident(v)){ |
92 |
VARMSG("good var '%s' is not incident"); |
/* VARMSG("good var '%s' is not incident"); */ |
93 |
/* var meets our filter, but perhaps it's not incident? */ |
/* var meets our filter, but perhaps it's not incident? */ |
94 |
if(seq.n == 1 || var_apply_filter(seq.vars[1],&integrator_ida_nonderiv)){ |
if(seq.n == 1 || var_apply_filter(seq.vars[1],&integrator_ida_nonderiv)){ |
95 |
VARMSG("DEACTIVATING NON-INCIDENT VAR '%s' (NO DERIVATIVE)"); |
/* VARMSG("DEACTIVATING NON-INCIDENT VAR '%s' (NO DERIVATIVE)"); */ |
96 |
var_set_active(v,0); |
var_set_active(v,0); |
97 |
vok = 0; |
vok = 0; |
98 |
}else{ |
}else{ |
99 |
VARMSG("'%s' has a derivative that's OK"); |
/* VARMSG("'%s' has a derivative that's OK"); */ |
100 |
ERROR_REPORTER_HERE(ASC_USER_ERROR,"Non-incident var with an incident derivative. ASCEND can't handle this case at the moment, but we hope to fix it."); |
ERROR_REPORTER_HERE(ASC_USER_ERROR,"Non-incident var with an incident derivative. ASCEND can't handle this case at the moment, but we hope to fix it."); |
101 |
return 1; |
return 1; |
102 |
} |
} |
103 |
} |
} |
104 |
|
|
105 |
if(!vok){ |
if(!vok){ |
106 |
VARMSG("'%s' fails non-deriv filter"); |
/* VARMSG("'%s' fails non-deriv filter"); |
107 |
if(var_fixed(v)){ |
if(var_fixed(v)){ |
108 |
CONSOLE_DEBUG("(var is fixed"); |
CONSOLE_DEBUG("(var is fixed"); |
109 |
} |
} |
110 |
CONSOLE_DEBUG("passes nonderiv? %s (flags = 0x%x)" |
CONSOLE_DEBUG("passes nonderiv? %s (flags = 0x%x)" |
111 |
, (var_apply_filter(v,&integrator_ida_nonderiv) ? "TRUE" : "false") |
, (var_apply_filter(v,&integrator_ida_nonderiv) ? "TRUE" : "false") |
112 |
, var_flags(v)); |
, var_flags(v) |
113 |
|
); |
114 |
|
*/ |
115 |
for(j=1;j<seq.n;++j){ |
for(j=1;j<seq.n;++j){ |
116 |
v = seq.vars[j]; |
v = seq.vars[j]; |
117 |
var_set_active(v,FALSE); |
var_set_active(v,FALSE); |
118 |
var_set_value(v,0); |
var_set_value(v,0); |
119 |
VARMSG("Derivative '%s' SET ZERO AND INACTIVE"); |
/* VARMSG("Derivative '%s' SET ZERO AND INACTIVE"); */ |
120 |
} |
} |
121 |
continue; |
continue; |
122 |
} |
} |
132 |
if(var_apply_filter(seq.vars[1],&integrator_ida_deriv)){ |
if(var_apply_filter(seq.vars[1],&integrator_ida_deriv)){ |
133 |
/* add the diff & deriv vars to the lists */ |
/* add the diff & deriv vars to the lists */ |
134 |
n_y++; |
n_y++; |
135 |
VARMSG("Added diff var '%s'"); |
/* VARMSG("Added diff var '%s'"); |
136 |
v = seq.vars[1]; VARMSG("and its derivative '%s'"); |
v = seq.vars[1]; VARMSG("and its derivative '%s'"); */ |
137 |
continue; |
continue; |
138 |
} |
} |
139 |
VARMSG("Diff var '%s' being converted to alg var..."); |
/* VARMSG("Diff var '%s' being converted to alg var..."); |
140 |
v = seq.vars[1]; VARMSG("...because deriv var '%s' fails filter"); |
v = seq.vars[1]; VARMSG("...because deriv var '%s' fails filter"); */ |
141 |
/* fall through */ |
/* fall through */ |
142 |
} |
} |
143 |
|
|
144 |
VARMSG("Adding '%s' to algebraic"); |
/* VARMSG("Adding '%s' to algebraic"); */ |
145 |
n_y++; |
n_y++; |
146 |
} |
} |
147 |
|
|
277 |
sys->y_id = ASC_NEW_ARRAY(int,sys->n_ydot); |
sys->y_id = ASC_NEW_ARRAY(int,sys->n_ydot); |
278 |
for(i=0,j=0; i < sys->n_y; ++i){ |
for(i=0,j=0; i < sys->n_y; ++i){ |
279 |
if(sys->ydot[i]==NULL)continue; |
if(sys->ydot[i]==NULL)continue; |
280 |
v = sys->ydot[i]; VARMSG("deriv '%s'..."); |
/* v = sys->ydot[i]; VARMSG("deriv '%s'..."); */ |
281 |
v = sys->y[i]; VARMSG("diff '%s'..."); |
/* v = sys->y[i]; VARMSG("diff '%s'..."); */ |
282 |
sys->y_id[var_sindex(sys->ydot[i]) - sys->n_y] = i; |
sys->y_id[var_sindex(sys->ydot[i]) - sys->n_y] = i; |
283 |
j++; |
j++; |
284 |
} |
} |
551 |
if(allownull)continue; |
if(allownull)continue; |
552 |
else return 2; |
else return 2; |
553 |
} |
} |
554 |
|
asc_assert(v!=0x31); |
555 |
for(j=0; j<i-1;++j){ |
for(j=0; j<i-1;++j){ |
556 |
if(list[j]==NULL)continue; |
if(list[j]==NULL)continue; |
557 |
if(v==list[j]){ |
if(v==list[j]){ |
|
CONSOLE_DEBUG("duplicate found (%d, v = %p)",j,v); |
|
558 |
varname = var_make_name(sys->system,v); |
varname = var_make_name(sys->system,v); |
559 |
if(varname){ |
if(varname){ |
560 |
CONSOLE_DEBUG("Duplicate of '%s' found",varname); |
CONSOLE_DEBUG("Duplicate of '%s' found",varname); |
562 |
}else{ |
}else{ |
563 |
CONSOLE_DEBUG("Duplicate found (couldn't retrieve name)"); |
CONSOLE_DEBUG("Duplicate found (couldn't retrieve name)"); |
564 |
} |
} |
565 |
|
ASC_FREE(varname); |
566 |
return 1; |
return 1; |
567 |
} |
} |
568 |
} |
} |
610 |
return 1; |
return 1; |
611 |
} |
} |
612 |
|
|
613 |
if(check_dups(sys, sys->ydot, n_vars,TRUE)){ |
if(check_dups(sys, sys->ydot, sys->n_y,TRUE)){ |
614 |
ERROR_REPORTER_HERE(ASC_PROG_ERR,"duplicates in ydot vector"); |
ERROR_REPORTER_HERE(ASC_PROG_ERR,"duplicates in ydot vector"); |
615 |
return 1; |
return 1; |
616 |
} |
} |