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 6*ac09b921SBarry Smith 72c8e378dSBarry Smith #include <petscsys.h> 8c619b03eSJed Brown #include <petscviewertypes.h> 93a3b2205SBarry Smith 10*ac09b921SBarry Smith /* SUBMANSEC = Sys */ 11*ac09b921SBarry Smith 12c5c1f447SLisandro Dalcin #define PETSC_MAX_OPTION_NAME 512 13c5929fdfSBarry Smith typedef struct _n_PetscOptions* PetscOptions; 14c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsCreate(PetscOptions*); 15b4205f0bSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPush(PetscOptions); 16b4205f0bSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPop(void); 17c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsDestroy(PetscOptions*); 182d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsCreateDefault(void); 192d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsDestroyDefault(void); 20c5929fdfSBarry Smith 212d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsHasHelp(PetscOptions,PetscBool*); 22c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsHasName(PetscOptions,const char[],const char[],PetscBool*); 23c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetBool(PetscOptions,const char[],const char [],PetscBool*,PetscBool*); 242d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetInt(PetscOptions,const char[],const char [],PetscInt*,PetscBool*); 252d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEnum(PetscOptions,const char[],const char[],const char*const*,PetscEnum*,PetscBool*); 262d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEList(PetscOptions,const char[],const char[],const char*const*,PetscInt,PetscInt*,PetscBool*); 27c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetReal(PetscOptions,const char[],const char[],PetscReal*,PetscBool*); 28c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetScalar(PetscOptions,const char[],const char[],PetscScalar*,PetscBool*); 292d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetString(PetscOptions,const char[],const char[],char[],size_t,PetscBool*); 302d747510SLisandro Dalcin 312d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetBoolArray(PetscOptions,const char[],const char[],PetscBool [],PetscInt*,PetscBool*); 322d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEnumArray(PetscOptions,const char[],const char[],const char*const*,PetscEnum*,PetscInt*,PetscBool*); 33c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetIntArray(PetscOptions,const char[],const char[],PetscInt[],PetscInt*,PetscBool*); 34c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetRealArray(PetscOptions,const char[],const char[],PetscReal[],PetscInt*,PetscBool*); 35c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetScalarArray(PetscOptions,const char[],const char[],PetscScalar[],PetscInt*,PetscBool*); 36c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetStringArray(PetscOptions,const char[],const char[],char*[],PetscInt*,PetscBool*); 373a3b2205SBarry Smith 382d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsValidKey(const char[],PetscBool*); 39c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSetAlias(PetscOptions,const char[],const char[]); 40c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSetValue(PetscOptions,const char[],const char[]); 41c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsClearValue(PetscOptions,const char[]); 422d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsFindPair(PetscOptions,const char[],const char[],const char*[],PetscBool*); 433a3b2205SBarry Smith 442d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetAll(PetscOptions,char*[]); 45c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsAllUsed(PetscOptions,PetscInt*); 462d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsUsed(PetscOptions,const char[],PetscBool*); 47c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsLeft(PetscOptions); 481ab23d95SFande Kong PETSC_EXTERN PetscErrorCode PetscOptionsLeftGet(PetscOptions,PetscInt*,char***,char***); 495b191818SFande Kong PETSC_EXTERN PetscErrorCode PetscOptionsLeftRestore(PetscOptions,PetscInt*,char***,char***); 50c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsView(PetscOptions,PetscViewer); 514b0e389bSBarry Smith 522d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsReject(PetscOptions,const char[],const char[],const char[]); 53c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsert(PetscOptions,int*,char***,const char[]); 54c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsertFile(MPI_Comm,PetscOptions,const char[],PetscBool); 555c23ca1cSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsInsertFileYAML(MPI_Comm,PetscOptions,const char[],PetscBool); 56c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsertString(PetscOptions,const char[]); 57080f0011SToby Isaac PETSC_EXTERN PetscErrorCode PetscOptionsInsertStringYAML(PetscOptions,const char[]); 58d06005cbSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsInsertArgs(PetscOptions,int,char**); 59c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsClear(PetscOptions); 60c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPush(PetscOptions,const char[]); 61c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPop(PetscOptions); 625d0dffe5SBarry Smith 63014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsGetenv(MPI_Comm,const char[],char[],size_t,PetscBool*); 642d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsStringToBool(const char[],PetscBool*); 65014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsStringToInt(const char[],PetscInt*); 66014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsStringToReal(const char[],PetscReal*); 672d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsStringToScalar(const char[],PetscScalar*); 682e8a6d31SBarry Smith 69014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsMonitorSet(PetscErrorCode (*)(const char[], const char[], void*), void*, PetscErrorCode (*)(void**)); 70014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsMonitorDefault(const char[], const char[], void*); 71081c24baSBoyana Norris 7284761bfeSJed Brown PETSC_EXTERN PetscErrorCode PetscObjectSetOptions(PetscObject,PetscOptions); 7384761bfeSJed Brown PETSC_EXTERN PetscErrorCode PetscObjectGetOptions(PetscObject,PetscOptions*); 7484761bfeSJed Brown 75014dd563SJed Brown PETSC_EXTERN PetscBool PetscOptionsPublish; 76e55864a3SBarry Smith 77e55864a3SBarry Smith /* 78e55864a3SBarry Smith See manual page for PetscOptionsBegin() 794416b707SBarry Smith 804416b707SBarry Smith PetscOptionsItem and PetscOptionsItems are a single option (such as ksp_type) and a collection of such single 814416b707SBarry Smith options being handled with a PetscOptionsBegin/End() 824416b707SBarry Smith 83e55864a3SBarry Smith */ 84050cccc3SHong 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; 854416b707SBarry Smith typedef struct _n_PetscOptionItem* PetscOptionItem; 864416b707SBarry Smith struct _n_PetscOptionItem{ 87e55864a3SBarry Smith char *option; 88e55864a3SBarry Smith char *text; 89e55864a3SBarry Smith void *data; /* used to hold the default value and then any value it is changed to by GUI */ 90e55864a3SBarry Smith PetscFunctionList flist; /* used for available values for PetscOptionsList() */ 91e55864a3SBarry Smith const char *const *list; /* used for available values for PetscOptionsEList() */ 92e55864a3SBarry Smith char nlist; /* number of entries in list */ 93e55864a3SBarry Smith char *man; 94e55864a3SBarry Smith size_t arraylength; /* number of entries in data in the case that it is an array (of PetscInt etc) */ 95e55864a3SBarry Smith PetscBool set; /* the user has changed this value in the GUI */ 96e55864a3SBarry Smith PetscOptionType type; 974416b707SBarry Smith PetscOptionItem next; 98e55864a3SBarry Smith char *pman; 99e55864a3SBarry Smith void *edata; 100e55864a3SBarry Smith }; 101e55864a3SBarry Smith 1024416b707SBarry Smith typedef struct _p_PetscOptionItems { 103e55864a3SBarry Smith PetscInt count; 1044416b707SBarry Smith PetscOptionItem next; 105e55864a3SBarry Smith char *prefix,*pprefix; 106e55864a3SBarry Smith char *title; 107e55864a3SBarry Smith MPI_Comm comm; 108e55864a3SBarry Smith PetscBool printhelp,changedmethod,alreadyprinted; 109e55864a3SBarry Smith PetscObject object; 110c5929fdfSBarry Smith PetscOptions options; 1114416b707SBarry Smith } PetscOptionItems; 11230de9b25SBarry Smith 1135f80ce2aSJacob Faibussowitsch #if defined(PETSC_CLANG_STATIC_ANALYZER) 11494bad497SJacob Faibussowitsch extern PetscOptionItems* PetscOptionsObject; /* declare this so that the PetscOptions stubs work */ 1155f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsBegin(MPI_Comm,const char*,const char*,const char*); 1165f80ce2aSJacob Faibussowitsch PetscErrorCode PetscObjectOptionsBegin(PetscObject); 1175f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsEnd(void); 1185f80ce2aSJacob Faibussowitsch #else 11930de9b25SBarry Smith /*MC 12030de9b25SBarry Smith PetscOptionsBegin - Begins a set of queries on the options database that are related and should be 1211957e957SBarry Smith displayed on the same window of a GUI that allows the user to set the options interactively. Often one should 1221957e957SBarry Smith use PetscObjectOptionsBegin() rather than this call. 12330de9b25SBarry Smith 124f2ba6396SBarry Smith Synopsis: 125aaa7dc30SBarry Smith #include <petscoptions.h> 126f2ba6396SBarry Smith PetscErrorCode PetscOptionsBegin(MPI_Comm comm,const char prefix[],const char title[],const char mansec[]) 12730de9b25SBarry Smith 128fb455bf4SPatrick Sanan Collective 12930de9b25SBarry Smith 13030de9b25SBarry Smith Input Parameters: 13130de9b25SBarry Smith + comm - communicator that shares GUI 13276280437SVaclav Hapla . prefix - options prefix for all options displayed on window (optional) 13330de9b25SBarry Smith . title - short descriptive text, for example "Krylov Solver Options" 13476280437SVaclav Hapla - mansec - section of manual pages for options, for example KSP (optional) 13530de9b25SBarry Smith 13630de9b25SBarry Smith Level: intermediate 13730de9b25SBarry Smith 13895452b02SPatrick Sanan Notes: 139d0609cedSBarry Smith This is a macro that handles its own error checking, it does not return an error code. 140d0609cedSBarry Smith 141fb455bf4SPatrick Sanan The set of queries needs to be ended by a call to PetscOptionsEnd(). 142fb455bf4SPatrick Sanan 143d0609cedSBarry Smith One can add subheadings with PetscOptionsHeadBegin(). 14430de9b25SBarry Smith 14595452b02SPatrick Sanan Developer Notes: 14695452b02SPatrick Sanan PetscOptionsPublish is set in PetscOptionsCheckInitial_Private() with -saws_options. When PetscOptionsPublish is set the 147fb455bf4SPatrick Sanan loop between PetscOptionsBegin() and PetscOptionsEnd() is run THREE times with PetscOptionsPublishCount of values -1,0,1. 148fb455bf4SPatrick Sanan Otherwise the loop is run ONCE with a PetscOptionsPublishCount of 1. 149fb455bf4SPatrick Sanan + \-1 - PetscOptionsInt() etc. just call PetscOptionsGetInt() etc. 150fb455bf4SPatrick Sanan . 0 - The GUI objects are created in PetscOptionsInt() etc. and displayed in PetscOptionsEnd() and the options 151fb455bf4SPatrick Sanan database updated with user changes; PetscOptionsGetInt() etc. are also called. 152fb455bf4SPatrick Sanan - 1 - PetscOptionsInt() etc. again call PetscOptionsGetInt() etc. (possibly getting new values), in addition the help message and 153fb455bf4SPatrick Sanan default values are printed if -help was given. 154fb455bf4SPatrick Sanan When PetscOptionsObject.changedmethod is set this causes PetscOptionsPublishCount to be reset to -2 (so in the next loop iteration it is -1) 155fb455bf4SPatrick Sanan and the whole process is repeated. This is to handle when, for example, the KSPType is changed thus changing the list of 156fb455bf4SPatrick Sanan options available so they need to be redisplayed so the user can change the. Changing PetscOptionsObjects.changedmethod is never 157fb455bf4SPatrick Sanan currently set. 158aee2cecaSBarry Smith 159db781477SPatrick Sanan .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 160db781477SPatrick Sanan `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` 161db781477SPatrick Sanan `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 162db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 163db781477SPatrick Sanan `PetscOptionsStringArray(),PetscOptionsRealArray()`, `PetscOptionsScalar()`, 164db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 165db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscObjectOptionsBegin()` 16630de9b25SBarry Smith 16730de9b25SBarry Smith M*/ 168d0609cedSBarry Smith #define PetscOptionsBegin(comm,prefix,mess,sec) do {\ 1694416b707SBarry Smith PetscOptionItems PetscOptionsObjectBase;\ 1704416b707SBarry Smith PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \ 171d0609cedSBarry Smith PetscCall(PetscMemzero(PetscOptionsObject,sizeof(*PetscOptionsObject))); \ 172e55864a3SBarry Smith for (PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->count<2; PetscOptionsObject->count++) {\ 1739566063dSJacob Faibussowitsch PetscCall(PetscOptionsBegin_Private(PetscOptionsObject,comm,prefix,mess,sec)) 17430de9b25SBarry Smith 1755fefd1ebSJed Brown /*MC 1765fefd1ebSJed Brown PetscObjectOptionsBegin - Begins a set of queries on the options database that are related and should be 1775fefd1ebSJed Brown displayed on the same window of a GUI that allows the user to set the options interactively. 1785fefd1ebSJed Brown 179f2ba6396SBarry Smith Synopsis: 180aaa7dc30SBarry Smith #include <petscoptions.h> 181f2ba6396SBarry Smith PetscErrorCode PetscObjectOptionsBegin(PetscObject obj) 1825fefd1ebSJed Brown 183d083f849SBarry Smith Collective on obj 1845fefd1ebSJed Brown 1855fefd1ebSJed Brown Input Parameters: 1865fefd1ebSJed Brown . obj - object to set options for 1875fefd1ebSJed Brown 1885fefd1ebSJed Brown Level: intermediate 1895fefd1ebSJed Brown 19095452b02SPatrick Sanan Notes: 191d0609cedSBarry Smith This is a macro that handles its own error checking, it does not return an error code. 192d0609cedSBarry Smith 19395452b02SPatrick Sanan Needs to be ended by a call the PetscOptionsEnd() 194d0609cedSBarry Smith 195d0609cedSBarry Smith Can add subheadings with PetscOptionsHeadBegin() 1965fefd1ebSJed Brown 197db781477SPatrick Sanan .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 198db781477SPatrick Sanan `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` 199db781477SPatrick Sanan `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 200db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 201db781477SPatrick Sanan `PetscOptionsStringArray(),PetscOptionsRealArray()`, `PetscOptionsScalar()`, 202db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 203db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()` 2045fefd1ebSJed Brown 2055fefd1ebSJed Brown M*/ 206d0609cedSBarry Smith #define PetscObjectOptionsBegin(obj) do { \ 2074416b707SBarry Smith PetscOptionItems PetscOptionsObjectBase;\ 2084416b707SBarry Smith PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \ 209c5929fdfSBarry Smith PetscOptionsObject->options = ((PetscObject)obj)->options; \ 210e55864a3SBarry Smith for (PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->count<2; PetscOptionsObject->count++) {\ 2119566063dSJacob Faibussowitsch PetscCall(PetscObjectOptionsBegin_Private(PetscOptionsObject,obj)) 2123194b578SJed Brown 21330de9b25SBarry Smith /*MC 21430de9b25SBarry Smith PetscOptionsEnd - Ends a set of queries on the options database that are related and should be 21530de9b25SBarry Smith displayed on the same window of a GUI that allows the user to set the options interactively. 21630de9b25SBarry Smith 217d083f849SBarry Smith Collective on the comm used in PetscOptionsBegin() or obj used in PetscObjectOptionsBegin() 21830de9b25SBarry Smith 219f2ba6396SBarry Smith Synopsis: 220aaa7dc30SBarry Smith #include <petscoptions.h> 221f2ba6396SBarry Smith PetscErrorCode PetscOptionsEnd(void) 22230de9b25SBarry Smith 22330de9b25SBarry Smith Level: intermediate 22430de9b25SBarry Smith 22595452b02SPatrick Sanan Notes: 22695452b02SPatrick Sanan Needs to be preceded by a call to PetscOptionsBegin() or PetscObjectOptionsBegin() 22730de9b25SBarry Smith 228d0609cedSBarry Smith This is a macro that handles its own error checking, it does not return an error code. 229d0609cedSBarry Smith 230db781477SPatrick Sanan .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 231db781477SPatrick Sanan `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` 232db781477SPatrick Sanan `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 233db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsHeadBegin()`, 234db781477SPatrick Sanan `PetscOptionsStringArray(),PetscOptionsRealArray()`, `PetscOptionsScalar()`, 235db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 236db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscObjectOptionsBegin()` 23730de9b25SBarry Smith 23830de9b25SBarry Smith M*/ 239d0609cedSBarry Smith #define PetscOptionsEnd() PetscCall(PetscOptionsEnd_Private(PetscOptionsObject));}} while (0) 2405f80ce2aSJacob Faibussowitsch #endif /* PETSC_CLANG_STATIC_ANALYZER */ 24130de9b25SBarry Smith 2424416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBegin_Private(PetscOptionItems *,MPI_Comm,const char[],const char[],const char[]); 2434416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectOptionsBegin_Private(PetscOptionItems *,PetscObject); 2444416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnd_Private(PetscOptionItems *); 245d0609cedSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsHeadBegin(PetscOptionItems *,const char[]); 24630de9b25SBarry Smith 2475f80ce2aSJacob Faibussowitsch #if defined(PETSC_CLANG_STATIC_ANALYZER) 248d0609cedSBarry Smith template <typename... T> void PetscOptionsHeadBegin(T...); 249d0609cedSBarry Smith void PetscOptionsHeadEnd(void); 2505f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsEnum(T...); 2515f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsInt(T...); 2525f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoundedInt(T...); 2535f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsRangeInt(T...); 2545f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsReal(T...); 2555f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsScalar(T...); 2565f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsName(T...); 2575f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsString(T...); 2585f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBool(T...); 2595f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolGroupBegin(T...); 2605f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolGroup(T...); 2615f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolGroupEnd(T...); 2625f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsFList(T...); 2635f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsEList(T...); 2645f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsRealArray(T...); 2655f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsScalarArray(T...); 2665f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsIntArray(T...); 2675f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsStringArray(T...); 2685f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsBoolArray(T...); 2695f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsEnumArray(T...); 2705f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsDeprecated(T...); 2715f80ce2aSJacob Faibussowitsch template <typename... T> PetscErrorCode PetscOptionsDeprecatedNoObject(T...); 2725f80ce2aSJacob Faibussowitsch #else 27330de9b25SBarry Smith /*MC 274d0609cedSBarry Smith PetscOptionsHeadBegin - Puts a heading before listing any more published options. Used, for example, 275d0609cedSBarry Smith in KSPSetFromOptions_GMRES(). 276d0609cedSBarry Smith 277d0609cedSBarry Smith Logically Collective on the communicator passed in PetscOptionsBegin() 278d0609cedSBarry Smith 279d0609cedSBarry Smith Input Parameter: 280d0609cedSBarry Smith . head - the heading text 281d0609cedSBarry Smith 282d0609cedSBarry Smith Level: intermediate 283d0609cedSBarry Smith 284d0609cedSBarry Smith Notes: 285d0609cedSBarry Smith Handles errors directly, hence does not return an error code 286d0609cedSBarry Smith 287d0609cedSBarry Smith Must be between a PetscOptionsBegin() and a PetscOptionsEnd(), and PetscOptionsObject created in PetscOptionsBegin() should be the first argument 288d0609cedSBarry Smith 289d0609cedSBarry Smith Can be followed by a call to PetscOptionsHeadEnd() in the same function. 290d0609cedSBarry Smith 291db781477SPatrick Sanan .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 292db781477SPatrick Sanan `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 293db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 294db781477SPatrick Sanan `PetscOptionsStringArray(),PetscOptionsRealArray()`, `PetscOptionsScalar()`, 295db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 296db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()` 297d0609cedSBarry Smith @*/ 298d0609cedSBarry Smith #define PetscOptionsHeadBegin(PetscOptionsObject,head) do {\ 299d0609cedSBarry Smith if (PetscOptionsObject->printhelp && PetscOptionsObject->count == 1 && !PetscOptionsObject->alreadyprinted) {\ 300d0609cedSBarry Smith PetscCall((*PetscHelpPrintf)(PetscOptionsObject->comm," %s\n",head));\ 301d0609cedSBarry Smith }\ 302d0609cedSBarry Smith } while (0) 303d0609cedSBarry Smith 304d0609cedSBarry Smith #define PetscOptionsHead(...) PETSC_DEPRECATED_MACRO("GCC warning \"Use PetscOptionsHeadBegin() (since version 3.18)\"") PetscOptionsHeadBegin(__VA_ARGS__) 305d0609cedSBarry Smith 306d0609cedSBarry Smith /*MC 307d0609cedSBarry Smith PetscOptionsHeadEnd - Ends a section of options begun with PetscOptionsHeadBegin() 30830de9b25SBarry Smith See, for example, KSPSetFromOptions_GMRES(). 30930de9b25SBarry Smith 310d083f849SBarry Smith Collective on the comm used in PetscOptionsBegin() or obj used in PetscObjectOptionsBegin() 31130de9b25SBarry Smith 312f2ba6396SBarry Smith Synopsis: 313aaa7dc30SBarry Smith #include <petscoptions.h> 314d0609cedSBarry Smith PetscErrorCode PetscOptionsHeadEnd(void) 31530de9b25SBarry Smith 31630de9b25SBarry Smith Level: intermediate 31730de9b25SBarry Smith 31895452b02SPatrick Sanan Notes: 31995452b02SPatrick Sanan Must be between a PetscOptionsBegin()/PetscObjectOptionsBegin() and a PetscOptionsEnd() 32030de9b25SBarry Smith 321d0609cedSBarry Smith Must be preceded by a call to PetscOptionsHeadBegin() in the same function. 32230de9b25SBarry Smith 323d0609cedSBarry Smith This needs to be used only if the code below PetscOptionsHeadEnd() can be run ONLY once. 324b52f573bSBarry Smith See, for example, PCSetFromOptions_Composite(). This is a return(0) in it for early exit 325b52f573bSBarry Smith from the function. 326b52f573bSBarry Smith 32756752e42SBarry Smith This is only for use with the PETSc options GUI 328b52f573bSBarry Smith 329db781477SPatrick Sanan .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 330db781477SPatrick Sanan `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 331db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 332db781477SPatrick Sanan `PetscOptionsStringArray(),PetscOptionsRealArray()`, `PetscOptionsScalar()`, 333db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 334db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsEnum()` 33530de9b25SBarry Smith M*/ 336d0609cedSBarry Smith #define PetscOptionsHeadEnd() do {if (PetscOptionsObject->count != 1) PetscFunctionReturn(0);} while (0) 337d0609cedSBarry Smith 338d0609cedSBarry Smith #define PetscOptionsTail(...) PETSC_DEPRECATED_MACRO("GCC warning \"Use PetscOptionsHeadEnd() (since version 3.18)\"") PetscOptionsHeadEnd(__VA_ARGS__) 339186905e3SBarry Smith 340e55864a3SBarry Smith #define PetscOptionsEnum(a,b,c,d,e,f,g) PetscOptionsEnum_Private(PetscOptionsObject,a,b,c,d,e,f,g) 3415a856986SBarry Smith #define PetscOptionsInt(a,b,c,d,e,f) PetscOptionsInt_Private(PetscOptionsObject,a,b,c,d,e,f,PETSC_MIN_INT,PETSC_MAX_INT) 3425a856986SBarry Smith #define PetscOptionsBoundedInt(a,b,c,d,e,f,g) PetscOptionsInt_Private(PetscOptionsObject,a,b,c,d,e,f,g,PETSC_MAX_INT) 3435a856986SBarry Smith #define PetscOptionsRangeInt(a,b,c,d,e,f,g,h) PetscOptionsInt_Private(PetscOptionsObject,a,b,c,d,e,f,g,h) 344e55864a3SBarry Smith #define PetscOptionsReal(a,b,c,d,e,f) PetscOptionsReal_Private(PetscOptionsObject,a,b,c,d,e,f) 345e55864a3SBarry Smith #define PetscOptionsScalar(a,b,c,d,e,f) PetscOptionsScalar_Private(PetscOptionsObject,a,b,c,d,e,f) 346e55864a3SBarry Smith #define PetscOptionsName(a,b,c,d) PetscOptionsName_Private(PetscOptionsObject,a,b,c,d) 347e55864a3SBarry Smith #define PetscOptionsString(a,b,c,d,e,f,g) PetscOptionsString_Private(PetscOptionsObject,a,b,c,d,e,f,g) 348e55864a3SBarry Smith #define PetscOptionsBool(a,b,c,d,e,f) PetscOptionsBool_Private(PetscOptionsObject,a,b,c,d,e,f) 349e55864a3SBarry Smith #define PetscOptionsBoolGroupBegin(a,b,c,d) PetscOptionsBoolGroupBegin_Private(PetscOptionsObject,a,b,c,d) 350e55864a3SBarry Smith #define PetscOptionsBoolGroup(a,b,c,d) PetscOptionsBoolGroup_Private(PetscOptionsObject,a,b,c,d) 351e55864a3SBarry Smith #define PetscOptionsBoolGroupEnd(a,b,c,d) PetscOptionsBoolGroupEnd_Private(PetscOptionsObject,a,b,c,d) 35283355fc5SBarry Smith #define PetscOptionsFList(a,b,c,d,e,f,g,h) PetscOptionsFList_Private(PetscOptionsObject,a,b,c,d,e,f,g,h) 353e55864a3SBarry Smith #define PetscOptionsEList(a,b,c,d,e,f,g,h) PetscOptionsEList_Private(PetscOptionsObject,a,b,c,d,e,f,g,h) 354e55864a3SBarry Smith #define PetscOptionsRealArray(a,b,c,d,e,f) PetscOptionsRealArray_Private(PetscOptionsObject,a,b,c,d,e,f) 355050cccc3SHong Zhang #define PetscOptionsScalarArray(a,b,c,d,e,f) PetscOptionsScalarArray_Private(PetscOptionsObject,a,b,c,d,e,f) 356e55864a3SBarry Smith #define PetscOptionsIntArray(a,b,c,d,e,f) PetscOptionsIntArray_Private(PetscOptionsObject,a,b,c,d,e,f) 357e55864a3SBarry Smith #define PetscOptionsStringArray(a,b,c,d,e,f) PetscOptionsStringArray_Private(PetscOptionsObject,a,b,c,d,e,f) 358e55864a3SBarry Smith #define PetscOptionsBoolArray(a,b,c,d,e,f) PetscOptionsBoolArray_Private(PetscOptionsObject,a,b,c,d,e,f) 359d3e47460SLisandro Dalcin #define PetscOptionsEnumArray(a,b,c,d,e,f,g) PetscOptionsEnumArray_Private(PetscOptionsObject,a,b,c,d,e,f,g) 3609f3a6782SPatrick Sanan #define PetscOptionsDeprecated(a,b,c,d) PetscOptionsDeprecated_Private(PetscOptionsObject,a,b,c,d) 361b0bdc838SStefano Zampini #define PetscOptionsDeprecatedNoObject(a,b,c,d) PetscOptionsDeprecated_Private(NULL,a,b,c,d) 3625f80ce2aSJacob Faibussowitsch #endif /* PETSC_CLANG_STATIC_ANALYZER */ 363e55864a3SBarry Smith 3644416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnum_Private(PetscOptionItems*,const char[],const char[],const char[],const char *const*,PetscEnum,PetscEnum*,PetscBool*); 3655a856986SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInt_Private(PetscOptionItems*,const char[],const char[],const char[],PetscInt,PetscInt*,PetscBool*,PetscInt,PetscInt); 3664416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsReal_Private(PetscOptionItems*,const char[],const char[],const char[],PetscReal,PetscReal*,PetscBool*); 3674416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsScalar_Private(PetscOptionItems*,const char[],const char[],const char[],PetscScalar,PetscScalar*,PetscBool*); 3684416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsName_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3694416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsString_Private(PetscOptionItems*,const char[],const char[],const char[],const char[],char*,size_t,PetscBool*); 3704416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBool_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool ,PetscBool*,PetscBool*); 3714416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroupBegin_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3724416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroup_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3734416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroupEnd_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool*); 3744416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsFList_Private(PetscOptionItems*,const char[],const char[],const char[],PetscFunctionList,const char[],char[],size_t,PetscBool*); 3754416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEList_Private(PetscOptionItems*,const char[],const char[],const char[],const char*const*,PetscInt,const char[],PetscInt*,PetscBool*); 3764416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsRealArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscReal[],PetscInt*,PetscBool*); 3774416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsScalarArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscScalar[],PetscInt*,PetscBool*); 3784416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsIntArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscInt[],PetscInt*,PetscBool*); 3794416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsStringArray_Private(PetscOptionItems*,const char[],const char[],const char[],char*[],PetscInt*,PetscBool*); 3804416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolArray_Private(PetscOptionItems*,const char[],const char[],const char[],PetscBool [],PetscInt*,PetscBool*); 3814416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnumArray_Private(PetscOptionItems*,const char[],const char[],const char[],const char *const*,PetscEnum[],PetscInt*,PetscBool*); 3829f3a6782SPatrick Sanan PETSC_EXTERN PetscErrorCode PetscOptionsDeprecated_Private(PetscOptionItems*,const char[],const char[],const char[],const char[]); 383cffb1e40SBarry Smith 384e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSAWsDestroy(void); 385f8d0b74dSMatthew Knepley 386447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectAddOptionsHandler(PetscObject,PetscErrorCode (*)(PetscOptionItems*,PetscObject,void*),PetscErrorCode (*)(PetscObject,void*),void*); 387447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectProcessOptionsHandlers(PetscOptionItems*,PetscObject); 388447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectDestroyOptionsHandlers(PetscObject); 389447ac60bSBarry Smith 3903a3b2205SBarry Smith #endif 391