Actual source code: aoptions.c
1: /*$Id: aoptions.c,v 1.34 2001/08/31 16:19:18 bsmith Exp $*/
2: /*
3: These routines simplify the use of command line, file options, etc.,
4: and are used to manipulate the options database.
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: */
10: #include petsc.h
11: #include petscsys.h
12: #if defined(PETSC_HAVE_STDLIB_H)
13: #include <stdlib.h>
14: #endif
16: #if defined(PETSC_HAVE_AMS)
17: /*
18: We keep a linked list of options that have been posted and we are waiting for
19: user selection
21: Eventually we'll attach this beast to a MPI_Comm
22: */
23: typedef enum {OPTION_INT,OPTION_LOGICAL,OPTION_REAL,OPTION_LIST,OPTION_STRING,OPTION_REAL_ARRAY,OPTION_HEAD} OptionType;
24: typedef struct _p_OptionsAMS* PetscOptionsAMS;
25: struct _p_OptionsAMS {
26: char *option;
27: char *text;
28: void *data;
29: void *edata;
30: int arraylength;
31: PetscTruth set;
32: OptionType type;
33: PetscOptionsAMS next;
34: char *man;
35: };
36: #endif
38: typedef struct {
39: #if defined(PETSC_HAVE_AMS)
40: AMS_Memory amem;
41: PetscOptionsAMS next;
42: #endif
43: char *prefix,*mprefix; /* publish mprefix, not prefix cause the AMS will change it BUT we need to free it*/
44: char *title;
45: MPI_Comm comm;
46: PetscTruth printhelp;
47: PetscTruth changedmethod;
48: } PetscOptionsPublishObject;
49: static PetscOptionsPublishObject amspub;
50: int PetscOptionsPublishCount;
52: /*MC
53: PetscOptionsBegin - Begins a set of queries on the options database that are related and should be
54: displayed on the same window of a GUI that allows the user to set the options interactively.
56: Synopsis: int PetscOptionsBegin(MPI_Comm comm,char *prefix,char *title,char *mansec)
58: Collective on MPI_Comm
60: Input Parameters:
61: + comm - communicator that shares GUI
62: . prefix - options prefix for all options displayed on window
63: . title - short descriptive text, for example "Krylov Solver Options"
64: - mansec - section of manual pages for options, for example KSP
66: Level: intermediate
68: Notes: Needs to be ended by a call the PetscOptionsEnd()
70: Can add subheadings with PetscOptionsHead()
72: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
73: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
74: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
75: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
76: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
77: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
78: PetscOptionsList(), PetscOptionsEList()
80: M*/
81: #undef __FUNCT__
83: int PetscOptionsBegin_Private(MPI_Comm comm,char *prefix,char *title,char *mansec)
84: {
85: int ierr;
88: PetscStrallocpy(prefix,&amspub.prefix);
89: PetscStrallocpy(title,&amspub.title);
90: amspub.comm = comm;
91: PetscOptionsHasName(PETSC_NULL,"-help",&amspub.printhelp);
92: if (amspub.printhelp && PetscOptionsPublishCount) {
93: (*PetscHelpPrintf)(comm,"%s -------------------------------------------------n",title);
94: }
95:
96: #if defined(PETSC_HAVE_AMS)
97: if (!PetscOptionsPublishCount) {
98: AMS_Comm acomm;
99: static int count = 0;
100: char options[16];
101: /* the next line is a bug, this will only work if all processors are here, the comm passed in is ignored!!! */
102: PetscViewerAMSGetAMSComm(PETSC_VIEWER_AMS_(PETSC_COMM_WORLD),&acomm);
103: sprintf(options,"Options_%d",count++);
104: AMS_Memory_create(acomm,options,&amspub.amem);
105: AMS_Memory_take_access(amspub.amem);
106: amspub.mprefix = amspub.prefix;
107: AMS_Memory_add_field(amspub.amem,title,&amspub.mprefix,1,AMS_STRING,AMS_READ,AMS_COMMON,AMS_REDUCT_UNDEF);
108: AMS_Memory_add_field(amspub.amem,mansec,&amspub.mprefix,1,AMS_STRING,AMS_READ,AMS_COMMON,AMS_REDUCT_UNDEF);
109: amspub.changedmethod = PETSC_FALSE;
110: AMS_Memory_add_field(amspub.amem,"ChangedMethod",&amspub.changedmethod,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
111: }
112: #endif
113: return(0);
114: }
116: /*MC
117: PetscOptionsEnd - Ends a set of queries on the options database that are related and should be
118: displayed on the same window of a GUI that allows the user to set the options interactively.
120: Collective on the MPI_Comm used in PetscOptionsBegin()
122: Synopsis: int PetscOptionsEnd(void)
124: Level: intermediate
126: Notes: Needs to be preceded by a call to PetscOptionsBegin()
128: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
129: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
130: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
131: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
132: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
133: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
134: PetscOptionsList(), PetscOptionsEList()
136: M*/
137: #undef __FUNCT__
139: int PetscOptionsEnd_Private(void)
140: {
144: #if defined(PETSC_HAVE_AMS)
145: if (!PetscOptionsPublishCount) {
146: PetscOptionsAMS last;
147: char option[256],value[1024],tmp[32];
148: int j;
150: if (amspub.amem < 0) SETERRQ(1,"Called without a call to PetscOptionsBegin()");
151: AMS_Memory_publish(amspub.amem);
152: AMS_Memory_grant_access(amspub.amem);
153: /* wait until accessor has unlocked the memory */
154: AMS_Memory_lock(amspub.amem,0);
155: AMS_Memory_take_access(amspub.amem);
157: /* reset counter to -2; this updates the screen with the new options for the selected method */
158: if (amspub.changedmethod) PetscOptionsPublishCount = -2;
160: /*
161: Free all the PetscOptions in the linked list and add any changed ones to the database
162: */
163: while (amspub.next) {
164: if (amspub.next->set) {
165: if (amspub.prefix) {
166: PetscStrcpy(option,"-");
167: PetscStrcat(option,amspub.prefix);
168: PetscStrcat(option,amspub.next->option+1);
169: } else {
170: PetscStrcpy(option,amspub.next->option);
171: }
173: switch (amspub.next->type) {
174: case OPTION_HEAD:
175: break;
176: case OPTION_INT:
177: sprintf(value,"%d",*(int*)amspub.next->data);
178: break;
179: case OPTION_REAL:
180: sprintf(value,"%g",*(double*)amspub.next->data);
181: break;
182: case OPTION_REAL_ARRAY:
183: sprintf(value,"%g",((PetscReal*)amspub.next->data)[0]);
184: for (j=1; j<amspub.next->arraylength; j++) {
185: sprintf(tmp,"%g",((PetscReal*)amspub.next->data)[j]);
186: PetscStrcat(value,",");
187: PetscStrcat(value,tmp);
188: }
189: break;
190: case OPTION_LOGICAL:
191: sprintf(value,"%d",*(int*)amspub.next->data);
192: break;
193: case OPTION_LIST:
194: PetscStrcpy(value,*(char**)amspub.next->data);
195: break;
196: case OPTION_STRING: /* also handles string arrays */
197: PetscStrcpy(value,*(char**)amspub.next->data);
198: break;
199: }
200: PetscOptionsSetValue(option,value);
201: }
202: ierr = PetscStrfree(amspub.next->text);
203: ierr = PetscStrfree(amspub.next->option);
204: ierr = PetscFree(amspub.next->man);
205: if (amspub.next->data) {PetscFree(amspub.next->data);}
206: if (amspub.next->edata) {PetscFree(amspub.next->edata);}
207: last = amspub.next;
208: amspub.next = amspub.next->next;
209: ierr = PetscFree(last);
210: }
211: AMS_Memory_grant_access(amspub.amem);
212: AMS_Memory_destroy(amspub.amem);
213: }
214: #endif
215: PetscStrfree(amspub.title); amspub.title = 0;
216: PetscStrfree(amspub.prefix); amspub.prefix = 0;
217: return(0);
218: }
220: #if defined(PETSC_HAVE_AMS)
221: /*
222: Publishes the "lock" for an option; with a name that is the command line
223: option name. This is the first item that is always published for an option
224: */
225: #undef __FUNCT__
227: static int PetscOptionsCreate_Private(char *opt,char *text,char *man,PetscOptionsAMS *amsopt)
228: {
229: int ierr;
230: static int mancount = 0;
231: PetscOptionsAMS next;
232: char manname[16];
235: ierr = PetscNew(struct _p_OptionsAMS,amsopt);
236: (*amsopt)->next = 0;
237: (*amsopt)->set = PETSC_FALSE;
238: (*amsopt)->data = 0;
239: (*amsopt)->edata = 0;
240: ierr = PetscStrallocpy(text,&(*amsopt)->text);
241: ierr = PetscStrallocpy(opt,&(*amsopt)->option);
242: AMS_Memory_add_field(amspub.amem,opt,&(*amsopt)->set,1,AMS_INT,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
243: sprintf(manname,"man_%d",mancount++);
244: ierr = PetscMalloc(sizeof(char*),&(*amsopt)->man);
245: *(char **)(*amsopt)->man = man;
246: AMS_Memory_add_field(amspub.amem,manname,(*amsopt)->man,1,AMS_STRING,AMS_READ,AMS_COMMON,AMS_REDUCT_UNDEF);
248: if (!amspub.next) {
249: amspub.next = *amsopt;
250: } else {
251: next = amspub.next;
252: while (next->next) next = next->next;
253: next->next = *amsopt;
254: }
255: return(0);
256: }
257: #endif
259: /* -------------------------------------------------------------------------------------------------------------*/
260: /*
261: Publishes an AMS int field (with the default value in it) and with a name
262: given by the text string
263: */
264: #undef __FUNCT__
266: /*@C
267: PetscOptionsInt - Gets the integer value for a particular option in the database.
269: Collective on the communicator passed in PetscOptionsBegin()
271: Input Parameters:
272: + opt - option name
273: . text - short string that describes the option
274: . man - manual page with additional information on option
275: - defaultv - the default (current) value
277: Output Parameter:
278: + value - the integer value to return
279: - flg - PETSC_TRUE if found, else PETSC_FALSE
281: Level: beginner
283: Concepts: options database^has int
285: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
287: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
288: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
289: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
290: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
291: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
292: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
293: PetscOptionsList(), PetscOptionsEList()
294: @*/
295: int PetscOptionsInt(char *opt,char *text,char *man,int defaultv,int *value,PetscTruth *set)
296: {
297: int ierr;
300: #if defined(PETSC_HAVE_AMS)
301: if (!PetscOptionsPublishCount) {
302: PetscOptionsAMS amsopt;
303: PetscOptionsCreate_Private(opt,text,man,&amsopt);
304: amsopt->type = OPTION_INT;
305: PetscMalloc(sizeof(int),&amsopt->data);
306: *(int*)amsopt->data = defaultv;
307: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_INT,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
308: if (set) *set = PETSC_FALSE;
309: return(0);
310: }
311: #endif
312: PetscOptionsGetInt(amspub.prefix,opt,value,set);
313: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
314: (*PetscHelpPrintf)(amspub.comm," -%s%s <%d>: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,defaultv,text,man);
315: }
316: return(0);
317: }
319: #undef __FUNCT__
321: /*@C
322: PetscOptionsString - Gets the string value for a particular option in the database.
324: Collective on the communicator passed in PetscOptionsBegin()
326: Input Parameters:
327: + opt - option name
328: . text - short string that describes the option
329: . man - manual page with additional information on option
330: - defaultv - the default (current) value
332: Output Parameter:
333: + value - the value to return
334: - flg - PETSC_TRUE if found, else PETSC_FALSE
336: Level: beginner
338: Concepts: options database^has int
340: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
342: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
343: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
344: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
345: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
346: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
347: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
348: PetscOptionsList(), PetscOptionsEList()
349: @*/
350: int PetscOptionsString(char *opt,char *text,char *man,char *defaultv,char *value,int len,PetscTruth *set)
351: {
352: int ierr;
355: #if defined(PETSC_HAVE_AMS)
356: if (!PetscOptionsPublishCount) {
357: PetscOptionsAMS amsopt;
358: PetscOptionsCreate_Private(opt,text,man,&amsopt);
359: amsopt->type = OPTION_STRING;
360: PetscMalloc(sizeof(char*),&amsopt->data);
361: *(char**)amsopt->data = defaultv;
362: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_STRING,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
363: if (set) *set = PETSC_FALSE;
364: return(0);
365: }
366: #endif
367: PetscOptionsGetString(amspub.prefix,opt,value,len,set);
368: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
369: (*PetscHelpPrintf)(amspub.comm," -%s%s <%s>: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,defaultv,text,man);
370: }
371: return(0);
372: }
374: /*
375: Publishes an AMS double field (with the default value in it) and with a name
376: given by the text string
377: */
378: #undef __FUNCT__
380: /*@C
381: PetscOptionsReal - Gets the PetscReal value for a particular option in the database.
383: Collective on the communicator passed in PetscOptionsBegin()
385: Input Parameters:
386: + opt - option name
387: . text - short string that describes the option
388: . man - manual page with additional information on option
389: - defaultv - the default (current) value
391: Output Parameter:
392: + value - the value to return
393: - flg - PETSC_TRUE if found, else PETSC_FALSE
395: Level: beginner
397: Concepts: options database^has int
399: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
401: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
402: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
403: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
404: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
405: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
406: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
407: PetscOptionsList(), PetscOptionsEList()
408: @*/
409: int PetscOptionsReal(char *opt,char *text,char *man,PetscReal defaultv,PetscReal *value,PetscTruth *set)
410: {
411: int ierr;
414: #if defined(PETSC_HAVE_AMS)
415: if (!PetscOptionsPublishCount) {
416: PetscOptionsAMS amsopt;
417: PetscOptionsCreate_Private(opt,text,man,&amsopt);
418: amsopt->type = OPTION_REAL;
419: PetscMalloc(sizeof(PetscReal),&amsopt->data);
420: *(PetscReal*)amsopt->data = defaultv;
421: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_DOUBLE,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
422: if (set) *set = PETSC_FALSE;
423: return(0);
424: }
425: #endif
426: PetscOptionsGetReal(amspub.prefix,opt,value,set);
427: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
428: (*PetscHelpPrintf)(amspub.comm," -%s%s <%g>: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,defaultv,text,man);
429: }
430: return(0);
431: }
433: #undef __FUNCT__
435: /*@C
436: PetscOptionsScalar - Gets the scalar value for a particular option in the database.
438: Collective on the communicator passed in PetscOptionsBegin()
440: Input Parameters:
441: + opt - option name
442: . text - short string that describes the option
443: . man - manual page with additional information on option
444: - defaultv - the default (current) value
446: Output Parameter:
447: + value - the value to return
448: - flg - PETSC_TRUE if found, else PETSC_FALSE
450: Level: beginner
452: Concepts: options database^has int
454: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
456: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
457: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
458: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
459: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
460: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
461: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
462: PetscOptionsList(), PetscOptionsEList()
463: @*/
464: int PetscOptionsScalar(char *opt,char *text,char *man,PetscScalar defaultv,PetscScalar *value,PetscTruth *set)
465: {
469: #if !defined(PETSC_USE_COMPLEX)
470: PetscOptionsReal(opt,text,man,defaultv,value,set);
471: #else
472: PetscOptionsGetScalar(amspub.prefix,opt,value,set);
473: #endif
474: return(0);
475: }
477: /*
478: Publishes an AMS logical field (with the default value in it) and with a name
479: given by the text string
480: */
481: #undef __FUNCT__
483: /*@C
484: PetscOptionsName - Determines if a particular option is in the database
486: Collective on the communicator passed in PetscOptionsBegin()
488: Input Parameters:
489: + opt - option name
490: . text - short string that describes the option
491: - man - manual page with additional information on option
493: Output Parameter:
494: . flg - PETSC_TRUE if found, else PETSC_FALSE
496: Level: beginner
498: Concepts: options database^has int
500: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
502: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
503: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
504: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
505: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
506: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
507: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
508: PetscOptionsList(), PetscOptionsEList()
509: @*/
510: int PetscOptionsName(char *opt,char *text,char *man,PetscTruth *flg)
511: {
512: int ierr;
515: #if defined(PETSC_HAVE_AMS)
516: if (!PetscOptionsPublishCount) {
517: PetscOptionsAMS amsopt;
518: PetscOptionsCreate_Private(opt,text,man,&amsopt);
519: amsopt->type = OPTION_LOGICAL;
520: PetscMalloc(sizeof(int),&amsopt->data);
521: *(int*)amsopt->data = 0;
522: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
523: if (flg) *flg = PETSC_FALSE;
524: return(0);
525: }
526: #endif
527: PetscOptionsHasName(amspub.prefix,opt,flg);
528: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
529: (*PetscHelpPrintf)(amspub.comm," -%s%s: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,text,man);
530: }
532: return(0);
533: }
535: #undef __FUNCT__
537: /*@C
538: PetscOptionsList - Puts a list of option values that a single one may be selected from
540: Collective on the communicator passed in PetscOptionsBegin()
542: Input Parameters:
543: + opt - option name
544: . text - short string that describes the option
545: . man - manual page with additional information on option
546: . list - the possible choices
547: - defaultv - the default (current) value
549: Output Parameter:
550: + value - the value to return
551: - set - PETSC_TRUE if found, else PETSC_FALSE
553: Level: intermediate
554:
555: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
557: See PetscOptionsEList() for when the choices are given in a string array
559: Concepts: options database^list
561: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
562: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
563: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
564: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
565: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
566: PetscOptionsList(), PetscOptionsEList()
567: @*/
568: int PetscOptionsList(char *opt,char *ltext,char *man,PetscFList list,char *defaultv,char *value,int len,PetscTruth *set)
569: {
570: int ierr;
573: #if defined(PETSC_HAVE_AMS)
574: if (!PetscOptionsPublishCount) {
575: PetscOptionsAMS amsopt;
576: int ntext;
577: char ldefault[128];
579: PetscOptionsCreate_Private(opt,ltext,man,&amsopt);
580: amsopt->type = OPTION_LIST;
581: PetscMalloc(sizeof(char*),&amsopt->data);
582: *(char **)(amsopt->data) = defaultv;
583: PetscStrcpy(ldefault,"DEFAULT:");
584: PetscStrcat(ldefault,ltext);
585: AMS_Memory_add_field(amspub.amem,ldefault,amsopt->data,1,AMS_STRING,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
587: PetscFListGet(list,(char***)&amsopt->edata,&ntext);
588: AMS_Memory_add_field(amspub.amem,ltext,amsopt->edata,ntext,AMS_STRING,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
589: if (set) *set = PETSC_FALSE;
590: return(0);
591: }
592: #endif
593: PetscOptionsGetString(amspub.prefix,opt,value,len,set);
594: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
595: PetscFListPrintTypes(amspub.comm,stdout,amspub.prefix,opt,ltext,man,list);
596: }
598: return(0);
599: }
601: #undef __FUNCT__
603: /*@C
604: PetscOptionsEList - Puts a list of option values that a single one may be selected from
606: Collective on the communicator passed in PetscOptionsBegin()
608: Input Parameters:
609: + opt - option name
610: . text - short string that describes the option
611: . man - manual page with additional information on option
612: . list - the possible choices
613: . ntext - number of choices
614: . defaultv - the default (current) value
615: - len - the size of the output value array
617: Output Parameter:
618: + value - the value to return
619: - set - PETSC_TRUE if found, else PETSC_FALSE
620:
621: Level: intermediate
623: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
625: See PetscOptionsList() for when the choices are given in a PetscFList()
627: Concepts: options database^list
629: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
630: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
631: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
632: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
633: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
634: PetscOptionsList(), PetscOptionsEList()
635: @*/
636: int PetscOptionsEList(char *opt,char *ltext,char *man,char **list,int ntext,char *defaultv,char *value,int len,PetscTruth *set)
637: {
638: int i,ierr;
641: #if defined(PETSC_HAVE_AMS)
642: if (!PetscOptionsPublishCount) {
643: PetscOptionsAMS amsopt;
644: char ldefault[128];
646: PetscOptionsCreate_Private(opt,ltext,man,&amsopt);
647: amsopt->type = OPTION_LIST;
648: PetscMalloc(sizeof(char*),&amsopt->data);
649: *(char **)(amsopt->data) = defaultv;
650: PetscStrcpy(ldefault,"DEFAULT:");
651: PetscStrcat(ldefault,ltext);
652: AMS_Memory_add_field(amspub.amem,ldefault,amsopt->data,1,AMS_STRING,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
654: PetscMalloc((ntext+1)*sizeof(char**),&amsopt->edata);
655: PetscMemcpy(amsopt->edata,list,ntext*sizeof(char*));
656: AMS_Memory_add_field(amspub.amem,ltext,amsopt->edata,ntext,AMS_STRING,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
657: if (set) *set = PETSC_FALSE;
658: return(0);
659: }
660: #endif
661: PetscOptionsGetString(amspub.prefix,opt,value,len,set);
662: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
663: (*PetscHelpPrintf)(amspub.comm," -%s%s <%s> (one of)",amspub.prefix?amspub.prefix:"",opt+1,defaultv);
664: for (i=0; i<ntext; i++){
665: (*PetscHelpPrintf)(amspub.comm," %s",list[i]);
666: }
667: (*PetscHelpPrintf)(amspub.comm,"n");
668: }
670: return(0);
671: }
673: #undef __FUNCT__
675: /*@C
676: PetscOptionsLogicalGroupBegin - First in a series of logical queries on the options database for
677: which only a single value can be true.
679: Collective on the communicator passed in PetscOptionsBegin()
681: Input Parameters:
682: + opt - option name
683: . text - short string that describes the option
684: - man - manual page with additional information on option
686: Output Parameter:
687: . flg - whether that option was set or not
688:
689: Level: intermediate
691: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
693: Must be followed by 0 or more PetscOptionsLogicalGroup()s and PetscOptionsLogicalGroupEnd()
695: Concepts: options database^logical group
697: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
698: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
699: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
700: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
701: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
702: PetscOptionsList(), PetscOptionsEList()
703: @*/
704: int PetscOptionsLogicalGroupBegin(char *opt,char *text,char *man,PetscTruth *flg)
705: {
706: int ierr;
709: #if defined(PETSC_HAVE_AMS)
710: if (!PetscOptionsPublishCount) {
711: PetscOptionsAMS amsopt;
712: PetscOptionsCreate_Private(opt,text,man,&amsopt);
713: amsopt->type = OPTION_LOGICAL;
714: PetscMalloc(sizeof(int),&amsopt->data);
715: *(int*)amsopt->data = 1; /* the first one listed is always the default */
716: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
717: if (flg) *flg = PETSC_FALSE;
718: return(0);
719: }
720: #endif
721: PetscOptionsHasName(amspub.prefix,opt,flg);
722: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
723: (*PetscHelpPrintf)(amspub.comm," Pick at most one of -------------n");
724: (*PetscHelpPrintf)(amspub.comm," -%s%s: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,text,man);
725: }
727: return(0);
728: }
730: #undef __FUNCT__
732: /*@C
733: PetscOptionsLogicalGroup - One in a series of logical queries on the options database for
734: which only a single value can be true.
736: Collective on the communicator passed in PetscOptionsBegin()
738: Input Parameters:
739: + opt - option name
740: . text - short string that describes the option
741: - man - manual page with additional information on option
743: Output Parameter:
744: . flg - PETSC_TRUE if found, else PETSC_FALSE
745:
746: Level: intermediate
748: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
750: Must follow a PetscOptionsLogicalGroupBegin() and preceded a PetscOptionsLogicalGroupEnd()
752: Concepts: options database^logical group
754: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
755: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
756: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
757: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
758: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
759: PetscOptionsList(), PetscOptionsEList()
760: @*/
761: int PetscOptionsLogicalGroup(char *opt,char *text,char *man,PetscTruth *flg)
762: {
763: int ierr;
766: #if defined(PETSC_HAVE_AMS)
767: if (!PetscOptionsPublishCount) {
768: PetscOptionsAMS amsopt;
769: PetscOptionsCreate_Private(opt,text,man,&amsopt);
770: amsopt->type = OPTION_LOGICAL;
771: PetscMalloc(sizeof(int),&amsopt->data);
772: *(int*)amsopt->data = 0;
773: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
774: if (flg) *flg = PETSC_FALSE;
775: return(0);
776: }
777: #endif
778: PetscOptionsHasName(amspub.prefix,opt,flg);
779: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
780: (*PetscHelpPrintf)(amspub.comm," -%s%s: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,text,man);
781: }
783: return(0);
784: }
786: #undef __FUNCT__
788: /*@C
789: PetscOptionsLogicalGroupEnd - Last in a series of logical queries on the options database for
790: which only a single value can be true.
792: Collective on the communicator passed in PetscOptionsBegin()
794: Input Parameters:
795: + opt - option name
796: . text - short string that describes the option
797: - man - manual page with additional information on option
799: Output Parameter:
800: . flg - PETSC_TRUE if found, else PETSC_FALSE
801:
802: Level: intermediate
804: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
806: Must follow a PetscOptionsLogicalGroupBegin()
808: Concepts: options database^logical group
810: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
811: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
812: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
813: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
814: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
815: PetscOptionsList(), PetscOptionsEList()
816: @*/
817: int PetscOptionsLogicalGroupEnd(char *opt,char *text,char *man,PetscTruth *flg)
818: {
819: int ierr;
822: #if defined(PETSC_HAVE_AMS)
823: if (!PetscOptionsPublishCount) {
824: PetscOptionsAMS amsopt;
825: PetscOptionsCreate_Private(opt,text,man,&amsopt);
826: amsopt->type = OPTION_LOGICAL;
827: PetscMalloc(sizeof(int),&amsopt->data);
828: *(int*)amsopt->data = 0;
829: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
830: if (flg) *flg = PETSC_FALSE;
831: return(0);
832: }
833: #endif
834: PetscOptionsHasName(amspub.prefix,opt,flg);
835: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
836: (*PetscHelpPrintf)(amspub.comm," -%s%s: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,text,man);
837: }
839: return(0);
840: }
842: #undef __FUNCT__
844: /*@C
845: PetscOptionsLogical - Determines if a particular option is in the database with a true or false
847: Collective on the communicator passed in PetscOptionsBegin()
849: Input Parameters:
850: + opt - option name
851: . text - short string that describes the option
852: - man - manual page with additional information on option
854: Output Parameter:
855: . flg - PETSC_TRUE or PETSC_FALSE
856: . set - PETSC_TRUE if found, else PETSC_FALSE
858: Level: beginner
860: Concepts: options database^logical
862: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
864: .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(),
865: PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical()
866: PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(),
867: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
868: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
869: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
870: PetscOptionsList(), PetscOptionsEList()
871: @*/
872: int PetscOptionsLogical(char *opt,char *text,char *man,PetscTruth deflt,PetscTruth *flg,PetscTruth *set)
873: {
874: int ierr;
875: PetscTruth iset;
878: #if defined(PETSC_HAVE_AMS)
879: if (!PetscOptionsPublishCount) {
880: PetscOptionsAMS amsopt;
881: PetscOptionsCreate_Private(opt,text,man,&amsopt);
882: amsopt->type = OPTION_LOGICAL;
883: PetscMalloc(sizeof(int),&amsopt->data);
884: *(int*)amsopt->data = (int)deflt;
885: AMS_Memory_add_field(amspub.amem,text,amsopt->data,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
886: if (flg) *flg = PETSC_FALSE;
887: return(0);
888: }
889: #endif
890: PetscOptionsGetLogical(amspub.prefix,opt,flg,&iset);
891: if (iset == PETSC_FALSE) {
892: if (flg != PETSC_NULL) *flg = deflt;
893: }
894: if (set != PETSC_NULL) *set = iset;
895: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
896: const char *v = (deflt ? "true" : "false");
897: (*PetscHelpPrintf)(amspub.comm," -%s%s: <%s> %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,v,text,man);
898: }
900: return(0);
901: }
903: #undef __FUNCT__
905: /*@C
906: PetscOptionsRealArray - Gets an array of double values for a particular
907: option in the database. The values must be separated with commas with
908: no intervening spaces.
910: Collective on the communicator passed in PetscOptionsBegin()
912: Input Parameters:
913: + opt - the option one is seeking
914: . text - short string describing option
915: . man - manual page for option
916: - nmax - maximum number of values
918: Output Parameter:
919: + value - location to copy values
920: . nmax - actual number of values found
921: - set - PETSC_TRUE if found, else PETSC_FALSE
923: Level: beginner
925: Notes:
926: The user should pass in an array of doubles
928: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
930: Concepts: options database^array of strings
932: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
933: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
934: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
935: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
936: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
937: PetscOptionsList(), PetscOptionsEList()
938: @*/
939: int PetscOptionsRealArray(char *opt,char *text,char *man,PetscReal *value,int *n,PetscTruth *set)
940: {
941: int ierr,i;
944: #if defined(PETSC_HAVE_AMS)
945: if (!PetscOptionsPublishCount) {
946: PetscOptionsAMS amsopt;
947: PetscOptionsCreate_Private(opt,text,man,&amsopt);
948: amsopt->type = OPTION_REAL_ARRAY;
949: amsopt->arraylength = *n;
950: PetscMalloc((*n)*sizeof(PetscReal),&amsopt->data);
951: ierr = PetscMemcpy(amsopt->data,value,(*n)*sizeof(PetscReal));
952: AMS_Memory_add_field(amspub.amem,text,amsopt->data,*n,AMS_DOUBLE,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
953: if (set) *set = PETSC_FALSE;
954: return(0);
955: }
956: #endif
957: PetscOptionsGetRealArray(amspub.prefix,opt,value,n,set);
958: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
959: (*PetscHelpPrintf)(amspub.comm," -%s%s <%g",amspub.prefix?amspub.prefix:"",opt+1,value[0]);
960: for (i=1; i<*n; i++) {
961: (*PetscHelpPrintf)(amspub.comm,",%g",value[i]);
962: }
963: (*PetscHelpPrintf)(amspub.comm,">: %s (%s)n",text,man);
964: }
965: return(0);
966: }
969: #undef __FUNCT__
971: /*@C
972: PetscOptionsIntArray - Gets an array of integers for a particular
973: option in the database. The values must be separated with commas with
974: no intervening spaces.
976: Collective on the communicator passed in PetscOptionsBegin()
978: Input Parameters:
979: + opt - the option one is seeking
980: . text - short string describing option
981: . man - manual page for option
982: - nmax - maximum number of values
984: Output Parameter:
985: + value - location to copy values
986: . nmax - actual number of values found
987: - set - PETSC_TRUE if found, else PETSC_FALSE
989: Level: beginner
991: Notes:
992: The user should pass in an array of integers
994: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
996: Concepts: options database^array of strings
998: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
999: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
1000: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
1001: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
1002: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
1003: PetscOptionsList(), PetscOptionsEList(), PetscOptionsRealArray()
1004: @*/
1005: int PetscOptionsIntArray(char *opt,char *text,char *man,int *value,int *n,PetscTruth *set)
1006: {
1007: int ierr,i;
1010: #if defined(PETSC_HAVE_AMS)
1011: if (!PetscOptionsPublishCount) {
1012: PetscOptionsAMS amsopt;
1013: PetscOptionsCreate_Private(opt,text,man,&amsopt);
1014: amsopt->type = OPTION_REAL_ARRAY;
1015: amsopt->arraylength = *n;
1016: PetscMalloc((*n)*sizeof(int),&amsopt->data);
1017: ierr = PetscMemcpy(amsopt->data,value,(*n)*sizeof(int));
1018: AMS_Memory_add_field(amspub.amem,text,amsopt->data,*n,AMS_INT,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
1019: if (set) *set = PETSC_FALSE;
1020: return(0);
1021: }
1022: #endif
1023: PetscOptionsGetIntArray(amspub.prefix,opt,value,n,set);
1024: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
1025: (*PetscHelpPrintf)(amspub.comm," -%s%s <%d",amspub.prefix?amspub.prefix:"",opt+1,value[0]);
1026: for (i=1; i<*n; i++) {
1027: (*PetscHelpPrintf)(amspub.comm,",%d",value[i]);
1028: }
1029: (*PetscHelpPrintf)(amspub.comm,">: %s (%s)n",text,man);
1030: }
1031: return(0);
1032: }
1034: #undef __FUNCT__
1036: /*@C
1037: PetscOptionsStringArray - Gets an array of string values for a particular
1038: option in the database. The values must be separated with commas with
1039: no intervening spaces.
1041: Collective on the communicator passed in PetscOptionsBegin()
1043: Input Parameters:
1044: + opt - the option one is seeking
1045: . text - short string describing option
1046: . man - manual page for option
1047: - nmax - maximum number of strings
1049: Output Parameter:
1050: + value - location to copy strings
1051: . nmax - actual number of strings found
1052: - set - PETSC_TRUE if found, else PETSC_FALSE
1054: Level: beginner
1056: Notes:
1057: The user should pass in an array of pointers to char, to hold all the
1058: strings returned by this function.
1060: The user is responsible for deallocating the strings that are
1061: returned. The Fortran interface for this routine is not supported.
1063: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
1065: Concepts: options database^array of strings
1067: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
1068: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
1069: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
1070: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
1071: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
1072: PetscOptionsList(), PetscOptionsEList()
1073: @*/
1074: int PetscOptionsStringArray(char *opt,char *text,char *man,char **value,int *nmax,PetscTruth *set)
1075: {
1076: int ierr;
1079: #if defined(PETSC_HAVE_AMS)
1080: if (!PetscOptionsPublishCount) {
1081: PetscOptionsAMS amsopt;
1082: PetscOptionsCreate_Private(opt,text,man,&amsopt);
1083: amsopt->type = OPTION_STRING;
1084: PetscMalloc((*nmax)*sizeof(char*),&amsopt->data);
1085: ierr = PetscMemzero(amsopt->data,(*nmax)*sizeof(char*));
1086: AMS_Memory_add_field(amspub.amem,text,amsopt->data,*nmax,AMS_STRING,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
1087: if (set) *set = PETSC_FALSE;
1088: return(0);
1089: }
1090: #endif
1091: PetscOptionsGetStringArray(amspub.prefix,opt,value,nmax,set);
1092: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
1093: (*PetscHelpPrintf)(amspub.comm," -%s%s <string1,string2,...>: %s (%s)n",amspub.prefix?amspub.prefix:"",opt+1,text,man);
1094: }
1095: return(0);
1096: }
1098: /*MC
1099: PetscOptionsTail - Ends a section of options begun with PetscOptionsHead()
1100: See, for example, KSPSetFromOptions_GMRES().
1102: Collective on the communicator passed in PetscOptionsBegin()
1104: Synopsis: int PetscOptionsTail(void)
1106: Level: intermediate
1108: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
1110: Must be preceded by a call to PetscOptionsHead() in the same function.
1112: Concepts: options database^subheading
1114: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
1115: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
1116: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
1117: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
1118: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
1119: PetscOptionsList(), PetscOptionsEList()
1120: M*/
1122: #undef __FUNCT__
1124: /*@C
1125: PetscOptionsHead - Puts a heading before list any more published options. Used, for example,
1126: in KSPSetFromOptions_GMRES().
1128: Collective on the communicator passed in PetscOptionsBegin()
1130: Input Parameter:
1131: . head - the heading text
1133:
1134: Level: intermediate
1136: Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd()
1138: Must be followed by a call to PetscOptionsTail() in the same function.
1140: Concepts: options database^subheading
1142: .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(),
1143: PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(),
1144: PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(),
1145: PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(),
1146: PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(),
1147: PetscOptionsList(), PetscOptionsEList()
1148: @*/
1149: int PetscOptionsHead(char *head)
1150: {
1151: int ierr;
1154: #if defined(PETSC_HAVE_AMS)
1155: if (!PetscOptionsPublishCount) {
1156: PetscOptionsAMS amsopt;
1157: PetscOptionsCreate_Private("-amshead",head,"None",&amsopt);
1158: amsopt->type = OPTION_HEAD;
1159: PetscMalloc(sizeof(int),&amsopt->data);
1160: *(int*)amsopt->data = 0;
1161: AMS_Memory_add_field(amspub.amem,head,amsopt->data,1,AMS_BOOLEAN,AMS_WRITE,AMS_COMMON,AMS_REDUCT_UNDEF);
1162: }
1163: #endif
1164: if (amspub.printhelp && PetscOptionsPublishCount == 1) {
1165: (*PetscHelpPrintf)(amspub.comm," %sn",head);
1166: }
1168: return(0);
1169: }