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

#46 classe ParamValues : setter singleValue modifié pour avoir la possibilité...

 #46 classe ParamValues : setter singleValue modifié pour avoir la possibilité de mettre à jour de manière optionnelle le mode de génération des valeurs (nécessaire pour CalcSerie())
parent 347ed123
No related branches found
No related tags found
No related merge requests found
......@@ -147,7 +147,7 @@ export class Dichotomie extends Debug {
}
private set vX(vCalc: number) {
this._paramX.v = vCalc;
this._paramX.setValue(vCalc, false);
}
/**
......
......@@ -55,7 +55,7 @@ export abstract class Nub extends ComputeNode {
return this._result;
}
const sAnalyticalPrm: string = this.getFirstAnalyticalParameter().symbol;
computedVar.v = resSolve.vCalc;
computedVar.setValue(resSolve.vCalc, false);
const res: Result = this.Equation(sAnalyticalPrm);
res.vCalc = resSolve.vCalc;
this._result = res;
......
......@@ -31,7 +31,7 @@ export class BaseParam extends JalhydObject {
this._symbol = symb;
this._paramValues = new ParamValues();
this._paramValues.singleValue = val;
this._paramValues.setSingleValue(val);
if (d instanceof ParamDomain) {
this._domain = d;
......@@ -76,9 +76,9 @@ export class BaseParam extends JalhydObject {
return this._paramValues.singleValue;
}
public setValue(val: number) {
public setValue(val: number, updateValueMode = true) {
this.checkValue(val);
this._paramValues.singleValue = val;
this._paramValues.setSingleValue(val, updateValueMode);
// console.log("setting param " + this._symbol + " id=" + this._id + " to " + val); // A VIRER
}
......
......@@ -211,23 +211,23 @@ export class ParamValues {
constructor() {
this._singleValue = new DefinedNumber();
this.valueMode = ParamValueMode.CALCUL;
this._valueMode = ParamValueMode.CALCUL;
}
public setValues(o: number | any, max?: number, step?: number) {
if (typeof (o) === "number") {
if (max == undefined) {
this.valueMode = ParamValueMode.SINGLE;
this._valueMode = ParamValueMode.SINGLE;
this._singleValue.value = o as number;
} else {
this.valueMode = ParamValueMode.MINMAX;
this._valueMode = ParamValueMode.MINMAX;
this._minValue = o as number;
this._maxValue = max;
this._stepValue = step;
}
}
else if (Array.isArray(o)) {
this.valueMode = ParamValueMode.LISTE;
this._valueMode = ParamValueMode.LISTE;
this._valueList = o;
}
else
......@@ -286,9 +286,10 @@ export class ParamValues {
return this._singleValue.uncheckedValue;
}
public set singleValue(v: number) {
public setSingleValue(v: number, updateValueMode = true) {
this._singleValue.value = v;
this.valueMode = ParamValueMode.SINGLE;
if (updateValueMode)
this._valueMode = ParamValueMode.SINGLE;
}
public get isDefined() {
......@@ -301,7 +302,7 @@ export class ParamValues {
public set min(v: number) {
this._minValue = v;
this.valueMode = ParamValueMode.MINMAX;
this._valueMode = ParamValueMode.MINMAX;
}
public get max() {
......@@ -310,7 +311,7 @@ export class ParamValues {
public set max(v: number) {
this._maxValue = v;
this.valueMode = ParamValueMode.MINMAX;
this._valueMode = ParamValueMode.MINMAX;
}
public get stepRefValue(): Pair {
......@@ -325,7 +326,7 @@ export class ParamValues {
public set step(v: number) {
this._stepValue = v;
this.valueMode = ParamValueMode.MINMAX;
this._valueMode = ParamValueMode.MINMAX;
}
public get valueList() {
......@@ -335,7 +336,7 @@ export class ParamValues {
public set valueList(l: number[]) {
this._valueList = l;
this.valueMode = ParamValueMode.LISTE;
this._valueMode = ParamValueMode.LISTE;
}
/**
......@@ -383,7 +384,7 @@ export class ParamValues {
* copie des membres
*/
public copyMembers(n: ParamValues) {
n._valueMode = this.valueMode;
n._valueMode = this._valueMode;
n._singleValue = new DefinedNumber(this._singleValue.value);
n._minValue = this._minValue;
n._maxValue = this._maxValue;
......
......@@ -189,7 +189,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.v = this.prms.Q.v - this.CalcQ(sVC.index).vCalc;
this.structures[sVC.index].prms.Q.setValue(this.prms.Q.v - this.CalcQ(sVC.index).vCalc, false);
// 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