diff --git a/src/nub.ts b/src/nub.ts index d6132a92cbb2e0651bdac96817b6c4f84805359d..f18235deb176287136d9b1d624e95f23e19eda29 100644 --- a/src/nub.ts +++ b/src/nub.ts @@ -411,6 +411,8 @@ export abstract class Nub extends ComputeNode implements IObservable { child.parent = this; // propagate precision child.prms.Pr.setValue(this.prms.Pr.v); // does not write to .v to bypass calculability control + // postprocessing + this.adjustChildParameters(child); } public getChildren(): Nub[] { @@ -882,6 +884,8 @@ export abstract class Nub extends ComputeNode implements IObservable { } // add reference to parent collection (this) child.parent = this; + // postprocessing + this.adjustChildParameters(child); } /** @@ -1053,6 +1057,12 @@ export abstract class Nub extends ComputeNode implements IObservable { }, this); } + /** + * Optional postprocessing after adding / replacing a child + */ + // tslint:disable-next-line:no-empty + protected adjustChildParameters(child: Nub) {} + /** * Résoud l'équation par une méthode numérique * @param sVarCalc nom de la variable à calculer diff --git a/src/regime_uniforme.ts b/src/regime_uniforme.ts index 4a349f3b3bc65450607f4c274a65a5485f6606ef..bf0685c50bf4fd037095904e68cd806e2991fdac 100644 --- a/src/regime_uniforme.ts +++ b/src/regime_uniforme.ts @@ -50,7 +50,7 @@ export class RegimeUniforme extends SectionNub { // tslint:disable-next-line:no-empty protected setParametersCalculability() {} - protected setSectionParametersCalculability(): void { + protected adjustChildParameters(): void { this.section.prms.Q.calculability = ParamCalculability.EQUATION; this.section.prms.Y.calculability = ParamCalculability.EQUATION; } diff --git a/src/remous.ts b/src/remous.ts index 234c1d8a7a8359cc070d0848c8e0e263ef1915cf..867f3cbf18dab2f062e923a10e63f12ad2c4a817 100644 --- a/src/remous.ts +++ b/src/remous.ts @@ -519,7 +519,7 @@ export class CourbeRemous extends SectionNub { this.prms.Yaval.calculability = ParamCalculability.FREE; } - protected setSectionParametersCalculability(): void { + protected adjustChildParameters(): void { this.section.prms.Y.calculability = ParamCalculability.DICHO; } diff --git a/src/section/section_nub.ts b/src/section/section_nub.ts index 37cf0dff307d7dec1b6146e5ae072641abb8423e..c53b7cda13a8dd46ba051405868d6fb25932b461 100644 --- a/src/section/section_nub.ts +++ b/src/section/section_nub.ts @@ -96,10 +96,6 @@ export abstract class SectionNub extends Nub { this._children[0] = undefined; } this.replaceChild(0, s); - this.setSectionParametersCalculability(); } } - - /** Called everytime a section is set / replaced */ - protected abstract setSectionParametersCalculability(): void; } diff --git a/src/section/section_parametree.ts b/src/section/section_parametree.ts index 874418aac3269a0ab419e75721bcf13c4a201c84..b3d03d8d4c561d9eaa828adfb44717ea539d9a24 100644 --- a/src/section/section_parametree.ts +++ b/src/section/section_parametree.ts @@ -202,7 +202,7 @@ export class SectionParametree extends SectionNub { protected setParametersCalculability(): void {} // tslint:disable-next-line:no-empty - protected setSectionParametersCalculability(): void {} + protected adjustChildParameters(): void {} protected setExtraResultsFamilies() { this._extraResultsFamilies = { diff --git a/src/structure/cloisons.ts b/src/structure/cloisons.ts index 056bf4f212b78a3a7e1d18229d2ae17f712f75ef..5dd0b51964c721398197427a7969dd2e84f07f6e 100644 --- a/src/structure/cloisons.ts +++ b/src/structure/cloisons.ts @@ -1,10 +1,11 @@ import { CalculatorType } from "../compute-node"; +import { Nub } from "../index"; import { PabPuissance, PabPuissanceParams } from "../pab/pab_puissance"; import { ParamCalculability } from "../param/param-definition"; import { Result } from "../util/result"; import { CloisonsParams } from "./cloisons_params"; import { ParallelStructure } from "./parallel_structure"; -import { StructureKiviParams } from "./structure_kivi"; +import { StructureKivi, StructureKiviParams } from "./structure_kivi"; import { loiAdmissiblesCloisons, LoiDebit } from "./structure_props"; export { CloisonsParams }; @@ -86,12 +87,19 @@ export class Cloisons extends ParallelStructure { ); r.extraResults.PV = puissanceNub.Calc("PV", 0).vCalc; - // Ajout de la cote de radier - r.extraResults.ZB = prms.Z1 - prms.DH - prms.PB; + // Ajout de la cote de radier de bassin + r.extraResults.ZRB = prms.Z1 - prms.DH - prms.PB; return r; } + public adjustChildParameters(child: Nub) { + if (child.prms instanceof StructureKiviParams) { + // hide ZRAM for KIVI, in Cloisons context only + child.prms.ZRAM.visible = false; + } + } + /** * paramétrage de la calculabilité des paramètres */