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
82259eb0
Commit
82259eb0
authored
5 years ago
by
David Dorchies
Committed by
mathias.chouet
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
#35
Debug inclined apron discretisation
parent
323dff5a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
spec/macrorugo/macrorugo_compound.spec.ts
+16
-6
16 additions, 6 deletions
spec/macrorugo/macrorugo_compound.spec.ts
src/macrorugo/macrorugo_compound.ts
+23
-14
23 additions, 14 deletions
src/macrorugo/macrorugo_compound.ts
with
39 additions
and
20 deletions
spec/macrorugo/macrorugo_compound.spec.ts
+
16
−
6
View file @
82259eb0
...
...
@@ -4,7 +4,7 @@ import { MacrorugoCompound } from "../../src/macrorugo/macrorugo_compound";
import
{
Props
}
from
"
../../src/props
"
;
import
{
Session
}
from
"
../../src/session
"
;
let
B
:
number
;
let
B
R
:
number
;
describe
(
"
MacroRugoCompound
"
,
()
=>
{
describe
(
"
Default 1 apron
"
,
()
=>
{
...
...
@@ -20,22 +20,32 @@ describe("MacroRugoCompound", () => {
});
describe
(
"
Default inclined but flat apron
"
,
()
=>
{
beforeAll
(()
=>
{
B
=
2
;
B
R
=
0
;
});
beforeEach
(()
=>
{
B
++
;
B
R
+=
1
;
});
for
(
let
i
=
2
;
i
<
6
;
i
++
)
{
for
(
let
i
=
1
;
i
<
10
;
i
+=
1
)
{
it
(
`B =
${
i
}
should return same result as Macrorugo`
,
()
=>
{
const
mrc
=
Session
.
getInstance
().
createNub
(
new
Props
({
calcType
:
CalculatorType
.
MacroRugoCompound
})
)
as
MacrorugoCompound
;
mrc
.
properties
.
setPropValue
(
"
InclinedApron
"
,
true
);
mrc
.
prms
.
B
.
singleValue
=
4
;
mrc
.
prms
.
B
R
.
singleValue
=
BR
;
const
mr
=
Session
.
getInstance
()
.
createNub
(
new
Props
({
calcType
:
CalculatorType
.
MacroRugo
}))
as
MacroRugo
;
mr
.
prms
.
Q
.
setCalculated
();
expect
(
mrc
.
CalcSerie
().
vCalc
).
toBeCloseTo
(
mr
.
CalcSerie
().
vCalc
*
mrc
.
prms
.
B
.
currentValue
,
3
);
expect
(
mrc
.
CalcSerie
().
vCalc
)
.
toBeCloseTo
(
mr
.
CalcSerie
().
vCalc
*
mrc
.
prms
.
BR
.
currentValue
/
mr
.
prms
.
B
.
currentValue
,
3
);
const
ax
=
mrc
.
prms
.
PBD
.
v
/
Math
.
sqrt
(
mrc
.
prms
.
C
.
v
);
let
B
:
number
=
0
;
for
(
const
child
of
mrc
.
children
)
{
expect
(
child
.
result
.
values
.
xCenter
)
.
toBeCloseTo
(
B
+
child
.
prms
.
B
.
v
/
2
);
B
+=
child
.
prms
.
B
.
v
;
expect
(
child
.
prms
.
B
.
v
).
toBeGreaterThanOrEqual
(
ax
/
4
);
}
expect
(
B
).
toBeCloseTo
(
mrc
.
prms
.
BR
.
currentValue
,
6
);
});
}
});
...
...
This diff is collapsed.
Click to expand it.
src/macrorugo/macrorugo_compound.ts
+
23
−
14
View file @
82259eb0
...
...
@@ -39,9 +39,12 @@ export class MacrorugoCompound extends MacroRugo {
public
Equation
(
sVarCalc
:
string
):
Result
{
let
QT
:
number
=
0
;
let
B
:
number
=
0
;
for
(
const
child
of
this
.
children
)
{
child
.
Calc
(
sVarCalc
);
QT
+=
child
.
result
.
vCalc
;
child
.
result
.
values
.
xCenter
=
B
+
child
.
prms
.
B
.
v
/
2
;
B
+=
child
.
prms
.
B
.
v
;
}
return
new
Result
(
QT
);
}
...
...
@@ -104,7 +107,7 @@ export class MacrorugoCompound extends MacroRugo {
// Taille d'une cellule de calcul
const
ax
:
number
=
this
.
prms
.
PBD
.
v
/
Math
.
sqrt
(
this
.
prms
.
C
.
v
);
// Nombre entier de cellules et reste
cons
t
nCells
:
number
=
Math
.
floor
(
this
.
prms
.
BR
.
v
/
ax
);
le
t
nCells
:
number
=
Math
.
floor
(
this
.
prms
.
BR
.
v
/
ax
);
const
xRest
:
number
=
this
.
prms
.
BR
.
v
%
ax
;
const
xCenters
:
number
[]
=
[];
let
lastBorder
:
number
=
0
;
...
...
@@ -112,22 +115,28 @@ export class MacrorugoCompound extends MacroRugo {
if
(
xRest
>
ax
/
2
)
{
// Ajout d'une cellule à gauche
xCenters
.
push
(
xRest
/
4
);
nCells
++
;
}
else
{
xCenters
.
push
((
ax
+
xRest
/
2
)
/
2
);
}
lastBorder
=
xCenters
[
0
]
*
2
;
// Ajout des cellules centrales décalées de ax
for
(
let
i
=
0
;
i
<
nCells
;
i
++
)
{
xCenters
.
push
(
lastBorder
+
ax
/
2
);
lastBorder
+=
ax
;
if
(
nCells
<
2
)
{
xCenters
.
push
(
this
.
prms
.
BR
.
v
/
2
);
}
else
{
xCenters
.
push
((
ax
+
xRest
/
2
)
/
2
);
}
}
if
(
xRest
>
ax
/
2
)
{
// Ajout de la cellule supplémentaire à droite
xCenters
.
push
(
this
.
prms
.
B
.
v
-
xRest
/
4
);
}
else
{
xCenters
[
xCenters
.
length
-
1
]
=
this
.
prms
.
BR
.
v
-
(
ax
+
xRest
/
2
)
/
2
;
if
(
nCells
>
1
||
xRest
>
ax
/
2
)
{
lastBorder
=
xCenters
[
0
]
*
2
;
// Ajout des cellules centrales décalées de ax
for
(
let
i
=
1
;
i
<
nCells
;
i
++
)
{
xCenters
.
push
(
lastBorder
+
ax
/
2
);
lastBorder
+=
ax
;
}
if
(
xRest
>
ax
/
2
)
{
// Ajout de la cellule supplémentaire à droite
xCenters
.
push
(
this
.
prms
.
BR
.
v
-
xRest
/
4
);
}
else
{
xCenters
[
xCenters
.
length
-
1
]
=
this
.
prms
.
BR
.
v
-
(
ax
+
xRest
/
2
)
/
2
;
}
}
// Génération des radiers
// Suppression des radiers existants
while
(
this
.
children
.
length
>
0
)
{
...
...
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