Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jalhyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cassiopée
jalhyd
Commits
8b11619b
Commit
8b11619b
authored
5 years ago
by
David Dorchies
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#104
parent
4dfa0ec2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nub.ts
+73
-48
73 additions, 48 deletions
src/nub.ts
with
73 additions
and
48 deletions
src/nub.ts
+
73
−
48
View file @
8b11619b
...
...
@@ -16,50 +16,6 @@ import { Result } from "./util/result";
*/
export
abstract
class
Nub
extends
ComputeNode
implements
IObservable
{
private
static
progressPercentageAccordedToChainCalculation
=
50
;
/** paramétrage de la dichotomie */
public
dichoStartIntervalMaxSteps
:
number
=
100
;
/** pointer to parent Nub */
public
parent
:
Nub
;
/** parameter that is to be computed by default - to be overloaded by child classes */
protected
_defaultCalculatedParam
:
ParamDefinition
;
/** parameter that is to be computed */
protected
_calculatedParam
:
ParamDefinition
;
/** résultat de Calc()/CalcSerie() */
protected
_result
:
Result
;
/**
* List of children Nubs; browsed by parameters iterator.
* - for ParallelStructures: contains 0 or more Structures
* - for SectionNub : contains exactly 1 acSection
*/
protected
_children
:
Nub
[];
/** properties describing the Nub type */
protected
_props
:
Props
=
new
Props
();
/** implémentation par délégation de IObservable */
private
_observable
:
Observable
;
/** a rough indication of calculation progress, between 0 and 100 */
private
_progress
:
number
=
0
;
/** allows notifying of progress every X milliseconds only */
private
previousNotificationTimestamp
=
0
;
public
constructor
(
prms
:
ParamsEquation
,
dbg
:
boolean
=
false
)
{
super
(
prms
,
dbg
);
this
.
_children
=
[];
this
.
_observable
=
new
Observable
();
this
.
_defaultCalculatedParam
=
this
.
getFirstAnalyticalParameter
();
this
.
resetDefaultCalculatedParam
();
}
public
get
result
():
Result
{
return
this
.
_result
;
}
...
...
@@ -75,6 +31,24 @@ export abstract class Nub extends ComputeNode implements IObservable {
this
.
_props
=
props
.
clone
();
}
/**
* return ParamsEquation of all children recursively
*/
public
get
childrenPrms
():
ParamsEquation
[]
{
const
prms
:
ParamsEquation
[]
=
[];
if
(
this
.
_children
.
length
)
{
// if called within constructor, default class member value is not set yet
for
(
const
child
of
this
.
_children
)
{
prms
.
push
(
child
.
prms
);
if
(
child
.
getChildren
())
{
if
(
child
.
getChildren
().
length
)
{
Nub
.
concatPrms
(
prms
,
child
.
childrenPrms
);
}
}
}
}
return
prms
;
}
/**
* Returns an iterator over :
* - own parameters (this._prms)
...
...
@@ -83,10 +57,8 @@ export abstract class Nub extends ComputeNode implements IObservable {
public
get
parameterIterator
():
IParamDefinitionIterator
{
const
prms
:
ParamsEquation
[]
=
[];
prms
.
push
(
this
.
_prms
);
if
(
this
.
_children
)
{
// if called within constructor, default class member value is not set yet
for
(
const
child
of
this
.
_children
)
{
prms
.
push
(
child
.
prms
);
}
if
(
this
.
_children
)
{
Nub
.
concatPrms
(
prms
,
this
.
childrenPrms
);
}
return
new
ParamsEquationArrayIterator
(
prms
);
}
...
...
@@ -145,6 +117,58 @@ export abstract class Nub extends ComputeNode implements IObservable {
}
}
private
static
progressPercentageAccordedToChainCalculation
=
50
;
private
static
concatPrms
(
p1
:
ParamsEquation
[],
p2
:
ParamsEquation
[]):
ParamsEquation
[]
{
const
p3
:
ParamsEquation
[]
=
p1
;
for
(
const
p
of
p2
)
{
p3
.
push
(
p
);
}
return
p3
;
}
/** paramétrage de la dichotomie */
public
dichoStartIntervalMaxSteps
:
number
=
100
;
/** pointer to parent Nub */
public
parent
:
Nub
;
/** parameter that is to be computed by default - to be overloaded by child classes */
protected
_defaultCalculatedParam
:
ParamDefinition
;
/** parameter that is to be computed */
protected
_calculatedParam
:
ParamDefinition
;
/** résultat de Calc()/CalcSerie() */
protected
_result
:
Result
;
/**
* List of children Nubs; browsed by parameters iterator.
* - for ParallelStructures: contains 0 or more Structures
* - for SectionNub : contains exactly 1 acSection
*/
protected
_children
:
Nub
[];
/** properties describing the Nub type */
protected
_props
:
Props
=
new
Props
();
/** implémentation par délégation de IObservable */
private
_observable
:
Observable
;
/** a rough indication of calculation progress, between 0 and 100 */
private
_progress
:
number
=
0
;
/** allows notifying of progress every X milliseconds only */
private
previousNotificationTimestamp
=
0
;
public
constructor
(
prms
:
ParamsEquation
,
dbg
:
boolean
=
false
)
{
super
(
prms
,
dbg
);
this
.
_children
=
[];
this
.
_observable
=
new
Observable
();
this
.
_defaultCalculatedParam
=
this
.
getFirstAnalyticalParameter
();
this
.
resetDefaultCalculatedParam
();
}
/**
* Finds the previous calculated parameter and sets its mode to SINGLE
*/
...
...
@@ -1207,4 +1231,5 @@ export abstract class Nub extends ComputeNode implements IObservable {
const
rPrec
=
this
.
_prms
.
Pr
.
v
;
return
dicho
.
Dichotomie
(
target
.
v
,
rPrec
,
rInit
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment