| options.c (685405a154face4053b328dd001218e74e413191) | options.c (bebe2cf65d55febe21a5af8db2bd2e168caaa2e7) |
|---|---|
| 1 2/* Define Feature test macros to make sure atoll is available (SVr4, POSIX.1-2001, 4.3BSD, C99), not in (C89 and POSIX.1-1996) */ 3#define PETSC_DESIRE_FEATURE_TEST_MACROS 4 5/* 6 These routines simplify the use of command line, file options, etc., and are used to manipulate the options database. 7 This provides the low-level interface, the high level interface is in aoptions.c 8 --- 1969 unchanged lines hidden (view full) --- 1978+ dvalue - the integer values to return 1979. nmax - actual number of values retreived 1980- set - PETSC_TRUE if found, else PETSC_FALSE 1981 1982 Level: beginner 1983 1984 Notes: 1985 The array can be passed as | 1 2/* Define Feature test macros to make sure atoll is available (SVr4, POSIX.1-2001, 4.3BSD, C99), not in (C89 and POSIX.1-1996) */ 3#define PETSC_DESIRE_FEATURE_TEST_MACROS 4 5/* 6 These routines simplify the use of command line, file options, etc., and are used to manipulate the options database. 7 This provides the low-level interface, the high level interface is in aoptions.c 8 --- 1969 unchanged lines hidden (view full) --- 1978+ dvalue - the integer values to return 1979. nmax - actual number of values retreived 1980- set - PETSC_TRUE if found, else PETSC_FALSE 1981 1982 Level: beginner 1983 1984 Notes: 1985 The array can be passed as |
| 1986 a comma seperated list: 0,1,2,3,4,5,6,7 | 1986 a comma separated list: 0,1,2,3,4,5,6,7 |
| 1987 a range (start-end+1): 0-8 1988 a range with given increment (start-end+1:inc): 0-7:2 | 1987 a range (start-end+1): 0-8 1988 a range with given increment (start-end+1:inc): 0-7:2 |
| 1989 a combination of values and ranges seperated by commas: 0,1-8,8-15:2 | 1989 a combination of values and ranges separated by commas: 0,1-8,8-15:2 |
| 1990 1991 There must be no intervening spaces between the values. 1992 1993 Concepts: options database^array of ints 1994 1995.seealso: PetscOptionsGetInt(), PetscOptionsHasName(), 1996 PetscOptionsGetString(), PetscOptionsGetRealArray(), PetscOptionsBool(), 1997 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), --- 598 unchanged lines hidden (view full) --- 2596#define __FUNCT__ "PetscObjectViewFromOptions" 2597/*@C 2598 PetscObjectViewFromOptions - Processes command line options to determine if/how a PetscObject is to be viewed. 2599 2600 Collective on PetscObject 2601 2602 Input Parameters: 2603+ obj - the object | 1990 1991 There must be no intervening spaces between the values. 1992 1993 Concepts: options database^array of ints 1994 1995.seealso: PetscOptionsGetInt(), PetscOptionsHasName(), 1996 PetscOptionsGetString(), PetscOptionsGetRealArray(), PetscOptionsBool(), 1997 PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), --- 598 unchanged lines hidden (view full) --- 2596#define __FUNCT__ "PetscObjectViewFromOptions" 2597/*@C 2598 PetscObjectViewFromOptions - Processes command line options to determine if/how a PetscObject is to be viewed. 2599 2600 Collective on PetscObject 2601 2602 Input Parameters: 2603+ obj - the object |
| 2604. bobj - optional other object that provides prefix (if NULL then the prefix in obj is used) | 2604. prefix - prefix to use for viewing, or NULL to use the prefix of obj |
| 2605- optionname - option to activate viewing 2606 2607 Level: intermediate 2608 2609@*/ | 2605- optionname - option to activate viewing 2606 2607 Level: intermediate 2608 2609@*/ |
| 2610PetscErrorCode PetscObjectViewFromOptions(PetscObject obj,PetscObject bobj,const char optionname[]) | 2610PetscErrorCode PetscObjectViewFromOptions(PetscObject obj,const char prefix[],const char optionname[]) |
| 2611{ 2612 PetscErrorCode ierr; 2613 PetscViewer viewer; 2614 PetscBool flg; 2615 static PetscBool incall = PETSC_FALSE; 2616 PetscViewerFormat format; | 2611{ 2612 PetscErrorCode ierr; 2613 PetscViewer viewer; 2614 PetscBool flg; 2615 static PetscBool incall = PETSC_FALSE; 2616 PetscViewerFormat format; |
| 2617 char *prefix; | |
| 2618 2619 PetscFunctionBegin; 2620 if (incall) PetscFunctionReturn(0); 2621 incall = PETSC_TRUE; | 2617 2618 PetscFunctionBegin; 2619 if (incall) PetscFunctionReturn(0); 2620 incall = PETSC_TRUE; |
| 2622 prefix = bobj ? bobj->prefix : obj->prefix; | 2621 if (!prefix) prefix = ((PetscObject)obj)->prefix; |
| 2623 ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)obj),prefix,optionname,&viewer,&format,&flg);CHKERRQI(incall,ierr); 2624 if (flg) { 2625 ierr = PetscViewerPushFormat(viewer,format);CHKERRQI(incall,ierr); 2626 ierr = PetscObjectView(obj,viewer);CHKERRQI(incall,ierr); 2627 ierr = PetscViewerPopFormat(viewer);CHKERRQI(incall,ierr); 2628 ierr = PetscViewerDestroy(&viewer);CHKERRQI(incall,ierr); 2629 } 2630 incall = PETSC_FALSE; 2631 PetscFunctionReturn(0); 2632} | 2622 ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)obj),prefix,optionname,&viewer,&format,&flg);CHKERRQI(incall,ierr); 2623 if (flg) { 2624 ierr = PetscViewerPushFormat(viewer,format);CHKERRQI(incall,ierr); 2625 ierr = PetscObjectView(obj,viewer);CHKERRQI(incall,ierr); 2626 ierr = PetscViewerPopFormat(viewer);CHKERRQI(incall,ierr); 2627 ierr = PetscViewerDestroy(&viewer);CHKERRQI(incall,ierr); 2628 } 2629 incall = PETSC_FALSE; 2630 PetscFunctionReturn(0); 2631} |