xref: /petsc/src/sys/objects/aoptions.c (revision e8fb0fc05573aa974b3f79797ad519d0316ca217)
1 #define PETSC_DLL
2 /*
3    These routines simplify the use of command line, file options, etc.,
4    and are used to manipulate the options database.
5 
6   This file uses regular malloc and free because it cannot know
7   what malloc is being used until it has already processed the input.
8 */
9 
10 #include "petsc.h"        /*I  "petsc.h"   I*/
11 #include "petscsys.h"
12 #if defined(PETSC_HAVE_STDLIB_H)
13 #include <stdlib.h>
14 #endif
15 
16 /*
17     Keep a linked list of options that have been posted and we are waiting for
18    user selection
19 
20     Eventually we'll attach this beast to a MPI_Comm
21 */
22 typedef enum {OPTION_INT,OPTION_LOGICAL,OPTION_REAL,OPTION_LIST,OPTION_STRING,OPTION_REAL_ARRAY,OPTION_HEAD} OptionType;
23 typedef struct _p_Options* PetscOptions;
24 struct _p_Options {
25   char         *option;
26   char         *text;
27   void         *data;
28   void         *edata;
29   char         *man;
30   int          arraylength;
31   PetscTruth   set;
32   OptionType   type;
33   PetscOptions next;
34 };
35 
36 typedef struct _p_OptionsHelp* OptionsHelp;
37 struct _p_OptionsHelp {
38   char        *prefix;
39   char        *title;
40   char        *mansec;
41   OptionsHelp next;
42 };
43 
44 static struct {
45   PetscOptions    next;
46   char            *prefix,*mprefix;
47   char            *title;
48   MPI_Comm        comm;
49   PetscTruth      printhelp,changedmethod,alreadyprinted;
50   OptionsHelp     help;
51 }                                   PetscOptionsObject;
52 PetscInt                            PetscOptionsPublishCount = 0;
53 
54 
55 #undef __FUNCT__
56 #define __FUNCT__ "PetscOptionsHelpAddList"
57 PetscErrorCode PetscOptionsHelpAddList(const char prefix[],const char title[],const char mansec[])
58 {
59   int          ierr;
60   OptionsHelp  newhelp;
61   PetscFunctionBegin;
62   ierr = PetscNew(struct _p_OptionsHelp,&newhelp);CHKERRQ(ierr);
63   ierr = PetscStrallocpy(prefix,&newhelp->prefix);CHKERRQ(ierr);
64   ierr = PetscStrallocpy(title,&newhelp->title);CHKERRQ(ierr);
65   ierr = PetscStrallocpy(mansec,&newhelp->mansec);CHKERRQ(ierr);
66   newhelp->next = 0;
67 
68   if (!PetscOptionsObject.help) {
69     PetscOptionsObject.help = newhelp;
70   } else {
71     newhelp->next = PetscOptionsObject.help;
72     PetscOptionsObject.help = newhelp;
73   }
74   PetscFunctionReturn(0);
75 }
76 
77 #undef __FUNCT__
78 #define __FUNCT__ "PetscOptionsHelpDestroyList"
79 PetscErrorCode PetscOptionsHelpDestroyList(void)
80 {
81   PetscErrorCode ierr;
82   OptionsHelp    help = PetscOptionsObject.help, next;
83 
84   PetscFunctionBegin;
85   while (help) {
86     next = help->next;
87     ierr = PetscStrfree(help->prefix);CHKERRQ(ierr);
88     ierr = PetscStrfree(help->title);CHKERRQ(ierr);
89     ierr = PetscStrfree(help->mansec);CHKERRQ(ierr);
90     ierr = PetscFree(help);CHKERRQ(ierr);
91     help = next;
92   }
93   PetscFunctionReturn(0);
94 }
95 
96 
97 #undef __FUNCT__
98 #define __FUNCT__ "PetscOptionsHelpFindList"
99 PetscErrorCode PetscOptionsHelpFindList(const char prefix[],const char title[],const char mansec[],PetscTruth *flg)
100 {
101   PetscErrorCode ierr;
102   PetscTruth     flg1,flg2,flg3;
103   OptionsHelp help = PetscOptionsObject.help;
104   PetscFunctionBegin;
105   while (help) {
106     ierr = PetscStrcmp(help->prefix,prefix,&flg1);CHKERRQ(ierr);
107     ierr = PetscStrcmp(help->title,title,&flg2);CHKERRQ(ierr);
108     ierr = PetscStrcmp(help->mansec,mansec,&flg3);CHKERRQ(ierr);
109     if (flg1 && flg2 && flg3) {
110       *flg = PETSC_TRUE;
111       break;
112     }
113     help = help->next;
114   }
115   PetscFunctionReturn(0);
116 
117 }
118 
119 #undef __FUNCT__
120 #define __FUNCT__ "PetscOptionsHelpCheckAddList"
121 PetscErrorCode PetscOptionsHelpCheckAddList(const char prefix[],const char title[],const char mansec[],PetscTruth *flg)
122 {
123   PetscFunctionBegin;
124   PetscOptionsHelpFindList(prefix,title,mansec,flg);
125   if (!(*flg)) PetscOptionsHelpAddList(prefix,title,mansec);
126   PetscFunctionReturn(0);
127 }
128 
129 #undef __FUNCT__
130 #define __FUNCT__ "PetscOptionsBegin_Private"
131 /*
132     Handles setting up the data structure in a call to PetscOptionsBegin()
133 */
134 PetscErrorCode PetscOptionsBegin_Private(MPI_Comm comm,const char prefix[],const char title[],const char mansec[])
135 {
136   PetscErrorCode ierr;
137 
138   PetscFunctionBegin;
139   PetscOptionsObject.next          = 0;
140   PetscOptionsObject.comm          = comm;
141   PetscOptionsObject.changedmethod = PETSC_FALSE;
142   ierr = PetscStrallocpy(prefix,&PetscOptionsObject.prefix);CHKERRQ(ierr);
143   ierr = PetscStrallocpy(title,&PetscOptionsObject.title);CHKERRQ(ierr);
144 
145   ierr = PetscOptionsHasName(PETSC_NULL,"-help",&PetscOptionsObject.printhelp);CHKERRQ(ierr);
146   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1) {
147     ierr = PetscOptionsHelpCheckAddList(prefix,title,mansec,&PetscOptionsObject.alreadyprinted);
148     if (!PetscOptionsObject.alreadyprinted) {
149       ierr = (*PetscHelpPrintf)(comm,"%s -------------------------------------------------\n",title);CHKERRQ(ierr);
150     }
151   }
152   PetscFunctionReturn(0);
153 }
154 
155 /*
156      Handles adding another option to the list of options within this particular PetscOptionsBegin() PetscOptionsEnd()
157 */
158 #undef __FUNCT__
159 #define __FUNCT__ "PetscOptionsCreate_Private"
160 static int PetscOptionsCreate_Private(const char opt[],const char text[],const char man[],OptionType t,PetscOptions *amsopt)
161 {
162   int          ierr;
163   PetscOptions next;
164 
165   PetscFunctionBegin;
166   ierr             = PetscNew(struct _p_Options,amsopt);CHKERRQ(ierr);
167   (*amsopt)->next  = 0;
168   (*amsopt)->set   = PETSC_FALSE;
169   (*amsopt)->type  = t;
170   (*amsopt)->data  = 0;
171   (*amsopt)->edata = 0;
172 
173   ierr             = PetscStrallocpy(text,&(*amsopt)->text);CHKERRQ(ierr);
174   ierr             = PetscStrallocpy(opt,&(*amsopt)->option);CHKERRQ(ierr);
175   ierr             = PetscStrallocpy(man,&(*amsopt)->man);CHKERRQ(ierr);
176 
177   if (!PetscOptionsObject.next) {
178     PetscOptionsObject.next = *amsopt;
179   } else {
180     next = PetscOptionsObject.next;
181     while (next->next) next = next->next;
182     next->next = *amsopt;
183   }
184   PetscFunctionReturn(0);
185 }
186 
187 #undef __FUNCT__
188 #define __FUNCT__ "PetscOptionsGetFromGui"
189 PetscErrorCode PetscOptionsGetFromGUI()
190 {
191   PetscErrorCode ierr;
192   PetscOptions   next = PetscOptionsObject.next;
193   char           str[512];
194 
195   ierr = (*PetscPrintf)(PetscOptionsObject.comm,"%s -------------------------------------------------\n",PetscOptionsObject.title);CHKERRQ(ierr);
196   while (next) {
197     switch (next->type) {
198       case OPTION_HEAD:
199         break;
200       case OPTION_INT:
201         ierr = PetscPrintf(PetscOptionsObject.comm,"-%s%s <%d>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",next->option,*(int*)next->data,next->text,next->man);CHKERRQ(ierr);
202         scanf("%s\n",str);
203         if (str[0] != '\n') {
204           printf("changing value\n");
205         }
206         break;
207     default:
208       break;
209     }
210     next = next->next;
211   }
212   PetscFunctionReturn(0);
213 }
214 
215 #undef __FUNCT__
216 #define __FUNCT__ "PetscOptionsEnd_Private"
217 PetscErrorCode PetscOptionsEnd_Private(void)
218 {
219   PetscErrorCode ierr;
220   PetscOptions   last;
221   char           option[256],value[1024],tmp[32];
222   PetscInt       j;
223 
224   PetscFunctionBegin;
225 
226   /*  if (PetscOptionsObject.next) {
227     ierr = PetscOptionsGetFromGUI();
228     }*/
229 
230   ierr = PetscStrfree(PetscOptionsObject.title);CHKERRQ(ierr); PetscOptionsObject.title  = 0;
231   ierr = PetscStrfree(PetscOptionsObject.prefix);CHKERRQ(ierr); PetscOptionsObject.prefix = 0;
232 
233   /* reset counter to -2; this updates the screen with the new options for the selected method */
234   if (PetscOptionsObject.changedmethod) PetscOptionsPublishCount = -2;
235   /* reset alreadyprinted flag */
236   PetscOptionsObject.alreadyprinted = PETSC_FALSE;
237 
238   while (PetscOptionsObject.next) {
239     if (PetscOptionsObject.next->set) {
240       if (PetscOptionsObject.prefix) {
241         ierr = PetscStrcpy(option,"-");CHKERRQ(ierr);
242         ierr = PetscStrcat(option,PetscOptionsObject.prefix);CHKERRQ(ierr);
243         ierr = PetscStrcat(option,PetscOptionsObject.next->option+1);CHKERRQ(ierr);
244       } else {
245         ierr = PetscStrcpy(option,PetscOptionsObject.next->option);CHKERRQ(ierr);
246       }
247 
248       switch (PetscOptionsObject.next->type) {
249         case OPTION_HEAD:
250           break;
251         case OPTION_INT:
252           sprintf(value,"%d",*(PetscInt*)PetscOptionsObject.next->data);
253           break;
254         case OPTION_REAL:
255           sprintf(value,"%g",*(PetscReal*)PetscOptionsObject.next->data);
256           break;
257         case OPTION_REAL_ARRAY:
258           sprintf(value,"%g",((PetscReal*)PetscOptionsObject.next->data)[0]);
259           for (j=1; j<PetscOptionsObject.next->arraylength; j++) {
260             sprintf(tmp,"%g",((PetscReal*)PetscOptionsObject.next->data)[j]);
261             ierr = PetscStrcat(value,",");CHKERRQ(ierr);
262             ierr = PetscStrcat(value,tmp);CHKERRQ(ierr);
263           }
264           break;
265         case OPTION_LOGICAL:
266           sprintf(value,"%d",*(PetscInt*)PetscOptionsObject.next->data);
267           break;
268         case OPTION_LIST:
269           ierr = PetscStrcpy(value,*(char**)PetscOptionsObject.next->data);CHKERRQ(ierr);
270           break;
271         case OPTION_STRING: /* also handles string arrays */
272           ierr = PetscStrcpy(value,*(char**)PetscOptionsObject.next->data);CHKERRQ(ierr);
273           break;
274       }
275       ierr = PetscOptionsSetValue(option,value);CHKERRQ(ierr);
276     }
277     ierr   = PetscStrfree(PetscOptionsObject.next->text);CHKERRQ(ierr);
278     ierr   = PetscStrfree(PetscOptionsObject.next->option);CHKERRQ(ierr);
279     ierr   = PetscFree(PetscOptionsObject.next->man);CHKERRQ(ierr);
280     ierr   = PetscFree(PetscOptionsObject.next->data);CHKERRQ(ierr);
281     ierr   = PetscFree(PetscOptionsObject.next->edata);CHKERRQ(ierr);
282     last                    = PetscOptionsObject.next;
283     PetscOptionsObject.next = PetscOptionsObject.next->next;
284     ierr                    = PetscFree(last);CHKERRQ(ierr);
285   }
286   PetscOptionsObject.next = 0;
287   PetscFunctionReturn(0);
288 }
289 
290 #undef __FUNCT__
291 #define __FUNCT__ "PetscOptionsEnum"
292 /*@C
293    PetscOptionsEnum - Gets the enum value for a particular option in the database.
294 
295    Collective on the communicator passed in PetscOptionsBegin()
296 
297    Input Parameters:
298 +  opt - option name
299 .  text - short string that describes the option
300 .  man - manual page with additional information on option
301 .  list - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null
302 -  defaultv - the default (current) value
303 
304    Output Parameter:
305 +  value - the  value to return
306 -  flg - PETSC_TRUE if found, else PETSC_FALSE
307 
308    Level: beginner
309 
310    Concepts: options database
311 
312    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
313 
314           list is usually something like PCASMTypes or some other predefined list of enum names
315 
316 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
317           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
318           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
319           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
320           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
321           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
322           PetscOptionsList(), PetscOptionsEList()
323 @*/
324 PetscErrorCode PETSC_DLLEXPORT PetscOptionsEnum(const char opt[],const char text[],const char man[],const char **list,PetscEnum defaultv,PetscEnum *value,PetscTruth *set)
325 {
326   PetscErrorCode ierr;
327   PetscInt       ntext = 0;
328 
329   PetscFunctionBegin;
330   while (list[ntext++]) {
331     if (ntext > 50) SETERRQ(PETSC_ERR_ARG_WRONG,"List argument appears to be wrong or have more than 50 entries");
332   }
333   if (ntext < 3) SETERRQ(PETSC_ERR_ARG_WRONG,"List argument must have at least two entries: typename and type prefix");
334   ntext -= 3;
335   ierr = PetscOptionsEList(opt,text,man,list,ntext,list[defaultv],(PetscInt*)value,set);CHKERRQ(ierr);
336   PetscFunctionReturn(0);
337 }
338 
339 /* -------------------------------------------------------------------------------------------------------------*/
340 #undef __FUNCT__
341 #define __FUNCT__ "PetscOptionsInt"
342 /*@C
343    PetscOptionsInt - Gets the integer value for a particular option in the database.
344 
345    Collective on the communicator passed in PetscOptionsBegin()
346 
347    Input Parameters:
348 +  opt - option name
349 .  text - short string that describes the option
350 .  man - manual page with additional information on option
351 -  defaultv - the default (current) value
352 
353    Output Parameter:
354 +  value - the integer value to return
355 -  flg - PETSC_TRUE if found, else PETSC_FALSE
356 
357    Level: beginner
358 
359    Concepts: options database^has int
360 
361    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
362 
363 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
364           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
365           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
366           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
367           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
368           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
369           PetscOptionsList(), PetscOptionsEList()
370 @*/
371 PetscErrorCode PETSC_DLLEXPORT PetscOptionsInt(const char opt[],const char text[],const char man[],PetscInt defaultv,PetscInt *value,PetscTruth *set)
372 {
373   PetscErrorCode ierr;
374   PetscOptions   amsopt;
375 
376   PetscFunctionBegin;
377   if (PetscOptionsPublishCount == 1) {
378     ierr = PetscOptionsCreate_Private(opt,text,man,OPTION_INT,&amsopt);CHKERRQ(ierr);
379     ierr = PetscMalloc(sizeof(PetscInt),&amsopt->data);CHKERRQ(ierr);
380     *(PetscInt*)amsopt->data = defaultv;
381   }
382   ierr = PetscOptionsGetInt(PetscOptionsObject.prefix,opt,value,set);CHKERRQ(ierr);
383   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
384     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <%d>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv,text,man);CHKERRQ(ierr);
385   }
386   PetscFunctionReturn(0);
387 }
388 
389 #undef __FUNCT__
390 #define __FUNCT__ "PetscOptionsString"
391 /*@C
392    PetscOptionsString - Gets the string value for a particular option in the database.
393 
394    Collective on the communicator passed in PetscOptionsBegin()
395 
396    Input Parameters:
397 +  opt - option name
398 .  text - short string that describes the option
399 .  man - manual page with additional information on option
400 -  defaultv - the default (current) value
401 
402    Output Parameter:
403 +  value - the value to return
404 -  flg - PETSC_TRUE if found, else PETSC_FALSE
405 
406    Level: beginner
407 
408    Concepts: options database^has int
409 
410    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
411 
412 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
413           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
414           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
415           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
416           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
417           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
418           PetscOptionsList(), PetscOptionsEList()
419 @*/
420 PetscErrorCode PETSC_DLLEXPORT PetscOptionsString(const char opt[],const char text[],const char man[],const char defaultv[],char value[],size_t len,PetscTruth *set)
421 {
422   PetscErrorCode ierr;
423 
424   PetscFunctionBegin;
425   ierr = PetscOptionsGetString(PetscOptionsObject.prefix,opt,value,len,set);CHKERRQ(ierr);
426   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
427     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <%s>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv,text,man);CHKERRQ(ierr);
428   }
429   PetscFunctionReturn(0);
430 }
431 
432 /*
433      Publishes an AMS double field (with the default value in it) and with a name
434    given by the text string
435 */
436 #undef __FUNCT__
437 #define __FUNCT__ "PetscOptionsReal"
438 /*@C
439    PetscOptionsReal - Gets the PetscReal value for a particular option in the database.
440 
441    Collective on the communicator passed in PetscOptionsBegin()
442 
443    Input Parameters:
444 +  opt - option name
445 .  text - short string that describes the option
446 .  man - manual page with additional information on option
447 -  defaultv - the default (current) value
448 
449    Output Parameter:
450 +  value - the value to return
451 -  flg - PETSC_TRUE if found, else PETSC_FALSE
452 
453    Level: beginner
454 
455    Concepts: options database^has int
456 
457    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
458 
459 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
460           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
461           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
462           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
463           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
464           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
465           PetscOptionsList(), PetscOptionsEList()
466 @*/
467 PetscErrorCode PETSC_DLLEXPORT PetscOptionsReal(const char opt[],const char text[],const char man[],PetscReal defaultv,PetscReal *value,PetscTruth *set)
468 {
469   PetscErrorCode ierr;
470 
471   PetscFunctionBegin;
472   ierr = PetscOptionsGetReal(PetscOptionsObject.prefix,opt,value,set);CHKERRQ(ierr);
473   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
474     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <%G>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv,text,man);CHKERRQ(ierr);
475   }
476   PetscFunctionReturn(0);
477 }
478 
479 #undef __FUNCT__
480 #define __FUNCT__ "PetscOptionsScalar"
481 /*@C
482    PetscOptionsScalar - Gets the scalar value for a particular option in the database.
483 
484    Collective on the communicator passed in PetscOptionsBegin()
485 
486    Input Parameters:
487 +  opt - option name
488 .  text - short string that describes the option
489 .  man - manual page with additional information on option
490 -  defaultv - the default (current) value
491 
492    Output Parameter:
493 +  value - the value to return
494 -  flg - PETSC_TRUE if found, else PETSC_FALSE
495 
496    Level: beginner
497 
498    Concepts: options database^has int
499 
500    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
501 
502 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
503           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
504           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
505           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
506           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
507           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
508           PetscOptionsList(), PetscOptionsEList()
509 @*/
510 PetscErrorCode PETSC_DLLEXPORT PetscOptionsScalar(const char opt[],const char text[],const char man[],PetscScalar defaultv,PetscScalar *value,PetscTruth *set)
511 {
512   PetscErrorCode ierr;
513 
514   PetscFunctionBegin;
515 #if !defined(PETSC_USE_COMPLEX)
516   ierr = PetscOptionsReal(opt,text,man,defaultv,value,set);CHKERRQ(ierr);
517 #else
518   ierr = PetscOptionsGetScalar(PetscOptionsObject.prefix,opt,value,set);CHKERRQ(ierr);
519 #endif
520   PetscFunctionReturn(0);
521 }
522 
523 /*
524      Publishes an AMS logical field (with the default value in it) and with a name
525    given by the text string
526 */
527 #undef __FUNCT__
528 #define __FUNCT__ "PetscOptionsName"
529 /*@C
530    PetscOptionsName - Determines if a particular option is in the database
531 
532    Collective on the communicator passed in PetscOptionsBegin()
533 
534    Input Parameters:
535 +  opt - option name
536 .  text - short string that describes the option
537 -  man - manual page with additional information on option
538 
539    Output Parameter:
540 .  flg - PETSC_TRUE if found, else PETSC_FALSE
541 
542    Level: beginner
543 
544    Concepts: options database^has int
545 
546    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
547 
548 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
549           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
550           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
551           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
552           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
553           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
554           PetscOptionsList(), PetscOptionsEList()
555 @*/
556 PetscErrorCode PETSC_DLLEXPORT PetscOptionsName(const char opt[],const char text[],const char man[],PetscTruth *flg)
557 {
558   PetscErrorCode ierr;
559 
560   PetscFunctionBegin;
561   ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr);
562   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
563     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr);
564   }
565   PetscFunctionReturn(0);
566 }
567 
568 #undef __FUNCT__
569 #define __FUNCT__ "PetscOptionsList"
570 /*@C
571      PetscOptionsList - Puts a list of option values that a single one may be selected from
572 
573    Collective on the communicator passed in PetscOptionsBegin()
574 
575    Input Parameters:
576 +  opt - option name
577 .  text - short string that describes the option
578 .  man - manual page with additional information on option
579 .  list - the possible choices
580 -  defaultv - the default (current) value
581 
582    Output Parameter:
583 +  value - the value to return
584 -  set - PETSC_TRUE if found, else PETSC_FALSE
585 
586    Level: intermediate
587 
588    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
589 
590    See PetscOptionsEList() for when the choices are given in a string array
591 
592    To get a listing of all currently specified options,
593     see PetscOptionsPrint() or PetscOptionsGetAll()
594 
595    Concepts: options database^list
596 
597 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
598            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
599           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
600           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
601           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
602           PetscOptionsList(), PetscOptionsEList()
603 @*/
604 PetscErrorCode PETSC_DLLEXPORT PetscOptionsList(const char opt[],const char ltext[],const char man[],PetscFList list,const char defaultv[],char value[],PetscInt len,PetscTruth *set)
605 {
606   PetscErrorCode ierr;
607 
608   PetscFunctionBegin;
609   ierr = PetscOptionsGetString(PetscOptionsObject.prefix,opt,value,len,set);CHKERRQ(ierr);
610   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
611     ierr = PetscFListPrintTypes(PetscOptionsObject.comm,stdout,PetscOptionsObject.prefix,opt,ltext,man,list);CHKERRQ(ierr);CHKERRQ(ierr);
612   }
613   PetscFunctionReturn(0);
614 }
615 
616 #undef __FUNCT__
617 #define __FUNCT__ "PetscOptionsEList"
618 /*@C
619      PetscOptionsEList - Puts a list of option values that a single one may be selected from
620 
621    Collective on the communicator passed in PetscOptionsBegin()
622 
623    Input Parameters:
624 +  opt - option name
625 .  ltext - short string that describes the option
626 .  man - manual page with additional information on option
627 .  list - the possible choices
628 .  ntext - number of choices
629 -  defaultv - the default (current) value
630 
631    Output Parameter:
632 +  value - the index of the value to return
633 -  set - PETSC_TRUE if found, else PETSC_FALSE
634 
635    Level: intermediate
636 
637    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
638 
639    See PetscOptionsList() for when the choices are given in a PetscFList()
640 
641    Concepts: options database^list
642 
643 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
644            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
645           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
646           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
647           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
648           PetscOptionsList(), PetscOptionsEList()
649 @*/
650 PetscErrorCode PETSC_DLLEXPORT PetscOptionsEList(const char opt[],const char ltext[],const char man[],const char **list,PetscInt ntext,const char defaultv[],PetscInt *value,PetscTruth *set)
651 {
652   PetscErrorCode ierr;
653   PetscInt       i;
654 
655   PetscFunctionBegin;
656   ierr = PetscOptionsGetEList(PetscOptionsObject.prefix,opt,list,ntext,value,set);CHKERRQ(ierr);
657   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
658     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <%s> (choose one of)",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv);CHKERRQ(ierr);
659     for (i=0; i<ntext; i++){
660       ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," %s",list[i]);CHKERRQ(ierr);
661     }
662     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"\n");CHKERRQ(ierr);
663   }
664   PetscFunctionReturn(0);
665 }
666 
667 #undef __FUNCT__
668 #define __FUNCT__ "PetscOptionsTruthGroupBegin"
669 /*@C
670      PetscOptionsTruthGroupBegin - First in a series of logical queries on the options database for
671        which only a single value can be true.
672 
673    Collective on the communicator passed in PetscOptionsBegin()
674 
675    Input Parameters:
676 +  opt - option name
677 .  text - short string that describes the option
678 -  man - manual page with additional information on option
679 
680    Output Parameter:
681 .  flg - whether that option was set or not
682 
683    Level: intermediate
684 
685    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
686 
687    Must be followed by 0 or more PetscOptionsTruthGroup()s and PetscOptionsTruthGroupEnd()
688 
689     Concepts: options database^logical group
690 
691 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
692            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
693           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
694           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
695           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
696           PetscOptionsList(), PetscOptionsEList()
697 @*/
698 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroupBegin(const char opt[],const char text[],const char man[],PetscTruth *flg)
699 {
700   PetscErrorCode ierr;
701 
702   PetscFunctionBegin;
703   ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr);
704   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
705     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  Pick at most one of -------------\n");CHKERRQ(ierr);
706     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"    -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr);
707   }
708   PetscFunctionReturn(0);
709 }
710 
711 #undef __FUNCT__
712 #define __FUNCT__ "PetscOptionsTruthGroup"
713 /*@C
714      PetscOptionsTruthGroup - One in a series of logical queries on the options database for
715        which only a single value can be true.
716 
717    Collective on the communicator passed in PetscOptionsBegin()
718 
719    Input Parameters:
720 +  opt - option name
721 .  text - short string that describes the option
722 -  man - manual page with additional information on option
723 
724    Output Parameter:
725 .  flg - PETSC_TRUE if found, else PETSC_FALSE
726 
727    Level: intermediate
728 
729    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
730 
731    Must follow a PetscOptionsTruthGroupBegin() and preceded a PetscOptionsTruthGroupEnd()
732 
733     Concepts: options database^logical group
734 
735 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
736            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
737           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
738           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
739           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
740           PetscOptionsList(), PetscOptionsEList()
741 @*/
742 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroup(const char opt[],const char text[],const char man[],PetscTruth *flg)
743 {
744   PetscErrorCode ierr;
745 
746   PetscFunctionBegin;
747   ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr);
748   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
749     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"    -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr);
750   }
751   PetscFunctionReturn(0);
752 }
753 
754 #undef __FUNCT__
755 #define __FUNCT__ "PetscOptionsTruthGroupEnd"
756 /*@C
757      PetscOptionsTruthGroupEnd - Last in a series of logical queries on the options database for
758        which only a single value can be true.
759 
760    Collective on the communicator passed in PetscOptionsBegin()
761 
762    Input Parameters:
763 +  opt - option name
764 .  text - short string that describes the option
765 -  man - manual page with additional information on option
766 
767    Output Parameter:
768 .  flg - PETSC_TRUE if found, else PETSC_FALSE
769 
770    Level: intermediate
771 
772    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
773 
774    Must follow a PetscOptionsTruthGroupBegin()
775 
776     Concepts: options database^logical group
777 
778 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
779            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
780           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
781           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
782           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
783           PetscOptionsList(), PetscOptionsEList()
784 @*/
785 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroupEnd(const char opt[],const char text[],const char man[],PetscTruth *flg)
786 {
787   PetscErrorCode ierr;
788 
789   PetscFunctionBegin;
790   ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr);
791   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
792     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"    -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr);
793   }
794   PetscFunctionReturn(0);
795 }
796 
797 #undef __FUNCT__
798 #define __FUNCT__ "PetscOptionsTruth"
799 /*@C
800    PetscOptionsTruth - Determines if a particular option is in the database with a true or false
801 
802    Collective on the communicator passed in PetscOptionsBegin()
803 
804    Input Parameters:
805 +  opt - option name
806 .  text - short string that describes the option
807 -  man - manual page with additional information on option
808 
809    Output Parameter:
810 .  flg - PETSC_TRUE or PETSC_FALSE
811 .  set - PETSC_TRUE if found, else PETSC_FALSE
812 
813    Level: beginner
814 
815    Concepts: options database^logical
816 
817    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
818 
819 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
820           PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth()
821           PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(),
822           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
823           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
824           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
825           PetscOptionsList(), PetscOptionsEList()
826 @*/
827 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruth(const char opt[],const char text[],const char man[],PetscTruth deflt,PetscTruth *flg,PetscTruth *set)
828 {
829   PetscErrorCode ierr;
830   PetscTruth     iset;
831 
832   PetscFunctionBegin;
833   ierr = PetscOptionsGetTruth(PetscOptionsObject.prefix,opt,flg,&iset);CHKERRQ(ierr);
834   if (!iset) {
835     if (flg) *flg = deflt;
836   }
837   if (set) *set = iset;
838   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
839     const char *v = PetscTruths[deflt];
840     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s: <%s> %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,v,text,man);CHKERRQ(ierr);
841   }
842   PetscFunctionReturn(0);
843 }
844 
845 #undef __FUNCT__
846 #define __FUNCT__ "PetscOptionsRealArray"
847 /*@C
848    PetscOptionsRealArray - Gets an array of double values for a particular
849    option in the database. The values must be separated with commas with
850    no intervening spaces.
851 
852    Collective on the communicator passed in PetscOptionsBegin()
853 
854    Input Parameters:
855 +  opt - the option one is seeking
856 .  text - short string describing option
857 .  man - manual page for option
858 -  nmax - maximum number of values
859 
860    Output Parameter:
861 +  value - location to copy values
862 .  nmax - actual number of values found
863 -  set - PETSC_TRUE if found, else PETSC_FALSE
864 
865    Level: beginner
866 
867    Notes:
868    The user should pass in an array of doubles
869 
870    Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
871 
872    Concepts: options database^array of strings
873 
874 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
875            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
876           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
877           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
878           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
879           PetscOptionsList(), PetscOptionsEList()
880 @*/
881 PetscErrorCode PETSC_DLLEXPORT PetscOptionsRealArray(const char opt[],const char text[],const char man[],PetscReal value[],PetscInt *n,PetscTruth *set)
882 {
883   PetscErrorCode ierr;
884   PetscInt       i;
885 
886   PetscFunctionBegin;
887   ierr = PetscOptionsGetRealArray(PetscOptionsObject.prefix,opt,value,n,set);CHKERRQ(ierr);
888   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
889     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <%G",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,value[0]);CHKERRQ(ierr);
890     for (i=1; i<*n; i++) {
891       ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,",%G",value[i]);CHKERRQ(ierr);
892     }
893     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,">: %s (%s)\n",text,man);CHKERRQ(ierr);
894   }
895   PetscFunctionReturn(0);
896 }
897 
898 
899 #undef __FUNCT__
900 #define __FUNCT__ "PetscOptionsIntArray"
901 /*@C
902    PetscOptionsIntArray - Gets an array of integers for a particular
903    option in the database. The values must be separated with commas with
904    no intervening spaces.
905 
906    Collective on the communicator passed in PetscOptionsBegin()
907 
908    Input Parameters:
909 +  opt - the option one is seeking
910 .  text - short string describing option
911 .  man - manual page for option
912 -  nmax - maximum number of values
913 
914    Output Parameter:
915 +  value - location to copy values
916 .  nmax - actual number of values found
917 -  set - PETSC_TRUE if found, else PETSC_FALSE
918 
919    Level: beginner
920 
921    Notes:
922    The user should pass in an array of integers
923 
924    Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
925 
926    Concepts: options database^array of strings
927 
928 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
929            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
930           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
931           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
932           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
933           PetscOptionsList(), PetscOptionsEList(), PetscOptionsRealArray()
934 @*/
935 PetscErrorCode PETSC_DLLEXPORT PetscOptionsIntArray(const char opt[],const char text[],const char man[],PetscInt value[],PetscInt *n,PetscTruth *set)
936 {
937   PetscErrorCode ierr;
938   PetscInt       i;
939 
940   PetscFunctionBegin;
941   ierr = PetscOptionsGetIntArray(PetscOptionsObject.prefix,opt,value,n,set);CHKERRQ(ierr);
942   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
943     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <%d",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,value[0]);CHKERRQ(ierr);
944     for (i=1; i<*n; i++) {
945       ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,",%d",value[i]);CHKERRQ(ierr);
946     }
947     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,">: %s (%s)\n",text,man);CHKERRQ(ierr);
948   }
949   PetscFunctionReturn(0);
950 }
951 
952 #undef __FUNCT__
953 #define __FUNCT__ "PetscOptionsStringArray"
954 /*@C
955    PetscOptionsStringArray - Gets an array of string values for a particular
956    option in the database. The values must be separated with commas with
957    no intervening spaces.
958 
959    Collective on the communicator passed in PetscOptionsBegin()
960 
961    Input Parameters:
962 +  opt - the option one is seeking
963 .  text - short string describing option
964 .  man - manual page for option
965 -  nmax - maximum number of strings
966 
967    Output Parameter:
968 +  value - location to copy strings
969 .  nmax - actual number of strings found
970 -  set - PETSC_TRUE if found, else PETSC_FALSE
971 
972    Level: beginner
973 
974    Notes:
975    The user should pass in an array of pointers to char, to hold all the
976    strings returned by this function.
977 
978    The user is responsible for deallocating the strings that are
979    returned. The Fortran interface for this routine is not supported.
980 
981    Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
982 
983    Concepts: options database^array of strings
984 
985 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
986            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
987           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
988           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
989           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
990           PetscOptionsList(), PetscOptionsEList()
991 @*/
992 PetscErrorCode PETSC_DLLEXPORT PetscOptionsStringArray(const char opt[],const char text[],const char man[],char *value[],PetscInt *nmax,PetscTruth *set)
993 {
994   PetscErrorCode ierr;
995 
996   PetscFunctionBegin;
997   ierr = PetscOptionsGetStringArray(PetscOptionsObject.prefix,opt,value,nmax,set);CHKERRQ(ierr);
998   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
999     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  -%s%s <string1,string2,...>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr);
1000   }
1001   PetscFunctionReturn(0);
1002 }
1003 
1004 
1005 #undef __FUNCT__
1006 #define __FUNCT__ "PetscOptionsHead"
1007 /*@C
1008      PetscOptionsHead - Puts a heading before listing any more published options. Used, for example,
1009             in KSPSetFromOptions_GMRES().
1010 
1011    Collective on the communicator passed in PetscOptionsBegin()
1012 
1013    Input Parameter:
1014 .   head - the heading text
1015 
1016 
1017    Level: intermediate
1018 
1019    Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
1020 
1021           Can be followed by a call to PetscOptionsTail() in the same function.
1022 
1023    Concepts: options database^subheading
1024 
1025 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
1026            PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(),
1027           PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
1028           PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
1029           PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(),
1030           PetscOptionsList(), PetscOptionsEList()
1031 @*/
1032 PetscErrorCode PETSC_DLLEXPORT PetscOptionsHead(const char head[])
1033 {
1034   PetscErrorCode ierr;
1035 
1036   PetscFunctionBegin;
1037   if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) {
1038     ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"  %s\n",head);CHKERRQ(ierr);
1039   }
1040   PetscFunctionReturn(0);
1041 }
1042 
1043 
1044 
1045 
1046 
1047 
1048