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
6d463004
Commit
6d463004
authored
Jul 10, 2021
by
niklas.baumgarten
Browse files
added 2D dummy problem
parent
110af1a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
mluq/src/problems/IStochasticProblem.cpp
View file @
6d463004
...
...
@@ -21,5 +21,7 @@ CreateStochasticDummyProblem(const std::string &problemName, const Meshes &meshe
return
new
CMatrixGeneratorProblem
(
meshes
);
if
(
problemName
==
"SparseGrid1DGeneratorProblem"
)
return
new
SparseGrid1DGeneratorProblem
(
meshes
);
if
(
problemName
==
"SparseGrid2DGeneratorProblem"
)
return
new
SparseGrid2DGeneratorProblem
(
meshes
);
Exit
(
problemName
+
" not found"
)
}
\ No newline at end of file
mluq/src/problems/IStochasticProblem.hpp
View file @
6d463004
...
...
@@ -206,6 +206,30 @@ public:
}
};
class
SparseGrid2DGeneratorProblem
:
public
StochasticDummyProblem
{
SparseGridGenerator
generator
;
public:
explicit
SparseGrid2DGeneratorProblem
(
const
Meshes
&
meshes
)
:
StochasticDummyProblem
(
meshes
),
generator
(
SparseGridGenerator
(
meshes
,
2
,
0
,
6
))
{}
void
DrawSample
(
const
SampleID
&
id
)
override
{
generator
.
DrawSample
(
id
);
}
double
FunctionEvaluation
()
override
{
RVector
sample
=
this
->
generator
.
EvalSample
();
double
y1
=
sample
[
0
];
double
y2
=
sample
[
1
];
return
std
::
exp
(
-
y1
*
y1
)
*
std
::
cos
(
y2
);
}
string
Name
()
const
override
{
return
"SparseGrid2DGeneratorProblem"
;
}
};
StochasticDummyProblem
*
CreateStochasticDummyProblem
(
const
std
::
string
&
problemName
,
const
Meshes
&
meshes
);
...
...
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