| 1887 |
jroman |
1 |
/*
|
|
|
2 |
QEP routines related to options that can be set via the command-line
|
|
|
3 |
or procedurally.
|
|
|
4 |
|
|
|
5 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
6 |
SLEPc - Scalable Library for Eigenvalue Problem Computations
|
|
|
7 |
Copyright (c) 2002-2009, Universidad Politecnica de Valencia, Spain
|
|
|
8 |
|
|
|
9 |
This file is part of SLEPc.
|
|
|
10 |
|
|
|
11 |
SLEPc is free software: you can redistribute it and/or modify it under the
|
|
|
12 |
terms of version 3 of the GNU Lesser General Public License as published by
|
|
|
13 |
the Free Software Foundation.
|
|
|
14 |
|
|
|
15 |
SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
16 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
17 |
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
|
18 |
more details.
|
|
|
19 |
|
|
|
20 |
You should have received a copy of the GNU Lesser General Public License
|
|
|
21 |
along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
|
|
|
22 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
#include "private/qepimpl.h" /*I "slepcqep.h" I*/
|
|
|
26 |
|
|
|
27 |
#undef __FUNCT__
|
|
|
28 |
#define __FUNCT__ "QEPSetFromOptions"
|
|
|
29 |
/*@
|
|
|
30 |
QEPSetFromOptions - Sets QEP options from the options database.
|
|
|
31 |
This routine must be called before QEPSetUp() if the user is to be
|
|
|
32 |
allowed to set the solver type.
|
|
|
33 |
|
|
|
34 |
Collective on QEP
|
|
|
35 |
|
|
|
36 |
Input Parameters:
|
|
|
37 |
. qep - the quadratic eigensolver context
|
|
|
38 |
|
|
|
39 |
Notes:
|
|
|
40 |
To see all options, run your program with the -help option.
|
|
|
41 |
|
|
|
42 |
Level: beginner
|
|
|
43 |
@*/
|
|
|
44 |
PetscErrorCode QEPSetFromOptions(QEP qep)
|
|
|
45 |
{
|
|
|
46 |
PetscErrorCode ierr;
|
|
|
47 |
char type[256],monfilename[PETSC_MAX_PATH_LEN];
|
| 1944 |
jroman |
48 |
PetscTruth flg,val;
|
| 1887 |
jroman |
49 |
PetscReal r;
|
|
|
50 |
PetscInt i,j,k;
|
|
|
51 |
PetscViewerASCIIMonitor monviewer;
|
| 1951 |
jroman |
52 |
QEPMONITOR_CONV *ctx;
|
| 1887 |
jroman |
53 |
|
|
|
54 |
PetscFunctionBegin;
|
|
|
55 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
56 |
ierr = PetscOptionsBegin(((PetscObject)qep)->comm,((PetscObject)qep)->prefix,"Quadratic Eigenvalue Problem (QEP) Solver Options","QEP");CHKERRQ(ierr);
|
|
|
57 |
ierr = PetscOptionsList("-qep_type","Quadratic Eigenvalue Problem method","QEPSetType",QEPList,(char*)(((PetscObject)qep)->type_name?((PetscObject)qep)->type_name:QEPLINEAR),type,256,&flg);CHKERRQ(ierr);
|
|
|
58 |
if (flg) {
|
|
|
59 |
ierr = QEPSetType(qep,type);CHKERRQ(ierr);
|
|
|
60 |
} else if (!((PetscObject)qep)->type_name) {
|
|
|
61 |
ierr = QEPSetType(qep,QEPLINEAR);CHKERRQ(ierr);
|
|
|
62 |
}
|
|
|
63 |
|
| 1907 |
jroman |
64 |
ierr = PetscOptionsTruthGroupBegin("-qep_general","general quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr);
|
|
|
65 |
if (flg) {ierr = QEPSetProblemType(qep,QEP_GENERAL);CHKERRQ(ierr);}
|
|
|
66 |
ierr = PetscOptionsTruthGroup("-qep_hermitian","hermitian quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr);
|
|
|
67 |
if (flg) {ierr = QEPSetProblemType(qep,QEP_HERMITIAN);CHKERRQ(ierr);}
|
|
|
68 |
ierr = PetscOptionsTruthGroupEnd("-qep_gyroscopic","gyroscopic quadratic eigenvalue problem","QEPSetProblemType",&flg);CHKERRQ(ierr);
|
|
|
69 |
if (flg) {ierr = QEPSetProblemType(qep,QEP_GYROSCOPIC);CHKERRQ(ierr);}
|
|
|
70 |
|
| 1918 |
jroman |
71 |
r = PETSC_IGNORE;
|
|
|
72 |
ierr = PetscOptionsReal("-qep_scale","Scale factor","QEPSetScaleFactor",qep->sfactor,&r,PETSC_NULL);CHKERRQ(ierr);
|
|
|
73 |
ierr = QEPSetScaleFactor(qep,r);CHKERRQ(ierr);
|
|
|
74 |
|
| 1887 |
jroman |
75 |
r = i = PETSC_IGNORE;
|
|
|
76 |
ierr = PetscOptionsInt("-qep_max_it","Maximum number of iterations","QEPSetTolerances",qep->max_it,&i,PETSC_NULL);CHKERRQ(ierr);
|
|
|
77 |
ierr = PetscOptionsReal("-qep_tol","Tolerance","QEPSetTolerances",qep->tol,&r,PETSC_NULL);CHKERRQ(ierr);
|
|
|
78 |
ierr = QEPSetTolerances(qep,r,i);CHKERRQ(ierr);
|
|
|
79 |
ierr = PetscOptionsTruthGroupBegin("-qep_convergence_default","Default (relative error) convergence test","QEPSetConvergenceTest",&flg);CHKERRQ(ierr);
|
|
|
80 |
if (flg) {ierr = QEPSetConvergenceTest(qep,QEPDefaultConverged,PETSC_NULL);CHKERRQ(ierr);}
|
|
|
81 |
ierr = PetscOptionsTruthGroupEnd("-qep_convergence_absolute","Absolute error convergence test","QEPSetConvergenceTest",&flg);CHKERRQ(ierr);
|
|
|
82 |
if (flg) {ierr = QEPSetConvergenceTest(qep,QEPAbsoluteConverged,PETSC_NULL);CHKERRQ(ierr);}
|
|
|
83 |
|
|
|
84 |
i = j = k = PETSC_IGNORE;
|
|
|
85 |
ierr = PetscOptionsInt("-qep_nev","Number of eigenvalues to compute","QEPSetDimensions",qep->nev,&i,PETSC_NULL);CHKERRQ(ierr);
|
|
|
86 |
ierr = PetscOptionsInt("-qep_ncv","Number of basis vectors","QEPSetDimensions",qep->ncv,&j,PETSC_NULL);CHKERRQ(ierr);
|
|
|
87 |
ierr = PetscOptionsInt("-qep_mpd","Maximum dimension of projected problem","QEPSetDimensions",qep->mpd,&k,PETSC_NULL);CHKERRQ(ierr);
|
|
|
88 |
ierr = QEPSetDimensions(qep,i,j,k);CHKERRQ(ierr);
|
|
|
89 |
|
|
|
90 |
/* -----------------------------------------------------------------------*/
|
|
|
91 |
/*
|
|
|
92 |
Cancels all monitors hardwired into code before call to QEPSetFromOptions()
|
|
|
93 |
*/
|
|
|
94 |
flg = PETSC_FALSE;
|
|
|
95 |
ierr = PetscOptionsTruth("-qep_monitor_cancel","Remove any hardwired monitor routines","QEPMonitorCancel",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
|
|
|
96 |
if (flg) {
|
|
|
97 |
ierr = QEPMonitorCancel(qep); CHKERRQ(ierr);
|
|
|
98 |
}
|
|
|
99 |
/*
|
|
|
100 |
Prints approximate eigenvalues and error estimates at each iteration
|
|
|
101 |
*/
|
| 2054 |
eromero |
102 |
ierr = PetscOptionsString("-qep_monitor","Monitor first unconverged approximate eigenvalue and error estimate","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
|
| 1887 |
jroman |
103 |
if (flg) {
|
|
|
104 |
ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,monfilename,((PetscObject)qep)->tablevel,&monviewer);CHKERRQ(ierr);
|
| 2054 |
eromero |
105 |
ierr = QEPMonitorSet(qep,QEPMonitorFirst,monviewer,(PetscErrorCode (*)(void*))PetscViewerASCIIMonitorDestroy);CHKERRQ(ierr);
|
| 1887 |
jroman |
106 |
}
|
|
|
107 |
ierr = PetscOptionsString("-qep_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
|
|
|
108 |
if (flg) {
|
| 1951 |
jroman |
109 |
ierr = PetscNew(QEPMONITOR_CONV,&ctx);CHKERRQ(ierr);
|
|
|
110 |
ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,monfilename,((PetscObject)qep)->tablevel,&ctx->viewer);CHKERRQ(ierr);
|
|
|
111 |
ierr = QEPMonitorSet(qep,QEPMonitorConverged,ctx,(PetscErrorCode (*)(void*))QEPMonitorDestroy_Converged);CHKERRQ(ierr);
|
| 1887 |
jroman |
112 |
}
|
| 2054 |
eromero |
113 |
ierr = PetscOptionsString("-qep_monitor_all","Monitor approximate eigenvalues and error estimates","QEPMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
|
| 1887 |
jroman |
114 |
if (flg) {
|
|
|
115 |
ierr = PetscViewerASCIIMonitorCreate(((PetscObject)qep)->comm,monfilename,((PetscObject)qep)->tablevel,&monviewer);CHKERRQ(ierr);
|
| 2054 |
eromero |
116 |
ierr = QEPMonitorSet(qep,QEPMonitorAll,monviewer,(PetscErrorCode (*)(void*))PetscViewerASCIIMonitorDestroy);CHKERRQ(ierr);
|
|
|
117 |
ierr = QEPSetTrackAll(qep,PETSC_TRUE);CHKERRQ(ierr);
|
| 1887 |
jroman |
118 |
}
|
|
|
119 |
flg = PETSC_FALSE;
|
| 2054 |
eromero |
120 |
ierr = PetscOptionsTruth("-qep_monitor_draw","Monitor first unconverged approximate error estimate graphically","QEPMonitorSet",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
|
| 1887 |
jroman |
121 |
if (flg) {
|
|
|
122 |
ierr = QEPMonitorSet(qep,QEPMonitorLG,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
|
|
|
123 |
}
|
| 2054 |
eromero |
124 |
flg = PETSC_FALSE;
|
|
|
125 |
ierr = PetscOptionsTruth("-qep_monitor_draw_all","Monitor error estimates graphically","QEPMonitorSet",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
|
|
|
126 |
if (flg) {
|
|
|
127 |
ierr = QEPMonitorSet(qep,QEPMonitorLGAll,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
|
|
|
128 |
ierr = QEPSetTrackAll(qep,PETSC_TRUE);CHKERRQ(ierr);
|
|
|
129 |
}
|
| 1887 |
jroman |
130 |
/* -----------------------------------------------------------------------*/
|
|
|
131 |
|
|
|
132 |
ierr = PetscOptionsTruthGroupBegin("-qep_largest_magnitude","compute largest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
133 |
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_MAGNITUDE);CHKERRQ(ierr);}
|
|
|
134 |
ierr = PetscOptionsTruthGroup("-qep_smallest_magnitude","compute smallest eigenvalues in magnitude","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
135 |
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_MAGNITUDE);CHKERRQ(ierr);}
|
|
|
136 |
ierr = PetscOptionsTruthGroup("-qep_largest_real","compute largest real parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
137 |
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_REAL);CHKERRQ(ierr);}
|
|
|
138 |
ierr = PetscOptionsTruthGroup("-qep_smallest_real","compute smallest real parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
139 |
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_REAL);CHKERRQ(ierr);}
|
|
|
140 |
ierr = PetscOptionsTruthGroup("-qep_largest_imaginary","compute largest imaginary parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
141 |
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_LARGEST_IMAGINARY);CHKERRQ(ierr);}
|
|
|
142 |
ierr = PetscOptionsTruthGroupEnd("-qep_smallest_imaginary","compute smallest imaginary parts","QEPSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
143 |
if (flg) {ierr = QEPSetWhichEigenpairs(qep,QEP_SMALLEST_IMAGINARY);CHKERRQ(ierr);}
|
|
|
144 |
|
| 1944 |
jroman |
145 |
ierr = PetscOptionsTruth("-qep_left_vectors","Compute left eigenvectors also","QEPSetLeftVectorsWanted",qep->leftvecs,&val,&flg);CHKERRQ(ierr);
|
|
|
146 |
if (flg) {
|
|
|
147 |
ierr = QEPSetLeftVectorsWanted(qep,val);CHKERRQ(ierr);
|
|
|
148 |
}
|
|
|
149 |
|
| 1887 |
jroman |
150 |
ierr = PetscOptionsName("-qep_view","Print detailed information on solver used","QEPView",0);CHKERRQ(ierr);
|
|
|
151 |
ierr = PetscOptionsName("-qep_view_binary","Save the matrices associated to the eigenproblem","QEPSetFromOptions",0);CHKERRQ(ierr);
|
|
|
152 |
ierr = PetscOptionsName("-qep_plot_eigs","Make a plot of the computed eigenvalues","QEPSolve",0);CHKERRQ(ierr);
|
|
|
153 |
|
|
|
154 |
if (qep->ops->setfromoptions) {
|
|
|
155 |
ierr = (*qep->ops->setfromoptions)(qep);CHKERRQ(ierr);
|
|
|
156 |
}
|
|
|
157 |
ierr = PetscOptionsEnd();CHKERRQ(ierr);
|
|
|
158 |
|
|
|
159 |
ierr = IPSetFromOptions(qep->ip); CHKERRQ(ierr);
|
|
|
160 |
PetscFunctionReturn(0);
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
#undef __FUNCT__
|
|
|
164 |
#define __FUNCT__ "QEPGetTolerances"
|
|
|
165 |
/*@
|
|
|
166 |
QEPGetTolerances - Gets the tolerance and maximum iteration count used
|
|
|
167 |
by the QEP convergence tests.
|
|
|
168 |
|
|
|
169 |
Not Collective
|
|
|
170 |
|
|
|
171 |
Input Parameter:
|
|
|
172 |
. qep - the quadratic eigensolver context
|
|
|
173 |
|
|
|
174 |
Output Parameters:
|
|
|
175 |
+ tol - the convergence tolerance
|
|
|
176 |
- maxits - maximum number of iterations
|
|
|
177 |
|
|
|
178 |
Notes:
|
|
|
179 |
The user can specify PETSC_NULL for any parameter that is not needed.
|
|
|
180 |
|
|
|
181 |
Level: intermediate
|
|
|
182 |
|
|
|
183 |
.seealso: QEPSetTolerances()
|
|
|
184 |
@*/
|
|
|
185 |
PetscErrorCode QEPGetTolerances(QEP qep,PetscReal *tol,PetscInt *maxits)
|
|
|
186 |
{
|
|
|
187 |
PetscFunctionBegin;
|
|
|
188 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
189 |
if (tol) *tol = qep->tol;
|
|
|
190 |
if (maxits) *maxits = qep->max_it;
|
|
|
191 |
PetscFunctionReturn(0);
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
#undef __FUNCT__
|
| 1918 |
jroman |
195 |
#define __FUNCT__ "QEPSetTolerances"
|
| 1887 |
jroman |
196 |
/*@
|
|
|
197 |
QEPSetTolerances - Sets the tolerance and maximum iteration count used
|
|
|
198 |
by the QEP convergence tests.
|
|
|
199 |
|
|
|
200 |
Collective on QEP
|
|
|
201 |
|
|
|
202 |
Input Parameters:
|
|
|
203 |
+ qep - the quadratic eigensolver context
|
|
|
204 |
. tol - the convergence tolerance
|
|
|
205 |
- maxits - maximum number of iterations to use
|
|
|
206 |
|
|
|
207 |
Options Database Keys:
|
|
|
208 |
+ -qep_tol <tol> - Sets the convergence tolerance
|
|
|
209 |
- -qep_max_it <maxits> - Sets the maximum number of iterations allowed
|
|
|
210 |
|
|
|
211 |
Notes:
|
|
|
212 |
Use PETSC_IGNORE for an argument that need not be changed.
|
|
|
213 |
|
|
|
214 |
Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
|
|
|
215 |
dependent on the solution method.
|
|
|
216 |
|
|
|
217 |
Level: intermediate
|
|
|
218 |
|
|
|
219 |
.seealso: QEPGetTolerances()
|
|
|
220 |
@*/
|
|
|
221 |
PetscErrorCode QEPSetTolerances(QEP qep,PetscReal tol,PetscInt maxits)
|
|
|
222 |
{
|
|
|
223 |
PetscFunctionBegin;
|
|
|
224 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
225 |
if (tol != PETSC_IGNORE) {
|
|
|
226 |
if (tol == PETSC_DEFAULT) {
|
|
|
227 |
qep->tol = 1e-7;
|
|
|
228 |
} else {
|
|
|
229 |
if (tol < 0.0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
|
|
|
230 |
qep->tol = tol;
|
|
|
231 |
}
|
|
|
232 |
}
|
|
|
233 |
if (maxits != PETSC_IGNORE) {
|
|
|
234 |
if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
|
|
|
235 |
qep->max_it = 0;
|
|
|
236 |
qep->setupcalled = 0;
|
|
|
237 |
} else {
|
|
|
238 |
if (maxits < 0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
|
|
|
239 |
qep->max_it = maxits;
|
|
|
240 |
}
|
|
|
241 |
}
|
|
|
242 |
PetscFunctionReturn(0);
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
#undef __FUNCT__
|
|
|
246 |
#define __FUNCT__ "QEPGetDimensions"
|
|
|
247 |
/*@
|
|
|
248 |
QEPGetDimensions - Gets the number of eigenvalues to compute
|
|
|
249 |
and the dimension of the subspace.
|
|
|
250 |
|
|
|
251 |
Not Collective
|
|
|
252 |
|
|
|
253 |
Input Parameter:
|
|
|
254 |
. qep - the quadratic eigensolver context
|
|
|
255 |
|
|
|
256 |
Output Parameters:
|
|
|
257 |
+ nev - number of eigenvalues to compute
|
|
|
258 |
. ncv - the maximum dimension of the subspace to be used by the solver
|
|
|
259 |
- mpd - the maximum dimension allowed for the projected problem
|
|
|
260 |
|
|
|
261 |
Notes:
|
|
|
262 |
The user can specify PETSC_NULL for any parameter that is not needed.
|
|
|
263 |
|
|
|
264 |
Level: intermediate
|
|
|
265 |
|
|
|
266 |
.seealso: QEPSetDimensions()
|
|
|
267 |
@*/
|
|
|
268 |
PetscErrorCode QEPGetDimensions(QEP qep,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
|
|
|
269 |
{
|
|
|
270 |
PetscFunctionBegin;
|
|
|
271 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
272 |
if (nev) *nev = qep->nev;
|
|
|
273 |
if (ncv) *ncv = qep->ncv;
|
|
|
274 |
if (mpd) *mpd = qep->mpd;
|
|
|
275 |
PetscFunctionReturn(0);
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
#undef __FUNCT__
|
|
|
279 |
#define __FUNCT__ "QEPSetDimensions"
|
|
|
280 |
/*@
|
|
|
281 |
QEPSetDimensions - Sets the number of eigenvalues to compute
|
|
|
282 |
and the dimension of the subspace.
|
|
|
283 |
|
|
|
284 |
Collective on QEP
|
|
|
285 |
|
|
|
286 |
Input Parameters:
|
|
|
287 |
+ qep - the quadratic eigensolver context
|
|
|
288 |
. nev - number of eigenvalues to compute
|
|
|
289 |
. ncv - the maximum dimension of the subspace to be used by the solver
|
|
|
290 |
- mpd - the maximum dimension allowed for the projected problem
|
|
|
291 |
|
|
|
292 |
Options Database Keys:
|
|
|
293 |
+ -qep_nev <nev> - Sets the number of eigenvalues
|
|
|
294 |
. -qep_ncv <ncv> - Sets the dimension of the subspace
|
|
|
295 |
- -qep_mpd <mpd> - Sets the maximum projected dimension
|
|
|
296 |
|
|
|
297 |
Notes:
|
|
|
298 |
Use PETSC_IGNORE to retain the previous value of any parameter.
|
|
|
299 |
|
|
|
300 |
Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
|
|
|
301 |
dependent on the solution method.
|
|
|
302 |
|
|
|
303 |
The parameters ncv and mpd are intimately related, so that the user is advised
|
|
|
304 |
to set one of them at most. Normal usage is the following
|
|
|
305 |
+ - In cases where nev is small, the user sets ncv (a reasonable default is 2*nev).
|
|
|
306 |
- - In cases where nev is large, the user sets mpd.
|
|
|
307 |
|
|
|
308 |
The value of ncv should always be between nev and (nev+mpd), typically
|
|
|
309 |
ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise
|
|
|
310 |
a smaller value should be used.
|
|
|
311 |
|
|
|
312 |
Level: intermediate
|
|
|
313 |
|
|
|
314 |
.seealso: QEPGetDimensions()
|
|
|
315 |
@*/
|
|
|
316 |
PetscErrorCode QEPSetDimensions(QEP qep,PetscInt nev,PetscInt ncv,PetscInt mpd)
|
|
|
317 |
{
|
|
|
318 |
PetscFunctionBegin;
|
|
|
319 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
320 |
|
|
|
321 |
if( nev != PETSC_IGNORE ) {
|
|
|
322 |
if (nev<1) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0");
|
|
|
323 |
qep->nev = nev;
|
|
|
324 |
qep->setupcalled = 0;
|
|
|
325 |
}
|
|
|
326 |
if( ncv != PETSC_IGNORE ) {
|
|
|
327 |
if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
|
|
|
328 |
qep->ncv = 0;
|
|
|
329 |
} else {
|
|
|
330 |
if (ncv<1) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
|
|
|
331 |
qep->ncv = ncv;
|
|
|
332 |
}
|
|
|
333 |
qep->setupcalled = 0;
|
|
|
334 |
}
|
|
|
335 |
if( mpd != PETSC_IGNORE ) {
|
|
|
336 |
if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
|
|
|
337 |
qep->mpd = 0;
|
|
|
338 |
} else {
|
|
|
339 |
if (mpd<1) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
|
|
|
340 |
qep->mpd = mpd;
|
|
|
341 |
}
|
|
|
342 |
}
|
|
|
343 |
PetscFunctionReturn(0);
|
|
|
344 |
}
|
|
|
345 |
|
|
|
346 |
#undef __FUNCT__
|
|
|
347 |
#define __FUNCT__ "QEPSetWhichEigenpairs"
|
|
|
348 |
/*@
|
|
|
349 |
QEPSetWhichEigenpairs - Specifies which portion of the spectrum is
|
|
|
350 |
to be sought.
|
|
|
351 |
|
|
|
352 |
Collective on QEP
|
|
|
353 |
|
|
|
354 |
Input Parameters:
|
| 1942 |
jroman |
355 |
+ qep - eigensolver context obtained from QEPCreate()
|
| 1887 |
jroman |
356 |
- which - the portion of the spectrum to be sought
|
|
|
357 |
|
|
|
358 |
Possible values:
|
|
|
359 |
The parameter 'which' can have one of these values
|
|
|
360 |
|
|
|
361 |
+ QEP_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
|
|
|
362 |
. QEP_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
|
|
|
363 |
. QEP_LARGEST_REAL - largest real parts
|
|
|
364 |
. QEP_SMALLEST_REAL - smallest real parts
|
|
|
365 |
. QEP_LARGEST_IMAGINARY - largest imaginary parts
|
|
|
366 |
- QEP_SMALLEST_IMAGINARY - smallest imaginary parts
|
|
|
367 |
|
|
|
368 |
Options Database Keys:
|
|
|
369 |
+ -qep_largest_magnitude - Sets largest eigenvalues in magnitude
|
|
|
370 |
. -qep_smallest_magnitude - Sets smallest eigenvalues in magnitude
|
|
|
371 |
. -qep_largest_real - Sets largest real parts
|
|
|
372 |
. -qep_smallest_real - Sets smallest real parts
|
|
|
373 |
. -qep_largest_imaginary - Sets largest imaginary parts
|
|
|
374 |
- -qep_smallest_imaginary - Sets smallest imaginary parts
|
|
|
375 |
|
|
|
376 |
Notes:
|
|
|
377 |
Not all eigensolvers implemented in QEP account for all the possible values
|
|
|
378 |
stated above. If SLEPc is compiled for real numbers QEP_LARGEST_IMAGINARY
|
|
|
379 |
and QEP_SMALLEST_IMAGINARY use the absolute value of the imaginary part
|
|
|
380 |
for eigenvalue selection.
|
|
|
381 |
|
|
|
382 |
Level: intermediate
|
|
|
383 |
|
|
|
384 |
.seealso: QEPGetWhichEigenpairs(), QEPWhich
|
|
|
385 |
@*/
|
|
|
386 |
PetscErrorCode QEPSetWhichEigenpairs(QEP qep,QEPWhich which)
|
|
|
387 |
{
|
|
|
388 |
PetscFunctionBegin;
|
|
|
389 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
| 1942 |
jroman |
390 |
if (which!=PETSC_IGNORE) {
|
|
|
391 |
if (which==PETSC_DECIDE || which==PETSC_DEFAULT) qep->which = (QEPWhich)0;
|
|
|
392 |
else switch (which) {
|
|
|
393 |
case QEP_LARGEST_MAGNITUDE:
|
|
|
394 |
case QEP_SMALLEST_MAGNITUDE:
|
|
|
395 |
case QEP_LARGEST_REAL:
|
|
|
396 |
case QEP_SMALLEST_REAL:
|
|
|
397 |
case QEP_LARGEST_IMAGINARY:
|
|
|
398 |
case QEP_SMALLEST_IMAGINARY:
|
|
|
399 |
if (qep->which != which) {
|
|
|
400 |
qep->setupcalled = 0;
|
|
|
401 |
qep->which = which;
|
|
|
402 |
}
|
|
|
403 |
break;
|
|
|
404 |
default:
|
|
|
405 |
SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value");
|
|
|
406 |
}
|
| 1887 |
jroman |
407 |
}
|
|
|
408 |
PetscFunctionReturn(0);
|
|
|
409 |
}
|
|
|
410 |
|
|
|
411 |
#undef __FUNCT__
|
|
|
412 |
#define __FUNCT__ "QEPGetWhichEigenpairs"
|
|
|
413 |
/*@C
|
|
|
414 |
QEPGetWhichEigenpairs - Returns which portion of the spectrum is to be
|
|
|
415 |
sought.
|
|
|
416 |
|
|
|
417 |
Not Collective
|
|
|
418 |
|
|
|
419 |
Input Parameter:
|
|
|
420 |
. qep - eigensolver context obtained from QEPCreate()
|
|
|
421 |
|
|
|
422 |
Output Parameter:
|
|
|
423 |
. which - the portion of the spectrum to be sought
|
|
|
424 |
|
|
|
425 |
Notes:
|
|
|
426 |
See QEPSetWhichEigenpairs() for possible values of 'which'.
|
|
|
427 |
|
|
|
428 |
Level: intermediate
|
|
|
429 |
|
|
|
430 |
.seealso: QEPSetWhichEigenpairs(), QEPWhich
|
|
|
431 |
@*/
|
|
|
432 |
PetscErrorCode QEPGetWhichEigenpairs(QEP qep,QEPWhich *which)
|
|
|
433 |
{
|
|
|
434 |
PetscFunctionBegin;
|
|
|
435 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
436 |
PetscValidPointer(which,2);
|
|
|
437 |
*which = qep->which;
|
|
|
438 |
PetscFunctionReturn(0);
|
|
|
439 |
}
|
|
|
440 |
|
|
|
441 |
#undef __FUNCT__
|
| 1944 |
jroman |
442 |
#define __FUNCT__ "QEPSetLeftVectorsWanted"
|
|
|
443 |
/*@
|
|
|
444 |
QEPSetLeftVectorsWanted - Specifies which eigenvectors are required.
|
|
|
445 |
|
|
|
446 |
Collective on QEP
|
|
|
447 |
|
|
|
448 |
Input Parameters:
|
|
|
449 |
+ qep - the quadratic eigensolver context
|
|
|
450 |
- leftvecs - whether left eigenvectors are required or not
|
|
|
451 |
|
|
|
452 |
Options Database Keys:
|
|
|
453 |
. -qep_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'
|
|
|
454 |
|
|
|
455 |
Notes:
|
|
|
456 |
If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of
|
|
|
457 |
the algorithm that computes both right and left eigenvectors. This is
|
|
|
458 |
usually much more costly. This option is not available in all solvers.
|
|
|
459 |
|
|
|
460 |
Level: intermediate
|
|
|
461 |
|
|
|
462 |
.seealso: QEPGetLeftVectorsWanted(), QEPGetEigenvectorLeft()
|
|
|
463 |
@*/
|
|
|
464 |
PetscErrorCode QEPSetLeftVectorsWanted(QEP qep,PetscTruth leftvecs)
|
|
|
465 |
{
|
|
|
466 |
PetscFunctionBegin;
|
|
|
467 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
| 1949 |
jroman |
468 |
if (qep->leftvecs != leftvecs) {
|
|
|
469 |
qep->leftvecs = leftvecs;
|
|
|
470 |
qep->setupcalled = 0;
|
|
|
471 |
}
|
| 1944 |
jroman |
472 |
PetscFunctionReturn(0);
|
|
|
473 |
}
|
|
|
474 |
|
|
|
475 |
#undef __FUNCT__
|
|
|
476 |
#define __FUNCT__ "QEPGetLeftVectorsWanted"
|
|
|
477 |
/*@C
|
|
|
478 |
QEPGetLeftVectorsWanted - Returns the flag indicating whether left
|
|
|
479 |
eigenvectors are required or not.
|
|
|
480 |
|
|
|
481 |
Not Collective
|
|
|
482 |
|
|
|
483 |
Input Parameter:
|
|
|
484 |
. qep - the eigensolver context
|
|
|
485 |
|
|
|
486 |
Output Parameter:
|
|
|
487 |
. leftvecs - the returned flag
|
|
|
488 |
|
|
|
489 |
Level: intermediate
|
|
|
490 |
|
|
|
491 |
.seealso: QEPSetLeftVectorsWanted()
|
|
|
492 |
@*/
|
|
|
493 |
PetscErrorCode QEPGetLeftVectorsWanted(QEP qep,PetscTruth *leftvecs)
|
|
|
494 |
{
|
|
|
495 |
PetscFunctionBegin;
|
|
|
496 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
497 |
PetscValidPointer(leftvecs,2);
|
|
|
498 |
*leftvecs = qep->leftvecs;
|
|
|
499 |
PetscFunctionReturn(0);
|
|
|
500 |
}
|
|
|
501 |
|
|
|
502 |
#undef __FUNCT__
|
| 1918 |
jroman |
503 |
#define __FUNCT__ "QEPGetScaleFactor"
|
|
|
504 |
/*@
|
|
|
505 |
QEPGetScaleFactor - Gets the factor used for scaling the quadratic eigenproblem.
|
|
|
506 |
|
|
|
507 |
Not Collective
|
|
|
508 |
|
|
|
509 |
Input Parameter:
|
|
|
510 |
. qep - the quadratic eigensolver context
|
|
|
511 |
|
|
|
512 |
Output Parameters:
|
|
|
513 |
. alpha - the scaling factor
|
|
|
514 |
|
|
|
515 |
Notes:
|
|
|
516 |
If the user did not specify a scaling factor, then after QEPSolve() the
|
|
|
517 |
default value is returned.
|
|
|
518 |
|
|
|
519 |
Level: intermediate
|
|
|
520 |
|
|
|
521 |
.seealso: QEPSetScaleFactor(), QEPSolve()
|
|
|
522 |
@*/
|
|
|
523 |
PetscErrorCode QEPGetScaleFactor(QEP qep,PetscReal *alpha)
|
|
|
524 |
{
|
|
|
525 |
PetscFunctionBegin;
|
|
|
526 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
527 |
if (alpha) *alpha = PetscRealPart(qep->sfactor);
|
|
|
528 |
PetscFunctionReturn(0);
|
|
|
529 |
}
|
|
|
530 |
|
|
|
531 |
#undef __FUNCT__
|
|
|
532 |
#define __FUNCT__ "QEPSetScaleFactor"
|
|
|
533 |
/*@
|
|
|
534 |
QEPSetScaleFactor - Sets the scaling factor to be used for scaling the
|
|
|
535 |
quadratic problem before attempting to solve.
|
|
|
536 |
|
|
|
537 |
Collective on QEP
|
|
|
538 |
|
|
|
539 |
Input Parameters:
|
|
|
540 |
+ qep - the quadratic eigensolver context
|
|
|
541 |
- alpha - the scaling factor
|
|
|
542 |
|
|
|
543 |
Options Database Keys:
|
|
|
544 |
. -qep_scale <alpha> - Sets the scaling factor
|
|
|
545 |
|
|
|
546 |
Notes:
|
|
|
547 |
For the problem (l^2*M + l*C + K)*x = 0, the effect of scaling is to work
|
|
|
548 |
with matrices (alpha^2*M, alpha*C, K), then scale the computed eigenvalue.
|
|
|
549 |
|
|
|
550 |
The default is to scale with alpha = norm(K)/norm(M).
|
|
|
551 |
|
|
|
552 |
Level: intermediate
|
|
|
553 |
|
|
|
554 |
.seealso: QEPGetScaleFactor()
|
|
|
555 |
@*/
|
|
|
556 |
PetscErrorCode QEPSetScaleFactor(QEP qep,PetscReal alpha)
|
|
|
557 |
{
|
|
|
558 |
PetscFunctionBegin;
|
|
|
559 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
560 |
if (alpha != PETSC_IGNORE) {
|
|
|
561 |
if (alpha == PETSC_DEFAULT || alpha == PETSC_DECIDE) {
|
|
|
562 |
qep->sfactor = 0.0;
|
|
|
563 |
} else {
|
|
|
564 |
if (alpha < 0.0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of alpha. Must be > 0");
|
|
|
565 |
qep->sfactor = alpha;
|
|
|
566 |
}
|
|
|
567 |
}
|
|
|
568 |
PetscFunctionReturn(0);
|
|
|
569 |
}
|
|
|
570 |
|
|
|
571 |
#undef __FUNCT__
|
| 1906 |
jroman |
572 |
#define __FUNCT__ "QEPSetProblemType"
|
|
|
573 |
/*@
|
|
|
574 |
QEPSetProblemType - Specifies the type of the quadratic eigenvalue problem.
|
|
|
575 |
|
|
|
576 |
Collective on QEP
|
|
|
577 |
|
|
|
578 |
Input Parameters:
|
|
|
579 |
+ qep - the quadratic eigensolver context
|
|
|
580 |
- type - a known type of quadratic eigenvalue problem
|
|
|
581 |
|
|
|
582 |
Options Database Keys:
|
|
|
583 |
+ -qep_general - general problem with no particular structure
|
|
|
584 |
. -qep_hermitian - problem whose coefficient matrices are Hermitian
|
|
|
585 |
- -qep_gyroscopic - problem with Hamiltonian structure
|
|
|
586 |
|
|
|
587 |
Notes:
|
|
|
588 |
Allowed values for the problem type are: general (QEP_GENERAL), Hermitian
|
|
|
589 |
(QEP_HERMITIAN), and gyroscopic (QEP_GYROSCOPIC).
|
|
|
590 |
|
|
|
591 |
This function is used to instruct SLEPc to exploit certain structure in
|
|
|
592 |
the quadratic eigenproblem. By default, no particular structure is assumed.
|
|
|
593 |
|
|
|
594 |
If the problem matrices are Hermitian (symmetric in the real case) or
|
|
|
595 |
Hermitian/skew-Hermitian then the solver can exploit this fact to perform
|
|
|
596 |
less operations or provide better stability.
|
|
|
597 |
|
|
|
598 |
Level: intermediate
|
|
|
599 |
|
|
|
600 |
.seealso: QEPSetOperators(), QEPSetType(), QEPGetProblemType(), QEPProblemType
|
|
|
601 |
@*/
|
|
|
602 |
PetscErrorCode QEPSetProblemType(QEP qep,QEPProblemType type)
|
|
|
603 |
{
|
|
|
604 |
PetscFunctionBegin;
|
|
|
605 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
606 |
if (type!=QEP_GENERAL && type!=QEP_HERMITIAN && type!=QEP_GYROSCOPIC)
|
|
|
607 |
SETERRQ(PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type");
|
|
|
608 |
qep->problem_type = type;
|
|
|
609 |
PetscFunctionReturn(0);
|
|
|
610 |
}
|
|
|
611 |
|
|
|
612 |
#undef __FUNCT__
|
|
|
613 |
#define __FUNCT__ "QEPGetProblemType"
|
|
|
614 |
/*@C
|
|
|
615 |
QEPGetProblemType - Gets the problem type from the QEP object.
|
|
|
616 |
|
|
|
617 |
Not Collective
|
|
|
618 |
|
|
|
619 |
Input Parameter:
|
|
|
620 |
. qep - the quadratic eigensolver context
|
|
|
621 |
|
|
|
622 |
Output Parameter:
|
|
|
623 |
. type - name of QEP problem type
|
|
|
624 |
|
|
|
625 |
Level: intermediate
|
|
|
626 |
|
|
|
627 |
.seealso: QEPSetProblemType(), QEPProblemType
|
|
|
628 |
@*/
|
|
|
629 |
PetscErrorCode QEPGetProblemType(QEP qep,QEPProblemType *type)
|
|
|
630 |
{
|
|
|
631 |
PetscFunctionBegin;
|
|
|
632 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
633 |
PetscValidPointer(type,2);
|
|
|
634 |
*type = qep->problem_type;
|
|
|
635 |
PetscFunctionReturn(0);
|
|
|
636 |
}
|
|
|
637 |
|
|
|
638 |
#undef __FUNCT__
|
| 1887 |
jroman |
639 |
#define __FUNCT__ "QEPSetConvergenceTest"
|
|
|
640 |
/*@C
|
|
|
641 |
QEPSetConvergenceTest - Specifies the convergence test.
|
|
|
642 |
|
|
|
643 |
Collective on QEP
|
|
|
644 |
|
|
|
645 |
Input Parameters:
|
|
|
646 |
+ qep - eigensolver context obtained from QEPCreate()
|
|
|
647 |
. func - a pointer to the convergence test function
|
|
|
648 |
- ctx - a context pointer (the last parameter to the convergence test function)
|
|
|
649 |
|
|
|
650 |
Calling Sequence of func:
|
|
|
651 |
$ func(QEP qep,PetscInt n,PetscInt k,PetscScalar* eigr,PetscScalar* eigi,PetscReal* errest,PetscTruth *conv,void *ctx)
|
|
|
652 |
|
|
|
653 |
+ qep - eigensolver context obtained from QEPCreate()
|
|
|
654 |
. n - length of the arrays
|
|
|
655 |
. k - first position of the array to be considered
|
|
|
656 |
. eigr - array containing real parts of the eigenvalues
|
|
|
657 |
. eigi - array containing imaginary parts of the eigenvalues
|
|
|
658 |
. errest - array containing the error estimates (residuals)
|
|
|
659 |
. conv - (output) boolean array with the result of the test
|
|
|
660 |
- ctx - optional context, as set by QEPSetConvergenceTest()
|
|
|
661 |
|
|
|
662 |
Note:
|
|
|
663 |
The convergence function sets an element of the flag array for each eigenvalue.
|
|
|
664 |
|
|
|
665 |
Level: advanced
|
|
|
666 |
|
|
|
667 |
.seealso: QEPSetTolerances()
|
|
|
668 |
@*/
|
| 2044 |
antodo |
669 |
EXTERN PetscErrorCode QEPSetConvergenceTest(QEP qep,PetscErrorCode (*func)(QEP,PetscScalar,PetscScalar,PetscReal*,PetscTruth*,void*),void* ctx)
|
| 1887 |
jroman |
670 |
{
|
|
|
671 |
PetscFunctionBegin;
|
|
|
672 |
qep->conv_func = func;
|
|
|
673 |
qep->conv_ctx = ctx;
|
|
|
674 |
PetscFunctionReturn(0);
|
|
|
675 |
}
|
|
|
676 |
|
|
|
677 |
#undef __FUNCT__
|
| 2054 |
eromero |
678 |
#define __FUNCT__ "QEPSetTrackAll"
|
|
|
679 |
/*@
|
|
|
680 |
QEPSetTrackAll - Specifies if the solver must compute the residual of all
|
|
|
681 |
approximate eigenpairs or not.
|
|
|
682 |
|
|
|
683 |
Collective on QEP
|
|
|
684 |
|
|
|
685 |
Input Parameters:
|
|
|
686 |
+ qep - the eigensolver context
|
|
|
687 |
- trackall - whether compute all residuals or not
|
|
|
688 |
|
|
|
689 |
Notes:
|
|
|
690 |
If the user sets trackall=PETSC_TRUE then the solver explicitly computes
|
|
|
691 |
the residual for each eigenpair approximation. Computing the residual is
|
|
|
692 |
usually an expensive operation and solvers commonly compute the associated
|
|
|
693 |
residual to the first unconverged eigenpair.
|
|
|
694 |
The options '-qep_monitor_all' and '-qep_monitor_draw_all' automatically
|
|
|
695 |
activates this option.
|
|
|
696 |
|
|
|
697 |
Level: intermediate
|
|
|
698 |
|
|
|
699 |
.seealso: EPSGetTrackAll()
|
|
|
700 |
@*/
|
|
|
701 |
PetscErrorCode QEPSetTrackAll(QEP qep,PetscTruth trackall)
|
|
|
702 |
{
|
|
|
703 |
PetscFunctionBegin;
|
|
|
704 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
705 |
qep->trackall = trackall;
|
|
|
706 |
PetscFunctionReturn(0);
|
|
|
707 |
}
|
|
|
708 |
|
|
|
709 |
#undef __FUNCT__
|
|
|
710 |
#define __FUNCT__ "QEPGetTrackAll"
|
|
|
711 |
/*@
|
|
|
712 |
QEPGetTrackAll - Returns the flag indicating whether all residuals must be computed explicitly or not.
|
|
|
713 |
|
|
|
714 |
Not Collective
|
|
|
715 |
|
|
|
716 |
Input Parameter:
|
|
|
717 |
. qep - the eigensolver context
|
|
|
718 |
|
|
|
719 |
Output Parameter:
|
|
|
720 |
. trackall - the returned flag
|
|
|
721 |
|
|
|
722 |
Level: intermediate
|
|
|
723 |
|
|
|
724 |
.seealso: EPSSetTrackAll()
|
|
|
725 |
@*/
|
|
|
726 |
PetscErrorCode QEPGetTrackAll(QEP qep,PetscTruth *trackall)
|
|
|
727 |
{
|
|
|
728 |
PetscFunctionBegin;
|
|
|
729 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
730 |
PetscValidPointer(trackall,2);
|
|
|
731 |
*trackall = qep->trackall;
|
|
|
732 |
PetscFunctionReturn(0);
|
|
|
733 |
}
|
|
|
734 |
|
|
|
735 |
#undef __FUNCT__
|
| 1887 |
jroman |
736 |
#define __FUNCT__ "QEPSetOptionsPrefix"
|
|
|
737 |
/*@C
|
|
|
738 |
QEPSetOptionsPrefix - Sets the prefix used for searching for all
|
|
|
739 |
QEP options in the database.
|
|
|
740 |
|
|
|
741 |
Collective on QEP
|
|
|
742 |
|
|
|
743 |
Input Parameters:
|
|
|
744 |
+ qep - the quadratic eigensolver context
|
|
|
745 |
- prefix - the prefix string to prepend to all QEP option requests
|
|
|
746 |
|
|
|
747 |
Notes:
|
|
|
748 |
A hyphen (-) must NOT be given at the beginning of the prefix name.
|
|
|
749 |
The first character of all runtime options is AUTOMATICALLY the
|
|
|
750 |
hyphen.
|
|
|
751 |
|
|
|
752 |
For example, to distinguish between the runtime options for two
|
|
|
753 |
different QEP contexts, one could call
|
|
|
754 |
.vb
|
|
|
755 |
QEPSetOptionsPrefix(qep1,"qeig1_")
|
|
|
756 |
QEPSetOptionsPrefix(qep2,"qeig2_")
|
|
|
757 |
.ve
|
|
|
758 |
|
|
|
759 |
Level: advanced
|
|
|
760 |
|
|
|
761 |
.seealso: QEPAppendOptionsPrefix(), QEPGetOptionsPrefix()
|
|
|
762 |
@*/
|
|
|
763 |
PetscErrorCode QEPSetOptionsPrefix(QEP qep,const char *prefix)
|
|
|
764 |
{
|
|
|
765 |
PetscErrorCode ierr;
|
|
|
766 |
PetscFunctionBegin;
|
|
|
767 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
768 |
ierr = PetscObjectSetOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr);
|
|
|
769 |
ierr = IPSetOptionsPrefix(qep->ip,prefix);CHKERRQ(ierr);
|
|
|
770 |
ierr = IPAppendOptionsPrefix(qep->ip,"qep_");CHKERRQ(ierr);
|
|
|
771 |
PetscFunctionReturn(0);
|
|
|
772 |
}
|
|
|
773 |
|
|
|
774 |
#undef __FUNCT__
|
|
|
775 |
#define __FUNCT__ "QEPAppendOptionsPrefix"
|
|
|
776 |
/*@C
|
|
|
777 |
QEPAppendOptionsPrefix - Appends to the prefix used for searching for all
|
|
|
778 |
QEP options in the database.
|
|
|
779 |
|
|
|
780 |
Collective on QEP
|
|
|
781 |
|
|
|
782 |
Input Parameters:
|
|
|
783 |
+ qep - the quadratic eigensolver context
|
|
|
784 |
- prefix - the prefix string to prepend to all QEP option requests
|
|
|
785 |
|
|
|
786 |
Notes:
|
|
|
787 |
A hyphen (-) must NOT be given at the beginning of the prefix name.
|
|
|
788 |
The first character of all runtime options is AUTOMATICALLY the hyphen.
|
|
|
789 |
|
|
|
790 |
Level: advanced
|
|
|
791 |
|
|
|
792 |
.seealso: QEPSetOptionsPrefix(), QEPGetOptionsPrefix()
|
|
|
793 |
@*/
|
|
|
794 |
PetscErrorCode QEPAppendOptionsPrefix(QEP qep,const char *prefix)
|
|
|
795 |
{
|
|
|
796 |
PetscErrorCode ierr;
|
|
|
797 |
PetscFunctionBegin;
|
|
|
798 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
799 |
ierr = PetscObjectAppendOptionsPrefix((PetscObject)qep, prefix);CHKERRQ(ierr);
|
|
|
800 |
ierr = IPSetOptionsPrefix(qep->ip,prefix);CHKERRQ(ierr);
|
|
|
801 |
ierr = IPAppendOptionsPrefix(qep->ip,"qep_");CHKERRQ(ierr);
|
|
|
802 |
PetscFunctionReturn(0);
|
|
|
803 |
}
|
|
|
804 |
|
|
|
805 |
#undef __FUNCT__
|
|
|
806 |
#define __FUNCT__ "QEPGetOptionsPrefix"
|
|
|
807 |
/*@C
|
|
|
808 |
QEPGetOptionsPrefix - Gets the prefix used for searching for all
|
|
|
809 |
QEP options in the database.
|
|
|
810 |
|
|
|
811 |
Not Collective
|
|
|
812 |
|
|
|
813 |
Input Parameters:
|
|
|
814 |
. qep - the quadratic eigensolver context
|
|
|
815 |
|
|
|
816 |
Output Parameters:
|
|
|
817 |
. prefix - pointer to the prefix string used is returned
|
|
|
818 |
|
|
|
819 |
Notes: On the fortran side, the user should pass in a string 'prefix' of
|
|
|
820 |
sufficient length to hold the prefix.
|
|
|
821 |
|
|
|
822 |
Level: advanced
|
|
|
823 |
|
|
|
824 |
.seealso: QEPSetOptionsPrefix(), QEPAppendOptionsPrefix()
|
|
|
825 |
@*/
|
|
|
826 |
PetscErrorCode QEPGetOptionsPrefix(QEP qep,const char *prefix[])
|
|
|
827 |
{
|
|
|
828 |
PetscErrorCode ierr;
|
|
|
829 |
PetscFunctionBegin;
|
|
|
830 |
PetscValidHeaderSpecific(qep,QEP_COOKIE,1);
|
|
|
831 |
PetscValidPointer(prefix,2);
|
|
|
832 |
ierr = PetscObjectGetOptionsPrefix((PetscObject)qep,prefix);CHKERRQ(ierr);
|
|
|
833 |
PetscFunctionReturn(0);
|
|
|
834 |
}
|