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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
710cf434
Commit
710cf434
authored
10 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
support petsc 3.6
parent
7cae26a2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+13
-16
13 additions, 16 deletions
CMakeLists.txt
Solver/eigenSolver.cpp
+15
-3
15 additions, 3 deletions
Solver/eigenSolver.cpp
with
28 additions
and
19 deletions
CMakeLists.txt
+
13
−
16
View file @
710cf434
...
...
@@ -938,22 +938,19 @@ if(HAVE_SOLVER)
else
(
PETSC_ARCH
)
set
(
ENV_PETSC_ARCH $ENV{PETSC_ARCH}
)
endif
(
PETSC_ARCH
)
if
(
EXISTS
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/conf/petscvariables
)
set
(
PETSC_POSSIBLE_CONF_FILES
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/conf/petscvariables
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/lib/petsc-conf/petscvariables
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/lib/petsc/conf/petscvariables
)
foreach
(
FILE
${
PETSC_POSSIBLE_CONF_FILES
}
)
if
(
EXISTS
${
FILE
}
)
# old-style PETSc installations (using PETSC_DIR and PETSC_ARCH)
message
(
STATUS
"Using PETSc dir:
${
ENV_PETSC_DIR
}
"
)
message
(
STATUS
"Using PETSc arch:
${
ENV_PETSC_ARCH
}
"
)
# find includes by parsing the petscvariables file
file
(
STRINGS
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/conf/petscvariables
PETSC_VARIABLES NEWLINE_CONSUME
)
endif
(
EXISTS
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/conf/petscvariables
)
if
(
EXISTS
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/lib/petsc-conf/petscvariables
)
# old-style PETSc installations (using PETSC_DIR and PETSC_ARCH)
message
(
STATUS
"Using PETSc dir:
${
ENV_PETSC_DIR
}
"
)
message
(
STATUS
"Using PETSc arch:
${
ENV_PETSC_ARCH
}
"
)
# find includes by parsing the petscvariables file
file
(
STRINGS
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/lib/petsc-conf/petscvariables
PETSC_VARIABLES NEWLINE_CONSUME
)
endif
(
EXISTS
${
ENV_PETSC_DIR
}
/
${
ENV_PETSC_ARCH
}
/lib/petsc-conf/petscvariables
)
file
(
STRINGS
${
FILE
}
PETSC_VARIABLES NEWLINE_CONSUME
)
endif
(
EXISTS
${
FILE
}
)
endforeach
(
FILE
)
if
(
PETSC_VARIABLES
)
# try to find PETSC_CC_INCLUDES for PETSc >= 3.4
string
(
REGEX MATCH
"PETSC_CC_INCLUDES = [^
\n\r
]*"
PETSC_PACKAGES_INCLUDES
...
...
This diff is collapsed.
Click to expand it.
Solver/eigenSolver.cpp
+
15
−
3
View file @
710cf434
...
...
@@ -18,7 +18,8 @@ void eigenSolver::_try(int ierr) const
CHKERRABORT
(
PETSC_COMM_WORLD
,
ierr
);
}
eigenSolver
::
eigenSolver
(
dofManager
<
double
>
*
manager
,
std
::
string
A
,
std
::
string
B
,
bool
hermitian
)
eigenSolver
::
eigenSolver
(
dofManager
<
double
>
*
manager
,
std
::
string
A
,
std
::
string
B
,
bool
hermitian
)
:
_A
(
0
),
_B
(
0
),
_hermitian
(
hermitian
)
{
if
(
A
.
size
())
{
...
...
@@ -34,7 +35,8 @@ eigenSolver::eigenSolver(dofManager<double> *manager, std::string A, std::string
eigenSolver
::
eigenSolver
(
linearSystemPETSc
<
double
>
*
A
,
linearSystemPETSc
<
double
>
*
B
,
bool
hermitian
)
:
_A
(
A
),
_B
(
B
),
_hermitian
(
hermitian
)
{}
bool
eigenSolver
::
solve
(
int
numEigenValues
,
std
::
string
which
,
std
::
string
method
,
double
tolVal
,
int
iterMax
)
bool
eigenSolver
::
solve
(
int
numEigenValues
,
std
::
string
which
,
std
::
string
method
,
double
tolVal
,
int
iterMax
)
{
if
(
!
_A
)
return
false
;
Mat
A
=
_A
->
getMatrix
();
...
...
@@ -138,15 +140,24 @@ bool eigenSolver::solve(int numEigenValues, std::string which, std::string metho
if
(
nconv
>
0
)
{
Vec
xr
,
xi
;
#if (PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR < 6)
_try
(
MatGetVecs
(
A
,
PETSC_NULL
,
&
xr
));
_try
(
MatGetVecs
(
A
,
PETSC_NULL
,
&
xi
));
#else
_try
(
MatCreateVecs
(
A
,
PETSC_NULL
,
&
xr
));
_try
(
MatCreateVecs
(
A
,
PETSC_NULL
,
&
xi
));
#endif
Msg
::
Debug
(
" Re[EigenValue] Im[EigenValue]"
" Relative error"
);
for
(
int
i
=
0
;
i
<
nconv
;
i
++
)
{
PetscScalar
kr
,
ki
;
_try
(
EPSGetEigenpair
(
eps
,
i
,
&
kr
,
&
ki
,
xr
,
xi
));
PetscReal
error
;
#if (PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR < 6)
_try
(
EPSComputeRelativeError
(
eps
,
i
,
&
error
));
#else
_try
(
EPSComputeError
(
eps
,
i
,
EPS_ERROR_RELATIVE
,
&
error
));
#endif
#if defined(PETSC_USE_COMPLEX)
PetscReal
re
=
PetscRealPart
(
kr
);
PetscReal
im
=
PetscImaginaryPart
(
kr
);
...
...
@@ -189,7 +200,8 @@ bool eigenSolver::solve(int numEigenValues, std::string which, std::string metho
}
void
eigenSolver
::
normalize_mode
(
std
::
vector
<
int
>
modeView
,
double
scale
)
{
void
eigenSolver
::
normalize_mode
(
std
::
vector
<
int
>
modeView
,
double
scale
)
{
Msg
::
Info
(
"Normalize all eigenvectors"
);
for
(
unsigned
int
imode
=
0
;
imode
<
modeView
.
size
();
imode
++
)
{
int
i
=
modeView
[
imode
];
...
...
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