An error occurred while loading the file. Please try again.
-
Grand Francois authored17222955
import { Debug } from "./base";
import { ParamsEquation, IParamDefinitionIterator } from "./param/params-equation";
import { ParamDefinition } from "./param/param-definition";
import { ParamValueMode } from "./param/param-values";
/**
* 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,
// ouvrages hydrauliques : Kindsvater-Carter & Villemonte
StructureKIVI
}
/**
* 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 get parameters(): ParamsEquation {
return this._prms;
}
public getParameter(name: string): ParamDefinition {
for (const p of this.parameterIterator)
if (p.symbol === name)
return p;
return undefined;
}
public getFirstAnalyticalParameter(): ParamDefinition {
for (const p of this.parameterIterator)
if (p.isAnalytical())
return p;
return undefined;
}
public initParametersValueMode(computedParam: ParamDefinition, variatedParam?: ParamDefinition, variatedMode?: ParamValueMode) {
for (const p of this.parameterIterator) {
if (p.symbol === computedParam.symbol)
p.paramValues.valueMode = ParamValueMode.CALCUL;
else if (variatedParam && p.symbol == variatedParam.symbol)
p.paramValues.valueMode = variatedMode;
717273747576777879808182
else
p.paramValues.valueMode = ParamValueMode.SINGLE;
}
}
public get parameterIterator(): IParamDefinitionIterator {
return this._prms.iterator;
}
protected abstract setParametersCalculability(): void;
}