forked from petsc/petsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpetscoptions.h
1320 lines (1034 loc) · 64.4 KB
/
petscoptions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Routines to determine options set in the options database.
*/
#pragma once
#include <petscsys.h>
#include <petscviewertypes.h>
/* SUBMANSEC = Sys */
typedef enum {
PETSC_OPT_CODE,
PETSC_OPT_COMMAND_LINE,
PETSC_OPT_FILE,
PETSC_OPT_ENVIRONMENT,
NUM_PETSC_OPT_SOURCE
} PetscOptionSource;
#define PETSC_MAX_OPTION_NAME 512
typedef struct _n_PetscOptions *PetscOptions;
PETSC_EXTERN PetscErrorCode PetscOptionsCreate(PetscOptions *);
PETSC_EXTERN PetscErrorCode PetscOptionsPush(PetscOptions);
PETSC_EXTERN PetscErrorCode PetscOptionsPop(void);
PETSC_EXTERN PetscErrorCode PetscOptionsDestroy(PetscOptions *);
PETSC_EXTERN PetscErrorCode PetscOptionsCreateDefault(void);
PETSC_EXTERN PetscErrorCode PetscOptionsDestroyDefault(void);
PETSC_EXTERN PetscErrorCode PetscOptionsHasHelp(PetscOptions, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsHasName(PetscOptions, const char[], const char[], PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetBool(PetscOptions, const char[], const char[], PetscBool *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetInt(PetscOptions, const char[], const char[], PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetEnum(PetscOptions, const char[], const char[], const char *const *, PetscEnum *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetEList(PetscOptions, const char[], const char[], const char *const *, PetscInt, PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetReal(PetscOptions, const char[], const char[], PetscReal *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetScalar(PetscOptions, const char[], const char[], PetscScalar *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetString(PetscOptions, const char[], const char[], char[], size_t, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetBoolArray(PetscOptions, const char[], const char[], PetscBool[], PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetEnumArray(PetscOptions, const char[], const char[], const char *const *, PetscEnum *, PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetIntArray(PetscOptions, const char[], const char[], PetscInt[], PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetRealArray(PetscOptions, const char[], const char[], PetscReal[], PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetScalarArray(PetscOptions, const char[], const char[], PetscScalar[], PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetStringArray(PetscOptions, const char[], const char[], char *[], PetscInt *, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsValidKey(const char[], PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsSetAlias(PetscOptions, const char[], const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsSetValue(PetscOptions, const char[], const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsClearValue(PetscOptions, const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsFindPair(PetscOptions, const char[], const char[], const char *[], PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsGetAll(PetscOptions, char *[]);
PETSC_EXTERN PetscErrorCode PetscOptionsAllUsed(PetscOptions, PetscInt *);
PETSC_EXTERN PetscErrorCode PetscOptionsUsed(PetscOptions, const char[], PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsLeft(PetscOptions);
PETSC_EXTERN PetscErrorCode PetscOptionsLeftGet(PetscOptions, PetscInt *, char ***, char ***);
PETSC_EXTERN PetscErrorCode PetscOptionsLeftRestore(PetscOptions, PetscInt *, char ***, char ***);
PETSC_EXTERN PetscErrorCode PetscOptionsView(PetscOptions, PetscViewer);
PETSC_EXTERN PetscErrorCode PetscOptionsReject(PetscOptions, const char[], const char[], const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsInsert(PetscOptions, int *, char ***, const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsInsertFile(MPI_Comm, PetscOptions, const char[], PetscBool);
PETSC_EXTERN PetscErrorCode PetscOptionsInsertFileYAML(MPI_Comm, PetscOptions, const char[], PetscBool);
PETSC_EXTERN PetscErrorCode PetscOptionsInsertString(PetscOptions, const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsInsertStringYAML(PetscOptions, const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsInsertArgs(PetscOptions, int, char **);
PETSC_EXTERN PetscErrorCode PetscOptionsClear(PetscOptions);
PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPush(PetscOptions, const char[]);
PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPop(PetscOptions);
PETSC_EXTERN PetscErrorCode PetscOptionsGetenv(MPI_Comm, const char[], char[], size_t, PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsStringToBool(const char[], PetscBool *);
PETSC_EXTERN PetscErrorCode PetscOptionsStringToInt(const char[], PetscInt *);
PETSC_EXTERN PetscErrorCode PetscOptionsStringToReal(const char[], PetscReal *);
PETSC_EXTERN PetscErrorCode PetscOptionsStringToScalar(const char[], PetscScalar *);
PETSC_EXTERN PetscErrorCode PetscOptionsMonitorSet(PetscErrorCode (*)(const char[], const char[], PetscOptionSource, void *), void *, PetscErrorCode (*)(void **));
PETSC_EXTERN PetscErrorCode PetscOptionsMonitorDefault(const char[], const char[], PetscOptionSource, void *);
PETSC_EXTERN PetscErrorCode PetscObjectSetOptions(PetscObject, PetscOptions);
PETSC_EXTERN PetscErrorCode PetscObjectGetOptions(PetscObject, PetscOptions *);
PETSC_EXTERN PetscBool PetscOptionsPublish;
/*
See manual page for PetscOptionsBegin()
PetscOptionsItem and PetscOptionsItems are a single option (such as ksp_type) and a collection of such single
options being handled with a PetscOptionsBegin/End()
*/
typedef enum {
OPTION_INT,
OPTION_BOOL,
OPTION_REAL,
OPTION_FLIST,
OPTION_STRING,
OPTION_REAL_ARRAY,
OPTION_SCALAR_ARRAY,
OPTION_HEAD,
OPTION_INT_ARRAY,
OPTION_ELIST,
OPTION_BOOL_ARRAY,
OPTION_STRING_ARRAY
} PetscOptionType;
typedef struct _n_PetscOptionItem *PetscOptionItem;
struct _n_PetscOptionItem {
char *option;
char *text;
void *data; /* used to hold the default value and then any value it is changed to by GUI */
PetscFunctionList flist; /* used for available values for PetscOptionsList() */
const char *const *list; /* used for available values for PetscOptionsEList() */
char nlist; /* number of entries in list */
char *man;
size_t arraylength; /* number of entries in data in the case that it is an array (of PetscInt etc) */
PetscBool set; /* the user has changed this value in the GUI */
PetscOptionType type;
PetscOptionItem next;
char *pman;
void *edata;
};
typedef struct _p_PetscOptionItems {
PetscInt count;
PetscOptionItem next;
char *prefix, *pprefix;
char *title;
MPI_Comm comm;
PetscBool printhelp, changedmethod, alreadyprinted;
PetscObject object;
PetscOptions options;
} PetscOptionItems;
#if defined(PETSC_CLANG_STATIC_ANALYZER)
extern PetscOptionItems *PetscOptionsObject; /* declare this so that the PetscOptions stubs work */
PetscErrorCode PetscOptionsBegin(MPI_Comm, const char *, const char *, const char *);
PetscErrorCode PetscObjectOptionsBegin(PetscObject);
PetscErrorCode PetscOptionsEnd(void);
#else
/*MC
PetscOptionsBegin - Begins a set of queries on the options database that are related and should be
displayed on the same window of a GUI that allows the user to set the options interactively. Often one should
use `PetscObjectOptionsBegin()` rather than this call.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsBegin(MPI_Comm comm,const char prefix[],const char title[],const char mansec[])
Collective
Input Parameters:
+ comm - communicator that shares GUI
. prefix - options prefix for all options displayed on window (optional)
. title - short descriptive text, for example "Krylov Solver Options"
- mansec - section of manual pages for options, for example `KSP` (optional)
Level: intermediate
Notes:
This is a macro that handles its own error checking, it does not return an error code.
The set of queries needs to be ended by a call to `PetscOptionsEnd()`.
One can add subheadings with `PetscOptionsHeadBegin()`.
Developer Notes:
`PetscOptionsPublish` is set in `PetscOptionsCheckInitial_Private()` with `-saws_options`. When `PetscOptionsPublish` is set the
loop between `PetscOptionsBegin()` and `PetscOptionsEnd()` is run THREE times with `PetscOptionsPublishCount` of values -1,0,1.
Otherwise the loop is run ONCE with a `PetscOptionsPublishCount` of 1.
+ \-1 - `PetscOptionsInt()` etc. just call `PetscOptionsGetInt()` etc.
. 0 - The GUI objects are created in `PetscOptionsInt()` etc. and displayed in `PetscOptionsEnd()` and the options
database updated with user changes; `PetscOptionsGetInt()` etc. are also called.
- 1 - `PetscOptionsInt()` etc. again call `PetscOptionsGetInt()` etc. (possibly getting new values), in addition the help message and
default values are printed if -help was given.
When `PetscOptionsObject.changedmethod` is set this causes `PetscOptionsPublishCount` to be reset to -2 (so in the next loop iteration it is -1)
and the whole process is repeated. This is to handle when, for example, the `KSPType` is changed thus changing the list of
options available so they need to be redisplayed so the user can change the. Changing `PetscOptionsObjects.changedmethod` is never
currently set.
Fortran Note:
Returns ierr error code per PETSc Fortran API
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscObjectOptionsBegin()`
M*/
#define PetscOptionsBegin(comm, prefix, mess, sec) \
do { \
PetscOptionItems PetscOptionsObjectBase; \
PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \
PetscCall(PetscMemzero(PetscOptionsObject, sizeof(*PetscOptionsObject))); \
for (PetscOptionsObject->count = (PetscOptionsPublish ? -1 : 1); PetscOptionsObject->count < 2; PetscOptionsObject->count++) { \
PetscCall(PetscOptionsBegin_Private(PetscOptionsObject, comm, prefix, mess, sec))
/*MC
PetscObjectOptionsBegin - Begins a set of queries on the options database that are related and should be
displayed on the same window of a GUI that allows the user to set the options interactively.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscObjectOptionsBegin(PetscObject obj)
Collective
Input Parameter:
. obj - object to set options for
Level: intermediate
Notes:
This is a macro that handles its own error checking, it does not return an error code.
Needs to be ended by a call the `PetscOptionsEnd()`
Can add subheadings with `PetscOptionsHeadBegin()`
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscObjectOptionsBegin(obj) \
do { \
PetscOptionItems PetscOptionsObjectBase; \
PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \
PetscOptionsObject->options = ((PetscObject)obj)->options; \
for (PetscOptionsObject->count = (PetscOptionsPublish ? -1 : 1); PetscOptionsObject->count < 2; PetscOptionsObject->count++) { \
PetscCall(PetscObjectOptionsBegin_Private(obj, PetscOptionsObject))
/*MC
PetscOptionsEnd - Ends a set of queries on the options database that are related and should be
displayed on the same window of a GUI that allows the user to set the options interactively.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsEnd(void)
Collective on the comm used in `PetscOptionsBegin()` or obj used in `PetscObjectOptionsBegin()`
Level: intermediate
Notes:
Needs to be preceded by a call to `PetscOptionsBegin()` or `PetscObjectOptionsBegin()`
This is a macro that handles its own error checking, it does not return an error code.
Fortran Note:
Returns ierr error code per PETSc Fortran API
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscObjectOptionsBegin()`
M*/
#define PetscOptionsEnd() \
PetscCall(PetscOptionsEnd_Private(PetscOptionsObject)); \
} \
} \
while (0)
#endif /* PETSC_CLANG_STATIC_ANALYZER */
PETSC_EXTERN PetscErrorCode PetscOptionsBegin_Private(PetscOptionItems *, MPI_Comm, const char[], const char[], const char[]);
PETSC_EXTERN PetscErrorCode PetscObjectOptionsBegin_Private(PetscObject, PetscOptionItems *);
PETSC_EXTERN PetscErrorCode PetscOptionsEnd_Private(PetscOptionItems *);
PETSC_EXTERN PetscErrorCode PetscOptionsHeadBegin(PetscOptionItems *, const char[]);
#if defined(PETSC_CLANG_STATIC_ANALYZER)
template <typename... T>
void PetscOptionsHeadBegin(T...);
void PetscOptionsHeadEnd(void);
template <typename... T>
PetscErrorCode PetscOptionsEnum(T...);
template <typename... T>
PetscErrorCode PetscOptionsInt(T...);
template <typename... T>
PetscErrorCode PetscOptionsBoundedInt(T...);
template <typename... T>
PetscErrorCode PetscOptionsRangeInt(T...);
template <typename... T>
PetscErrorCode PetscOptionsReal(T...);
template <typename... T>
PetscErrorCode PetscOptionsScalar(T...);
template <typename... T>
PetscErrorCode PetscOptionsName(T...);
template <typename... T>
PetscErrorCode PetscOptionsString(T...);
template <typename... T>
PetscErrorCode PetscOptionsBool(T...);
template <typename... T>
PetscErrorCode PetscOptionsBoolGroupBegin(T...);
template <typename... T>
PetscErrorCode PetscOptionsBoolGroup(T...);
template <typename... T>
PetscErrorCode PetscOptionsBoolGroupEnd(T...);
template <typename... T>
PetscErrorCode PetscOptionsFList(T...);
template <typename... T>
PetscErrorCode PetscOptionsEList(T...);
template <typename... T>
PetscErrorCode PetscOptionsRealArray(T...);
template <typename... T>
PetscErrorCode PetscOptionsScalarArray(T...);
template <typename... T>
PetscErrorCode PetscOptionsIntArray(T...);
template <typename... T>
PetscErrorCode PetscOptionsStringArray(T...);
template <typename... T>
PetscErrorCode PetscOptionsBoolArray(T...);
template <typename... T>
PetscErrorCode PetscOptionsEnumArray(T...);
template <typename... T>
PetscErrorCode PetscOptionsDeprecated(T...);
template <typename... T>
PetscErrorCode PetscOptionsDeprecatedNoObject(T...);
#else
/*MC
PetscOptionsHeadBegin - Puts a heading before listing any more published options. Used, for example,
in `KSPSetFromOptions_GMRES()`.
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameter:
. head - the heading text
Level: developer
Notes:
Handles errors directly, hence does not return an error code
Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`, and `PetscOptionsObject` created in `PetscOptionsBegin()` should be the first argument
Must be followed by a call to `PetscOptionsHeadEnd()` in the same function.
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsHeadBegin(PetscOptionsObject, head) \
do { \
if (PetscOptionsObject->printhelp && PetscOptionsObject->count == 1 && !PetscOptionsObject->alreadyprinted) PetscCall((*PetscHelpPrintf)(PetscOptionsObject->comm, " %s\n", head)); \
} while (0)
#define PetscOptionsHead(...) PETSC_DEPRECATED_MACRO(3, 18, 0, "PetscOptionsHeadBegin()", ) PetscOptionsHeadBegin(__VA_ARGS__)
/*MC
PetscOptionsHeadEnd - Ends a section of options begun with `PetscOptionsHeadBegin()`
See, for example, `KSPSetFromOptions_GMRES()`.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsHeadEnd(void)
Collective on the comm used in `PetscOptionsBegin()` or obj used in `PetscObjectOptionsBegin()`
Level: intermediate
Notes:
Must be between a `PetscOptionsBegin()` or `PetscObjectOptionsBegin()` and a `PetscOptionsEnd()`
Must be preceded by a call to `PetscOptionsHeadBegin()` in the same function.
This needs to be used only if the code below `PetscOptionsHeadEnd()` can be run ONLY once.
See, for example, `PCSetFromOptions_Composite()`. This is a `return(0)` in it for early exit
from the function.
This is only for use with the PETSc options GUI
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsEnum()`
M*/
#define PetscOptionsHeadEnd() \
do { \
if (PetscOptionsObject->count != 1) PetscFunctionReturn(PETSC_SUCCESS); \
} while (0)
#define PetscOptionsTail(...) PETSC_DEPRECATED_MACRO(3, 18, 0, "PetscOptionsHeadEnd()", ) PetscOptionsHeadEnd(__VA_ARGS__)
/*MC
PetscOptionsEnum - Gets the enum value for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsEnum(const char opt[], const char text[], const char man[], const char *const *list, PetscEnum currentvalue, PetscEnum *value, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
. list - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null
- currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either
.vb
PetscOptionsEnum(..., obj->value,&object->value,...) or
value = defaultvalue
PetscOptionsEnum(..., value,&value,&flg);
if (flg) {
.ve
Output Parameters:
+ value - the value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
list is usually something like `PCASMTypes` or some other predefined list of enum names
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `set` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`,
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsEnum(opt, text, man, list, currentvalue, value, set) PetscOptionsEnum_Private(PetscOptionsObject, opt, text, man, list, currentvalue, value, set)
/*MC
PetscOptionsInt - Gets the integer value for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsInt(const char opt[], const char text[], const char man[], PetscInt currentvalue, PetscInt *value, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
- currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either
.vb
PetscOptionsInt(..., obj->value,&obj->value,...) or
value = defaultvalue
PetscOptionsInt(..., value,&value,&flg);
if (flg) {
.ve
Output Parameters:
+ value - the integer value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsBoundedInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, `PetscOptionsRangeInt()`
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsInt(opt, text, man, currentvalue, value, set) PetscOptionsInt_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set, PETSC_MIN_INT, PETSC_MAX_INT)
/*MC
PetscOptionsBoundedInt - Gets an integer value greater than or equal a given bound for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsBoundedInt(const char opt[], const char text[], const char man[], PetscInt currentvalue, PetscInt *value, PetscBool *flg, PetscInt bound)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
. currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either
.vb
PetscOptionsInt(..., obj->value,&obj->value,...)
.ve
or
.vb
value = defaultvalue
PetscOptionsInt(..., value,&value,&flg);
if (flg) {
.ve
- bound - the requested value should be greater than or equal this bound or an error is generated
Output Parameters:
+ value - the integer value to return
- flg - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, `PetscOptionsRangeInt()`
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsBoundedInt(opt, text, man, currentvalue, value, set, lb) PetscOptionsInt_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set, lb, PETSC_MAX_INT)
/*MC
PetscOptionsRangeInt - Gets an integer value within a range of values for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsRangeInt(const char opt[], const char text[], const char man[], PetscInt currentvalue, PetscInt *value, PetscBool *flg, PetscInt lb, PetscInt ub)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
. currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either
.vb
PetscOptionsInt(..., obj->value,&obj->value,...) or
value = defaultvalue
PetscOptionsInt(..., value,&value,&flg);
if (flg) {
.ve
. lb - the lower bound, provided value must be greater than or equal to this value or an error is generated
- ub - the upper bound, provided value must be less than or equal to this value or an error is generated
Output Parameters:
+ value - the integer value to return
- flg - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, `PetscOptionsBoundedInt()`
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsRangeInt(opt, text, man, currentvalue, value, set, lb, ub) PetscOptionsInt_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set, lb, ub)
/*MC
PetscOptionsReal - Gets the `PetscReal` value for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsReal(const char opt[], const char text[], const char man[], PetscReal currentvalue, PetscReal *value, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
- currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either
.vb
PetscOptionsReal(..., obj->value,&obj->value,...) or
value = defaultvalue
PetscOptionsReal(..., value,&value,&flg);
if (flg) {
.ve
Output Parameters:
+ value - the value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`,
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsReal(opt, text, man, currentvalue, value, set) PetscOptionsReal_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set)
/*MC
PetscOptionsScalar - Gets the `PetscScalar` value for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsScalar(const char opt[], const char text[], const char man[], PetscScalar currentvalue, PetscScalar *value, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
- currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either
.vb
PetscOptionsScalar(..., obj->value,&obj->value,...) or
value = defaultvalue
PetscOptionsScalar(..., value,&value,&flg);
if (flg) {
.ve
Output Parameters:
+ value - the value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`,
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsScalar(opt, text, man, currentvalue, value, set) PetscOptionsScalar_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set)
/*MC
PetscOptionsName - Determines if a particular option has been set in the database. This returns true whether the option is a number, string or boolean, even
its value is set to false.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsName(const char opt[], const char text[], const char man[], PetscBool *flg)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
- man - manual page with additional information on option
Output Parameter:
. flg - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Note:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`,
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsName(opt, text, man, flg) PetscOptionsName_Private(PetscOptionsObject, opt, text, man, flg)
/*MC
PetscOptionsString - Gets the string value for a particular option in the database.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsString(const char opt[], const char text[], const char man[], const char currentvalue[], char value[], size_t len, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
. currentvalue - the current value; caller is responsible for setting this value correctly. This is not used to set value
- len - length of the result string including null terminator
Output Parameters:
+ value - the value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
If the user provided no string (for example `-optionname` `-someotheroption`) `flg` is set to `PETSC_TRUE` (and the string is filled with nulls).
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`,
`PetscOptionsInt()`, `PetscOptionsReal()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsString(opt, text, man, currentvalue, value, len, set) PetscOptionsString_Private(PetscOptionsObject, opt, text, man, currentvalue, value, len, set)
/*MC
PetscOptionsBool - Determines if a particular option is in the database with a true or false
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsBool(const char opt[], const char text[], const char man[], PetscBool currentvalue, PetscBool *flg, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
. man - manual page with additional information on option
- currentvalue - the current value
Output Parameters:
+ flg - `PETSC_TRUE` or `PETSC_FALSE`
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: beginner
Notes:
TRUE, true, YES, yes, nostring, and 1 all translate to `PETSC_TRUE`
FALSE, false, NO, no, and 0 all translate to `PETSC_FALSE`
If the option is given, but no value is provided, then flg and set are both given the value `PETSC_TRUE`. That is `-requested_bool`
is equivalent to `-requested_bool true`
If the user does not supply the option at all `flg` is NOT changed. Thus
you should ALWAYS initialize the `flg` variable if you access it without first checking if the `set` flag is `PETSC_TRUE`.
Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
.seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`,
`PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`,
`PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsBool(opt, text, man, currentvalue, value, set) PetscOptionsBool_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set)
/*MC
PetscOptionsBoolGroupBegin - First in a series of logical queries on the options database for
which at most a single value can be true.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsBoolGroupBegin(const char opt[], const char text[], const char man[], PetscBool *flg)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
- man - manual page with additional information on option
Output Parameter:
. flg - whether that option was set or not
Level: intermediate
Notes:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
Must be followed by 0 or more `PetscOptionsBoolGroup()`s and `PetscOptionsBoolGroupEnd()`
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsBoolGroupBegin(opt, text, man, flg) PetscOptionsBoolGroupBegin_Private(PetscOptionsObject, opt, text, man, flg)
/*MC
PetscOptionsBoolGroup - One in a series of logical queries on the options database for
which at most a single value can be true.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsBoolGroup(const char opt[], const char text[], const char man[], PetscBool *flg)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
- man - manual page with additional information on option
Output Parameter:
. flg - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: intermediate
Notes:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
Must follow a `PetscOptionsBoolGroupBegin()` and preceded a `PetscOptionsBoolGroupEnd()`
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsBoolGroup(opt, text, man, flg) PetscOptionsBoolGroup_Private(PetscOptionsObject, opt, text, man, flg)
/*MC
PetscOptionsBoolGroupEnd - Last in a series of logical queries on the options database for
which at most a single value can be true.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsBoolGroupEnd(const char opt[], const char text[], const char man[], PetscBool *flg)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. text - short string that describes the option
- man - manual page with additional information on option
Output Parameter:
. flg - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: intermediate
Notes:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
Must follow a `PetscOptionsBoolGroupBegin()`
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`
M*/
#define PetscOptionsBoolGroupEnd(opt, text, man, flg) PetscOptionsBoolGroupEnd_Private(PetscOptionsObject, opt, text, man, flg)
/*MC
PetscOptionsFList - Puts a list of option values that a single one may be selected from
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsFList(const char opt[], const char ltext[], const char man[], PetscFunctionList list, const char currentvalue[], char value[], size_t len, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. ltext - short string that describes the option
. man - manual page with additional information on option
. list - the possible choices
. currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with
.vb
PetscOptionsFlist(..., obj->value,value,len,&flg);
if (flg) {
.ve
- len - the length of the character array value
Output Parameters:
+ value - the value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: intermediate
Notes:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if the `set` flag is `PETSC_TRUE`.
The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically.
See `PetscOptionsEList()` for when the choices are given in a string array
To get a listing of all currently specified options,
see `PetscOptionsView()` or `PetscOptionsGetAll()`
Developer Note:
This cannot check for invalid selection because of things like `MATAIJ` that are not included in the list
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsEnum()`
M*/
#define PetscOptionsFList(opt, ltext, man, list, currentvalue, value, len, set) PetscOptionsFList_Private(PetscOptionsObject, opt, ltext, man, list, currentvalue, value, len, set)
/*MC
PetscOptionsEList - Puts a list of option values that a single one may be selected from
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsEList(const char opt[], const char ltext[], const char man[], const char *const *list, PetscInt ntext, const char currentvalue[], PetscInt *value, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters:
+ opt - option name
. ltext - short string that describes the option
. man - manual page with additional information on option
. list - the possible choices (one of these must be selected, anything else is invalid)
. ntext - number of choices
- currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with
.vb
PetscOptionsEList(..., obj->value,&value,&flg);
.ve if (flg) {
Output Parameters:
+ value - the index of the value to return
- set - `PETSC_TRUE` if found, else `PETSC_FALSE`
Level: intermediate
Notes:
Must be used between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`
If the user does not supply the option at all `value` is NOT changed. Thus
you should ALWAYS initialize `value` if you access it without first checking if the `set` flag is `PETSC_TRUE`.
See `PetscOptionsFList()` for when the choices are given in a `PetscFunctionList()`
.seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`,
`PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`,
`PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`,
`PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`,
`PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`,
`PetscOptionsFList()`, `PetscOptionsEnum()`
M*/
#define PetscOptionsEList(opt, ltext, man, list, ntext, currentvalue, value, set) PetscOptionsEList_Private(PetscOptionsObject, opt, ltext, man, list, ntext, currentvalue, value, set)
/*MC
PetscOptionsRealArray - Gets an array of double values for a particular
option in the database. The values must be separated with commas with
no intervening spaces.
Synopsis:
#include <petscoptions.h>
PetscErrorCode PetscOptionsRealArray(const char opt[], const char text[], const char man[], PetscReal value[], PetscInt *n, PetscBool *set)
Logically Collective on the communicator passed in `PetscOptionsBegin()`
Input Parameters: