1f26ada1bSBarry Smith /* 237f753daSBarry Smith Routines to determine options set in the options database. 3f26ada1bSBarry Smith */ 4a4963045SJacob Faibussowitsch #pragma once 5ac09b921SBarry Smith 62c8e378dSBarry Smith #include <petscsys.h> 7c619b03eSJed Brown #include <petscviewertypes.h> 83a3b2205SBarry Smith 9ac09b921SBarry Smith /* SUBMANSEC = Sys */ 10ac09b921SBarry Smith 119355ec05SMatthew G. Knepley typedef enum { 129355ec05SMatthew G. Knepley PETSC_OPT_CODE, 139355ec05SMatthew G. Knepley PETSC_OPT_COMMAND_LINE, 149355ec05SMatthew G. Knepley PETSC_OPT_FILE, 159355ec05SMatthew G. Knepley PETSC_OPT_ENVIRONMENT, 169355ec05SMatthew G. Knepley NUM_PETSC_OPT_SOURCE 179355ec05SMatthew G. Knepley } PetscOptionSource; 189355ec05SMatthew G. Knepley 19c5c1f447SLisandro Dalcin #define PETSC_MAX_OPTION_NAME 512 20c5929fdfSBarry Smith typedef struct _n_PetscOptions *PetscOptions; 21c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsCreate(PetscOptions *); 22b4205f0bSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPush(PetscOptions); 23b4205f0bSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPop(void); 24c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsDestroy(PetscOptions *); 252d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsCreateDefault(void); 262d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsDestroyDefault(void); 27c5929fdfSBarry Smith 282d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsHasHelp(PetscOptions, PetscBool *); 29c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsHasName(PetscOptions, const char[], const char[], PetscBool *); 30c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetBool(PetscOptions, const char[], const char[], PetscBool *, PetscBool *); 312d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetInt(PetscOptions, const char[], const char[], PetscInt *, PetscBool *); 322d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEnum(PetscOptions, const char[], const char[], const char *const *, PetscEnum *, PetscBool *); 332d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEList(PetscOptions, const char[], const char[], const char *const *, PetscInt, PetscInt *, PetscBool *); 34c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetReal(PetscOptions, const char[], const char[], PetscReal *, PetscBool *); 35c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetScalar(PetscOptions, const char[], const char[], PetscScalar *, PetscBool *); 362d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetString(PetscOptions, const char[], const char[], char[], size_t, PetscBool *); 372d747510SLisandro Dalcin 382d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetBoolArray(PetscOptions, const char[], const char[], PetscBool[], PetscInt *, PetscBool *); 392d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetEnumArray(PetscOptions, const char[], const char[], const char *const *, PetscEnum *, PetscInt *, PetscBool *); 40c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetIntArray(PetscOptions, const char[], const char[], PetscInt[], PetscInt *, PetscBool *); 41c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetRealArray(PetscOptions, const char[], const char[], PetscReal[], PetscInt *, PetscBool *); 42c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetScalarArray(PetscOptions, const char[], const char[], PetscScalar[], PetscInt *, PetscBool *); 43c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetStringArray(PetscOptions, const char[], const char[], char *[], PetscInt *, PetscBool *); 443a3b2205SBarry Smith 452d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsValidKey(const char[], PetscBool *); 46c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSetAlias(PetscOptions, const char[], const char[]); 47c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSetValue(PetscOptions, const char[], const char[]); 48c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsClearValue(PetscOptions, const char[]); 492d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsFindPair(PetscOptions, const char[], const char[], const char *[], PetscBool *); 503a3b2205SBarry Smith 512d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsGetAll(PetscOptions, char *[]); 52c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsAllUsed(PetscOptions, PetscInt *); 532d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsUsed(PetscOptions, const char[], PetscBool *); 54c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsLeft(PetscOptions); 551ab23d95SFande Kong PETSC_EXTERN PetscErrorCode PetscOptionsLeftGet(PetscOptions, PetscInt *, char ***, char ***); 565b191818SFande Kong PETSC_EXTERN PetscErrorCode PetscOptionsLeftRestore(PetscOptions, PetscInt *, char ***, char ***); 57c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsView(PetscOptions, PetscViewer); 584b0e389bSBarry Smith 592d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsReject(PetscOptions, const char[], const char[], const char[]); 60c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsert(PetscOptions, int *, char ***, const char[]); 61c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsertFile(MPI_Comm, PetscOptions, const char[], PetscBool); 625c23ca1cSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsInsertFileYAML(MPI_Comm, PetscOptions, const char[], PetscBool); 63c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInsertString(PetscOptions, const char[]); 64080f0011SToby Isaac PETSC_EXTERN PetscErrorCode PetscOptionsInsertStringYAML(PetscOptions, const char[]); 65d06005cbSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsInsertArgs(PetscOptions, int, char **); 66c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsClear(PetscOptions); 67c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPush(PetscOptions, const char[]); 68c5929fdfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPrefixPop(PetscOptions); 695d0dffe5SBarry Smith 70014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsGetenv(MPI_Comm, const char[], char[], size_t, PetscBool *); 712d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsStringToBool(const char[], PetscBool *); 72014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsStringToInt(const char[], PetscInt *); 73014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscOptionsStringToReal(const char[], PetscReal *); 742d747510SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscOptionsStringToScalar(const char[], PetscScalar *); 752e8a6d31SBarry Smith 769355ec05SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscOptionsMonitorSet(PetscErrorCode (*)(const char[], const char[], PetscOptionSource, void *), void *, PetscErrorCode (*)(void **)); 779355ec05SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscOptionsMonitorDefault(const char[], const char[], PetscOptionSource, void *); 78081c24baSBoyana Norris 7984761bfeSJed Brown PETSC_EXTERN PetscErrorCode PetscObjectSetOptions(PetscObject, PetscOptions); 8084761bfeSJed Brown PETSC_EXTERN PetscErrorCode PetscObjectGetOptions(PetscObject, PetscOptions *); 8184761bfeSJed Brown 82014dd563SJed Brown PETSC_EXTERN PetscBool PetscOptionsPublish; 83e55864a3SBarry Smith 84e55864a3SBarry Smith /* 85e55864a3SBarry Smith See manual page for PetscOptionsBegin() 864416b707SBarry Smith 874416b707SBarry Smith PetscOptionsItem and PetscOptionsItems are a single option (such as ksp_type) and a collection of such single 884416b707SBarry Smith options being handled with a PetscOptionsBegin/End() 894416b707SBarry Smith 90e55864a3SBarry Smith */ 919371c9d4SSatish Balay typedef enum { 929371c9d4SSatish Balay OPTION_INT, 939371c9d4SSatish Balay OPTION_BOOL, 949371c9d4SSatish Balay OPTION_REAL, 959371c9d4SSatish Balay OPTION_FLIST, 969371c9d4SSatish Balay OPTION_STRING, 979371c9d4SSatish Balay OPTION_REAL_ARRAY, 989371c9d4SSatish Balay OPTION_SCALAR_ARRAY, 999371c9d4SSatish Balay OPTION_HEAD, 1009371c9d4SSatish Balay OPTION_INT_ARRAY, 1019371c9d4SSatish Balay OPTION_ELIST, 1029371c9d4SSatish Balay OPTION_BOOL_ARRAY, 1039371c9d4SSatish Balay OPTION_STRING_ARRAY 1049371c9d4SSatish Balay } PetscOptionType; 1059355ec05SMatthew G. Knepley 1064416b707SBarry Smith typedef struct _n_PetscOptionItem *PetscOptionItem; 1074416b707SBarry Smith struct _n_PetscOptionItem { 108e55864a3SBarry Smith char *option; 109e55864a3SBarry Smith char *text; 110e55864a3SBarry Smith void *data; /* used to hold the default value and then any value it is changed to by GUI */ 111e55864a3SBarry Smith PetscFunctionList flist; /* used for available values for PetscOptionsList() */ 112e55864a3SBarry Smith const char *const *list; /* used for available values for PetscOptionsEList() */ 113e55864a3SBarry Smith char nlist; /* number of entries in list */ 114e55864a3SBarry Smith char *man; 115e55864a3SBarry Smith size_t arraylength; /* number of entries in data in the case that it is an array (of PetscInt etc) */ 116e55864a3SBarry Smith PetscBool set; /* the user has changed this value in the GUI */ 117e55864a3SBarry Smith PetscOptionType type; 1184416b707SBarry Smith PetscOptionItem next; 119e55864a3SBarry Smith char *pman; 120e55864a3SBarry Smith void *edata; 121e55864a3SBarry Smith }; 122e55864a3SBarry Smith 1234416b707SBarry Smith typedef struct _p_PetscOptionItems { 124e55864a3SBarry Smith PetscInt count; 1254416b707SBarry Smith PetscOptionItem next; 126e55864a3SBarry Smith char *prefix, *pprefix; 127e55864a3SBarry Smith char *title; 128e55864a3SBarry Smith MPI_Comm comm; 129e55864a3SBarry Smith PetscBool printhelp, changedmethod, alreadyprinted; 130e55864a3SBarry Smith PetscObject object; 131c5929fdfSBarry Smith PetscOptions options; 1324416b707SBarry Smith } PetscOptionItems; 13330de9b25SBarry Smith 1345f80ce2aSJacob Faibussowitsch #if defined(PETSC_CLANG_STATIC_ANALYZER) 13594bad497SJacob Faibussowitsch extern PetscOptionItems *PetscOptionsObject; /* declare this so that the PetscOptions stubs work */ 1365f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsBegin(MPI_Comm, const char *, const char *, const char *); 1375f80ce2aSJacob Faibussowitsch PetscErrorCode PetscObjectOptionsBegin(PetscObject); 1385f80ce2aSJacob Faibussowitsch PetscErrorCode PetscOptionsEnd(void); 1395f80ce2aSJacob Faibussowitsch #else 14030de9b25SBarry Smith /*MC 14130de9b25SBarry Smith PetscOptionsBegin - Begins a set of queries on the options database that are related and should be 1421957e957SBarry Smith displayed on the same window of a GUI that allows the user to set the options interactively. Often one should 14316a05f60SBarry Smith use `PetscObjectOptionsBegin()` rather than this call. 14430de9b25SBarry Smith 145f2ba6396SBarry Smith Synopsis: 146aaa7dc30SBarry Smith #include <petscoptions.h> 147f2ba6396SBarry Smith PetscErrorCode PetscOptionsBegin(MPI_Comm comm,const char prefix[],const char title[],const char mansec[]) 14830de9b25SBarry Smith 149fb455bf4SPatrick Sanan Collective 15030de9b25SBarry Smith 15130de9b25SBarry Smith Input Parameters: 15230de9b25SBarry Smith + comm - communicator that shares GUI 15376280437SVaclav Hapla . prefix - options prefix for all options displayed on window (optional) 15430de9b25SBarry Smith . title - short descriptive text, for example "Krylov Solver Options" 15587497f52SBarry Smith - mansec - section of manual pages for options, for example `KSP` (optional) 15630de9b25SBarry Smith 15730de9b25SBarry Smith Level: intermediate 15830de9b25SBarry Smith 15995452b02SPatrick Sanan Notes: 160d0609cedSBarry Smith This is a macro that handles its own error checking, it does not return an error code. 161d0609cedSBarry Smith 16287497f52SBarry Smith The set of queries needs to be ended by a call to `PetscOptionsEnd()`. 163fb455bf4SPatrick Sanan 16487497f52SBarry Smith One can add subheadings with `PetscOptionsHeadBegin()`. 16530de9b25SBarry Smith 16695452b02SPatrick Sanan Developer Notes: 16716a05f60SBarry Smith `PetscOptionsPublish` is set in `PetscOptionsCheckInitial_Private()` with `-saws_options`. When `PetscOptionsPublish` is set the 16816a05f60SBarry Smith loop between `PetscOptionsBegin()` and `PetscOptionsEnd()` is run THREE times with `PetscOptionsPublishCount` of values -1,0,1. 16916a05f60SBarry Smith Otherwise the loop is run ONCE with a `PetscOptionsPublishCount` of 1. 17016a05f60SBarry Smith + \-1 - `PetscOptionsInt()` etc. just call `PetscOptionsGetInt()` etc. 17116a05f60SBarry Smith . 0 - The GUI objects are created in `PetscOptionsInt()` etc. and displayed in `PetscOptionsEnd()` and the options 17216a05f60SBarry Smith database updated with user changes; `PetscOptionsGetInt()` etc. are also called. 17316a05f60SBarry Smith - 1 - `PetscOptionsInt()` etc. again call `PetscOptionsGetInt()` etc. (possibly getting new values), in addition the help message and 174fb455bf4SPatrick Sanan default values are printed if -help was given. 17516a05f60SBarry Smith When `PetscOptionsObject.changedmethod` is set this causes `PetscOptionsPublishCount` to be reset to -2 (so in the next loop iteration it is -1) 17616a05f60SBarry Smith and the whole process is repeated. This is to handle when, for example, the `KSPType` is changed thus changing the list of 17716a05f60SBarry Smith options available so they need to be redisplayed so the user can change the. Changing `PetscOptionsObjects.changedmethod` is never 178fb455bf4SPatrick Sanan currently set. 179aee2cecaSBarry Smith 1804bb2516aSBarry Smith Fortran Note: 1814bb2516aSBarry Smith Returns ierr error code per PETSc Fortran API 1824bb2516aSBarry Smith 183db781477SPatrick Sanan .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 184db781477SPatrick Sanan `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` 185db781477SPatrick Sanan `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 186db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 187c2e3fba1SPatrick Sanan `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 188db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 189db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscObjectOptionsBegin()` 19030de9b25SBarry Smith M*/ 1919371c9d4SSatish Balay #define PetscOptionsBegin(comm, prefix, mess, sec) \ 1929371c9d4SSatish Balay do { \ 1934416b707SBarry Smith PetscOptionItems PetscOptionsObjectBase; \ 1944416b707SBarry Smith PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \ 195d0609cedSBarry Smith PetscCall(PetscMemzero(PetscOptionsObject, sizeof(*PetscOptionsObject))); \ 196e55864a3SBarry Smith for (PetscOptionsObject->count = (PetscOptionsPublish ? -1 : 1); PetscOptionsObject->count < 2; PetscOptionsObject->count++) { \ 1979566063dSJacob Faibussowitsch PetscCall(PetscOptionsBegin_Private(PetscOptionsObject, comm, prefix, mess, sec)) 19830de9b25SBarry Smith 1995fefd1ebSJed Brown /*MC 2005fefd1ebSJed Brown PetscObjectOptionsBegin - Begins a set of queries on the options database that are related and should be 2015fefd1ebSJed Brown displayed on the same window of a GUI that allows the user to set the options interactively. 2025fefd1ebSJed Brown 203f2ba6396SBarry Smith Synopsis: 204aaa7dc30SBarry Smith #include <petscoptions.h> 205f2ba6396SBarry Smith PetscErrorCode PetscObjectOptionsBegin(PetscObject obj) 2065fefd1ebSJed Brown 207c3339decSBarry Smith Collective 2085fefd1ebSJed Brown 2092fe279fdSBarry Smith Input Parameter: 2105fefd1ebSJed Brown . obj - object to set options for 2115fefd1ebSJed Brown 2125fefd1ebSJed Brown Level: intermediate 2135fefd1ebSJed Brown 21495452b02SPatrick Sanan Notes: 215d0609cedSBarry Smith This is a macro that handles its own error checking, it does not return an error code. 216d0609cedSBarry Smith 21787497f52SBarry Smith Needs to be ended by a call the `PetscOptionsEnd()` 218d0609cedSBarry Smith 21987497f52SBarry Smith Can add subheadings with `PetscOptionsHeadBegin()` 2205fefd1ebSJed Brown 221db781477SPatrick Sanan .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 222db781477SPatrick Sanan `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` 223db781477SPatrick Sanan `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 224db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 225c2e3fba1SPatrick Sanan `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 226db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 227db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()` 2285fefd1ebSJed Brown M*/ 2299371c9d4SSatish Balay #define PetscObjectOptionsBegin(obj) \ 2309371c9d4SSatish Balay do { \ 2314416b707SBarry Smith PetscOptionItems PetscOptionsObjectBase; \ 2324416b707SBarry Smith PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; \ 233c5929fdfSBarry Smith PetscOptionsObject->options = ((PetscObject)obj)->options; \ 234e55864a3SBarry Smith for (PetscOptionsObject->count = (PetscOptionsPublish ? -1 : 1); PetscOptionsObject->count < 2; PetscOptionsObject->count++) { \ 235dbbe0bcdSBarry Smith PetscCall(PetscObjectOptionsBegin_Private(obj, PetscOptionsObject)) 2363194b578SJed Brown 23730de9b25SBarry Smith /*MC 23830de9b25SBarry Smith PetscOptionsEnd - Ends a set of queries on the options database that are related and should be 23930de9b25SBarry Smith displayed on the same window of a GUI that allows the user to set the options interactively. 24030de9b25SBarry Smith 241f2ba6396SBarry Smith Synopsis: 242aaa7dc30SBarry Smith #include <petscoptions.h> 243f2ba6396SBarry Smith PetscErrorCode PetscOptionsEnd(void) 24430de9b25SBarry Smith 2457cdbe19fSJose E. Roman Collective on the comm used in `PetscOptionsBegin()` or obj used in `PetscObjectOptionsBegin()` 2467cdbe19fSJose E. Roman 24730de9b25SBarry Smith Level: intermediate 24830de9b25SBarry Smith 24995452b02SPatrick Sanan Notes: 25087497f52SBarry Smith Needs to be preceded by a call to `PetscOptionsBegin()` or `PetscObjectOptionsBegin()` 25130de9b25SBarry Smith 252d0609cedSBarry Smith This is a macro that handles its own error checking, it does not return an error code. 253d0609cedSBarry Smith 2544bb2516aSBarry Smith Fortran Note: 2554bb2516aSBarry Smith Returns ierr error code per PETSc Fortran API 2564bb2516aSBarry Smith 257db781477SPatrick Sanan .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 258db781477SPatrick Sanan `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()` 259db781477SPatrick Sanan `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 260db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsHeadBegin()`, 261c2e3fba1SPatrick Sanan `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 262db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 263db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscObjectOptionsBegin()` 26430de9b25SBarry Smith M*/ 2659371c9d4SSatish Balay #define PetscOptionsEnd() \ 2669371c9d4SSatish Balay PetscCall(PetscOptionsEnd_Private(PetscOptionsObject)); \ 2679371c9d4SSatish Balay } \ 2689371c9d4SSatish Balay } \ 2699371c9d4SSatish Balay while (0) 2705f80ce2aSJacob Faibussowitsch #endif /* PETSC_CLANG_STATIC_ANALYZER */ 27130de9b25SBarry Smith 2724416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBegin_Private(PetscOptionItems *, MPI_Comm, const char[], const char[], const char[]); 273dbbe0bcdSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectOptionsBegin_Private(PetscObject, PetscOptionItems *); 2744416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnd_Private(PetscOptionItems *); 275d0609cedSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsHeadBegin(PetscOptionItems *, const char[]); 27630de9b25SBarry Smith 2775f80ce2aSJacob Faibussowitsch #if defined(PETSC_CLANG_STATIC_ANALYZER) 2789371c9d4SSatish Balay template <typename... T> 2799371c9d4SSatish Balay void PetscOptionsHeadBegin(T...); 280d0609cedSBarry Smith void PetscOptionsHeadEnd(void); 2819371c9d4SSatish Balay template <typename... T> 2829371c9d4SSatish Balay PetscErrorCode PetscOptionsEnum(T...); 2839371c9d4SSatish Balay template <typename... T> 2849371c9d4SSatish Balay PetscErrorCode PetscOptionsInt(T...); 2859371c9d4SSatish Balay template <typename... T> 2869371c9d4SSatish Balay PetscErrorCode PetscOptionsBoundedInt(T...); 2879371c9d4SSatish Balay template <typename... T> 2889371c9d4SSatish Balay PetscErrorCode PetscOptionsRangeInt(T...); 2899371c9d4SSatish Balay template <typename... T> 2909371c9d4SSatish Balay PetscErrorCode PetscOptionsReal(T...); 2919371c9d4SSatish Balay template <typename... T> 2929371c9d4SSatish Balay PetscErrorCode PetscOptionsScalar(T...); 2939371c9d4SSatish Balay template <typename... T> 2949371c9d4SSatish Balay PetscErrorCode PetscOptionsName(T...); 2959371c9d4SSatish Balay template <typename... T> 2969371c9d4SSatish Balay PetscErrorCode PetscOptionsString(T...); 2979371c9d4SSatish Balay template <typename... T> 2989371c9d4SSatish Balay PetscErrorCode PetscOptionsBool(T...); 2999371c9d4SSatish Balay template <typename... T> 3009371c9d4SSatish Balay PetscErrorCode PetscOptionsBoolGroupBegin(T...); 3019371c9d4SSatish Balay template <typename... T> 3029371c9d4SSatish Balay PetscErrorCode PetscOptionsBoolGroup(T...); 3039371c9d4SSatish Balay template <typename... T> 3049371c9d4SSatish Balay PetscErrorCode PetscOptionsBoolGroupEnd(T...); 3059371c9d4SSatish Balay template <typename... T> 3069371c9d4SSatish Balay PetscErrorCode PetscOptionsFList(T...); 3079371c9d4SSatish Balay template <typename... T> 3089371c9d4SSatish Balay PetscErrorCode PetscOptionsEList(T...); 3099371c9d4SSatish Balay template <typename... T> 3109371c9d4SSatish Balay PetscErrorCode PetscOptionsRealArray(T...); 3119371c9d4SSatish Balay template <typename... T> 3129371c9d4SSatish Balay PetscErrorCode PetscOptionsScalarArray(T...); 3139371c9d4SSatish Balay template <typename... T> 3149371c9d4SSatish Balay PetscErrorCode PetscOptionsIntArray(T...); 3159371c9d4SSatish Balay template <typename... T> 3169371c9d4SSatish Balay PetscErrorCode PetscOptionsStringArray(T...); 3179371c9d4SSatish Balay template <typename... T> 3189371c9d4SSatish Balay PetscErrorCode PetscOptionsBoolArray(T...); 3199371c9d4SSatish Balay template <typename... T> 3209371c9d4SSatish Balay PetscErrorCode PetscOptionsEnumArray(T...); 3219371c9d4SSatish Balay template <typename... T> 3229371c9d4SSatish Balay PetscErrorCode PetscOptionsDeprecated(T...); 3239371c9d4SSatish Balay template <typename... T> 3249371c9d4SSatish Balay PetscErrorCode PetscOptionsDeprecatedNoObject(T...); 3255f80ce2aSJacob Faibussowitsch #else 32630de9b25SBarry Smith /*MC 327d0609cedSBarry Smith PetscOptionsHeadBegin - Puts a heading before listing any more published options. Used, for example, 32816a05f60SBarry Smith in `KSPSetFromOptions_GMRES()`. 329d0609cedSBarry Smith 33016a05f60SBarry Smith Logically Collective on the communicator passed in `PetscOptionsBegin()` 331d0609cedSBarry Smith 332d0609cedSBarry Smith Input Parameter: 333d0609cedSBarry Smith . head - the heading text 334d0609cedSBarry Smith 33587497f52SBarry Smith Level: developer 336d0609cedSBarry Smith 337d0609cedSBarry Smith Notes: 338d0609cedSBarry Smith Handles errors directly, hence does not return an error code 339d0609cedSBarry Smith 34016a05f60SBarry Smith Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()`, and `PetscOptionsObject` created in `PetscOptionsBegin()` should be the first argument 341d0609cedSBarry Smith 34287497f52SBarry Smith Must be followed by a call to `PetscOptionsHeadEnd()` in the same function. 343d0609cedSBarry Smith 344db781477SPatrick Sanan .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 345db781477SPatrick Sanan `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 346db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 347c2e3fba1SPatrick Sanan `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 348db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 349db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()` 350d0609cedSBarry Smith @*/ 3519371c9d4SSatish Balay #define PetscOptionsHeadBegin(PetscOptionsObject, head) \ 3529371c9d4SSatish Balay do { \ 35348a46eb9SPierre Jolivet if (PetscOptionsObject->printhelp && PetscOptionsObject->count == 1 && !PetscOptionsObject->alreadyprinted) PetscCall((*PetscHelpPrintf)(PetscOptionsObject->comm, " %s\n", head)); \ 354d0609cedSBarry Smith } while (0) 355d0609cedSBarry Smith 356edd03b47SJacob Faibussowitsch #define PetscOptionsHead(...) PETSC_DEPRECATED_MACRO(3, 18, 0, "PetscOptionsHeadBegin()", ) PetscOptionsHeadBegin(__VA_ARGS__) 357d0609cedSBarry Smith 358d0609cedSBarry Smith /*MC 35987497f52SBarry Smith PetscOptionsHeadEnd - Ends a section of options begun with `PetscOptionsHeadBegin()` 36016a05f60SBarry Smith See, for example, `KSPSetFromOptions_GMRES()`. 36130de9b25SBarry Smith 362f2ba6396SBarry Smith Synopsis: 363aaa7dc30SBarry Smith #include <petscoptions.h> 364d0609cedSBarry Smith PetscErrorCode PetscOptionsHeadEnd(void) 36530de9b25SBarry Smith 3667cdbe19fSJose E. Roman Collective on the comm used in `PetscOptionsBegin()` or obj used in `PetscObjectOptionsBegin()` 3677cdbe19fSJose E. Roman 36830de9b25SBarry Smith Level: intermediate 36930de9b25SBarry Smith 37095452b02SPatrick Sanan Notes: 37187497f52SBarry Smith Must be between a `PetscOptionsBegin()` or `PetscObjectOptionsBegin()` and a `PetscOptionsEnd()` 37230de9b25SBarry Smith 37387497f52SBarry Smith Must be preceded by a call to `PetscOptionsHeadBegin()` in the same function. 37430de9b25SBarry Smith 37587497f52SBarry Smith This needs to be used only if the code below `PetscOptionsHeadEnd()` can be run ONLY once. 37616a05f60SBarry Smith See, for example, `PCSetFromOptions_Composite()`. This is a `return(0)` in it for early exit 377b52f573bSBarry Smith from the function. 378b52f573bSBarry Smith 37956752e42SBarry Smith This is only for use with the PETSc options GUI 380b52f573bSBarry Smith 381db781477SPatrick Sanan .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 382db781477SPatrick Sanan `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 383db781477SPatrick Sanan `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 384c2e3fba1SPatrick Sanan `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 385db781477SPatrick Sanan `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 386db781477SPatrick Sanan `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsEnum()` 38730de9b25SBarry Smith M*/ 3889371c9d4SSatish Balay #define PetscOptionsHeadEnd() \ 3899371c9d4SSatish Balay do { \ 3903ba16761SJacob Faibussowitsch if (PetscOptionsObject->count != 1) PetscFunctionReturn(PETSC_SUCCESS); \ 3919371c9d4SSatish Balay } while (0) 392d0609cedSBarry Smith 393edd03b47SJacob Faibussowitsch #define PetscOptionsTail(...) PETSC_DEPRECATED_MACRO(3, 18, 0, "PetscOptionsHeadEnd()", ) PetscOptionsHeadEnd(__VA_ARGS__) 394186905e3SBarry Smith 395*5305534fSZach Atkins /*MC 396*5305534fSZach Atkins PetscOptionsEnum - Gets the enum value for a particular option in the database. 397*5305534fSZach Atkins 398*5305534fSZach Atkins Synopsis: 399*5305534fSZach Atkins #include <petscoptions.h> 400*5305534fSZach Atkins PetscErrorCode PetscOptionsEnum(const char opt[], const char text[], const char man[], const char *const *list, PetscEnum currentvalue, PetscEnum *value, PetscBool *set) 401*5305534fSZach Atkins 402*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 403*5305534fSZach Atkins 404*5305534fSZach Atkins Input Parameters: 405*5305534fSZach Atkins + opt - option name 406*5305534fSZach Atkins . text - short string that describes the option 407*5305534fSZach Atkins . man - manual page with additional information on option 408*5305534fSZach Atkins . list - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null 409*5305534fSZach Atkins - currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either 410*5305534fSZach Atkins .vb 411*5305534fSZach Atkins PetscOptionsEnum(..., obj->value,&object->value,...) or 412*5305534fSZach Atkins value = defaultvalue 413*5305534fSZach Atkins PetscOptionsEnum(..., value,&value,&flg); 414*5305534fSZach Atkins if (flg) { 415*5305534fSZach Atkins .ve 416*5305534fSZach Atkins 417*5305534fSZach Atkins Output Parameters: 418*5305534fSZach Atkins + value - the value to return 419*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 420*5305534fSZach Atkins 421*5305534fSZach Atkins Level: beginner 422*5305534fSZach Atkins 423*5305534fSZach Atkins Notes: 424*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 425*5305534fSZach Atkins 426*5305534fSZach Atkins list is usually something like `PCASMTypes` or some other predefined list of enum names 427*5305534fSZach Atkins 428*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 429*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `set` is `PETSC_TRUE`. 430*5305534fSZach Atkins 431*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 432*5305534fSZach Atkins 433*5305534fSZach Atkins .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 434*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 435*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 436*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 437*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 438*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 439*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 440*5305534fSZach Atkins M*/ 4411ff8fb82SZach Atkins #define PetscOptionsEnum(opt, text, man, list, currentvalue, value, set) PetscOptionsEnum_Private(PetscOptionsObject, opt, text, man, list, currentvalue, value, set) 442*5305534fSZach Atkins 443*5305534fSZach Atkins /*MC 444*5305534fSZach Atkins PetscOptionsInt - Gets the integer value for a particular option in the database. 445*5305534fSZach Atkins 446*5305534fSZach Atkins Synopsis: 447*5305534fSZach Atkins #include <petscoptions.h> 448*5305534fSZach Atkins PetscErrorCode PetscOptionsInt(const char opt[], const char text[], const char man[], PetscInt currentvalue, PetscInt *value, PetscBool *set) 449*5305534fSZach Atkins 450*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 451*5305534fSZach Atkins 452*5305534fSZach Atkins Input Parameters: 453*5305534fSZach Atkins + opt - option name 454*5305534fSZach Atkins . text - short string that describes the option 455*5305534fSZach Atkins . man - manual page with additional information on option 456*5305534fSZach Atkins - currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either 457*5305534fSZach Atkins .vb 458*5305534fSZach Atkins PetscOptionsInt(..., obj->value,&obj->value,...) or 459*5305534fSZach Atkins value = defaultvalue 460*5305534fSZach Atkins PetscOptionsInt(..., value,&value,&flg); 461*5305534fSZach Atkins if (flg) { 462*5305534fSZach Atkins .ve 463*5305534fSZach Atkins 464*5305534fSZach Atkins Output Parameters: 465*5305534fSZach Atkins + value - the integer value to return 466*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 467*5305534fSZach Atkins 468*5305534fSZach Atkins Level: beginner 469*5305534fSZach Atkins 470*5305534fSZach Atkins Notes: 471*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 472*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`. 473*5305534fSZach Atkins 474*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 475*5305534fSZach Atkins 476*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 477*5305534fSZach Atkins 478*5305534fSZach Atkins .seealso: `PetscOptionsBoundedInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 479*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, `PetscOptionsRangeInt()` 480*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 481*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 482*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 483*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 484*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 485*5305534fSZach Atkins M*/ 4861ff8fb82SZach Atkins #define PetscOptionsInt(opt, text, man, currentvalue, value, set) PetscOptionsInt_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set, PETSC_MIN_INT, PETSC_MAX_INT) 487*5305534fSZach Atkins 488*5305534fSZach Atkins /*MC 489*5305534fSZach Atkins PetscOptionsBoundedInt - Gets an integer value greater than or equal a given bound for a particular option in the database. 490*5305534fSZach Atkins 491*5305534fSZach Atkins Synopsis: 492*5305534fSZach Atkins #include <petscoptions.h> 493*5305534fSZach Atkins PetscErrorCode PetscOptionsBoundedInt(const char opt[], const char text[], const char man[], PetscInt currentvalue, PetscInt *value, PetscBool *flg, PetscInt bound) 494*5305534fSZach Atkins 495*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 496*5305534fSZach Atkins 497*5305534fSZach Atkins Input Parameters: 498*5305534fSZach Atkins + opt - option name 499*5305534fSZach Atkins . text - short string that describes the option 500*5305534fSZach Atkins . man - manual page with additional information on option 501*5305534fSZach Atkins . currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either 502*5305534fSZach Atkins .vb 503*5305534fSZach Atkins PetscOptionsInt(..., obj->value,&obj->value,...) 504*5305534fSZach Atkins .ve 505*5305534fSZach Atkins or 506*5305534fSZach Atkins .vb 507*5305534fSZach Atkins value = defaultvalue 508*5305534fSZach Atkins PetscOptionsInt(..., value,&value,&flg); 509*5305534fSZach Atkins if (flg) { 510*5305534fSZach Atkins .ve 511*5305534fSZach Atkins - bound - the requested value should be greater than or equal this bound or an error is generated 512*5305534fSZach Atkins 513*5305534fSZach Atkins Output Parameters: 514*5305534fSZach Atkins + value - the integer value to return 515*5305534fSZach Atkins - flg - `PETSC_TRUE` if found, else `PETSC_FALSE` 516*5305534fSZach Atkins 517*5305534fSZach Atkins Level: beginner 518*5305534fSZach Atkins 519*5305534fSZach Atkins Notes: 520*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 521*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`. 522*5305534fSZach Atkins 523*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 524*5305534fSZach Atkins 525*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 526*5305534fSZach Atkins 527*5305534fSZach Atkins .seealso: `PetscOptionsInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 528*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, `PetscOptionsRangeInt()` 529*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 530*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 531*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 532*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 533*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 534*5305534fSZach Atkins M*/ 5351ff8fb82SZach Atkins #define PetscOptionsBoundedInt(opt, text, man, currentvalue, value, set, lb) PetscOptionsInt_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set, lb, PETSC_MAX_INT) 536*5305534fSZach Atkins 537*5305534fSZach Atkins /*MC 538*5305534fSZach Atkins PetscOptionsRangeInt - Gets an integer value within a range of values for a particular option in the database. 539*5305534fSZach Atkins 540*5305534fSZach Atkins Synopsis: 541*5305534fSZach Atkins #include <petscoptions.h> 542*5305534fSZach Atkins PetscErrorCode PetscOptionsRangeInt(const char opt[], const char text[], const char man[], PetscInt currentvalue, PetscInt *value, PetscBool *flg, PetscInt lb, PetscInt ub) 543*5305534fSZach Atkins 544*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 545*5305534fSZach Atkins 546*5305534fSZach Atkins Input Parameters: 547*5305534fSZach Atkins + opt - option name 548*5305534fSZach Atkins . text - short string that describes the option 549*5305534fSZach Atkins . man - manual page with additional information on option 550*5305534fSZach Atkins . currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either 551*5305534fSZach Atkins .vb 552*5305534fSZach Atkins PetscOptionsInt(..., obj->value,&obj->value,...) or 553*5305534fSZach Atkins value = defaultvalue 554*5305534fSZach Atkins PetscOptionsInt(..., value,&value,&flg); 555*5305534fSZach Atkins if (flg) { 556*5305534fSZach Atkins .ve 557*5305534fSZach Atkins . lb - the lower bound, provided value must be greater than or equal to this value or an error is generated 558*5305534fSZach Atkins - ub - the upper bound, provided value must be less than or equal to this value or an error is generated 559*5305534fSZach Atkins 560*5305534fSZach Atkins Output Parameters: 561*5305534fSZach Atkins + value - the integer value to return 562*5305534fSZach Atkins - flg - `PETSC_TRUE` if found, else `PETSC_FALSE` 563*5305534fSZach Atkins 564*5305534fSZach Atkins Level: beginner 565*5305534fSZach Atkins 566*5305534fSZach Atkins Notes: 567*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 568*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`. 569*5305534fSZach Atkins 570*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 571*5305534fSZach Atkins 572*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 573*5305534fSZach Atkins 574*5305534fSZach Atkins .seealso: `PetscOptionsInt()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 575*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, `PetscOptionsBoundedInt()` 576*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 577*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 578*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 579*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 580*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 581*5305534fSZach Atkins M*/ 5821ff8fb82SZach Atkins #define PetscOptionsRangeInt(opt, text, man, currentvalue, value, set, lb, ub) PetscOptionsInt_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set, lb, ub) 583*5305534fSZach Atkins 584*5305534fSZach Atkins /*MC 585*5305534fSZach Atkins PetscOptionsReal - Gets the `PetscReal` value for a particular option in the database. 586*5305534fSZach Atkins 587*5305534fSZach Atkins Synopsis: 588*5305534fSZach Atkins #include <petscoptions.h> 589*5305534fSZach Atkins PetscErrorCode PetscOptionsReal(const char opt[], const char text[], const char man[], PetscReal currentvalue, PetscReal *value, PetscBool *set) 590*5305534fSZach Atkins 591*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 592*5305534fSZach Atkins 593*5305534fSZach Atkins Input Parameters: 594*5305534fSZach Atkins + opt - option name 595*5305534fSZach Atkins . text - short string that describes the option 596*5305534fSZach Atkins . man - manual page with additional information on option 597*5305534fSZach Atkins - currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either 598*5305534fSZach Atkins .vb 599*5305534fSZach Atkins PetscOptionsReal(..., obj->value,&obj->value,...) or 600*5305534fSZach Atkins value = defaultvalue 601*5305534fSZach Atkins PetscOptionsReal(..., value,&value,&flg); 602*5305534fSZach Atkins if (flg) { 603*5305534fSZach Atkins .ve 604*5305534fSZach Atkins 605*5305534fSZach Atkins Output Parameters: 606*5305534fSZach Atkins + value - the value to return 607*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 608*5305534fSZach Atkins 609*5305534fSZach Atkins Level: beginner 610*5305534fSZach Atkins 611*5305534fSZach Atkins Notes: 612*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 613*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`. 614*5305534fSZach Atkins 615*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 616*5305534fSZach Atkins 617*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 618*5305534fSZach Atkins 619*5305534fSZach Atkins .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 620*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 621*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 622*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 623*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 624*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 625*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 626*5305534fSZach Atkins M*/ 6271ff8fb82SZach Atkins #define PetscOptionsReal(opt, text, man, currentvalue, value, set) PetscOptionsReal_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 628*5305534fSZach Atkins 629*5305534fSZach Atkins /*MC 630*5305534fSZach Atkins PetscOptionsScalar - Gets the `PetscScalar` value for a particular option in the database. 631*5305534fSZach Atkins 632*5305534fSZach Atkins Synopsis: 633*5305534fSZach Atkins #include <petscoptions.h> 634*5305534fSZach Atkins PetscErrorCode PetscOptionsScalar(const char opt[], const char text[], const char man[], PetscScalar currentvalue, PetscScalar *value, PetscBool *set) 635*5305534fSZach Atkins 636*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 637*5305534fSZach Atkins 638*5305534fSZach Atkins Input Parameters: 639*5305534fSZach Atkins + opt - option name 640*5305534fSZach Atkins . text - short string that describes the option 641*5305534fSZach Atkins . man - manual page with additional information on option 642*5305534fSZach Atkins - currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with either 643*5305534fSZach Atkins .vb 644*5305534fSZach Atkins PetscOptionsScalar(..., obj->value,&obj->value,...) or 645*5305534fSZach Atkins value = defaultvalue 646*5305534fSZach Atkins PetscOptionsScalar(..., value,&value,&flg); 647*5305534fSZach Atkins if (flg) { 648*5305534fSZach Atkins .ve 649*5305534fSZach Atkins 650*5305534fSZach Atkins Output Parameters: 651*5305534fSZach Atkins + value - the value to return 652*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 653*5305534fSZach Atkins 654*5305534fSZach Atkins Level: beginner 655*5305534fSZach Atkins 656*5305534fSZach Atkins Notes: 657*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 658*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`. 659*5305534fSZach Atkins 660*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 661*5305534fSZach Atkins 662*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 663*5305534fSZach Atkins 664*5305534fSZach Atkins .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 665*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 666*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 667*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 668*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 669*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 670*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 671*5305534fSZach Atkins M*/ 6721ff8fb82SZach Atkins #define PetscOptionsScalar(opt, text, man, currentvalue, value, set) PetscOptionsScalar_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 673*5305534fSZach Atkins 674*5305534fSZach Atkins /*MC 675*5305534fSZach Atkins 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 676*5305534fSZach Atkins its value is set to false. 677*5305534fSZach Atkins 678*5305534fSZach Atkins Synopsis: 679*5305534fSZach Atkins #include <petscoptions.h> 680*5305534fSZach Atkins PetscErrorCode PetscOptionsName(const char opt[], const char text[], const char man[], PetscBool *flg) 681*5305534fSZach Atkins 682*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 683*5305534fSZach Atkins 684*5305534fSZach Atkins Input Parameters: 685*5305534fSZach Atkins + opt - option name 686*5305534fSZach Atkins . text - short string that describes the option 687*5305534fSZach Atkins - man - manual page with additional information on option 688*5305534fSZach Atkins 689*5305534fSZach Atkins Output Parameter: 690*5305534fSZach Atkins . flg - `PETSC_TRUE` if found, else `PETSC_FALSE` 691*5305534fSZach Atkins 692*5305534fSZach Atkins Level: beginner 693*5305534fSZach Atkins 694*5305534fSZach Atkins Note: 695*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 696*5305534fSZach Atkins 697*5305534fSZach Atkins .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 698*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 699*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 700*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 701*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 702*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 703*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 704*5305534fSZach Atkins M*/ 7051ff8fb82SZach Atkins #define PetscOptionsName(opt, text, man, flg) PetscOptionsName_Private(PetscOptionsObject, opt, text, man, flg) 706*5305534fSZach Atkins 707*5305534fSZach Atkins /*MC 708*5305534fSZach Atkins PetscOptionsString - Gets the string value for a particular option in the database. 709*5305534fSZach Atkins 710*5305534fSZach Atkins Synopsis: 711*5305534fSZach Atkins #include <petscoptions.h> 712*5305534fSZach Atkins PetscErrorCode PetscOptionsString(const char opt[], const char text[], const char man[], const char currentvalue[], char value[], size_t len, PetscBool *set) 713*5305534fSZach Atkins 714*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 715*5305534fSZach Atkins 716*5305534fSZach Atkins Input Parameters: 717*5305534fSZach Atkins + opt - option name 718*5305534fSZach Atkins . text - short string that describes the option 719*5305534fSZach Atkins . man - manual page with additional information on option 720*5305534fSZach Atkins . currentvalue - the current value; caller is responsible for setting this value correctly. This is not used to set value 721*5305534fSZach Atkins - len - length of the result string including null terminator 722*5305534fSZach Atkins 723*5305534fSZach Atkins Output Parameters: 724*5305534fSZach Atkins + value - the value to return 725*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 726*5305534fSZach Atkins 727*5305534fSZach Atkins Level: beginner 728*5305534fSZach Atkins 729*5305534fSZach Atkins Notes: 730*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 731*5305534fSZach Atkins 732*5305534fSZach Atkins If the user provided no string (for example `-optionname` `-someotheroption`) `flg` is set to `PETSC_TRUE` (and the string is filled with nulls). 733*5305534fSZach Atkins 734*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 735*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if `flg` is `PETSC_TRUE`. 736*5305534fSZach Atkins 737*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 738*5305534fSZach Atkins 739*5305534fSZach Atkins .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 740*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 741*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsReal()`, `PetscOptionsBool()`, 742*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 743*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 744*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 745*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 746*5305534fSZach Atkins M*/ 7471ff8fb82SZach Atkins #define PetscOptionsString(opt, text, man, currentvalue, value, len, set) PetscOptionsString_Private(PetscOptionsObject, opt, text, man, currentvalue, value, len, set) 748*5305534fSZach Atkins 749*5305534fSZach Atkins /*MC 750*5305534fSZach Atkins PetscOptionsBool - Determines if a particular option is in the database with a true or false 751*5305534fSZach Atkins 752*5305534fSZach Atkins Synopsis: 753*5305534fSZach Atkins #include <petscoptions.h> 754*5305534fSZach Atkins PetscErrorCode PetscOptionsBool(const char opt[], const char text[], const char man[], PetscBool currentvalue, PetscBool *flg, PetscBool *set) 755*5305534fSZach Atkins 756*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 757*5305534fSZach Atkins 758*5305534fSZach Atkins Input Parameters: 759*5305534fSZach Atkins + opt - option name 760*5305534fSZach Atkins . text - short string that describes the option 761*5305534fSZach Atkins . man - manual page with additional information on option 762*5305534fSZach Atkins - currentvalue - the current value 763*5305534fSZach Atkins 764*5305534fSZach Atkins Output Parameters: 765*5305534fSZach Atkins + flg - `PETSC_TRUE` or `PETSC_FALSE` 766*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 767*5305534fSZach Atkins 768*5305534fSZach Atkins Level: beginner 769*5305534fSZach Atkins 770*5305534fSZach Atkins Notes: 771*5305534fSZach Atkins TRUE, true, YES, yes, nostring, and 1 all translate to `PETSC_TRUE` 772*5305534fSZach Atkins FALSE, false, NO, no, and 0 all translate to `PETSC_FALSE` 773*5305534fSZach Atkins 774*5305534fSZach Atkins 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` 775*5305534fSZach Atkins is equivalent to `-requested_bool true` 776*5305534fSZach Atkins 777*5305534fSZach Atkins If the user does not supply the option at all `flg` is NOT changed. Thus 778*5305534fSZach Atkins you should ALWAYS initialize the `flg` variable if you access it without first checking if the `set` flag is `PETSC_TRUE`. 779*5305534fSZach Atkins 780*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 781*5305534fSZach Atkins 782*5305534fSZach Atkins .seealso: `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetInt()`, 783*5305534fSZach Atkins `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 784*5305534fSZach Atkins `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, 785*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 786*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 787*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 788*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 789*5305534fSZach Atkins M*/ 7901ff8fb82SZach Atkins #define PetscOptionsBool(opt, text, man, currentvalue, value, set) PetscOptionsBool_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 791*5305534fSZach Atkins 792*5305534fSZach Atkins /*MC 793*5305534fSZach Atkins PetscOptionsBoolGroupBegin - First in a series of logical queries on the options database for 794*5305534fSZach Atkins which at most a single value can be true. 795*5305534fSZach Atkins 796*5305534fSZach Atkins Synopsis: 797*5305534fSZach Atkins #include <petscoptions.h> 798*5305534fSZach Atkins PetscErrorCode PetscOptionsBoolGroupBegin(const char opt[], const char text[], const char man[], PetscBool *flg) 799*5305534fSZach Atkins 800*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 801*5305534fSZach Atkins 802*5305534fSZach Atkins Input Parameters: 803*5305534fSZach Atkins + opt - option name 804*5305534fSZach Atkins . text - short string that describes the option 805*5305534fSZach Atkins - man - manual page with additional information on option 806*5305534fSZach Atkins 807*5305534fSZach Atkins Output Parameter: 808*5305534fSZach Atkins . flg - whether that option was set or not 809*5305534fSZach Atkins 810*5305534fSZach Atkins Level: intermediate 811*5305534fSZach Atkins 812*5305534fSZach Atkins Notes: 813*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 814*5305534fSZach Atkins 815*5305534fSZach Atkins Must be followed by 0 or more `PetscOptionsBoolGroup()`s and `PetscOptionsBoolGroupEnd()` 816*5305534fSZach Atkins 817*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 818*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 819*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 820*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 821*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 822*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 823*5305534fSZach Atkins M*/ 8241ff8fb82SZach Atkins #define PetscOptionsBoolGroupBegin(opt, text, man, flg) PetscOptionsBoolGroupBegin_Private(PetscOptionsObject, opt, text, man, flg) 825*5305534fSZach Atkins 826*5305534fSZach Atkins /*MC 827*5305534fSZach Atkins PetscOptionsBoolGroup - One in a series of logical queries on the options database for 828*5305534fSZach Atkins which at most a single value can be true. 829*5305534fSZach Atkins 830*5305534fSZach Atkins Synopsis: 831*5305534fSZach Atkins #include <petscoptions.h> 832*5305534fSZach Atkins PetscErrorCode PetscOptionsBoolGroup(const char opt[], const char text[], const char man[], PetscBool *flg) 833*5305534fSZach Atkins 834*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 835*5305534fSZach Atkins 836*5305534fSZach Atkins Input Parameters: 837*5305534fSZach Atkins + opt - option name 838*5305534fSZach Atkins . text - short string that describes the option 839*5305534fSZach Atkins - man - manual page with additional information on option 840*5305534fSZach Atkins 841*5305534fSZach Atkins Output Parameter: 842*5305534fSZach Atkins . flg - `PETSC_TRUE` if found, else `PETSC_FALSE` 843*5305534fSZach Atkins 844*5305534fSZach Atkins Level: intermediate 845*5305534fSZach Atkins 846*5305534fSZach Atkins Notes: 847*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 848*5305534fSZach Atkins 849*5305534fSZach Atkins Must follow a `PetscOptionsBoolGroupBegin()` and preceded a `PetscOptionsBoolGroupEnd()` 850*5305534fSZach Atkins 851*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 852*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 853*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 854*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 855*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 856*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 857*5305534fSZach Atkins M*/ 8581ff8fb82SZach Atkins #define PetscOptionsBoolGroup(opt, text, man, flg) PetscOptionsBoolGroup_Private(PetscOptionsObject, opt, text, man, flg) 859*5305534fSZach Atkins 860*5305534fSZach Atkins /*MC 861*5305534fSZach Atkins PetscOptionsBoolGroupEnd - Last in a series of logical queries on the options database for 862*5305534fSZach Atkins which at most a single value can be true. 863*5305534fSZach Atkins 864*5305534fSZach Atkins Synopsis: 865*5305534fSZach Atkins #include <petscoptions.h> 866*5305534fSZach Atkins PetscErrorCode PetscOptionsBoolGroupEnd(const char opt[], const char text[], const char man[], PetscBool *flg) 867*5305534fSZach Atkins 868*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 869*5305534fSZach Atkins 870*5305534fSZach Atkins Input Parameters: 871*5305534fSZach Atkins + opt - option name 872*5305534fSZach Atkins . text - short string that describes the option 873*5305534fSZach Atkins - man - manual page with additional information on option 874*5305534fSZach Atkins 875*5305534fSZach Atkins Output Parameter: 876*5305534fSZach Atkins . flg - `PETSC_TRUE` if found, else `PETSC_FALSE` 877*5305534fSZach Atkins 878*5305534fSZach Atkins Level: intermediate 879*5305534fSZach Atkins 880*5305534fSZach Atkins Notes: 881*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 882*5305534fSZach Atkins 883*5305534fSZach Atkins Must follow a `PetscOptionsBoolGroupBegin()` 884*5305534fSZach Atkins 885*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 886*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 887*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 888*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 889*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 890*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 891*5305534fSZach Atkins M*/ 8921ff8fb82SZach Atkins #define PetscOptionsBoolGroupEnd(opt, text, man, flg) PetscOptionsBoolGroupEnd_Private(PetscOptionsObject, opt, text, man, flg) 893*5305534fSZach Atkins 894*5305534fSZach Atkins /*MC 895*5305534fSZach Atkins PetscOptionsFList - Puts a list of option values that a single one may be selected from 896*5305534fSZach Atkins 897*5305534fSZach Atkins Synopsis: 898*5305534fSZach Atkins #include <petscoptions.h> 899*5305534fSZach Atkins PetscErrorCode PetscOptionsFList(const char opt[], const char ltext[], const char man[], PetscFunctionList list, const char currentvalue[], char value[], size_t len, PetscBool *set) 900*5305534fSZach Atkins 901*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 902*5305534fSZach Atkins 903*5305534fSZach Atkins Input Parameters: 904*5305534fSZach Atkins + opt - option name 905*5305534fSZach Atkins . ltext - short string that describes the option 906*5305534fSZach Atkins . man - manual page with additional information on option 907*5305534fSZach Atkins . list - the possible choices 908*5305534fSZach Atkins . currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with 909*5305534fSZach Atkins .vb 910*5305534fSZach Atkins PetscOptionsFlist(..., obj->value,value,len,&flg); 911*5305534fSZach Atkins if (flg) { 912*5305534fSZach Atkins .ve 913*5305534fSZach Atkins - len - the length of the character array value 914*5305534fSZach Atkins 915*5305534fSZach Atkins Output Parameters: 916*5305534fSZach Atkins + value - the value to return 917*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 918*5305534fSZach Atkins 919*5305534fSZach Atkins Level: intermediate 920*5305534fSZach Atkins 921*5305534fSZach Atkins Notes: 922*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 923*5305534fSZach Atkins 924*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 925*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if the `set` flag is `PETSC_TRUE`. 926*5305534fSZach Atkins 927*5305534fSZach Atkins The `currentvalue` passed into this routine does not get transferred to the output `value` variable automatically. 928*5305534fSZach Atkins 929*5305534fSZach Atkins See `PetscOptionsEList()` for when the choices are given in a string array 930*5305534fSZach Atkins 931*5305534fSZach Atkins To get a listing of all currently specified options, 932*5305534fSZach Atkins see `PetscOptionsView()` or `PetscOptionsGetAll()` 933*5305534fSZach Atkins 934*5305534fSZach Atkins Developer Notes: 935*5305534fSZach Atkins This cannot check for invalid selection because of things like `MATAIJ` that are not included in the list 936*5305534fSZach Atkins 937*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 938*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 939*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 940*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 941*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 942*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscOptionsEnum()` 943*5305534fSZach Atkins M*/ 9441ff8fb82SZach Atkins #define PetscOptionsFList(opt, ltext, man, list, currentvalue, value, len, set) PetscOptionsFList_Private(PetscOptionsObject, opt, ltext, man, list, currentvalue, value, len, set) 945*5305534fSZach Atkins 946*5305534fSZach Atkins /*MC 947*5305534fSZach Atkins PetscOptionsEList - Puts a list of option values that a single one may be selected from 948*5305534fSZach Atkins 949*5305534fSZach Atkins Synopsis: 950*5305534fSZach Atkins #include <petscoptions.h> 951*5305534fSZach Atkins PetscErrorCode PetscOptionsEList(const char opt[], const char ltext[], const char man[], const char *const *list, PetscInt ntext, const char currentvalue[], PetscInt *value, PetscBool *set) 952*5305534fSZach Atkins 953*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 954*5305534fSZach Atkins 955*5305534fSZach Atkins Input Parameters: 956*5305534fSZach Atkins + opt - option name 957*5305534fSZach Atkins . ltext - short string that describes the option 958*5305534fSZach Atkins . man - manual page with additional information on option 959*5305534fSZach Atkins . list - the possible choices (one of these must be selected, anything else is invalid) 960*5305534fSZach Atkins . ntext - number of choices 961*5305534fSZach Atkins - currentvalue - the current value; caller is responsible for setting this value correctly. Normally this is done with 962*5305534fSZach Atkins .vb 963*5305534fSZach Atkins PetscOptionsEList(..., obj->value,&value,&flg); 964*5305534fSZach Atkins .ve if (flg) { 965*5305534fSZach Atkins 966*5305534fSZach Atkins Output Parameters: 967*5305534fSZach Atkins + value - the index of the value to return 968*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 969*5305534fSZach Atkins 970*5305534fSZach Atkins Level: intermediate 971*5305534fSZach Atkins 972*5305534fSZach Atkins Notes: 973*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 974*5305534fSZach Atkins 975*5305534fSZach Atkins If the user does not supply the option at all `value` is NOT changed. Thus 976*5305534fSZach Atkins you should ALWAYS initialize `value` if you access it without first checking if the `set` flag is `PETSC_TRUE`. 977*5305534fSZach Atkins 978*5305534fSZach Atkins See `PetscOptionsFList()` for when the choices are given in a `PetscFunctionList()` 979*5305534fSZach Atkins 980*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 981*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 982*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 983*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 984*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 985*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEnum()` 986*5305534fSZach Atkins M*/ 9871ff8fb82SZach Atkins #define PetscOptionsEList(opt, ltext, man, list, ntext, currentvalue, value, set) PetscOptionsEList_Private(PetscOptionsObject, opt, ltext, man, list, ntext, currentvalue, value, set) 988*5305534fSZach Atkins 989*5305534fSZach Atkins /*MC 990*5305534fSZach Atkins PetscOptionsRealArray - Gets an array of double values for a particular 991*5305534fSZach Atkins option in the database. The values must be separated with commas with 992*5305534fSZach Atkins no intervening spaces. 993*5305534fSZach Atkins 994*5305534fSZach Atkins Synopsis: 995*5305534fSZach Atkins #include <petscoptions.h> 996*5305534fSZach Atkins PetscErrorCode PetscOptionsRealArray(const char opt[], const char text[], const char man[], PetscReal value[], PetscInt *n, PetscBool *set) 997*5305534fSZach Atkins 998*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 999*5305534fSZach Atkins 1000*5305534fSZach Atkins Input Parameters: 1001*5305534fSZach Atkins + opt - the option one is seeking 1002*5305534fSZach Atkins . text - short string describing option 1003*5305534fSZach Atkins . man - manual page for option 1004*5305534fSZach Atkins - n - maximum number of values that value has room for 1005*5305534fSZach Atkins 1006*5305534fSZach Atkins Output Parameters: 1007*5305534fSZach Atkins + value - location to copy values 1008*5305534fSZach Atkins . n - actual number of values found 1009*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 1010*5305534fSZach Atkins 1011*5305534fSZach Atkins Level: beginner 1012*5305534fSZach Atkins 1013*5305534fSZach Atkins Note: 1014*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 1015*5305534fSZach Atkins 1016*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 1017*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 1018*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 1019*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 1020*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 1021*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 1022*5305534fSZach Atkins M*/ 10231ff8fb82SZach Atkins #define PetscOptionsRealArray(opt, text, man, currentvalue, value, set) PetscOptionsRealArray_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 1024*5305534fSZach Atkins 1025*5305534fSZach Atkins /*MC 1026*5305534fSZach Atkins PetscOptionsScalarArray - Gets an array of `PetscScalar` values for a particular 1027*5305534fSZach Atkins option in the database. The values must be separated with commas with 1028*5305534fSZach Atkins no intervening spaces. 1029*5305534fSZach Atkins 1030*5305534fSZach Atkins Synopsis: 1031*5305534fSZach Atkins #include <petscoptions.h> 1032*5305534fSZach Atkins PetscErrorCode PetscOptionsScalarArray(const char opt[], const char text[], const char man[], PetscScalar value[], PetscInt *n, PetscBool *set) 1033*5305534fSZach Atkins 1034*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 1035*5305534fSZach Atkins 1036*5305534fSZach Atkins Input Parameters: 1037*5305534fSZach Atkins + opt - the option one is seeking 1038*5305534fSZach Atkins . text - short string describing option 1039*5305534fSZach Atkins . man - manual page for option 1040*5305534fSZach Atkins - n - maximum number of values allowed in the value array 1041*5305534fSZach Atkins 1042*5305534fSZach Atkins Output Parameters: 1043*5305534fSZach Atkins + value - location to copy values 1044*5305534fSZach Atkins . n - actual number of values found 1045*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 1046*5305534fSZach Atkins 1047*5305534fSZach Atkins Level: beginner 1048*5305534fSZach Atkins 1049*5305534fSZach Atkins Note: 1050*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 1051*5305534fSZach Atkins 1052*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 1053*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 1054*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 1055*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 1056*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 1057*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 1058*5305534fSZach Atkins M*/ 10591ff8fb82SZach Atkins #define PetscOptionsScalarArray(opt, text, man, currentvalue, value, set) PetscOptionsScalarArray_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 1060*5305534fSZach Atkins 1061*5305534fSZach Atkins /*MC 1062*5305534fSZach Atkins PetscOptionsIntArray - Gets an array of integers for a particular 1063*5305534fSZach Atkins option in the database. 1064*5305534fSZach Atkins 1065*5305534fSZach Atkins Synopsis: 1066*5305534fSZach Atkins #include <petscoptions.h> 1067*5305534fSZach Atkins PetscErrorCode PetscOptionsIntArray(const char opt[], const char text[], const char man[], PetscInt value[], PetscInt *n, PetscBool *set) 1068*5305534fSZach Atkins 1069*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 1070*5305534fSZach Atkins 1071*5305534fSZach Atkins Input Parameters: 1072*5305534fSZach Atkins + opt - the option one is seeking 1073*5305534fSZach Atkins . text - short string describing option 1074*5305534fSZach Atkins . man - manual page for option 1075*5305534fSZach Atkins - n - maximum number of values 1076*5305534fSZach Atkins 1077*5305534fSZach Atkins Output Parameters: 1078*5305534fSZach Atkins + value - location to copy values 1079*5305534fSZach Atkins . n - actual number of values found 1080*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 1081*5305534fSZach Atkins 1082*5305534fSZach Atkins Level: beginner 1083*5305534fSZach Atkins 1084*5305534fSZach Atkins Notes: 1085*5305534fSZach Atkins The array can be passed as 1086*5305534fSZach Atkins + a comma separated list - 0,1,2,3,4,5,6,7 1087*5305534fSZach Atkins . a range (start\-end+1) - 0-8 1088*5305534fSZach Atkins . a range with given increment (start\-end+1:inc) - 0-7:2 1089*5305534fSZach Atkins - a combination of values and ranges separated by commas - 0,1-8,8-15:2 1090*5305534fSZach Atkins 1091*5305534fSZach Atkins There must be no intervening spaces between the values. 1092*5305534fSZach Atkins 1093*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 1094*5305534fSZach Atkins 1095*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 1096*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 1097*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 1098*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 1099*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 1100*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 1101*5305534fSZach Atkins M*/ 11021ff8fb82SZach Atkins #define PetscOptionsIntArray(opt, text, man, currentvalue, value, set) PetscOptionsIntArray_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 1103*5305534fSZach Atkins 1104*5305534fSZach Atkins /*MC 1105*5305534fSZach Atkins PetscOptionsStringArray - Gets an array of string values for a particular 1106*5305534fSZach Atkins option in the database. The values must be separated with commas with 1107*5305534fSZach Atkins no intervening spaces. 1108*5305534fSZach Atkins 1109*5305534fSZach Atkins Synopsis: 1110*5305534fSZach Atkins #include <petscoptions.h> 1111*5305534fSZach Atkins PetscErrorCode PetscOptionsStringArray(const char opt[], const char text[], const char man[], char *value[], PetscInt *nmax, PetscBool *set) 1112*5305534fSZach Atkins 1113*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()`; No Fortran Support 1114*5305534fSZach Atkins 1115*5305534fSZach Atkins Input Parameters: 1116*5305534fSZach Atkins + opt - the option one is seeking 1117*5305534fSZach Atkins . text - short string describing option 1118*5305534fSZach Atkins . man - manual page for option 1119*5305534fSZach Atkins - nmax - maximum number of strings 1120*5305534fSZach Atkins 1121*5305534fSZach Atkins Output Parameters: 1122*5305534fSZach Atkins + value - location to copy strings 1123*5305534fSZach Atkins . nmax - actual number of strings found 1124*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 1125*5305534fSZach Atkins 1126*5305534fSZach Atkins Level: beginner 1127*5305534fSZach Atkins 1128*5305534fSZach Atkins Notes: 1129*5305534fSZach Atkins The user should pass in an array of pointers to char, to hold all the 1130*5305534fSZach Atkins strings returned by this function. 1131*5305534fSZach Atkins 1132*5305534fSZach Atkins The user is responsible for deallocating the strings that are 1133*5305534fSZach Atkins returned. 1134*5305534fSZach Atkins 1135*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 1136*5305534fSZach Atkins 1137*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 1138*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 1139*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 1140*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 1141*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 1142*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 1143*5305534fSZach Atkins M*/ 11441ff8fb82SZach Atkins #define PetscOptionsStringArray(opt, text, man, currentvalue, value, set) PetscOptionsStringArray_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 1145*5305534fSZach Atkins 1146*5305534fSZach Atkins /*MC 1147*5305534fSZach Atkins PetscOptionsBoolArray - Gets an array of logical values (true or false) for a particular 1148*5305534fSZach Atkins option in the database. The values must be separated with commas with 1149*5305534fSZach Atkins no intervening spaces. 1150*5305534fSZach Atkins 1151*5305534fSZach Atkins Synopsis: 1152*5305534fSZach Atkins #include <petscoptions.h> 1153*5305534fSZach Atkins PetscErrorCode PetscOptionsBoolArray(const char opt[], const char text[], const char man[], PetscBool value[], PetscInt *n, PetscBool *set) 1154*5305534fSZach Atkins 1155*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 1156*5305534fSZach Atkins 1157*5305534fSZach Atkins Input Parameters: 1158*5305534fSZach Atkins + opt - the option one is seeking 1159*5305534fSZach Atkins . text - short string describing option 1160*5305534fSZach Atkins . man - manual page for option 1161*5305534fSZach Atkins - n - maximum number of values allowed in the value array 1162*5305534fSZach Atkins 1163*5305534fSZach Atkins Output Parameters: 1164*5305534fSZach Atkins + value - location to copy values 1165*5305534fSZach Atkins . n - actual number of values found 1166*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 1167*5305534fSZach Atkins 1168*5305534fSZach Atkins Level: beginner 1169*5305534fSZach Atkins 1170*5305534fSZach Atkins Notes: 1171*5305534fSZach Atkins The user should pass in an array of `PetscBool` 1172*5305534fSZach Atkins 1173*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 1174*5305534fSZach Atkins 1175*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 1176*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, 1177*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 1178*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 1179*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 1180*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 1181*5305534fSZach Atkins M*/ 11821ff8fb82SZach Atkins #define PetscOptionsBoolArray(opt, text, man, currentvalue, value, set) PetscOptionsBoolArray_Private(PetscOptionsObject, opt, text, man, currentvalue, value, set) 1183*5305534fSZach Atkins 1184*5305534fSZach Atkins /*MC 1185*5305534fSZach Atkins PetscOptionsEnumArray - Gets an array of enum values for a particular 1186*5305534fSZach Atkins option in the database. 1187*5305534fSZach Atkins 1188*5305534fSZach Atkins Synopsis: 1189*5305534fSZach Atkins #include <petscoptions.h> 1190*5305534fSZach Atkins PetscErrorCode PetscOptionsEnumArray(const char opt[], const char text[], const char man[], const char *const *list, PetscEnum value[], PetscInt *n, PetscBool *set) 1191*5305534fSZach Atkins 1192*5305534fSZach Atkins Logically Collective on the communicator passed in `PetscOptionsBegin()` 1193*5305534fSZach Atkins 1194*5305534fSZach Atkins Input Parameters: 1195*5305534fSZach Atkins + opt - the option one is seeking 1196*5305534fSZach Atkins . text - short string describing option 1197*5305534fSZach Atkins . man - manual page for option 1198*5305534fSZach Atkins . list - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null 1199*5305534fSZach Atkins - n - maximum number of values allowed in the value array 1200*5305534fSZach Atkins 1201*5305534fSZach Atkins Output Parameters: 1202*5305534fSZach Atkins + value - location to copy values 1203*5305534fSZach Atkins . n - actual number of values found 1204*5305534fSZach Atkins - set - `PETSC_TRUE` if found, else `PETSC_FALSE` 1205*5305534fSZach Atkins 1206*5305534fSZach Atkins Level: beginner 1207*5305534fSZach Atkins 1208*5305534fSZach Atkins Notes: 1209*5305534fSZach Atkins The array must be passed as a comma separated list. 1210*5305534fSZach Atkins 1211*5305534fSZach Atkins There must be no intervening spaces between the values. 1212*5305534fSZach Atkins 1213*5305534fSZach Atkins Must be between a `PetscOptionsBegin()` and a `PetscOptionsEnd()` 1214*5305534fSZach Atkins 1215*5305534fSZach Atkins .seealso: `PetscOptionsGetInt()`, `PetscOptionsGetReal()`, 1216*5305534fSZach Atkins `PetscOptionsHasName()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsGetBool()`, 1217*5305534fSZach Atkins `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, 1218*5305534fSZach Atkins `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, 1219*5305534fSZach Atkins `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, 1220*5305534fSZach Atkins `PetscOptionsFList()`, `PetscOptionsEList()` 1221*5305534fSZach Atkins M*/ 12221ff8fb82SZach Atkins #define PetscOptionsEnumArray(opt, text, man, list, value, n, set) PetscOptionsEnumArray_Private(PetscOptionsObject, opt, text, man, list, value, n, set) 1223*5305534fSZach Atkins 1224*5305534fSZach Atkins /*MC 1225*5305534fSZach Atkins PetscOptionsDeprecated - mark an option as deprecated, optionally replacing it with `newname` 1226*5305534fSZach Atkins 1227*5305534fSZach Atkins Prints a deprecation warning, unless an option is supplied to suppress. 1228*5305534fSZach Atkins 1229*5305534fSZach Atkins Logically Collective 1230*5305534fSZach Atkins 1231*5305534fSZach Atkins Input Parameters: 1232*5305534fSZach Atkins + oldname - the old, deprecated option 1233*5305534fSZach Atkins . newname - the new option, or `NULL` if option is purely removed 1234*5305534fSZach Atkins . version - a string describing the version of first deprecation, e.g. "3.9" 1235*5305534fSZach Atkins - info - additional information string, or `NULL`. 1236*5305534fSZach Atkins 1237*5305534fSZach Atkins Options Database Key: 1238*5305534fSZach Atkins . -options_suppress_deprecated_warnings - do not print deprecation warnings 1239*5305534fSZach Atkins 1240*5305534fSZach Atkins Level: developer 1241*5305534fSZach Atkins 1242*5305534fSZach Atkins Notes: 1243*5305534fSZach Atkins If `newname` is provided then the options database will automatically check the database for `oldname`. 1244*5305534fSZach Atkins 1245*5305534fSZach Atkins The old call `PetscOptionsXXX`(`oldname`) should be removed from the source code when both (1) the call to `PetscOptionsDeprecated()` occurs before the 1246*5305534fSZach Atkins new call to `PetscOptionsXXX`(`newname`) and (2) the argument handling of the new call to `PetscOptionsXXX`(`newname`) is identical to the previous call. 1247*5305534fSZach Atkins See `PTScotch_PartGraph_Seq()` for an example of when (1) fails and `SNESTestJacobian()` where an example of (2) fails. 1248*5305534fSZach Atkins 1249*5305534fSZach Atkins Must be called between `PetscOptionsBegin()` (or `PetscObjectOptionsBegin()`) and `PetscOptionsEnd()`. 1250*5305534fSZach Atkins Only the process of rank zero that owns the `PetscOptionsItems` are argument (managed by `PetscOptionsBegin()` or `PetscObjectOptionsBegin()` prints the information 1251*5305534fSZach Atkins If newname is provided, the old option is replaced. Otherwise, it remains in the options database. 1252*5305534fSZach Atkins If an option is not replaced, the info argument should be used to advise the user on how to proceed. 1253*5305534fSZach Atkins There is a limit on the length of the warning printed, so very long strings provided as info may be truncated. 1254*5305534fSZach Atkins 1255*5305534fSZach Atkins .seealso: `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsScalar()`, `PetscOptionsBool()`, `PetscOptionsString()`, `PetscOptionsSetValue()` 1256*5305534fSZach Atkins M*/ 12571ff8fb82SZach Atkins #define PetscOptionsDeprecated(opt, text, man, info) PetscOptionsDeprecated_Private(PetscOptionsObject, opt, text, man, info) 1258*5305534fSZach Atkins 1259*5305534fSZach Atkins /*MC 1260*5305534fSZach Atkins PetscOptionsDeprecatedMoObject - mark an option as deprecated in the global PetscOptionsObject, optionally replacing it with `newname` 1261*5305534fSZach Atkins 1262*5305534fSZach Atkins Prints a deprecation warning, unless an option is supplied to suppress. 1263*5305534fSZach Atkins 1264*5305534fSZach Atkins Logically Collective 1265*5305534fSZach Atkins 1266*5305534fSZach Atkins Input Parameters: 1267*5305534fSZach Atkins + oldname - the old, deprecated option 1268*5305534fSZach Atkins . newname - the new option, or `NULL` if option is purely removed 1269*5305534fSZach Atkins . version - a string describing the version of first deprecation, e.g. "3.9" 1270*5305534fSZach Atkins - info - additional information string, or `NULL`. 1271*5305534fSZach Atkins 1272*5305534fSZach Atkins Options Database Key: 1273*5305534fSZach Atkins . -options_suppress_deprecated_warnings - do not print deprecation warnings 1274*5305534fSZach Atkins 1275*5305534fSZach Atkins Level: developer 1276*5305534fSZach Atkins 1277*5305534fSZach Atkins Notes: 1278*5305534fSZach Atkins If `newname` is provided then the options database will automatically check the database for `oldname`. 1279*5305534fSZach Atkins 1280*5305534fSZach Atkins The old call `PetscOptionsXXX`(`oldname`) should be removed from the source code when both (1) the call to `PetscOptionsDeprecated()` occurs before the 1281*5305534fSZach Atkins new call to `PetscOptionsXXX`(`newname`) and (2) the argument handling of the new call to `PetscOptionsXXX`(`newname`) is identical to the previous call. 1282*5305534fSZach Atkins See `PTScotch_PartGraph_Seq()` for an example of when (1) fails and `SNESTestJacobian()` where an example of (2) fails. 1283*5305534fSZach Atkins 1284*5305534fSZach Atkins Only the process of rank zero that owns the `PetscOptionsItems` are argument (managed by `PetscOptionsBegin()` or `PetscObjectOptionsBegin()` prints the information 1285*5305534fSZach Atkins If newname is provided, the old option is replaced. Otherwise, it remains in the options database. 1286*5305534fSZach Atkins If an option is not replaced, the info argument should be used to advise the user on how to proceed. 1287*5305534fSZach Atkins There is a limit on the length of the warning printed, so very long strings provided as info may be truncated. 1288*5305534fSZach Atkins 1289*5305534fSZach Atkins .seealso: `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsScalar()`, `PetscOptionsBool()`, `PetscOptionsString()`, `PetscOptionsSetValue()` 1290*5305534fSZach Atkins M*/ 12911ff8fb82SZach Atkins #define PetscOptionsDeprecatedNoObject(opt, text, man, info) PetscOptionsDeprecated_Private(NULL, opt, text, man, info) 12925f80ce2aSJacob Faibussowitsch #endif /* PETSC_CLANG_STATIC_ANALYZER */ 1293e55864a3SBarry Smith 12944416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnum_Private(PetscOptionItems *, const char[], const char[], const char[], const char *const *, PetscEnum, PetscEnum *, PetscBool *); 12955a856986SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsInt_Private(PetscOptionItems *, const char[], const char[], const char[], PetscInt, PetscInt *, PetscBool *, PetscInt, PetscInt); 12964416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsReal_Private(PetscOptionItems *, const char[], const char[], const char[], PetscReal, PetscReal *, PetscBool *); 12974416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsScalar_Private(PetscOptionItems *, const char[], const char[], const char[], PetscScalar, PetscScalar *, PetscBool *); 12984416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsName_Private(PetscOptionItems *, const char[], const char[], const char[], PetscBool *); 12994416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsString_Private(PetscOptionItems *, const char[], const char[], const char[], const char[], char *, size_t, PetscBool *); 13004416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBool_Private(PetscOptionItems *, const char[], const char[], const char[], PetscBool, PetscBool *, PetscBool *); 13014416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroupBegin_Private(PetscOptionItems *, const char[], const char[], const char[], PetscBool *); 13024416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroup_Private(PetscOptionItems *, const char[], const char[], const char[], PetscBool *); 13034416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolGroupEnd_Private(PetscOptionItems *, const char[], const char[], const char[], PetscBool *); 13044416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsFList_Private(PetscOptionItems *, const char[], const char[], const char[], PetscFunctionList, const char[], char[], size_t, PetscBool *); 13054416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEList_Private(PetscOptionItems *, const char[], const char[], const char[], const char *const *, PetscInt, const char[], PetscInt *, PetscBool *); 13064416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsRealArray_Private(PetscOptionItems *, const char[], const char[], const char[], PetscReal[], PetscInt *, PetscBool *); 13074416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsScalarArray_Private(PetscOptionItems *, const char[], const char[], const char[], PetscScalar[], PetscInt *, PetscBool *); 13084416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsIntArray_Private(PetscOptionItems *, const char[], const char[], const char[], PetscInt[], PetscInt *, PetscBool *); 13094416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsStringArray_Private(PetscOptionItems *, const char[], const char[], const char[], char *[], PetscInt *, PetscBool *); 13104416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsBoolArray_Private(PetscOptionItems *, const char[], const char[], const char[], PetscBool[], PetscInt *, PetscBool *); 13114416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsEnumArray_Private(PetscOptionItems *, const char[], const char[], const char[], const char *const *, PetscEnum[], PetscInt *, PetscBool *); 13129f3a6782SPatrick Sanan PETSC_EXTERN PetscErrorCode PetscOptionsDeprecated_Private(PetscOptionItems *, const char[], const char[], const char[], const char[]); 1313cffb1e40SBarry Smith 1314e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsSAWsDestroy(void); 1315f8d0b74dSMatthew Knepley 1316dbbe0bcdSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectAddOptionsHandler(PetscObject, PetscErrorCode (*)(PetscObject, PetscOptionItems *, void *), PetscErrorCode (*)(PetscObject, void *), void *); 1317dbbe0bcdSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectProcessOptionsHandlers(PetscObject, PetscOptionItems *); 1318447ac60bSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectDestroyOptionsHandlers(PetscObject); 1319447ac60bSBarry Smith 1320f4bc716fSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsLeftError(void); 1321