diff --git a/spec/iterator/param_equation.spec.ts b/spec/iterator/param_equation.spec.ts index 3ae53d1be734414913dafdacfd4e3ec77127273a..b8b881f063981292fdc837ce7af13eaccaf6bdab 100644 --- a/spec/iterator/param_equation.spec.ts +++ b/spec/iterator/param_equation.spec.ts @@ -1,7 +1,6 @@ /// <reference path="../../node_modules/@types/jasmine/index.d.ts" /> import { ConduiteDistribParams, ConduiteDistrib } from "../../src/cond_distri"; -import { ParamDefinition } from "../../src/param"; describe("iterator ConduiteDistribParams : ", () => { it("test 1", () => { diff --git a/spec/nubtest.ts b/spec/nubtest.ts index b16dc52d8ce6f861fd9ae81e232406d52c8cfed3..75896f2ed4d8f4aa4330811c481368b35641641c 100644 --- a/spec/nubtest.ts +++ b/spec/nubtest.ts @@ -1,6 +1,7 @@ import { Result } from "../src/util/result"; import { Nub } from "../src/nub"; -import { ParamCalculability, ParamDefinition, ParamDomainValue, ParamsEquation } from "../src/param"; +import { ParamsEquation } from "../src/param/params-equation"; +import { ParamDefinition, ParamDomainValue, ParamCalculability } from "../src"; class NubTestParams extends ParamsEquation { private _A: ParamDefinition; diff --git a/spec/param.spec.ts b/spec/param.spec.ts index e134b983d39d62c393934ad528f36daef9791925..88ee7943c8b237b2601c6db120098b4342455b6c 100644 --- a/spec/param.spec.ts +++ b/spec/param.spec.ts @@ -1,6 +1,7 @@ /// <reference path="../node_modules/@types/jasmine/index.d.ts" /> -import { ParamDefinition, ParamDomain, ParamDomainValue } from "../src/param"; +import { ParamDomainValue, ParamDomain } from "../src/param/param-domain"; +import { ParamDefinition } from "../src"; import { MessageCode, Message } from "../src/util/message"; describe('Class ParamDomain : ', () => { diff --git a/spec/structure/parallel_structure.spec.ts b/spec/structure/parallel_structure.spec.ts index d865367069ba624f1b6f048df6b27b9cf531328a..edacedeea591aec9ef2c5ffc20f7ec903afbfaba 100644 --- a/spec/structure/parallel_structure.spec.ts +++ b/spec/structure/parallel_structure.spec.ts @@ -6,7 +6,7 @@ */ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; -import { ParamCalculability, ParamDefinition, ParamsEquation } from "../../src/param"; +import { ParamCalculability } from "../../src/param/param-definition"; import { CreateStructure, loiAdmissibles, LoiDebit, StructureType } from "../../src/structure/factory_structure"; import { ParallelStructure } from "../../src/structure/parallel_structure"; import { ParallelStructureParams } from "../../src/structure/parallel_structure_params"; diff --git a/spec/structure/structure_test.ts b/spec/structure/structure_test.ts index 1cf6216b0cd7bb4368b0b90d5220a4a1132d6934..8fefd6ab17b34b7dde4ccb2600391069ef63b5b1 100644 --- a/spec/structure/structure_test.ts +++ b/spec/structure/structure_test.ts @@ -6,7 +6,7 @@ */ // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine"; -import { ParamCalculability, ParamDefinition, ParamsEquation } from "../../src/param"; +import { ParamCalculability } from "../../src/param/param-definition"; import { Structure, StructureParams, StructureFlowRegime, StructureFlowMode } from "../../src/structure/structure"; import { Result } from "../../src/util/result"; import { checkResult } from "../test_func"; diff --git a/src/compute-node.ts b/src/compute-node.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ec2cf5845de489fe00a965bc6f74403894b4f94 --- /dev/null +++ b/src/compute-node.ts @@ -0,0 +1,53 @@ +import { Debug } from "./base"; +import { ParamsEquation } from "./param/params-equation"; +import { ParamDefinition } from "./param/param-definition"; + +/** + * type de calculette + */ +export enum CalculatorType { + ConduiteDistributrice, LechaptCalmon, SectionParametree, RegimeUniforme, CourbeRemous, + PabDimensions, // passe à bassin rectangulaire + PabPuissance, // passe à bassin : puissance dissipée + Structure, // ouvrages hydrauliques simples + ParallelStructure // ouvrages hydrauliques en parallèle +} + +/** + * type de noeud de calcul (sous type de calculette) + */ +export enum ComputeNodeType { + None, + // types de sections + SectionTrapeze, SectionRectangle, SectionCercle, SectionPuissance, + // types d'ouvrages hydrauliques + StructureRectangle, +} + +/** + * noeud de calcul + */ +// tslint:disable-next-line:max-classes-per-file +export abstract class ComputeNode extends Debug { + protected _prms: ParamsEquation; + + constructor(prms: ParamsEquation, dbg: boolean = false) { + super(dbg); + this._prms = prms; + if (!this._prms.calculabilityDefined) { + this._prms.resetParametersCalculability(); + } + this.setParametersCalculability(); + this._prms.DefineCalculability(); + } + + public getParameter(name: string): ParamDefinition { + return this._prms.getParameter(name); + } + + public getFirstAnalyticalParameter(): ParamDefinition { + return this._prms.getFirstAnalyticalParameter(); + } + + protected abstract setParametersCalculability(): void; +} diff --git a/src/cond_distri.ts b/src/cond_distri.ts index 958e176d58ff78ddd85166b4a8f0e53f0f50bfe7..f88c82296655cee706445c6a4cf0abfd0a197bd5 100644 --- a/src/cond_distri.ts +++ b/src/cond_distri.ts @@ -1,5 +1,7 @@ import { Result } from "./util/result"; -import { ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation } from "./param"; +import { ParamsEquation } from "./param/params-equation"; +import { ParamDefinition, ParamCalculability } from "./param/param-definition"; +import { ParamDomainValue } from "./param/param-domain"; import { Nub } from "./nub"; /** diff --git a/src/dichotomie.ts b/src/dichotomie.ts index 063c301a0af11ba741d71bbab35fd6682ae0a203..568fdc977acef3867fb907c88d0f33111cb2166e 100644 --- a/src/dichotomie.ts +++ b/src/dichotomie.ts @@ -1,7 +1,8 @@ // import { XOR, BoolIdentity, Debug, Result, ResultCode, UndefinedError } from "./base"; import { BoolIdentity, Debug, XOR } from "./base"; import { Nub } from "./nub"; -import { ParamDefinition, ParamDomain, ParamDomainValue } from "./param"; +import { ParamDefinition } from "./param/param-definition"; +import { ParamDomain, ParamDomainValue } from "./param/param-domain"; import { Interval } from "./util/interval"; import { Message, MessageCode } from "./util/message"; import { Pair } from "./util/pair"; diff --git a/src/index.ts b/src/index.ts index 33eb8b28c2a91f58bdca073c11c14c0da67b59d6..4cc0584dd590e9af70101e7e5ded51e27a3653dd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,10 @@ export * from "./base"; -export * from "./param"; +export * from "./param/param-base"; +export * from "./param/param-definition"; +export * from "./param/param-domain"; +export * from "./param/params-equation"; +export * from "./param/param-values"; +export * from "./compute-node"; export * from "./parameters"; export * from "./nub"; export * from "./cond_distri"; diff --git a/src/lechaptcalmon.ts b/src/lechaptcalmon.ts index ad6c8c010ec5680b3b60057cce8f3e155fe3a5e2..d59753b3deefdf87dca5f0e842dbf7f828f8a0e5 100644 --- a/src/lechaptcalmon.ts +++ b/src/lechaptcalmon.ts @@ -1,5 +1,7 @@ import { Result } from "./util/result"; -import { ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation } from "./param"; +import { ParamsEquation } from "./param/params-equation"; +import { ParamDefinition, ParamCalculability } from "./param/param-definition"; +import { ParamDomainValue } from "./param/param-domain"; import { Nub } from "./nub"; /** diff --git a/src/nub.ts b/src/nub.ts index cb434afd5a582309ddb79582381d8af34b1fbdc5..e1471dcef093daf9a4d499d400ea09e33cbb8562 100644 --- a/src/nub.ts +++ b/src/nub.ts @@ -1,6 +1,6 @@ import { Debug, Serie } from "./base"; import { Dichotomie } from "./dichotomie"; -import { ComputeNode, ParamDefinition, ParamsEquation } from "./param"; +import { ComputeNode } from "./compute-node"; import { Result } from "./util/result"; /** diff --git a/src/pab/pab_dimension.ts b/src/pab/pab_dimension.ts index 02dbd6c5afa9d63ed9ace61bcc43fc433be2df1a..319e4e13e53989af868a497c8ab8087a98d5e41b 100644 --- a/src/pab/pab_dimension.ts +++ b/src/pab/pab_dimension.ts @@ -1,5 +1,7 @@ import { Result } from "../util/result"; -import { ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation } from "../param"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamDefinition, ParamCalculability } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; import { Nub } from "../nub"; export class PabDimensionParams extends ParamsEquation { diff --git a/src/pab/pab_puissance.ts b/src/pab/pab_puissance.ts index 445ddd1d858219666c411f40db4a46200d2ede7e..df0b1ff400c404346c81387869d4b9228a65b599 100644 --- a/src/pab/pab_puissance.ts +++ b/src/pab/pab_puissance.ts @@ -1,5 +1,7 @@ import { Result } from "../util/result"; -import { ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation } from "../param"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamDefinition, ParamCalculability } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; import { Nub } from "../nub"; export class PabPuissanceParams extends ParamsEquation { diff --git a/src/param.ts b/src/param.ts deleted file mode 100644 index af75f075398ef76a139b4dcdf3e6107c4d021925..0000000000000000000000000000000000000000 --- a/src/param.ts +++ /dev/null @@ -1,522 +0,0 @@ -import { Debug } from "./base"; -import { JalhydObject } from "./jalhyd_object"; -import { DefinedNumber } from "./util/definedvalue"; -import { Interval } from "./util/interval"; -import { MapIterator } from "./util/iterator"; -import { Message, MessageCode } from "./util/message"; - -/** - * domaine de définition du paramètre - */ -export enum ParamDomainValue { - /** - * >0, =0, <0 (-inf -> +inf) - */ - ANY, - - /** - * >=0 - */ - POS_NULL, - - /** - * > 0 - */ - POS, - - /** - * <>0 - */ - NOT_NULL, - - /** - * intervalle - */ - INTERVAL -} - -export class ParamDomain { - - public static getDefaultBounds(d: ParamDomainValue): { min: number, max: number } { - switch (d) { - case ParamDomainValue.INTERVAL: - const e: Message = new Message(MessageCode.ERROR_PARAMDOMAIN_INVALID); - throw e; - - case ParamDomainValue.ANY: - case ParamDomainValue.NOT_NULL: - return { min: -Infinity, max: Infinity }; - - case ParamDomainValue.POS: - return { min: 1e-9, max: Infinity }; - - case ParamDomainValue.POS_NULL: - return { min: 0, max: Infinity }; - - // default: - // throw "valeur de ParamDomainValue" + ParamDomainValue[d] + " non prise en charge"; - } - } - - private _domain: ParamDomainValue; - - private _minValue: number; - - private _maxValue: number; - - constructor(d: ParamDomainValue, min?: number, max?: number) { - this.checkValue(d, min, max); - this._domain = d; - - switch (this._domain) { - case ParamDomainValue.INTERVAL: - this._minValue = min; - this._maxValue = max; - break; - - default: - const b = ParamDomain.getDefaultBounds(this._domain); - this._minValue = b.min; - this._maxValue = b.max; - break; - } - } - - get domain() { - return this._domain; - } - - get minValue() { - return this._minValue; - } - - get maxValue() { - return this._maxValue; - } - - public get interval(): Interval { - switch (this._domain) { - case ParamDomainValue.INTERVAL: - return new Interval(this._minValue, this._maxValue); - - default: - const b = ParamDomain.getDefaultBounds(this._domain); - return new Interval(b.min, b.max); - } - } - - public clone(): ParamDomain { - switch (this._domain) { - case ParamDomainValue.INTERVAL: - return new ParamDomain(this._domain, this._minValue, this._maxValue); - - default: - return new ParamDomain(this._domain); - } - } - - private checkValue(val: number, min: number, max: number) { - switch (val) { - case ParamDomainValue.INTERVAL: - if (min === undefined || max === undefined || min > max) { - const e: Message = new Message(MessageCode.ERROR_PARAMDOMAIN_INTERVAL_BOUNDS); - e.extraVar.minValue = min; - e.extraVar.maxValue = max; - throw e; - } - break; - - default: - // en dehors du cas INTERVAL, on ne doit pas fournir de valeur - if (min !== undefined || max !== undefined) { - const e: Message = new Message(MessageCode.ERROR_PARAMDOMAIN_INTERVAL_BOUNDS); - e.extraVar.minValue = min; - e.extraVar.maxValue = max; - throw e; - } - break; - } - } - -} - -/** - * calculabilité du paramètre - */ -export enum ParamCalculability { - /** - * paramètre fixé (immuable, cad non modifiable après création) - */ - NONE, - - /** - * paramètre libre (modifiable) - */ - FREE, - - /** - * paramètre calculable analytiquement, par méthode de Newton, ... - */ - EQUATION, - - /** - * paramètre calculable par dichotomie - */ - DICHO -} - -/** - * paramètre avec symbole et domaine de définition - */ -// tslint:disable-next-line:max-classes-per-file -export class BaseParam extends JalhydObject { - /** - * symbole - */ - private _symbol: string; - - /** - * domaine de définition - */ - private _domain: ParamDomain; - - /** - * valeur numérique (éventuellement non définie) - */ - private _value: DefinedNumber; - - constructor(symb: string, d: ParamDomain | ParamDomainValue, val?: number) { - super(); - this._symbol = symb; - this._value = new DefinedNumber(val); - - if (d instanceof ParamDomain) { - this._domain = d; - } else { - this._domain = new ParamDomain(d as ParamDomainValue); - } - - this.checkValue(val); - } - - get symbol(): string { - return this._symbol; - } - - public getDomain(): ParamDomain { - return this._domain; - } - - public get interval(): Interval { - return this._domain.interval; - } - - /** - * gestion de la valeur - */ - - public get isDefined(): boolean { - return this._value.isDefined; - } - - public getValue(): number { - if (!this._value.isDefined) { - const e = new Message(MessageCode.ERROR_PARAMDEF_VALUE_UNDEFINED); - e.extraVar.symbol = this.symbol; - throw e; - } - - return this._value.value; - } - - public setValue(val: number) { - this.checkValue(val); - this._value.value = val; - - // console.log("setting param " + this._symbol + " id=" + this._id + " to " + val); // A VIRER - } - - public get uncheckedValue(): number { - return this._value.uncheckedValue; - } - - public checkValue(v: number) { - const sDomain = ParamDomainValue[this._domain.domain]; - - switch (this._domain.domain) { - case ParamDomainValue.ANY: - break; - - case ParamDomainValue.POS: - if (v <= 0) { - const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_POS); - f.extraVar.symbol = this.symbol; - f.extraVar.value = v; - throw f; - } - break; - - case ParamDomainValue.POS_NULL: - if (v < 0) { - const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_POSNULL); - f.extraVar.symbol = this.symbol; - f.extraVar.value = v; - throw f; - } - break; - - case ParamDomainValue.NOT_NULL: - if (v === 0) { - const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_NULL); - f.extraVar.symbol = this.symbol; - throw f; - } - break; - - case ParamDomainValue.INTERVAL: - const min = this._domain.minValue; - const max = this._domain.maxValue; - if (v < min || v > max) { - const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_INTERVAL); - f.extraVar.symbol = this.symbol; - f.extraVar.value = v; - f.extraVar.minValue = min; - f.extraVar.maxValue = max; - throw f; - } - break; - - default: - const e = new Message(MessageCode.ERROR_PARAMDOMAIN_INVALID); - e.extraVar.symbol = this.symbol; - e.extraVar.domain = sDomain; - throw e; - } - } -} - -/** - * définition d'un paramètre d'un noeud de calcul - */ -// tslint:disable-next-line:max-classes-per-file -export class ParamDefinition extends BaseParam { - /** - * calculabilité - */ - private _calc: ParamCalculability; - - constructor(s: string, d: ParamDomain | ParamDomainValue, val?: number) { - super(s, d, val); - this._calc = ParamCalculability.FREE; - this.checkValue(val); - } - - get v(): number { - return super.getValue(); - } - - set v(val: number) { - if (this.calculability === ParamCalculability.NONE) { - const e = new Message(MessageCode.ERROR_PARAMDEF_VALUE_FIXED); - e.extraVar.symbol = this.symbol; - throw e; - } - super.setValue(val); - } - - /* - * méthodes de calculabilité - */ - - /** - * variable calculable par l'équation ? - */ - public isAnalytical(): boolean { - return this.calculability === ParamCalculability.EQUATION; - } - - get calculability(): ParamCalculability { - if (this._calc === undefined) { - // throw "value of parameter '" + this._symbol + "' calculability is not defined"; - const e = new Message(MessageCode.ERROR_PARAMDEF_CALC_UNDEFINED); - e.extraVar.symbol = this.symbol; - throw e; - } - - return this._calc; - } - - set calculability(c: ParamCalculability) { - this._calc = c; - } - - public clone(): ParamDefinition { - const res = new ParamDefinition(this.symbol, this.getDomain().clone(), this.uncheckedValue); - res._calc = this._calc; - return res; - } -} - -/** - * liste des paramètres d'une équation - */ -// tslint:disable-next-line:max-classes-per-file -export abstract class ParamsEquation implements Iterable<ParamDefinition> { - protected _paramMap: { [key: string]: ParamDefinition } = {}; - - private _calculabilityDefined: boolean; - - public constructor() { - this._calculabilityDefined = false; - } - - get calculabilityDefined(): boolean { - return this._calculabilityDefined; - } - - public DefineCalculability() { - this._calculabilityDefined = true; - } - - public hasParameter(name: string): boolean { - for (const ps in this._paramMap) { - if (this._paramMap.hasOwnProperty(ps)) { - const p: ParamDefinition = this._paramMap[ps]; - if (p.symbol === name) { - return true; - } - } - } - - return false; - } - - public getParameter(name: string): ParamDefinition { - for (const ps in this._paramMap) { - if (this._paramMap.hasOwnProperty(ps)) { - const p: ParamDefinition = this._paramMap[ps]; - if (p.symbol === name) { - return p; - } - } - } - - throw new Error("ParamsEquation.getParameter() : invalid parameter name " + name); - } - - public getFirstAnalyticalParameter(): ParamDefinition { - for (const ps in this._paramMap) { - if (this._paramMap.hasOwnProperty(ps)) { - const p: ParamDefinition = this._paramMap[ps]; - if (p.isAnalytical()) { - return p; - } - } - } - return undefined; - } - - public get map(): { [key: string]: ParamDefinition } { - return this._paramMap; - } - - public resetParametersCalculability() { - for (const ps in this._paramMap) { - if (this._paramMap.hasOwnProperty(ps)) { - const p: ParamDefinition = this._paramMap[ps]; - p.calculability = undefined - } - } - } - - public checkParametersCalculability() { - const res = []; - - for (const ps in this._paramMap) { - if (this._paramMap.hasOwnProperty(ps)) { - const p: ParamDefinition = this._paramMap[ps]; - if (p.calculability === undefined) { - res.push(p.symbol); - } - } - } - - if (res.length > 0) { - throw new Error("Calculability of parameter(s) " + res.toString() + " has not been defined"); - } - } - - public [Symbol.iterator](): Iterator<ParamDefinition> { - return this.iterator; - } - - public get iterator() { - return new MapIterator(this._paramMap); - } - - protected addParamDefinition(p: ParamDefinition) { - if (!this.hasParameter(p.symbol)) { - this._paramMap[p.symbol] = p; - } - } - - protected addParamDefinitions(ps: ParamsEquation) { - for (const pi in ps._paramMap) { - if (ps._paramMap.hasOwnProperty(pi)) { - this.addParamDefinition(ps._paramMap[pi]); - } - } - } - -} - -/** - * type de calculette - */ -export enum CalculatorType { - ConduiteDistributrice, LechaptCalmon, SectionParametree, RegimeUniforme, CourbeRemous, - PabDimensions, // passe à bassin rectangulaire - PabPuissance, // passe à bassin : puissance dissipée - Structure, // ouvrages hydrauliques simples - ParallelStructure // ouvrages hydrauliques en parallèle -} - -/** - * type de noeud de calcul (sous type de calculette) - */ -export enum ComputeNodeType { - None, - // types de sections - SectionTrapeze, SectionRectangle, SectionCercle, SectionPuissance, - // types d'ouvrages hydrauliques - StructureRectangle, -} - -/** - * noeud de calcul - */ -// tslint:disable-next-line:max-classes-per-file -export abstract class ComputeNode extends Debug { - protected _prms: ParamsEquation; - - constructor(prms: ParamsEquation, dbg: boolean = false) { - super(dbg); - this._prms = prms; - if (!this._prms.calculabilityDefined) { - this._prms.resetParametersCalculability(); - } - this.setParametersCalculability(); - this._prms.DefineCalculability(); - } - - public getParameter(name: string): ParamDefinition { - return this._prms.getParameter(name); - } - - public getFirstAnalyticalParameter(): ParamDefinition { - return this._prms.getFirstAnalyticalParameter(); - } - - protected abstract setParametersCalculability(): void; - -} diff --git a/src/param/param-base.ts b/src/param/param-base.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5415e91fb4dcebcb6238c92c875825b86d63dc --- /dev/null +++ b/src/param/param-base.ts @@ -0,0 +1,136 @@ +import { DefinedNumber } from "../util/definedvalue"; +import { Interval } from "../util/interval"; +import { Message, MessageCode } from "../util/message"; + +import { JalhydObject } from "../jalhyd_object" +import { ParamDomain, ParamDomainValue } from "./param-domain"; + +/** + * paramètre avec symbole et domaine de définition + */ +// tslint:disable-next-line:max-classes-per-file +export class BaseParam extends JalhydObject { + /** + * symbole + */ + private _symbol: string; + + /** + * domaine de définition + */ + private _domain: ParamDomain; + + /** + * valeur numérique (éventuellement non définie) + */ + private _value: DefinedNumber; + + constructor(symb: string, d: ParamDomain | ParamDomainValue, val?: number) { + super(); + this._symbol = symb; + this._value = new DefinedNumber(val); + + if (d instanceof ParamDomain) { + this._domain = d; + } else { + this._domain = new ParamDomain(d as ParamDomainValue); + } + + this.checkValue(val); + } + + get symbol(): string { + return this._symbol; + } + + public getDomain(): ParamDomain { + return this._domain; + } + + public get interval(): Interval { + return this._domain.interval; + } + + /** + * gestion de la valeur + */ + + public get isDefined(): boolean { + return this._value.isDefined; + } + + public getValue(): number { + if (!this._value.isDefined) { + const e = new Message(MessageCode.ERROR_PARAMDEF_VALUE_UNDEFINED); + e.extraVar.symbol = this.symbol; + throw e; + } + + return this._value.value; + } + + public setValue(val: number) { + this.checkValue(val); + this._value.value = val; + + // console.log("setting param " + this._symbol + " id=" + this._id + " to " + val); // A VIRER + } + + public get uncheckedValue(): number { + return this._value.uncheckedValue; + } + + public checkValue(v: number) { + const sDomain = ParamDomainValue[this._domain.domain]; + + switch (this._domain.domain) { + case ParamDomainValue.ANY: + break; + + case ParamDomainValue.POS: + if (v <= 0) { + const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_POS); + f.extraVar.symbol = this.symbol; + f.extraVar.value = v; + throw f; + } + break; + + case ParamDomainValue.POS_NULL: + if (v < 0) { + const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_POSNULL); + f.extraVar.symbol = this.symbol; + f.extraVar.value = v; + throw f; + } + break; + + case ParamDomainValue.NOT_NULL: + if (v === 0) { + const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_NULL); + f.extraVar.symbol = this.symbol; + throw f; + } + break; + + case ParamDomainValue.INTERVAL: + const min = this._domain.minValue; + const max = this._domain.maxValue; + if (v < min || v > max) { + const f = new Message(MessageCode.ERROR_PARAMDEF_VALUE_INTERVAL); + f.extraVar.symbol = this.symbol; + f.extraVar.value = v; + f.extraVar.minValue = min; + f.extraVar.maxValue = max; + throw f; + } + break; + + default: + const e = new Message(MessageCode.ERROR_PARAMDOMAIN_INVALID); + e.extraVar.symbol = this.symbol; + e.extraVar.domain = sDomain; + throw e; + } + } +} diff --git a/src/param/param-definition.ts b/src/param/param-definition.ts new file mode 100644 index 0000000000000000000000000000000000000000..4f911a6c221357f17df65e82fb440f2aa5d0e903 --- /dev/null +++ b/src/param/param-definition.ts @@ -0,0 +1,91 @@ +import { Message, MessageCode } from "../util/message"; + +import { BaseParam } from "./param-base"; +import { ParamDomain, ParamDomainValue } from "./param-domain"; + +/** + * calculabilité du paramètre + */ +export enum ParamCalculability { + /** + * paramètre fixé (immuable, cad non modifiable après création) + */ + NONE, + + /** + * paramètre libre (modifiable) + */ + FREE, + + /** + * paramètre calculable analytiquement, par méthode de Newton, ... + */ + EQUATION, + + /** + * paramètre calculable par dichotomie + */ + DICHO +} + +/** + * définition d'un paramètre d'un noeud de calcul + */ +// tslint:disable-next-line:max-classes-per-file +export class ParamDefinition extends BaseParam { + /** + * calculabilité + */ + private _calc: ParamCalculability; + + constructor(s: string, d: ParamDomain | ParamDomainValue, val?: number) { + super(s, d, val); + this._calc = ParamCalculability.FREE; + this.checkValue(val); + } + + get v(): number { + return super.getValue(); + } + + set v(val: number) { + if (this.calculability === ParamCalculability.NONE) { + const e = new Message(MessageCode.ERROR_PARAMDEF_VALUE_FIXED); + e.extraVar.symbol = this.symbol; + throw e; + } + super.setValue(val); + } + + /* + * méthodes de calculabilité + */ + + /** + * variable calculable par l'équation ? + */ + public isAnalytical(): boolean { + return this.calculability === ParamCalculability.EQUATION; + } + + get calculability(): ParamCalculability { + if (this._calc === undefined) { + // throw "value of parameter '" + this._symbol + "' calculability is not defined"; + const e = new Message(MessageCode.ERROR_PARAMDEF_CALC_UNDEFINED); + e.extraVar.symbol = this.symbol; + throw e; + } + + return this._calc; + } + + set calculability(c: ParamCalculability) { + this._calc = c; + } + + public clone(): ParamDefinition { + const res = new ParamDefinition(this.symbol, this.getDomain().clone(), this.uncheckedValue); + res._calc = this._calc; + return res; + } +} diff --git a/src/param/param-domain.ts b/src/param/param-domain.ts new file mode 100644 index 0000000000000000000000000000000000000000..e614d3a66a701f637434d3d8b99363ed6a5a4531 --- /dev/null +++ b/src/param/param-domain.ts @@ -0,0 +1,135 @@ +import { Message, MessageCode } from "../util/message"; +import { Interval } from "../util/interval"; + +/** + * domaine de définition du paramètre + */ +export enum ParamDomainValue { + /** + * >0, =0, <0 (-inf -> +inf) + */ + ANY, + + /** + * >=0 + */ + POS_NULL, + + /** + * > 0 + */ + POS, + + /** + * <>0 + */ + NOT_NULL, + + /** + * intervalle + */ + INTERVAL +} + +export class ParamDomain { + public static getDefaultBounds(d: ParamDomainValue): { min: number, max: number } { + switch (d) { + case ParamDomainValue.INTERVAL: + const e: Message = new Message(MessageCode.ERROR_PARAMDOMAIN_INVALID); + throw e; + + case ParamDomainValue.ANY: + case ParamDomainValue.NOT_NULL: + return { min: -Infinity, max: Infinity }; + + case ParamDomainValue.POS: + return { min: 1e-9, max: Infinity }; + + case ParamDomainValue.POS_NULL: + return { min: 0, max: Infinity }; + + // default: + // throw "valeur de ParamDomainValue" + ParamDomainValue[d] + " non prise en charge"; + } + } + + private _domain: ParamDomainValue; + + private _minValue: number; + + private _maxValue: number; + + constructor(d: ParamDomainValue, min?: number, max?: number) { + this.checkValue(d, min, max); + this._domain = d; + + switch (this._domain) { + case ParamDomainValue.INTERVAL: + this._minValue = min; + this._maxValue = max; + break; + + default: + const b = ParamDomain.getDefaultBounds(this._domain); + this._minValue = b.min; + this._maxValue = b.max; + break; + } + } + + get domain() { + return this._domain; + } + + get minValue() { + return this._minValue; + } + + get maxValue() { + return this._maxValue; + } + + public get interval(): Interval { + switch (this._domain) { + case ParamDomainValue.INTERVAL: + return new Interval(this._minValue, this._maxValue); + + default: + const b = ParamDomain.getDefaultBounds(this._domain); + return new Interval(b.min, b.max); + } + } + + public clone(): ParamDomain { + switch (this._domain) { + case ParamDomainValue.INTERVAL: + return new ParamDomain(this._domain, this._minValue, this._maxValue); + + default: + return new ParamDomain(this._domain); + } + } + + private checkValue(val: number, min: number, max: number) { + switch (val) { + case ParamDomainValue.INTERVAL: + if (min === undefined || max === undefined || min > max) { + const e: Message = new Message(MessageCode.ERROR_PARAMDOMAIN_INTERVAL_BOUNDS); + e.extraVar.minValue = min; + e.extraVar.maxValue = max; + throw e; + } + break; + + default: + // en dehors du cas INTERVAL, on ne doit pas fournir de valeur + if (min !== undefined || max !== undefined) { + const e: Message = new Message(MessageCode.ERROR_PARAMDOMAIN_INTERVAL_BOUNDS); + e.extraVar.minValue = min; + e.extraVar.maxValue = max; + throw e; + } + break; + } + } +} diff --git a/src/param/param-values.ts b/src/param/param-values.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb27d317cf0ce7cc50ff1b7e8e9447b6ca276665 --- /dev/null +++ b/src/param/param-values.ts @@ -0,0 +1,264 @@ +import { Pair } from "../util/pair" + +/** + * mode de génération des valeurs + */ +export enum ParamValueMode { + /** + * valeur unique + */ + SINGLE, + + /** + * min, max, pas + */ + MINMAX, + + /** + * liste de valeurs discrètes + */ + LISTE +} + +/** + * itérateur sur les (ou la) valeurs prises par le paramètre + */ +export class ParamValueIterator implements IterableIterator<number> { + /** + * paramètre à itérer + */ + private _param: ParamValues; + + /** + * true si les valeurs sont fournies de max à min (ParamValueMode.MINMAX) + */ + private _reverse: boolean; + + private _index: number; + + /** + * cas de figure : + * 0 : valeur fixée + * 1 : min/max/pas + * 2 : liste de valeurs + */ + private _config: number; + + constructor(prm: ParamValues, reverse: boolean = false) { + this._param = prm; + this.reset(reverse) + } + + public reset(reverse: boolean) { + this._reverse = reverse; + + switch (this._param.valueMode) { + case ParamValueMode.SINGLE: + this._config = 0; + this._index = 0; + break; + + case ParamValueMode.MINMAX: + this._config = 1; + if (reverse) + this._index = this._param.max; + else + this._index = this._param.min; + break; + + case ParamValueMode.LISTE: + this._config = 2; + this._index = 0; + break; + + default: + throw new Error(`mode de génération de valeurs ${ParamValueMode[this._param.valueMode]}`); + } + } + + public next(): IteratorResult<number> { + switch (this._config) { + // valeur fixée + case 0: + if (this._index == 0) + return { + done: false, + value: this._param.singleValue + }; + else + return { + done: true, + value: undefined + }; + + // min/max + case 1: + const res = this._index; + const end = this._reverse ? this._index < this._param.min : this._index > this._param.max; + if (!end) { + if (this._reverse) + this._index -= this._param.step; + else + this._index += this._param.step; + return { + done: false, + value: res + }; + } else { + return { + done: true, + value: undefined + }; + } + + // liste + case 2: + const i = this._index; + if (this._index < this._param.valueList.length) { + const res = this._param.valueList[this._index++]; + return { + done: false, + value: res + }; + } else { + return { + done: true, + value: undefined + }; + } + + default: + throw new Error(`ParamValueIterator.next() : erreur interne`); + } + } + + // public get current(): number { + // if (this._config == 1) + // return this._index; + // throw new Error(`appel ParamValueIterator.current() invalide`) + // } + + // interface IterableIterator + + public [Symbol.iterator](): IterableIterator<number> { + return this; + } +} + +export class ParamValues { + /** + * mode de génération des valeurs : min/max, liste, ... + */ + private _valueMode: ParamValueMode = ParamValueMode.MINMAX; + + /** + * valeur dans le cas ParamValueMode.SINGLE + */ + private _singleValue: number; + + /** + * valeur min dans le cas ParamValueMode.MINMAX + */ + private _minValue: number = undefined; + + /** + * valeur max dans le cas ParamValueMode.MINMAX + */ + private _maxValue: number = undefined; + + /** + * pas de progression dans le cas ParamValueMode.MINMAX + */ + private _stepValue: number = undefined; + + /** + * liste de valeurs dans le cas ParamValueMode.LISTE + */ + private _valueList: number[]; + + constructor(o: number | any, max?: number, step?: number) { + if (typeof (o) === "number") { + if (max == undefined) { + this._valueMode = ParamValueMode.SINGLE; + this._singleValue = o as number; + } else { + this._valueMode = ParamValueMode.MINMAX; + this._minValue = o as number; + this._maxValue = max; + this._stepValue = step; + } + } + else if (Array.isArray(o)) + this._valueList = o; + else + throw new Error(`appel du constructeur ParamValues invalide`); + } + + public get valueMode() { + return this._valueMode; + } + + public set valueMode(m: ParamValueMode) { + this._valueMode = m; + } + + public get singleValue() { + return this._singleValue; + } + + public set singleValue(v: number) { + this._singleValue = v; + } + + public get min() { + return this._minValue; + } + + public set min(v: number) { + this._minValue = v; + } + + public get max() { + return this._maxValue; + } + + public set max(v: number) { + this._maxValue = v; + } + + public get stepRefValue(): Pair { + return new Pair(1e-9, this._maxValue - this._minValue); + } + + public get step() { + return this._stepValue; + } + + public set step(v: number) { + this._stepValue = v; + } + + public get valueList() { + return this._valueList; + } + + public set valueList(l: number[]) { + this._valueList = l; + } + + public getValuesIterator(reverse: boolean = false): ParamValueIterator { + return new ParamValueIterator(this, reverse); + } + + /** + * copie des membres + */ + public copyMembers(n: ParamValues) { + n._valueMode = this.valueMode; + n._minValue = this._minValue; + n._maxValue = this._maxValue; + n._stepValue = this._stepValue; + if (this._valueList != undefined) + n._valueList = this._valueList.slice(0); // copie + } +} diff --git a/src/param/params-equation.ts b/src/param/params-equation.ts new file mode 100644 index 0000000000000000000000000000000000000000..94ea6bcd25ed57b07cd2d2cb1843f5797fc45568 --- /dev/null +++ b/src/param/params-equation.ts @@ -0,0 +1,115 @@ +import { MapIterator } from "../util/iterator" + +import { ParamDefinition } from "./param-definition"; + +/** + * liste des paramètres d'une équation + */ +// tslint:disable-next-line:max-classes-per-file +export abstract class ParamsEquation implements Iterable<ParamDefinition> { + protected _paramMap: { [key: string]: ParamDefinition } = {}; + + private _calculabilityDefined: boolean; + + public constructor() { + this._calculabilityDefined = false; + } + + get calculabilityDefined(): boolean { + return this._calculabilityDefined; + } + + public DefineCalculability() { + this._calculabilityDefined = true; + } + + public hasParameter(name: string): boolean { + for (const ps in this._paramMap) { + if (this._paramMap.hasOwnProperty(ps)) { + const p: ParamDefinition = this._paramMap[ps]; + if (p.symbol === name) { + return true; + } + } + } + + return false; + } + + public getParameter(name: string): ParamDefinition { + for (const ps in this._paramMap) { + if (this._paramMap.hasOwnProperty(ps)) { + const p: ParamDefinition = this._paramMap[ps]; + if (p.symbol === name) { + return p; + } + } + } + + throw new Error("ParamsEquation.getParameter() : invalid parameter name " + name); + } + + public getFirstAnalyticalParameter(): ParamDefinition { + for (const ps in this._paramMap) { + if (this._paramMap.hasOwnProperty(ps)) { + const p: ParamDefinition = this._paramMap[ps]; + if (p.isAnalytical()) { + return p; + } + } + } + return undefined; + } + + public get map(): { [key: string]: ParamDefinition } { + return this._paramMap; + } + + public resetParametersCalculability() { + for (const ps in this._paramMap) { + if (this._paramMap.hasOwnProperty(ps)) { + const p: ParamDefinition = this._paramMap[ps]; + p.calculability = undefined + } + } + } + + public checkParametersCalculability() { + const res = []; + + for (const ps in this._paramMap) { + if (this._paramMap.hasOwnProperty(ps)) { + const p: ParamDefinition = this._paramMap[ps]; + if (p.calculability === undefined) { + res.push(p.symbol); + } + } + } + + if (res.length > 0) { + throw new Error("Calculability of parameter(s) " + res.toString() + " has not been defined"); + } + } + + public [Symbol.iterator](): Iterator<ParamDefinition> { + return this.iterator; + } + + public get iterator() { + return new MapIterator(this._paramMap); + } + + protected addParamDefinition(p: ParamDefinition) { + if (!this.hasParameter(p.symbol)) { + this._paramMap[p.symbol] = p; + } + } + + protected addParamDefinitions(ps: ParamsEquation) { + for (const pi in ps._paramMap) { + if (ps._paramMap.hasOwnProperty(pi)) { + this.addParamDefinition(ps._paramMap[pi]); + } + } + } +} diff --git a/src/parameters.ts b/src/parameters.ts index 7e64f8abee96a01a59fac1d9f1dbbe1a76c4f5c4..710b5b55f7ca5eddb5511d632e300fe91dc7df2f 100644 --- a/src/parameters.ts +++ b/src/parameters.ts @@ -1,4 +1,6 @@ -import { ComputeNodeType, ParamsEquation, CalculatorType, ParamDefinition } from "./param"; +import { ComputeNodeType, CalculatorType } from "./compute-node" +import { ParamsEquation } from "./param/params-equation"; +import { ParamDefinition } from "./param/param-definition"; import { ConduiteDistribParams, ConduiteDistrib } from "./cond_distri"; import { LechaptCalmonParams, LechaptCalmon } from "./lechaptcalmon"; import { acSection } from "./section/section_type"; diff --git a/src/regime_uniforme.ts b/src/regime_uniforme.ts index df983a2b937f20dc17d1bafd17e3ef5a017a8941..f9ce030da447da9bf3dad5864d228ca6ad76eb2e 100644 --- a/src/regime_uniforme.ts +++ b/src/regime_uniforme.ts @@ -1,5 +1,5 @@ import { Nub } from "./nub"; -import { ParamCalculability, ParamDefinition } from "./param" +import { ParamCalculability } from "./param/param-definition"; import { acSection, ParamsSection } from "./section/section_type"; import { Result } from "./util/result"; diff --git a/src/remous.ts b/src/remous.ts index a769963ef0d2edbfe6baec1de229ff6f6bf05b69..137f8d8bbb919b186d0e38b933305b9e5c1620ce 100644 --- a/src/remous.ts +++ b/src/remous.ts @@ -1,7 +1,9 @@ import { round, XOR } from "./base"; import { Dichotomie } from "./dichotomie"; import { Nub } from "./nub"; -import { ParamCalculability, ParamDefinition, ParamDomainValue, ParamsEquation } from "./param"; +import { ParamsEquation } from "./param/params-equation"; +import { ParamDefinition, ParamCalculability } from "./param/param-definition"; +import { ParamDomainValue } from "./param/param-domain"; import { acSection, ParamsSection } from "./section/section_type"; import { cLog } from "./util/log"; import { Message, MessageCode } from "./util/message"; diff --git a/src/section/section_circulaire.ts b/src/section/section_circulaire.ts index f1f661ce4a447b48ce6334e4ccd5ee4c0c594cf3..26763beb68cac93351d93476511b3cc803ba4564 100644 --- a/src/section/section_circulaire.ts +++ b/src/section/section_circulaire.ts @@ -1,4 +1,5 @@ -import { ParamDefinition, ParamDomainValue, ParamCalculability } from "../param"; +import { ParamDefinition, ParamCalculability } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; import { acSection, ParamsSection } from "./section_type"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; diff --git a/src/section/section_puissance.ts b/src/section/section_puissance.ts index 4a58f459d2eed33efe7df7c1e86ead140323c67d..0ffa4696c8705aef1fefc0eb5b2077d1b94ae092 100644 --- a/src/section/section_puissance.ts +++ b/src/section/section_puissance.ts @@ -1,4 +1,5 @@ -import { ParamDefinition, ParamDomain, ParamDomainValue, ParamCalculability } from "../param"; +import { ParamDefinition, ParamCalculability } from "../param/param-definition"; +import { ParamDomain, ParamDomainValue } from "../param/param-domain"; import { acSection, ParamsSection } from "./section_type"; import { Result } from "../util/result"; diff --git a/src/section/section_trapez.ts b/src/section/section_trapez.ts index 03f93d44cf099ab7e751ef36a97843eaf401d9bc..3f5bc0817936d46754151e194c32bffa80ab193b 100644 --- a/src/section/section_trapez.ts +++ b/src/section/section_trapez.ts @@ -1,4 +1,5 @@ -import { ParamDefinition, ParamDomainValue, ParamCalculability } from "../param"; +import { ParamDomainValue } from "../param/param-domain"; +import { ParamDefinition, ParamCalculability } from "../param/param-definition"; import { acSection, ParamsSection } from "./section_type"; import { Result } from "../util/result"; @@ -166,4 +167,4 @@ export class cSnTrapez extends acSection { SYg += (this.prms.LargeurFond.v / 2 + this.prms.Fruit.v * this.prms.Y.v / 3) * 2 * this.prms.Y.v; return new Result(SYg); } -} \ No newline at end of file +} diff --git a/src/section/section_type.ts b/src/section/section_type.ts index 7cc0467dee1aeff35225310065fb6cb0f7903e4b..fda44b4e7b1bb6cb5234055b8d3877e473bc353d 100644 --- a/src/section/section_type.ts +++ b/src/section/section_type.ts @@ -1,5 +1,8 @@ import { MessageCode, Message } from "../util/message"; -import { ComputeNode, ParamDefinition, ParamDomainValue, ParamCalculability, ParamsEquation } from "../param"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamDefinition, ParamCalculability } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; +import { ComputeNode } from "../compute-node"; import { cHautCritique, cHautNormale, cHautCorrespondante, cHautConjuguee } from "./hauteur"; import { Result } from "../util/result"; diff --git a/src/structure/parallel_structure.ts b/src/structure/parallel_structure.ts index 0086540636a3cb4b53cb1d790b69b713efecbdc7..8d2b46ab60bd5cadee49503d3ea5067e9fdaf7a7 100644 --- a/src/structure/parallel_structure.ts +++ b/src/structure/parallel_structure.ts @@ -1,5 +1,5 @@ import { Nub } from "../nub"; -import { ParamCalculability } from "../param"; +import { ParamCalculability } from "../param/param-definition"; import { Message } from "../util/message"; import { Result } from "../util/result"; import { ParallelStructureParams } from "./parallel_structure_params"; diff --git a/src/structure/parallel_structure_params.ts b/src/structure/parallel_structure_params.ts index 3af8ca046b197666c3d7f3cbcdc0f3c2f8fdde55..71c037a59395b8602aaf2557a00d494eecec529e 100644 --- a/src/structure/parallel_structure_params.ts +++ b/src/structure/parallel_structure_params.ts @@ -1,5 +1,7 @@ import { Nub } from "../nub"; -import { ParamDefinition, ParamDomainValue, ParamsEquation } from "../param"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamDefinition } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; /** * Common parameters of hydraulic structure equations diff --git a/src/structure/rectangular_structure.ts b/src/structure/rectangular_structure.ts index a835b146a9c764c11d7d25eac107557c4761c8c6..da1956dc03148990cfa8b4b4fcbcccbf174ad72f 100644 --- a/src/structure/rectangular_structure.ts +++ b/src/structure/rectangular_structure.ts @@ -1,4 +1,4 @@ -import { ParamCalculability } from "../param"; +import { ParamCalculability } from "../param/param-definition"; import { RectangularStructureParams } from "./rectangular_structure_params"; import { Structure } from "./structure"; diff --git a/src/structure/rectangular_structure_params.ts b/src/structure/rectangular_structure_params.ts index 549a83ba42175fa44dd9b5865cbac7bcbac69a5e..5a2df407a594766af77d17233280c27a82c00f69 100644 --- a/src/structure/rectangular_structure_params.ts +++ b/src/structure/rectangular_structure_params.ts @@ -1,4 +1,5 @@ -import { ParamDefinition, ParamDomainValue } from "../param"; +import { ParamDefinition } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; import { Structure } from "./structure"; import { StructureParams } from "./structure_params"; diff --git a/src/structure/structure.ts b/src/structure/structure.ts index c8b84578ae478789aca85f8d60f783b9b06e0cc0..5e73d099bbd97798118b5e4f05855a926f4732d4 100644 --- a/src/structure/structure.ts +++ b/src/structure/structure.ts @@ -1,5 +1,5 @@ import { Nub } from "../nub"; -import { ParamCalculability } from "../param"; +import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; diff --git a/src/structure/structure_kivi.ts b/src/structure/structure_kivi.ts index 8fe1231c437598a8b3e2d04fda096fc37aa590dc..6df85dd19b29c59246d92d38d3bfb705b06259db 100644 --- a/src/structure/structure_kivi.ts +++ b/src/structure/structure_kivi.ts @@ -1,4 +1,4 @@ -import { ParamCalculability } from "../param"; +import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure"; diff --git a/src/structure/structure_kivi_params.ts b/src/structure/structure_kivi_params.ts index 062b11d079d5d889043dc891b3bfdd4e24c2e79d..4e8a4869dc176745e4d3745b9bf7b5c22f001c03 100644 --- a/src/structure/structure_kivi_params.ts +++ b/src/structure/structure_kivi_params.ts @@ -1,4 +1,5 @@ -import { ParamDefinition, ParamDomainValue } from "../param"; +import { ParamDefinition } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; import { StructureParams } from "./structure_params"; /** diff --git a/src/structure/structure_params.ts b/src/structure/structure_params.ts index e75d4c117714fef4809f3cd90fd6d2487568a911..28ff720ad5f5dd5b8cd186ddbaf304f566ff9bd7 100644 --- a/src/structure/structure_params.ts +++ b/src/structure/structure_params.ts @@ -1,5 +1,7 @@ import { Nub } from "../nub"; -import { ParamDefinition, ParamDomainValue, ParamsEquation } from "../param"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamDefinition } from "../param/param-definition"; +import { ParamDomainValue } from "../param/param-domain"; /** * Common parameters of hydraulic structure equations