1f26ada1bSBarry Smith /* 237f753daSBarry Smith Routines to determine options set in the options database. 3f26ada1bSBarry Smith */ 426bd1501SBarry Smith #if !defined(PETSCOPTIONS_H) 526bd1501SBarry Smith #define PETSCOPTIONS_H 62c8e378dSBarry Smith #include <petscsys.h> 7c619b03eSJed Brown #include <petscviewertypes.h> 83a3b2205SBarry Smith 9c5c1f447SLisandro Dalcin #define PETSC_MAX_OPTION_NAME 512 10c5929fdfSBarry Smith typedef struct _n_PetscOptions* PetscOptions; 11c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsCreate(PetscOptions*); 12b4205f0bSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPush(PetscOptions); 13b4205f0bSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPop(void); 14c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsDestroy(PetscOptions*); 152d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsCreateDefault(void); 162d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsDestroyDefault(void); 17c5929fdfSBarry Smith 182d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsHasHelp(PetscOptions,PetscBool*); 19c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsHasName(PetscOptions,const char[],const char[],PetscBool*); 20c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetBool(PetscOptions,const char[],const char [],PetscBool*,PetscBool*); 212d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetInt(PetscOptions,const char[],const char [],PetscInt*,PetscBool*); 222d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEnum(PetscOptions,const char[],const char[],const char*const*,PetscEnum*,PetscBool*); 232d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEList(PetscOptions,const char[],const char[],const char*const*,PetscInt,PetscInt*,PetscBool*); 24c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetReal(PetscOptions,const char[],const char[],PetscReal*,PetscBool*); 25c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetScalar(PetscOptions,const char[],const char[],PetscScalar*,PetscBool*); 262d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetString(PetscOptions,const char[],const char[],char[],size_t,PetscBool*); 272d747510SLisandro Dalcin 282d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetBoolArray(PetscOptions,const char[],const char[],PetscBool [],PetscInt*,PetscBool*); 292d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEnumArray(PetscOptions,const char[],const char[],const char*const*,PetscEnum*,PetscInt*,PetscBool*); 30c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetIntArray(PetscOptions,const char[],const char[],PetscInt[],PetscInt*,PetscBool*); 31c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetRealArray(PetscOptions,const char[],const char[],PetscReal[],PetscInt*,PetscBool*); 32c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetScalarArray(PetscOptions,const char[],const char[],PetscScalar[],PetscInt*,PetscBool*); 33c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetStringArray(PetscOptions,const char[],const char[],char*[],PetscInt*,PetscBool*); 343a3b2205SBarry Smith 352d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsValidKey(const char[],PetscBool*); 36c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSetAlias(PetscOptions,const char[],const char[]); 37c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSetValue(PetscOptions,const char[],const char[]); 38c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsClearValue(PetscOptions,const char[]); 392d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsFindPair(PetscOptions,const char[],const char[],const char*[],PetscBool*); 403a3b2205SBarry Smith 412d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetAll(PetscOptions,char*[]); 42c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsAllUsed(PetscOptions,PetscInt*); 432d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsUsed(PetscOptions,const char[],PetscBool*); 44c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsLeft(PetscOptions); 451ab23d95SFande Kong PETSC_EXTERN PetscErrorCode PetscOptionsLeftGet(PetscOptions,PetscInt*,char***,char***); 465b191818SFande Kong PETSC_EXTERN PetscErrorCode PetscOptionsLeftRestore(PetscOptions,PetscInt*,char***,char***); 47c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsView(PetscOptions,PetscViewer); 484b0e389bSBarry Smith 492d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsReject(PetscOptions,const char[],const char[],const char[]); 50c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsert(PetscOptions,int*,char***,const char[]); 51c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsertFile(MPI_Comm,PetscOptions,const char[],PetscBool); 525c23ca1cSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsInsertFileYAML(MPI_Comm,PetscOptions,const char[],PetscBool); 53c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsertString(PetscOptions,const char[]); 54080f0011SToby Isaac PETSC_EXTERN PetscErrorCode PetscOptionsInsertStringYAML(PetscOptions,const char[]); 55d06005cbSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsInsertArgs(PetscOptions,int,char**); 56c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsClear(PetscOptions); 57c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPush(PetscOptions,const char[]); 58c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPop(PetscOptions); 595d0dffe5SBarry Smith 60014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsGetenv(MPI_Comm,const char[],char[],size_t,PetscBool*); 612d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsStringToBool(const char[],PetscBool*); 62014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsStringToInt(const char[],PetscInt*); 63014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsStringToReal(const char[],PetscReal*); 642d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsStringToScalar(const char[],PetscScalar*); 652e8a6d31SBarry Smith 66014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsMonitorSet(PetscErrorCode (*)(const char[], const char[], void*), void*, PetscErrorCode (*)(void**)); 67014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsMonitorDefault(const char[], const char[], void*); 68081c24baSBoyana Norris 6984761bfeSJed Brown PETSC_EXTERN PetscErrorCode PetscObjectSetOptions(PetscObject,PetscOptions); 7084761bfeSJed Brown PETSC_EXTERN PetscErrorCode PetscObjectGetOptions(PetscObject,PetscOptions*); 7184761bfeSJed Brown 72014dd563SJed Brown PETSC_EXTERN PetscBool PetscOptionsPublish; 73e55864a3SBarry Smith 74e55864a3SBarry Smith /* 75e55864a3SBarry Smith See manual page for PetscOptionsBegin() 764416b707SBarry Smith 774416b707SBarry Smith PetscOptionsItem and PetscOptionsItems are a single option (such as ksp_type) and a collection of such single 784416b707SBarry Smith options being handled with a PetscOptionsBegin/End() 794416b707SBarry Smith 80e55864a3SBarry Smith */ 81050cccc3SHong Zhang 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; 824416b707SBarry Smith typedef struct _n_PetscOptionItem* PetscOptionItem; 834416b707SBarry Smith struct _n_PetscOptionItem{ 84e55864a3SBarry Smith char *option; 85e55864a3SBarry Smith char *text; 86e55864a3SBarry Smith void *data; /* used to hold the default value and then any value it is changed to by GUI */ 87e55864a3SBarry Smith PetscFunctionList flist; /* used for available values for PetscOptionsList() */ 88e55864a3SBarry Smith const char *const *list; /* used for available values for PetscOptionsEList() */ 89e55864a3SBarry Smith char nlist; /* number of entries in list */ 90e55864a3SBarry Smith char *man; 91e55864a3SBarry Smith size_t arraylength; /* number of entries in data in the case that it is an array (of PetscInt etc) */ 92e55864a3SBarry Smith PetscBool set; /* the user has changed this value in the GUI */ 93e55864a3SBarry Smith PetscOptionType type; 944416b707SBarry Smith PetscOptionItem next; 95e55864a3SBarry Smith char *pman; 96e55864a3SBarry Smith void *edata; 97e55864a3SBarry Smith }; 98e55864a3SBarry Smith 994416b707SBarry Smith typedef struct _p_PetscOptionItems { 100e55864a3SBarry Smith PetscInt count; 1014416b707SBarry Smith PetscOptionItem next; 102e55864a3SBarry Smith char *prefix,*pprefix; 103e55864a3SBarry Smith char *title; 104e55864a3SBarry Smith MPI_Comm comm; 105e55864a3SBarry Smith PetscBool printhelp,changedmethod,alreadyprinted; 106e55864a3SBarry Smith PetscObject object; 107c5929fdfSBarry Smith PetscOptions options; 1084416b707SBarry Smith } PetscOptionItems; 10930de9b25SBarry Smith 110*5f80ce2aSJacob Faibussowitsch #if defined(PETSC_CLANG_STATIC_ANALYZER) 111*5f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsBegin(MPI_Comm,const char*,const char*,const char*); 112*5f80ce2aSJacob Faibussowitsch PetscErrorCode PetscObjectOptionsBegin(PetscObject); 113*5f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsEnd(void); 114*5f80ce2aSJacob Faibussowitsch #else 11530de9b25SBarry Smith /*MC 11630de9b25SBarry Smith PetscOptionsBegin - Begins a set of queries on the options database that are related and should be 1171957e957SBarry Smith displayed on the same window of a GUI that allows the user to set the options interactively. Often one should 1181957e957SBarry Smith use PetscObjectOptionsBegin() rather than this call. 11930de9b25SBarry Smith 120f2ba6396SBarry Smith Synopsis: 121aaa7dc30SBarry Smith #include <petscoptions.h> 122f2ba6396SBarry Smith PetscErrorCode PetscOptionsBegin(MPI_Comm comm,const char prefix[],const char title[],const char mansec[]) 12330de9b25SBarry Smith 124fb455bf4SPatrick Sanan Collective 12530de9b25SBarry Smith 12630de9b25SBarry Smith Input Parameters: 12730de9b25SBarry Smith + comm - communicator that shares GUI 12876280437SVaclav Hapla . prefix - options prefix for all options displayed on window (optional) 12930de9b25SBarry Smith . title - short descriptive text, for example "Krylov Solver Options" 13076280437SVaclav Hapla - mansec - section of manual pages for options, for example KSP (optional) 13130de9b25SBarry Smith 13230de9b25SBarry Smith Level: intermediate 13330de9b25SBarry Smith 13495452b02SPatrick Sanan Notes: 135fb455bf4SPatrick Sanan The set of queries needs to be ended by a call to PetscOptionsEnd(). 136fb455bf4SPatrick Sanan 137fb455bf4SPatrick Sanan One can add subheadings with PetscOptionsHead(). 13830de9b25SBarry Smith 13995452b02SPatrick Sanan Developer Notes: 14095452b02SPatrick Sanan PetscOptionsPublish is set in PetscOptionsCheckInitial_Private() with -saws_options. When PetscOptionsPublish is set the 141fb455bf4SPatrick Sanan loop between PetscOptionsBegin() and PetscOptionsEnd() is run THREE times with PetscOptionsPublishCount of values -1,0,1. 142fb455bf4SPatrick Sanan Otherwise the loop is run ONCE with a PetscOptionsPublishCount of 1. 143fb455bf4SPatrick Sanan + \-1 - PetscOptionsInt() etc. just call PetscOptionsGetInt() etc. 144fb455bf4SPatrick Sanan . 0 - The GUI objects are created in PetscOptionsInt() etc. and displayed in PetscOptionsEnd() and the options 145fb455bf4SPatrick Sanan database updated with user changes; PetscOptionsGetInt() etc. are also called. 146fb455bf4SPatrick Sanan - 1 - PetscOptionsInt() etc. again call PetscOptionsGetInt() etc. (possibly getting new values), in addition the help message and 147fb455bf4SPatrick Sanan default values are printed if -help was given. 148fb455bf4SPatrick Sanan When PetscOptionsObject.changedmethod is set this causes PetscOptionsPublishCount to be reset to -2 (so in the next loop iteration it is -1) 149fb455bf4SPatrick Sanan and the whole process is repeated. This is to handle when, for example, the KSPType is changed thus changing the list of 150fb455bf4SPatrick Sanan options available so they need to be redisplayed so the user can change the. Changing PetscOptionsObjects.changedmethod is never 151fb455bf4SPatrick Sanan currently set. 152aee2cecaSBarry Smith 15330de9b25SBarry Smith .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 154acfcf0e5SJed Brown PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() 155acfcf0e5SJed Brown PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsBool(), 15630de9b25SBarry Smith PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 15730de9b25SBarry Smith PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 158acfcf0e5SJed Brown PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), 159a264d7a6SBarry Smith PetscOptionsFList(), PetscOptionsEList(), PetscObjectOptionsBegin() 16030de9b25SBarry Smith 16130de9b25SBarry Smith M*/ 1623194b578SJed Brown #define PetscOptionsBegin(comm,prefix,mess,sec) 0; do {\ 1634416b707SBarry Smith PetscOptionItems PetscOptionsObjectBase;\ 1644416b707SBarry Smith PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \ 165*5f80ce2aSJacob Faibussowitsch PetscMemzero(PetscOptionsObject,sizeof(*PetscOptionsObject)); \ 166e55864a3SBarry Smith for (PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->count<2; PetscOptionsObject->count++) {\ 167*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscOptionsBegin_Private(PetscOptionsObject,comm,prefix,mess,sec)) 16830de9b25SBarry Smith 1695fefd1ebSJed Brown /*MC 1705fefd1ebSJed Brown PetscObjectOptionsBegin - Begins a set of queries on the options database that are related and should be 1715fefd1ebSJed Brown displayed on the same window of a GUI that allows the user to set the options interactively. 1725fefd1ebSJed Brown 173f2ba6396SBarry Smith Synopsis: 174aaa7dc30SBarry Smith #include <petscoptions.h> 175f2ba6396SBarry Smith PetscErrorCode PetscObjectOptionsBegin(PetscObject obj) 1765fefd1ebSJed Brown 177d083f849SBarry Smith Collective on obj 1785fefd1ebSJed Brown 1795fefd1ebSJed Brown Input Parameters: 1805fefd1ebSJed Brown . obj - object to set options for 1815fefd1ebSJed Brown 1825fefd1ebSJed Brown Level: intermediate 1835fefd1ebSJed Brown 18495452b02SPatrick Sanan Notes: 18595452b02SPatrick Sanan Needs to be ended by a call the PetscOptionsEnd() 1865fefd1ebSJed Brown Can add subheadings with PetscOptionsHead() 1875fefd1ebSJed Brown 1885fefd1ebSJed Brown .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 1895fefd1ebSJed Brown PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() 1905fefd1ebSJed Brown PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsBool(), 1915fefd1ebSJed Brown PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 1925fefd1ebSJed Brown PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 1935fefd1ebSJed Brown PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), 194a264d7a6SBarry Smith PetscOptionsFList(), PetscOptionsEList() 1955fefd1ebSJed Brown 1965fefd1ebSJed Brown M*/ 1973194b578SJed Brown #define PetscObjectOptionsBegin(obj) 0; do { \ 1984416b707SBarry Smith PetscOptionItems PetscOptionsObjectBase;\ 1994416b707SBarry Smith PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \ 200c5929fdfSBarry Smith PetscOptionsObject->options = ((PetscObject)obj)->options; \ 201e55864a3SBarry Smith for (PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->count<2; PetscOptionsObject->count++) {\ 202*5f80ce2aSJacob Faibussowitsch CHKERRQ(PetscObjectOptionsBegin_Private(PetscOptionsObject,obj)) 2033194b578SJed Brown 20430de9b25SBarry Smith /*MC 20530de9b25SBarry Smith PetscOptionsEnd - Ends a set of queries on the options database that are related and should be 20630de9b25SBarry Smith displayed on the same window of a GUI that allows the user to set the options interactively. 20730de9b25SBarry Smith 208d083f849SBarry Smith Collective on the comm used in PetscOptionsBegin() or obj used in PetscObjectOptionsBegin() 20930de9b25SBarry Smith 210f2ba6396SBarry Smith Synopsis: 211aaa7dc30SBarry Smith #include <petscoptions.h> 212f2ba6396SBarry Smith PetscErrorCode PetscOptionsEnd(void) 21330de9b25SBarry Smith 21430de9b25SBarry Smith Level: intermediate 21530de9b25SBarry Smith 21695452b02SPatrick Sanan Notes: 21795452b02SPatrick Sanan Needs to be preceded by a call to PetscOptionsBegin() or PetscObjectOptionsBegin() 21830de9b25SBarry Smith 21930de9b25SBarry Smith .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 220acfcf0e5SJed Brown PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() 221acfcf0e5SJed Brown PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsBool(), 22230de9b25SBarry Smith PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 22330de9b25SBarry Smith PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 224acfcf0e5SJed Brown PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), 225a264d7a6SBarry Smith PetscOptionsFList(), PetscOptionsEList(), PetscObjectOptionsBegin() 22630de9b25SBarry Smith 22730de9b25SBarry Smith M*/ 228*5f80ce2aSJacob Faibussowitsch #define PetscOptionsEnd() 0;CHKERRQ(PetscOptionsEnd_Private(PetscOptionsObject));}} while (0) 229*5f80ce2aSJacob Faibussowitsch #endif /* PETSC_CLANG_STATIC_ANALYZER */ 23030de9b25SBarry Smith 2314416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBegin_Private(PetscOptionItems *,MPI_Comm,const char[],const char[],const char[]); 2324416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectOptionsBegin_Private(PetscOptionItems *,PetscObject); 2334416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnd_Private(PetscOptionItems *); 2344416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsHead(PetscOptionItems *,const char[]); 23530de9b25SBarry Smith 236*5f80ce2aSJacob Faibussowitsch #if defined(PETSC_CLANG_STATIC_ANALYZER) 237*5f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsTail(void); 238*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsEnum(T...); 239*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsInt(T...); 240*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoundedInt(T...); 241*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsRangeInt(T...); 242*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsReal(T...); 243*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsScalar(T...); 244*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsName(T...); 245*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsString(T...); 246*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBool(T...); 247*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolGroupBegin(T...); 248*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolGroup(T...); 249*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolGroupEnd(T...); 250*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsFList(T...); 251*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsEList(T...); 252*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsRealArray(T...); 253*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsScalarArray(T...); 254*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsIntArray(T...); 255*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsStringArray(T...); 256*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolArray(T...); 257*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsEnumArray(T...); 258*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsDeprecated(T...); 259*5f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsDeprecatedNoObject(T...); 260*5f80ce2aSJacob Faibussowitsch #else 26130de9b25SBarry Smith /*MC 26230de9b25SBarry Smith PetscOptionsTail - Ends a section of options begun with PetscOptionsHead() 26330de9b25SBarry Smith See, for example, KSPSetFromOptions_GMRES(). 26430de9b25SBarry Smith 265d083f849SBarry Smith Collective on the comm used in PetscOptionsBegin() or obj used in PetscObjectOptionsBegin() 26630de9b25SBarry Smith 267f2ba6396SBarry Smith Synopsis: 268aaa7dc30SBarry Smith #include <petscoptions.h> 269f2ba6396SBarry Smith PetscErrorCode PetscOptionsTail(void) 27030de9b25SBarry Smith 27130de9b25SBarry Smith Level: intermediate 27230de9b25SBarry Smith 27395452b02SPatrick Sanan Notes: 27495452b02SPatrick Sanan Must be between a PetscOptionsBegin()/PetscObjectOptionsBegin() and a PetscOptionsEnd() 27530de9b25SBarry Smith 27630de9b25SBarry Smith Must be preceded by a call to PetscOptionsHead() in the same function. 27730de9b25SBarry Smith 278b52f573bSBarry Smith This needs to be used only if the code below PetscOptionsTail() can be run ONLY once. 279b52f573bSBarry Smith See, for example, PCSetFromOptions_Composite(). This is a return(0) in it for early exit 280b52f573bSBarry Smith from the function. 281b52f573bSBarry Smith 28256752e42SBarry Smith This is only for use with the PETSc options GUI 283b52f573bSBarry Smith 28430de9b25SBarry Smith .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 285acfcf0e5SJed Brown PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool(), 28630de9b25SBarry Smith PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 28730de9b25SBarry Smith PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 288acfcf0e5SJed Brown PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), 289a264d7a6SBarry Smith PetscOptionsFList(), PetscOptionsEList(), PetscOptionsEnum() 29030de9b25SBarry Smith M*/ 291e83a5d19SLisandro Dalcin #define PetscOptionsTail() 0; do {if (PetscOptionsObject->count != 1) PetscFunctionReturn(0);} while (0) 292186905e3SBarry Smith 293e55864a3SBarry Smith #define PetscOptionsEnum(a,b,c,d,e,f,g) PetscOptionsEnum_Private(PetscOptionsObject,a,b,c,d,e,f,g) 2945a856986SBarry Smith #define PetscOptionsInt(a,b,c,d,e,f) PetscOptionsInt_Private(PetscOptionsObject,a,b,c,d,e,f,PETSC_MIN_INT,PETSC_MAX_INT) 2955a856986SBarry Smith #define PetscOptionsBoundedInt(a,b,c,d,e,f,g) PetscOptionsInt_Private(PetscOptionsObject,a,b,c,d,e,f,g,PETSC_MAX_INT) 2965a856986SBarry Smith #define PetscOptionsRangeInt(a,b,c,d,e,f,g,h) PetscOptionsInt_Private(PetscOptionsObject,a,b,c,d,e,f,g,h) 297e55864a3SBarry Smith #define PetscOptionsReal(a,b,c,d,e,f) PetscOptionsReal_Private(PetscOptionsObject,a,b,c,d,e,f) 298e55864a3SBarry Smith #define PetscOptionsScalar(a,b,c,d,e,f) PetscOptionsScalar_Private(PetscOptionsObject,a,b,c,d,e,f) 299e55864a3SBarry Smith #define PetscOptionsName(a,b,c,d) PetscOptionsName_Private(PetscOptionsObject,a,b,c,d) 300e55864a3SBarry Smith #define PetscOptionsString(a,b,c,d,e,f,g) PetscOptionsString_Private(PetscOptionsObject,a,b,c,d,e,f,g) 301e55864a3SBarry Smith #define PetscOptionsBool(a,b,c,d,e,f) PetscOptionsBool_Private(PetscOptionsObject,a,b,c,d,e,f) 302e55864a3SBarry Smith #define PetscOptionsBoolGroupBegin(a,b,c,d) PetscOptionsBoolGroupBegin_Private(PetscOptionsObject,a,b,c,d) 303e55864a3SBarry Smith #define PetscOptionsBoolGroup(a,b,c,d) PetscOptionsBoolGroup_Private(PetscOptionsObject,a,b,c,d) 304e55864a3SBarry Smith #define PetscOptionsBoolGroupEnd(a,b,c,d) PetscOptionsBoolGroupEnd_Private(PetscOptionsObject,a,b,c,d) 30583355fc5SBarry Smith #define PetscOptionsFList(a,b,c,d,e,f,g,h) PetscOptionsFList_Private(PetscOptionsObject,a,b,c,d,e,f,g,h) 306e55864a3SBarry Smith #define PetscOptionsEList(a,b,c,d,e,f,g,h) PetscOptionsEList_Private(PetscOptionsObject,a,b,c,d,e,f,g,h) 307e55864a3SBarry Smith #define PetscOptionsRealArray(a,b,c,d,e,f) PetscOptionsRealArray_Private(PetscOptionsObject,a,b,c,d,e,f) 308050cccc3SHong Zhang #define PetscOptionsScalarArray(a,b,c,d,e,f) PetscOptionsScalarArray_Private(PetscOptionsObject,a,b,c,d,e,f) 309e55864a3SBarry Smith #define PetscOptionsIntArray(a,b,c,d,e,f) PetscOptionsIntArray_Private(PetscOptionsObject,a,b,c,d,e,f) 310e55864a3SBarry Smith #define PetscOptionsStringArray(a,b,c,d,e,f) PetscOptionsStringArray_Private(PetscOptionsObject,a,b,c,d,e,f) 311e55864a3SBarry Smith #define PetscOptionsBoolArray(a,b,c,d,e,f) PetscOptionsBoolArray_Private(PetscOptionsObject,a,b,c,d,e,f) 312d3e47460SLisandro Dalcin #define PetscOptionsEnumArray(a,b,c,d,e,f,g) PetscOptionsEnumArray_Private(PetscOptionsObject,a,b,c,d,e,f,g) 3139f3a6782SPatrick Sanan #define PetscOptionsDeprecated(a,b,c,d) PetscOptionsDeprecated_Private(PetscOptionsObject,a,b,c,d) 314b0bdc838SStefano Zampini #define PetscOptionsDeprecatedNoObject(a,b,c,d) PetscOptionsDeprecated_Private(NULL,a,b,c,d) 315*5f80ce2aSJacob Faibussowitsch #endif /* PETSC_CLANG_STATIC_ANALYZER */ 316e55864a3SBarry Smith 3174416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnum_Private(PetscOptionItems*,const char[],const char[],const char[],const char *const*,PetscEnum,PetscEnum*,PetscBool*); 3185a856986SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInt_Private(PetscOptionItems*,const char[],const char[],const char[],PetscInt,PetscInt*,PetscBool*,PetscInt,PetscInt); 3194416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsReal_Private(PetscOptionItems*,const char[],const char[],const char[],PetscReal,PetscReal*,PetscBool*); 3204416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsScalar_Private(PetscOptionItems*,const char[],const char[],const char[],PetscScalar,PetscScalar*,PetscBool*); 3214416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsName_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3224416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsString_Private(PetscOptionItems*,const char[],const char[],const char[],const char[],char*,size_t,PetscBool*); 3234416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBool_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool ,PetscBool*,PetscBool*); 3244416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroupBegin_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3254416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroup_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3264416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroupEnd_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3274416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsFList_Private(PetscOptionItems*,const char[],const char[],const char[],PetscFunctionList,const char[],char[],size_t,PetscBool*); 3284416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEList_Private(PetscOptionItems*,const char[],const char[],const char[],const char*const*,PetscInt,const char[],PetscInt*,PetscBool*); 3294416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsRealArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscReal[],PetscInt*,PetscBool*); 3304416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsScalarArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscScalar[],PetscInt*,PetscBool*); 3314416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsIntArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscInt[],PetscInt*,PetscBool*); 3324416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsStringArray_Private(PetscOptionItems*,const char[],const char[],const char[],char*[],PetscInt*,PetscBool*); 3334416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool [],PetscInt*,PetscBool*); 3344416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnumArray_Private(PetscOptionItems*,const char[],const char[],const char[],const char *const*,PetscEnum[],PetscInt*,PetscBool*); 3359f3a6782SPatrick Sanan PETSC_EXTERN PetscErrorCode PetscOptionsDeprecated_Private(PetscOptionItems*,const char[],const char[],const char[],const char[]); 336cffb1e40SBarry Smith 337e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSAWsDestroy(void); 338f8d0b74dSMatthew Knepley 339447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectAddOptionsHandler(PetscObject,PetscErrorCode (*)(PetscOptionItems*,PetscObject,void*),PetscErrorCode (*)(PetscObject,void*),void*); 340447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectProcessOptionsHandlers(PetscOptionItems*,PetscObject); 341447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectDestroyOptionsHandlers(PetscObject); 342447ac60bSBarry Smith 3433a3b2205SBarry Smith #endif 344