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 PetscOptionsHasName(const char[],const char[],PetscTruth*); 10 PetscPolymorphicSubroutine(PetscOptionsHasName,(const char b[],PetscTruth *f),(PETSC_NULL,b,f)) 11 EXTERN PetscErrorCode 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 PetscOptionsGetLogical(const char[],const char [],PetscTruth *,PetscTruth*); 14 PetscPolymorphicSubroutine(PetscOptionsGetLogical,(const char b[],PetscTruth *i,PetscTruth *f),(PETSC_NULL,b,i,f)) 15 EXTERN PetscErrorCode 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 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 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 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 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 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 28 EXTERN PetscErrorCode PetscOptionsSetAlias(const char[],const char[]); 29 EXTERN PetscErrorCode PetscOptionsSetValue(const char[],const char[]); 30 EXTERN PetscErrorCode PetscOptionsClearValue(const char[]); 31 32 EXTERN PetscErrorCode PetscOptionsAllUsed(int*); 33 EXTERN PetscErrorCode PetscOptionsLeft(void); 34 EXTERN PetscErrorCode PetscOptionsPrint(FILE *); 35 36 EXTERN PetscErrorCode PetscOptionsCreate(void); 37 EXTERN PetscErrorCode PetscOptionsInsert(int*,char ***,const char[]); 38 EXTERN PetscErrorCode PetscOptionsInsertFile(const char[]); 39 EXTERN PetscErrorCode PetscOptionsInsertString(const char[]); 40 EXTERN PetscErrorCode PetscOptionsDestroy(void); 41 42 EXTERN PetscErrorCode PetscOptionsReject(const char[],const char[]); 43 EXTERN PetscErrorCode PetscOptionsGetAll(char*[]); 44 45 EXTERN PetscErrorCode PetscOptionsGetenv(MPI_Comm,const char[],char[],size_t,PetscTruth *); 46 EXTERN PetscErrorCode PetscOptionsAtoi(const char[],PetscInt*); 47 EXTERN PetscErrorCode PetscOptionsAtod(const char[],PetscReal*); 48 49 extern PetscTruth PetscOptionsPublish; 50 extern int PetscOptionsPublishCount; 51 52 /*MC 53 PetscOptionsBegin - Begins a set of queries on the options database that are related and should be 54 displayed on the same window of a GUI that allows the user to set the options interactively. 55 56 Synopsis: PetscErrorCode PetscOptionsBegin(MPI_Comm comm,const char prefix[],const char title[],const char mansec[]) 57 58 Collective on MPI_Comm 59 60 Input Parameters: 61 + comm - communicator that shares GUI 62 . prefix - options prefix for all options displayed on window 63 . title - short descriptive text, for example "Krylov Solver Options" 64 - mansec - section of manual pages for options, for example KSP 65 66 Level: intermediate 67 68 Notes: Needs to be ended by a call the PetscOptionsEnd() 69 70 Can add subheadings with PetscOptionsHead() 71 72 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 73 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical() 74 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(), 75 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 76 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 77 PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(), 78 PetscOptionsList(), PetscOptionsEList() 79 80 M*/ 81 #define PetscOptionsBegin(comm,prefix,mess,sec) 0; {\ 82 for (PetscOptionsPublishCount=(PetscOptionsPublish?-1:1); PetscOptionsPublishCount<2; PetscOptionsPublishCount++) {\ 83 int _5_ierr = PetscOptionsBegin_Private(comm,prefix,mess,sec);CHKERRQ(_5_ierr); 84 85 /*MC 86 PetscOptionsEnd - Ends a set of queries on the options database that are related and should be 87 displayed on the same window of a GUI that allows the user to set the options interactively. 88 89 Collective on the MPI_Comm used in PetscOptionsBegin() 90 91 Synopsis: PetscErrorCode PetscOptionsEnd(void) 92 93 Level: intermediate 94 95 Notes: Needs to be preceded by a call to PetscOptionsBegin() 96 97 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 98 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical() 99 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsLogical(), 100 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 101 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 102 PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(), 103 PetscOptionsList(), PetscOptionsEList() 104 105 M*/ 106 #define PetscOptionsEnd() _5_ierr = PetscOptionsEnd_Private();CHKERRQ(_5_ierr);}} 107 108 EXTERN PetscErrorCode PetscOptionsBegin_Private(MPI_Comm,const char[],const char[],const char[]); 109 EXTERN PetscErrorCode PetscOptionsEnd_Private(void); 110 EXTERN PetscErrorCode PetscOptionsHead(const char[]); 111 112 /*MC 113 PetscOptionsTail - Ends a section of options begun with PetscOptionsHead() 114 See, for example, KSPSetFromOptions_GMRES(). 115 116 Collective on the communicator passed in PetscOptionsBegin() 117 118 Synopsis: PetscErrorCode PetscOptionsTail(void) 119 120 Level: intermediate 121 122 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 123 124 Must be preceded by a call to PetscOptionsHead() in the same function. 125 126 Concepts: options database^subheading 127 128 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 129 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsLogical(), 130 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 131 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 132 PetscOptionsLogicalGroupBegin(), PetscOptionsLogicalGroup(), PetscOptionsLogicalGroupEnd(), 133 PetscOptionsList(), PetscOptionsEList() 134 M*/ 135 #define PetscOptionsTail() 0; {if (PetscOptionsPublishCount != 1) PetscFunctionReturn(0);} 136 137 EXTERN PetscErrorCode PetscOptionsInt(const char[],const char[],const char[],PetscInt,PetscInt*,PetscTruth*); 138 EXTERN PetscErrorCode PetscOptionsReal(const char[],const char[],const char[],PetscReal,PetscReal*,PetscTruth*); 139 EXTERN PetscErrorCode PetscOptionsScalar(const char[],const char[],const char[],PetscScalar,PetscScalar*,PetscTruth*); 140 EXTERN PetscErrorCode PetscOptionsName(const char[],const char[],const char[],PetscTruth*); 141 EXTERN PetscErrorCode PetscOptionsString(const char[],const char[],const char[],const char[],char*,size_t,PetscTruth*); 142 EXTERN PetscErrorCode PetscOptionsLogical(const char[],const char[],const char[],PetscTruth,PetscTruth*,PetscTruth*); 143 EXTERN PetscErrorCode PetscOptionsLogicalGroupBegin(const char[],const char[],const char[],PetscTruth*); 144 EXTERN PetscErrorCode PetscOptionsLogicalGroup(const char[],const char[],const char[],PetscTruth*); 145 EXTERN PetscErrorCode PetscOptionsLogicalGroupEnd(const char[],const char[],const char[],PetscTruth*); 146 EXTERN PetscErrorCode PetscOptionsList(const char[],const char[],const char[],PetscFList,const char[],char[],PetscInt,PetscTruth*); 147 EXTERN PetscErrorCode PetscOptionsEList(const char[],const char[],const char[],const char*[],PetscInt,const char[],PetscInt*,PetscTruth*); 148 EXTERN PetscErrorCode PetscOptionsRealArray(const char[],const char[],const char[],PetscReal[],PetscInt*,PetscTruth*); 149 EXTERN PetscErrorCode PetscOptionsIntArray(const char[],const char[],const char[],PetscInt[],PetscInt*,PetscTruth*); 150 EXTERN PetscErrorCode PetscOptionsStringArray(const char[],const char[],const char[],char*[],PetscInt*,PetscTruth*); 151 152 PETSC_EXTERN_CXX_END 153 #endif 154