Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
0a79fc7f
Commit
0a79fc7f
authored
Nov 06, 2012
by
Thomas Witkowski
Browse files
Added some support for block preconditioners.
parent
842726b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.cc
View file @
0a79fc7f
...
...
@@ -92,11 +92,12 @@ namespace AMDiS {
matAssembly
();
// === Init PETSc solver. ===
KSPCreate
(
mpiCommGlobal
,
&
kspInterior
);
KSPSetOperators
(
kspInterior
,
getMatInterior
(),
getMatInterior
(),
SAME_NONZERO_PATTERN
);
KSPSetFromOptions
(
kspInterior
);
// === Init PETSc solver and preconditioner objects. ===
initSolver
(
kspInterior
);
KSPGetPC
(
kspInterior
,
&
pcInterior
);
initPreconditioner
(
pcInterior
);
MSG
(
"Fill petsc matrix needed %.5f seconds
\n
"
,
MPI
::
Wtime
()
-
wtime
);
}
...
...
@@ -131,14 +132,45 @@ namespace AMDiS {
}
void
PetscSolverGlobalBlockMatrix
::
initSolver
(
KSP
&
ksp
)
{
FUNCNAME
(
"PetscSolverGlobalBlockMatrix::initSolver()"
);
KSPCreate
(
mpiCommGlobal
,
&
ksp
);
KSPSetOperators
(
ksp
,
getMatInterior
(),
getMatInterior
(),
SAME_NONZERO_PATTERN
);
KSPSetOptionsPrefix
(
ksp
,
kspPrefix
.
c_str
());
KSPSetFromOptions
(
ksp
);
}
void
PetscSolverGlobalBlockMatrix
::
exitSolver
(
KSP
ksp
)
{
FUNCNAME
(
"PetscSolverGlobalBlockMatrix::exitSolver()"
);
KSPDestroy
(
&
ksp
);
}
void
PetscSolverGlobalBlockMatrix
::
initPreconditioner
(
PC
pc
)
{
FUNCNAME
(
"PetscSolverGlobalBlockMatrix::initPreconditioner()"
);
PCSetFromOptions
(
pc
);
}
void
PetscSolverGlobalBlockMatrix
::
exitPreconditioner
(
PC
pc
)
{
FUNCNAME
(
"PetscSolverGlobalBlockMatrix::exitPreconditioner()"
);
}
void
PetscSolverGlobalBlockMatrix
::
solvePetscMatrix
(
SystemVector
&
vec
,
AdaptInfo
*
adaptInfo
)
{
FUNCNAME
(
"PetscSolverGlobalBlockMatrix::solvePetscMatrix()"
);
KSPGetPC
(
kspInterior
,
&
pcInterior
);
setBlockPreconditioner
(
pcInterior
);
const
FiniteElemSpace
*
feSpace
=
componentSpaces
[
0
];
VecDuplicate
(
getVecRhsInterior
(),
&
petscSolVec
);
...
...
@@ -181,7 +213,9 @@ namespace AMDiS {
matDestroy
();
KSPDestroy
(
&
kspInterior
);
exitPreconditioner
(
pcInterior
);
exitSolver
(
kspInterior
);
}
...
...
AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.h
View file @
0a79fc7f
...
...
@@ -58,12 +58,14 @@ namespace AMDiS {
/// Takes a DOF vector and sends its values to a given PETSc vector.
void
setDofVector
(
Vec
&
petscVec
,
DOFVector
<
double
>*
vec
);
virtual
void
initSolver
(
KSP
&
ksp
);
virtual
void
setBlockPreconditioner
(
PC
&
pc
)
{
PCSetFromOptions
(
pc
);
}
virtual
void
exitSolver
(
KSP
ksp
);
virtual
void
initPreconditioner
(
PC
pc
);
virtual
void
exitPreconditioner
(
PC
pc
);
protected:
vector
<
Mat
>
nestMat
;
...
...
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