LCOV - code coverage report
Current view: top level - lme/interface - lmeopts.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 135 141 95.7 %
Date: 2019-11-15 09:58:42 Functions: 13 13 100.0 %

          Line data    Source code
       1             : /*
       2             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       3             :    SLEPc - Scalable Library for Eigenvalue Problem Computations
       4             :    Copyright (c) 2002-2019, Universitat Politecnica de Valencia, Spain
       5             : 
       6             :    This file is part of SLEPc.
       7             :    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
       8             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       9             : */
      10             : /*
      11             :    LME routines related to options that can be set via the command-line
      12             :    or procedurally
      13             : */
      14             : 
      15             : #include <slepc/private/lmeimpl.h>   /*I "slepclme.h" I*/
      16             : #include <petscdraw.h>
      17             : 
      18             : /*@C
      19             :    LMEMonitorSetFromOptions - Sets a monitor function and viewer appropriate for the type
      20             :    indicated by the user.
      21             : 
      22             :    Collective on lme
      23             : 
      24             :    Input Parameters:
      25             : +  lme      - the eigensolver context
      26             : .  name     - the monitor option name
      27             : .  help     - message indicating what monitoring is done
      28             : .  manual   - manual page for the monitor
      29             : -  monitor  - the monitor function, whose context is a PetscViewerAndFormat
      30             : 
      31             :    Level: developer
      32             : 
      33             : .seealso: LMEMonitorSet()
      34             : @*/
      35           5 : PetscErrorCode LMEMonitorSetFromOptions(LME lme,const char name[],const char help[],const char manual[],PetscErrorCode (*monitor)(LME,PetscInt,PetscReal,PetscViewerAndFormat*))
      36             : {
      37             :   PetscErrorCode       ierr;
      38             :   PetscBool            flg;
      39             :   PetscViewer          viewer;
      40             :   PetscViewerFormat    format;
      41             :   PetscViewerAndFormat *vf;
      42             : 
      43           5 :   PetscFunctionBegin;
      44           5 :   ierr = PetscOptionsGetViewer(PetscObjectComm((PetscObject)lme),((PetscObject)lme)->options,((PetscObject)lme)->prefix,name,&viewer,&format,&flg);CHKERRQ(ierr);
      45           5 :   if (flg) {
      46           1 :     ierr = PetscViewerAndFormatCreate(viewer,format,&vf);CHKERRQ(ierr);
      47           1 :     ierr = PetscObjectDereference((PetscObject)viewer);CHKERRQ(ierr);
      48           1 :     ierr = LMEMonitorSet(lme,(PetscErrorCode (*)(LME,PetscInt,PetscReal,void*))monitor,vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);CHKERRQ(ierr);
      49             :   }
      50           5 :   PetscFunctionReturn(0);
      51             : }
      52             : 
      53             : /*@
      54             :    LMESetFromOptions - Sets LME options from the options database.
      55             :    This routine must be called before LMESetUp() if the user is to be
      56             :    allowed to set the solver type.
      57             : 
      58             :    Collective on lme
      59             : 
      60             :    Input Parameters:
      61             : .  lme - the linear matrix equation solver context
      62             : 
      63             :    Notes:
      64             :    To see all options, run your program with the -help option.
      65             : 
      66             :    Level: beginner
      67             : @*/
      68           5 : PetscErrorCode LMESetFromOptions(LME lme)
      69             : {
      70             :   PetscErrorCode ierr;
      71             :   char           type[256];
      72             :   PetscBool      set,flg,flg1,flg2;
      73             :   PetscReal      r;
      74             :   PetscInt       i;
      75             :   PetscDrawLG    lg;
      76             : 
      77           5 :   PetscFunctionBegin;
      78           5 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
      79           5 :   ierr = LMERegisterAll();CHKERRQ(ierr);
      80          10 :   ierr = PetscObjectOptionsBegin((PetscObject)lme);CHKERRQ(ierr);
      81           5 :     ierr = PetscOptionsFList("-lme_type","Linear matrix equation","LMESetType",LMEList,(char*)(((PetscObject)lme)->type_name?((PetscObject)lme)->type_name:LMEKRYLOV),type,256,&flg);CHKERRQ(ierr);
      82           5 :     if (flg) {
      83           0 :       ierr = LMESetType(lme,type);CHKERRQ(ierr);
      84           5 :     } else if (!((PetscObject)lme)->type_name) {
      85           5 :       ierr = LMESetType(lme,LMEKRYLOV);CHKERRQ(ierr);
      86             :     }
      87             : 
      88           5 :     ierr = PetscOptionsBoolGroupBegin("-lme_lyapunov","Continuous-time Lyapunov equation","LMESetProblemType",&flg);CHKERRQ(ierr);
      89           5 :     if (flg) { ierr = LMESetProblemType(lme,LME_LYAPUNOV);CHKERRQ(ierr); }
      90           5 :     ierr = PetscOptionsBoolGroup("-lme_sylvester","Continuous-time Sylvester equation","LMESetProblemType",&flg);CHKERRQ(ierr);
      91           5 :     if (flg) { ierr = LMESetProblemType(lme,LME_SYLVESTER);CHKERRQ(ierr); }
      92           5 :     ierr = PetscOptionsBoolGroup("-lme_gen_lyapunov","Generalized Lyapunov equation","LMESetProblemType",&flg);CHKERRQ(ierr);
      93           5 :     if (flg) { ierr = LMESetProblemType(lme,LME_GEN_LYAPUNOV);CHKERRQ(ierr); }
      94           5 :     ierr = PetscOptionsBoolGroup("-lme_gen_sylvester","Generalized Sylvester equation","LMESetProblemType",&flg);CHKERRQ(ierr);
      95           5 :     if (flg) { ierr = LMESetProblemType(lme,LME_GEN_SYLVESTER);CHKERRQ(ierr); }
      96           5 :     ierr = PetscOptionsBoolGroup("-lme_dt_lyapunov","Discrete-time Lyapunov equation","LMESetProblemType",&flg);CHKERRQ(ierr);
      97           5 :     if (flg) { ierr = LMESetProblemType(lme,LME_DT_LYAPUNOV);CHKERRQ(ierr); }
      98           5 :     ierr = PetscOptionsBoolGroupEnd("-lme_stein","Stein equation","LMESetProblemType",&flg);CHKERRQ(ierr);
      99           5 :     if (flg) { ierr = LMESetProblemType(lme,LME_STEIN);CHKERRQ(ierr); }
     100             : 
     101           5 :     i = lme->max_it;
     102           5 :     ierr = PetscOptionsInt("-lme_max_it","Maximum number of iterations","LMESetTolerances",lme->max_it,&i,&flg1);CHKERRQ(ierr);
     103           5 :     if (!flg1) i = PETSC_DEFAULT;
     104           5 :     r = lme->tol;
     105           5 :     ierr = PetscOptionsReal("-lme_tol","Tolerance","LMESetTolerances",lme->tol==PETSC_DEFAULT?SLEPC_DEFAULT_TOL:lme->tol,&r,&flg2);CHKERRQ(ierr);
     106           5 :     if (flg1 || flg2) { ierr = LMESetTolerances(lme,r,i);CHKERRQ(ierr); }
     107             : 
     108           5 :     ierr = PetscOptionsInt("-lme_ncv","Number of basis vectors","LMESetDimensions",lme->ncv,&i,&flg);CHKERRQ(ierr);
     109           5 :     if (flg) { ierr = LMESetDimensions(lme,i);CHKERRQ(ierr); }
     110             : 
     111           5 :     ierr = PetscOptionsBool("-lme_error_if_not_converged","Generate error if solver does not converge","LMESetErrorIfNotConverged",lme->errorifnotconverged,&lme->errorifnotconverged,NULL);CHKERRQ(ierr);
     112             : 
     113             :     /* -----------------------------------------------------------------------*/
     114             :     /*
     115             :       Cancels all monitors hardwired into code before call to LMESetFromOptions()
     116             :     */
     117           5 :     ierr = PetscOptionsBool("-lme_monitor_cancel","Remove any hardwired monitor routines","LMEMonitorCancel",PETSC_FALSE,&flg,&set);CHKERRQ(ierr);
     118           5 :     if (set && flg) {
     119           2 :       ierr = LMEMonitorCancel(lme);CHKERRQ(ierr);
     120             :     }
     121             :     /*
     122             :       Text monitors
     123             :     */
     124           5 :     ierr = LMEMonitorSetFromOptions(lme,"-lme_monitor","Monitor error estimate","LMEMonitorDefault",LMEMonitorDefault);CHKERRQ(ierr);
     125             :     /*
     126             :       Line graph monitors
     127             :     */
     128           5 :     ierr = PetscOptionsBool("-lme_monitor_lg","Monitor error estimate graphically","LMEMonitorSet",PETSC_FALSE,&flg,&set);CHKERRQ(ierr);
     129           5 :     if (set && flg) {
     130           0 :       ierr = LMEMonitorLGCreate(PetscObjectComm((PetscObject)lme),NULL,"Error estimate",PETSC_DECIDE,PETSC_DECIDE,300,300,&lg);CHKERRQ(ierr);
     131           0 :       ierr = LMEMonitorSet(lme,LMEMonitorLG,lg,(PetscErrorCode (*)(void**))PetscDrawLGDestroy);CHKERRQ(ierr);
     132             :     }
     133             : 
     134             :     /* -----------------------------------------------------------------------*/
     135           5 :     ierr = PetscOptionsName("-lme_view","Print detailed information on solver used","LMEView",NULL);CHKERRQ(ierr);
     136             : 
     137           5 :     if (lme->ops->setfromoptions) {
     138           0 :       ierr = (*lme->ops->setfromoptions)(PetscOptionsObject,lme);CHKERRQ(ierr);
     139             :     }
     140           5 :     ierr = PetscObjectProcessOptionsHandlers(PetscOptionsObject,(PetscObject)lme);CHKERRQ(ierr);
     141          10 :   ierr = PetscOptionsEnd();CHKERRQ(ierr);
     142             : 
     143           5 :   if (!lme->V) { ierr = LMEGetBV(lme,&lme->V);CHKERRQ(ierr); }
     144           5 :   ierr = BVSetFromOptions(lme->V);CHKERRQ(ierr);
     145           5 :   PetscFunctionReturn(0);
     146             : }
     147             : 
     148             : /*@
     149             :    LMESetProblemType - Specifies the type of matrix equation to be solved.
     150             : 
     151             :    Logically Collective on lme
     152             : 
     153             :    Input Parameters:
     154             : +  lme  - the linear matrix equation solver context
     155             : -  type - a known type of matrix equation
     156             : 
     157             :    Options Database Keys:
     158             : +  -lme_lyapunov - continuous-time Lyapunov equation A*X+X*A'=-C
     159             : .  -lme_sylvester - continuous-time Sylvester equation A*X+X*B=C
     160             : .  -lme_gen_lyapunov - generalized Lyapunov equation A*X*D'+D*X*A'=-C
     161             : .  -lme_gen_sylvester - generalized Sylvester equation A*X*E+D*X*B=C
     162             : .  -lme_dt_lyapunov - discrete-time Lyapunov equation A*X*A'-X=-C
     163             : -  -lme_stein - Stein equation A*X*E+X=C
     164             : 
     165             :    Notes:
     166             :    The coefficient matrices A, B, D, E must be provided via LMESetCoefficients(),
     167             :    but some of them are optional depending on the matrix equation.
     168             : 
     169             : .vb
     170             :                             equation              A    B    D    E
     171             :                           -----------------      ---  ---  ---  ---
     172             :        LME_LYAPUNOV        A*X+X*A'=-C           yes (A-t)  -    -
     173             :        LME_SYLVESTER       A*X+X*B=C             yes  yes   -    -
     174             :        LME_GEN_LYAPUNOV    A*X*D'+D*X*A'=-C      yes (A-t) yes (D-t)
     175             :        LME_GEN_SYLVESTER   A*X*E+D*X*B=C         yes  yes  yes  yes
     176             :        LME_DT_LYAPUNOV     A*X*A'-X=-C           yes   -    -  (A-t)
     177             :        LME_STEIN           A*X*E+X=C             yes   -    -   yes
     178             : .ve
     179             : 
     180             :    In the above table, the notation (A-t) means that this matrix need
     181             :    not be passed, but the user may choose to pass an explicit transpose
     182             :    of matrix A (for improved efficiency).
     183             : 
     184             :    Also note that some of the equation types impose restrictions on the
     185             :    properties of the coefficient matrices and possibly on the right-hand
     186             :    side C.
     187             : 
     188             :    Level: beginner
     189             : 
     190             : .seealso: LMESetCoefficients(), LMESetType(), LMEGetProblemType(), LMEProblemType
     191             : @*/
     192           8 : PetscErrorCode LMESetProblemType(LME lme,LMEProblemType type)
     193             : {
     194           8 :   PetscFunctionBegin;
     195           8 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     196          16 :   PetscValidLogicalCollectiveEnum(lme,type,2);
     197          10 :   if (type == lme->problem_type) PetscFunctionReturn(0);
     198           6 :   switch (type) {
     199             :     case LME_LYAPUNOV:
     200             :     case LME_SYLVESTER:
     201             :     case LME_GEN_LYAPUNOV:
     202             :     case LME_GEN_SYLVESTER:
     203             :     case LME_DT_LYAPUNOV:
     204             :     case LME_STEIN:
     205             :       break;
     206             :     default:
     207           0 :       SETERRQ(PetscObjectComm((PetscObject)lme),PETSC_ERR_ARG_WRONG,"Unknown matrix equation type");
     208             :   }
     209           6 :   lme->problem_type = type;
     210           6 :   lme->setupcalled  = PETSC_FALSE;
     211           6 :   PetscFunctionReturn(0);
     212             : }
     213             : 
     214             : /*@
     215             :    LMEGetProblemType - Gets the matrix equation type from the LME object.
     216             : 
     217             :    Not Collective
     218             : 
     219             :    Input Parameter:
     220             : .  lme - the linear matrix equation solver context
     221             : 
     222             :    Output Parameter:
     223             : .  type - name of LME problem type
     224             : 
     225             :    Level: intermediate
     226             : 
     227             : .seealso: LMESetProblemType(), LMEProblemType
     228             : @*/
     229           6 : PetscErrorCode LMEGetProblemType(LME lme,LMEProblemType *type)
     230             : {
     231           6 :   PetscFunctionBegin;
     232           6 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     233           6 :   PetscValidPointer(type,2);
     234           6 :   *type = lme->problem_type;
     235           6 :   PetscFunctionReturn(0);
     236             : }
     237             : 
     238             : /*@C
     239             :    LMEGetTolerances - Gets the tolerance and maximum iteration count used
     240             :    by the LME convergence tests.
     241             : 
     242             :    Not Collective
     243             : 
     244             :    Input Parameter:
     245             : .  lme - the linear matrix equation solver context
     246             : 
     247             :    Output Parameters:
     248             : +  tol - the convergence tolerance
     249             : -  maxits - maximum number of iterations
     250             : 
     251             :    Notes:
     252             :    The user can specify NULL for any parameter that is not needed.
     253             : 
     254             :    Level: intermediate
     255             : 
     256             : .seealso: LMESetTolerances()
     257             : @*/
     258           5 : PetscErrorCode LMEGetTolerances(LME lme,PetscReal *tol,PetscInt *maxits)
     259             : {
     260           5 :   PetscFunctionBegin;
     261           5 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     262           5 :   if (tol)    *tol    = lme->tol;
     263           5 :   if (maxits) *maxits = lme->max_it;
     264           5 :   PetscFunctionReturn(0);
     265             : }
     266             : 
     267             : /*@
     268             :    LMESetTolerances - Sets the tolerance and maximum iteration count used
     269             :    by the LME convergence tests.
     270             : 
     271             :    Logically Collective on lme
     272             : 
     273             :    Input Parameters:
     274             : +  lme - the linear matrix equation solver context
     275             : .  tol - the convergence tolerance
     276             : -  maxits - maximum number of iterations to use
     277             : 
     278             :    Options Database Keys:
     279             : +  -lme_tol <tol> - Sets the convergence tolerance
     280             : -  -lme_max_it <maxits> - Sets the maximum number of iterations allowed
     281             : 
     282             :    Notes:
     283             :    Use PETSC_DEFAULT for either argument to assign a reasonably good value.
     284             : 
     285             :    Level: intermediate
     286             : 
     287             : .seealso: LMEGetTolerances()
     288             : @*/
     289           5 : PetscErrorCode LMESetTolerances(LME lme,PetscReal tol,PetscInt maxits)
     290             : {
     291           5 :   PetscFunctionBegin;
     292           5 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     293          10 :   PetscValidLogicalCollectiveReal(lme,tol,2);
     294          15 :   PetscValidLogicalCollectiveInt(lme,maxits,3);
     295           5 :   if (tol == PETSC_DEFAULT) {
     296           3 :     lme->tol = PETSC_DEFAULT;
     297           3 :     lme->setupcalled = 0;
     298             :   } else {
     299           2 :     if (tol <= 0.0) SETERRQ(PetscObjectComm((PetscObject)lme),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
     300           2 :     lme->tol = tol;
     301             :   }
     302           5 :   if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
     303           2 :     lme->max_it = 0;
     304           2 :     lme->setupcalled = 0;
     305             :   } else {
     306           3 :     if (maxits <= 0) SETERRQ(PetscObjectComm((PetscObject)lme),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
     307           3 :     lme->max_it = maxits;
     308             :   }
     309           5 :   PetscFunctionReturn(0);
     310             : }
     311             : 
     312             : /*@
     313             :    LMEGetDimensions - Gets the dimension of the subspace used by the solver.
     314             : 
     315             :    Not Collective
     316             : 
     317             :    Input Parameter:
     318             : .  lme - the linear matrix equation solver context
     319             : 
     320             :    Output Parameter:
     321             : .  ncv - the maximum dimension of the subspace to be used by the solver
     322             : 
     323             :    Level: intermediate
     324             : 
     325             : .seealso: LMESetDimensions()
     326             : @*/
     327           5 : PetscErrorCode LMEGetDimensions(LME lme,PetscInt *ncv)
     328             : {
     329           5 :   PetscFunctionBegin;
     330           5 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     331           5 :   PetscValidIntPointer(ncv,2);
     332           5 :   *ncv = lme->ncv;
     333           5 :   PetscFunctionReturn(0);
     334             : }
     335             : 
     336             : /*@
     337             :    LMESetDimensions - Sets the dimension of the subspace to be used by the solver.
     338             : 
     339             :    Logically Collective on lme
     340             : 
     341             :    Input Parameters:
     342             : +  lme - the linear matrix equation solver context
     343             : -  ncv - the maximum dimension of the subspace to be used by the solver
     344             : 
     345             :    Options Database Keys:
     346             : .  -lme_ncv <ncv> - Sets the dimension of the subspace
     347             : 
     348             :    Notes:
     349             :    Use PETSC_DEFAULT for ncv to assign a reasonably good value, which is
     350             :    dependent on the solution method.
     351             : 
     352             :    Level: intermediate
     353             : 
     354             : .seealso: LMEGetDimensions()
     355             : @*/
     356           3 : PetscErrorCode LMESetDimensions(LME lme,PetscInt ncv)
     357             : {
     358           3 :   PetscFunctionBegin;
     359           3 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     360           6 :   PetscValidLogicalCollectiveInt(lme,ncv,2);
     361           3 :   if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
     362           0 :     lme->ncv = 0;
     363             :   } else {
     364           3 :     if (ncv<1) SETERRQ(PetscObjectComm((PetscObject)lme),PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
     365           3 :     lme->ncv = ncv;
     366             :   }
     367           3 :   lme->setupcalled = 0;
     368           3 :   PetscFunctionReturn(0);
     369             : }
     370             : 
     371             : /*@
     372             :    LMESetErrorIfNotConverged - Causes LMESolve() to generate an error if the
     373             :    solver has not converged.
     374             : 
     375             :    Logically Collective on lme
     376             : 
     377             :    Input Parameters:
     378             : +  lme - the linear matrix equation solver context
     379             : -  flg - PETSC_TRUE indicates you want the error generated
     380             : 
     381             :    Options Database Keys:
     382             : .  -lme_error_if_not_converged - this takes an optional truth value (0/1/no/yes/true/false)
     383             : 
     384             :    Level: intermediate
     385             : 
     386             :    Note:
     387             :    Normally SLEPc continues if the solver fails to converge, you can call
     388             :    LMEGetConvergedReason() after a LMESolve() to determine if it has converged.
     389             : 
     390             : .seealso: LMEGetErrorIfNotConverged()
     391             : @*/
     392           3 : PetscErrorCode LMESetErrorIfNotConverged(LME lme,PetscBool flg)
     393             : {
     394           3 :   PetscFunctionBegin;
     395           3 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     396           6 :   PetscValidLogicalCollectiveBool(lme,flg,2);
     397           3 :   lme->errorifnotconverged = flg;
     398           6 :   PetscFunctionReturn(0);
     399             : }
     400             : 
     401             : /*@
     402             :    LMEGetErrorIfNotConverged - Return a flag indicating whether LMESolve() will
     403             :    generate an error if the solver does not converge.
     404             : 
     405             :    Not Collective
     406             : 
     407             :    Input Parameter:
     408             : .  lme - the linear matrix equation solver context
     409             : 
     410             :    Output Parameter:
     411             : .  flag - PETSC_TRUE if it will generate an error, else PETSC_FALSE
     412             : 
     413             :    Level: intermediate
     414             : 
     415             : .seealso:  LMESetErrorIfNotConverged()
     416             : @*/
     417           3 : PetscErrorCode LMEGetErrorIfNotConverged(LME lme,PetscBool *flag)
     418             : {
     419           3 :   PetscFunctionBegin;
     420           3 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     421           3 :   PetscValidBoolPointer(flag,2);
     422           3 :   *flag = lme->errorifnotconverged;
     423           3 :   PetscFunctionReturn(0);
     424             : }
     425             : 
     426             : /*@C
     427             :    LMESetOptionsPrefix - Sets the prefix used for searching for all
     428             :    LME options in the database.
     429             : 
     430             :    Logically Collective on lme
     431             : 
     432             :    Input Parameters:
     433             : +  lme - the linear matrix equation solver context
     434             : -  prefix - the prefix string to prepend to all LME option requests
     435             : 
     436             :    Notes:
     437             :    A hyphen (-) must NOT be given at the beginning of the prefix name.
     438             :    The first character of all runtime options is AUTOMATICALLY the
     439             :    hyphen.
     440             : 
     441             :    For example, to distinguish between the runtime options for two
     442             :    different LME contexts, one could call
     443             : .vb
     444             :       LMESetOptionsPrefix(lme1,"fun1_")
     445             :       LMESetOptionsPrefix(lme2,"fun2_")
     446             : .ve
     447             : 
     448             :    Level: advanced
     449             : 
     450             : .seealso: LMEAppendOptionsPrefix(), LMEGetOptionsPrefix()
     451             : @*/
     452           1 : PetscErrorCode LMESetOptionsPrefix(LME lme,const char *prefix)
     453             : {
     454             :   PetscErrorCode ierr;
     455             : 
     456           1 :   PetscFunctionBegin;
     457           1 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     458           1 :   if (!lme->V) { ierr = LMEGetBV(lme,&lme->V);CHKERRQ(ierr); }
     459           1 :   ierr = BVSetOptionsPrefix(lme->V,prefix);CHKERRQ(ierr);
     460           1 :   ierr = PetscObjectSetOptionsPrefix((PetscObject)lme,prefix);CHKERRQ(ierr);
     461           1 :   PetscFunctionReturn(0);
     462             : }
     463             : 
     464             : /*@C
     465             :    LMEAppendOptionsPrefix - Appends to the prefix used for searching for all
     466             :    LME options in the database.
     467             : 
     468             :    Logically Collective on lme
     469             : 
     470             :    Input Parameters:
     471             : +  lme - the linear matrix equation solver context
     472             : -  prefix - the prefix string to prepend to all LME option requests
     473             : 
     474             :    Notes:
     475             :    A hyphen (-) must NOT be given at the beginning of the prefix name.
     476             :    The first character of all runtime options is AUTOMATICALLY the hyphen.
     477             : 
     478             :    Level: advanced
     479             : 
     480             : .seealso: LMESetOptionsPrefix(), LMEGetOptionsPrefix()
     481             : @*/
     482           1 : PetscErrorCode LMEAppendOptionsPrefix(LME lme,const char *prefix)
     483             : {
     484             :   PetscErrorCode ierr;
     485             : 
     486           1 :   PetscFunctionBegin;
     487           1 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     488           1 :   if (!lme->V) { ierr = LMEGetBV(lme,&lme->V);CHKERRQ(ierr); }
     489           1 :   ierr = BVAppendOptionsPrefix(lme->V,prefix);CHKERRQ(ierr);
     490           1 :   ierr = PetscObjectAppendOptionsPrefix((PetscObject)lme,prefix);CHKERRQ(ierr);
     491           1 :   PetscFunctionReturn(0);
     492             : }
     493             : 
     494             : /*@C
     495             :    LMEGetOptionsPrefix - Gets the prefix used for searching for all
     496             :    LME options in the database.
     497             : 
     498             :    Not Collective
     499             : 
     500             :    Input Parameters:
     501             : .  lme - the linear matrix equation solver context
     502             : 
     503             :    Output Parameters:
     504             : .  prefix - pointer to the prefix string used is returned
     505             : 
     506             :    Note:
     507             :    On the Fortran side, the user should pass in a string 'prefix' of
     508             :    sufficient length to hold the prefix.
     509             : 
     510             :    Level: advanced
     511             : 
     512             : .seealso: LMESetOptionsPrefix(), LMEAppendOptionsPrefix()
     513             : @*/
     514           1 : PetscErrorCode LMEGetOptionsPrefix(LME lme,const char *prefix[])
     515             : {
     516             :   PetscErrorCode ierr;
     517             : 
     518           1 :   PetscFunctionBegin;
     519           1 :   PetscValidHeaderSpecific(lme,LME_CLASSID,1);
     520           1 :   PetscValidPointer(prefix,2);
     521           1 :   ierr = PetscObjectGetOptionsPrefix((PetscObject)lme,prefix);CHKERRQ(ierr);
     522           1 :   PetscFunctionReturn(0);
     523             : }

Generated by: LCOV version 1.13