Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
podlesny
dune-tectonic
Commits
84c454f4
Commit
84c454f4
authored
11 years ago
by
Elias Pipping
Committed by
Elias Pipping
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Cleanup] Reinvent MySolver interface
parent
90e34fc1
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/mysolver.cc
+7
-7
7 additions, 7 deletions
src/mysolver.cc
src/mysolver.hh
+7
-8
7 additions, 8 deletions
src/mysolver.hh
src/mysolver_tmpl.cc
+9
-1
9 additions, 1 deletion
src/mysolver_tmpl.cc
src/one-body-sample.cc
+15
-11
15 additions, 11 deletions
src/one-body-sample.cc
with
38 additions
and
27 deletions
src/mysolver.cc
+
7
−
7
View file @
84c454f4
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
#include
"mysolver.hh"
#include
"mysolver.hh"
template
<
int
dim
,
class
MatrixType
,
class
Vector
Type
,
class
GridType
>
template
<
int
dim
,
class
BlockProblem
Type
,
class
GridType
>
MySolver
<
dim
,
MatrixType
,
Vector
Type
,
GridType
>::
MySolver
(
MySolver
<
dim
,
BlockProblem
Type
,
GridType
>::
MySolver
(
Dune
::
ParameterTree
const
&
parset
,
int
refinements
,
double
solver_tolerance
,
Dune
::
ParameterTree
const
&
parset
,
int
refinements
,
double
solver_tolerance
,
GridType
const
&
grid
,
Dune
::
BitSetVector
<
dim
>
const
&
ignoreNodes
)
GridType
const
&
grid
,
Dune
::
BitSetVector
<
dim
>
const
&
ignoreNodes
)
:
baseEnergyNorm
(
linearBaseSolverStep
),
:
baseEnergyNorm
(
linearBaseSolverStep
),
...
@@ -42,17 +42,17 @@ MySolver<dim, MatrixType, VectorType, GridType>::MySolver(
...
@@ -42,17 +42,17 @@ MySolver<dim, MatrixType, VectorType, GridType>::MySolver(
multigridStep
->
ignoreNodes_
=
&
ignoreNodes
;
multigridStep
->
ignoreNodes_
=
&
ignoreNodes
;
}
}
template
<
int
dim
,
class
MatrixType
,
class
Vector
Type
,
class
GridType
>
template
<
int
dim
,
class
BlockProblem
Type
,
class
GridType
>
MySolver
<
dim
,
MatrixType
,
Vector
Type
,
GridType
>::~
MySolver
()
{
MySolver
<
dim
,
BlockProblem
Type
,
GridType
>::~
MySolver
()
{
for
(
auto
&
x
:
transferOperators
)
for
(
auto
&
x
:
transferOperators
)
delete
x
;
delete
x
;
delete
multigridStep
;
delete
multigridStep
;
}
}
template
<
int
dim
,
class
MatrixType
,
class
Vector
Type
,
class
GridType
>
template
<
int
dim
,
class
BlockProblem
Type
,
class
GridType
>
typename
MySolver
<
dim
,
MatrixType
,
Vector
Type
,
GridType
>::
SolverType
*
typename
MySolver
<
dim
,
BlockProblem
Type
,
GridType
>::
SolverType
*
MySolver
<
dim
,
MatrixType
,
Vector
Type
,
GridType
>::
getSolver
()
{
MySolver
<
dim
,
BlockProblem
Type
,
GridType
>::
getSolver
()
{
return
multigridStep
;
return
multigridStep
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mysolver.hh
+
7
−
8
View file @
84c454f4
...
@@ -11,17 +11,16 @@
...
@@ -11,17 +11,16 @@
#include
<dune/tnnmg/iterationsteps/genericnonlineargs.hh>
#include
<dune/tnnmg/iterationsteps/genericnonlineargs.hh>
#include
<dune/solvers/transferoperators/compressedmultigridtransfer.hh>
#include
<dune/solvers/transferoperators/compressedmultigridtransfer.hh>
#include
<dune/tnnmg/iterationsteps/tnnmgstep.hh>
#include
<dune/tnnmg/iterationsteps/tnnmgstep.hh>
#include
<dune/tnnmg/problem-classes/convexproblem.hh>
#include
"dune/tectonic/myblockproblem.hh"
template
<
int
dim
,
class
BlockProblemTypeTEMPLATE
,
class
GridType
>
#include
"dune/tectonic/globalnonlinearity.hh"
template
<
int
dim
,
class
MatrixType
,
class
VectorType
,
class
GridType
>
class
MySolver
{
class
MySolver
{
public:
using
BlockProblemType
=
BlockProblemTypeTEMPLATE
;
using
ConvexProblemType
=
typename
BlockProblemType
::
ConvexProblemType
;
using
VectorType
=
typename
BlockProblemType
::
VectorType
;
using
MatrixType
=
typename
BlockProblemType
::
MatrixType
;
private:
private:
using
ConvexProblemType
=
ConvexProblem
<
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>
,
MatrixType
>
;
using
BlockProblemType
=
MyBlockProblem
<
ConvexProblemType
>
;
using
NonlinearSmootherType
=
GenericNonlinearGS
<
BlockProblemType
>
;
using
NonlinearSmootherType
=
GenericNonlinearGS
<
BlockProblemType
>
;
using
SolverType
=
TruncatedNonsmoothNewtonMultigrid
<
BlockProblemType
,
using
SolverType
=
TruncatedNonsmoothNewtonMultigrid
<
BlockProblemType
,
NonlinearSmootherType
>
;
NonlinearSmootherType
>
;
...
...
This diff is collapsed.
Click to expand it.
src/mysolver_tmpl.cc
+
9
−
1
View file @
84c454f4
...
@@ -13,6 +13,11 @@
...
@@ -13,6 +13,11 @@
#include
<dune/istl/bcrsmatrix.hh>
#include
<dune/istl/bcrsmatrix.hh>
#include
<dune/istl/bvector.hh>
#include
<dune/istl/bvector.hh>
#include
<dune/tnnmg/problem-classes/convexproblem.hh>
#include
<dune/tectonic/globalnonlinearity.hh>
#include
<dune/tectonic/myblockproblem.hh>
using
SmallVector
=
Dune
::
FieldVector
<
double
,
DIM
>
;
using
SmallVector
=
Dune
::
FieldVector
<
double
,
DIM
>
;
using
SmallMatrix
=
Dune
::
FieldMatrix
<
double
,
DIM
,
DIM
>
;
using
SmallMatrix
=
Dune
::
FieldMatrix
<
double
,
DIM
,
DIM
>
;
using
VectorType
=
Dune
::
BlockVector
<
SmallVector
>
;
using
VectorType
=
Dune
::
BlockVector
<
SmallVector
>
;
...
@@ -20,4 +25,7 @@ using MatrixType = Dune::BCRSMatrix<SmallMatrix>;
...
@@ -20,4 +25,7 @@ using MatrixType = Dune::BCRSMatrix<SmallMatrix>;
using
GridType
=
Dune
::
ALUGrid
<
DIM
,
DIM
,
Dune
::
simplex
,
Dune
::
nonconforming
>
;
using
GridType
=
Dune
::
ALUGrid
<
DIM
,
DIM
,
Dune
::
simplex
,
Dune
::
nonconforming
>
;
template
class
MySolver
<
DIM
,
MatrixType
,
VectorType
,
GridType
>;
template
class
MySolver
<
DIM
,
MyBlockProblem
<
ConvexProblem
<
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>,
MatrixType
>>
,
GridType
>
;
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
15
−
11
View file @
84c454f4
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
#include
<dune/tnnmg/problem-classes/convexproblem.hh>
#include
<dune/tnnmg/problem-classes/convexproblem.hh>
#include
<dune/tectonic/myblockproblem.hh>
#include
<dune/tectonic/myblockproblem.hh>
#include
<dune/tectonic/globalnonlinearity.hh>
#include
"assemblers.hh"
#include
"assemblers.hh"
#include
"mysolver.hh"
#include
"mysolver.hh"
...
@@ -168,6 +169,7 @@ int main(int argc, char *argv[]) {
...
@@ -168,6 +169,7 @@ int main(int argc, char *argv[]) {
using
SingletonMatrixType
=
Dune
::
BCRSMatrix
<
SmallSingletonMatrix
>
;
using
SingletonMatrixType
=
Dune
::
BCRSMatrix
<
SmallSingletonMatrix
>
;
using
VectorType
=
Dune
::
BlockVector
<
SmallVector
>
;
using
VectorType
=
Dune
::
BlockVector
<
SmallVector
>
;
using
SingletonVectorType
=
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>
;
using
SingletonVectorType
=
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>
;
using
NonlinearityType
=
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>
;
auto
const
E
=
parset
.
get
<
double
>
(
"body.E"
);
auto
const
E
=
parset
.
get
<
double
>
(
"body.E"
);
auto
const
nu
=
parset
.
get
<
double
>
(
"body.nu"
);
auto
const
nu
=
parset
.
get
<
double
>
(
"body.nu"
);
...
@@ -390,10 +392,14 @@ int main(int argc, char *argv[]) {
...
@@ -390,10 +392,14 @@ int main(int argc, char *argv[]) {
// Set up TNNMG solver
// Set up TNNMG solver
auto
const
solverTolerance
=
parset
.
get
<
double
>
(
"solver.tolerance"
);
auto
const
solverTolerance
=
parset
.
get
<
double
>
(
"solver.tolerance"
);
MySolver
<
dims
,
MatrixType
,
VectorType
,
GridType
>
solverHost
(
using
FactoryType
=
MySolver
<
parset
.
sub
(
"solver.tnnmg"
),
refinements
,
solverTolerance
,
*
grid
,
dims
,
velocityDirichletNodes
);
MyBlockProblem
<
ConvexProblem
<
auto
multigridStep
=
solverHost
.
getSolver
();
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>
,
MatrixType
>>
,
GridType
>
;
FactoryType
factory
(
parset
.
sub
(
"solver.tnnmg"
),
refinements
,
solverTolerance
,
*
grid
,
velocityDirichletNodes
);
auto
multigridStep
=
factory
.
getSolver
();
Solver
::
VerbosityMode
const
verbosity
=
Solver
::
VerbosityMode
const
verbosity
=
parset
.
get
<
bool
>
(
"verbose"
)
?
Solver
::
FULL
:
Solver
::
QUIET
;
parset
.
get
<
bool
>
(
"verbose"
)
?
Solver
::
FULL
:
Solver
::
QUIET
;
...
@@ -460,14 +466,12 @@ int main(int argc, char *argv[]) {
...
@@ -460,14 +466,12 @@ int main(int argc, char *argv[]) {
SingletonVectorType
const
&
_alpha
)
{
SingletonVectorType
const
&
_alpha
)
{
myGlobalNonlinearity
->
updateState
(
_alpha
);
myGlobalNonlinearity
->
updateState
(
_alpha
);
using
ConvexProblemType
=
ConvexProblem
<
Dune
::
GlobalNonlinearity
<
MatrixType
,
VectorType
>
,
MatrixType
>
;
// FIXME: Do we really need to pass u here?
// FIXME: Do we really need to pass u here?
ConvexProblemType
const
myConvexProblem
(
1.0
,
problem_AM
,
typename
FactoryType
::
ConvexProblemType
const
myConvexProblem
(
*
myGlobalNonlinearity
,
1.0
,
problem_AM
,
*
myGlobalNonlinearity
,
problem_rhs
,
problem_rhs
,
_problem_iterate
);
_problem_iterate
);
MyBlockProblem
<
Convex
ProblemType
>
velocityProblem
(
parset
,
typename
FactoryType
::
Block
ProblemType
velocityProblem
(
parset
,
myConvexProblem
);
myConvexProblem
);
multigridStep
->
setProblem
(
_problem_iterate
,
velocityProblem
);
multigridStep
->
setProblem
(
_problem_iterate
,
velocityProblem
);
velocityProblemSolver
.
preprocess
();
velocityProblemSolver
.
preprocess
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment