Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Backofen, Rainer
amdis
Commits
b26c7ec3
Commit
b26c7ec3
authored
Nov 14, 2011
by
Thomas Witkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PetscSolverGlobalMatrix works now for multiple rhs.
parent
e73db218
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
+29
-20
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
+28
-18
AMDiS/src/parallel/PetscSolverGlobalMatrix.h
AMDiS/src/parallel/PetscSolverGlobalMatrix.h
+1
-2
No files found.
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
View file @
b26c7ec3
...
@@ -94,6 +94,20 @@ namespace AMDiS {
...
@@ -94,6 +94,20 @@ namespace AMDiS {
MatAssemblyBegin
(
petscMatrix
,
MAT_FINAL_ASSEMBLY
);
MatAssemblyBegin
(
petscMatrix
,
MAT_FINAL_ASSEMBLY
);
MatAssemblyEnd
(
petscMatrix
,
MAT_FINAL_ASSEMBLY
);
MatAssemblyEnd
(
petscMatrix
,
MAT_FINAL_ASSEMBLY
);
// === Init PETSc solver. ===
KSPCreate
(
PETSC_COMM_WORLD
,
&
solver
);
KSPGetPC
(
solver
,
&
pc
);
KSPSetOperators
(
solver
,
petscMatrix
,
petscMatrix
,
SAME_NONZERO_PATTERN
);
KSPSetTolerances
(
solver
,
0.0
,
1e-8
,
PETSC_DEFAULT
,
PETSC_DEFAULT
);
KSPSetType
(
solver
,
KSPBCGS
);
KSPMonitorSet
(
solver
,
myKSPMonitor
,
PETSC_NULL
,
0
);
KSPSetFromOptions
(
solver
);
PCSetFromOptions
(
pc
);
// Do not delete the solution vector, use it for the initial guess.
if
(
!
zeroStartVector
)
KSPSetInitialGuessNonzero
(
solver
,
PETSC_TRUE
);
MSG
(
"Fill petsc matrix needed %.5f seconds
\n
"
,
MPI
::
Wtime
()
-
wtime
);
MSG
(
"Fill petsc matrix needed %.5f seconds
\n
"
,
MPI
::
Wtime
()
-
wtime
);
}
}
...
@@ -138,20 +152,6 @@ namespace AMDiS {
...
@@ -138,20 +152,6 @@ namespace AMDiS {
VecAssemblyEnd
(
petscSolVec
);
VecAssemblyEnd
(
petscSolVec
);
}
}
// === Init PETSc solver. ===
KSPCreate
(
PETSC_COMM_WORLD
,
&
solver
);
KSPGetPC
(
solver
,
&
pc
);
KSPSetOperators
(
solver
,
petscMatrix
,
petscMatrix
,
SAME_NONZERO_PATTERN
);
KSPSetTolerances
(
solver
,
0.0
,
1e-8
,
PETSC_DEFAULT
,
PETSC_DEFAULT
);
KSPSetType
(
solver
,
KSPBCGS
);
KSPMonitorSet
(
solver
,
myKSPMonitor
,
PETSC_NULL
,
0
);
KSPSetFromOptions
(
solver
);
PCSetFromOptions
(
pc
);
// Do not delete the solution vector, use it for the initial guess.
if
(
!
zeroStartVector
)
KSPSetInitialGuessNonzero
(
solver
,
PETSC_TRUE
);
// PETSc.
// PETSc.
KSPSolve
(
solver
,
petscRhsVec
,
petscSolVec
);
KSPSolve
(
solver
,
petscRhsVec
,
petscSolVec
);
...
@@ -182,17 +182,27 @@ namespace AMDiS {
...
@@ -182,17 +182,27 @@ namespace AMDiS {
// === Destroy PETSc's variables. ===
// === Destroy PETSc's variables. ===
#ifdef HAVE_PETSC_DEV
#ifdef HAVE_PETSC_DEV
MatDestroy
(
&
petscMatrix
);
VecDestroy
(
&
petscRhsVec
);
VecDestroy
(
&
petscRhsVec
);
#else
VecDestroy
(
petscRhsVec
);
#endif
}
void
PetscSolverGlobalMatrix
::
destroyMatrixData
()
{
FUNCNAME
(
"PetscSolverGlobalMatrix::destroyMatrixData()"
);
#ifdef HAVE_PETSC_DEV
MatDestroy
(
&
petscMatrix
);
KSPDestroy
(
&
solver
);
VecDestroy
(
&
petscSolVec
);
VecDestroy
(
&
petscSolVec
);
VecDestroy
(
&
petscTmpVec
);
VecDestroy
(
&
petscTmpVec
);
KSPDestroy
(
&
solver
);
#else
#else
MatDestroy
(
petscMatrix
);
MatDestroy
(
petscMatrix
);
VecDestroy
(
petscRhsVec
);
KSPDestroy
(
solver
);
VecDestroy
(
petscSolVec
);
VecDestroy
(
petscSolVec
);
VecDestroy
(
petscTmpVec
);
VecDestroy
(
petscTmpVec
);
KSPDestroy
(
solver
);
#endif
#endif
}
}
...
...
AMDiS/src/parallel/PetscSolverGlobalMatrix.h
View file @
b26c7ec3
...
@@ -50,8 +50,7 @@ namespace AMDiS {
...
@@ -50,8 +50,7 @@ namespace AMDiS {
void
solvePetscMatrix
(
SystemVector
&
vec
,
AdaptInfo
*
adaptInfo
);
void
solvePetscMatrix
(
SystemVector
&
vec
,
AdaptInfo
*
adaptInfo
);
void
destroyMatrixData
()
void
destroyMatrixData
();
{}
protected:
protected:
/// Creates a new non zero pattern structure for the PETSc matrix.
/// Creates a new non zero pattern structure for the PETSc matrix.
...
...
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