Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romin Tomasetti
gmsh
Commits
f0ae40e8
Commit
f0ae40e8
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
support for petsc-dev
parent
48310585
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Solver/eigenSolver.cpp
+11
-0
11 additions, 0 deletions
Solver/eigenSolver.cpp
Solver/linearSystemPETSc.cpp
+6
-0
6 additions, 0 deletions
Solver/linearSystemPETSc.cpp
Solver/linearSystemPETSc.hpp
+18
-2
18 additions, 2 deletions
Solver/linearSystemPETSc.hpp
with
35 additions
and
2 deletions
Solver/eigenSolver.cpp
+
11
−
0
View file @
f0ae40e8
...
...
@@ -105,8 +105,10 @@ bool eigenSolver::solve(int numEigenValues, std::string which)
Msg
::
Error
(
"SLEPc diverged after %d iterations"
,
its
);
else
if
(
reason
==
EPS_DIVERGED_BREAKDOWN
)
Msg
::
Error
(
"SLEPc generic breakdown in method"
);
#if !(PETSC_VERSION_RELEASE == 0) // petsc-dev
else
if
(
reason
==
EPS_DIVERGED_NONSYMMETRIC
)
Msg
::
Error
(
"The operator is nonsymmetric"
);
#endif
// get number of converged approximate eigenpairs
PetscInt
nconv
;
...
...
@@ -152,11 +154,20 @@ bool eigenSolver::solve(int numEigenValues, std::string which)
}
_eigenVectors
.
push_back
(
ev
);
}
#if (PETSC_VERSION_RELEASE == 0) // petsc-dev
_try
(
VecDestroy
(
&
xr
));
_try
(
VecDestroy
(
&
xi
));
#else
_try
(
VecDestroy
(
xr
));
_try
(
VecDestroy
(
xi
));
#endif
}
#if (PETSC_VERSION_RELEASE == 0) // petsc-dev
_try
(
EPSDestroy
(
&
eps
));
#else
_try
(
EPSDestroy
(
eps
));
#endif
if
(
reason
==
EPS_CONVERGED_TOL
){
Msg
::
Debug
(
"SLEPc done"
);
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.cpp
+
6
−
0
View file @
f0ae40e8
...
...
@@ -145,9 +145,15 @@ bool linearSystemPETScBlockDouble::isAllocated() const
void
linearSystemPETScBlockDouble
::
clear
()
{
if
(
_isAllocated
){
#if (PETSC_VERSION_RELEASE == 0) // petsc-dev
MatDestroy
(
&
_a
);
VecDestroy
(
&
_x
);
VecDestroy
(
&
_b
);
#else
MatDestroy
(
_a
);
VecDestroy
(
_x
);
VecDestroy
(
_b
);
#endif
}
_isAllocated
=
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.hpp
+
18
−
2
View file @
f0ae40e8
...
...
@@ -2,6 +2,12 @@
#include
<petsc.h>
#include
<petscksp.h>
#include
"linearSystemPETSc.h"
#if (PETSC_VERSION_RELEASE == 0) // petsc-dev
#define PetscTruth PetscBool
#define PetscOptionsGetTruth PetscOptionsGetBool
#endif
static
void
_try
(
int
ierr
)
{
CHKERRABORT
(
PETSC_COMM_WORLD
,
ierr
);
...
...
@@ -40,7 +46,11 @@ linearSystemPETSc<scalar>::~linearSystemPETSc()
{
clear
();
if
(
_kspAllocated
)
#if (PETSC_VERSION_RELEASE == 0) // petsc-dev
_try
(
KSPDestroy
(
&
_ksp
));
#else
_try
(
KSPDestroy
(
_ksp
));
#endif
}
template
<
class
scalar
>
...
...
@@ -141,9 +151,15 @@ template <class scalar>
void
linearSystemPETSc
<
scalar
>::
clear
()
{
if
(
_isAllocated
){
#if (PETSC_VERSION_RELEASE == 0) // petsc-dev
_try
(
MatDestroy
(
&
_a
));
_try
(
VecDestroy
(
&
_x
));
_try
(
VecDestroy
(
&
_b
));
#else
_try
(
MatDestroy
(
_a
));
_try
(
VecDestroy
(
_x
));
_try
(
VecDestroy
(
_b
));
#endif
}
_isAllocated
=
false
;
}
...
...
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