diff --git a/spec/cond_distri.spec.ts b/spec/cond_distri.spec.ts index d8272b2c46d1d727f8ee2c5a28471e46d555f318..deec4e9730bc1d86968df6b58821b90bb4a8ae66 100644 --- a/spec/cond_distri.spec.ts +++ b/spec/cond_distri.spec.ts @@ -1,7 +1,8 @@ // tslint:disable-next-line:no-reference /// <reference path="../node_modules/@types/jasmine/index.d.ts" /> -import { ConduiteDistrib, ConduiteDistribParams } from "../src/cond_distri"; +import { ConduiteDistrib } from "../src/cond_distri"; +import { ConduiteDistribParams } from "../src/cond_distri_params"; import { checkResult } from "./test_func"; describe("Class ConduiteDistrib: ", () => { diff --git a/spec/iterator/array_reverse_iterator.spec.ts b/spec/iterator/array_reverse_iterator.spec.ts index cc8592eb2947139bd80e9f619e1e9744cebac561..11472caa838cb537b8b8fd035364208c0acac255 100644 --- a/spec/iterator/array_reverse_iterator.spec.ts +++ b/spec/iterator/array_reverse_iterator.spec.ts @@ -1,4 +1,4 @@ -import { ArrayReverseIterator } from "../../src/util/iterator"; +import { ArrayReverseIterator } from "../../src/util/array_reverse_iterator"; describe("array reverse iterator : ", () => { it("reverse ( undefined )", () => { diff --git a/spec/iterator/map_iterator.spec.ts b/spec/iterator/map_iterator.spec.ts index 5f57d5a94f7bde4d15025735419ddc0bcf75801b..a11ad2d7007520d905db7714adda8d5e0b7d81f1 100644 --- a/spec/iterator/map_iterator.spec.ts +++ b/spec/iterator/map_iterator.spec.ts @@ -1,4 +1,4 @@ -import { MapIterator } from "../../src/util/iterator"; +import { MapIterator } from "../../src/util/map_iterator"; describe("param map iterator : ", () => { it("sur undefined (1)", () => { diff --git a/spec/iterator/param_equation.spec.ts b/spec/iterator/param_equation.spec.ts index a94fb5abe2cfbbca67f37986852b6c9dfaf7ab7d..6d2ca3b497d8c29b2306dd2aa6433e0a4960b737 100644 --- a/spec/iterator/param_equation.spec.ts +++ b/spec/iterator/param_equation.spec.ts @@ -6,8 +6,8 @@ */ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; -import { ConduiteDistribParams } from "../../src/cond_distri"; -import { IParamDefinitionIterator } from "../../src/param/params-equation"; +import { ConduiteDistribParams } from "../../src/cond_distri_params"; +import { IParamDefinitionIterator } from "../../src/param/param_definition_iterator"; import { CreateStructure } from "../../src/structure/factory_structure"; import { ParallelStructure } from "../../src/structure/parallel_structure"; import { ParallelStructureParams } from "../../src/structure/parallel_structure_params"; diff --git a/spec/lechaptcalmon.spec.ts b/spec/lechaptcalmon.spec.ts index ce82794d6deead16395f768421051787a8f791c5..cf06d1a6fe54146e06767b332bfedbfb9d3d0698 100644 --- a/spec/lechaptcalmon.spec.ts +++ b/spec/lechaptcalmon.spec.ts @@ -1,4 +1,5 @@ -import { LechaptCalmon, LechaptCalmonParams } from "../src/lechaptcalmon"; +import { LechaptCalmon } from "../src/lechaptcalmon"; +import { LechaptCalmonParams } from "../src/lechaptcalmon_params"; import { checkResult } from "./test_func"; let lechapt: LechaptCalmon; diff --git a/spec/macrorugo/macrorugo.spec.ts b/spec/macrorugo/macrorugo.spec.ts index 1201f6b7ac08b8c4a7e84a5674d2242ce6375875..60a1167fa536726dee99e93de76f453d7c6a803e 100644 --- a/spec/macrorugo/macrorugo.spec.ts +++ b/spec/macrorugo/macrorugo.spec.ts @@ -7,7 +7,8 @@ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; import { ParamCalculability, ParamValueMode } from "../../src/index"; -import { MacroRugo, MacroRugoFlowType, MacrorugoParams } from "../../src/macrorugo/macrorugo"; +import { MacroRugo, MacroRugoFlowType } from "../../src/macrorugo/macrorugo"; +import { MacrorugoParams } from "../../src/macrorugo/macrorugo_params"; import { checkResult } from "../test_func"; /* diff --git a/spec/macrorugo/macrorugo_compound.spec.ts b/spec/macrorugo/macrorugo_compound.spec.ts index 096533774ad01d008b189a9341f837750755d316..93c8a5853b23d9aa614c7a73b37629c2256866bb 100644 --- a/spec/macrorugo/macrorugo_compound.spec.ts +++ b/spec/macrorugo/macrorugo_compound.spec.ts @@ -1,6 +1,7 @@ import { CalculatorType } from "../../src/compute-node"; -import { MacroRugo, MacrorugoParams } from "../../src/macrorugo/macrorugo"; +import { MacroRugo } from "../../src/macrorugo/macrorugo"; import { MacrorugoCompound } from "../../src/macrorugo/macrorugo_compound"; +import { MacrorugoParams } from "../../src/macrorugo/macrorugo_params"; import { Props } from "../../src/props"; import { Session } from "../../src/session"; import { compareTwoResults } from "../test_func"; diff --git a/spec/pab/cloison_aval.spec.ts b/spec/pab/cloison_aval.spec.ts index d60ba0dd0afe7048f91b704237310a98a0832096..3e3537b5f59908c7838703220235da97cd3e80a3 100644 --- a/spec/pab/cloison_aval.spec.ts +++ b/spec/pab/cloison_aval.spec.ts @@ -1,7 +1,8 @@ -import { CloisonAval, ParallelStructureParams } from "../../src/pab/cloison_aval"; +import { CloisonAval } from "../../src/pab/cloison_aval"; import { CloisonsAvalParams } from "../../src/pab/cloison_aval_params"; -import { StructureVanLevLarinier, StructureVanLevParams } from "../../src/structure/structure_vanlev"; -import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev"; +import { StructureVanLevLarinier } from "../../src/structure/structure_vanlev_larinier"; +import { StructureVanLevParams } from "../../src/structure/structure_vanlev_params"; +import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev_villemonte"; import { MessageCode } from "../../src/util/message"; function getCloisonAvalTest(Q: number, Z2: number): CloisonAval { diff --git a/spec/pab/cloisons_jalhyd127.spec.ts b/spec/pab/cloisons_jalhyd127.spec.ts index fbcf805ccf25c5806dee80132358d79bd1b5fa22..20c73708f3ac256a8761fe4b0f9a670d6e0ccc30 100644 --- a/spec/pab/cloisons_jalhyd127.spec.ts +++ b/spec/pab/cloisons_jalhyd127.spec.ts @@ -1,4 +1,3 @@ -import { Nub } from "../../src/nub"; import { Cloisons } from "../../src/pab/cloisons"; import { Session } from "../../src/session"; diff --git a/spec/pab/pab.spec.ts b/spec/pab/pab.spec.ts index eb563edec649e059098ee7ff4af2a95346274951..8ec3d3b64088b22e67d45d8d5c99905d76e576a4 100644 --- a/spec/pab/pab.spec.ts +++ b/spec/pab/pab.spec.ts @@ -9,11 +9,13 @@ import { ParamValueMode, Session } from "../../src/index"; import { CloisonAval } from "../../src/pab/cloison_aval"; import { CloisonsAvalParams } from "../../src/pab/cloison_aval_params"; -import { Cloisons, CloisonsParams } from "../../src/pab/cloisons"; -import { Pab, PabParams } from "../../src/pab/pab"; -import { ParallelStructureParams } from "../../src/structure/parallel_structure"; +import { Cloisons } from "../../src/pab/cloisons"; +import { CloisonsParams } from "../../src/pab/cloisons_params"; +import { Pab } from "../../src/pab/pab"; +import { PabParams } from "../../src/pab/pab_params"; import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; -import { StructureVanLevParams, StructureVanLevVillemonte } from "../../src/structure/structure_vanlev"; +import { StructureVanLevParams } from "../../src/structure/structure_vanlev_params"; +import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev_villemonte"; import { StructureWeirSubmergedLarinier } from "../../src/structure/structure_weir_submerged_larinier"; import { StructureWeirVillemonte } from "../../src/structure/structure_weir_villemonte"; import { MessageCode } from "../../src/util/message"; diff --git a/spec/pab/pab_chute.spec.ts b/spec/pab/pab_chute.spec.ts index 2f2f5b5943be7218fe42cfc69fbff14952da8aec..5bcbd42708bc7b5eb4135d64a619e2e977b14e37 100644 --- a/spec/pab/pab_chute.spec.ts +++ b/spec/pab/pab_chute.spec.ts @@ -1,5 +1,6 @@ -import { PabChute, PabChuteParams } from "../../src/pab/pab_chute"; +import { PabChute } from "../../src/pab/pab_chute"; +import { PabChuteParams } from "../../src/pab/pab_chute_params"; import { checkResult } from "../test_func"; function pabChuteTest(varTest: string, expected: number) { diff --git a/spec/pab/pab_dimension.spec.ts b/spec/pab/pab_dimension.spec.ts index 496feaa9c0392f874547cb2e20f287be368ed2cf..2a54f06e85d6421c3dafe12e65bb803642128d38 100644 --- a/spec/pab/pab_dimension.spec.ts +++ b/spec/pab/pab_dimension.spec.ts @@ -1,4 +1,5 @@ -import { PabDimension, PabDimensionParams } from "../../src/pab/pab_dimension"; +import { PabDimension } from "../../src/pab/pab_dimension"; +import { PabDimensionParams } from "../../src/pab/pab_dimensions_params"; import { checkResult } from "../test_func"; function pabDimensionTest(varTest: string) { diff --git a/spec/pab/pab_nombre.spec.ts b/spec/pab/pab_nombre.spec.ts index db83da47c8a675bd2b4f07e89adc68158f95cc5f..313269c63026fcb8adfbfebccc3b0161770f8209 100644 --- a/spec/pab/pab_nombre.spec.ts +++ b/spec/pab/pab_nombre.spec.ts @@ -1,5 +1,6 @@ -import { PabNombre, PabNombreParams } from "../../src/pab/pab_nombre"; +import { PabNombre } from "../../src/pab/pab_nombre"; +import { PabNombreParams } from "../../src/pab/pab_nombre_params"; import { checkResult } from "../test_func"; function pabNombreTest(varTest: string, expected: number) { diff --git a/spec/pab/pab_puissance.spec.ts b/spec/pab/pab_puissance.spec.ts index a1a46ba4d4692e0292e04d1db10530f91a9517a2..bc47735e187b63b08f4496c98f6c4d0a8edf69c2 100644 --- a/spec/pab/pab_puissance.spec.ts +++ b/spec/pab/pab_puissance.spec.ts @@ -1,7 +1,8 @@ // tslint:disable-next-line:no-reference /// <reference path="../../node_modules/@types/jasmine/index.d.ts" /> -import { PabPuissance, PabPuissanceParams } from "../../src/pab/pab_puissance"; +import { PabPuissance } from "../../src/pab/pab_puissance"; +import { PabPuissanceParams } from "../../src/pab/pab_puissance_params"; import { checkResult } from "../test_func"; function PabPuissanceTest(varTest: string) { diff --git a/spec/param/param_modes.spec.ts b/spec/param/param_modes.spec.ts index 1afaf7a44915071076d06ed6544597473ba82894..c2da86253749406b9ac37af506a03ab571565d2d 100644 --- a/spec/param/param_modes.spec.ts +++ b/spec/param/param_modes.spec.ts @@ -1,13 +1,16 @@ import { cSnTrapez, LinkedValue, Nub, ParallelStructure, ParallelStructureParams, - ParamCalculability, ParamsSectionTrapez, ParamValueMode, SectionParametree, + ParamValueMode, SectionParametree, Session } from "../../src/index"; import { Cloisons } from "../../src/pab/cloisons"; import { CloisonsParams } from "../../src/pab/cloisons_params"; import { RegimeUniforme } from "../../src/regime_uniforme"; -import { cSnCirc, ParamsSectionCirc } from "../../src/section/section_circulaire"; -import { Dever, DeverParams } from "../../src/structure/dever"; +import { cSnCirc } from "../../src/section/section_circulaire"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; +import { Dever } from "../../src/structure/dever"; +import { DeverParams } from "../../src/structure/dever_params"; import { CreateStructure } from "../../src/structure/factory_structure"; import { LoiDebit } from "../../src/structure/structure_props"; diff --git a/spec/param/param_multivar.spec.ts b/spec/param/param_multivar.spec.ts index 64a24f8243f79ca6cf6ff0ff764e07a0026c27da..8c5475a36735b432a6a7bbb6ae8dca27bf75e419 100644 --- a/spec/param/param_multivar.spec.ts +++ b/spec/param/param_multivar.spec.ts @@ -1,6 +1,6 @@ import { CreateStructure, ExtensionStrategy, LoiDebit, ParallelStructure, ParallelStructureParams, ParamValueMode, Session, Structure} from "../../src/index"; -import { RectangularStructureParams } from "../../src/structure/structure_cem88d"; +import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; let prms1: ParallelStructureParams; let nub1: ParallelStructure; diff --git a/spec/regime_uniforme/regime_uniforme_circ.spec.ts b/spec/regime_uniforme/regime_uniforme_circ.spec.ts index 6b085cfa7c567c08d6eecc84afd68168b3894c33..5f9ece8f51163d07492eac2246cb2de6c7251db8 100644 --- a/spec/regime_uniforme/regime_uniforme_circ.spec.ts +++ b/spec/regime_uniforme/regime_uniforme_circ.spec.ts @@ -2,9 +2,10 @@ /// <reference path="../../node_modules/@types/jasmine/index.d.ts" /> import { RegimeUniforme } from "../../src/regime_uniforme"; -import { cSnCirc, ParamsSectionCirc } from "../../src/section/section_circulaire"; +import { cSnCirc } from "../../src/section/section_circulaire"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; import { precDist } from "../test_config"; -import { checkResult, equalEpsilon } from "../test_func"; +import { checkResult } from "../test_func"; describe("Class RegimeUniforme / section circulaire :", () => { describe("pas de débordement : ", () => { diff --git a/spec/regime_uniforme/regime_uniforme_puissance.spec.ts b/spec/regime_uniforme/regime_uniforme_puissance.spec.ts index a813a80448528ee3032c427464ea58329e7c3030..fae572ff3d0d89e912354aac9b289e36577201f7 100644 --- a/spec/regime_uniforme/regime_uniforme_puissance.spec.ts +++ b/spec/regime_uniforme/regime_uniforme_puissance.spec.ts @@ -7,10 +7,11 @@ // import { describe, expect, it, xdescribe } from "../mock_jasmine"; import { RegimeUniforme } from "../../src/regime_uniforme"; -import { cSnPuiss, ParamsSectionPuiss } from "../../src/section/section_puissance"; +import { cSnPuiss } from "../../src/section/section_puissance"; +import { ParamsSectionPuiss } from "../../src/section/section_puissance_params"; import { MessageCode } from "../../src/util/message"; import { Result } from "../../src/util/result"; -import { precDigits, precDist } from "../test_config"; +import { precDist } from "../test_config"; import { checkResult } from "../test_func"; describe("Class RegimeUniforme / section puissance :", () => { diff --git a/spec/regime_uniforme/regime_uniforme_rect.spec.ts b/spec/regime_uniforme/regime_uniforme_rect.spec.ts index ed5bbcee3ff1a5f982741511fb240eb380da17e9..f2c4d6388675d0a99298c8d672d5f2a6bab38d79 100644 --- a/spec/regime_uniforme/regime_uniforme_rect.spec.ts +++ b/spec/regime_uniforme/regime_uniforme_rect.spec.ts @@ -7,8 +7,8 @@ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; import { RegimeUniforme } from "../../src/regime_uniforme"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; -import { Result } from "../../src/util/result"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { precDist } from "../test_config"; import { checkResult, equalEpsilon } from "../test_func"; diff --git a/spec/regime_uniforme/regime_uniforme_trapeze.spec.ts b/spec/regime_uniforme/regime_uniforme_trapeze.spec.ts index c55be2b837575d07583040c077e04aad4d6b8718..074dade786c5eb4a6e57c48dd222c65500ec3a62 100644 --- a/spec/regime_uniforme/regime_uniforme_trapeze.spec.ts +++ b/spec/regime_uniforme/regime_uniforme_trapeze.spec.ts @@ -2,8 +2,8 @@ /// <reference path="../../node_modules/@types/jasmine/index.d.ts" /> import { RegimeUniforme } from "../../src/regime_uniforme"; -import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez"; -import { Result } from "../../src/util/result"; +import { cSnTrapez } from "../../src/section/section_trapez"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; import { precDist } from "../test_config"; import { checkResult, equalEpsilon } from "../test_func"; diff --git a/spec/remous/remous_rect_euler_pentefaible.spec.ts b/spec/remous/remous_rect_euler_pentefaible.spec.ts index a8545b7c5507df1bf3f19955faacbfa8eec96f9f..0fd8d7aa6099ec03eae11f64b45a1c7046fd5194 100644 --- a/spec/remous/remous_rect_euler_pentefaible.spec.ts +++ b/spec/remous/remous_rect_euler_pentefaible.spec.ts @@ -7,8 +7,10 @@ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { cLog } from "../../src/util/log"; import { Message, MessageCode } from "../../src/util/message"; import { Result } from "../../src/util/result"; diff --git a/spec/remous/remous_rect_euler_penteforte.spec.ts b/spec/remous/remous_rect_euler_penteforte.spec.ts index 307ad084fc07ad833e062bc66d51f71289fcea47..2c64f7f8a7e2a677427fbd6673bd782bcf54e243 100644 --- a/spec/remous/remous_rect_euler_penteforte.spec.ts +++ b/spec/remous/remous_rect_euler_penteforte.spec.ts @@ -1,6 +1,8 @@ import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { cLog } from "../../src/util/log"; import { Message, MessageCode } from "../../src/util/message"; import { precDist } from "../test_config"; diff --git a/spec/remous/remous_rect_rk4_pentefaible.spec.ts b/spec/remous/remous_rect_rk4_pentefaible.spec.ts index a0e9120f2b3837c6c8f7c4378ecd2b2ec17d0bc0..2c4e0fdcfee8f50142305f392923c2b06f0bcb60 100644 --- a/spec/remous/remous_rect_rk4_pentefaible.spec.ts +++ b/spec/remous/remous_rect_rk4_pentefaible.spec.ts @@ -1,6 +1,8 @@ import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { cLog } from "../../src/util/log"; import { Message, MessageCode } from "../../src/util/message"; import { precDist } from "../test_config"; diff --git a/spec/remous/remous_rect_rk4_penteforte.spec.ts b/spec/remous/remous_rect_rk4_penteforte.spec.ts index d568aa99d29482e079b1eeafce42f9d44ebc44dd..baac46d43bc4876cf77d6d4150344612b0162197 100644 --- a/spec/remous/remous_rect_rk4_penteforte.spec.ts +++ b/spec/remous/remous_rect_rk4_penteforte.spec.ts @@ -1,6 +1,8 @@ import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { cLog } from "../../src/util/log"; import { Message, MessageCode } from "../../src/util/message"; import { precDist } from "../test_config"; diff --git a/spec/remous/remous_rect_trapezes_pentefaible.spec.ts b/spec/remous/remous_rect_trapezes_pentefaible.spec.ts index 4a5cf34c704c92d9190bc6ce6c2c41823d8d6852..2a7253caf001c3a149ef753bf4b57a8e81f0f490 100644 --- a/spec/remous/remous_rect_trapezes_pentefaible.spec.ts +++ b/spec/remous/remous_rect_trapezes_pentefaible.spec.ts @@ -7,8 +7,10 @@ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { cLog } from "../../src/util/log"; import { Message, MessageCode } from "../../src/util/message"; import { precDist } from "../test_config"; diff --git a/spec/remous/remous_rect_trapezes_penteforte.spec.ts b/spec/remous/remous_rect_trapezes_penteforte.spec.ts index 8e0f07be4075d15c3962e3be1d265a6439282df2..669a480fcbebf188b0a250eb8c957ab88134603f 100644 --- a/spec/remous/remous_rect_trapezes_penteforte.spec.ts +++ b/spec/remous/remous_rect_trapezes_penteforte.spec.ts @@ -1,10 +1,12 @@ import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { cLog } from "../../src/util/log"; import { Message, MessageCode } from "../../src/util/message"; import { precDist } from "../test_config"; -import { compareExtraResult, compareLog, equalEpsilon, extraResultLength } from "../test_func"; +import { compareExtraResult, compareLog, extraResultLength } from "../test_func"; /* cas 1 : diff --git a/spec/remous/remous_trapez.spec.ts b/spec/remous/remous_trapez.spec.ts index 412fc70908b0aa136a10a846adcc9b57ca2c97e9..08ece0a7559c400d17bbc653fe79c08e9937801b 100644 --- a/spec/remous/remous_trapez.spec.ts +++ b/spec/remous/remous_trapez.spec.ts @@ -7,8 +7,10 @@ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnTrapez } from "../../src/section/section_trapez"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; import { precDist } from "../test_config"; import { compareExtraResult } from "../test_func"; diff --git a/spec/section_param/section_param.spec.ts b/spec/section_param/section_param.spec.ts index dbbda8ace066c1554e2a6afee06f3b90d8c7b187..e0a12f8019373af15c86313b263fb96693fde2b1 100644 --- a/spec/section_param/section_param.spec.ts +++ b/spec/section_param/section_param.spec.ts @@ -8,7 +8,8 @@ import { ParamDefinition } from "../../src/param/param-definition"; import { SectionParametree } from "../../src/section/section_parametree"; -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { precDist } from "../test_config"; function createSection(prec: number) { diff --git a/spec/section_param/section_param_circ_fluvial.spec.ts b/spec/section_param/section_param_circ_fluvial.spec.ts index 425384dc16a584e7d868af4e8c5b330c425deb80..f1680376bfc492738ffba3c847108507049d4b5e 100644 --- a/spec/section_param/section_param_circ_fluvial.spec.ts +++ b/spec/section_param/section_param_circ_fluvial.spec.ts @@ -1,4 +1,5 @@ -import { cSnCirc, ParamsSectionCirc } from "../../src/section/section_circulaire"; +import { cSnCirc } from "../../src/section/section_circulaire"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_circ_torrentiel.spec.ts b/spec/section_param/section_param_circ_torrentiel.spec.ts index 8ae10cbb4b81b9b8c0befbcb5e18637bae524a92..ce0cc55fb39d938ee0501911b144ef85fa3e212e 100644 --- a/spec/section_param/section_param_circ_torrentiel.spec.ts +++ b/spec/section_param/section_param_circ_torrentiel.spec.ts @@ -1,4 +1,5 @@ -import { cSnCirc, ParamsSectionCirc } from "../../src/section/section_circulaire"; +import { cSnCirc } from "../../src/section/section_circulaire"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_puiss_fluvial.spec.ts b/spec/section_param/section_param_puiss_fluvial.spec.ts index f2fb30ed4e672c35858f3343950991ac02ee57cf..0b3a79c0b573ecc54353ad2f0811092795057ad7 100644 --- a/spec/section_param/section_param_puiss_fluvial.spec.ts +++ b/spec/section_param/section_param_puiss_fluvial.spec.ts @@ -1,4 +1,5 @@ -import { cSnPuiss, ParamsSectionPuiss } from "../../src/section/section_puissance"; +import { cSnPuiss } from "../../src/section/section_puissance"; +import { ParamsSectionPuiss } from "../../src/section/section_puissance_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_puiss_torrentiel.spec.ts b/spec/section_param/section_param_puiss_torrentiel.spec.ts index 6df874ef91760be164b20de3053c15e82e9e05dc..cafacf0bee71d6379319e87a46ada85dbef1260f 100644 --- a/spec/section_param/section_param_puiss_torrentiel.spec.ts +++ b/spec/section_param/section_param_puiss_torrentiel.spec.ts @@ -1,4 +1,5 @@ -import { cSnPuiss, ParamsSectionPuiss } from "../../src/section/section_puissance"; +import { cSnPuiss } from "../../src/section/section_puissance"; +import { ParamsSectionPuiss } from "../../src/section/section_puissance_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_rect_conv_newton.spec.ts b/spec/section_param/section_param_rect_conv_newton.spec.ts index fdae2fad8ebaf7b2cf62689e135d3b57a6c3cb1a..8882930c20acdacc104f399a196808c97008d9c0 100644 --- a/spec/section_param/section_param_rect_conv_newton.spec.ts +++ b/spec/section_param/section_param_rect_conv_newton.spec.ts @@ -1,5 +1,6 @@ // tslint:disable:no-console -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { MessageCode } from "../../src/util/message"; import { Result } from "../../src/util/result"; diff --git a/spec/section_param/section_param_rect_fluvial.spec.ts b/spec/section_param/section_param_rect_fluvial.spec.ts index 9e6103ec54e33d7fd34b11942d0caafc660c1360..d2a9529f4a14f5375d03ef8d329f2bfe0eb0398d 100644 --- a/spec/section_param/section_param_rect_fluvial.spec.ts +++ b/spec/section_param/section_param_rect_fluvial.spec.ts @@ -1,4 +1,5 @@ -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_rect_torrentiel.spec.ts b/spec/section_param/section_param_rect_torrentiel.spec.ts index 08949ad33cb680ff9034fed719e711dfeccbb3ec..d8ac98417ef7ed53e0e587f0461476ae5ccf2150 100644 --- a/spec/section_param/section_param_rect_torrentiel.spec.ts +++ b/spec/section_param/section_param_rect_torrentiel.spec.ts @@ -1,4 +1,5 @@ -import { cSnRectang, ParamsSectionRectang } from "../../src/section/section_rectang"; +import { cSnRectang } from "../../src/section/section_rectang"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_trapez_fluvial.spec.ts b/spec/section_param/section_param_trapez_fluvial.spec.ts index c58cbc8e823c9355951d566656540352cfffa9a5..6f8c822a8b7c9dc37093216a37307c183275609f 100644 --- a/spec/section_param/section_param_trapez_fluvial.spec.ts +++ b/spec/section_param/section_param_trapez_fluvial.spec.ts @@ -1,4 +1,5 @@ -import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez"; +import { cSnTrapez } from "../../src/section/section_trapez"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/section_param/section_param_trapez_torrentiel.spec.ts b/spec/section_param/section_param_trapez_torrentiel.spec.ts index 658f3d800d4d167921c46de3d1e8e674e3a73500..8534af20276aa727fa59d1025c0a5036d0599996 100644 --- a/spec/section_param/section_param_trapez_torrentiel.spec.ts +++ b/spec/section_param/section_param_trapez_torrentiel.spec.ts @@ -1,4 +1,5 @@ -import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez"; +import { cSnTrapez } from "../../src/section/section_trapez"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; import { precDist } from "../test_config"; import { checkResult } from "../test_func"; diff --git a/spec/session/serialisation.spec.ts b/spec/session/serialisation.spec.ts index 3c541b545c40c500cec676933fd6e2e72eaed6f8..78083864a2f24d74c58671ca29a28437513fbacb 100644 --- a/spec/session/serialisation.spec.ts +++ b/spec/session/serialisation.spec.ts @@ -1,17 +1,24 @@ -import { ConduiteDistrib, ConduiteDistribParams } from "../../src/cond_distri"; +import { ConduiteDistrib } from "../../src/cond_distri"; +import { ConduiteDistribParams } from "../../src/cond_distri_params"; import { Nub, ParallelStructure, ParamDefinition, ParamValueMode, SectionParametree, Session } from "../../src/index"; import { MacroRugo } from "../../src/macrorugo/macrorugo"; import { Cloisons } from "../../src/pab/cloisons"; import { CloisonsParams } from "../../src/pab/cloisons_params"; -import { PabChute, PabChuteParams } from "../../src/pab/pab_chute"; +import { PabChute } from "../../src/pab/pab_chute"; +import { PabChuteParams } from "../../src/pab/pab_chute_params"; import { RegimeUniforme } from "../../src/regime_uniforme"; import { MethodeResolution } from "../../src/remous/methode-resolution"; -import { CourbeRemous, CourbeRemousParams } from "../../src/remous/remous"; -import { cSnCirc, ParamsSectionCirc } from "../../src/section/section_circulaire"; -import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez"; -import { Dever, DeverParams } from "../../src/structure/dever"; +import { CourbeRemous } from "../../src/remous/remous"; +import { CourbeRemousParams } from "../../src/remous/remous_params"; +import { cSnCirc } from "../../src/section/section_circulaire"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; +import { cSnTrapez } from "../../src/section/section_trapez"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; +import { Dever } from "../../src/structure/dever"; +import { DeverParams } from "../../src/structure/dever_params"; import { CreateStructure } from "../../src/structure/factory_structure"; -import { RectangularStructure, RectangularStructureParams } from "../../src/structure/rectangular_structure"; +import { RectangularStructure } from "../../src/structure/rectangular_structure"; +import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { LoiDebit } from "../../src/structure/structure_props"; import { StructureWeirSubmergedLarinier, diff --git a/spec/structure/dever.spec.ts b/spec/structure/dever.spec.ts index bf01d278b0830271d33b7ce1405b2cecb1654f2d..1a2d87dd4d3b4be3ed671d058a6576b1da5e5b47 100644 --- a/spec/structure/dever.spec.ts +++ b/spec/structure/dever.spec.ts @@ -6,7 +6,8 @@ */ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; -import { Dever, DeverParams } from "../../src/structure/dever"; +import { Dever } from "../../src/structure/dever"; +import { DeverParams } from "../../src/structure/dever_params"; import { CreateStructure } from "../../src/structure/factory_structure"; import { LoiDebit } from "../../src/structure/structure_props"; diff --git a/spec/structure/dever_jalhyd123.spec.ts b/spec/structure/dever_jalhyd123.spec.ts index 1a4bf63063f5a832ce1e6a9bb1807a99a447242f..c4445548181900eeee39f0f71c121b3efd81df13 100644 --- a/spec/structure/dever_jalhyd123.spec.ts +++ b/spec/structure/dever_jalhyd123.spec.ts @@ -1,5 +1,5 @@ import { Session } from "../../src/session"; -import { checkResultConsistency, isFiniteNumber } from "../test_func"; +import { checkResultConsistency } from "../test_func"; describe("Dever", () => { describe("jalhyd#123", () => { diff --git a/spec/structure/parallel_structure.spec.ts b/spec/structure/parallel_structure.spec.ts index 565f97aef3bc04a1a12716d1ae1c42b5de3075f6..646b27d4e1b55fed813bbace866bbb90a8b85057 100644 --- a/spec/structure/parallel_structure.spec.ts +++ b/spec/structure/parallel_structure.spec.ts @@ -12,7 +12,8 @@ import { Session } from "../../src/session"; import { CreateStructure } from "../../src/structure/factory_structure"; import { ParallelStructure } from "../../src/structure/parallel_structure"; import { ParallelStructureParams } from "../../src/structure/parallel_structure_params"; -import { StructureKivi, StructureKiviParams } from "../../src/structure/structure_kivi"; +import { StructureKivi } from "../../src/structure/structure_kivi"; +import { StructureKiviParams } from "../../src/structure/structure_kivi_params"; import { LoiDebit } from "../../src/structure/structure_props"; import { MessageCode } from "../../src/util/message"; import { Result } from "../../src/util/result"; diff --git a/spec/structure/structure.spec.ts b/spec/structure/structure.spec.ts index 1c435756cb7c55adbf257e34c934032a2a209b99..ed52c58055c29614c7190260bef6ea358b4980b4 100644 --- a/spec/structure/structure.spec.ts +++ b/spec/structure/structure.spec.ts @@ -6,7 +6,7 @@ */ // import { describe, expect, it, xdescribe } from "../mock_jasmine"; -import { Structure, StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; +import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; import { checkResult } from "../test_func"; import { CreateStructTest, StructureTest } from "./structure_test"; diff --git a/spec/structure/structure_cem88d.spec.ts b/spec/structure/structure_cem88d.spec.ts index 4ec98e616a94dc3ca6fa4861bcb796bb8869bb37..edc1a3f2924660103296bf7a0ce41d4f0d190b3c 100644 --- a/spec/structure/structure_cem88d.spec.ts +++ b/spec/structure/structure_cem88d.spec.ts @@ -8,7 +8,7 @@ import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; -import { StructureGateCem88d, StructureWeirCem88d } from "../../src/structure/structure_cem88d"; +import { StructureGateCem88d } from "../../src/structure/structure_gate_cem88d"; import { itCalcQ } from "./functions"; const structPrm: RectangularStructureParams = new RectangularStructureParams(1, 0, 1, 1, 2, 0.6, 0); diff --git a/spec/structure/structure_cem88v.spec.ts b/spec/structure/structure_cem88v.spec.ts index 8ee80ca59266d8edc16575ce7f92e30414aa28ff..660cbdc8fc7b31e1e581d5e1efa599cf133598da 100644 --- a/spec/structure/structure_cem88v.spec.ts +++ b/spec/structure/structure_cem88v.spec.ts @@ -9,7 +9,7 @@ import { CreateStructure, LoiDebit, MessageCode, Result } from "../../src/index"; import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; -import { StructureGateCem88v } from "../../src/structure/structure_cem88v"; +import { StructureGateCem88v } from "../../src/structure/structure_gate_cem88v"; import { itCalcQ } from "./functions"; let structPrm: RectangularStructureParams = new RectangularStructureParams(1, 0, 1, 1, 2, 0.6, 0); diff --git a/spec/structure/structure_cunge80.spec.ts b/spec/structure/structure_cunge80.spec.ts index c3384679770dc8e25d203acddaa5d484d3625b60..4ffbd439489238181fe68df6b742163285a78656 100644 --- a/spec/structure/structure_cunge80.spec.ts +++ b/spec/structure/structure_cunge80.spec.ts @@ -8,8 +8,7 @@ import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; -import { StructureGateCunge80 } from "../../src/structure/structure_cunge80"; -import { Result } from "../../src/util/result"; +import { StructureGateCunge80 } from "../../src/structure/structure_gate_cunge80"; import { itCalcQ } from "./functions"; const structPrm: RectangularStructureParams = new RectangularStructureParams(1, 0, 1, 1, 2, 0.6, 0); diff --git a/spec/structure/structure_kivi.spec.ts b/spec/structure/structure_kivi.spec.ts index 928e1136fdda7c54045a8b8bc71cbc0349e696fc..a26ebb67ae6cf907b83c6a4256be905173b365f9 100644 --- a/spec/structure/structure_kivi.spec.ts +++ b/spec/structure/structure_kivi.spec.ts @@ -7,7 +7,8 @@ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; import { MessageCode, StructureFlowMode, StructureFlowRegime } from "../../src/index"; -import { StructureKivi, StructureKiviParams } from "../../src/structure/structure_kivi"; +import { StructureKivi } from "../../src/structure/structure_kivi"; +import { StructureKiviParams } from "../../src/structure/structure_kivi_params"; import { testStructure } from "./functions"; const kiviParams: StructureKiviParams = new StructureKiviParams( diff --git a/spec/structure/structure_orifice_submerged.spec.ts b/spec/structure/structure_orifice_submerged.spec.ts index 2eaf38fa6c221a727a94403c9e0c8ae65e2f8492..f70e5c9c7a09af4d88e45efe24e06e2c8d0357f1 100644 --- a/spec/structure/structure_orifice_submerged.spec.ts +++ b/spec/structure/structure_orifice_submerged.spec.ts @@ -8,7 +8,8 @@ import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; // tslint:disable-next-line:max-line-length -import { StructureOrificeSubmerged, StructureOrificeSubmergedParams } from "../../src/structure/structure_orifice_submerged"; +import { StructureOrificeSubmerged } from "../../src/structure/structure_orifice_submerged"; +import { StructureOrificeSubmergedParams } from "../../src/structure/structure_orifice_submerged_params"; import { itCalcQ } from "../structure/functions"; const prms: StructureOrificeSubmergedParams = new StructureOrificeSubmergedParams(0, 102, 101.5, 0.7, 0.1); diff --git a/spec/structure/structure_test.ts b/spec/structure/structure_test.ts index d235fcb40b7eb4537188d8a4fc44b4ebd00f1362..f204d024e7b4db29b30c89a9d1a40a74cafc2223 100644 --- a/spec/structure/structure_test.ts +++ b/spec/structure/structure_test.ts @@ -6,7 +6,8 @@ */ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; -import { Structure, StructureParams } from "../../src/structure/structure"; +import { Structure } from "../../src/structure/structure"; +import { StructureParams } from "../../src/structure/structure_params"; import { Result } from "../../src/util/result"; export class StructureTest extends Structure { diff --git a/spec/structure/structure_weir_free.spec.ts b/spec/structure/structure_weir_free.spec.ts index 004cf2891d90d6f60e077b6db6f0d5cfa348238b..371e9fd8e6630e8f7ee2f453f71ee7aedb4de604 100644 --- a/spec/structure/structure_weir_free.spec.ts +++ b/spec/structure/structure_weir_free.spec.ts @@ -9,7 +9,6 @@ import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure"; import { StructureWeirFree } from "../../src/structure/structure_weir_free"; -import { Result } from "../../src/util/result"; import { itCalcQ } from "./functions"; function getStructTest(): StructureWeirFree { diff --git a/spec/value_ref/value_ref_chained_computation.spec.ts b/spec/value_ref/value_ref_chained_computation.spec.ts index b44d93ba42c9fa9004192336b05ac460937db747..96658fcdafc378b0dbd492dc373be4a0a166e360 100644 --- a/spec/value_ref/value_ref_chained_computation.spec.ts +++ b/spec/value_ref/value_ref_chained_computation.spec.ts @@ -1,8 +1,12 @@ -import { Cloisons, CloisonsParams, CreateStructure, cSnRectang, LoiDebit, - ParamsSectionRectang, SectionParametree, Session } from "../../src/index"; -import { PabDimension, PabDimensionParams } from "../../src/pab/pab_dimension"; -import { PabPuissance, PabPuissanceParams } from "../../src/pab/pab_puissance"; +import { Cloisons, CreateStructure, cSnRectang, LoiDebit, + SectionParametree, Session } from "../../src/index"; +import { CloisonsParams } from "../../src/pab/cloisons_params"; +import { PabDimension } from "../../src/pab/pab_dimension"; +import { PabDimensionParams } from "../../src/pab/pab_dimensions_params"; +import { PabPuissance } from "../../src/pab/pab_puissance"; +import { PabPuissanceParams } from "../../src/pab/pab_puissance_params"; import { RegimeUniforme } from "../../src/regime_uniforme"; +import { ParamsSectionRectang } from "../../src/section/section_rectang_params"; describe("chained computation of linked Nubs : ", () => { diff --git a/spec/value_ref/value_ref_circularity.spec.ts b/spec/value_ref/value_ref_circularity.spec.ts index fae60c8fdc14f5d3aab37d3d31977e2cb52bff2d..5b3535d49f09494f72b093378e91747fbff8520f 100644 --- a/spec/value_ref/value_ref_circularity.spec.ts +++ b/spec/value_ref/value_ref_circularity.spec.ts @@ -1,6 +1,6 @@ import { CreateStructure, LoiDebit, ParallelStructure, ParallelStructureParams, Session, Structure } from "../../src/index"; -import { RectangularStructureParams } from "../../src/structure/structure_cem88d"; +import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { NubTest, NubTestParams } from "../nubtest"; /** diff --git a/spec/value_ref/value_ref_partial_session.spec.ts b/spec/value_ref/value_ref_partial_session.spec.ts index c974bb714f2b91b04d6501bd07d467a34063bad9..0fb663f900040b37044130b0936a94987f18d248 100644 --- a/spec/value_ref/value_ref_partial_session.spec.ts +++ b/spec/value_ref/value_ref_partial_session.spec.ts @@ -1,7 +1,9 @@ import { ExtensionStrategy, ParamValueMode } from "../../src/index"; import { Nub } from "../../src/nub"; -import { PabChute, PabChuteParams } from "../../src/pab/pab_chute"; -import { PabNombre, PabNombreParams } from "../../src/pab/pab_nombre"; +import { PabChute } from "../../src/pab/pab_chute"; +import { PabChuteParams } from "../../src/pab/pab_chute_params"; +import { PabNombre } from "../../src/pab/pab_nombre"; +import { PabNombreParams } from "../../src/pab/pab_nombre_params"; import { Session } from "../../src/session"; function saveAndReload(nubToSave: Nub): Nub { diff --git a/spec/value_ref/value_ref_section.spec.ts b/spec/value_ref/value_ref_section.spec.ts index 4dec46b616240f2baf4b5511b19816800cba6f2a..5f63963c2df60cf245d9cd318072032ea36cfd08 100644 --- a/spec/value_ref/value_ref_section.spec.ts +++ b/spec/value_ref/value_ref_section.spec.ts @@ -1,6 +1,8 @@ -import { CreateStructure, cSnTrapez, LoiDebit, ParamsSectionTrapez, Session } from "../../src/index"; +import { CreateStructure, cSnTrapez, LoiDebit, Session } from "../../src/index"; import { SectionParametree } from "../../src/section/section_parametree"; -import { Dever, DeverParams } from "../../src/structure/dever"; +import { ParamsSectionTrapez } from "../../src/section/section_trapez_params"; +import { Dever } from "../../src/structure/dever"; +import { DeverParams } from "../../src/structure/dever_params"; /** * IMPORTANT ! diff --git a/spec/value_ref/value_ref_target_status.spec.ts b/spec/value_ref/value_ref_target_status.spec.ts index 1d604b2dc2f0dfbc596b503605bbe050f1852bd7..44196990c9ecae9313dc4d2f3b7c6a7e76891a39 100644 --- a/spec/value_ref/value_ref_target_status.spec.ts +++ b/spec/value_ref/value_ref_target_status.spec.ts @@ -7,7 +7,8 @@ // import { describe, expect, it } from "../mock_jasmine"; import { Session } from "../../src/index"; -import { PabDimension, PabDimensionParams } from "../../src/pab/pab_dimension"; +import { PabDimension } from "../../src/pab/pab_dimension"; +import { PabDimensionParams } from "../../src/pab/pab_dimensions_params"; let nub1: PabDimension; let nub2: PabDimension; diff --git a/spec/value_ref/value_ref_type_section.spec.ts b/spec/value_ref/value_ref_type_section.spec.ts index e38d265b7ea333c82c8de53d76e7abb881627e83..cbcec79f31a8e5828ed60605acb9edc8a872536e 100644 --- a/spec/value_ref/value_ref_type_section.spec.ts +++ b/spec/value_ref/value_ref_type_section.spec.ts @@ -1,7 +1,8 @@ import { CreateStructure, cSnCirc, LinkedValue, LoiDebit, ParallelStructure, ParallelStructureParams, - ParamsSectionCirc, Session } from "../../src/index"; + Session } from "../../src/index"; import { RegimeUniforme } from "../../src/regime_uniforme"; -import { RectangularStructureParams } from "../../src/structure/structure_cem88d"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; +import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; /** * IMPORTANT ! @@ -12,8 +13,8 @@ import { RectangularStructureParams } from "../../src/structure/structure_cem88d // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; let nub1: RegimeUniforme; -let prm1: ParamsSectionCirc; let nub2: ParallelStructure; +let prm1: ParamsSectionCirc; let prm2: ParallelStructureParams; /** diff --git a/spec/value_ref/value_ref_variable.spec.ts b/spec/value_ref/value_ref_variable.spec.ts index e04ae24cb05822378087806c3fd57579ad7229a2..d12efe440405c7800d7b814c8596df8d19f968f3 100644 --- a/spec/value_ref/value_ref_variable.spec.ts +++ b/spec/value_ref/value_ref_variable.spec.ts @@ -1,5 +1,6 @@ -import { ConduiteDistrib, ConduiteDistribParams } from "../../src/cond_distri"; -import { ParamValueMode, Session } from "../../src/index"; +import { ConduiteDistrib } from "../../src/cond_distri"; +import { ConduiteDistribParams } from "../../src/cond_distri_params"; +import { Session } from "../../src/index"; import { Result } from "../../src/util/result"; /** diff --git a/spec/value_ref/value_ref_variable_extraresult.spec.ts b/spec/value_ref/value_ref_variable_extraresult.spec.ts index 55df0479dc6dbd9426019cfb3cc5a8f0927455e0..c1f6462cb3477e8a65e2be9eb5d4f80cb2d5f641 100644 --- a/spec/value_ref/value_ref_variable_extraresult.spec.ts +++ b/spec/value_ref/value_ref_variable_extraresult.spec.ts @@ -1,7 +1,9 @@ // tslint:disable-next-line:max-line-length -import { CreateStructure, cSnCirc, LoiDebit, ParamsSectionCirc, Session } from "../../src/index"; +import { CreateStructure, cSnCirc, LoiDebit, Session } from "../../src/index"; import { RegimeUniforme } from "../../src/regime_uniforme"; -import { Dever, DeverParams } from "../../src/structure/dever"; +import { ParamsSectionCirc } from "../../src/section/section_circulaire_params"; +import { Dever } from "../../src/structure/dever"; +import { DeverParams } from "../../src/structure/dever_params"; /** * IMPORTANT ! diff --git a/spec/value_ref/value_ref_variable_result.spec.ts b/spec/value_ref/value_ref_variable_result.spec.ts index c0124736b7d6d6e71ad499395e1dfb9b612f3880..5dbd9796957256c8207218b1075d7bd67fa29925 100644 --- a/spec/value_ref/value_ref_variable_result.spec.ts +++ b/spec/value_ref/value_ref_variable_result.spec.ts @@ -1,4 +1,5 @@ -import { ConduiteDistrib, ConduiteDistribParams } from "../../src/cond_distri"; +import { ConduiteDistrib } from "../../src/cond_distri"; +import { ConduiteDistribParams } from "../../src/cond_distri_params"; import { Session } from "../../src/index"; import { Result } from "../../src/util/result"; diff --git a/src/compute-node.ts b/src/compute-node.ts index 9619bdda8ec8f66eeea9aec10639c1f4a98689d1..4c810db8eac10c7b7cbda6c9abd82dac169a47ba 100644 --- a/src/compute-node.ts +++ b/src/compute-node.ts @@ -1,7 +1,8 @@ import { Debug, IDebug } from "./base"; import { JalhydObject } from "./jalhyd_object"; import { ParamCalculability, ParamDefinition } from "./param/param-definition"; -import { IParamDefinitionIterator, ParamsEquation } from "./param/params-equation"; +import { IParamDefinitionIterator } from "./param/param_definition_iterator"; +import { ParamsEquation } from "./param/params-equation"; /** * type de calculette diff --git a/src/cond_distri.ts b/src/cond_distri.ts index 30fc05806b15cc3215ea2f9f85676b11bf249a10..396109932936d193bd30f21f24145d4208363b81 100644 --- a/src/cond_distri.ts +++ b/src/cond_distri.ts @@ -1,51 +1,12 @@ import { CalculatorType } from "./compute-node"; +import { ConduiteDistribParams } from "./cond_distri_params"; import { Nub } from "./nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "./param/param-definition"; -import { ParamDomainValue } from "./param/param-domain"; -import { ParamsEquation } from "./param/params-equation"; +import { ParamCalculability } from "./param/param-definition"; import { Result } from "./util/result"; -/** - * paramètres pour la conduite distributrice - */ -export class ConduiteDistribParams extends ParamsEquation { - /** Débit */ - public Q: ParamDefinition; - - /** Diamètre */ - public D: ParamDefinition; - - /** Perte de charge */ - public J: ParamDefinition; - - /** Longueur de la conduite */ - // tslint:disable-next-line:variable-name - public Lg: ParamDefinition; - - /** Viscosité dynamique nu */ - // tslint:disable-next-line:variable-name - public Nu: ParamDefinition; - - constructor(rQ: number, rD: number, rJ: number, rLg: number, rNu: number) { - super(); - this.Q = new ParamDefinition(this, "Q", ParamDomainValue.POS, "m³/s", rQ, ParamFamily.FLOWS); - this.D = new ParamDefinition(this, "D", ParamDomainValue.POS, "m", rD, ParamFamily.DIAMETERS); - this.J = new ParamDefinition(this, "J", ParamDomainValue.POS, "m", rJ); - this.Lg = new ParamDefinition(this, "Lg", ParamDomainValue.POS, "m", rLg, ParamFamily.LENGTHS); - this.Nu = new ParamDefinition(this, "Nu", ParamDomainValue.POS, "Pa·s", rNu); - - this.addParamDefinition(this.Q); - this.addParamDefinition(this.D); - this.addParamDefinition(this.J); - this.addParamDefinition(this.Lg); - this.addParamDefinition(this.Nu); - } -} - /** * classe de calcul sur la conduite distributrice */ -// tslint:disable-next-line:max-classes-per-file export class ConduiteDistrib extends Nub { constructor(prms: ConduiteDistribParams, dbg: boolean = false) { diff --git a/src/cond_distri_params.ts b/src/cond_distri_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..8bc62af44db648fb38e76ed4e192b251841e9f74 --- /dev/null +++ b/src/cond_distri_params.ts @@ -0,0 +1,40 @@ +import { ParamDefinition, ParamFamily } from "./param/param-definition"; +import { ParamDomainValue } from "./param/param-domain"; +import { ParamsEquation } from "./param/params-equation"; + +/** + * paramètres pour la conduite distributrice + */ +export class ConduiteDistribParams extends ParamsEquation { + /** Débit */ + public Q: ParamDefinition; + + /** Diamètre */ + public D: ParamDefinition; + + /** Perte de charge */ + public J: ParamDefinition; + + /** Longueur de la conduite */ + // tslint:disable-next-line:variable-name + public Lg: ParamDefinition; + + /** Viscosité dynamique nu */ + // tslint:disable-next-line:variable-name + public Nu: ParamDefinition; + + constructor(rQ: number, rD: number, rJ: number, rLg: number, rNu: number) { + super(); + this.Q = new ParamDefinition(this, "Q", ParamDomainValue.POS, "m³/s", rQ, ParamFamily.FLOWS); + this.D = new ParamDefinition(this, "D", ParamDomainValue.POS, "m", rD, ParamFamily.DIAMETERS); + this.J = new ParamDefinition(this, "J", ParamDomainValue.POS, "m", rJ); + this.Lg = new ParamDefinition(this, "Lg", ParamDomainValue.POS, "m", rLg, ParamFamily.LENGTHS); + this.Nu = new ParamDefinition(this, "Nu", ParamDomainValue.POS, "Pa·s", rNu); + + this.addParamDefinition(this.Q); + this.addParamDefinition(this.D); + this.addParamDefinition(this.J); + this.addParamDefinition(this.Lg); + this.addParamDefinition(this.Nu); + } +} diff --git a/src/dichotomie.ts b/src/dichotomie.ts index 278390dcd0f7efd57e4b7c0042740a0119422c6f..38904fd2b70bbbdcff9be3fe5bc01d8e1cd8140c 100644 --- a/src/dichotomie.ts +++ b/src/dichotomie.ts @@ -5,101 +5,7 @@ import { ParamDomain, ParamDomainValue } from "./param/param-domain"; import { Interval } from "./util/interval"; import { Message, MessageCode } from "./util/message"; import { Result } from "./util/result"; - -class SearchInterval extends Interval { - private _step: number; - - private _dicho: Dichotomie; - - private _targets: Interval; - - constructor(d: Dichotomie, min: number, max: number, s: number) { - super(min, max); - if (s === 0) { - const e = new Message(MessageCode.ERROR_DICHO_NULL_STEP); - throw e; - } - this._step = s; - this._dicho = d; - } - - public reverse() { - this._step = -this._step; - } - - public growStep(k: number) { - if (k === 0) { - const e = new Message(MessageCode.ERROR_DICHO_INVALID_STEP_GROWTH); - throw e; - } - this._step *= k; - } - - get step() { - return this._step; - } - - get targets() { - if (this._targets === undefined) { - // @TODO just set _targets to undefined / null ? - this._targets = new Interval(undefined, undefined); - } - return this._targets; - } - - /** - * get target value for lower bound - */ - get targetLower() { - this.updateTargets(); - // @TODO val1 is not guaranteed to be the lower bound; use .min ? - return this.targets.val1; - } - - /** - * get target value for upper bound - */ - get targetUpper() { - this.updateTargets(); - // @TODO val2 is not guaranteed to be the upper bound; use .max ? - return this.targets.val2; - } - - public next() { - if (this._step > 0) { - this.val1 = this.val2; - this.val2 += this._step; - this.targets.setValues(this.targets.val2, undefined); - } else { - this.val2 = this.val1; - this.val1 += this._step; - this.targets.setValues(undefined, this.targets.val1); - } - } - - public hasTargetValue(targ: number) { - this.updateTargets(); - return this.targets.intervalHasValue(targ); - } - - public toString(): string { - return super.toString() + " step=" + this._step; - } - - public updateTargets() { - let t1 = this.targets.val1; - if (t1 === undefined || isNaN(t1)) { - t1 = this._dicho.CalculX(this.val1); - } - - let t2 = this.targets.val2; - if (t2 === undefined || isNaN(t2)) { - t2 = this._dicho.CalculX(this.val2); - } - this.targets.setValues(t1, t2); - } - -} +import { SearchInterval } from "./util/search_interval"; /** * calcul par dichotomie @@ -107,7 +13,6 @@ class SearchInterval extends Interval { * on cherche par ex le x2 correspondant, les autres xi étant fixés. * la méthode Equation() calcule analytiquement y=f(xi) */ -// tslint:disable-next-line:max-classes-per-file export class Dichotomie extends Debug { /** * définition de la variable de la fonction diff --git a/src/index.ts b/src/index.ts index 243c278ee7ca6342658d4a54aa8d057b5c7af0bc..13bd76b6174e47216b22af8f7f4c6b2fbee2fa36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,7 +24,10 @@ export * from "./util/result"; export * from "./util/resultelement"; export * from "./util/interval"; export * from "./util/observer"; -export * from "./util/iterator"; +export * from "./util/array_reverse_iterator"; +export * from "./util/map_iterator"; +export * from "./util/number_array_iterator"; +export * from "./util/number_array_reverse_iterator"; export * from "./util/enum"; export * from "./pab/cloisons"; export * from "./structure/parallel_structure"; diff --git a/src/lechaptcalmon.ts b/src/lechaptcalmon.ts index 0a600d403d2bbe347b8cea6626e59390e63fbb63..36354324344ffb904d559409be04b004f4694c12 100644 --- a/src/lechaptcalmon.ts +++ b/src/lechaptcalmon.ts @@ -1,94 +1,14 @@ import { CalculatorType } from "./compute-node"; import { LCMaterial } from "./lc-material"; +import { LechaptCalmonParams } from "./lechaptcalmon_params"; import { Nub } from "./nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "./param/param-definition"; -import { ParamDomain, ParamDomainValue } from "./param/param-domain"; -import { ParamsEquation } from "./param/params-equation"; +import { ParamCalculability } from "./param/param-definition"; import { Observer } from "./util/observer"; import { Result } from "./util/result"; -/** - * paramètres pour le calcul Lechapt et Calmon - */ -export class LechaptCalmonParams extends ParamsEquation { - /** Débit */ - private _Q: ParamDefinition; - - /** Diamètre */ - private _D: ParamDefinition; - - /** Perte de charge */ - private _J: ParamDefinition; - - /** Longueur de la conduite */ - private _Lg: ParamDefinition; - - /** Paramètre de rugosité L */ - private _L: ParamDefinition; - - /** Paramètre de rugosité M */ - private _M: ParamDefinition; - - /** Paramètre de rugosité N */ - private _N: ParamDefinition; - - constructor(rQ: number, rD: number, rJ: number, rLg: number, rL: number, rM: number, rN: number) { - super(); - this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS, "m³/s", rQ, ParamFamily.FLOWS); - this._D = new ParamDefinition( - this, "D", new ParamDomain(ParamDomainValue.INTERVAL, 0, 20), "m", rD, ParamFamily.DIAMETERS - ); - this._J = new ParamDefinition(this, "J", ParamDomainValue.POS, "m", rJ); - this._Lg = new ParamDefinition(this, "Lg", ParamDomainValue.POS, "m", rLg, ParamFamily.LENGTHS); - this._L = new ParamDefinition(this, "L", new ParamDomain(ParamDomainValue.INTERVAL, 0.8, 2), undefined, rL, - undefined, false); - this._M = new ParamDefinition(this, "M", new ParamDomain(ParamDomainValue.INTERVAL, 1.5, 2.5), undefined, rM, - undefined, false); - this._N = new ParamDefinition(this, "N", new ParamDomain(ParamDomainValue.INTERVAL, 4.5, 5.5), undefined, rN, - undefined, false); - - this.addParamDefinition(this._Q); - this.addParamDefinition(this._D); - this.addParamDefinition(this._J); - this.addParamDefinition(this._Lg); - this.addParamDefinition(this._L); - this.addParamDefinition(this._M); - this.addParamDefinition(this._N); - } - - get Q() { - return this._Q; - } - - get D() { - return this._D; - } - - get J() { - return this._J; - } - - get Lg() { - return this._Lg; - } - - get L() { - return this._L; - } - - get M() { - return this._M; - } - - get N() { - return this._N; - } -} - /** * Calcul des pertes de charge dans un tube à partir des tables de Lechapt et Calmon */ -// tslint:disable-next-line:max-classes-per-file export class LechaptCalmon extends Nub implements Observer { private static _materials: Array<{ L: number, M: number, N: number, title: string }> = [ diff --git a/src/lechaptcalmon_params.ts b/src/lechaptcalmon_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e8f15d6c344d46ba199774d687e2854f639ce10 --- /dev/null +++ b/src/lechaptcalmon_params.ts @@ -0,0 +1,81 @@ +import { ParamDefinition, ParamFamily } from "./param/param-definition"; +import { ParamDomain, ParamDomainValue } from "./param/param-domain"; +import { ParamsEquation } from "./param/params-equation"; + +/** + * paramètres pour le calcul Lechapt et Calmon + */ +export class LechaptCalmonParams extends ParamsEquation { + /** Débit */ + private _Q: ParamDefinition; + + /** Diamètre */ + private _D: ParamDefinition; + + /** Perte de charge */ + private _J: ParamDefinition; + + /** Longueur de la conduite */ + private _Lg: ParamDefinition; + + /** Paramètre de rugosité L */ + private _L: ParamDefinition; + + /** Paramètre de rugosité M */ + private _M: ParamDefinition; + + /** Paramètre de rugosité N */ + private _N: ParamDefinition; + + constructor(rQ: number, rD: number, rJ: number, rLg: number, rL: number, rM: number, rN: number) { + super(); + this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS, "m³/s", rQ, ParamFamily.FLOWS); + this._D = new ParamDefinition( + this, "D", new ParamDomain(ParamDomainValue.INTERVAL, 0, 20), "m", rD, ParamFamily.DIAMETERS + ); + this._J = new ParamDefinition(this, "J", ParamDomainValue.POS, "m", rJ); + this._Lg = new ParamDefinition(this, "Lg", ParamDomainValue.POS, "m", rLg, ParamFamily.LENGTHS); + this._L = new ParamDefinition(this, "L", new ParamDomain(ParamDomainValue.INTERVAL, 0.8, 2), undefined, rL, + undefined, false); + this._M = new ParamDefinition(this, "M", new ParamDomain(ParamDomainValue.INTERVAL, 1.5, 2.5), undefined, rM, + undefined, false); + this._N = new ParamDefinition(this, "N", new ParamDomain(ParamDomainValue.INTERVAL, 4.5, 5.5), undefined, rN, + undefined, false); + + this.addParamDefinition(this._Q); + this.addParamDefinition(this._D); + this.addParamDefinition(this._J); + this.addParamDefinition(this._Lg); + this.addParamDefinition(this._L); + this.addParamDefinition(this._M); + this.addParamDefinition(this._N); + } + + get Q() { + return this._Q; + } + + get D() { + return this._D; + } + + get J() { + return this._J; + } + + get Lg() { + return this._Lg; + } + + get L() { + return this._L; + } + + get M() { + return this._M; + } + + get N() { + return this._N; + } +} diff --git a/src/macrorugo/macrorugo.ts b/src/macrorugo/macrorugo.ts index 1adc516b0486cc9972da5b3cbab4c0ee7f64d94f..9d7577a4dbd3540dab8bbb5e6a89d75e525a8db7 100644 --- a/src/macrorugo/macrorugo.ts +++ b/src/macrorugo/macrorugo.ts @@ -6,8 +6,6 @@ import { ParamValueMode } from "../param/param-value-mode"; import { Result } from "../util/result"; import { MacrorugoParams } from "./macrorugo_params"; -export { MacrorugoParams }; - export enum MacroRugoFlowType { EMERGENT, QUASI_EMERGENT, diff --git a/src/macrorugo/macrorugo_compound_params.ts b/src/macrorugo/macrorugo_compound_params.ts index 93e55e4917b56b3ad922b15802a22e7a47902f47..d849b481aa8a118f63eeb37bd3e5b0983703b5d7 100644 --- a/src/macrorugo/macrorugo_compound_params.ts +++ b/src/macrorugo/macrorugo_compound_params.ts @@ -1,6 +1,6 @@ import { ParamDefinition, ParamFamily } from "../param/param-definition"; import { ParamDomain, ParamDomainValue } from "../param/param-domain"; -import { MacrorugoParams } from "./macrorugo"; +import { MacrorugoParams } from "./macrorugo_params"; export class MacrorugoCompoundParams extends MacrorugoParams { diff --git a/src/nub.ts b/src/nub.ts index c3f36c512ab79bc29fd4674a8230ff0045e16ffe..09a0e8514c8836a3e79a785071e126b17fdc69f9 100644 --- a/src/nub.ts +++ b/src/nub.ts @@ -1,11 +1,13 @@ import { CalculatorType, ComputeNode } from "./compute-node"; import { Dichotomie } from "./dichotomie"; -import { acSection, IParamDefinitionIterator, MacrorugoCompound, Pab, ParamDefinition, ParamsEquation, - ParamsEquationArrayIterator, Session, Structure } from "./index"; +import { acSection, MacrorugoCompound, Pab, ParamDefinition, ParamsEquation, + Session, Structure } from "./index"; import { LinkedValue } from "./linked-value"; import { ParamCalculability, ParamFamily } from "./param/param-definition"; import { ParamValueMode } from "./param/param-value-mode"; import { ParamValues } from "./param/param-values"; +import { IParamDefinitionIterator } from "./param/param_definition_iterator"; +import { ParamsEquationArrayIterator } from "./param/params_equation_array_iterator"; import { Props } from "./props"; import { IObservable, Observable, Observer } from "./util/observer"; import { Result } from "./util/result"; diff --git a/src/pab/cloison_aval.ts b/src/pab/cloison_aval.ts index 0f88fa1515e5b9dba74085af10287f4e0768ac2e..58db80f8b6152a0ecf34f87d14780c1719f09bab 100644 --- a/src/pab/cloison_aval.ts +++ b/src/pab/cloison_aval.ts @@ -1,14 +1,13 @@ -import { CalculatorType, ParamsEquation } from "../index"; +import { CalculatorType } from "../index"; import { ParamCalculability } from "../param/param-definition"; import { ParallelStructure } from "../structure/parallel_structure"; import { loiAdmissiblesCloisonAval, LoiDebit } from "../structure/structure_props"; -import { StructureVanLevLarinier, StructureVanLevVillemonte } from "../structure/structure_vanlev"; +import { StructureVanLevLarinier } from "../structure/structure_vanlev_larinier"; +import { StructureVanLevVillemonte } from "../structure/structure_vanlev_villemonte"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { CloisonsAvalParams } from "./cloison_aval_params"; -export { ParallelStructureParams } from "../structure/parallel_structure_params"; - export class CloisonAval extends ParallelStructure { constructor(prms: CloisonsAvalParams, dbg: boolean = false) { diff --git a/src/pab/cloisons.ts b/src/pab/cloisons.ts index 32ec000c0493af0204739ce93a44c4c5fafd7353..6be9d09f03aea5b72bf2e14968b904a63d8cd686 100644 --- a/src/pab/cloisons.ts +++ b/src/pab/cloisons.ts @@ -2,12 +2,10 @@ import { CalculatorType } from "../compute-node"; import { Nub, Pab, StructureParams } from "../index"; import { ParamCalculability } from "../param/param-definition"; import { ParallelStructure } from "../structure/parallel_structure"; -import { StructureKiviParams } from "../structure/structure_kivi"; +import { StructureKiviParams } from "../structure/structure_kivi_params"; import { loiAdmissiblesCloisons, LoiDebit } from "../structure/structure_props"; import { Result } from "../util/result"; import { CloisonsParams } from "./cloisons_params"; - -export { CloisonsParams }; export class Cloisons extends ParallelStructure { constructor(prms: CloisonsParams, dbg: boolean = false) { diff --git a/src/pab/pab.ts b/src/pab/pab.ts index 0fffd368109baf23f562389cbb0149f8e7f020ca..1ff3e398cd6e242619b6083d01cf28c0d2c27ea5 100644 --- a/src/pab/pab.ts +++ b/src/pab/pab.ts @@ -2,7 +2,9 @@ import { CalculatorType } from "../compute-node"; import { ParamValueMode } from "../index"; import { Nub } from "../nub"; import { ParamCalculability, ParamDefinition } from "../param/param-definition"; -import { IParamDefinitionIterator, ParamsEquation, ParamsEquationArrayIterator } from "../param/params-equation"; +import { IParamDefinitionIterator } from "../param/param_definition_iterator"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamsEquationArrayIterator } from "../param/params_equation_array_iterator"; import { Props } from "../props"; import { Session } from "../session"; import { ParallelStructure } from "../structure/parallel_structure"; @@ -10,13 +12,11 @@ import { StructureTriangularTruncWeirFree } from "../structure/structure_triangu import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { ResultElement } from "../util/resultelement"; -import { CloisonAval, ParallelStructureParams } from "./cloison_aval"; +import { CloisonAval } from "./cloison_aval"; import { CloisonsAvalParams } from "./cloison_aval_params"; import { Cloisons } from "./cloisons"; import { PabParams } from "./pab_params"; -export { PabParams }; - export class Pab extends Nub { /** diff --git a/src/pab/pab_chute.ts b/src/pab/pab_chute.ts index c076d90ea617cd932abdcdebfc844c93acfc7a9c..a494221ca33ee31dcd69655de7242d622fe4ca7c 100644 --- a/src/pab/pab_chute.ts +++ b/src/pab/pab_chute.ts @@ -1,48 +1,10 @@ import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; +import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; +import { PabChuteParams } from "./pab_chute_params"; -export class PabChuteParams extends ParamsEquation { - [key: string]: any; // pour pouvoir faire this['methode'](); - - /** Cote amont Z1 */ - private _Z1: ParamDefinition; - - /** Cote aval Z2 */ - private _Z2: ParamDefinition; - - /** Chute DH */ - private _DH: ParamDefinition; - - constructor(rZ1: number, rZ2: number, rDH: number) { - super(); - this._Z1 = new ParamDefinition(this, "Z1", ParamDomainValue.ANY, "m", rZ1, ParamFamily.ELEVATIONS); - this._Z2 = new ParamDefinition(this, "Z2", ParamDomainValue.ANY, "m", rZ2, ParamFamily.ELEVATIONS); - this._DH = new ParamDefinition(this, "DH", ParamDomainValue.POS_NULL, "m", rDH, ParamFamily.TOTALFALLS); - - this.addParamDefinition(this._Z1); - this.addParamDefinition(this._Z2); - this.addParamDefinition(this._DH); - } - - get Z1() { - return this._Z1; - } - - get Z2() { - return this._Z2; - } - - get DH() { - return this._DH; - } -} - -// tslint:disable-next-line:max-classes-per-file export class PabChute extends Nub { constructor(prms: PabChuteParams, dbg: boolean = false) { super(prms, dbg); diff --git a/src/pab/pab_chute_params.ts b/src/pab/pab_chute_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..e5cfe64ba7c3165735c998ca5285dee585d5b9db --- /dev/null +++ b/src/pab/pab_chute_params.ts @@ -0,0 +1,39 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsEquation } from "../param/params-equation"; + +export class PabChuteParams extends ParamsEquation { + [key: string]: any; // pour pouvoir faire this['methode'](); + + /** Cote amont Z1 */ + private _Z1: ParamDefinition; + + /** Cote aval Z2 */ + private _Z2: ParamDefinition; + + /** Chute DH */ + private _DH: ParamDefinition; + + constructor(rZ1: number, rZ2: number, rDH: number) { + super(); + this._Z1 = new ParamDefinition(this, "Z1", ParamDomainValue.ANY, "m", rZ1, ParamFamily.ELEVATIONS); + this._Z2 = new ParamDefinition(this, "Z2", ParamDomainValue.ANY, "m", rZ2, ParamFamily.ELEVATIONS); + this._DH = new ParamDefinition(this, "DH", ParamDomainValue.POS_NULL, "m", rDH, ParamFamily.TOTALFALLS); + + this.addParamDefinition(this._Z1); + this.addParamDefinition(this._Z2); + this.addParamDefinition(this._DH); + } + + get Z1() { + return this._Z1; + } + + get Z2() { + return this._Z2; + } + + get DH() { + return this._DH; + } +} diff --git a/src/pab/pab_dimension.ts b/src/pab/pab_dimension.ts index 965495c17ac2f3c3254862bcf20b5b05597a0e94..0cbc8af6f3902ca2bceb3894a12a7efb04115e8b 100644 --- a/src/pab/pab_dimension.ts +++ b/src/pab/pab_dimension.ts @@ -1,56 +1,9 @@ import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; +import { ParamCalculability } from "../param/param-definition"; import { Result } from "../util/result"; +import { PabDimensionParams } from "./pab_dimensions_params"; -export class PabDimensionParams extends ParamsEquation { - [key: string]: any; // pour pouvoir faire this['methode](); - - /** Longueur L */ - private _L: ParamDefinition; - - /** Largeur W */ - private _W: ParamDefinition; - - /** Tirant d'eau Y */ - private _Y: ParamDefinition; - - /** Volume V */ - private _V: ParamDefinition; - - constructor(rL: number, rW: number, rY: number, rV?: number) { - super(); - this._L = new ParamDefinition(this, "L", ParamDomainValue.POS, "m", rL, ParamFamily.LENGTHS); - this._W = new ParamDefinition(this, "W", ParamDomainValue.POS, "m", rW, ParamFamily.WIDTHS); - this._Y = new ParamDefinition(this, "Y", ParamDomainValue.POS, "m", rY, ParamFamily.HEIGHTS); - this._V = new ParamDefinition(this, "V", ParamDomainValue.POS, "m³", rV, ParamFamily.VOLUMES); - - this.addParamDefinition(this._L); - this.addParamDefinition(this._W); - this.addParamDefinition(this._Y); - this.addParamDefinition(this._V); - } - - get L() { - return this._L; - } - - get W() { - return this._W; - } - - get Y() { - return this._Y; - } - - get V() { - return this._V; - } -} - -// tslint:disable-next-line:max-classes-per-file export class PabDimension extends Nub { constructor(prms: PabDimensionParams, dbg: boolean = false) { super(prms, dbg); diff --git a/src/pab/pab_dimensions_params.ts b/src/pab/pab_dimensions_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..044fddfa6605c0f6f61743ce020ec9fb5a2ae71d --- /dev/null +++ b/src/pab/pab_dimensions_params.ts @@ -0,0 +1,48 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsEquation } from "../param/params-equation"; + +export class PabDimensionParams extends ParamsEquation { + [key: string]: any; // pour pouvoir faire this['methode](); + + /** Longueur L */ + private _L: ParamDefinition; + + /** Largeur W */ + private _W: ParamDefinition; + + /** Tirant d'eau Y */ + private _Y: ParamDefinition; + + /** Volume V */ + private _V: ParamDefinition; + + constructor(rL: number, rW: number, rY: number, rV?: number) { + super(); + this._L = new ParamDefinition(this, "L", ParamDomainValue.POS, "m", rL, ParamFamily.LENGTHS); + this._W = new ParamDefinition(this, "W", ParamDomainValue.POS, "m", rW, ParamFamily.WIDTHS); + this._Y = new ParamDefinition(this, "Y", ParamDomainValue.POS, "m", rY, ParamFamily.HEIGHTS); + this._V = new ParamDefinition(this, "V", ParamDomainValue.POS, "m³", rV, ParamFamily.VOLUMES); + + this.addParamDefinition(this._L); + this.addParamDefinition(this._W); + this.addParamDefinition(this._Y); + this.addParamDefinition(this._V); + } + + get L() { + return this._L; + } + + get W() { + return this._W; + } + + get Y() { + return this._Y; + } + + get V() { + return this._V; + } +} diff --git a/src/pab/pab_nombre.ts b/src/pab/pab_nombre.ts index fbad5cd396ad6c9c7c5e9ca66f248cfe1204ce93..27b76643f21cf3968c164e869ab1b0b7dfc11d97 100644 --- a/src/pab/pab_nombre.ts +++ b/src/pab/pab_nombre.ts @@ -1,49 +1,11 @@ import { floatDivAndMod } from "../base"; import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; +import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; +import { PabNombreParams } from "./pab_nombre_params"; -export class PabNombreParams extends ParamsEquation { - [key: string]: any; // pour pouvoir faire this['methode'](); - - /** Chute totale DHT */ - private _DHT: ParamDefinition; - - /** Nombre de chutes N */ - private _N: ParamDefinition; - - /** Chute entre bassins DH */ - private _DH: ParamDefinition; - - constructor(rDHT: number, rN: number, rDH: number) { - super(); - this._DHT = new ParamDefinition(this, "DHT", ParamDomainValue.POS, "m", rDHT, ParamFamily.TOTALFALLS); - this._N = new ParamDefinition(this, "N", ParamDomainValue.POS, undefined, rN); - this._DH = new ParamDefinition(this, "DH", ParamDomainValue.POS, "m", rDH, ParamFamily.BASINFALLS); - - this.addParamDefinition(this._DHT); - this.addParamDefinition(this._N); - this.addParamDefinition(this._DH); - } - - get DHT() { - return this._DHT; - } - - get N() { - return this._N; - } - - get DH() { - return this._DH; - } -} - -// tslint:disable-next-line:max-classes-per-file export class PabNombre extends Nub { constructor(prms: PabNombreParams, dbg: boolean = false) { super(prms, dbg); diff --git a/src/pab/pab_nombre_params.ts b/src/pab/pab_nombre_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..76834d3fe8bb88a11e271e43652a6c3b88f9c4b0 --- /dev/null +++ b/src/pab/pab_nombre_params.ts @@ -0,0 +1,39 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsEquation } from "../param/params-equation"; + +export class PabNombreParams extends ParamsEquation { + [key: string]: any; // pour pouvoir faire this['methode'](); + + /** Chute totale DHT */ + private _DHT: ParamDefinition; + + /** Nombre de chutes N */ + private _N: ParamDefinition; + + /** Chute entre bassins DH */ + private _DH: ParamDefinition; + + constructor(rDHT: number, rN: number, rDH: number) { + super(); + this._DHT = new ParamDefinition(this, "DHT", ParamDomainValue.POS, "m", rDHT, ParamFamily.TOTALFALLS); + this._N = new ParamDefinition(this, "N", ParamDomainValue.POS, undefined, rN); + this._DH = new ParamDefinition(this, "DH", ParamDomainValue.POS, "m", rDH, ParamFamily.BASINFALLS); + + this.addParamDefinition(this._DHT); + this.addParamDefinition(this._N); + this.addParamDefinition(this._DH); + } + + get DHT() { + return this._DHT; + } + + get N() { + return this._N; + } + + get DH() { + return this._DH; + } +} diff --git a/src/pab/pab_puissance.ts b/src/pab/pab_puissance.ts index f5050535405a4681bb62e8eb7d607d37e5f11306..4e4a03711f5c50569d3bf4080376a8a4c932555a 100644 --- a/src/pab/pab_puissance.ts +++ b/src/pab/pab_puissance.ts @@ -1,56 +1,9 @@ import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; +import { ParamCalculability } from "../param/param-definition"; import { Result } from "../util/result"; +import { PabPuissanceParams } from "./pab_puissance_params"; -export class PabPuissanceParams extends ParamsEquation { - [key: string]: any; // pour pouvoir faire this['methode](); - - /** Chute entre bassins DH */ - private _DH: ParamDefinition; - - /** Débit Q */ - private _Q: ParamDefinition; - - /** Volume V */ - private _V: ParamDefinition; - - /** Puissance dissipée PV */ - private _PV: ParamDefinition; - - constructor(rDH: number, rQ: number, rV: number, rPV?: number) { - super(); - this._DH = new ParamDefinition(this, "DH", ParamDomainValue.POS, "m", rDH, ParamFamily.BASINFALLS); - this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS_NULL, "m³/s", rQ, ParamFamily.FLOWS); - this._V = new ParamDefinition(this, "V", ParamDomainValue.POS, "m³", rV, ParamFamily.VOLUMES); - this._PV = new ParamDefinition(this, "PV", ParamDomainValue.POS, "W/m³", rPV); - - this.addParamDefinition(this._DH); - this.addParamDefinition(this._Q); - this.addParamDefinition(this._V); - this.addParamDefinition(this._PV); - } - - get DH() { - return this._DH; - } - - get Q() { - return this._Q; - } - - get V() { - return this._V; - } - - get PV() { - return this._PV; - } -} - -// tslint:disable-next-line:max-classes-per-file export class PabPuissance extends Nub { constructor(prms: PabPuissanceParams, dbg: boolean = false) { super(prms, dbg); diff --git a/src/pab/pab_puissance_params.ts b/src/pab/pab_puissance_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..45690c247be83017281cae847390c52a4fd7f831 --- /dev/null +++ b/src/pab/pab_puissance_params.ts @@ -0,0 +1,48 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsEquation } from "../param/params-equation"; + +export class PabPuissanceParams extends ParamsEquation { + [key: string]: any; // pour pouvoir faire this['methode](); + + /** Chute entre bassins DH */ + private _DH: ParamDefinition; + + /** Débit Q */ + private _Q: ParamDefinition; + + /** Volume V */ + private _V: ParamDefinition; + + /** Puissance dissipée PV */ + private _PV: ParamDefinition; + + constructor(rDH: number, rQ: number, rV: number, rPV?: number) { + super(); + this._DH = new ParamDefinition(this, "DH", ParamDomainValue.POS, "m", rDH, ParamFamily.BASINFALLS); + this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS_NULL, "m³/s", rQ, ParamFamily.FLOWS); + this._V = new ParamDefinition(this, "V", ParamDomainValue.POS, "m³", rV, ParamFamily.VOLUMES); + this._PV = new ParamDefinition(this, "PV", ParamDomainValue.POS, "W/m³", rPV); + + this.addParamDefinition(this._DH); + this.addParamDefinition(this._Q); + this.addParamDefinition(this._V); + this.addParamDefinition(this._PV); + } + + get DH() { + return this._DH; + } + + get Q() { + return this._Q; + } + + get V() { + return this._V; + } + + get PV() { + return this._PV; + } +} diff --git a/src/param/param-value-iterator.ts b/src/param/param-value-iterator.ts index dfc309826f2f593b054fd8054885649668ce87f8..42d82906ecadbbce041c8e36840f1456588cfba0 100644 --- a/src/param/param-value-iterator.ts +++ b/src/param/param-value-iterator.ts @@ -1,5 +1,4 @@ import { INamedObject, IObjectWithFamily } from "../jalhyd_object"; -import { ArrayReverseIterator } from "../util/iterator"; import { ExtensionStrategy } from "./param-definition"; import { ParamValueMode } from "./param-value-mode"; import { ParamValues } from "./param-values"; @@ -30,6 +29,7 @@ export interface INumberIterator extends IterableIterator<number> { /** * interface implémentée par les objets pouvant posséder/renvoyer un itérateur sur une série de valeurs numériques */ +// tslint:disable-next-line:interface-name export interface IterableValues extends INumberIterator { /** * crée un nouvel itérateur sur les valeurs @@ -301,95 +301,3 @@ export class ParamValueIterator implements INumberIterator { } } } - -/** - * itérateur sur les valeurs prises par un tableau - */ -// tslint:disable-next-line:max-classes-per-file -export class NumberArrayIterator implements INumberIterator { - private _it: IterableIterator<number>; - - private _index: number; - - /** - * valeur courante - */ - private _current: number; - - constructor(private _arr: number[]) { - this._it = this._arr[Symbol.iterator](); // crée un itérateur à partir d'un tableau - this._index = 0; - } - - public count() { - return this._arr.length; - } - - public get hasNext(): boolean { - return this._index < this._arr.length; - } - - public next(): IteratorResult<number> { - this._index++; - const res = this._it.next(); - if (!res.done) { - this._current = res.value; - } - return res; - } - - public get currentValue(): number { - return this._current; - } - - // interface IterableIterator - - public [Symbol.iterator](): IterableIterator<number> { - return this; - } -} - -/** - * itérateur sur les valeurs prises par un tableau (parcourues depuis la fin) - */ -// tslint:disable-next-line:max-classes-per-file -export class NumberArrayReverseIterator extends ArrayReverseIterator<number> implements INumberIterator { - private _count: number; - - /** - * valeur courante - */ - private _current: number; - - constructor(arr: number[]) { - super(arr); - this._count = 0; - } - - public count() { - return this._arr.length; - } - - public get hasNext(): boolean { - return this._count < super._arr.length; - } - - public next(): IteratorResult<number> { - this._count++; - const res = super.next(); - if (!res.done) { - this._current = res.value; - } - return res; - } - - public get currentValue(): number { - return this._current; - } - - // interface IterableIterator - - public [Symbol.iterator](): IterableIterator<number> { - return this; - } -} diff --git a/src/param/param_definition_iterator.ts b/src/param/param_definition_iterator.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7f272492eb11a972b04061fa29f994a7e3607fb --- /dev/null +++ b/src/param/param_definition_iterator.ts @@ -0,0 +1,25 @@ +import { MapIterator } from "../util/map_iterator"; +import { ParamDefinition } from "./param-definition"; +import { ParamsEquation } from "./params-equation"; + +export interface IParamDefinitionIterator extends IterableIterator<ParamDefinition> { +} + +/** + * itérateur sur les paramètres d'une seule instance de ParamsEquation + */ +export class ParamDefinitionIterator implements IParamDefinitionIterator { + private _mapIterator: MapIterator<ParamDefinition>; + + constructor(_params: ParamsEquation) { + this._mapIterator = new MapIterator(_params.map); + } + + public next(): IteratorResult<ParamDefinition> { + return this._mapIterator.next(); + } + + public [Symbol.iterator](): IterableIterator<ParamDefinition> { + return this; + } +} diff --git a/src/param/params-equation.ts b/src/param/params-equation.ts index 6eb66a5c42fed11e9f1591d2813a7e45a83428ff..00cddf9dca785cf2cc661efb39b5169ede702a13 100644 --- a/src/param/params-equation.ts +++ b/src/param/params-equation.ts @@ -1,88 +1,11 @@ import { ComputeNode } from "../compute-node"; -import { MapIterator } from "../util/iterator"; import { ParamDefinition } from "./param-definition"; import { ParamDomainValue } from "./param-domain"; - -export interface IParamDefinitionIterator extends IterableIterator<ParamDefinition> { -} - -/** - * itérateur sur les paramètres d'une seule instance de ParamsEquation - */ -export class ParamDefinitionIterator implements IParamDefinitionIterator { - private _mapIterator: MapIterator<ParamDefinition>; - - constructor(_params: ParamsEquation) { - this._mapIterator = new MapIterator(_params.map); - } - - public next(): IteratorResult<ParamDefinition> { - return this._mapIterator.next(); - } - - public [Symbol.iterator](): IterableIterator<ParamDefinition> { - return this; - } -} - -/** - * itérateur sur les paramètres d'un tableau de de ParamsEquation - */ -// tslint:disable-next-line:max-classes-per-file -export class ParamsEquationArrayIterator implements IParamDefinitionIterator { - - private get done(): IteratorResult<ParamDefinition> { - return { - done: true, - value: undefined - }; - } - private _paramsEqs: ParamsEquation[]; - - private _index: number = 0; - - private _currentMapIterator: MapIterator<ParamDefinition>; - - constructor(p: ParamsEquation[]) { - this._paramsEqs = p; - } - - public next(): IteratorResult<ParamDefinition> { - if (this._currentMapIterator === undefined) { - this.nextIterator(); - } - - let res = this.done; - if (this._currentMapIterator) { - res = this._currentMapIterator.next(); - if (res.done) { - this.nextIterator(); - if (this._currentMapIterator) { - res = this._currentMapIterator.next(); - } - } - } - - return res; - } - - public [Symbol.iterator](): IterableIterator<ParamDefinition> { - return this; - } - - private nextIterator() { - if (this._index < this._paramsEqs.length) { - this._currentMapIterator = new MapIterator(this._paramsEqs[this._index++].map); - } else { - this._currentMapIterator = undefined; - } - } -} +import { IParamDefinitionIterator, ParamDefinitionIterator } from "./param_definition_iterator"; /** * liste des paramètres d'une équation */ -// tslint:disable-next-line:max-classes-per-file export abstract class ParamsEquation implements Iterable<ParamDefinition> { /** précision de calcul par défaut */ diff --git a/src/param/params_equation_array_iterator.ts b/src/param/params_equation_array_iterator.ts new file mode 100644 index 0000000000000000000000000000000000000000..02cd6ade25da5b3ee0cbbdbadf87db707eb66d17 --- /dev/null +++ b/src/param/params_equation_array_iterator.ts @@ -0,0 +1,57 @@ +import { MapIterator } from "../util/map_iterator"; +import { ParamDefinition } from "./param-definition"; +import { IParamDefinitionIterator } from "./param_definition_iterator"; +import { ParamsEquation } from "./params-equation"; + +/** + * itérateur sur les paramètres d'un tableau de de ParamsEquation + */ +export class ParamsEquationArrayIterator implements IParamDefinitionIterator { + + private get done(): IteratorResult<ParamDefinition> { + return { + done: true, + value: undefined + }; + } + private _paramsEqs: ParamsEquation[]; + + private _index: number = 0; + + private _currentMapIterator: MapIterator<ParamDefinition>; + + constructor(p: ParamsEquation[]) { + this._paramsEqs = p; + } + + public next(): IteratorResult<ParamDefinition> { + if (this._currentMapIterator === undefined) { + this.nextIterator(); + } + + let res = this.done; + if (this._currentMapIterator) { + res = this._currentMapIterator.next(); + if (res.done) { + this.nextIterator(); + if (this._currentMapIterator) { + res = this._currentMapIterator.next(); + } + } + } + + return res; + } + + public [Symbol.iterator](): IterableIterator<ParamDefinition> { + return this; + } + + private nextIterator() { + if (this._index < this._paramsEqs.length) { + this._currentMapIterator = new MapIterator(this._paramsEqs[this._index++].map); + } else { + this._currentMapIterator = undefined; + } + } +} diff --git a/src/regime_uniforme.ts b/src/regime_uniforme.ts index bf0685c50bf4fd037095904e68cd806e2991fdac..6d7418c7f080a651e11d80002a284dd25e4b197f 100644 --- a/src/regime_uniforme.ts +++ b/src/regime_uniforme.ts @@ -1,7 +1,7 @@ import { CalculatorType } from "./compute-node"; import { ParamCalculability } from "./param/param-definition"; import { SectionNub } from "./section/section_nub"; -import { SectionParams } from "./section/section_parametree"; +import { SectionParams } from "./section/section_parametree_params"; import { acSection } from "./section/section_type"; import { Result } from "./util/result"; diff --git a/src/remous/remous.ts b/src/remous/remous.ts index d6d370dd30ad7c3b5f7f9cc1f9a7c431f4362177..88178cd5bee2a2c365df8c37bf40851fed330654 100644 --- a/src/remous/remous.ts +++ b/src/remous/remous.ts @@ -1,11 +1,9 @@ import { round, XOR } from "../base"; import { CalculatorType } from "../compute-node"; import { Dichotomie } from "../dichotomie"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; +import { ParamCalculability } from "../param/param-definition"; import { ParamValueMode } from "../param/param-value-mode"; import { ParamValues } from "../param/param-values"; -import { ParamsEquation } from "../param/params-equation"; import { SectionNub } from "../section/section_nub"; import { acSection } from "../section/section_type"; import { cLog } from "../util/log"; @@ -13,82 +11,16 @@ import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { ResultElement } from "../util/resultelement"; import { MethodeResolution } from "./methode-resolution"; +import { CourbeRemousParams } from "./remous_params"; export interface ITrYResult { trY: { [key: number]: number; }; log: cLog; } -/** - * paramètres pour les courbes de remous - */ -export class CourbeRemousParams extends ParamsEquation { - - /** - * Débit amont - */ - // private _Qamont: ParamDefinition; - - /** - * Tirant imposé à l'amont - */ - private _Yamont: ParamDefinition; - - /** - * Tirant imposé à l'aval - */ - private _Yaval: ParamDefinition; - - /** - * Longueur du bief - */ - private _Long: ParamDefinition; - - /** - * Pas de discrétisation de l'espace (positif en partant de l'aval, négatif en partant de l'amont) - */ - private _Dx: ParamDefinition; - - constructor(rYamont: number, rYAval: number, rLong: number, rDx: number) { - super(); - this._Yamont = new ParamDefinition(this, "Yamont", ParamDomainValue.POS, "m", rYamont, ParamFamily.HEIGHTS); - this._Yaval = new ParamDefinition(this, "Yaval", ParamDomainValue.POS, "m", rYAval, ParamFamily.HEIGHTS); - this._Long = new ParamDefinition(this, "Long", ParamDomainValue.POS, "m", rLong, ParamFamily.LENGTHS); - this._Dx = new ParamDefinition(this, "Dx", ParamDomainValue.POS, "m", rDx); - - this.addParamDefinition(this._Yamont); - this.addParamDefinition(this._Yaval); - this.addParamDefinition(this._Long); - this.addParamDefinition(this._Dx); - - this.Pr.visible = true; // exception - } - - public addParamDefinition(p: ParamDefinition) { - super.addParamDefinition(p); - } - - get Yamont() { - return this._Yamont; - } - - get Yaval() { - return this._Yaval; - } - - get Long() { - return this._Long; - } - - get Dx(): ParamDefinition { - return this._Dx; - } -} - /** * Calcul d'une courbe de remous */ -// tslint:disable-next-line:max-classes-per-file export class CourbeRemous extends SectionNub { [key: string]: any; // pour pouvoir faire this['methode](); diff --git a/src/remous/remous_params.ts b/src/remous/remous_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..54029f5667104854e050c31c94894b5357a502fb --- /dev/null +++ b/src/remous/remous_params.ts @@ -0,0 +1,69 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsEquation } from "../param/params-equation"; + +/** + * paramètres pour les courbes de remous + */ +export class CourbeRemousParams extends ParamsEquation { + + /** + * Débit amont + */ + // private _Qamont: ParamDefinition; + + /** + * Tirant imposé à l'amont + */ + private _Yamont: ParamDefinition; + + /** + * Tirant imposé à l'aval + */ + private _Yaval: ParamDefinition; + + /** + * Longueur du bief + */ + private _Long: ParamDefinition; + + /** + * Pas de discrétisation de l'espace (positif en partant de l'aval, négatif en partant de l'amont) + */ + private _Dx: ParamDefinition; + + constructor(rYamont: number, rYAval: number, rLong: number, rDx: number) { + super(); + this._Yamont = new ParamDefinition(this, "Yamont", ParamDomainValue.POS, "m", rYamont, ParamFamily.HEIGHTS); + this._Yaval = new ParamDefinition(this, "Yaval", ParamDomainValue.POS, "m", rYAval, ParamFamily.HEIGHTS); + this._Long = new ParamDefinition(this, "Long", ParamDomainValue.POS, "m", rLong, ParamFamily.LENGTHS); + this._Dx = new ParamDefinition(this, "Dx", ParamDomainValue.POS, "m", rDx); + + this.addParamDefinition(this._Yamont); + this.addParamDefinition(this._Yaval); + this.addParamDefinition(this._Long); + this.addParamDefinition(this._Dx); + + this.Pr.visible = true; // exception + } + + public addParamDefinition(p: ParamDefinition) { + super.addParamDefinition(p); + } + + get Yamont() { + return this._Yamont; + } + + get Yaval() { + return this._Yaval; + } + + get Long() { + return this._Long; + } + + get Dx(): ParamDefinition { + return this._Dx; + } +} diff --git a/src/section/hauteur.ts b/src/section/hauteur.ts deleted file mode 100644 index 2b3a8d41c79bf62473226111eaa9bfa15068ec07..0000000000000000000000000000000000000000 --- a/src/section/hauteur.ts +++ /dev/null @@ -1,429 +0,0 @@ -import { Message, MessageCode } from "../util/message"; -import { Result } from "../util/result"; -import { acNewton } from "./newton"; -import { acSection, ParamsSection } from "./section_type"; - -/** - * Calcul de la hauteur critique - */ -// tslint:disable-next-line:class-name -export class cHautCritique extends acNewton { - /** - * Section sur laquuelle porte le calcul - */ - // tslint:disable-next-line:variable-name - private Sn: acSection; - - /** - * Constructeur de la classe - * @param Sn Section sur laquelle on fait le calcul - */ - // tslint:disable-next-line:variable-name - constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { - super(Sn.prms, maxIter, dbg); - this.Sn = Sn.clone(); - } - - /** - * Calcul de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcFn(rX: number): Result { - const rS: Result = this.Sn.CalcSection("S", rX); - if (!rS.ok) { - return rS; - } - - // Calcul de la fonction - // if (this.Sn.CalcSection("S", rX) !== 0) - if (rS.vCalc === 0) { - return new Result(new Message(MessageCode.ERROR_SECTION_SURFACE_NULLE)); - } - - // tslint:disable-next-line:max-line-length - // return (Math.pow(this.Sn.prms.Q.v, 2) * this.Sn.CalcSection("B", rX) / Math.pow(this.Sn.CalcSection("S", rX), 3) / ParamsSection.G - 1); - const rB: Result = this.Sn.CalcSection("B", rX); - if (!rB.ok) { - return rB; - } - - const rS2: Result = this.Sn.CalcSection("S", rX); - if (!rS2.ok) { - return rS2; - } - - const v = (Math.pow(this.Sn.prms.Q.v, 2) * rB.vCalc / Math.pow(rS2.vCalc, 3) / ParamsSection.G - 1); - return new Result(v); - - // return Infinity; - } - - /** - * Calcul analytique de la dérivée de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcDer(rX: number): Result { - // let S = this.Sn.CalcSection("S"); - const rS: Result = this.Sn.CalcSection("S"); - if (!rS.ok) { - return rS; - } - const S = rS.vCalc; - // if (S !== 0) { - if (S === 0) { - return new Result(new Message(MessageCode.ERROR_SECTION_SURFACE_NULLE)); - } - - // let B = this.Sn.CalcSection("B"); - const rB: Result = this.Sn.CalcSection("B"); - if (!rB.ok) { - return rB; - } - const B = rB.vCalc; - - const rDB: Result = this.Sn.CalcSection("dB"); - if (!rDB.ok) { - return rDB; - } - - // L'initialisation à partir de rX a été faite lors de l'appel à CalcFn - // let Der = (this.Sn.CalcSection("dB") * S - 3 * B * B); - // tslint:disable-next-line:variable-name - const Der = (rDB.vCalc * S - 3 * B * B); - const v = Math.pow(this.Sn.prms.Q.v, 2) / ParamsSection.G * Der / Math.pow(S, 4); - return new Result(v); - // } - - // return Infinity; - } -} - -/** - * Calcul de la hauteur normale - */ -// tslint:disable-next-line:max-classes-per-file class-name -export class cHautNormale extends acNewton { - /** - * Section sur laquuelle porte le calcul - */ - // tslint:disable-next-line:variable-name - private Sn: acSection; - - /** - * Débit connu - */ - private Q: number; - - /** - * Coefficient de Strickler - */ - // tslint:disable-next-line:variable-name - private Ks: number; - - /** - * Pente du fond - */ - // tslint:disable-next-line:variable-name - private If: number; - - /** - * Constructeur de la classe - * @param oSn Section sur laquelle on fait le calcul - */ - // tslint:disable-next-line:variable-name - constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { - super(Sn.prms, maxIter, dbg); - this.Sn = Sn; - this.Q = Sn.prms.Q.v; - this.Ks = Sn.prms.Ks.v; - this.If = Sn.prms.If.v; - } - - /** - * Calcul de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcFn(rX: number): Result { - // Calcul de la fonction - // tslint:disable-next-line:max-line-length - // return (this.Q - this.Ks * Math.pow(this.Sn.CalcSection("R", rX), 2 / 3) * this.Sn.CalcSection("S", rX) * Math.sqrt(this.If)); - const rR: Result = this.Sn.CalcSection("R", rX); - if (!rR.ok) { - return rR; - } - - const rS: Result = this.Sn.CalcSection("S", rX); - if (!rS.ok) { - return rS; - } - - const v = (this.Q - this.Ks * Math.pow(rR.vCalc, 2 / 3) * rS.vCalc * Math.sqrt(this.If)); - return new Result(v); - } - - /** - * Calcul analytique de la dérivée de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcDer(rX: number): Result { - const rDR: Result = this.Sn.CalcSection("dR"); - if (!rDR.ok) { - return rDR; - } - - const rR: Result = this.Sn.CalcSection("R"); - if (!rR.ok) { - return rR; - } - - const rS: Result = this.Sn.CalcSection("S"); - if (!rS.ok) { - return rS; - } - - // L'initialisation a été faite lors de l'appel à CalcFn - - // let Der = 2 / 3 * this.Sn.CalcSection("dR") * Math.pow(this.Sn.CalcSection("R"), -1 / 3) - // * this.Sn.CalcSection("S"); - // tslint:disable-next-line:variable-name - let Der = 2 / 3 * rDR.vCalc * Math.pow(rR.vCalc, -1 / 3) * rS.vCalc; - - const rR2: Result = this.Sn.CalcSection("R"); - if (!rR2.ok) { - return rR2; - } - - const rB: Result = this.Sn.CalcSection("B"); - if (!rB.ok) { - return rB; - } - - // Der = Der + Math.pow(this.Sn.CalcSection("R"), 2 / 3) * this.Sn.CalcSection("B"); - Der = Der + Math.pow(rR2.vCalc, 2 / 3) * rB.vCalc; - - Der = Der * -this.Ks * Math.sqrt(this.If); - return new Result(Der); - } -} - -/** - * Calcul de la hauteur correspondante (charge égale) - */ -// tslint:disable-next-line:max-classes-per-file class-name -export class cHautCorrespondante extends acNewton { - /** - * Tirant d'eau connu - */ - private Y: number; - - /** - * 1/S^2 associé au tirant d'eau connu - */ - private _rS2: Result; - - /** - * Section contenant les données de la section avec la hauteur à calculer - */ - // tslint:disable-next-line:variable-name - private Sn: acSection; - - /** - * Constante de gravité - */ - private rQ2G: number; - - /** - * Constructeur de la classe - * @param oSn Section sur laquelle on fait le calcul - */ - // tslint:disable-next-line:variable-name - constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { - super(Sn.prms, maxIter, dbg); - this.Y = Sn.prms.Y.v; - // this.rS2 = Math.pow(Sn.CalcSection("S"), -2); - this.Sn = Sn; - // tslint:disable-next-line:no-unused-expression - this.rS2; // pour initialiser la valeur @WTF (utilise le getter) - this.rQ2G = Math.pow(Sn.prms.Q.v, 2) / (2 * ParamsSection.G); - } - - private get rS2(): Result { - if (this._rS2 === undefined) { - const rS = this.Sn.CalcSection("S"); - if (rS.ok) { - const v = Math.pow(rS.vCalc, -2); - this._rS2 = new Result(v); - } else { - this._rS2 = rS; - } - } - return this._rS2; - } - - /** - * Calcul de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcFn(rX: number): Result { - if (!this.rS2.ok) { - return this.rS2; - } - - const rS: Result = this.Sn.CalcSection("S", rX); - if (!rS.ok) { - return rS; - } - - // Calcul de la fonction - // return this.Y - rX + (this.rS2 - Math.pow(this.Sn.CalcSection("S", rX), -2)) * this.rQ2G; - const v = this.Y - rX + (this.rS2.vCalc - Math.pow(rS.vCalc, -2)) * this.rQ2G; - return new Result(v); - } - - /** - * Calcul analytique de la dérivée de la fonction dont on protected function cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcDer(rX: number): Result { - // let S = this.Sn.CalcSection("S"); - const rS: Result = this.Sn.CalcSection("S"); - if (!rS.ok) { - return rS; - } - const S = rS.vCalc; - - // L'initialisation a été faite lors de l'appel à CalcFn - // if (S !== 0) - if (S === 0) { - return new Result(new Message(MessageCode.ERROR_SECTION_SURFACE_NULLE)); - } - - const rB: Result = this.Sn.CalcSection("B"); - if (!rB.ok) { - return rB; - } - - // return -1 + 2 * this.rQ2G * this.Sn.CalcSection("B") / Math.pow(S, 3); - const v = -1 + 2 * this.rQ2G * rB.vCalc / Math.pow(S, 3); - return new Result(v); - - // return Infinity; - } -} - -/** - * Calcul de la hauteur conjuguée (Impulsion égale) - */ -// tslint:disable-next-line:max-classes-per-file class-name -export class cHautConjuguee extends acNewton { - /** Section contenant les données de la section avec la hauteur à calculer */ - // tslint:disable-next-line:variable-name - private Sn: acSection; - - /** Carré du débit */ - private rQ2: number; - - /** Surface hydraulique associée au tirant d'eau connu */ - private rS: Result; - - /** SYg associée au tirant d'eau connu */ - private rSYg: Result; - - /** - * Constructeur de la classe - * @param oSn Section sur laquelle on fait le calcul - */ - constructor(oSn: acSection, maxIter: number, dbg: boolean = false) { - super(oSn.prms, maxIter, dbg); - this.rQ2 = Math.pow(oSn.prms.Q.v, 2); - this.Sn = oSn; - this.rS = oSn.CalcSection("S"); - this.rSYg = oSn.CalcSection("SYg"); - } - - /** - * Calcul de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcFn(rX: number) { - if (!this.rS.ok) { - return this.rS; - } - - if (!this.rSYg.ok) { - return this.rSYg; - } - - const rS2: Result = this.Sn.CalcSection("S", rX); - if (!rS2.ok) { - return rS2; - } - - // Réinitialisation des paramètres hydrauliques de this.Sn avec l'appel this.Sn.CalcSection("S',rX) - // if (this.rS > 0 && this.Sn.CalcSection("S", rX) > 0) { - if (this.rS.vCalc > 0 && rS2.vCalc > 0) { - // let Fn = this.rQ2 * (1 / this.rS - 1 / this.Sn.CalcSection("S")); - const rS3: Result = this.Sn.CalcSection("S"); - if (!rS3.ok) { - return rS3; - } - - // tslint:disable-next-line:variable-name - const Fn = this.rQ2 * (1 / this.rS.vCalc - 1 / rS3.vCalc); - - const rSYg = this.Sn.CalcSection("SYg"); - if (!rSYg.ok) { - return rSYg; - } - - // return Fn + ParamsSection.G * (this.rSYg - this.Sn.CalcSection("SYg")); - const v = Fn + ParamsSection.G * (this.rSYg.vCalc - rSYg.vCalc); - return new Result(v); - } - - return new Result(new Message(MessageCode.ERROR_SECTION_PERIMETRE_NUL)); - // return -Infinity; - } - - /** - * Calcul analytique de la dérivée de la fonction dont on cherche le zéro - * @param rX Variable dont dépend la fonction - */ - public CalcDer(rX: number): Result { - if (!this.rS.ok) { - return this.rS; - } - - // let S = this.Sn.CalcSection("S"); - const rS2: Result = this.Sn.CalcSection("S"); - if (!rS2.ok) { - return rS2; - } - const S = rS2.vCalc; - - // L'initialisation a été faite lors de l'appel à CalcFn - // if (this.rS > 0 && S > 0) { - if (this.rS.vCalc > 0 && S > 0) { - const rDS: Result = this.Sn.CalcSection("dS"); - if (!rDS.ok) { - return rDS; - } - - // let Der = this.rQ2 * this.Sn.CalcSection("dS") * Math.pow(S, -2); - // tslint:disable-next-line:variable-name - const Der = this.rQ2 * rDS.vCalc * Math.pow(S, -2); - - const rDYG: Result = this.Sn.CalcSection("dSYg", rX); - if (!rDYG.ok) { - return rDYG; - } - - // return Der - ParamsSection.G * this.Sn.CalcSection("dSYg", rX); - const v = Der - ParamsSection.G * rDYG.vCalc; - return new Result(v); - } - - return new Result(new Message(MessageCode.ERROR_SECTION_PERIMETRE_NUL)); - // return -Infinity; - } -} diff --git a/src/section/hauteur_conjuguee.ts b/src/section/hauteur_conjuguee.ts new file mode 100644 index 0000000000000000000000000000000000000000..f190287ccc87e65cef8001fe9449b4826873018a --- /dev/null +++ b/src/section/hauteur_conjuguee.ts @@ -0,0 +1,122 @@ +import { Message, MessageCode } from "../util/message"; +import { Result } from "../util/result"; +import { acNewton } from "./newton"; +import { acSection } from "./section_type"; +import { ParamsSection } from "./section_type_params"; + +/** + * Calcul de la hauteur conjuguée (Impulsion égale) + */ +// tslint:disable-next-line:class-name +export class cHautConjuguee extends acNewton { + /** Section contenant les données de la section avec la hauteur à calculer */ + // tslint:disable-next-line:variable-name + private Sn: acSection; + + /** Carré du débit */ + private rQ2: number; + + /** Surface hydraulique associée au tirant d'eau connu */ + private rS: Result; + + /** SYg associée au tirant d'eau connu */ + private rSYg: Result; + + /** + * Constructeur de la classe + * @param oSn Section sur laquelle on fait le calcul + */ + constructor(oSn: acSection, maxIter: number, dbg: boolean = false) { + super(oSn.prms, maxIter, dbg); + this.rQ2 = Math.pow(oSn.prms.Q.v, 2); + this.Sn = oSn; + this.rS = oSn.CalcSection("S"); + this.rSYg = oSn.CalcSection("SYg"); + } + + /** + * Calcul de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcFn(rX: number) { + if (!this.rS.ok) { + return this.rS; + } + + if (!this.rSYg.ok) { + return this.rSYg; + } + + const rS2: Result = this.Sn.CalcSection("S", rX); + if (!rS2.ok) { + return rS2; + } + + // Réinitialisation des paramètres hydrauliques de this.Sn avec l'appel this.Sn.CalcSection("S',rX) + // if (this.rS > 0 && this.Sn.CalcSection("S", rX) > 0) { + if (this.rS.vCalc > 0 && rS2.vCalc > 0) { + // let Fn = this.rQ2 * (1 / this.rS - 1 / this.Sn.CalcSection("S")); + const rS3: Result = this.Sn.CalcSection("S"); + if (!rS3.ok) { + return rS3; + } + + // tslint:disable-next-line:variable-name + const Fn = this.rQ2 * (1 / this.rS.vCalc - 1 / rS3.vCalc); + + const rSYg = this.Sn.CalcSection("SYg"); + if (!rSYg.ok) { + return rSYg; + } + + // return Fn + ParamsSection.G * (this.rSYg - this.Sn.CalcSection("SYg")); + const v = Fn + ParamsSection.G * (this.rSYg.vCalc - rSYg.vCalc); + return new Result(v); + } + + return new Result(new Message(MessageCode.ERROR_SECTION_PERIMETRE_NUL)); + // return -Infinity; + } + + /** + * Calcul analytique de la dérivée de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcDer(rX: number): Result { + if (!this.rS.ok) { + return this.rS; + } + + // let S = this.Sn.CalcSection("S"); + const rS2: Result = this.Sn.CalcSection("S"); + if (!rS2.ok) { + return rS2; + } + const S = rS2.vCalc; + + // L'initialisation a été faite lors de l'appel à CalcFn + // if (this.rS > 0 && S > 0) { + if (this.rS.vCalc > 0 && S > 0) { + const rDS: Result = this.Sn.CalcSection("dS"); + if (!rDS.ok) { + return rDS; + } + + // let Der = this.rQ2 * this.Sn.CalcSection("dS") * Math.pow(S, -2); + // tslint:disable-next-line:variable-name + const Der = this.rQ2 * rDS.vCalc * Math.pow(S, -2); + + const rDYG: Result = this.Sn.CalcSection("dSYg", rX); + if (!rDYG.ok) { + return rDYG; + } + + // return Der - ParamsSection.G * this.Sn.CalcSection("dSYg", rX); + const v = Der - ParamsSection.G * rDYG.vCalc; + return new Result(v); + } + + return new Result(new Message(MessageCode.ERROR_SECTION_PERIMETRE_NUL)); + // return -Infinity; + } +} diff --git a/src/section/hauteur_correspondante.ts b/src/section/hauteur_correspondante.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec57a8645e29624d839153655a88bd8bdc5e343e --- /dev/null +++ b/src/section/hauteur_correspondante.ts @@ -0,0 +1,110 @@ +import { Message, MessageCode } from "../util/message"; +import { Result } from "../util/result"; +import { acNewton } from "./newton"; +import { acSection } from "./section_type"; +import { ParamsSection } from "./section_type_params"; + +/** + * Calcul de la hauteur correspondante (charge égale) + */ +// tslint:disable-next-line:class-name +export class cHautCorrespondante extends acNewton { + /** + * Tirant d'eau connu + */ + private Y: number; + + /** + * 1/S^2 associé au tirant d'eau connu + */ + private _rS2: Result; + + /** + * Section contenant les données de la section avec la hauteur à calculer + */ + // tslint:disable-next-line:variable-name + private Sn: acSection; + + /** + * Constante de gravité + */ + private rQ2G: number; + + /** + * Constructeur de la classe + * @param oSn Section sur laquelle on fait le calcul + */ + // tslint:disable-next-line:variable-name + constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { + super(Sn.prms, maxIter, dbg); + this.Y = Sn.prms.Y.v; + // this.rS2 = Math.pow(Sn.CalcSection("S"), -2); + this.Sn = Sn; + // tslint:disable-next-line:no-unused-expression + this.rS2; // pour initialiser la valeur @WTF (utilise le getter) + this.rQ2G = Math.pow(Sn.prms.Q.v, 2) / (2 * ParamsSection.G); + } + + private get rS2(): Result { + if (this._rS2 === undefined) { + const rS = this.Sn.CalcSection("S"); + if (rS.ok) { + const v = Math.pow(rS.vCalc, -2); + this._rS2 = new Result(v); + } else { + this._rS2 = rS; + } + } + return this._rS2; + } + + /** + * Calcul de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcFn(rX: number): Result { + if (!this.rS2.ok) { + return this.rS2; + } + + const rS: Result = this.Sn.CalcSection("S", rX); + if (!rS.ok) { + return rS; + } + + // Calcul de la fonction + // return this.Y - rX + (this.rS2 - Math.pow(this.Sn.CalcSection("S", rX), -2)) * this.rQ2G; + const v = this.Y - rX + (this.rS2.vCalc - Math.pow(rS.vCalc, -2)) * this.rQ2G; + return new Result(v); + } + + /** + * Calcul analytique de la dérivée de la fonction dont on protected function cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcDer(rX: number): Result { + // let S = this.Sn.CalcSection("S"); + const rS: Result = this.Sn.CalcSection("S"); + if (!rS.ok) { + return rS; + } + const S = rS.vCalc; + + // L'initialisation a été faite lors de l'appel à CalcFn + // if (S !== 0) + if (S === 0) { + return new Result(new Message(MessageCode.ERROR_SECTION_SURFACE_NULLE)); + } + + const rB: Result = this.Sn.CalcSection("B"); + if (!rB.ok) { + return rB; + } + + // return -1 + 2 * this.rQ2G * this.Sn.CalcSection("B") / Math.pow(S, 3); + const v = -1 + 2 * this.rQ2G * rB.vCalc / Math.pow(S, 3); + return new Result(v); + + // return Infinity; + } +} diff --git a/src/section/hauteur_critique.ts b/src/section/hauteur_critique.ts new file mode 100644 index 0000000000000000000000000000000000000000..e80c99e67b52099e0a9badae77a09d568fb2fbce --- /dev/null +++ b/src/section/hauteur_critique.ts @@ -0,0 +1,100 @@ +import { Message, MessageCode } from "../util/message"; +import { Result } from "../util/result"; +import { acNewton } from "./newton"; +import { acSection } from "./section_type"; +import { ParamsSection } from "./section_type_params"; + +/** + * Calcul de la hauteur critique + */ +// tslint:disable-next-line:class-name +export class cHautCritique extends acNewton { + /** + * Section sur laquuelle porte le calcul + */ + // tslint:disable-next-line:variable-name + private Sn: acSection; + + /** + * Constructeur de la classe + * @param Sn Section sur laquelle on fait le calcul + */ + // tslint:disable-next-line:variable-name + constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { + super(Sn.prms, maxIter, dbg); + this.Sn = Sn.clone(); + } + + /** + * Calcul de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcFn(rX: number): Result { + const rS: Result = this.Sn.CalcSection("S", rX); + if (!rS.ok) { + return rS; + } + + // Calcul de la fonction + // if (this.Sn.CalcSection("S", rX) !== 0) + if (rS.vCalc === 0) { + return new Result(new Message(MessageCode.ERROR_SECTION_SURFACE_NULLE)); + } + + // tslint:disable-next-line:max-line-length + // return (Math.pow(this.Sn.prms.Q.v, 2) * this.Sn.CalcSection("B", rX) / Math.pow(this.Sn.CalcSection("S", rX), 3) / ParamsSection.G - 1); + const rB: Result = this.Sn.CalcSection("B", rX); + if (!rB.ok) { + return rB; + } + + const rS2: Result = this.Sn.CalcSection("S", rX); + if (!rS2.ok) { + return rS2; + } + + const v = (Math.pow(this.Sn.prms.Q.v, 2) * rB.vCalc / Math.pow(rS2.vCalc, 3) / ParamsSection.G - 1); + return new Result(v); + + // return Infinity; + } + + /** + * Calcul analytique de la dérivée de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcDer(rX: number): Result { + // let S = this.Sn.CalcSection("S"); + const rS: Result = this.Sn.CalcSection("S"); + if (!rS.ok) { + return rS; + } + const S = rS.vCalc; + // if (S !== 0) { + if (S === 0) { + return new Result(new Message(MessageCode.ERROR_SECTION_SURFACE_NULLE)); + } + + // let B = this.Sn.CalcSection("B"); + const rB: Result = this.Sn.CalcSection("B"); + if (!rB.ok) { + return rB; + } + const B = rB.vCalc; + + const rDB: Result = this.Sn.CalcSection("dB"); + if (!rDB.ok) { + return rDB; + } + + // L'initialisation à partir de rX a été faite lors de l'appel à CalcFn + // let Der = (this.Sn.CalcSection("dB") * S - 3 * B * B); + // tslint:disable-next-line:variable-name + const Der = (rDB.vCalc * S - 3 * B * B); + const v = Math.pow(this.Sn.prms.Q.v, 2) / ParamsSection.G * Der / Math.pow(S, 4); + return new Result(v); + // } + + // return Infinity; + } +} diff --git a/src/section/hauteur_normale.ts b/src/section/hauteur_normale.ts new file mode 100644 index 0000000000000000000000000000000000000000..de39af7934e69f778aad3d17b5b24170535bbd80 --- /dev/null +++ b/src/section/hauteur_normale.ts @@ -0,0 +1,111 @@ +import { Result } from "../util/result"; +import { acNewton } from "./newton"; +import { acSection } from "./section_type"; + +/** + * Calcul de la hauteur normale + */ +// tslint:disable-next-line:class-name +export class cHautNormale extends acNewton { + /** + * Section sur laquuelle porte le calcul + */ + // tslint:disable-next-line:variable-name + private Sn: acSection; + + /** + * Débit connu + */ + private Q: number; + + /** + * Coefficient de Strickler + */ + // tslint:disable-next-line:variable-name + private Ks: number; + + /** + * Pente du fond + */ + // tslint:disable-next-line:variable-name + private If: number; + + /** + * Constructeur de la classe + * @param oSn Section sur laquelle on fait le calcul + */ + // tslint:disable-next-line:variable-name + constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { + super(Sn.prms, maxIter, dbg); + this.Sn = Sn; + this.Q = Sn.prms.Q.v; + this.Ks = Sn.prms.Ks.v; + this.If = Sn.prms.If.v; + } + + /** + * Calcul de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcFn(rX: number): Result { + // Calcul de la fonction + // tslint:disable-next-line:max-line-length + // return (this.Q - this.Ks * Math.pow(this.Sn.CalcSection("R", rX), 2 / 3) * this.Sn.CalcSection("S", rX) * Math.sqrt(this.If)); + const rR: Result = this.Sn.CalcSection("R", rX); + if (!rR.ok) { + return rR; + } + + const rS: Result = this.Sn.CalcSection("S", rX); + if (!rS.ok) { + return rS; + } + + const v = (this.Q - this.Ks * Math.pow(rR.vCalc, 2 / 3) * rS.vCalc * Math.sqrt(this.If)); + return new Result(v); + } + + /** + * Calcul analytique de la dérivée de la fonction dont on cherche le zéro + * @param rX Variable dont dépend la fonction + */ + public CalcDer(rX: number): Result { + const rDR: Result = this.Sn.CalcSection("dR"); + if (!rDR.ok) { + return rDR; + } + + const rR: Result = this.Sn.CalcSection("R"); + if (!rR.ok) { + return rR; + } + + const rS: Result = this.Sn.CalcSection("S"); + if (!rS.ok) { + return rS; + } + + // L'initialisation a été faite lors de l'appel à CalcFn + + // let Der = 2 / 3 * this.Sn.CalcSection("dR") * Math.pow(this.Sn.CalcSection("R"), -1 / 3) + // * this.Sn.CalcSection("S"); + // tslint:disable-next-line:variable-name + let Der = 2 / 3 * rDR.vCalc * Math.pow(rR.vCalc, -1 / 3) * rS.vCalc; + + const rR2: Result = this.Sn.CalcSection("R"); + if (!rR2.ok) { + return rR2; + } + + const rB: Result = this.Sn.CalcSection("B"); + if (!rB.ok) { + return rB; + } + + // Der = Der + Math.pow(this.Sn.CalcSection("R"), 2 / 3) * this.Sn.CalcSection("B"); + Der = Der + Math.pow(rR2.vCalc, 2 / 3) * rB.vCalc; + + Der = Der * -this.Ks * Math.sqrt(this.If); + return new Result(Der); + } +} diff --git a/src/section/newton.ts b/src/section/newton.ts index bc8c9c9604f4b1d495120a3d784a351e84f06da5..3c83d71a53d0b46b6ae31da638f295af9b97002b 100644 --- a/src/section/newton.ts +++ b/src/section/newton.ts @@ -2,7 +2,7 @@ import { Debug, XOR } from "../base"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { ResultElement } from "../util/resultelement"; -import { ParamsSection } from "./section_type"; +import { ParamsSection } from "./section_type_params"; // tslint:disable-next-line:class-name export abstract class acNewton extends Debug { diff --git a/src/section/section_circulaire.ts b/src/section/section_circulaire.ts index c57ed795b4713e777d80841943971e8f54c40268..7f45613deccb7a18dedccf4679970e2fadcf2876 100644 --- a/src/section/section_circulaire.ts +++ b/src/section/section_circulaire.ts @@ -1,35 +1,14 @@ import { ComputeNodeType } from "../compute-node"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; +import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; -import { acSection, ParamsSection } from "./section_type"; - -export class ParamsSectionCirc extends ParamsSection { - private _D: ParamDefinition; // Diamètre du cercle - - constructor(rD: number, rY: number, rKs: number, rQ: number, rIf: number, rYB: number) { - // set LargeurBerge to default value so that it is not undefined when changing section type - super(rY, 2.5, rKs, rQ, rIf, rYB); - this._D = new ParamDefinition(this, "D", ParamDomainValue.POS, "m", rD, ParamFamily.DIAMETERS); - this.addParamDefinition(this._D); - // hide params - this.LargeurBerge.visible = false; - this.LargeurBerge.undefineFamily(); // or else something might get linked to it although it is undefined - } - - /** - * Diamètre du cercle - */ - get D(): ParamDefinition { - return this._D; - } -} +import { ParamsSectionCirc } from "./section_circulaire_params"; +import { acSection } from "./section_type"; /** * Calculs de la section circulaire */ -// tslint:disable-next-line:max-classes-per-file class-name +// tslint:disable-next-line:class-name export class cSnCirc extends acSection { get prms(): ParamsSectionCirc { diff --git a/src/section/section_circulaire_params.ts b/src/section/section_circulaire_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..db10136fa089308cbc1b0aa171a1e96c865aadd7 --- /dev/null +++ b/src/section/section_circulaire_params.ts @@ -0,0 +1,24 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsSection } from "./section_type_params"; + +export class ParamsSectionCirc extends ParamsSection { + private _D: ParamDefinition; // Diamètre du cercle + + constructor(rD: number, rY: number, rKs: number, rQ: number, rIf: number, rYB: number) { + // set LargeurBerge to default value so that it is not undefined when changing section type + super(rY, 2.5, rKs, rQ, rIf, rYB); + this._D = new ParamDefinition(this, "D", ParamDomainValue.POS, "m", rD, ParamFamily.DIAMETERS); + this.addParamDefinition(this._D); + // hide params + this.LargeurBerge.visible = false; + this.LargeurBerge.undefineFamily(); // or else something might get linked to it although it is undefined + } + + /** + * Diamètre du cercle + */ + get D(): ParamDefinition { + return this._D; + } +} diff --git a/src/section/section_parametree.ts b/src/section/section_parametree.ts index 0ef7ed543d53e85e2a757f37eb79e0350190a767..8efce98a69753bc30e1f8cc6427e234f5c968523 100644 --- a/src/section/section_parametree.ts +++ b/src/section/section_parametree.ts @@ -1,18 +1,14 @@ import { CalculatorType } from "../compute-node"; import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; import { ParamDomain, ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; import { Result } from "../util/result"; import { SectionNub } from "./section_nub"; +import { SectionParams } from "./section_parametree_params"; import { acSection } from "./section_type"; -// dummy ParamsEquation for code consistency -export class SectionParams extends ParamsEquation {} - /** * Nub sur les sections paramétrées */ -// tslint:disable-next-line:max-classes-per-file export class SectionParametree extends SectionNub { constructor(s: acSection, dbg: boolean = false) { diff --git a/src/section/section_parametree_params.ts b/src/section/section_parametree_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..357ec95a88af15a1b819a0ef7ea712b7bac2285d --- /dev/null +++ b/src/section/section_parametree_params.ts @@ -0,0 +1,4 @@ +import { ParamsEquation } from "../param/params-equation"; + +// dummy ParamsEquation for code consistency +export class SectionParams extends ParamsEquation {} diff --git a/src/section/section_puissance.ts b/src/section/section_puissance.ts index 5364686a51d198055031300e84b39b7c5bd8bbcc..0056153afc0cc6718edfb058697843c5f54661d6 100644 --- a/src/section/section_puissance.ts +++ b/src/section/section_puissance.ts @@ -1,38 +1,13 @@ import { ComputeNodeType } from "../compute-node"; -import { ParamCalculability, ParamDefinition } from "../param/param-definition"; -import { ParamDomain, ParamDomainValue } from "../param/param-domain"; +import { ParamCalculability } from "../param/param-definition"; import { Result } from "../util/result"; -import { acSection, ParamsSection } from "./section_type"; - -/** - * Paramètres de la section parabolique ou "puissance" - */ -export class ParamsSectionPuiss extends ParamsSection { - private _k: ParamDefinition; // Coefficient de forme compris entre 0 et 1 - - constructor(rk: number, rY: number, rLargeurBerge: number, rKs: number, rQ: number, - rIf: number, rYB: number) { - - super(rY, rLargeurBerge, rKs, rQ, rIf, rYB); - this._k = new ParamDefinition( - this, "k", new ParamDomain(ParamDomainValue.INTERVAL, 0, 1), undefined, rk - ); - - this.addParamDefinition(this._k); - } - - /** - * Coefficient de forme compris entre 0 et 1 - */ - get k(): ParamDefinition { - return this._k; - } -} +import { ParamsSectionPuiss } from "./section_puissance_params"; +import { acSection } from "./section_type"; /** * Calculs de la section parabolique ou "puissance" */ -// tslint:disable-next-line:max-classes-per-file class-name +// tslint:disable-next-line:class-name export class cSnPuiss extends acSection { protected nbDessinPoints = 50; diff --git a/src/section/section_puissance_params.ts b/src/section/section_puissance_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d5b16d75e4e99a1d47dfbec4aec8f2a9085c0ac --- /dev/null +++ b/src/section/section_puissance_params.ts @@ -0,0 +1,28 @@ +import { ParamDefinition } from "../param/param-definition"; +import { ParamDomain, ParamDomainValue } from "../param/param-domain"; +import { ParamsSection } from "./section_type_params"; + +/** + * Paramètres de la section parabolique ou "puissance" + */ +export class ParamsSectionPuiss extends ParamsSection { + private _k: ParamDefinition; // Coefficient de forme compris entre 0 et 1 + + constructor(rk: number, rY: number, rLargeurBerge: number, rKs: number, rQ: number, + rIf: number, rYB: number) { + + super(rY, rLargeurBerge, rKs, rQ, rIf, rYB); + this._k = new ParamDefinition( + this, "k", new ParamDomain(ParamDomainValue.INTERVAL, 0, 1), undefined, rk + ); + + this.addParamDefinition(this._k); + } + + /** + * Coefficient de forme compris entre 0 et 1 + */ + get k(): ParamDefinition { + return this._k; + } +} diff --git a/src/section/section_rectang.ts b/src/section/section_rectang.ts index 4e2d178ed49c02e4a6ab6d6aaf00564b8ddcb63c..b02b1046308aeb2aa6c8d2179e38f2edb5659e4b 100644 --- a/src/section/section_rectang.ts +++ b/src/section/section_rectang.ts @@ -1,20 +1,12 @@ import { ComputeNodeType } from "../compute-node"; import { Result } from "../util/result"; -import { acSection, ParamsSection } from "./section_type"; - -export class ParamsSectionRectang extends ParamsSection { - constructor(rY: number, rLargeurFond: number, rKs: number, rQ: number, rIf: number, rYB: number) { - - super(rY, - rLargeurFond, // LargeurBerge=LargeurFond - rKs, rQ, rIf, rYB); - } -} +import { ParamsSectionRectang } from "./section_rectang_params"; +import { acSection } from "./section_type"; /** * Calculs de la section rectangulaire */ -// tslint:disable-next-line:max-classes-per-file class-name +// tslint:disable-next-line:class-name export class cSnRectang extends acSection { constructor(prms: ParamsSectionRectang, dbg: boolean = false) { super(prms, dbg); diff --git a/src/section/section_rectang_params.ts b/src/section/section_rectang_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0f57b69e101d4b539b5c01d93ce933d4a598c4e --- /dev/null +++ b/src/section/section_rectang_params.ts @@ -0,0 +1,10 @@ +import { ParamsSection } from "./section_type_params"; + +export class ParamsSectionRectang extends ParamsSection { + constructor(rY: number, rLargeurFond: number, rKs: number, rQ: number, rIf: number, rYB: number) { + + super(rY, + rLargeurFond, // LargeurBerge=LargeurFond + rKs, rQ, rIf, rYB); + } +} diff --git a/src/section/section_trapez.ts b/src/section/section_trapez.ts index 730f6315e529c3203c016ebdca2605979fe98f77..a77801f2a1742921e6f5289630e5a300de3cf482 100644 --- a/src/section/section_trapez.ts +++ b/src/section/section_trapez.ts @@ -1,48 +1,13 @@ import { ComputeNodeType } from "../compute-node"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; +import { ParamCalculability } from "../param/param-definition"; import { Result } from "../util/result"; -import { acSection, ParamsSection } from "./section_type"; - -export class ParamsSectionTrapez extends ParamsSection { - private _LargeurFond: ParamDefinition; // Largeur au fond - private _Fruit: ParamDefinition; // Fruit des berges - - constructor(rLargeurFond: number, rFruit: number, rY: number, rKs: number, - rQ: number, rIf: number, rYB: number) { - - // set LargeurBerge to default value so that it is not undefined when changing section type - super(rY, 2.5, rKs, rQ, rIf, rYB); - this._LargeurFond = new ParamDefinition(this, "LargeurFond", ParamDomainValue.POS_NULL, - "m", rLargeurFond, ParamFamily.WIDTHS); - this._Fruit = new ParamDefinition(this, "Fruit", ParamDomainValue.POS_NULL, "m/m", rFruit); - - this.addParamDefinition(this._LargeurFond); - this.addParamDefinition(this._Fruit); - // hide params - this.LargeurBerge.visible = false; - this.LargeurBerge.undefineFamily(); // or else something might get linked to it although it is undefined - } - - /** - * Largeur au fond - */ - get LargeurFond(): ParamDefinition { - return this._LargeurFond; - } - - /** - * Fruit des berges - */ - get Fruit(): ParamDefinition { - return this._Fruit; - } -} +import { ParamsSectionTrapez } from "./section_trapez_params"; +import { acSection } from "./section_type"; /** * Calculs de la section trapézoïdale */ -// tslint:disable-next-line:max-classes-per-file class-name +// tslint:disable-next-line:class-name export class cSnTrapez extends acSection { get prms(): ParamsSectionTrapez { diff --git a/src/section/section_trapez_params.ts b/src/section/section_trapez_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a4e1219791150b23f8f2829b7cbab5ae8e64d6a --- /dev/null +++ b/src/section/section_trapez_params.ts @@ -0,0 +1,38 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsSection } from "./section_type_params"; + +export class ParamsSectionTrapez extends ParamsSection { + private _LargeurFond: ParamDefinition; // Largeur au fond + private _Fruit: ParamDefinition; // Fruit des berges + + constructor(rLargeurFond: number, rFruit: number, rY: number, rKs: number, + rQ: number, rIf: number, rYB: number) { + + // set LargeurBerge to default value so that it is not undefined when changing section type + super(rY, 2.5, rKs, rQ, rIf, rYB); + this._LargeurFond = new ParamDefinition(this, "LargeurFond", ParamDomainValue.POS_NULL, + "m", rLargeurFond, ParamFamily.WIDTHS); + this._Fruit = new ParamDefinition(this, "Fruit", ParamDomainValue.POS_NULL, "m/m", rFruit); + + this.addParamDefinition(this._LargeurFond); + this.addParamDefinition(this._Fruit); + // hide params + this.LargeurBerge.visible = false; + this.LargeurBerge.undefineFamily(); // or else something might get linked to it although it is undefined + } + + /** + * Largeur au fond + */ + get LargeurFond(): ParamDefinition { + return this._LargeurFond; + } + + /** + * Fruit des berges + */ + get Fruit(): ParamDefinition { + return this._Fruit; + } +} diff --git a/src/section/section_type.ts b/src/section/section_type.ts index 2a1712ec1db7da9c803f0c2303b807aa308ceb55..1b41863bad2a555fbac9083db231d208d66a2425 100644 --- a/src/section/section_type.ts +++ b/src/section/section_type.ts @@ -1,111 +1,20 @@ import { CalculatorType, ComputeNodeType } from "../compute-node"; import { Nub } from "../nub"; -import { ParamCalculability, ParamDefinition, ParamFamily } from "../param/param-definition"; -import { ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; +import { ParamCalculability, ParamDefinition } from "../param/param-definition"; import { Props } from "../props"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; -import { cHautConjuguee, cHautCorrespondante, cHautCritique, cHautNormale } from "./hauteur"; - -// tslint:disable-next-line:max-classes-per-file -export abstract class ParamsSection extends ParamsEquation { - - public static readonly G: number = 9.81; /// Constante de gravité - - private _Ks: ParamDefinition; // Strickler - private _Q: ParamDefinition; // Débit - private _If: ParamDefinition; // Pente du fond - private _YB: ParamDefinition; // Hauteur de berge - private _iPrec: number; // Précision en nombre de décimales - private _Y: ParamDefinition; // Tirant d'eau - private _LargeurBerge: ParamDefinition; // largeur au débordement - - constructor(rY: number, - rLargeurBerge: number, - rKs: number, - rQ: number, - rIf: number, - rYB: number - ) { - super(); - this._Ks = new ParamDefinition(this, "Ks", ParamDomainValue.POS, "m1/3s-1", rKs); - this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS_NULL, "m³/s", rQ, ParamFamily.FLOWS); - this._If = new ParamDefinition(this, "If", ParamDomainValue.ANY, "m/m", rIf, ParamFamily.SLOPES); - this._YB = new ParamDefinition(this, "YB", ParamDomainValue.POS, "m", rYB, ParamFamily.HEIGHTS); - this._Y = new ParamDefinition(this, "Y", ParamDomainValue.POS_NULL, "m", rY, ParamFamily.HEIGHTS); - this._LargeurBerge = new ParamDefinition( - this, "LargeurBerge", ParamDomainValue.POS_NULL, "m", rLargeurBerge, ParamFamily.WIDTHS); - - this._iPrec = Math.round(-Math.log(this.Pr.v) / Math.log(10)); - - this.addParamDefinition(this._Ks); - this.addParamDefinition(this._Q); - this.addParamDefinition(this._If); - this.addParamDefinition(this._YB); - this.addParamDefinition(this._Y); - this.addParamDefinition(this._LargeurBerge); - - if (rY === undefined) { // avoid undefined on Swap() - this._Y.v = 1E6; - } - } - - /** - * Strickler - */ - get Ks(): ParamDefinition { - return this._Ks; - } - - /** - * Débit - */ - get Q(): ParamDefinition { - return this._Q; - } - - /** - * Pente du fond - */ - get If(): ParamDefinition { - return this._If; - } - - /** - * Précision en nombre de décimales - */ - get iPrec(): number { - return this._iPrec; - } - - /** - * Hauteur de berge - */ - get YB(): ParamDefinition { - return this._YB; - } - - /** - * Tirant d'eau - */ - get Y(): ParamDefinition { - return this._Y; - } - - /** - * Largeur au débordement - */ - get LargeurBerge(): ParamDefinition { - return this._LargeurBerge; - } -} +import { cHautConjuguee } from "./hauteur_conjuguee"; +import { cHautCorrespondante } from "./hauteur_correspondante"; +import { cHautCritique } from "./hauteur_critique"; +import { cHautNormale } from "./hauteur_normale"; +import { ParamsSection } from "./section_type_params"; /** * Gestion commune pour les différents types de section. * Comprend les formules pour la section rectangulaire pour gérer les débordements */ -// tslint:disable-next-line:max-classes-per-file class-name +// tslint:disable-next-line:class-name export abstract class acSection extends Nub { [key: string]: any; // pour pouvoir faire this['methode](); diff --git a/src/section/section_type_params.ts b/src/section/section_type_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e0eb1ec722275b5d5b517b599765c6ba54c935e --- /dev/null +++ b/src/section/section_type_params.ts @@ -0,0 +1,95 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamsEquation } from "../param/params-equation"; + +export abstract class ParamsSection extends ParamsEquation { + + public static readonly G: number = 9.81; /// Constante de gravité + + private _Ks: ParamDefinition; // Strickler + private _Q: ParamDefinition; // Débit + private _If: ParamDefinition; // Pente du fond + private _YB: ParamDefinition; // Hauteur de berge + private _iPrec: number; // Précision en nombre de décimales + private _Y: ParamDefinition; // Tirant d'eau + private _LargeurBerge: ParamDefinition; // largeur au débordement + + constructor(rY: number, + rLargeurBerge: number, + rKs: number, + rQ: number, + rIf: number, + rYB: number + ) { + super(); + this._Ks = new ParamDefinition(this, "Ks", ParamDomainValue.POS, "m1/3s-1", rKs); + this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS_NULL, "m³/s", rQ, ParamFamily.FLOWS); + this._If = new ParamDefinition(this, "If", ParamDomainValue.ANY, "m/m", rIf, ParamFamily.SLOPES); + this._YB = new ParamDefinition(this, "YB", ParamDomainValue.POS, "m", rYB, ParamFamily.HEIGHTS); + this._Y = new ParamDefinition(this, "Y", ParamDomainValue.POS_NULL, "m", rY, ParamFamily.HEIGHTS); + this._LargeurBerge = new ParamDefinition( + this, "LargeurBerge", ParamDomainValue.POS_NULL, "m", rLargeurBerge, ParamFamily.WIDTHS); + + this._iPrec = Math.round(-Math.log(this.Pr.v) / Math.log(10)); + + this.addParamDefinition(this._Ks); + this.addParamDefinition(this._Q); + this.addParamDefinition(this._If); + this.addParamDefinition(this._YB); + this.addParamDefinition(this._Y); + this.addParamDefinition(this._LargeurBerge); + + if (rY === undefined) { // avoid undefined on Swap() + this._Y.v = 1E6; + } + } + + /** + * Strickler + */ + get Ks(): ParamDefinition { + return this._Ks; + } + + /** + * Débit + */ + get Q(): ParamDefinition { + return this._Q; + } + + /** + * Pente du fond + */ + get If(): ParamDefinition { + return this._If; + } + + /** + * Précision en nombre de décimales + */ + get iPrec(): number { + return this._iPrec; + } + + /** + * Hauteur de berge + */ + get YB(): ParamDefinition { + return this._YB; + } + + /** + * Tirant d'eau + */ + get Y(): ParamDefinition { + return this._Y; + } + + /** + * Largeur au débordement + */ + get LargeurBerge(): ParamDefinition { + return this._LargeurBerge; + } +} diff --git a/src/session.ts b/src/session.ts index e9c64acdc7192d6a0a3ea73101ab9d4d98126de9..9e34bcb83aba46ef5d468524d2bd1d452c98aef2 100644 --- a/src/session.ts +++ b/src/session.ts @@ -7,38 +7,53 @@ import { Props } from "./props"; import { config } from "./config"; // Calculettes -import { ConduiteDistrib, ConduiteDistribParams } from "./cond_distri"; -import { LechaptCalmon, LechaptCalmonParams } from "./lechaptcalmon"; -import { MacroRugo, MacrorugoParams } from "./macrorugo/macrorugo"; +import { ConduiteDistrib } from "./cond_distri"; +import { LechaptCalmon } from "./lechaptcalmon"; +import { MacroRugo } from "./macrorugo/macrorugo"; import { MacrorugoCompound } from "./macrorugo/macrorugo_compound"; import { MacrorugoCompoundParams } from "./macrorugo/macrorugo_compound_params"; -import { PabChute, PabChuteParams } from "./pab/pab_chute"; -import { PabDimension, PabDimensionParams } from "./pab/pab_dimension"; -import { PabNombre, PabNombreParams } from "./pab/pab_nombre"; -import { PabPuissance, PabPuissanceParams } from "./pab/pab_puissance"; +import { PabChute } from "./pab/pab_chute"; +import { PabDimension } from "./pab/pab_dimension"; +import { PabNombre } from "./pab/pab_nombre"; +import { PabPuissance } from "./pab/pab_puissance"; import { RegimeUniforme } from "./regime_uniforme"; -import { CourbeRemous, CourbeRemousParams } from "./remous/remous"; +import { CourbeRemous } from "./remous/remous"; import { SectionParametree } from "./section/section_parametree"; // Classes relatives aux sections -import { cSnCirc, ParamsSectionCirc } from "./section/section_circulaire"; -import { cSnPuiss, ParamsSectionPuiss } from "./section/section_puissance"; -import { cSnRectang, ParamsSectionRectang } from "./section/section_rectang"; -import { cSnTrapez, ParamsSectionTrapez } from "./section/section_trapez"; +import { cSnCirc } from "./section/section_circulaire"; +import { cSnPuiss } from "./section/section_puissance"; +import { cSnRectang } from "./section/section_rectang"; +import { cSnTrapez } from "./section/section_trapez"; import { acSection } from "./section/section_type"; // Classes relatives aux structures import { isNumeric } from "./base"; +import { ConduiteDistribParams } from "./cond_distri_params"; +import { LechaptCalmonParams } from "./lechaptcalmon_params"; +import { MacrorugoParams } from "./macrorugo/macrorugo_params"; import { CloisonAval } from "./pab/cloison_aval"; import { CloisonsAvalParams } from "./pab/cloison_aval_params"; import { Cloisons } from "./pab/cloisons"; import { CloisonsParams } from "./pab/cloisons_params"; -import { Pab, PabParams } from "./pab/pab"; +import { Pab } from "./pab/pab"; +import { PabChuteParams } from "./pab/pab_chute_params"; +import { PabDimensionParams } from "./pab/pab_dimensions_params"; +import { PabNombreParams } from "./pab/pab_nombre_params"; +import { PabParams } from "./pab/pab_params"; +import { PabPuissanceParams } from "./pab/pab_puissance_params"; import { ParamDefinition } from "./param/param-definition"; import { MethodeResolution } from "./remous/methode-resolution"; -import { Dever, DeverParams } from "./structure/dever"; +import { CourbeRemousParams } from "./remous/remous_params"; +import { ParamsSectionCirc } from "./section/section_circulaire_params"; +import { ParamsSectionPuiss } from "./section/section_puissance_params"; +import { ParamsSectionRectang } from "./section/section_rectang_params"; +import { ParamsSectionTrapez } from "./section/section_trapez_params"; +import { Dever } from "./structure/dever"; +import { DeverParams } from "./structure/dever_params"; import { CreateStructure } from "./structure/factory_structure"; -import { ParallelStructure, ParallelStructureParams } from "./structure/parallel_structure"; +import { ParallelStructure } from "./structure/parallel_structure"; +import { ParallelStructureParams } from "./structure/parallel_structure_params"; import { LoiDebit, StructureType } from "./structure/structure_props"; export class Session { diff --git a/src/structure/dever.ts b/src/structure/dever.ts index a1bbd61a496881a094233ad00b23b08e17dd796c..eba12c20104a3094a999b8507bc126aab8697c52 100644 --- a/src/structure/dever.ts +++ b/src/structure/dever.ts @@ -6,8 +6,6 @@ import { DeverParams } from "./dever_params"; import { ParallelStructure } from "./parallel_structure"; import { loiAdmissiblesDever, LoiDebit } from "./structure_props"; -export { DeverParams }; - export class Dever extends ParallelStructure { constructor(prms: DeverParams, dbg: boolean = false) { super(prms, dbg); diff --git a/src/structure/factory_structure.ts b/src/structure/factory_structure.ts index ee892ff0595d7328193a897a5e4ef636b4e3d6c5..1838ff3f115005557ae000894c07198377a66575 100755 --- a/src/structure/factory_structure.ts +++ b/src/structure/factory_structure.ts @@ -6,17 +6,25 @@ import { Structure } from "./structure"; import { LoiDebit } from "./structure_props"; // Equations de débit -import { StructureGateCem88d, StructureWeirCem88d } from "./structure_cem88d"; -import { StructureGateCem88v, StructureWeirCem88v } from "./structure_cem88v"; -import { StructureGateCunge80, StructureWeirCunge80 } from "./structure_cunge80"; -import { StructureKivi, StructureKiviParams } from "./structure_kivi"; -import { StructureOrificeSubmerged, StructureOrificeSubmergedParams } from "./structure_orifice_submerged"; +import { StructureGateCem88d } from "./structure_gate_cem88d"; +import { StructureGateCem88v } from "./structure_gate_cem88v"; +import { StructureGateCunge80 } from "./structure_gate_cunge80"; +import { StructureKivi } from "./structure_kivi"; +import { StructureKiviParams } from "./structure_kivi_params"; +import { StructureOrificeSubmerged } from "./structure_orifice_submerged"; +import { StructureOrificeSubmergedParams } from "./structure_orifice_submerged_params"; import { StructureRectangularOrificeFree } from "./structure_rectangular_orifice_free"; import { StructureRectangularOrificeSubmerged } from "./structure_rectangular_orifice_submerged"; -// tslint:disable-next-line:max-line-length -import { StructureTriangularTruncWeirFree, TriangularTruncStructureParams } from "./structure_triangular_trunc_weir"; -import { StructureTriangularWeir, TriangularStructureParams } from "./structure_triangular_weir"; -import { StructureVanLevLarinier, StructureVanLevParams, StructureVanLevVillemonte } from "./structure_vanlev"; +import { StructureTriangularTruncWeirFree } from "./structure_triangular_trunc_weir"; +import { TriangularTruncStructureParams } from "./structure_triangular_trunc_weir_params"; +import { StructureTriangularWeir } from "./structure_triangular_weir"; +import { TriangularStructureParams } from "./structure_triangular_weir_params"; +import { StructureVanLevLarinier } from "./structure_vanlev_larinier"; +import { StructureVanLevParams } from "./structure_vanlev_params"; +import { StructureVanLevVillemonte } from "./structure_vanlev_villemonte"; +import { StructureWeirCem88d } from "./structure_weir_cem88d"; +import { StructureWeirCem88v } from "./structure_weir_cem88v"; +import { StructureWeirCunge80 } from "./structure_weir_cunge80"; import { StructureWeirFree } from "./structure_weir_free"; import { StructureWeirSubmergedLarinier } from "./structure_weir_submerged_larinier"; import { StructureWeirVillemonte } from "./structure_weir_villemonte"; diff --git a/src/structure/parallel_structure.ts b/src/structure/parallel_structure.ts index d9c7483e5c436af4b7c82ef0c9cbc708016758d7..bb23f3832858fd266bb3bc409ec2bdce3f58c178 100644 --- a/src/structure/parallel_structure.ts +++ b/src/structure/parallel_structure.ts @@ -1,6 +1,5 @@ import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; -import { Pab } from "../pab/pab"; import { ParamCalculability } from "../param/param-definition"; import { ParamsEquation } from "../param/params-equation"; import { Session } from "../session"; @@ -9,8 +8,6 @@ import { ParallelStructureParams } from "./parallel_structure_params"; import { Structure } from "./structure"; import { loiAdmissiblesOuvrages, LoiDebit } from "./structure_props"; -export { ParallelStructureParams }; - /** * Calcul de une ou plusieurs structures hydrauliques en parallèles * reliées par les cotes amont et aval et dont le débit est égal à la diff --git a/src/structure/rectangular_structure.ts b/src/structure/rectangular_structure.ts index 242a167040e2b85dd83767df3d7fcab671806b14..b5834c3d8f66c9b286e3772a3e5c625a140cbad7 100644 --- a/src/structure/rectangular_structure.ts +++ b/src/structure/rectangular_structure.ts @@ -2,8 +2,6 @@ import { ParamCalculability } from "../param/param-definition"; import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure } from "./structure"; -export { RectangularStructureParams }; - /** * Classe mère pour toutes les structures ayant une base rectangulaire (vannes, seuils) */ diff --git a/src/structure/structure.ts b/src/structure/structure.ts index 75285fdc5c0d19e9c5ae176dc28afb9d70496b33..ef4d58d4af8ffb00b9a5b01cae0d01a02cc5f831 100644 --- a/src/structure/structure.ts +++ b/src/structure/structure.ts @@ -1,15 +1,12 @@ import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; import { ParamCalculability, ParamDefinition } from "../param/param-definition"; -import { ParamValueMode } from "../param/param-value-mode"; import { Props } from "../props"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { StructureParams } from "./structure_params"; import { LoiDebit } from "./structure_props"; -export { StructureParams }; - /** * Flow mode: weir or orifice flow */ diff --git a/src/structure/structure_cem88d.ts b/src/structure/structure_gate_cem88d.ts similarity index 85% rename from src/structure/structure_cem88d.ts rename to src/structure/structure_gate_cem88d.ts index 51d820c5f311d05969f50d2d9e69be4983040851..0cbd201999a83588b9b5a2bf80da6a53a9593dca 100644 --- a/src/structure/structure_cem88d.ts +++ b/src/structure/structure_gate_cem88d.ts @@ -5,8 +5,6 @@ import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -export { RectangularStructureParams }; - /** * Equation CEM88D : déversoir / orifice (pelle importante) Cemagref 1988 */ @@ -75,20 +73,3 @@ export class StructureGateCem88d extends RectangularStructure { this.prms.W.calculability = ParamCalculability.DICHO; } } - -// tslint:disable-next-line:max-classes-per-file -export class StructureWeirCem88d extends StructureGateCem88d { - - constructor(prms: RectangularStructureParams, dbg: boolean = false) { - super(prms, dbg); - this._loiDebit = LoiDebit.WeirCem88d; - this._isZDVcalculable = true; - // Gestion de l'affichage l'ouverture de vanne - this.prms.W.visible = false; - } - - protected getFlowMode(): StructureFlowMode { - return StructureFlowMode.WEIR; - } - -} diff --git a/src/structure/structure_cem88v.ts b/src/structure/structure_gate_cem88v.ts similarity index 93% rename from src/structure/structure_cem88v.ts rename to src/structure/structure_gate_cem88v.ts index dec63d4005427e6400fb2ffbe4793e3d70d0da34..eea96f17f0aabde2e3618f90131deb17d7f40c17 100644 --- a/src/structure/structure_cem88v.ts +++ b/src/structure/structure_gate_cem88v.ts @@ -5,8 +5,6 @@ import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -export { RectangularStructureParams }; - /** * Equation CEM88V : déversoir / vanne de fond (pelle faible) Cemagref 1988 */ @@ -143,18 +141,3 @@ export class StructureGateCem88v extends RectangularStructure { return KF; } } - -// tslint:disable-next-line:max-classes-per-file -export class StructureWeirCem88v extends StructureGateCem88v { - - constructor(prms: RectangularStructureParams, dbg: boolean = false) { - super(prms, dbg); - this._loiDebit = LoiDebit.WeirCem88v; - this.prms.W.visible = false; - } - - protected getFlowMode(): StructureFlowMode { - return StructureFlowMode.WEIR; - } - -} diff --git a/src/structure/structure_cunge80.ts b/src/structure/structure_gate_cunge80.ts similarity index 88% rename from src/structure/structure_cunge80.ts rename to src/structure/structure_gate_cunge80.ts index a19f4354df4cf259671c08d13d11d653697f8d51..3d87c971244b73b8acdd0f3ecf7cfe9154201ddf 100644 --- a/src/structure/structure_cunge80.ts +++ b/src/structure/structure_gate_cunge80.ts @@ -5,8 +5,6 @@ import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -export { RectangularStructureParams }; - /** * Equation Cunge80 */ @@ -90,18 +88,3 @@ export class StructureGateCunge80 extends RectangularStructure { this.prms.W.calculability = ParamCalculability.DICHO; } } - -// tslint:disable-next-line:max-classes-per-file -export class StructureWeirCunge80 extends StructureGateCunge80 { - - constructor(prms: RectangularStructureParams, dbg: boolean = false) { - super(prms, dbg); - this._loiDebit = LoiDebit.WeirCunge80; - this.prms.W.visible = false; - } - - protected getFlowMode(): StructureFlowMode { - return StructureFlowMode.WEIR; - } - -} diff --git a/src/structure/structure_kivi.ts b/src/structure/structure_kivi.ts index a00937d3c9c6bfa12056be4b133ef803cff04266..bd6ce28c58dafa8c7133420e348f3c6cc43e9cdb 100644 --- a/src/structure/structure_kivi.ts +++ b/src/structure/structure_kivi.ts @@ -6,8 +6,6 @@ import { StructureKiviParams } from "./structure_kivi_params"; import { LoiDebit } from "./structure_props"; import { Villemonte } from "./villemonte"; -export { StructureKiviParams }; - export class StructureKivi extends Structure { constructor(prms: StructureKiviParams, dbg: boolean = false) { diff --git a/src/structure/structure_orifice_submerged.ts b/src/structure/structure_orifice_submerged.ts index d4856b9d8bca596592fff53cc5402278b0af7b97..f1dd43558685a24d05885c17d43d85c41cd8e421 100644 --- a/src/structure/structure_orifice_submerged.ts +++ b/src/structure/structure_orifice_submerged.ts @@ -4,8 +4,6 @@ import { Result } from "../util/result"; import { StructureOrificeSubmergedParams } from "./structure_orifice_submerged_params"; import { LoiDebit } from "./structure_props"; -export { StructureOrificeSubmergedParams }; - /** * Equation classique orifice noyé */ diff --git a/src/structure/structure_params.ts b/src/structure/structure_params.ts index 3ad06cc666cdbec192e16a96b06e2f070c26caf0..3ac17721ad383f19218af4597e9a99949dc3f247 100644 --- a/src/structure/structure_params.ts +++ b/src/structure/structure_params.ts @@ -1,8 +1,6 @@ -import { Nub } from "../nub"; import { ParamDefinition, ParamFamily } from "../param/param-definition"; import { ParamDomainValue } from "../param/param-domain"; import { ParamsEquation } from "../param/params-equation"; -import { SectionNub } from "../section/section_nub"; /** * Common parameters of hydraulic structure equations diff --git a/src/structure/structure_rectangular_orifice_free.ts b/src/structure/structure_rectangular_orifice_free.ts index 18c2cc80128182f82fc4b37c2c37bae8dd383a0f..b34e7d803833b5f2ffe94f7d97e1eaba11bcce64 100644 --- a/src/structure/structure_rectangular_orifice_free.ts +++ b/src/structure/structure_rectangular_orifice_free.ts @@ -5,8 +5,6 @@ import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -export { RectangularStructureParams }; - /** * Equation classique orifice dénoyé ("Vanne dénoyé") */ diff --git a/src/structure/structure_rectangular_orifice_submerged.ts b/src/structure/structure_rectangular_orifice_submerged.ts index 257bbd495b86d677eb85ba04ee657e9fdbaddd96..23f2ca82b6c8cd5256754149cbdc39d39a20c4fd 100644 --- a/src/structure/structure_rectangular_orifice_submerged.ts +++ b/src/structure/structure_rectangular_orifice_submerged.ts @@ -5,8 +5,6 @@ import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -export { RectangularStructureParams }; - /** * Equation classique orifice noyé ("Vanne noyé") */ diff --git a/src/structure/structure_triangular_trunc_weir.ts b/src/structure/structure_triangular_trunc_weir.ts index c24185b3accd1dcc9a45ccfc302561b468c5a8b9..b313099e74aa7ed1284578a4796e91daa5499f44 100644 --- a/src/structure/structure_triangular_trunc_weir.ts +++ b/src/structure/structure_triangular_trunc_weir.ts @@ -5,8 +5,6 @@ import { LoiDebit } from "./structure_props"; import { TriangularTruncStructureParams } from "./structure_triangular_trunc_weir_params"; import { Villemonte } from "./villemonte"; -export { TriangularTruncStructureParams }; - /** * Equation classique seuil triangulaire dénoyé */ diff --git a/src/structure/structure_triangular_weir.ts b/src/structure/structure_triangular_weir.ts index 8132327d698891f15cbb1958254bc1351cef9104..d8b203616fe2bdcc1c460da7f3db75e2e2aed565 100644 --- a/src/structure/structure_triangular_weir.ts +++ b/src/structure/structure_triangular_weir.ts @@ -5,8 +5,6 @@ import { LoiDebit } from "./structure_props"; import { TriangularStructureParams } from "./structure_triangular_weir_params"; import { Villemonte } from "./villemonte"; -export { TriangularStructureParams }; - /** * Equation classique seuil triangulaire + Ennoiement Villemonte */ diff --git a/src/structure/structure_triangular_weir_params.ts b/src/structure/structure_triangular_weir_params.ts index 3dbf138fc68224361ddbb8578a172a8816d9dd08..ccd314039c346bb135b5896a8a997f85fcdc5bd9 100644 --- a/src/structure/structure_triangular_weir_params.ts +++ b/src/structure/structure_triangular_weir_params.ts @@ -1,4 +1,4 @@ -import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamDefinition } from "../param/param-definition"; import { ParamDomain, ParamDomainValue } from "../param/param-domain"; import { StructureParams } from "./structure_params"; diff --git a/src/structure/structure_vanlev_larinier.ts b/src/structure/structure_vanlev_larinier.ts new file mode 100644 index 0000000000000000000000000000000000000000..33342264b54ab73f42d874491f825bdeda8ff3b3 --- /dev/null +++ b/src/structure/structure_vanlev_larinier.ts @@ -0,0 +1,18 @@ +import { LoiDebit } from "./structure_props"; +import { StructureVanLevParams } from "./structure_vanlev_params"; +import { StructureWeirSubmergedLarinier } from "./structure_weir_submerged_larinier"; + +export class StructureVanLevLarinier extends StructureWeirSubmergedLarinier { + + constructor(prms: StructureVanLevParams, dbg: boolean = false) { + super(prms, dbg); + this._loiDebit = LoiDebit.VanLevLarinier; + } + + /** + * paramètres castés au bon type + */ + get prms(): StructureVanLevParams { + return this._prms as StructureVanLevParams; + } +} diff --git a/src/structure/structure_vanlev.ts b/src/structure/structure_vanlev_params.ts similarity index 61% rename from src/structure/structure_vanlev.ts rename to src/structure/structure_vanlev_params.ts index f59896dc5095c7cd99967a5c065d2e7d4a982686..c19e5ae16f114bacf933c7deb327a20eaa1bc0b3 100644 --- a/src/structure/structure_vanlev.ts +++ b/src/structure/structure_vanlev_params.ts @@ -1,20 +1,18 @@ import { ParamDefinition, ParamFamily } from "../param/param-definition"; import { ParamDomainValue } from "../param/param-domain"; -import { Message, MessageCode } from "../util/message"; -import { Result } from "../util/result"; -import { RectangularStructureParams } from "./rectangular_structure"; -import { LoiDebit } from "./structure_props"; -import { StructureWeirSubmergedLarinier } from "./structure_weir_submerged_larinier"; -import { StructureWeirVillemonte } from "./structure_weir_villemonte"; +import { RectangularStructureParams } from "./rectangular_structure_params"; /** * Parameters of an automatic weir with crest elevation regulation */ export class StructureVanLevParams extends RectangularStructureParams { + /** Maximum weir crest elevation (m) */ public minZDV: ParamDefinition; + /** Minimum weir crest elevation (m) */ public maxZDV: ParamDefinition; + /** Imposed fall (m) */ public DH: ParamDefinition; @@ -44,35 +42,3 @@ export class StructureVanLevParams extends RectangularStructureParams { this.ZDV.visible = false; } } - -// tslint:disable-next-line:max-classes-per-file -export class StructureVanLevVillemonte extends StructureWeirVillemonte { - - constructor(prms: StructureVanLevParams, dbg: boolean = false) { - super(prms, dbg); - this._loiDebit = LoiDebit.VanLevVillemonte; - } - - /** - * paramètres castés au bon type - */ - get prms(): StructureVanLevParams { - return this._prms as StructureVanLevParams; - } -} - -// tslint:disable-next-line:max-classes-per-file -export class StructureVanLevLarinier extends StructureWeirSubmergedLarinier { - - constructor(prms: StructureVanLevParams, dbg: boolean = false) { - super(prms, dbg); - this._loiDebit = LoiDebit.VanLevLarinier; - } - - /** - * paramètres castés au bon type - */ - get prms(): StructureVanLevParams { - return this._prms as StructureVanLevParams; - } -} diff --git a/src/structure/structure_vanlev_villemonte.ts b/src/structure/structure_vanlev_villemonte.ts new file mode 100644 index 0000000000000000000000000000000000000000..07e186e7faad776c91f1f361a96bf5eeef8ee0f1 --- /dev/null +++ b/src/structure/structure_vanlev_villemonte.ts @@ -0,0 +1,18 @@ +import { LoiDebit } from "./structure_props"; +import { StructureVanLevParams } from "./structure_vanlev_params"; +import { StructureWeirVillemonte } from "./structure_weir_villemonte"; + +export class StructureVanLevVillemonte extends StructureWeirVillemonte { + + constructor(prms: StructureVanLevParams, dbg: boolean = false) { + super(prms, dbg); + this._loiDebit = LoiDebit.VanLevVillemonte; + } + + /** + * paramètres castés au bon type + */ + get prms(): StructureVanLevParams { + return this._prms as StructureVanLevParams; + } +} diff --git a/src/structure/structure_weir_cem88d.ts b/src/structure/structure_weir_cem88d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ca6ff9889b2798fcad1a850057bb3716f49f4d8 --- /dev/null +++ b/src/structure/structure_weir_cem88d.ts @@ -0,0 +1,20 @@ +import { RectangularStructureParams } from "./rectangular_structure_params"; +import { StructureFlowMode } from "./structure"; +import { StructureGateCem88d } from "./structure_gate_cem88d"; +import { LoiDebit } from "./structure_props"; + +export class StructureWeirCem88d extends StructureGateCem88d { + + constructor(prms: RectangularStructureParams, dbg: boolean = false) { + super(prms, dbg); + this._loiDebit = LoiDebit.WeirCem88d; + this._isZDVcalculable = true; + // Gestion de l'affichage l'ouverture de vanne + this.prms.W.visible = false; + } + + protected getFlowMode(): StructureFlowMode { + return StructureFlowMode.WEIR; + } + +} diff --git a/src/structure/structure_weir_cem88v.ts b/src/structure/structure_weir_cem88v.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4c44d3319cb49ae12ee67f71599e4b6f7985ffa --- /dev/null +++ b/src/structure/structure_weir_cem88v.ts @@ -0,0 +1,18 @@ +import { RectangularStructureParams } from "./rectangular_structure_params"; +import { StructureFlowMode } from "./structure"; +import { StructureGateCem88v } from "./structure_gate_cem88v"; +import { LoiDebit } from "./structure_props"; + +export class StructureWeirCem88v extends StructureGateCem88v { + + constructor(prms: RectangularStructureParams, dbg: boolean = false) { + super(prms, dbg); + this._loiDebit = LoiDebit.WeirCem88v; + this.prms.W.visible = false; + } + + protected getFlowMode(): StructureFlowMode { + return StructureFlowMode.WEIR; + } + +} diff --git a/src/structure/structure_weir_cunge80.ts b/src/structure/structure_weir_cunge80.ts new file mode 100644 index 0000000000000000000000000000000000000000..c46ffb635ccc40c96e2d61c44f21bdbaeff48adf --- /dev/null +++ b/src/structure/structure_weir_cunge80.ts @@ -0,0 +1,18 @@ +import { RectangularStructureParams } from "./rectangular_structure_params"; +import { StructureFlowMode } from "./structure"; +import { StructureGateCunge80 } from "./structure_gate_cunge80"; +import { LoiDebit } from "./structure_props"; + +export class StructureWeirCunge80 extends StructureGateCunge80 { + + constructor(prms: RectangularStructureParams, dbg: boolean = false) { + super(prms, dbg); + this._loiDebit = LoiDebit.WeirCunge80; + this.prms.W.visible = false; + } + + protected getFlowMode(): StructureFlowMode { + return StructureFlowMode.WEIR; + } + +} diff --git a/src/structure/structure_weir_free.ts b/src/structure/structure_weir_free.ts index 2a41c971ab51888a10b847195a32c99398392c0e..e16ded1d20d71c8432552cef1ddb854261bfe8cc 100644 --- a/src/structure/structure_weir_free.ts +++ b/src/structure/structure_weir_free.ts @@ -4,8 +4,6 @@ import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -export { RectangularStructureParams }; - /** * Equation classique seuil dénoyé */ diff --git a/src/structure/structure_weir_submerged_larinier.ts b/src/structure/structure_weir_submerged_larinier.ts index 91742e34099b524e9fa20a8c96f1e942bc1cf533..d8107e58fcdd81dcd750692bd4f0674cb9745daf 100644 --- a/src/structure/structure_weir_submerged_larinier.ts +++ b/src/structure/structure_weir_submerged_larinier.ts @@ -1,6 +1,7 @@ import { ParamCalculability } from "../index"; import { Result } from "../util/result"; -import { RectangularStructure, RectangularStructureParams } from "./rectangular_structure"; +import { RectangularStructure } from "./rectangular_structure"; +import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; diff --git a/src/structure/structure_weir_villemonte.ts b/src/structure/structure_weir_villemonte.ts index a2399dc5032f915de5423f727bdf4770e38eb26d..d8e65458eb583eb070538cce2ccfaf51ec785be2 100644 --- a/src/structure/structure_weir_villemonte.ts +++ b/src/structure/structure_weir_villemonte.ts @@ -1,7 +1,8 @@ import { Result } from "../util/result"; +import { RectangularStructureParams } from "./rectangular_structure_params"; import { StructureFlowRegime } from "./structure"; import { LoiDebit } from "./structure_props"; -import { RectangularStructureParams, StructureWeirFree } from "./structure_weir_free"; +import { StructureWeirFree } from "./structure_weir_free"; import { Villemonte } from "./villemonte"; export class StructureWeirVillemonte extends StructureWeirFree { diff --git a/src/util/array_reverse_iterator.ts b/src/util/array_reverse_iterator.ts new file mode 100644 index 0000000000000000000000000000000000000000..48cf99b158de41347ecdec788aa48f1a436da553 --- /dev/null +++ b/src/util/array_reverse_iterator.ts @@ -0,0 +1,34 @@ +/** + * itérateur sur un tableau dans le sens inverse (depuis la fin) + * + * utilisation : + * let arr = [1,2,3]; + * const it = new ArrayReverseIterator<Result>(arr); + * for (let r of it) + * console.log( r ); // 3 2 1 + */ +export class ArrayReverseIterator<T> implements IterableIterator<T> { + private _index: number; + + constructor(protected _arr: any[]) { + this._index = this._arr === undefined ? 0 : this._arr.length - 1; + } + + public next(): IteratorResult<T> { + if (this._arr !== undefined && this._index >= 0) { + return { + done: false, + value: this._arr[this._index--] + }; + } else { + return { + done: true, + value: null + }; + } + } + + public [Symbol.iterator](): IterableIterator<T> { + return this; + } +} diff --git a/src/util/log.ts b/src/util/log.ts index 004923d506764819c74b848c66a9a5c12d2e2402..dfa9ce65f8731c1434b73c25e3504ec2bd50851f 100644 --- a/src/util/log.ts +++ b/src/util/log.ts @@ -1,4 +1,4 @@ -import { Message, MessageCode } from "./message"; +import { Message } from "./message"; // tslint:disable-next-line:class-name export class cLog { diff --git a/src/util/iterator.ts b/src/util/map_iterator.ts similarity index 66% rename from src/util/iterator.ts rename to src/util/map_iterator.ts index d53f46ae475b183b7b08c14595ccc3b67e8a2a0c..c3da8893b2a0345129b5eddedde24a08710502a8 100644 --- a/src/util/iterator.ts +++ b/src/util/map_iterator.ts @@ -1,38 +1,3 @@ -/** - * itérateur sur un tableau dans le sens inverse (depuis la fin) - * - * utilisation : - * let arr = [1,2,3]; - * const it = new ArrayReverseIterator<Result>(arr); - * for (let r of it) - * console.log( r ); // 3 2 1 - */ -export class ArrayReverseIterator<T> implements IterableIterator<T> { - private _index: number; - - constructor(protected _arr: any[]) { - this._index = this._arr === undefined ? 0 : this._arr.length - 1; - } - - public next(): IteratorResult<T> { - if (this._arr !== undefined && this._index >= 0) { - return { - done: false, - value: this._arr[this._index--] - }; - } else { - return { - done: true, - value: null - }; - } - } - - public [Symbol.iterator](): IterableIterator<T> { - return this; - } -} - /** * itérateur sur un map string<->any * @@ -55,7 +20,6 @@ export class ArrayReverseIterator<T> implements IterableIterator<T> { * ... * } */ -// tslint:disable-next-line:max-classes-per-file export class MapIterator<T> implements IterableIterator<T> { private _map: { [key: string]: T }; diff --git a/src/util/number_array_iterator.ts b/src/util/number_array_iterator.ts new file mode 100644 index 0000000000000000000000000000000000000000..303849c5f9e6da00db65306f4adbdda159429863 --- /dev/null +++ b/src/util/number_array_iterator.ts @@ -0,0 +1,47 @@ +import { INumberIterator } from "../param/param-value-iterator"; + +/** + * itérateur sur les valeurs prises par un tableau + */ +export class NumberArrayIterator implements INumberIterator { + private _it: IterableIterator<number>; + + private _index: number; + + /** + * valeur courante + */ + private _current: number; + + constructor(private _arr: number[]) { + this._it = this._arr[Symbol.iterator](); // crée un itérateur à partir d'un tableau + this._index = 0; + } + + public count() { + return this._arr.length; + } + + public get hasNext(): boolean { + return this._index < this._arr.length; + } + + public next(): IteratorResult<number> { + this._index++; + const res = this._it.next(); + if (!res.done) { + this._current = res.value; + } + return res; + } + + public get currentValue(): number { + return this._current; + } + + // interface IterableIterator + + public [Symbol.iterator](): IterableIterator<number> { + return this; + } +} diff --git a/src/util/number_array_reverse_iterator.ts b/src/util/number_array_reverse_iterator.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2d31162a3ae5df665c73cf9b4e753acc4b9c1b2 --- /dev/null +++ b/src/util/number_array_reverse_iterator.ts @@ -0,0 +1,46 @@ +import { INumberIterator } from "../param/param-value-iterator"; +import { ArrayReverseIterator } from "../util/array_reverse_iterator"; + +/** + * itérateur sur les valeurs prises par un tableau (parcourues depuis la fin) + */ +export class NumberArrayReverseIterator extends ArrayReverseIterator<number> implements INumberIterator { + private _count: number; + + /** + * valeur courante + */ + private _current: number; + + constructor(arr: number[]) { + super(arr); + this._count = 0; + } + + public count() { + return this._arr.length; + } + + public get hasNext(): boolean { + return this._count < super._arr.length; + } + + public next(): IteratorResult<number> { + this._count++; + const res = super.next(); + if (!res.done) { + this._current = res.value; + } + return res; + } + + public get currentValue(): number { + return this._current; + } + + // interface IterableIterator + + public [Symbol.iterator](): IterableIterator<number> { + return this; + } +} diff --git a/src/util/search_interval.ts b/src/util/search_interval.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1d8ab01b3d24fd7845ec453202248d01cc1c6f4 --- /dev/null +++ b/src/util/search_interval.ts @@ -0,0 +1,98 @@ +import { Dichotomie } from "../dichotomie"; +import { Interval } from "./interval"; +import { Message, MessageCode } from "./message"; + +export class SearchInterval extends Interval { + private _step: number; + + private _dicho: Dichotomie; + + private _targets: Interval; + + constructor(d: Dichotomie, min: number, max: number, s: number) { + super(min, max); + if (s === 0) { + const e = new Message(MessageCode.ERROR_DICHO_NULL_STEP); + throw e; + } + this._step = s; + this._dicho = d; + } + + public reverse() { + this._step = -this._step; + } + + public growStep(k: number) { + if (k === 0) { + const e = new Message(MessageCode.ERROR_DICHO_INVALID_STEP_GROWTH); + throw e; + } + this._step *= k; + } + + get step() { + return this._step; + } + + get targets() { + if (this._targets === undefined) { + // @TODO just set _targets to undefined / null ? + this._targets = new Interval(undefined, undefined); + } + return this._targets; + } + + /** + * get target value for lower bound + */ + get targetLower() { + this.updateTargets(); + // @TODO val1 is not guaranteed to be the lower bound; use .min ? + return this.targets.val1; + } + + /** + * get target value for upper bound + */ + get targetUpper() { + this.updateTargets(); + // @TODO val2 is not guaranteed to be the upper bound; use .max ? + return this.targets.val2; + } + + public next() { + if (this._step > 0) { + this.val1 = this.val2; + this.val2 += this._step; + this.targets.setValues(this.targets.val2, undefined); + } else { + this.val2 = this.val1; + this.val1 += this._step; + this.targets.setValues(undefined, this.targets.val1); + } + } + + public hasTargetValue(targ: number) { + this.updateTargets(); + return this.targets.intervalHasValue(targ); + } + + public toString(): string { + return super.toString() + " step=" + this._step; + } + + public updateTargets() { + let t1 = this.targets.val1; + if (t1 === undefined || isNaN(t1)) { + t1 = this._dicho.CalculX(this.val1); + } + + let t2 = this.targets.val2; + if (t2 === undefined || isNaN(t2)) { + t2 = this._dicho.CalculX(this.val2); + } + this.targets.setValues(t1, t2); + } + +}