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
07ffc775
Commit
07ffc775
authored
Nov 25, 2020
by
niklas.baumgarten
Browse files
moved PDESolverCreator, and refactored TestPDESolver.cpp
parent
ec6efe55
Changes
8
Hide whitespace changes
Inline
Side-by-side
mlmc/src/generators/algorithms/HybridFluxGenerator.cpp
View file @
07ffc775
#include
"HybridFluxGenerator.hpp"
#include
"pdesolver/PDESolver.hpp"
#include
"pdesolver/PDESolver
Creator
.hpp"
void
HybridFaceNormalFluxGenerator
::
createPDESolver
()
{
...
...
mlmc/src/montecarlo/MultilevelMonteCarlo.hpp
View file @
07ffc775
...
...
@@ -7,6 +7,7 @@
#include
"montecarlo/datastructure/Errors.hpp"
#include
"basics/Utilities.hpp"
#include
"mesh/MeshesCreator.hpp"
class
MultilevelMonteCarlo
{
private:
...
...
mlmc/src/pdesolver/CMakeLists.txt
View file @
07ffc775
add_library
(
PDESOLVER STATIC
PDESolver.cpp
PDESolverCreator.cpp
assembling/LagrangeEllipticAssemble.cpp
assembling/MixedEllipticAssemble.cpp
assembling/HybridEllipticAssemble.cpp
...
...
mlmc/src/pdesolver/PDESolver.cpp
View file @
07ffc775
...
...
@@ -109,50 +109,3 @@ TimeSeries TransportPDESolver::createTimeSeries(SampleSolution &solution) {
double
h_max
=
solution
.
U
.
GetMesh
().
MeshWidth
().
second
;
return
TimeSeries
(
t0
,
T
,
CFL
*
h_max
,
"UniformTimeSeries"
);
}
PDESolver
*
PDESolverCreator
::
Create
()
{
if
(
_model
==
"LagrangeElliptic"
)
return
new
EllipticPDESolver
(
new
LagrangeEllipticAssemble
(
new
LagrangeDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"MixedElliptic"
)
return
new
EllipticPDESolver
(
new
MixedEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"HybridElliptic"
)
return
new
EllipticPDESolver
(
new
HybridEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGElliptic"
)
return
new
EllipticPDESolver
(
new
DGEllipticAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGTransport"
)
return
new
TransportPDESolver
(
new
DGTransportAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticTransportProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"PGTransport"
)
return
nullptr
;
// Todo open research question
Exit
(
_model
+
" not found"
)
}
mlmc/src/pdesolver/PDESolver.hpp
View file @
07ffc775
...
...
@@ -121,10 +121,12 @@ protected:
void
createOtherMatrixGraphs
(
Meshes
&
meshes
)
override
;
public:
EllipticPDESolver
(
IStochasticEllipticAssemble
*
assemble
)
:
EllipticPDESolver
(
IStochasticEllipticAssemble
*
assemble
,
std
::
string
pc
=
"SuperLU"
,
std
::
string
linearSolver
=
"GMRES"
)
:
PDESolver
(),
assemble
(
assemble
),
solver
(
Solver
(
GetPC
(
"SuperLU"
),
"GMRES"
)),
solver
(
Solver
(
GetPC
(
pc
),
linearSolver
)),
newton
(
Newton
(
solver
))
{
}
...
...
@@ -201,40 +203,4 @@ public:
}
};
class
PDESolverCreator
{
private:
std
::
string
_model
;
std
::
string
_problem
;
std
::
string
_quantity
;
int
_degree
=
1
;
Meshes
&
meshes
;
public:
PDESolverCreator
(
Meshes
&
meshes
)
:
meshes
(
meshes
)
{}
PDESolverCreator
WithModel
(
const
std
::
string
&
model
)
{
_model
=
model
;
return
*
this
;
}
PDESolverCreator
WithProblem
(
const
std
::
string
&
problem
)
{
_problem
=
problem
;
return
*
this
;
}
PDESolverCreator
WithDegree
(
int
degree
)
{
_degree
=
degree
;
return
*
this
;
}
PDESolverCreator
WithQuantity
(
const
std
::
string
&
quantity
)
{
_quantity
=
quantity
;
return
*
this
;
}
PDESolver
*
Create
();
};
#endif //PDESOLVER_HPP
mlmc/src/pdesolver/PDESolverCreator.cpp
0 → 100644
View file @
07ffc775
#include
"PDESolverCreator.hpp"
PDESolver
*
PDESolverCreator
::
Create
()
{
if
(
_model
==
"LagrangeElliptic"
)
return
new
EllipticPDESolver
(
new
LagrangeEllipticAssemble
(
new
LagrangeDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"MixedElliptic"
)
return
new
EllipticPDESolver
(
new
MixedEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"HybridElliptic"
)
return
new
EllipticPDESolver
(
new
HybridEllipticAssemble
(
new
RTLagrangeDiscretization
(
meshes
,
0
,
0
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGElliptic"
)
return
new
EllipticPDESolver
(
new
DGEllipticAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticEllipticProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"DGTransport"
)
return
new
TransportPDESolver
(
new
DGTransportAssemble
(
new
DGDiscretization
(
meshes
,
_degree
),
CreateStochasticTransportProblem
(
_problem
,
meshes
)
)
);
if
(
_model
==
"PGTransport"
)
return
nullptr
;
// Todo open research question
Exit
(
_model
+
" not found"
)
}
\ No newline at end of file
mlmc/src/pdesolver/PDESolverCreator.hpp
0 → 100644
View file @
07ffc775
#ifndef PDESOLVERCREATOR_HPP
#define PDESOLVERCREATOR_HPP
#include
"PDESolver.hpp"
class
PDESolverCreator
{
private:
std
::
string
_model
;
std
::
string
_problem
;
std
::
string
_quantity
;
std
::
string
_pc
;
std
::
string
_linearSolver
;
int
_degree
=
1
;
Meshes
&
meshes
;
public:
PDESolverCreator
(
Meshes
&
meshes
)
:
meshes
(
meshes
)
{}
PDESolverCreator
WithModel
(
const
std
::
string
&
model
)
{
_model
=
model
;
return
*
this
;
}
PDESolverCreator
WithProblem
(
const
std
::
string
&
problem
)
{
_problem
=
problem
;
return
*
this
;
}
PDESolverCreator
WithDegree
(
int
degree
)
{
_degree
=
degree
;
return
*
this
;
}
PDESolverCreator
WithQuantity
(
const
std
::
string
&
quantity
)
{
_quantity
=
quantity
;
return
*
this
;
}
PDESolver
*
Create
();
};
#endif //PDESOLVERCREATOR_HPP
mlmc/tests/pdesolver/TestPDESolver.cpp
View file @
07ffc775
#include
"pdesolver/PDESolver.hpp"
#include
"pdesolver/PDESolver
Creator
.hpp"
#include
"TestEnvironment.hpp"
...
...
@@ -21,10 +21,7 @@ protected:
SampleID
dummyID
;
TestPDESolver
(
const
std
::
string
&
meshName
)
{
dummyID
.
level
=
Level
(
6
,
0
);
dummyID
.
coarse
=
false
;
dummyID
.
number
=
-
1
;
TestPDESolver
(
const
std
::
string
&
meshName
)
:
dummyID
(
6
,
0
,
false
)
{
meshes
=
createTestMeshes
(
meshName
,
dummyID
.
level
.
pLevel
,
dummyID
.
level
.
fine
);
...
...
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