1 #define PETSC_DLL 2 /* 3 These routines simplify the use of command line, file options, etc., 4 and are used to manipulate the options database. 5 6 This file uses regular malloc and free because it cannot know 7 what malloc is being used until it has already processed the input. 8 */ 9 10 #include "petsc.h" /*I "petsc.h" I*/ 11 #include "petscsys.h" 12 #if defined(PETSC_HAVE_STDLIB_H) 13 #include <stdlib.h> 14 #endif 15 16 /* 17 Keep a linked list of options that have been posted and we are waiting for 18 user selection 19 20 Eventually we'll attach this beast to a MPI_Comm 21 */ 22 PetscOptionsObjectType PetscOptionsObject; 23 PetscInt PetscOptionsPublishCount = 0; 24 25 26 #undef __FUNCT__ 27 #define __FUNCT__ "PetscOptionsHelpAddList" 28 PetscErrorCode PetscOptionsHelpAddList(const char prefix[],const char title[],const char mansec[]) 29 { 30 int ierr; 31 PetscOptionsHelp newhelp; 32 PetscFunctionBegin; 33 ierr = PetscNew(struct _p_PetscOptionsHelp,&newhelp);CHKERRQ(ierr); 34 ierr = PetscStrallocpy(prefix,&newhelp->prefix);CHKERRQ(ierr); 35 ierr = PetscStrallocpy(title,&newhelp->title);CHKERRQ(ierr); 36 ierr = PetscStrallocpy(mansec,&newhelp->mansec);CHKERRQ(ierr); 37 newhelp->next = 0; 38 39 if (!PetscOptionsObject.help) { 40 PetscOptionsObject.help = newhelp; 41 } else { 42 newhelp->next = PetscOptionsObject.help; 43 PetscOptionsObject.help = newhelp; 44 } 45 PetscFunctionReturn(0); 46 } 47 48 #undef __FUNCT__ 49 #define __FUNCT__ "PetscOptionsHelpDestroyList" 50 PetscErrorCode PetscOptionsHelpDestroyList(void) 51 { 52 PetscErrorCode ierr; 53 PetscOptionsHelp help = PetscOptionsObject.help, next; 54 55 PetscFunctionBegin; 56 while (help) { 57 next = help->next; 58 ierr = PetscStrfree(help->prefix);CHKERRQ(ierr); 59 ierr = PetscStrfree(help->title);CHKERRQ(ierr); 60 ierr = PetscStrfree(help->mansec);CHKERRQ(ierr); 61 ierr = PetscFree(help);CHKERRQ(ierr); 62 help = next; 63 } 64 PetscFunctionReturn(0); 65 } 66 67 68 #undef __FUNCT__ 69 #define __FUNCT__ "PetscOptionsHelpFindList" 70 PetscErrorCode PetscOptionsHelpFindList(const char prefix[],const char title[],const char mansec[],PetscTruth *flg) 71 { 72 PetscErrorCode ierr; 73 PetscTruth flg1,flg2,flg3; 74 PetscOptionsHelp help = PetscOptionsObject.help; 75 PetscFunctionBegin; 76 while (help) { 77 ierr = PetscStrcmp(help->prefix,prefix,&flg1);CHKERRQ(ierr); 78 ierr = PetscStrcmp(help->title,title,&flg2);CHKERRQ(ierr); 79 ierr = PetscStrcmp(help->mansec,mansec,&flg3);CHKERRQ(ierr); 80 if (flg1 && flg2 && flg3) { 81 *flg = PETSC_TRUE; 82 break; 83 } 84 help = help->next; 85 } 86 PetscFunctionReturn(0); 87 88 } 89 90 #undef __FUNCT__ 91 #define __FUNCT__ "PetscOptionsHelpCheckAddList" 92 PetscErrorCode PetscOptionsHelpCheckAddList(const char prefix[],const char title[],const char mansec[],PetscTruth *flg) 93 { 94 PetscFunctionBegin; 95 PetscOptionsHelpFindList(prefix,title,mansec,flg); 96 if (!(*flg)) PetscOptionsHelpAddList(prefix,title,mansec); 97 PetscFunctionReturn(0); 98 } 99 100 #undef __FUNCT__ 101 #define __FUNCT__ "PetscOptionsBegin_Private" 102 /* 103 Handles setting up the data structure in a call to PetscOptionsBegin() 104 */ 105 PetscErrorCode PetscOptionsBegin_Private(MPI_Comm comm,const char prefix[],const char title[],const char mansec[]) 106 { 107 PetscErrorCode ierr; 108 109 PetscFunctionBegin; 110 PetscOptionsObject.next = 0; 111 PetscOptionsObject.comm = comm; 112 PetscOptionsObject.changedmethod = PETSC_FALSE; 113 if (PetscOptionsObject.prefix) { 114 ierr = PetscStrfree(PetscOptionsObject.prefix);CHKERRQ(ierr); PetscOptionsObject.prefix = 0; 115 } 116 ierr = PetscStrallocpy(prefix,&PetscOptionsObject.prefix);CHKERRQ(ierr); 117 if (PetscOptionsObject.title) { 118 ierr = PetscStrfree(PetscOptionsObject.title);CHKERRQ(ierr); PetscOptionsObject.title = 0; 119 } 120 ierr = PetscStrallocpy(title,&PetscOptionsObject.title);CHKERRQ(ierr); 121 122 ierr = PetscOptionsHasName(PETSC_NULL,"-help",&PetscOptionsObject.printhelp);CHKERRQ(ierr); 123 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1) { 124 ierr = PetscOptionsHelpCheckAddList(prefix,title,mansec,&PetscOptionsObject.alreadyprinted); 125 if (!PetscOptionsObject.alreadyprinted) { 126 ierr = (*PetscHelpPrintf)(comm,"%s -------------------------------------------------\n",title);CHKERRQ(ierr); 127 } 128 } 129 PetscFunctionReturn(0); 130 } 131 132 /* 133 Handles adding another option to the list of options within this particular PetscOptionsBegin() PetscOptionsEnd() 134 */ 135 #undef __FUNCT__ 136 #define __FUNCT__ "PetscOptionsCreate_Private" 137 static int PetscOptionsCreate_Private(const char opt[],const char text[],const char man[],PetscOptionType t,PetscOptions *amsopt) 138 { 139 int ierr; 140 PetscOptions next; 141 142 PetscFunctionBegin; 143 ierr = PetscNew(struct _p_PetscOptions,amsopt);CHKERRQ(ierr); 144 (*amsopt)->next = 0; 145 (*amsopt)->set = PETSC_FALSE; 146 (*amsopt)->type = t; 147 (*amsopt)->data = 0; 148 (*amsopt)->edata = 0; 149 150 ierr = PetscStrallocpy(text,&(*amsopt)->text);CHKERRQ(ierr); 151 ierr = PetscStrallocpy(opt,&(*amsopt)->option);CHKERRQ(ierr); 152 ierr = PetscStrallocpy(man,&(*amsopt)->man);CHKERRQ(ierr); 153 154 if (!PetscOptionsObject.next) { 155 PetscOptionsObject.next = *amsopt; 156 } else { 157 next = PetscOptionsObject.next; 158 while (next->next) next = next->next; 159 next->next = *amsopt; 160 } 161 PetscFunctionReturn(0); 162 } 163 164 #undef __FUNCT__ 165 #define __FUNCT__ "PetscOptionsGetFromGui" 166 PetscErrorCode PetscOptionsGetFromGUI() 167 { 168 PetscErrorCode ierr; 169 PetscOptions next = PetscOptionsObject.next; 170 char str[512]; 171 172 ierr = (*PetscPrintf)(PetscOptionsObject.comm,"%s -------------------------------------------------\n",PetscOptionsObject.title);CHKERRQ(ierr); 173 while (next) { 174 switch (next->type) { 175 case OPTION_HEAD: 176 break; 177 case OPTION_INT: 178 ierr = PetscPrintf(PetscOptionsObject.comm,"-%s%s <%d>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",next->option,*(int*)next->data,next->text,next->man);CHKERRQ(ierr); 179 scanf("%s\n",str); 180 if (str[0] != '\n') { 181 printf("changing value\n"); 182 } 183 break; 184 default: 185 break; 186 } 187 next = next->next; 188 } 189 PetscFunctionReturn(0); 190 } 191 192 #undef __FUNCT__ 193 #define __FUNCT__ "PetscOptionsEnd_Private" 194 PetscErrorCode PetscOptionsEnd_Private(void) 195 { 196 PetscErrorCode ierr; 197 PetscOptions last; 198 char option[256],value[1024],tmp[32]; 199 PetscInt j; 200 201 PetscFunctionBegin; 202 203 /* if (PetscOptionsObject.next) { 204 ierr = PetscOptionsGetFromGUI(); 205 }*/ 206 207 ierr = PetscStrfree(PetscOptionsObject.title);CHKERRQ(ierr); PetscOptionsObject.title = 0; 208 ierr = PetscStrfree(PetscOptionsObject.prefix);CHKERRQ(ierr); PetscOptionsObject.prefix = 0; 209 210 /* reset counter to -2; this updates the screen with the new options for the selected method */ 211 if (PetscOptionsObject.changedmethod) PetscOptionsPublishCount = -2; 212 /* reset alreadyprinted flag */ 213 PetscOptionsObject.alreadyprinted = PETSC_FALSE; 214 215 while (PetscOptionsObject.next) { 216 if (PetscOptionsObject.next->set) { 217 if (PetscOptionsObject.prefix) { 218 ierr = PetscStrcpy(option,"-");CHKERRQ(ierr); 219 ierr = PetscStrcat(option,PetscOptionsObject.prefix);CHKERRQ(ierr); 220 ierr = PetscStrcat(option,PetscOptionsObject.next->option+1);CHKERRQ(ierr); 221 } else { 222 ierr = PetscStrcpy(option,PetscOptionsObject.next->option);CHKERRQ(ierr); 223 } 224 225 switch (PetscOptionsObject.next->type) { 226 case OPTION_HEAD: 227 break; 228 case OPTION_INT: 229 sprintf(value,"%d",*(PetscInt*)PetscOptionsObject.next->data); 230 break; 231 case OPTION_REAL: 232 sprintf(value,"%g",*(PetscReal*)PetscOptionsObject.next->data); 233 break; 234 case OPTION_REAL_ARRAY: 235 sprintf(value,"%g",((PetscReal*)PetscOptionsObject.next->data)[0]); 236 for (j=1; j<PetscOptionsObject.next->arraylength; j++) { 237 sprintf(tmp,"%g",((PetscReal*)PetscOptionsObject.next->data)[j]); 238 ierr = PetscStrcat(value,",");CHKERRQ(ierr); 239 ierr = PetscStrcat(value,tmp);CHKERRQ(ierr); 240 } 241 break; 242 case OPTION_LOGICAL: 243 sprintf(value,"%d",*(PetscInt*)PetscOptionsObject.next->data); 244 break; 245 case OPTION_LIST: 246 ierr = PetscStrcpy(value,*(char**)PetscOptionsObject.next->data);CHKERRQ(ierr); 247 break; 248 case OPTION_STRING: /* also handles string arrays */ 249 ierr = PetscStrcpy(value,*(char**)PetscOptionsObject.next->data);CHKERRQ(ierr); 250 break; 251 } 252 ierr = PetscOptionsSetValue(option,value);CHKERRQ(ierr); 253 } 254 ierr = PetscStrfree(PetscOptionsObject.next->text);CHKERRQ(ierr); 255 ierr = PetscStrfree(PetscOptionsObject.next->option);CHKERRQ(ierr); 256 ierr = PetscFree(PetscOptionsObject.next->man);CHKERRQ(ierr); 257 ierr = PetscFree(PetscOptionsObject.next->data);CHKERRQ(ierr); 258 ierr = PetscFree(PetscOptionsObject.next->edata);CHKERRQ(ierr); 259 last = PetscOptionsObject.next; 260 PetscOptionsObject.next = PetscOptionsObject.next->next; 261 ierr = PetscFree(last);CHKERRQ(ierr); 262 } 263 PetscOptionsObject.next = 0; 264 PetscFunctionReturn(0); 265 } 266 267 #undef __FUNCT__ 268 #define __FUNCT__ "PetscOptionsEnum" 269 /*@C 270 PetscOptionsEnum - Gets the enum value for a particular option in the database. 271 272 Collective on the communicator passed in PetscOptionsBegin() 273 274 Input Parameters: 275 + opt - option name 276 . text - short string that describes the option 277 . man - manual page with additional information on option 278 . list - array containing the list of choices, followed by the enum name, followed by the enum prefix, followed by a null 279 - defaultv - the default (current) value 280 281 Output Parameter: 282 + value - the value to return 283 - flg - PETSC_TRUE if found, else PETSC_FALSE 284 285 Level: beginner 286 287 Concepts: options database 288 289 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 290 291 list is usually something like PCASMTypes or some other predefined list of enum names 292 293 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 294 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 295 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 296 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 297 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 298 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 299 PetscOptionsList(), PetscOptionsEList() 300 @*/ 301 PetscErrorCode PETSC_DLLEXPORT PetscOptionsEnum(const char opt[],const char text[],const char man[],const char **list,PetscEnum defaultv,PetscEnum *value,PetscTruth *set) 302 { 303 PetscErrorCode ierr; 304 PetscInt ntext = 0; 305 306 PetscFunctionBegin; 307 while (list[ntext++]) { 308 if (ntext > 50) SETERRQ(PETSC_ERR_ARG_WRONG,"List argument appears to be wrong or have more than 50 entries"); 309 } 310 if (ntext < 3) SETERRQ(PETSC_ERR_ARG_WRONG,"List argument must have at least two entries: typename and type prefix"); 311 ntext -= 3; 312 ierr = PetscOptionsEList(opt,text,man,list,ntext,list[defaultv],(PetscInt*)value,set);CHKERRQ(ierr); 313 PetscFunctionReturn(0); 314 } 315 316 /* -------------------------------------------------------------------------------------------------------------*/ 317 #undef __FUNCT__ 318 #define __FUNCT__ "PetscOptionsInt" 319 /*@C 320 PetscOptionsInt - Gets the integer value for a particular option in the database. 321 322 Collective on the communicator passed in PetscOptionsBegin() 323 324 Input Parameters: 325 + opt - option name 326 . text - short string that describes the option 327 . man - manual page with additional information on option 328 - defaultv - the default (current) value 329 330 Output Parameter: 331 + value - the integer value to return 332 - flg - PETSC_TRUE if found, else PETSC_FALSE 333 334 Level: beginner 335 336 Concepts: options database^has int 337 338 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 339 340 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 341 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 342 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 343 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 344 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 345 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 346 PetscOptionsList(), PetscOptionsEList() 347 @*/ 348 PetscErrorCode PETSC_DLLEXPORT PetscOptionsInt(const char opt[],const char text[],const char man[],PetscInt defaultv,PetscInt *value,PetscTruth *set) 349 { 350 PetscErrorCode ierr; 351 PetscOptions amsopt; 352 353 PetscFunctionBegin; 354 if (PetscOptionsPublishCount == 1) { 355 ierr = PetscOptionsCreate_Private(opt,text,man,OPTION_INT,&amsopt);CHKERRQ(ierr); 356 ierr = PetscMalloc(sizeof(PetscInt),&amsopt->data);CHKERRQ(ierr); 357 *(PetscInt*)amsopt->data = defaultv; 358 } 359 ierr = PetscOptionsGetInt(PetscOptionsObject.prefix,opt,value,set);CHKERRQ(ierr); 360 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 361 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <%d>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv,text,man);CHKERRQ(ierr); 362 } 363 PetscFunctionReturn(0); 364 } 365 366 #undef __FUNCT__ 367 #define __FUNCT__ "PetscOptionsString" 368 /*@C 369 PetscOptionsString - Gets the string value for a particular option in the database. 370 371 Collective on the communicator passed in PetscOptionsBegin() 372 373 Input Parameters: 374 + opt - option name 375 . text - short string that describes the option 376 . man - manual page with additional information on option 377 - defaultv - the default (current) value 378 379 Output Parameter: 380 + value - the value to return 381 - flg - PETSC_TRUE if found, else PETSC_FALSE 382 383 Level: beginner 384 385 Concepts: options database^has int 386 387 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 388 389 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 390 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 391 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 392 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 393 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 394 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 395 PetscOptionsList(), PetscOptionsEList() 396 @*/ 397 PetscErrorCode PETSC_DLLEXPORT PetscOptionsString(const char opt[],const char text[],const char man[],const char defaultv[],char value[],size_t len,PetscTruth *set) 398 { 399 PetscErrorCode ierr; 400 401 PetscFunctionBegin; 402 ierr = PetscOptionsGetString(PetscOptionsObject.prefix,opt,value,len,set);CHKERRQ(ierr); 403 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 404 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <%s>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv,text,man);CHKERRQ(ierr); 405 } 406 PetscFunctionReturn(0); 407 } 408 409 /* 410 Publishes an AMS double field (with the default value in it) and with a name 411 given by the text string 412 */ 413 #undef __FUNCT__ 414 #define __FUNCT__ "PetscOptionsReal" 415 /*@C 416 PetscOptionsReal - Gets the PetscReal value for a particular option in the database. 417 418 Collective on the communicator passed in PetscOptionsBegin() 419 420 Input Parameters: 421 + opt - option name 422 . text - short string that describes the option 423 . man - manual page with additional information on option 424 - defaultv - the default (current) value 425 426 Output Parameter: 427 + value - the value to return 428 - flg - PETSC_TRUE if found, else PETSC_FALSE 429 430 Level: beginner 431 432 Concepts: options database^has int 433 434 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 435 436 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 437 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 438 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 439 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 440 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 441 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 442 PetscOptionsList(), PetscOptionsEList() 443 @*/ 444 PetscErrorCode PETSC_DLLEXPORT PetscOptionsReal(const char opt[],const char text[],const char man[],PetscReal defaultv,PetscReal *value,PetscTruth *set) 445 { 446 PetscErrorCode ierr; 447 448 PetscFunctionBegin; 449 ierr = PetscOptionsGetReal(PetscOptionsObject.prefix,opt,value,set);CHKERRQ(ierr); 450 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 451 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <%G>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv,text,man);CHKERRQ(ierr); 452 } 453 PetscFunctionReturn(0); 454 } 455 456 #undef __FUNCT__ 457 #define __FUNCT__ "PetscOptionsScalar" 458 /*@C 459 PetscOptionsScalar - Gets the scalar value for a particular option in the database. 460 461 Collective on the communicator passed in PetscOptionsBegin() 462 463 Input Parameters: 464 + opt - option name 465 . text - short string that describes the option 466 . man - manual page with additional information on option 467 - defaultv - the default (current) value 468 469 Output Parameter: 470 + value - the value to return 471 - flg - PETSC_TRUE if found, else PETSC_FALSE 472 473 Level: beginner 474 475 Concepts: options database^has int 476 477 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 478 479 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 480 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 481 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 482 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 483 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 484 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 485 PetscOptionsList(), PetscOptionsEList() 486 @*/ 487 PetscErrorCode PETSC_DLLEXPORT PetscOptionsScalar(const char opt[],const char text[],const char man[],PetscScalar defaultv,PetscScalar *value,PetscTruth *set) 488 { 489 PetscErrorCode ierr; 490 491 PetscFunctionBegin; 492 #if !defined(PETSC_USE_COMPLEX) 493 ierr = PetscOptionsReal(opt,text,man,defaultv,value,set);CHKERRQ(ierr); 494 #else 495 ierr = PetscOptionsGetScalar(PetscOptionsObject.prefix,opt,value,set);CHKERRQ(ierr); 496 #endif 497 PetscFunctionReturn(0); 498 } 499 500 /* 501 Publishes an AMS logical field (with the default value in it) and with a name 502 given by the text string 503 */ 504 #undef __FUNCT__ 505 #define __FUNCT__ "PetscOptionsName" 506 /*@C 507 PetscOptionsName - Determines if a particular option is in the database 508 509 Collective on the communicator passed in PetscOptionsBegin() 510 511 Input Parameters: 512 + opt - option name 513 . text - short string that describes the option 514 - man - manual page with additional information on option 515 516 Output Parameter: 517 . flg - PETSC_TRUE if found, else PETSC_FALSE 518 519 Level: beginner 520 521 Concepts: options database^has int 522 523 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 524 525 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 526 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 527 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 528 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 529 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 530 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 531 PetscOptionsList(), PetscOptionsEList() 532 @*/ 533 PetscErrorCode PETSC_DLLEXPORT PetscOptionsName(const char opt[],const char text[],const char man[],PetscTruth *flg) 534 { 535 PetscErrorCode ierr; 536 537 PetscFunctionBegin; 538 ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr); 539 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 540 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr); 541 } 542 PetscFunctionReturn(0); 543 } 544 545 #undef __FUNCT__ 546 #define __FUNCT__ "PetscOptionsList" 547 /*@C 548 PetscOptionsList - Puts a list of option values that a single one may be selected from 549 550 Collective on the communicator passed in PetscOptionsBegin() 551 552 Input Parameters: 553 + opt - option name 554 . text - short string that describes the option 555 . man - manual page with additional information on option 556 . list - the possible choices 557 - defaultv - the default (current) value 558 559 Output Parameter: 560 + value - the value to return 561 - set - PETSC_TRUE if found, else PETSC_FALSE 562 563 Level: intermediate 564 565 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 566 567 See PetscOptionsEList() for when the choices are given in a string array 568 569 To get a listing of all currently specified options, 570 see PetscOptionsPrint() or PetscOptionsGetAll() 571 572 Concepts: options database^list 573 574 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 575 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 576 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 577 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 578 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 579 PetscOptionsList(), PetscOptionsEList() 580 @*/ 581 PetscErrorCode PETSC_DLLEXPORT PetscOptionsList(const char opt[],const char ltext[],const char man[],PetscFList list,const char defaultv[],char value[],PetscInt len,PetscTruth *set) 582 { 583 PetscErrorCode ierr; 584 585 PetscFunctionBegin; 586 ierr = PetscOptionsGetString(PetscOptionsObject.prefix,opt,value,len,set);CHKERRQ(ierr); 587 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 588 ierr = PetscFListPrintTypes(list,PetscOptionsObject.comm,stdout,PetscOptionsObject.prefix,opt,ltext,man);CHKERRQ(ierr);CHKERRQ(ierr); 589 } 590 PetscFunctionReturn(0); 591 } 592 593 #undef __FUNCT__ 594 #define __FUNCT__ "PetscOptionsEList" 595 /*@C 596 PetscOptionsEList - Puts a list of option values that a single one may be selected from 597 598 Collective on the communicator passed in PetscOptionsBegin() 599 600 Input Parameters: 601 + opt - option name 602 . ltext - short string that describes the option 603 . man - manual page with additional information on option 604 . list - the possible choices 605 . ntext - number of choices 606 - defaultv - the default (current) value 607 608 Output Parameter: 609 + value - the index of the value to return 610 - set - PETSC_TRUE if found, else PETSC_FALSE 611 612 Level: intermediate 613 614 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 615 616 See PetscOptionsList() for when the choices are given in a PetscFList() 617 618 Concepts: options database^list 619 620 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 621 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 622 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 623 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 624 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 625 PetscOptionsList(), PetscOptionsEList() 626 @*/ 627 PetscErrorCode PETSC_DLLEXPORT PetscOptionsEList(const char opt[],const char ltext[],const char man[],const char **list,PetscInt ntext,const char defaultv[],PetscInt *value,PetscTruth *set) 628 { 629 PetscErrorCode ierr; 630 PetscInt i; 631 632 PetscFunctionBegin; 633 ierr = PetscOptionsGetEList(PetscOptionsObject.prefix,opt,list,ntext,value,set);CHKERRQ(ierr); 634 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 635 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <%s> (choose one of)",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,defaultv);CHKERRQ(ierr); 636 for (i=0; i<ntext; i++){ 637 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," %s",list[i]);CHKERRQ(ierr); 638 } 639 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,"\n");CHKERRQ(ierr); 640 } 641 PetscFunctionReturn(0); 642 } 643 644 #undef __FUNCT__ 645 #define __FUNCT__ "PetscOptionsTruthGroupBegin" 646 /*@C 647 PetscOptionsTruthGroupBegin - First in a series of logical queries on the options database for 648 which only a single value can be true. 649 650 Collective on the communicator passed in PetscOptionsBegin() 651 652 Input Parameters: 653 + opt - option name 654 . text - short string that describes the option 655 - man - manual page with additional information on option 656 657 Output Parameter: 658 . flg - whether that option was set or not 659 660 Level: intermediate 661 662 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 663 664 Must be followed by 0 or more PetscOptionsTruthGroup()s and PetscOptionsTruthGroupEnd() 665 666 Concepts: options database^logical group 667 668 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 669 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 670 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 671 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 672 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 673 PetscOptionsList(), PetscOptionsEList() 674 @*/ 675 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroupBegin(const char opt[],const char text[],const char man[],PetscTruth *flg) 676 { 677 PetscErrorCode ierr; 678 679 PetscFunctionBegin; 680 ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr); 681 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 682 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," Pick at most one of -------------\n");CHKERRQ(ierr); 683 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr); 684 } 685 PetscFunctionReturn(0); 686 } 687 688 #undef __FUNCT__ 689 #define __FUNCT__ "PetscOptionsTruthGroup" 690 /*@C 691 PetscOptionsTruthGroup - One in a series of logical queries on the options database for 692 which only a single value can be true. 693 694 Collective on the communicator passed in PetscOptionsBegin() 695 696 Input Parameters: 697 + opt - option name 698 . text - short string that describes the option 699 - man - manual page with additional information on option 700 701 Output Parameter: 702 . flg - PETSC_TRUE if found, else PETSC_FALSE 703 704 Level: intermediate 705 706 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 707 708 Must follow a PetscOptionsTruthGroupBegin() and preceded a PetscOptionsTruthGroupEnd() 709 710 Concepts: options database^logical group 711 712 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 713 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 714 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 715 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 716 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 717 PetscOptionsList(), PetscOptionsEList() 718 @*/ 719 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroup(const char opt[],const char text[],const char man[],PetscTruth *flg) 720 { 721 PetscErrorCode ierr; 722 723 PetscFunctionBegin; 724 ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr); 725 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 726 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr); 727 } 728 PetscFunctionReturn(0); 729 } 730 731 #undef __FUNCT__ 732 #define __FUNCT__ "PetscOptionsTruthGroupEnd" 733 /*@C 734 PetscOptionsTruthGroupEnd - Last in a series of logical queries on the options database for 735 which only a single value can be true. 736 737 Collective on the communicator passed in PetscOptionsBegin() 738 739 Input Parameters: 740 + opt - option name 741 . text - short string that describes the option 742 - man - manual page with additional information on option 743 744 Output Parameter: 745 . flg - PETSC_TRUE if found, else PETSC_FALSE 746 747 Level: intermediate 748 749 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 750 751 Must follow a PetscOptionsTruthGroupBegin() 752 753 Concepts: options database^logical group 754 755 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 756 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 757 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 758 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 759 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 760 PetscOptionsList(), PetscOptionsEList() 761 @*/ 762 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruthGroupEnd(const char opt[],const char text[],const char man[],PetscTruth *flg) 763 { 764 PetscErrorCode ierr; 765 766 PetscFunctionBegin; 767 ierr = PetscOptionsHasName(PetscOptionsObject.prefix,opt,flg);CHKERRQ(ierr); 768 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 769 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr); 770 } 771 PetscFunctionReturn(0); 772 } 773 774 #undef __FUNCT__ 775 #define __FUNCT__ "PetscOptionsTruth" 776 /*@C 777 PetscOptionsTruth - Determines if a particular option is in the database with a true or false 778 779 Collective on the communicator passed in PetscOptionsBegin() 780 781 Input Parameters: 782 + opt - option name 783 . text - short string that describes the option 784 - man - manual page with additional information on option 785 786 Output Parameter: 787 . flg - PETSC_TRUE or PETSC_FALSE 788 . set - PETSC_TRUE if found, else PETSC_FALSE 789 790 Level: beginner 791 792 Concepts: options database^logical 793 794 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 795 796 .seealso: PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetInt(), 797 PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth() 798 PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsTruth(), 799 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 800 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 801 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 802 PetscOptionsList(), PetscOptionsEList() 803 @*/ 804 PetscErrorCode PETSC_DLLEXPORT PetscOptionsTruth(const char opt[],const char text[],const char man[],PetscTruth deflt,PetscTruth *flg,PetscTruth *set) 805 { 806 PetscErrorCode ierr; 807 PetscTruth iset; 808 809 PetscFunctionBegin; 810 ierr = PetscOptionsGetTruth(PetscOptionsObject.prefix,opt,flg,&iset);CHKERRQ(ierr); 811 if (!iset) { 812 if (flg) *flg = deflt; 813 } 814 if (set) *set = iset; 815 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 816 const char *v = PetscTruths[deflt]; 817 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s: <%s> %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,v,text,man);CHKERRQ(ierr); 818 } 819 PetscFunctionReturn(0); 820 } 821 822 #undef __FUNCT__ 823 #define __FUNCT__ "PetscOptionsRealArray" 824 /*@C 825 PetscOptionsRealArray - Gets an array of double values for a particular 826 option in the database. The values must be separated with commas with 827 no intervening spaces. 828 829 Collective on the communicator passed in PetscOptionsBegin() 830 831 Input Parameters: 832 + opt - the option one is seeking 833 . text - short string describing option 834 . man - manual page for option 835 - nmax - maximum number of values 836 837 Output Parameter: 838 + value - location to copy values 839 . nmax - actual number of values found 840 - set - PETSC_TRUE if found, else PETSC_FALSE 841 842 Level: beginner 843 844 Notes: 845 The user should pass in an array of doubles 846 847 Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 848 849 Concepts: options database^array of strings 850 851 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 852 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 853 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 854 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 855 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 856 PetscOptionsList(), PetscOptionsEList() 857 @*/ 858 PetscErrorCode PETSC_DLLEXPORT PetscOptionsRealArray(const char opt[],const char text[],const char man[],PetscReal value[],PetscInt *n,PetscTruth *set) 859 { 860 PetscErrorCode ierr; 861 PetscInt i; 862 863 PetscFunctionBegin; 864 ierr = PetscOptionsGetRealArray(PetscOptionsObject.prefix,opt,value,n,set);CHKERRQ(ierr); 865 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 866 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <%G",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,value[0]);CHKERRQ(ierr); 867 for (i=1; i<*n; i++) { 868 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,",%G",value[i]);CHKERRQ(ierr); 869 } 870 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,">: %s (%s)\n",text,man);CHKERRQ(ierr); 871 } 872 PetscFunctionReturn(0); 873 } 874 875 876 #undef __FUNCT__ 877 #define __FUNCT__ "PetscOptionsIntArray" 878 /*@C 879 PetscOptionsIntArray - Gets an array of integers for a particular 880 option in the database. The values must be separated with commas with 881 no intervening spaces. 882 883 Collective on the communicator passed in PetscOptionsBegin() 884 885 Input Parameters: 886 + opt - the option one is seeking 887 . text - short string describing option 888 . man - manual page for option 889 - nmax - maximum number of values 890 891 Output Parameter: 892 + value - location to copy values 893 . nmax - actual number of values found 894 - set - PETSC_TRUE if found, else PETSC_FALSE 895 896 Level: beginner 897 898 Notes: 899 The user should pass in an array of integers 900 901 Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 902 903 Concepts: options database^array of strings 904 905 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 906 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 907 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 908 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 909 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 910 PetscOptionsList(), PetscOptionsEList(), PetscOptionsRealArray() 911 @*/ 912 PetscErrorCode PETSC_DLLEXPORT PetscOptionsIntArray(const char opt[],const char text[],const char man[],PetscInt value[],PetscInt *n,PetscTruth *set) 913 { 914 PetscErrorCode ierr; 915 PetscInt i; 916 917 PetscFunctionBegin; 918 ierr = PetscOptionsGetIntArray(PetscOptionsObject.prefix,opt,value,n,set);CHKERRQ(ierr); 919 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 920 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <%d",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,value[0]);CHKERRQ(ierr); 921 for (i=1; i<*n; i++) { 922 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,",%d",value[i]);CHKERRQ(ierr); 923 } 924 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm,">: %s (%s)\n",text,man);CHKERRQ(ierr); 925 } 926 PetscFunctionReturn(0); 927 } 928 929 #undef __FUNCT__ 930 #define __FUNCT__ "PetscOptionsStringArray" 931 /*@C 932 PetscOptionsStringArray - Gets an array of string values for a particular 933 option in the database. The values must be separated with commas with 934 no intervening spaces. 935 936 Collective on the communicator passed in PetscOptionsBegin() 937 938 Input Parameters: 939 + opt - the option one is seeking 940 . text - short string describing option 941 . man - manual page for option 942 - nmax - maximum number of strings 943 944 Output Parameter: 945 + value - location to copy strings 946 . nmax - actual number of strings found 947 - set - PETSC_TRUE if found, else PETSC_FALSE 948 949 Level: beginner 950 951 Notes: 952 The user should pass in an array of pointers to char, to hold all the 953 strings returned by this function. 954 955 The user is responsible for deallocating the strings that are 956 returned. The Fortran interface for this routine is not supported. 957 958 Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 959 960 Concepts: options database^array of strings 961 962 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 963 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 964 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 965 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 966 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 967 PetscOptionsList(), PetscOptionsEList() 968 @*/ 969 PetscErrorCode PETSC_DLLEXPORT PetscOptionsStringArray(const char opt[],const char text[],const char man[],char *value[],PetscInt *nmax,PetscTruth *set) 970 { 971 PetscErrorCode ierr; 972 973 PetscFunctionBegin; 974 ierr = PetscOptionsGetStringArray(PetscOptionsObject.prefix,opt,value,nmax,set);CHKERRQ(ierr); 975 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 976 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," -%s%s <string1,string2,...>: %s (%s)\n",PetscOptionsObject.prefix?PetscOptionsObject.prefix:"",opt+1,text,man);CHKERRQ(ierr); 977 } 978 PetscFunctionReturn(0); 979 } 980 981 982 #undef __FUNCT__ 983 #define __FUNCT__ "PetscOptionsHead" 984 /*@C 985 PetscOptionsHead - Puts a heading before listing any more published options. Used, for example, 986 in KSPSetFromOptions_GMRES(). 987 988 Collective on the communicator passed in PetscOptionsBegin() 989 990 Input Parameter: 991 . head - the heading text 992 993 994 Level: intermediate 995 996 Notes: Must be between a PetscOptionsBegin() and a PetscOptionsEnd() 997 998 Can be followed by a call to PetscOptionsTail() in the same function. 999 1000 Concepts: options database^subheading 1001 1002 .seealso: PetscOptionsGetInt(), PetscOptionsGetReal(), 1003 PetscOptionsHasName(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsTruth(), 1004 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), 1005 PetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), 1006 PetscOptionsTruthGroupBegin(), PetscOptionsTruthGroup(), PetscOptionsTruthGroupEnd(), 1007 PetscOptionsList(), PetscOptionsEList() 1008 @*/ 1009 PetscErrorCode PETSC_DLLEXPORT PetscOptionsHead(const char head[]) 1010 { 1011 PetscErrorCode ierr; 1012 1013 PetscFunctionBegin; 1014 if (PetscOptionsObject.printhelp && PetscOptionsPublishCount == 1 && !PetscOptionsObject.alreadyprinted) { 1015 ierr = (*PetscHelpPrintf)(PetscOptionsObject.comm," %s\n",head);CHKERRQ(ierr); 1016 } 1017 PetscFunctionReturn(0); 1018 } 1019 1020 1021 1022 1023 1024 1025