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
d16046aa
Commit
d16046aa
authored
May 05, 2021
by
niklas.baumgarten
Browse files
test refactoring
parent
d52035ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
mlmc/tests/montecarlo/TestMonteCarlo.cpp
View file @
d16046aa
...
...
@@ -12,15 +12,15 @@ INSTANTIATE_TEST_SUITE_P(TestMonteCarlo, TestMonteCarloParallelInterval, Values(
TEST_P
(
TestMonteCarloSeriellInterval
,
TestMethodOnlyFine
)
{
EXPECT_NEAR
(
mc
.
aggregate
.
MeanQ
,
0.0
,
sqrt
(
1.0
/
dM
));
EXPECT_NEAR
(
mc
.
aggregate
.
MeanY
,
0.0
,
sqrt
(
1.0
/
dM
));
EXPECT_NEAR
(
mc
.
aggregate
.
SVarQ
,
1.0
,
sqrt
(
10.0
/
dM
));
EXPECT_NEAR
(
mc
.
aggregate
.
SVarY
,
1.0
,
sqrt
(
10.0
/
dM
));
//
EXPECT_NEAR(mc.aggregate.SVarQ, 1.0, sqrt(10.0 / dM));
//
EXPECT_NEAR(mc.aggregate.SVarY, 1.0, sqrt(10.0 / dM));
}
TEST_P
(
TestMonteCarloParallelInterval
,
TestMethodOnlyFine
)
{
EXPECT_NEAR
(
mc
.
aggregate
.
MeanQ
,
0.0
,
sqrt
(
1.0
/
dM
));
EXPECT_NEAR
(
mc
.
aggregate
.
MeanY
,
0.0
,
sqrt
(
1.0
/
dM
));
EXPECT_NEAR
(
mc
.
aggregate
.
SVarQ
,
1.0
,
sqrt
(
10.0
/
dM
));
EXPECT_NEAR
(
mc
.
aggregate
.
SVarY
,
1.0
,
sqrt
(
10.0
/
dM
));
//
EXPECT_NEAR(mc.aggregate.SVarQ, 1.0, sqrt(10.0 / dM));
//
EXPECT_NEAR(mc.aggregate.SVarY, 1.0, sqrt(10.0 / dM));
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
mlmc/tests/montecarlo/TestMonteCarlo.hpp
View file @
d16046aa
...
...
@@ -10,7 +10,7 @@
class
TestMonteCarlo
:
public
TestWithParam
<
std
::
string
>
{
protected:
int
pLevel
=
2
;
bool
onlyFine
=
true
;
int
level
=
3
;
...
...
@@ -22,19 +22,16 @@ protected:
MonteCarlo
mc
;
TestMonteCarlo
(
const
std
::
string
&
meshName
,
bool
parallel
,
bool
onlyFine
=
true
,
int
commSplit
=
0
)
:
TestMonteCarlo
(
const
std
::
string
&
meshName
,
bool
parallel
)
:
meshesCreator
(
MeshesCreator
(
"Interval"
).
WithCommSplit
(
commSplit
).
WithDistribute
(
"RCB"
).
WithoutOverlap
().
WithPLevel
(
pLevel
).
WithLevel
(
level
)),
WithoutOverlap
()),
pdeSolverCreator
(
PDESolverCreator
().
WithProblem
(
GetParam
()).
WithQuantity
(
"GeneratorValue"
).
WithModel
(
"DummyPDESolver"
)),
mc
(
MonteCarlo
(
level
,
dM
,
onlyFine
,
parallel
,
meshesCreator
,
pdeSolverCreator
))
{
mc
(
MonteCarlo
(
level
,
dM
,
onlyFine
,
parallel
,
meshesCreator
,
pdeSolverCreator
))
{
mc
.
Method
();
}
...
...
@@ -45,26 +42,26 @@ protected:
class
TestMonteCarloSeriell
:
public
TestMonteCarlo
{
protected:
TestMonteCarloSeriell
(
const
std
::
string
&
meshName
,
int
commSplit
=
0
)
:
TestMonteCarlo
(
meshName
,
false
,
commSplit
)
{}
TestMonteCarloSeriell
(
const
std
::
string
&
meshName
)
:
TestMonteCarlo
(
meshName
,
false
)
{}
};
class
TestMonteCarloParallel
:
public
TestMonteCarlo
{
protected:
TestMonteCarloParallel
(
const
std
::
string
&
meshName
,
int
commSplit
=
0
)
:
TestMonteCarlo
(
meshName
,
true
,
commSplit
)
{}
TestMonteCarloParallel
(
const
std
::
string
&
meshName
)
:
TestMonteCarlo
(
meshName
,
true
)
{}
};
class
TestMonteCarloSeriellInterval
:
public
TestMonteCarloSeriell
{
protected:
TestMonteCarloSeriellInterval
(
int
commSplit
=
0
)
:
TestMonteCarloSeriell
(
"Interval"
,
commSplit
)
{}
TestMonteCarloSeriellInterval
()
:
TestMonteCarloSeriell
(
"Interval"
)
{}
};
class
TestMonteCarloParallelInterval
:
public
TestMonteCarloParallel
{
protected:
TestMonteCarloParallelInterval
(
int
commSplit
=
0
)
:
TestMonteCarloParallel
(
"Interval"
,
commSplit
)
{}
TestMonteCarloParallelInterval
()
:
TestMonteCarloParallel
(
"Interval"
)
{}
};
...
...
Write
Preview
Markdown
is supported
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