Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
090b6cf4
Commit
090b6cf4
authored
May 12, 2021
by
niklas.baumgarten
Browse files
removed basics lib
parent
65a65deb
Pipeline
#149256
failed with stages
in 15 minutes
Changes
21
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
mlmc/src/CMakeLists.txt
View file @
090b6cf4
add_subdirectory
(
basics
)
add_subdirectory
(
generators
)
add_subdirectory
(
problems
)
add_subdirectory
(
pdesolver
)
...
...
mlmc/src/basics/CMakeLists.txt
deleted
100644 → 0
View file @
65a65deb
add_library
(
BASICS STATIC
Utilities.cpp
)
target_link_libraries
(
BASICS MPP_LIBRARIES
)
\ No newline at end of file
mlmc/src/basics/Utilities.cpp
deleted
100644 → 0
View file @
65a65deb
#include
"Utilities.hpp"
#include
<sstream>
template
<
>
std
::
string
vec2str
<
int
>
(
std
::
vector
<
int
>
vec
)
{
std
::
string
str
=
"["
;
for
(
unsigned
long
i
=
0
;
i
<
vec
.
size
();
i
++
)
{
if
(
i
!=
vec
.
size
()
-
1
)
str
+=
std
::
to_string
(
vec
[
i
])
+
", "
;
else
str
+=
std
::
to_string
(
vec
[
i
]);
}
return
(
str
+
"]"
);
}
template
<
>
std
::
string
vec2str
<
double
>
(
std
::
vector
<
double
>
vec
)
{
std
::
string
str
=
"["
;
for
(
unsigned
long
i
=
0
;
i
<
vec
.
size
();
i
++
)
{
std
::
ostringstream
streamObj
;
if
(
i
!=
vec
.
size
()
-
1
)
{
streamObj
<<
vec
[
i
];
str
+=
streamObj
.
str
()
+
", "
;
}
else
{
streamObj
<<
vec
[
i
];
str
+=
streamObj
.
str
();
}
}
return
(
str
+
"]"
);
}
template
<
>
std
::
string
vec2str
<
std
::
string
>
(
std
::
vector
<
std
::
string
>
vec
)
{
std
::
string
str
=
"["
;
for
(
unsigned
long
i
=
0
;
i
<
vec
.
size
();
i
++
)
{
if
(
i
!=
vec
.
size
()
-
1
)
str
+=
vec
[
i
]
+
", "
;
else
str
+=
vec
[
i
];
}
return
(
str
+
"]"
);
}
mlmc/src/basics/Utilities.hpp
deleted
100644 → 0
View file @
65a65deb
#ifndef TOOLS_HPP
#define TOOLS_HPP
#include
"RVector.hpp"
#include
"CVector.hpp"
#include
"RMatrix.hpp"
#include
"CMatrix.hpp"
#include
<vector>
#include
<string>
#include
<math.h>
template
<
typename
T
>
std
::
string
vec2str
(
std
::
vector
<
T
>
vec
);
#endif //TOOLS_HPP
mlmc/src/estimators/MultilevelEstimator.hpp
View file @
090b6cf4
...
...
@@ -5,7 +5,6 @@
#include
"MonteCarlo.hpp"
#include
"Exponents.hpp"
#include
"MultilevelErrors.hpp"
#include
"Utilities.hpp"
#include
"Estimator.hpp"
...
...
mlmc/src/estimators/datastructure/LevelMaps.cpp
View file @
090b6cf4
...
...
@@ -2,6 +2,43 @@
#include
"MultilevelEstimator.hpp"
template
<
>
std
::
string
vec2str
<
int
>
(
std
::
vector
<
int
>
vec
)
{
std
::
string
str
=
"["
;
for
(
unsigned
long
i
=
0
;
i
<
vec
.
size
();
i
++
)
{
if
(
i
!=
vec
.
size
()
-
1
)
str
+=
std
::
to_string
(
vec
[
i
])
+
", "
;
else
str
+=
std
::
to_string
(
vec
[
i
]);
}
return
(
str
+
"]"
);
}
template
<
>
std
::
string
vec2str
<
double
>
(
std
::
vector
<
double
>
vec
)
{
std
::
string
str
=
"["
;
for
(
unsigned
long
i
=
0
;
i
<
vec
.
size
();
i
++
)
{
std
::
ostringstream
streamObj
;
if
(
i
!=
vec
.
size
()
-
1
)
{
streamObj
<<
vec
[
i
];
str
+=
streamObj
.
str
()
+
", "
;
}
else
{
streamObj
<<
vec
[
i
];
str
+=
streamObj
.
str
();
}
}
return
(
str
+
"]"
);
}
template
<
>
std
::
string
vec2str
<
std
::
string
>
(
std
::
vector
<
std
::
string
>
vec
)
{
std
::
string
str
=
"["
;
for
(
unsigned
long
i
=
0
;
i
<
vec
.
size
();
i
++
)
{
if
(
i
!=
vec
.
size
()
-
1
)
str
+=
vec
[
i
]
+
", "
;
else
str
+=
vec
[
i
];
}
return
(
str
+
"]"
);
}
void
EstimatorMap
::
UpdateSampleCounter
(
double
epsilon
)
{
int
optimalM
;
...
...
@@ -68,3 +105,15 @@ void KurtosisMap::Update(const EstimatorMap &estimatorMap) {
for
(
auto
&
[
level
,
estimator
]
:
estimatorMap
)
_levelMap
[
level
]
=
estimator
->
aggregate
.
kurtosis
;
}
void
MultilevelData
::
MultilevelResults
()
const
{
mout
.
PrintInfo
(
"Multilevel Results"
,
1
,
PrintInfoEntry
(
"E(Qf-Qc)"
,
vec2str
(
means
.
GetYVector
())),
PrintInfoEntry
(
"E(Qf)"
,
vec2str
(
means
.
GetQVector
())),
PrintInfoEntry
(
"V(Qf-Qc)"
,
vec2str
(
sVars
.
GetYVector
())),
PrintInfoEntry
(
"V(Qf)"
,
vec2str
(
sVars
.
GetQVector
())),
PrintInfoEntry
(
"kurtosis"
,
vec2str
(
kurtosis
.
GetYVector
())),
PrintInfoEntry
(
"E(cost)"
,
vec2str
(
means
.
GetCostVector
())),
PrintInfoEntry
(
"Used Levels"
,
vec2str
(
means
.
GetLevelVector
())),
PrintInfoEntry
(
"Used Samples"
,
vec2str
(
ctrs
.
GetMVector
())));
}
mlmc/src/estimators/datastructure/LevelMaps.hpp
View file @
090b6cf4
...
...
@@ -121,7 +121,8 @@ public:
}
};
template
<
typename
T
>
std
::
string
vec2str
(
std
::
vector
<
T
>
vec
);
struct
EstimatorMap
;
...
...
@@ -207,17 +208,7 @@ struct MultilevelData {
kurtosis
.
Update
(
estimatorMap
);
}
void
MultilevelResults
()
const
{
mout
.
PrintInfo
(
"Multilevel Results"
,
1
,
PrintInfoEntry
(
"E(Qf-Qc)"
,
vec2str
(
means
.
GetYVector
())),
PrintInfoEntry
(
"E(Qf)"
,
vec2str
(
means
.
GetQVector
())),
PrintInfoEntry
(
"V(Qf-Qc)"
,
vec2str
(
sVars
.
GetYVector
())),
PrintInfoEntry
(
"V(Qf)"
,
vec2str
(
sVars
.
GetQVector
())),
PrintInfoEntry
(
"kurtosis"
,
vec2str
(
kurtosis
.
GetYVector
())),
PrintInfoEntry
(
"E(cost)"
,
vec2str
(
means
.
GetCostVector
())),
PrintInfoEntry
(
"Used Levels"
,
vec2str
(
means
.
GetLevelVector
())),
PrintInfoEntry
(
"Used Samples"
,
vec2str
(
ctrs
.
GetMVector
())));
}
void
MultilevelResults
()
const
;
friend
Logging
&
operator
<<
(
Logging
&
s
,
const
MultilevelData
&
data
)
{
return
s
<<
"E(Qf-Qc)="
<<
data
.
means
.
GetYVector
()
<<
endl
...
...
mlmc/src/estimators/datastructure/WelfordAggregate.hpp
View file @
090b6cf4
#ifndef WELFORDAGGREGATE_HPP
#define WELFORDAGGREGATE_HPP
#include
"
basics/
Sample.hpp"
#include
"Sample.hpp"
#include
"Parallel.hpp"
...
...
mlmc/src/generators/CMakeLists.txt
View file @
090b6cf4
...
...
@@ -6,4 +6,4 @@ add_library(GENERATORS STATIC
algorithms/SymmetricCovariance.cpp
algorithms/HybridFluxGenerator.cpp
)
target_link_libraries
(
GENERATORS
BASICS
PDESOLVER sprng MPP_LIBRARIES
)
target_link_libraries
(
GENERATORS PDESOLVER sprng MPP_LIBRARIES
)
mlmc/src/
basic
s/Sample.hpp
→
mlmc/src/
generator
s/Sample.hpp
View file @
090b6cf4
File moved
mlmc/src/generators/algorithms/CirculantEmbedding.hpp
View file @
090b6cf4
...
...
@@ -3,9 +3,8 @@
#include
"SymmetricCovariance.hpp"
#include
"LagrangeDiscretization.hpp"
#include
"basics/Utilities.hpp"
#include
"Algebra.hpp"
#include
"
generators/
NormalDistribution.hpp"
#include
"NormalDistribution.hpp"
#include
"FFT.hpp"
...
...
mlmc/src/generators/algorithms/SymmetricCovariance.hpp
View file @
090b6cf4
#ifndef M_COVARIANCEFUNCTION_H
#define M_COVARIANCEFUNCTION_H
#include
"basics/Utilities.hpp"
#include
"Assertion.hpp"
#include
"RVector.hpp"
#include
"CVector.hpp"
...
...
mlmc/src/pdesolver/PDESolver.hpp
View file @
090b6cf4
...
...
@@ -5,7 +5,7 @@
#include
"assembling/IStochasticDummyAssemble.hpp"
// Imports from basics
#include
"
basics/
Sample.hpp"
#include
"Sample.hpp"
// Mpp imports
#include
"TimeIntegrator.hpp"
...
...
mlmc/src/problems/CMakeLists.txt
View file @
090b6cf4
...
...
@@ -3,4 +3,4 @@ add_library(PROBLEMS STATIC
StochasticEllipticProblem.cpp
StochasticTransportProblem.cpp
)
target_link_libraries
(
PROBLEMS GENERATORS
${
MPP_LIBRARIES
}
)
target_link_libraries
(
PROBLEMS GENERATORS MPP_LIBRARIES
)
mlmc/src/problems/IStochasticProblem.hpp
View file @
090b6cf4
...
...
@@ -2,7 +2,6 @@
#define ISTOCHASTICPROBLEM_HPP
#include
"Sample.hpp"
#include
"Utilities.hpp"
#include
"SampleGeneratorContainer.hpp"
#include
"Algebra.hpp"
...
...
@@ -14,13 +13,11 @@ protected:
const
Meshes
&
meshes
;
GeneratorNames
genNames
;
SampleGeneratorContainer
genContainer
;
public:
IStochasticProblem
(
Meshes
&
meshes
,
GeneratorNames
genNames
)
:
meshes
(
meshes
),
genNames
(
genNames
),
genContainer
(
genNames
,
meshes
)
{
meshes
(
meshes
),
genContainer
(
genNames
,
meshes
)
{
config
.
get
(
"ProblemVerbose"
,
verbose
);
}
...
...
@@ -28,12 +25,6 @@ public:
genContainer
.
DrawSample
(
id
);
}
virtual
void
PrintInfo
()
const
{
mout
.
PrintInfo
(
"Stochastic Problem"
,
verbose
,
PrintInfoEntry
(
"Problem Name"
,
Name
()),
PrintInfoEntry
(
"Generators"
,
vec2str
(
genNames
)));
};
virtual
string
Name
()
const
=
0
;
};
...
...
mlmc/tests/CMakeLists.txt
View file @
090b6cf4
...
...
@@ -9,8 +9,7 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/mlmc/tests/data/vtu)
file
(
MAKE_DIRECTORY
${
PROJECT_BINARY_DIR
}
/mlmc/tests/log
)
# ------- Unit Tests -------
add_mpp_test
(
basics/TestPlotting BASICS
)
add_mpp_test
(
generators/TestPlotting GENERATORS
)
add_mpp_test
(
generators/TestNormalDistribution GENERATORS
)
add_mpp_test
(
generators/TestUniformDistribution GENERATORS
)
add_mpp_test
(
generators/TestCirculantEmbedding GENERATORS
)
...
...
mlmc/tests/basics/TestSample.cpp
deleted
100644 → 0
View file @
65a65deb
// Todo
\ No newline at end of file
mlmc/tests/basics/TestUtilities.cpp
deleted
100644 → 0
View file @
65a65deb
// Todo
mlmc/tests/generators/TestNormalDistribution.cpp
View file @
090b6cf4
#include
"generators/NormalDistribution.hpp"
#include
"basics/Utilities.hpp"
#include
"TestEnvironment.hpp"
#include
"MeshesCreator.hpp"
...
...
mlmc/tests/
basic
s/TestPlotting.cpp
→
mlmc/tests/
generator
s/TestPlotting.cpp
View file @
090b6cf4
#include
"
basics/
Sample.hpp"
#include
"Sample.hpp"
#include
"RTLagrangeDiscretization.hpp"
#include
"LagrangeDiscretization.hpp"
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment