Skip to content
Snippets Groups Projects
Commit 360db843 authored by francois.grand's avatar francois.grand
Browse files

#46 ParamValues.setSingleValue() : suppression du paramètre de MAJ du mode de...

 #46 ParamValues.setSingleValue() : suppression du paramètre de MAJ du mode de valeur (pose plus de problèmes qu'il n'en résoud)
parent a02f44d1
No related branches found
No related tags found
No related merge requests found
/// <reference path="../../node_modules/@types/jasmine/index.d.ts" />
import { ParamValues, ParamValueMode, ParamValueIterator } from "../../src/param/param-values"
function checkNumberList(it: ParamValueIterator, exp: number[]) {
......@@ -14,7 +12,7 @@ function checkNumberList(it: ParamValueIterator, exp: number[]) {
describe('paramvalues iterator : ', () => {
it("vide (1)", () => {
const p = new ParamValues();
expect(() => p.getValuesIterator()).toThrow(new Error("ParamValueIterator : mode de génération de valeurs CALCUL incorrect"));
expect(() => p.getValuesIterator()).toThrow(new Error("ParamValues : mode de valeurs undefined incorrect"));
});
it("vide (2)", () => {
......
......@@ -158,7 +158,7 @@ export class Dichotomie extends Debug {
}
private set vX(vCalc: number) {
this._paramX.setValue(vCalc, false);
this._paramX.setValue(vCalc);
}
/**
......
......@@ -55,7 +55,7 @@ export abstract class Nub extends ComputeNode {
return this._result;
}
const sAnalyticalPrm: string = this.getFirstAnalyticalParameter().symbol;
computedVar.setValue(resSolve.vCalc, false);
computedVar.setValue(resSolve.vCalc);
const res: Result = this.Equation(sAnalyticalPrm);
res.vCalc = resSolve.vCalc;
this._result = res;
......
......@@ -76,11 +76,9 @@ export class BaseParam extends JalhydObject {
return this._paramValues.singleValue;
}
public setValue(val: number, updateValueMode = true) {
public setValue(val: number) {
this.checkValue(val);
this._paramValues.setSingleValue(val, updateValueMode);
// console.log("setting param " + this._symbol + " id=" + this._id + " to " + val); // A VIRER
this._paramValues.setSingleValue(val);
}
public get uncheckedValue(): number {
......
......@@ -211,7 +211,6 @@ export class ParamValues {
constructor() {
this._singleValue = new DefinedNumber();
this._valueMode = ParamValueMode.CALCUL;
}
public setValues(o: number | any, max?: number, step?: number) {
......@@ -286,10 +285,8 @@ export class ParamValues {
return this._singleValue.uncheckedValue;
}
public setSingleValue(v: number, updateValueMode = true) {
public setSingleValue(v: number) {
this._singleValue.value = v;
if (updateValueMode)
this._valueMode = ParamValueMode.SINGLE;
}
public get isDefined() {
......
......@@ -139,7 +139,7 @@ export class ParallelStructure extends Nub {
case "Q":
res = super.Calc(sVarCalc, rInit, rPrec);
if (res.ok) {
this.getParameter(sVarCalc).setValue(res.vCalc, false);
this.getParameter(sVarCalc).setValue(res.vCalc);
}
break;
default:
......@@ -147,7 +147,7 @@ export class ParallelStructure extends Nub {
const sVC = this.getStructureVarCalc(sVarCalc);
res = this.CalcStructPrm(sVC, rInit, rPrec);
if (res.ok) {
this.structures[sVC.index].getParameter(sVC.prm).setValue(res.vCalc, false);
this.structures[sVC.index].getParameter(sVC.prm).setValue(res.vCalc);
}
}
if (res.ok) {
......@@ -206,7 +206,7 @@ export class ParallelStructure extends Nub {
*/
private CalcStructPrm(sVC: IStructureVarCalc, rInit?: number, rPrec: number = 0.001): Result {
// Le débit restant sur la structure en calcul est :
this.structures[sVC.index].prms.Q.setValue(this.prms.Q.v - this.CalcQ(sVC.index).vCalc, false);
this.structures[sVC.index].prms.Q.setValue(this.prms.Q.v - this.CalcQ(sVC.index).vCalc);
// Calcul du paramètre de la structure en calcul
return this.structures[sVC.index].Calc(sVC.prm, rInit, rPrec);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment