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
e3c9f317
Commit
e3c9f317
authored
Apr 13, 2021
by
niklas.baumgarten
Browse files
started to remove Level in SampleID
parent
fc54d895
Changes
4
Hide whitespace changes
Inline
Side-by-side
mlmc/src/basics/Sample.hpp
View file @
e3c9f317
...
...
@@ -9,76 +9,89 @@
struct
SampleID
{
Level
level
;
private:
Level
level
;
public:
int
fLevel
;
int
cLevel
;
std
::
string
name
;
std
::
string
name
;
int
number
;
int
number
;
bool
coarse
;
// Todo should be; SampleID makes more sense then
bool
coarse
;
// Todo should be; SampleID makes more sense then
SampleID
()
{}
SampleID
()
{}
SampleID
(
Level
level
,
int
number
,
bool
coarse
,
const
std
::
string
&
name
=
"U"
)
:
level
(
level
),
number
(
number
),
coarse
(
coarse
),
name
(
name
)
{}
SampleID
(
Level
level
,
int
number
,
bool
coarse
,
const
std
::
string
&
name
=
"U"
)
:
level
(
level
),
number
(
number
),
coarse
(
coarse
),
name
(
name
)
{
fLevel
=
level
.
fine
;
cLevel
=
level
.
coarse
;
}
SampleID
(
int
level
,
int
number
,
bool
coarse
,
const
std
::
string
&
name
=
"U"
)
:
level
(
Level
(
level
)),
number
(
number
),
coarse
(
coarse
),
name
(
name
)
{}
SampleID
(
int
level
,
int
number
,
bool
coarse
,
const
std
::
string
&
name
=
"U"
)
:
level
(
Level
(
level
)),
number
(
number
),
coarse
(
coarse
),
name
(
name
)
{
fLevel
=
this
->
level
.
fine
;
cLevel
=
this
->
level
.
coarse
;
}
int
l
()
const
{
return
level
.
ActualLevel
(
coarse
);
};
int
l
()
const
{
if
(
coarse
)
return
cLevel
;
else
return
fLevel
;
};
std
::
string
IdString
(
const
std
::
string
&
name_
)
const
{
return
name_
+
"."
+
std
::
to_string
(
level
.
fine
)
+
"."
+
std
::
to_string
((
int
)
coarse
)
+
"."
+
std
::
to_string
(
number
);
}
std
::
string
IdString
(
const
std
::
string
&
name_
)
const
{
return
name_
+
"."
+
std
::
to_string
(
level
.
fine
)
+
"."
+
std
::
to_string
((
int
)
coarse
)
+
"."
+
std
::
to_string
(
number
);
}
std
::
string
IdString
()
const
{
return
IdString
(
name
);
}
std
::
string
IdString
()
const
{
return
IdString
(
name
);
}
};
struct
SampleSolution
{
SampleID
id
;
SampleID
id
;
public:
double
Q
;
double
Cost
;
Vector
U
;
SampleSolution
(
IDiscretization
*
disc
,
const
std
::
string
&
name
=
"U"
)
:
U
(
Vector
((
*
disc
)))
{
this
->
id
.
name
=
name
;
Init
();
}
SampleSolution
(
IDiscretization
*
disc
,
const
SampleID
&
id
,
const
std
::
string
&
name
=
"U"
)
:
id
(
id
),
U
(
Vector
(
*
disc
,
id
.
l
()))
{
this
->
id
.
name
=
name
;
Init
();
}
SampleSolution
(
const
Vector
&
U
,
const
SampleID
&
id
,
const
std
::
string
&
name
=
"U"
)
:
id
(
id
),
U
(
U
)
{
this
->
id
.
name
=
name
;
}
std
::
string
IdString
()
const
{
return
id
.
IdString
();
}
const
SampleID
&
Id
()
const
{
return
id
;
}
void
Init
()
{
Q
=
0.0
;
Cost
=
0.0
;
U
=
0.0
;
}
double
Q
;
double
Cost
;
Vector
U
;
SampleSolution
(
IDiscretization
*
disc
,
const
std
::
string
&
name
=
"U"
)
:
U
(
Vector
((
*
disc
)))
{
this
->
id
.
name
=
name
;
Init
();
}
SampleSolution
(
IDiscretization
*
disc
,
const
SampleID
&
id
,
const
std
::
string
&
name
=
"U"
)
:
id
(
id
),
U
(
Vector
(
*
disc
,
id
.
l
()))
{
this
->
id
.
name
=
name
;
Init
();
}
SampleSolution
(
const
Vector
&
U
,
const
SampleID
&
id
,
const
std
::
string
&
name
=
"U"
)
:
id
(
id
),
U
(
U
)
{
this
->
id
.
name
=
name
;
}
std
::
string
IdString
()
const
{
return
id
.
IdString
();
}
const
SampleID
&
Id
()
const
{
return
id
;
}
void
Init
()
{
Q
=
0.0
;
Cost
=
0.0
;
U
=
0.0
;
}
};
#endif //SAMPLE_HPP
mlmc/src/montecarlo/MonteCarlo.hpp
View file @
e3c9f317
...
...
@@ -72,9 +72,9 @@ public:
meshes
=
meshesCreator
.
Create
();
pdeSolver
=
pdeSolverCreator
.
Create
(
*
meshes
);
fineId
.
l
evel
=
level
;
fineId
.
fL
evel
=
level
.
fine
;
fineId
.
coarse
=
false
;
coarseId
.
l
evel
=
level
;
coarseId
.
cL
evel
=
level
.
coarse
;
coarseId
.
coarse
=
true
;
ctr
.
parallel
=
parallel
;
ctr
.
UpdateSampleCounter
(
dM
);
...
...
mlmc/tests/basics/TestPlotting.cpp
View file @
e3c9f317
...
...
@@ -57,8 +57,8 @@ public:
std
::
filesystem
::
create_directory
(
"data/vtu/"
);
meshes
=
MeshesCreator
(
"Square"
).
WithPLevel
(
testIds
.
front
().
level
.
p
Level
).
WithLevel
(
testIds
.
back
().
l
evel
.
fine
).
WithPLevel
(
testIds
.
front
().
c
Level
).
WithLevel
(
testIds
.
back
().
fL
evel
).
Create
();
discs
=
{
...
...
mlmc/tests/pdesolver/TestPDESolver.hpp
View file @
e3c9f317
...
...
@@ -50,8 +50,8 @@ protected:
meshes
=
MeshesCreator
(
meshName
).
WithOverlap
(
GetParam
().
GetOverlap
()).
WithPLevel
(
id
.
level
.
p
Level
).
WithLevel
(
id
.
l
evel
.
fine
).
WithPLevel
(
id
.
c
Level
).
WithLevel
(
id
.
fL
evel
).
WithCommSplit
(
commSplit
).
WithDistribute
(
"RCB"
).
Create
();
...
...
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