1 /* 2 Routines to determine options set in the options database. 3 */ 4 #if !defined(__PETSCOPTIONS_H) 5 #define __PETSCOPTIONS_H 6 #include "petsc.h" 7 PETSC_EXTERN_CXX_BEGIN 8 9 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsHasName(const char[],const char[],PetscTruth*); 10 PetscPolymorphicSubroutine(PetscOptionsHasName,(const char b[],PetscTruth *f),(PETSC_NULL,b,f)) 11 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetInt(const char[],const char [],PetscInt *,PetscTruth*); 12 PetscPolymorphicSubroutine(PetscOptionsGetInt,(const char b[],PetscInt *i,PetscTruth *f),(PETSC_NULL,b,i,f)) 13 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetTruth(const char[],const char [],PetscTruth *,PetscTruth*); 14 PetscPolymorphicSubroutine(PetscOptionsGetTruth,(const char b[],PetscTruth *i,PetscTruth *f),(PETSC_NULL,b,i,f)) 15 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetReal(const char[],const char[],PetscReal *,PetscTruth*); 16 PetscPolymorphicSubroutine(PetscOptionsGetReal,(const char b[],PetscReal *i,PetscTruth *f),(PETSC_NULL,b,i,f)) 17 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetScalar(const char[],const char[],PetscScalar *,PetscTruth*); 18 PetscPolymorphicSubroutine(PetscOptionsGetScalar,(const char b[],PetscScalar i[],PetscTruth *f),(PETSC_NULL,b,i,f)) 19 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetIntArray(const char[],const char[],PetscInt[],PetscInt *,PetscTruth*); 20 PetscPolymorphicSubroutine(PetscOptionsGetIntArray,(const char b[],PetscInt i[],PetscInt *ii,PetscTruth *f),(PETSC_NULL,b,i,ii,f)) 21 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetRealArray(const char[],const char[],PetscReal[],PetscInt *,PetscTruth*); 22 PetscPolymorphicSubroutine(PetscOptionsGetRealArray,(const char b[],PetscReal i[],PetscInt *ii,PetscTruth *f),(PETSC_NULL,b,i,ii,f)) 23 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetString(const char[],const char[],char[],size_t,PetscTruth*); 24 PetscPolymorphicSubroutine(PetscOptionsGetString,(const char b[],char i[],size_t s,PetscTruth *f),(PETSC_NULL,b,i,s,f)) 25 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetStringArray(const char[],const char[],char*[],PetscInt*,PetscTruth*); 26 PetscPolymorphicSubroutine(PetscOptionsGetStringArray,(const char b[],char *i[],PetscInt *ii,PetscTruth *f),(PETSC_NULL,b,i,ii,f)) 27 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetEList(const char[],const char[],const char**,PetscInt,PetscInt*,PetscTruth*); 28 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetEnum(const char[],const char[],const char**,PetscEnum*,PetscTruth*); 29 30 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsSetAlias(const char[],const char[]); 31 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsSetValue(const char[],const char[]); 32 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsClearValue(const char[]); 33 34 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsAllUsed(int*); 35 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsLeft(void); 36 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsPrint(FILE *); 37 38 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsCreate(void); 39 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsInsert(int*,char ***,const char[]); 40 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsInsertFile(const char[]); 41 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsInsertString(const char[]); 42 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsDestroy(void); 43 44 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsReject(const char[],const char[]); 45 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetAll(char*[]); 46 47 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsGetenv(MPI_Comm,const char[],char[],size_t,PetscTruth *); 48 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsAtoi(const char[],PetscInt*); 49 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsAtod(const char[],PetscReal*); 50 51 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsMonitorSet(PetscErrorCode (*)(const char[], const char[], void*), void *, PetscErrorCode (*)(void*)); 52 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsMonitorCancel(void); 53 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsMonitorDefault(const char[], const char[], void *); 54 55 extern PETSC_DLLEXPORT PetscTruth PetscOptionsPublish; 56 extern PETSC_DLLEXPORT PetscInt PetscOptionsPublishCount; 57 58 /*MC 59 PetscOptionsBegin - Begins a set of queries on the options database that are related and should be 60 displayed on the same window of a GUI that allows the user to set the options interactively. 61 62 Synopsis: PetscErrorCode PetscOptionsBegin(MPI_Comm comm,const char prefix[],const char title[],const char mansec[]) 63 64 Collective on MPI_Comm 65 66 Input Parameters: 67 + comm - communicator that shares GUI 68 . prefix - options prefix for all options displayed on window 69 . title - short descriptive text, for example "Krylov Solver Options" 70 - mansec - section of manual pages for options, for example KSP 71 72 Level: intermediate 73 74 Notes: Needs to be ended by a call the PetscOptionsEnd() 75 76 Can add subheadings with PetscOptionsHead() 77 78 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 79 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 80 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 81 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 82 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 83 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 84 PetscOptionsList(), PetscOptionsEList() 85 86 M*/ 87 #define PetscOptionsBegin(comm,prefix,mess,sec) 0; {\ 88 for (PetscOptionsPublishCount=(PetscOptionsPublish?-1:1); PetscOptionsPublishCount<2; PetscOptionsPublishCount++) {\ 89 PetscErrorCode _5_ierr = PetscOptionsBegin_Private(comm,prefix,mess,sec);CHKERRQ(_5_ierr); 90 91 /*MC 92 PetscOptionsEnd - Ends a set of queries on the options database that are related and should be 93 displayed on the same window of a GUI that allows the user to set the options interactively. 94 95 Collective on the MPI_Comm used in PetscOptionsBegin() 96 97 Synopsis: PetscErrorCode PetscOptionsEnd(void) 98 99 Level: intermediate 100 101 Notes: Needs to be preceded by a call to PetscOptionsBegin() 102 103 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 104 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 105 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 106 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 107 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 108 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 109 PetscOptionsList(), PetscOptionsEList() 110 111 M*/ 112 #define PetscOptionsEnd() _5_ierr = PetscOptionsEnd_Private();CHKERRQ(_5_ierr);}} 113 114 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsBegin_Private(MPI_Comm,const char[],const char[],const char[]); 115 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsEnd_Private(void); 116 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsHead(const char[]); 117 118 /*MC 119 PetscOptionsTail - Ends a section of options begun with PetscOptionsHead() 120 See, for example, KSPSetFromOptions_GMRES(). 121 122 Collective on the communicator passed in PetscOptionsBegin() 123 124 Synopsis: PetscErrorCode PetscOptionsTail(void) 125 126 Level: intermediate 127 128 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 129 130 Must be preceded by a call to PetscOptionsHead() in the same function. 131 132 This needs to be used only if the code below PetscOptionsTail() can be run ONLY once. 133 See, for example, PCSetFromOptions_Composite(). This is a return(0) in it for early exit 134 from the function. 135 136 This is only for use with the PETSc options GUI; which does not currently exist. 137 138 Concepts: options database^subheading 139 140 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 141 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 142 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 143 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 144 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 145 PetscOptionsList(), PetscOptionsEList(), PetscOptionsEnum() 146 M*/ 147 #define PetscOptionsTail() 0; {if (PetscOptionsPublishCount != 1) PetscFunctionReturn(0);} 148 149 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsEnum(const char[],const char[],const char[],const char **,PetscEnum,PetscEnum*,PetscTruth*); 150 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsInt(const char[],const char[],const char[],PetscInt,PetscInt*,PetscTruth*); 151 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsReal(const char[],const char[],const char[],PetscReal,PetscReal*,PetscTruth*); 152 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsScalar(const char[],const char[],const char[],PetscScalar,PetscScalar*,PetscTruth*); 153 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsName(const char[],const char[],const char[],PetscTruth*); 154 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsString(const char[],const char[],const char[],const char[],char*,size_t,PetscTruth*); 155 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruth(const char[],const char[],const char[],PetscTruth,PetscTruth*,PetscTruth*); 156 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroupBegin(const char[],const char[],const char[],PetscTruth*); 157 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroup(const char[],const char[],const char[],PetscTruth*); 158 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroupEnd(const char[],const char[],const char[],PetscTruth*); 159 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsList(const char[],const char[],const char[],PetscFList,const char[],char[],PetscInt,PetscTruth*); 160 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsEList(const char[],const char[],const char[],const char**,PetscInt,const char[],PetscInt*,PetscTruth*); 161 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsRealArray(const char[],const char[],const char[],PetscReal[],PetscInt*,PetscTruth*); 162 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsIntArray(const char[],const char[],const char[],PetscInt[],PetscInt*,PetscTruth*); 163 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsStringArray(const char[],const char[],const char[],char*[],PetscInt*,PetscTruth*); 164 165 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOptionsSetFromOptions(); 166 PETSC_EXTERN_CXX_END 167 #endif 168