xref: /petsc/src/ksp/pc/impls/sor/sor.c (revision b00a91154f763f12aa55f3d53a3f2776f15f49e3)
1dba47a55SKris Buschelman 
24b9ad928SBarry Smith /*
34b9ad928SBarry Smith    Defines a  (S)SOR  preconditioner for any Mat implementation
44b9ad928SBarry Smith */
5b45d2f2cSJed Brown #include <petsc-private/pcimpl.h>               /*I "petscpc.h" I*/
64b9ad928SBarry Smith 
74b9ad928SBarry Smith typedef struct {
8c1ac3661SBarry Smith   PetscInt   its;         /* inner iterations, number of sweeps */
9c1ac3661SBarry Smith   PetscInt   lits;        /* local inner iterations, number of sweeps applied by the local matrix mat->A */
104b9ad928SBarry Smith   MatSORType sym;         /* forward, reverse, symmetric etc. */
114b9ad928SBarry Smith   PetscReal  omega;
1229c1d7e0SHong Zhang   PetscReal  fshift;
134b9ad928SBarry Smith } PC_SOR;
144b9ad928SBarry Smith 
154b9ad928SBarry Smith #undef __FUNCT__
164b9ad928SBarry Smith #define __FUNCT__ "PCDestroy_SOR"
176849ba73SBarry Smith static PetscErrorCode PCDestroy_SOR(PC pc)
184b9ad928SBarry Smith {
19dfbe8321SBarry Smith   PetscErrorCode ierr;
204b9ad928SBarry Smith 
214b9ad928SBarry Smith   PetscFunctionBegin;
22c31cb41cSBarry Smith   ierr = PetscFree(pc->data);CHKERRQ(ierr);
234b9ad928SBarry Smith   PetscFunctionReturn(0);
244b9ad928SBarry Smith }
254b9ad928SBarry Smith 
264b9ad928SBarry Smith #undef __FUNCT__
274b9ad928SBarry Smith #define __FUNCT__ "PCApply_SOR"
286849ba73SBarry Smith static PetscErrorCode PCApply_SOR(PC pc,Vec x,Vec y)
294b9ad928SBarry Smith {
304b9ad928SBarry Smith   PC_SOR         *jac = (PC_SOR*)pc->data;
31dfbe8321SBarry Smith   PetscErrorCode ierr;
32c1ac3661SBarry Smith   PetscInt       flag = jac->sym | SOR_ZERO_INITIAL_GUESS;
334b9ad928SBarry Smith 
344b9ad928SBarry Smith   PetscFunctionBegin;
3541f059aeSBarry Smith   ierr = MatSOR(pc->pmat,x,jac->omega,(MatSORType)flag,jac->fshift,jac->its,jac->lits,y);CHKERRQ(ierr);
364b9ad928SBarry Smith   PetscFunctionReturn(0);
374b9ad928SBarry Smith }
384b9ad928SBarry Smith 
394b9ad928SBarry Smith #undef __FUNCT__
404b9ad928SBarry Smith #define __FUNCT__ "PCApplyRichardson_SOR"
41ace3abfcSBarry Smith static PetscErrorCode PCApplyRichardson_SOR(PC pc,Vec b,Vec y,Vec w,PetscReal rtol,PetscReal abstol, PetscReal dtol,PetscInt its,PetscBool guesszero,PetscInt *outits,PCRichardsonConvergedReason *reason)
424b9ad928SBarry Smith {
434b9ad928SBarry Smith   PC_SOR         *jac = (PC_SOR*)pc->data;
44dfbe8321SBarry Smith   PetscErrorCode ierr;
457319c654SBarry Smith   MatSORType     stype = jac->sym;
464b9ad928SBarry Smith 
474b9ad928SBarry Smith   PetscFunctionBegin;
48ae15b995SBarry Smith   ierr = PetscInfo1(pc,"Warning, convergence critera ignored, using %D iterations\n",its);CHKERRQ(ierr);
492fa5cd67SKarl Rupp   if (guesszero) stype = (MatSORType) (stype | SOR_ZERO_INITIAL_GUESS);
5041f059aeSBarry Smith   ierr = MatSOR(pc->pmat,b,jac->omega,stype,jac->fshift,its*jac->its,jac->lits,y);CHKERRQ(ierr);
514d0a8057SBarry Smith   *outits = its;
524d0a8057SBarry Smith   *reason = PCRICHARDSON_CONVERGED_ITS;
534b9ad928SBarry Smith   PetscFunctionReturn(0);
544b9ad928SBarry Smith }
554b9ad928SBarry Smith 
564b9ad928SBarry Smith #undef __FUNCT__
574b9ad928SBarry Smith #define __FUNCT__ "PCSetFromOptions_SOR"
58dfbe8321SBarry Smith PetscErrorCode PCSetFromOptions_SOR(PC pc)
594b9ad928SBarry Smith {
604b9ad928SBarry Smith   PC_SOR         *jac = (PC_SOR*)pc->data;
61dfbe8321SBarry Smith   PetscErrorCode ierr;
62ace3abfcSBarry Smith   PetscBool      flg;
634b9ad928SBarry Smith 
644b9ad928SBarry Smith   PetscFunctionBegin;
654b9ad928SBarry Smith   ierr = PetscOptionsHead("(S)SOR options");CHKERRQ(ierr);
664b9ad928SBarry Smith   ierr = PetscOptionsReal("-pc_sor_omega","relaxation factor (0 < omega < 2)","PCSORSetOmega",jac->omega,&jac->omega,0);CHKERRQ(ierr);
6796fc60bcSBarry Smith   ierr = PetscOptionsReal("-pc_sor_diagonal_shift","Add to the diagonal entries","",jac->fshift,&jac->fshift,0);CHKERRQ(ierr);
684b9ad928SBarry Smith   ierr = PetscOptionsInt("-pc_sor_its","number of inner SOR iterations","PCSORSetIterations",jac->its,&jac->its,0);CHKERRQ(ierr);
694b9ad928SBarry Smith   ierr = PetscOptionsInt("-pc_sor_lits","number of local inner SOR iterations","PCSORSetIterations",jac->lits,&jac->lits,0);CHKERRQ(ierr);
70acfcf0e5SJed Brown   ierr = PetscOptionsBoolGroupBegin("-pc_sor_symmetric","SSOR, not SOR","PCSORSetSymmetric",&flg);CHKERRQ(ierr);
714b9ad928SBarry Smith   if (flg) {ierr = PCSORSetSymmetric(pc,SOR_SYMMETRIC_SWEEP);CHKERRQ(ierr);}
72acfcf0e5SJed Brown   ierr = PetscOptionsBoolGroup("-pc_sor_backward","use backward sweep instead of forward","PCSORSetSymmetric",&flg);CHKERRQ(ierr);
734b9ad928SBarry Smith   if (flg) {ierr = PCSORSetSymmetric(pc,SOR_BACKWARD_SWEEP);CHKERRQ(ierr);}
74acfcf0e5SJed Brown   ierr = PetscOptionsBoolGroup("-pc_sor_forward","use forward sweep","PCSORSetSymmetric",&flg);CHKERRQ(ierr);
75a9510f2eSBarry Smith   if (flg) {ierr = PCSORSetSymmetric(pc,SOR_FORWARD_SWEEP);CHKERRQ(ierr);}
76acfcf0e5SJed Brown   ierr = PetscOptionsBoolGroup("-pc_sor_local_symmetric","use SSOR separately on each processor","PCSORSetSymmetric",&flg);CHKERRQ(ierr);
774b9ad928SBarry Smith   if (flg) {ierr = PCSORSetSymmetric(pc,SOR_LOCAL_SYMMETRIC_SWEEP);CHKERRQ(ierr);}
78acfcf0e5SJed Brown   ierr = PetscOptionsBoolGroup("-pc_sor_local_backward","use backward sweep locally","PCSORSetSymmetric",&flg);CHKERRQ(ierr);
794b9ad928SBarry Smith   if (flg) {ierr = PCSORSetSymmetric(pc,SOR_LOCAL_BACKWARD_SWEEP);CHKERRQ(ierr);}
80acfcf0e5SJed Brown   ierr = PetscOptionsBoolGroupEnd("-pc_sor_local_forward","use forward sweep locally","PCSORSetSymmetric",&flg);CHKERRQ(ierr);
814b9ad928SBarry Smith   if (flg) {ierr = PCSORSetSymmetric(pc,SOR_LOCAL_FORWARD_SWEEP);CHKERRQ(ierr);}
824b9ad928SBarry Smith   ierr = PetscOptionsTail();CHKERRQ(ierr);
834b9ad928SBarry Smith   PetscFunctionReturn(0);
844b9ad928SBarry Smith }
854b9ad928SBarry Smith 
864b9ad928SBarry Smith #undef __FUNCT__
874b9ad928SBarry Smith #define __FUNCT__ "PCView_SOR"
88dfbe8321SBarry Smith PetscErrorCode PCView_SOR(PC pc,PetscViewer viewer)
894b9ad928SBarry Smith {
904b9ad928SBarry Smith   PC_SOR         *jac = (PC_SOR*)pc->data;
914b9ad928SBarry Smith   MatSORType     sym  = jac->sym;
922fc52814SBarry Smith   const char     *sortype;
93dfbe8321SBarry Smith   PetscErrorCode ierr;
94ace3abfcSBarry Smith   PetscBool      iascii;
954b9ad928SBarry Smith 
964b9ad928SBarry Smith   PetscFunctionBegin;
97251f4c67SDmitry Karpeev   ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
9832077d6dSBarry Smith   if (iascii) {
994b9ad928SBarry Smith     if (sym & SOR_ZERO_INITIAL_GUESS) {ierr = PetscViewerASCIIPrintf(viewer,"  SOR:  zero initial guess\n");CHKERRQ(ierr);}
1004b9ad928SBarry Smith     if (sym == SOR_APPLY_UPPER)                                              sortype = "apply_upper";
1014b9ad928SBarry Smith     else if (sym == SOR_APPLY_LOWER)                                         sortype = "apply_lower";
1024b9ad928SBarry Smith     else if (sym & SOR_EISENSTAT)                                            sortype = "Eisenstat";
103db4deed7SKarl Rupp     else if ((sym & SOR_SYMMETRIC_SWEEP) == SOR_SYMMETRIC_SWEEP)             sortype = "symmetric";
1044b9ad928SBarry Smith     else if (sym & SOR_BACKWARD_SWEEP)                                       sortype = "backward";
1054b9ad928SBarry Smith     else if (sym & SOR_FORWARD_SWEEP)                                        sortype = "forward";
106db4deed7SKarl Rupp     else if ((sym & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) sortype = "local_symmetric";
1074b9ad928SBarry Smith     else if (sym & SOR_LOCAL_FORWARD_SWEEP)                                  sortype = "local_forward";
1084b9ad928SBarry Smith     else if (sym & SOR_LOCAL_BACKWARD_SWEEP)                                 sortype = "local_backward";
1094b9ad928SBarry Smith     else                                                                     sortype = "unknown";
110cf576665SBarry Smith     ierr = PetscViewerASCIIPrintf(viewer,"  SOR: type = %s, iterations = %D, local iterations = %D, omega = %G\n",sortype,jac->its,jac->lits,jac->omega);CHKERRQ(ierr);
1114b9ad928SBarry Smith   }
1124b9ad928SBarry Smith   PetscFunctionReturn(0);
1134b9ad928SBarry Smith }
1144b9ad928SBarry Smith 
1154b9ad928SBarry Smith 
1164b9ad928SBarry Smith /* ------------------------------------------------------------------------------*/
1174b9ad928SBarry Smith #undef __FUNCT__
1184b9ad928SBarry Smith #define __FUNCT__ "PCSORSetSymmetric_SOR"
119f7a08781SBarry Smith static PetscErrorCode  PCSORSetSymmetric_SOR(PC pc,MatSORType flag)
1204b9ad928SBarry Smith {
1214b9ad928SBarry Smith   PC_SOR *jac;
1224b9ad928SBarry Smith 
1234b9ad928SBarry Smith   PetscFunctionBegin;
1244b9ad928SBarry Smith   jac      = (PC_SOR*)pc->data;
1254b9ad928SBarry Smith   jac->sym = flag;
1264b9ad928SBarry Smith   PetscFunctionReturn(0);
1274b9ad928SBarry Smith }
1284b9ad928SBarry Smith 
1294b9ad928SBarry Smith #undef __FUNCT__
1304b9ad928SBarry Smith #define __FUNCT__ "PCSORSetOmega_SOR"
131f7a08781SBarry Smith static PetscErrorCode  PCSORSetOmega_SOR(PC pc,PetscReal omega)
1324b9ad928SBarry Smith {
1334b9ad928SBarry Smith   PC_SOR *jac;
1344b9ad928SBarry Smith 
1354b9ad928SBarry Smith   PetscFunctionBegin;
136ce94432eSBarry Smith   if (omega >= 2.0 || omega <= 0.0) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"Relaxation out of range");
1374b9ad928SBarry Smith   jac        = (PC_SOR*)pc->data;
1384b9ad928SBarry Smith   jac->omega = omega;
1394b9ad928SBarry Smith   PetscFunctionReturn(0);
1404b9ad928SBarry Smith }
1414b9ad928SBarry Smith 
1424b9ad928SBarry Smith #undef __FUNCT__
1434b9ad928SBarry Smith #define __FUNCT__ "PCSORSetIterations_SOR"
144f7a08781SBarry Smith static PetscErrorCode  PCSORSetIterations_SOR(PC pc,PetscInt its,PetscInt lits)
1454b9ad928SBarry Smith {
1464b9ad928SBarry Smith   PC_SOR *jac;
1474b9ad928SBarry Smith 
1484b9ad928SBarry Smith   PetscFunctionBegin;
1494b9ad928SBarry Smith   jac       = (PC_SOR*)pc->data;
1504b9ad928SBarry Smith   jac->its  = its;
1514b9ad928SBarry Smith   jac->lits = lits;
1524b9ad928SBarry Smith   PetscFunctionReturn(0);
1534b9ad928SBarry Smith }
1544b9ad928SBarry Smith 
1554b9ad928SBarry Smith /* ------------------------------------------------------------------------------*/
1564b9ad928SBarry Smith #undef __FUNCT__
1574b9ad928SBarry Smith #define __FUNCT__ "PCSORSetSymmetric"
1584b9ad928SBarry Smith /*@
1594b9ad928SBarry Smith    PCSORSetSymmetric - Sets the SOR preconditioner to use symmetric (SSOR),
1604b9ad928SBarry Smith    backward, or forward relaxation.  The local variants perform SOR on
1614b9ad928SBarry Smith    each processor.  By default forward relaxation is used.
1624b9ad928SBarry Smith 
1633f9fe445SBarry Smith    Logically Collective on PC
1644b9ad928SBarry Smith 
1654b9ad928SBarry Smith    Input Parameters:
1664b9ad928SBarry Smith +  pc - the preconditioner context
1674b9ad928SBarry Smith -  flag - one of the following
1684b9ad928SBarry Smith .vb
1694b9ad928SBarry Smith     SOR_FORWARD_SWEEP
1704b9ad928SBarry Smith     SOR_BACKWARD_SWEEP
1714b9ad928SBarry Smith     SOR_SYMMETRIC_SWEEP
1724b9ad928SBarry Smith     SOR_LOCAL_FORWARD_SWEEP
1734b9ad928SBarry Smith     SOR_LOCAL_BACKWARD_SWEEP
1744b9ad928SBarry Smith     SOR_LOCAL_SYMMETRIC_SWEEP
1754b9ad928SBarry Smith .ve
1764b9ad928SBarry Smith 
1774b9ad928SBarry Smith    Options Database Keys:
1784b9ad928SBarry Smith +  -pc_sor_symmetric - Activates symmetric version
1794b9ad928SBarry Smith .  -pc_sor_backward - Activates backward version
1804b9ad928SBarry Smith .  -pc_sor_local_forward - Activates local forward version
1814b9ad928SBarry Smith .  -pc_sor_local_symmetric - Activates local symmetric version
1824b9ad928SBarry Smith -  -pc_sor_local_backward - Activates local backward version
1834b9ad928SBarry Smith 
1844b9ad928SBarry Smith    Notes:
1854b9ad928SBarry Smith    To use the Eisenstat trick with SSOR, employ the PCEISENSTAT preconditioner,
1864b9ad928SBarry Smith    which can be chosen with the option
1874b9ad928SBarry Smith .  -pc_type eisenstat - Activates Eisenstat trick
1884b9ad928SBarry Smith 
1894b9ad928SBarry Smith    Level: intermediate
1904b9ad928SBarry Smith 
1914b9ad928SBarry Smith .keywords: PC, SOR, SSOR, set, relaxation, sweep, forward, backward, symmetric
1924b9ad928SBarry Smith 
1934b9ad928SBarry Smith .seealso: PCEisenstatSetOmega(), PCSORSetIterations(), PCSORSetOmega()
1944b9ad928SBarry Smith @*/
1957087cfbeSBarry Smith PetscErrorCode  PCSORSetSymmetric(PC pc,MatSORType flag)
1964b9ad928SBarry Smith {
1974ac538c5SBarry Smith   PetscErrorCode ierr;
1984b9ad928SBarry Smith 
1994b9ad928SBarry Smith   PetscFunctionBegin;
2000700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
201c5eb9154SBarry Smith   PetscValidLogicalCollectiveEnum(pc,flag,2);
2024ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCSORSetSymmetric_C",(PC,MatSORType),(pc,flag));CHKERRQ(ierr);
2034b9ad928SBarry Smith   PetscFunctionReturn(0);
2044b9ad928SBarry Smith }
2054b9ad928SBarry Smith 
2064b9ad928SBarry Smith #undef __FUNCT__
2074b9ad928SBarry Smith #define __FUNCT__ "PCSORSetOmega"
2084b9ad928SBarry Smith /*@
2094b9ad928SBarry Smith    PCSORSetOmega - Sets the SOR relaxation coefficient, omega
2104b9ad928SBarry Smith    (where omega = 1.0 by default).
2114b9ad928SBarry Smith 
2123f9fe445SBarry Smith    Logically Collective on PC
2134b9ad928SBarry Smith 
2144b9ad928SBarry Smith    Input Parameters:
2154b9ad928SBarry Smith +  pc - the preconditioner context
2164b9ad928SBarry Smith -  omega - relaxation coefficient (0 < omega < 2).
2174b9ad928SBarry Smith 
2184b9ad928SBarry Smith    Options Database Key:
2194b9ad928SBarry Smith .  -pc_sor_omega <omega> - Sets omega
2204b9ad928SBarry Smith 
2214b9ad928SBarry Smith    Level: intermediate
2224b9ad928SBarry Smith 
2234b9ad928SBarry Smith .keywords: PC, SOR, SSOR, set, relaxation, omega
2244b9ad928SBarry Smith 
2254b9ad928SBarry Smith .seealso: PCSORSetSymmetric(), PCSORSetIterations(), PCEisenstatSetOmega()
2264b9ad928SBarry Smith @*/
2277087cfbeSBarry Smith PetscErrorCode  PCSORSetOmega(PC pc,PetscReal omega)
2284b9ad928SBarry Smith {
2294ac538c5SBarry Smith   PetscErrorCode ierr;
2304b9ad928SBarry Smith 
2314b9ad928SBarry Smith   PetscFunctionBegin;
232c5eb9154SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
233c5eb9154SBarry Smith   PetscValidLogicalCollectiveReal(pc,omega,2);
2344ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCSORSetOmega_C",(PC,PetscReal),(pc,omega));CHKERRQ(ierr);
2354b9ad928SBarry Smith   PetscFunctionReturn(0);
2364b9ad928SBarry Smith }
2374b9ad928SBarry Smith 
2384b9ad928SBarry Smith #undef __FUNCT__
2394b9ad928SBarry Smith #define __FUNCT__ "PCSORSetIterations"
2404b9ad928SBarry Smith /*@
2414b9ad928SBarry Smith    PCSORSetIterations - Sets the number of inner iterations to
2424b9ad928SBarry Smith    be used by the SOR preconditioner. The default is 1.
2434b9ad928SBarry Smith 
2443f9fe445SBarry Smith    Logically Collective on PC
2454b9ad928SBarry Smith 
2464b9ad928SBarry Smith    Input Parameters:
2474b9ad928SBarry Smith +  pc - the preconditioner context
2484b9ad928SBarry Smith .  lits - number of local iterations, smoothings over just variables on processor
2494b9ad928SBarry Smith -  its - number of parallel iterations to use; each parallel iteration has lits local iterations
2504b9ad928SBarry Smith 
2514b9ad928SBarry Smith    Options Database Key:
2524b9ad928SBarry Smith +  -pc_sor_its <its> - Sets number of iterations
2534b9ad928SBarry Smith -  -pc_sor_lits <lits> - Sets number of local iterations
2544b9ad928SBarry Smith 
2554b9ad928SBarry Smith    Level: intermediate
2564b9ad928SBarry Smith 
2574b9ad928SBarry Smith    Notes: When run on one processor the number of smoothings is lits*its
2584b9ad928SBarry Smith 
2594b9ad928SBarry Smith .keywords: PC, SOR, SSOR, set, iterations
2604b9ad928SBarry Smith 
2614b9ad928SBarry Smith .seealso: PCSORSetOmega(), PCSORSetSymmetric()
2624b9ad928SBarry Smith @*/
2637087cfbeSBarry Smith PetscErrorCode  PCSORSetIterations(PC pc,PetscInt its,PetscInt lits)
2644b9ad928SBarry Smith {
2654ac538c5SBarry Smith   PetscErrorCode ierr;
2664b9ad928SBarry Smith 
2674b9ad928SBarry Smith   PetscFunctionBegin;
2680700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
269c5eb9154SBarry Smith   PetscValidLogicalCollectiveInt(pc,its,2);
2704ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCSORSetIterations_C",(PC,PetscInt,PetscInt),(pc,its,lits));CHKERRQ(ierr);
2714b9ad928SBarry Smith   PetscFunctionReturn(0);
2724b9ad928SBarry Smith }
2734b9ad928SBarry Smith 
2744b9ad928SBarry Smith /*MC
2754b9ad928SBarry Smith      PCSOR - (S)SOR (successive over relaxation, Gauss-Seidel) preconditioning
2764b9ad928SBarry Smith 
2774b9ad928SBarry Smith    Options Database Keys:
2784b9ad928SBarry Smith +  -pc_sor_symmetric - Activates symmetric version
2794b9ad928SBarry Smith .  -pc_sor_backward - Activates backward version
280a9510f2eSBarry Smith .  -pc_sor_forward - Activates forward version
2814b9ad928SBarry Smith .  -pc_sor_local_forward - Activates local forward version
282a9510f2eSBarry Smith .  -pc_sor_local_symmetric - Activates local symmetric version  (default version)
2834b9ad928SBarry Smith .  -pc_sor_local_backward - Activates local backward version
2844b9ad928SBarry Smith .  -pc_sor_omega <omega> - Sets omega
285a9510f2eSBarry Smith .  -pc_sor_its <its> - Sets number of iterations   (default 1)
286a9510f2eSBarry Smith -  -pc_sor_lits <lits> - Sets number of local iterations  (default 1)
2874b9ad928SBarry Smith 
2884b9ad928SBarry Smith    Level: beginner
2894b9ad928SBarry Smith 
2904b9ad928SBarry Smith   Concepts: SOR, preconditioners, Gauss-Seidel
2914b9ad928SBarry Smith 
29237a17b4dSBarry Smith    Notes: Only implemented for the AIJ  and SeqBAIJ matrix formats.
2934b9ad928SBarry Smith           Not a true parallel SOR, in parallel this implementation corresponds to block
2944b9ad928SBarry Smith           Jacobi with SOR on each block.
2954b9ad928SBarry Smith 
29637a17b4dSBarry Smith           For SeqBAIJ matrices this implements point-block SOR, but the omega, its, lits options are not supported.
29737a17b4dSBarry Smith 
2984b9ad928SBarry Smith .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC,
2994b9ad928SBarry Smith            PCSORSetIterations(), PCSORSetSymmetric(), PCSORSetOmega(), PCEISENSTAT
3004b9ad928SBarry Smith M*/
3014b9ad928SBarry Smith 
3024b9ad928SBarry Smith #undef __FUNCT__
3034b9ad928SBarry Smith #define __FUNCT__ "PCCreate_SOR"
3048cc058d9SJed Brown PETSC_EXTERN PetscErrorCode PCCreate_SOR(PC pc)
3054b9ad928SBarry Smith {
306dfbe8321SBarry Smith   PetscErrorCode ierr;
3074b9ad928SBarry Smith   PC_SOR         *jac;
3084b9ad928SBarry Smith 
3094b9ad928SBarry Smith   PetscFunctionBegin;
310*b00a9115SJed Brown   ierr = PetscNewLog(pc,&jac);CHKERRQ(ierr);
3114b9ad928SBarry Smith 
3124b9ad928SBarry Smith   pc->ops->apply           = PCApply_SOR;
3134b9ad928SBarry Smith   pc->ops->applyrichardson = PCApplyRichardson_SOR;
3144b9ad928SBarry Smith   pc->ops->setfromoptions  = PCSetFromOptions_SOR;
3154b9ad928SBarry Smith   pc->ops->setup           = 0;
3164b9ad928SBarry Smith   pc->ops->view            = PCView_SOR;
3174b9ad928SBarry Smith   pc->ops->destroy         = PCDestroy_SOR;
3184b9ad928SBarry Smith   pc->data                 = (void*)jac;
319d9bc8e36SBarry Smith   jac->sym                 = SOR_LOCAL_SYMMETRIC_SWEEP;
3204b9ad928SBarry Smith   jac->omega               = 1.0;
32196fc60bcSBarry Smith   jac->fshift              = 0.0;
3224b9ad928SBarry Smith   jac->its                 = 1;
3234b9ad928SBarry Smith   jac->lits                = 1;
3244b9ad928SBarry Smith 
325bdf89e91SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCSORSetSymmetric_C",PCSORSetSymmetric_SOR);CHKERRQ(ierr);
326bdf89e91SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCSORSetOmega_C",PCSORSetOmega_SOR);CHKERRQ(ierr);
327bdf89e91SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCSORSetIterations_C",PCSORSetIterations_SOR);CHKERRQ(ierr);
3284b9ad928SBarry Smith   PetscFunctionReturn(0);
3294b9ad928SBarry Smith }
3304b9ad928SBarry Smith 
3314b9ad928SBarry Smith 
3324b9ad928SBarry Smith 
3334b9ad928SBarry Smith 
3344b9ad928SBarry Smith 
335