deal.II version 9.7.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
slepc_spectral_transformation.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2009 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
16
17#ifdef DEAL_II_WITH_SLEPC
18
21
22# include <petscversion.h>
23
24# include <cmath>
25# include <vector>
26
28
29namespace SLEPcWrappers
30{
32 {
33 const PetscErrorCode ierr = STCreate(mpi_communicator, &st);
34 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
35 }
36
38 {
39 if (st != nullptr)
40 {
41 const PetscErrorCode ierr = STDestroy(&st);
43 }
44 }
45
46 void
48 {
49 const PetscErrorCode ierr = STSetMatMode(st, mode);
50 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
51 }
52
53 void
55 {
56 PetscErrorCode ierr = STSetKSP(st, solver);
57 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
58 }
59
60 /* ------------------- TransformationShift --------------------- */
61
66
68 const AdditionalData &data)
69 : TransformationBase(mpi_communicator)
70 , additional_data(data)
71 {
72 PetscErrorCode ierr = STSetType(st, const_cast<char *>(STSHIFT));
73 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
74
75 ierr = STSetShift(st, additional_data.shift_parameter);
76 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
77 }
78
79 /* ---------------- TransformationShiftInvert ------------------ */
80
85
87 const MPI_Comm mpi_communicator,
88 const AdditionalData &data)
89 : TransformationBase(mpi_communicator)
90 , additional_data(data)
91 {
92 PetscErrorCode ierr = STSetType(st, const_cast<char *>(STSINVERT));
93 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
94
95 ierr = STSetShift(st, additional_data.shift_parameter);
96 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
97 }
98
99 /* ------------------- TransformationCayley --------------------- */
100
107
109 const AdditionalData &data)
110 : TransformationBase(mpi_communicator)
111 , additional_data(data)
112 {
113 PetscErrorCode ierr = STSetType(st, const_cast<char *>(STCAYLEY));
114 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
115
116 ierr = STSetShift(st, additional_data.shift_parameter);
117 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
118
119 ierr = STCayleySetAntishift(st, additional_data.antishift_parameter);
120 AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
121 }
122
123} // namespace SLEPcWrappers
124
126
127#endif // DEAL_II_WITH_SLEPC
TransformationBase(const MPI_Comm mpi_communicator)
void set_solver(const PETScWrappers::SolverBase &solver)
TransformationCayley(const MPI_Comm mpi_communicator, const AdditionalData &data=AdditionalData())
TransformationShiftInvert(const MPI_Comm mpi_communicator, const AdditionalData &data=AdditionalData())
TransformationShift(const MPI_Comm mpi_communicator, const AdditionalData &data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
static ::ExceptionBase & ExcSLEPcError(int arg1)
#define AssertNothrow(cond, exc)
#define AssertThrow(cond, exc)
AdditionalData(const double shift_parameter=0, const double antishift_parameter=0)