Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
675d50d7
Commit
675d50d7
authored
Apr 09, 2021
by
niklas.baumgarten
Browse files
cleaning logging
parent
a1c6a3ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
mlmc/src/montecarlo/MonteCarlo.cpp
View file @
675d50d7
...
...
@@ -2,44 +2,42 @@
void
MonteCarlo
::
Method
()
{
mout
.
StartBlock
(
"MC Method l="
+
to_string
(
level
.
fine
));
vout
(
1
)
<<
aggregate
;
vout
(
1
)
<<
"Run"
<<
endl
;
method
();
aggregate
.
UpdateParallel
();
vout
(
1
)
<<
aggregate
;
// sums.UpdateParallel(ctr);
vout
(
2
)
<<
sums
;
avgs
.
Update
(
sums
,
aggregate
.
M
);
vout
(
1
)
<<
avgs
;
vars
.
Update
(
avgs
);
vout
(
1
)
<<
vars
;
kurtosis
.
Update
(
avgs
,
vars
);
vout
(
2
)
<<
kurtosis
;
mout
.
EndBlock
(
verbose
==
0
);
mout
.
StartBlock
(
"MonteCarlo l="
+
to_string
(
level
.
fine
));
vout
(
1
)
<<
"Start with: "
<<
aggregate
;
method
();
aggregate
.
UpdateParallel
();
// sums.UpdateParallel(ctr);
vout
(
2
)
<<
sums
;
avgs
.
Update
(
sums
,
aggregate
.
M
);
vars
.
Update
(
avgs
);
kurtosis
.
Update
(
avgs
,
vars
);
aggregate
.
MeanQ
=
avgs
.
Q
;
aggregate
.
SVarQ
=
vars
.
Q
;
aggregate
.
MeanY
=
avgs
.
Y
;
aggregate
.
SVarY
=
vars
.
Y
;
vout
(
1
)
<<
"End with: "
<<
aggregate
;
mout
.
EndBlock
(
verbose
==
0
,
"Took"
);
}
void
MonteCarlo
::
method
()
{
SampleSolution
coarseSolution
(
pdeSolver
->
GetDisc
(),
coarseId
);
SampleSolution
fineSolution
(
pdeSolver
->
GetDisc
(),
fineId
);
while
(
aggregate
.
dMcomm
!=
0
)
{
computeSampleSolution
(
aggregate
.
index
(),
fineId
,
fineSolution
);
if
(
onlyFine
)
coarseSolution
.
Init
();
else
computeSampleSolution
(
aggregate
.
index
(),
coarseId
,
coarseSolution
);
sums
.
Update
(
fineSolution
,
coarseSolution
);
vout
(
3
)
<<
sums
;
aggregate
.
Update
(
fineSolution
,
coarseSolution
);
}
SampleSolution
coarseSolution
(
pdeSolver
->
GetDisc
(),
coarseId
);
SampleSolution
fineSolution
(
pdeSolver
->
GetDisc
(),
fineId
);
while
(
aggregate
.
dMcomm
!=
0
)
{
computeSampleSolution
(
aggregate
.
index
(),
fineId
,
fineSolution
);
if
(
onlyFine
)
coarseSolution
.
Init
();
else
computeSampleSolution
(
aggregate
.
index
(),
coarseId
,
coarseSolution
);
sums
.
Update
(
fineSolution
,
coarseSolution
);
vout
(
3
)
<<
sums
;
aggregate
.
Update
(
fineSolution
,
coarseSolution
);
}
}
void
MonteCarlo
::
computeSampleSolution
(
int
m
,
SampleID
&
id
,
SampleSolution
&
solution
)
{
id
.
number
=
m
;
solution
.
id
=
id
;
pdeSolver
->
DrawSample
(
id
);
pdeSolver
->
Run
(
solution
);
id
.
number
=
m
;
solution
.
id
=
id
;
pdeSolver
->
DrawSample
(
id
);
pdeSolver
->
Run
(
solution
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment