diff --git a/docs/html/index.html b/docs/html/index.html index 3dcd3433..bb6796be 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -136,7 +136,7 @@ Feb. 28, 2017
  • Adding smoothers and solvers to MLD2P4 + HREF="node24.html">Adding new smoothers and solvers to MLD2P4
  • Error Handling

  • -
    +
    Table 2: Parameters defining the multi-level cycle and the number of cycles to @@ -294,7 +294,7 @@ number

    -
    +
    Table 3: Parameters defining the aggregation algorithm. @@ -409,7 +409,7 @@ of levels.


    -
    +
    Table 4: Parameters defining the aggregation algorithm (continued). @@ -547,7 +547,7 @@ the parameter ilev.


    -
    +
    Table 5: Parameters defining the coarse-space correction at the coarsest @@ -655,7 +655,7 @@ Note that UMF and SLU require the coarsest


    -
    +
    Table 6: Parameters defining the coarse-space correction at the coarsest @@ -721,7 +721,7 @@ number

    -
    +
    Table 7: Parameters defining the smoother or the details of the one-level preconditioner. @@ -844,7 +844,7 @@ Parameters defining the smoother or the details of the one-level preconditioner.


    -
    +
    Table 8: Parameters defining the smoother or the details of the one-level preconditioner diff --git a/docs/html/node2.html b/docs/html/node2.html index a560c26e..581ee848 100644 --- a/docs/html/node2.html +++ b/docs/html/node2.html @@ -108,7 +108,7 @@ Contents
  • Adding smoothers and solvers to MLD2P4 + HREF="node24.html">Adding new smoothers and solvers to MLD2P4
  • Error Handling

  • Next: Adding smoothers and solvers + HREF="node24.html">Adding new smoothers and Up: User Interface Previous: -Adding smoothers and solvers to MLD2P4 - +Adding new smoothers and solvers to MLD2P4 + @@ -53,37 +53,53 @@ original version by: Nikos Drakos, CBLU, University of Leeds


    -Adding smoothers and solvers to MLD2P4 +Adding new smoothers and solvers to MLD2P4

    -Da ampliare e completare - SALVATORE. -
    -

    -Completely new smoother and/or solver classes derived from the -base objects in the library may be used without recompiling the -library itself. Once the new smoother/solver class has been -developed, the user can declare a variable of that new type in the -application, and pass that variable to the p%set(solver,info) -call; the new solver object is then dynamically included in the -preconditioner structure. +Developers can add completely new smoother and/or solver classes +derived from the base objects in the library may be used without +recompiling the library itself. To do so it is necessary first to +select the base type to be extended; in our experience, it is quite +likely that the new application needs only require the definition of a +``solver'' object, which is almost always acting only on the local +part of the distributed matrix. The parallel actions required to +connect the various solver objects are most often already provided by +the Block Jacobi or the Additive Schwarz smoothers. +To define a new solver, the developer will then have to define its +components and methods, perhaps taking one of the predefined solvers +as a starting point if possible.

    - -
    -

    -If the user has developed a new type of smoother and/or -solver by extending one of the base MLD2P4 types, and has declared a -variable of the new type in the main program, it is possible to pass -the new smoother/solver variable to the setup routine as follows: +Once the new smoother/solver class has been developed, to use it in +the context of the multilevel preconditioners it is necessary to: + +

      +
    • Declare in the application program a variable of the new type; +
    • +
    • Pass that variable as the argument to the se routine as in the + following:
      call p%set(smoother,info [,ilev, ilmax,pos])
      call p%set(solver,info [,ilev, ilmax,pos])
      -In this way, the variable will act as a mold to which the -preconditioner will conform, even though the MLD2P4 library is not -modified, and thus has no direct knowledge about the new type. +
    • +
    • Link into the application executable the code implementing the + various methods. +
    • +
    +The new solver object is then dynamically included in the +preconditioner structure, and will act as a mold to which the +preconditioner will conform, even though the MLD2P4 library has not +been modified to account for this new development. + +

    +It is possible to define new values for the keyword WHAT in the +set routines; if the library code does not recognize a keyword, +it passes it down the composition hierarchy (levels containing +smoothers containing solvers), so that it can be eventually caught by +the new solver.

    diff --git a/docs/html/node25.html b/docs/html/node25.html index 31ff396e..a0e6da22 100644 --- a/docs/html/node25.html +++ b/docs/html/node25.html @@ -44,7 +44,7 @@ original version by: Nikos Drakos, CBLU, University of Leeds Up: userhtml Previous: Adding smoothers and solvers + HREF="node24.html">Adding new smoothers and   Contents
    diff --git a/docs/html/node28.html b/docs/html/node28.html index faaa7903..504ddd1d 100644 --- a/docs/html/node28.html +++ b/docs/html/node28.html @@ -63,7 +63,7 @@ Mathematics Department, Macquarie University, Sydney. The command line arguments were:
    latex2html -local_icons -noaddress -dir ../../html userhtml.tex

    -The translation was initiated by Salvatore Filippone on 2017-04-21 +The translation was initiated by Salvatore Filippone on 2017-04-24


    diff --git a/docs/html/userhtml.html b/docs/html/userhtml.html index 3dcd3433..bb6796be 100644 --- a/docs/html/userhtml.html +++ b/docs/html/userhtml.html @@ -136,7 +136,7 @@ Feb. 28, 2017
  • Adding smoothers and solvers to MLD2P4 + HREF="node24.html">Adding new smoothers and solvers to MLD2P4
  • Error Handling
  • > stream 0 g 0 G @@ -253,9 +253,9 @@ BT [-1281(38)]TJ 0 g 0 G 0 0 1 rg 0 0 1 RG -/F43 10.9091 Tf -16.364 -24.458 Td [(7)-925(Adding)-383(smo)-32(others)-384(and)-383(solv)32(ers)-383(t)-1(o)-383(MLD2P4)]TJ +/F43 10.9091 Tf -16.364 -24.458 Td [(7)-925(Adding)-383(new)-384(smo)-32(others)-383(and)-383(solv)32(ers)-384(to)-383(MLD2P4)]TJ 0 g 0 G - [-13589(39)]TJ + [-11209(39)]TJ 0 0 1 rg 0 0 1 RG 0 -24.459 Td [(8)-925(Error)-383(Handling)]TJ 0 g 0 G @@ -279,7 +279,7 @@ endobj /Type /ObjStm /N 100 /First 814 -/Length 8404 +/Length 8409 >> stream 1 0 5 38 6 84 9 125 10 146 13 187 14 219 17 260 18 293 21 334 @@ -287,11 +287,11 @@ stream 42 803 45 844 46 880 49 926 50 963 53 1009 54 1047 57 1093 58 1147 61 1188 62 1219 65 1265 66 1291 69 1332 70 1362 73 1408 74 1441 77 1487 78 1519 81 1565 82 1599 85 1645 86 1692 89 1738 90 1785 93 1831 94 1865 97 1911 98 1944 101 1990 -102 2025 105 2067 106 2122 109 2164 110 2195 113 2238 114 2262 117 2305 118 2330 119 2375 -122 2489 123 2543 3 2597 120 2649 129 2742 131 2856 128 2910 133 2946 135 3060 7 3114 -132 3166 139 3259 141 3373 138 3427 171 3494 142 3844 143 3990 144 4136 145 4282 146 4428 -147 4580 148 4732 149 4884 150 5035 151 5186 152 5332 153 5484 154 5636 155 5788 156 5934 -157 6086 158 6231 159 6382 160 6534 161 6685 162 6837 163 6989 164 7141 165 7293 166 7445 +102 2025 105 2067 106 2126 109 2168 110 2199 113 2242 114 2266 117 2309 118 2334 119 2379 +122 2493 123 2547 3 2601 120 2653 129 2746 131 2860 128 2914 133 2950 135 3064 7 3118 +132 3170 139 3263 141 3377 138 3431 171 3498 142 3848 143 3994 144 4140 145 4286 146 4432 +147 4584 148 4736 149 4888 150 5039 151 5190 152 5336 153 5488 154 5640 155 5792 156 5938 +157 6090 158 6235 159 6386 160 6538 161 6689 162 6841 163 6993 164 7145 165 7297 166 7449 % 1 0 obj << /S /GoTo /D (title.0) >> % 5 0 obj @@ -395,7 +395,7 @@ stream % 102 0 obj << /S /GoTo /D (section.7) >> % 105 0 obj -(7 Adding smoothers and solvers to MLD2P4) +(7 Adding new smoothers and solvers to MLD2P4) % 106 0 obj << /S /GoTo /D (section.8) >> % 109 0 obj @@ -695,7 +695,7 @@ stream /Type /Annot /Subtype /Link /Border[0 0 0]/H/I/C[1 0 0] -/Rect [92.604 275.016 346.26 286.705] +/Rect [92.604 275.016 372.222 286.705] /A << /S /GoTo /D (section.7) >> >> @@ -6327,7 +6327,7 @@ endstream endobj 557 0 obj << -/Length 3346 +/Length 5303 >> stream 0 g 0 G @@ -6337,10 +6337,22 @@ BT 0 g 0 G [-378(User)-377(Interf)88(a)23(ce)]TJ/F15 10.9091 Tf 401.542 0 Td [(39)]TJ 0 g 0 G -/F17 14.3462 Tf -401.542 -35.866 Td [(7)-1125(Adding)-375(smo)-31(others)-375(and)-375(solv)31(ers)-375(to)-375(MLD2P4)]TJ/F43 10.9091 Tf 0 -24.352 Td [(Da)-383(ampli)-1(are)-383(e)-383(completare)-384(-)-383(SAL)128(V)128(A)95(TORE.)]TJ/F15 10.9091 Tf 16.937 -27.098 Td [(Completely)-281(new)-281(smo)-27(other)-281(and/or)-281(solv)28(er)-281(classes)-281(deriv)28(ed)-281(from)-281(th)1(e)-281(base)-281(ob)-56(jects)-280(in)-281(the)]TJ -16.937 -13.549 Td [(library)-222(ma)28(y)-223(b)-27(e)-223(u)1(s)-1(ed)-222(without)-222(recompiling)-222(the)-222(library)-222(itself.)-408(Once)-222(the)-222(new)-222(smo)-28(other/solv)28(er)]TJ 0 -13.55 Td [(class)-318(has)-317(b)-28(een)-317(dev)27(elop)-27(ed,)-321(the)-317(user)-318(can)-317(declare)-318(a)-317(v)55(ariable)-317(of)-318(that)-317(new)-318(t)28(yp)-28(e)-317(in)-318(the)-317(appli-)]TJ 0 -13.549 Td [(cation,)-366(and)-360(pass)-360(th)1(at)-360(v)55(ariab)1(le)-360(to)-360(the)]TJ/F44 10.9091 Tf 179.508 0 Td [(p%set\050solver,info\051)]TJ/F15 10.9091 Tf 107.014 0 Td [(call;)-373(the)-359(new)-360(solv)28(er)-360(ob)-56(ject)]TJ -286.522 -13.549 Td [(is)-333(then)-334(dynamically)-333(included)-333(in)-333(the)-334(preconditioner)-333(structure.)]TJ 16.937 -40.648 Td [(If)-383(the)-383(user)-383(has)-383(dev)28(elop)-28(ed)-383(a)-382(new)-383(t)27(yp)-27(e)-383(of)-383(smo)-28(other)-383(and/or)-383(solv)28(er)-383(b)28(y)-383(extending)-383(one)]TJ -16.937 -13.549 Td [(of)-394(the)-395(base)-395(MLD)1(2P4)-395(t)28(yp)-28(es,)-410(and)-394(has)-395(declared)-394(a)-395(v)56(ariable)-395(of)-394(the)-395(n)1(e)-1(w)-394(t)28(yp)-28(e)-395(in)-394(the)-394(m)-1(ai)1(n)]TJ 0 -13.549 Td [(program,)-401(it)-388(is)-387(p)-28(ossible)-388(to)-387(pass)-388(the)-388(n)1(e)-1(w)-387(smo)-28(other/solv)28(er)-388(v)56(ariable)-388(to)-387(the)-388(setup)-388(rou)1(tine)]TJ 0 -13.549 Td [(as)-333(follo)27(ws:)]TJ +/F17 14.3462 Tf -401.542 -35.866 Td [(7)-1125(Adding)-375(new)-375(smo)-31(others)-375(and)-375(solv)31(ers)-375(to)-375(MLD2P4)]TJ/F15 10.9091 Tf 0 -24.352 Td [(Dev)28(elop)-28(ers)-414(can)-413(add)-414(completely)-413(new)-414(smo)-28(other)-414(an)1(d/or)-414(solv)28(er)-414(classes)-414(deriv)28(ed)-413(from)-414(the)]TJ 0 -13.549 Td [(base)-302(ob)-55(jects)-302(in)-301(the)-302(library)-301(ma)28(y)-302(b)-28(e)-301(used)-302(without)-301(recompiling)-302(th)1(e)-302(library)-301(itself.)-434(T)83(o)-301(do)-302(so)]TJ 0 -13.549 Td [(it)-317(is)-317(necessary)-317(\014rst)-317(to)-317(select)-317(the)-317(base)-317(t)28(yp)-28(e)-317(to)-317(b)-27(e)-317(exte)-1(n)1(ded;)-323(in)-317(our)-317(exp)-27(erience,)-321(it)-317(is)-317(q)1(uite)]TJ 0 -13.549 Td [(lik)28(ely)-396(that)-396(the)-396(new)-397(application)-396(needs)-396(only)-396(require)-396(the)-396(de\014nition)-396(of)-396(a)-396(\134solv)28(er")-397(ob)-55(ject,)]TJ 0 -13.55 Td [(whic)28(h)-417(is)-417(al)1(m)-1(ost)-416(alw)28(a)27(ys)-416(acting)-417(only)-416(on)-417(the)-417(lo)-27(c)-1(al)-416(part)-417(of)-416(the)-417(distributed)-416(matrix.)-695(The)]TJ 0 -13.549 Td [(parallel)-399(actions)-399(required)-399(to)-399(connect)-399(the)-399(v)55(ari)1(ous)-400(solv)28(er)-399(ob)-55(jects)-399(are)-400(most)-399(often)-399(already)]TJ 0 -13.549 Td [(pro)28(vided)-447(b)28(y)-447(the)-447(Blo)-28(c)28(k)-447(Jacobi)-446(or)-447(the)-447(Additiv)28(e)-447(Sc)28(h)28(w)27(arz)-446(smo)-28(others.)-785(T)83(o)-447(de\014ne)-446(a)-447(new)]TJ 0 -13.549 Td [(solv)28(er,)-466(the)-440(dev)28(elop)-28(er)-439(will)-440(then)-439(ha)28(v)27(e)-439(to)-440(de\014ne)-439(its)-440(comp)-28(onen)28(ts)-439(and)-440(metho)-28(ds,)-466(p)-27(erhaps)]TJ 0 -13.549 Td [(taking)-333(one)-334(of)-333(the)-333(prede\014ned)-333(solv)27(ers)-333(as)-333(a)-334(starting)-333(p)-28(oin)28(t)-333(if)-333(p)-28(ossible.)]TJ 16.937 -13.55 Td [(Once)-329(the)-329(new)-329(smo)-28(other/solv)28(er)-329(class)-329(has)-329(b)-27(een)-329(dev)28(e)-1(l)1(op)-28(ed,)-330(to)-329(use)-329(it)-329(in)-329(th)1(e)-329(con)27(text)-329(of)]TJ -16.937 -13.549 Td [(the)-333(m)27(ultil)1(e)-1(v)28(el)-333(preconditioners)-333(it)-334(is)-333(necessary)-333(to:)]TJ 0 g 0 G +/F25 10.9091 Tf 16.364 -22.515 Td [(\017)]TJ 0 g 0 G -/F44 10.9091 Tf 80.227 -22.516 Td [(call)-525(p%set\050smoother,info)-525([,ilev,)-525(ilmax,pos]\051)]TJ 5.727 -13.549 Td [(call)-525(p%set\050solver,info)-525([,ilev,)-525(ilmax,pos]\051)]TJ/F15 10.9091 Tf -85.954 -22.516 Td [(In)-375(this)-376(w)28(a)28(y)83(,)-386(the)-375(v)55(ariable)-375(will)-376(act)-375(as)-376(a)]TJ/F18 10.9091 Tf 184.403 0 Td [(mold)]TJ/F15 10.9091 Tf 28.084 0 Td [(to)-375(whic)27(h)-375(the)-375(prec)-1(on)1(ditioner)-376(will)-375(conform,)]TJ -212.487 -13.549 Td [(ev)28(en)-413(though)-412(the)-412(MLD2P4)-412(library)-413(is)-412(not)-412(mo)-28(di\014ed,)-432(and)-412(th)28(us)-413(has)-412(no)-412(direct)-413(kno)28(wledge)]TJ 0 -13.549 Td [(ab)-28(out)-333(the)-333(new)-334(t)28(yp)-28(e.)]TJ/F44 10.9091 Tf 22.914 -37.579 Td [(smoother)-14(class\050mld_x_base_smoother_type\051)]TJ/F15 10.9091 Tf 45.971 -13.549 Td [(The)-333(user-de\014ned)-334(new)-333(smo)-28(other)-333(to)-333(b)-28(e)-334(emplo)28(y)28(ed)-333(in)-334(the)-333(preconditioner.)]TJ/F44 10.9091 Tf -45.971 -13.549 Td [(solver)-1064(class\050mld_x_base_solver_type\051)]TJ/F15 10.9091 Tf 45.971 -13.55 Td [(The)-333(user-de\014ned)-334(new)-333(solv)28(er)-334(to)-333(b)-28(e)-333(emplo)28(y)28(ed)-334(in)-333(the)-333(preconditioner.)]TJ +/F15 10.9091 Tf 10.909 0 Td [(Declare)-333(in)-334(the)-333(application)-333(program)-333(a)-334(v)56(ariable)-333(of)-334(the)-333(new)-333(t)27(yp)-27(e;)]TJ +0 g 0 G +/F25 10.9091 Tf -10.909 -22.516 Td [(\017)]TJ +0 g 0 G +/F15 10.9091 Tf 10.909 0 Td [(P)28(ass)-334(that)-333(v)56(ariable)-334(as)-333(the)-333(argumen)28(t)-334(to)-333(the)-333(se)-334(routine)-333(as)-333(in)-334(the)-333(follo)28(wing:)]TJ +0 g 0 G +0 g 0 G +/F44 10.9091 Tf 66.591 -26.999 Td [(call)-525(p%set\050smoother,info)-525([,ilev,)-525(ilmax,pos]\051)]TJ 5.727 -13.549 Td [(call)-525(p%set\050solver,info)-525([,ilev,)-525(ilmax,pos]\051)]TJ +0 g 0 G +/F25 10.9091 Tf -83.227 -26.999 Td [(\017)]TJ +0 g 0 G +/F15 10.9091 Tf 10.909 0 Td [(Link)-308(in)27(to)-308(the)-309(application)-308(executable)-309(the)-308(co)-28(de)-309(implemen)28(ting)-309(th)1(e)-309(v)55(ar)1(ious)-309(metho)-28(ds.)]TJ -27.273 -22.515 Td [(The)-270(new)-270(solv)28(er)-270(ob)-55(ject)-270(is)-270(then)-269(dynamically)-270(included)-270(in)-269(the)-270(preconditioner)-270(stru)1(c)-1(tu)1(re)-1(,)-282(and)]TJ 0 -13.549 Td [(will)-321(act)-321(as)-321(a)]TJ/F18 10.9091 Tf 60.74 0 Td [(mold)]TJ/F15 10.9091 Tf 27.49 0 Td [(to)-321(whic)28(h)-321(the)-322(p)1(rec)-1(on)1(ditioner)-321(w)-1(i)1(ll)-322(confor)1(m)-1(,)-323(ev)28(en)-321(though)-321(the)-321(MLD2P4)]TJ -88.23 -13.55 Td [(library)-333(has)-334(n)1(ot)-334(b)-28(een)-333(mo)-28(di\014ed)-333(to)-333(accoun)28(t)-334(for)-333(this)-333(new)-334(dev)28(elopmen)28(t.)]TJ 16.937 -13.549 Td [(It)-358(is)-358(p)-28(ossible)-358(to)-357(de\014ne)-358(new)-358(v)55(alues)-358(for)-357(the)-358(k)27(eyw)28(ord)]TJ/F44 10.9091 Tf 244.802 0 Td [(WHAT)]TJ/F15 10.9091 Tf 26.813 0 Td [(in)-358(the)]TJ/F44 10.9091 Tf 32.052 0 Td [(set)]TJ/F15 10.9091 Tf 21.086 0 Td [(routines;)-370(if)-358(the)]TJ -341.69 -13.549 Td [(library)-319(co)-28(de)-319(do)-28(es)-319(not)-319(recognize)-320(a)-319(k)28(eyw)28(ord,)-322(it)-319(passes)-320(it)-319(do)28(wn)-319(the)-319(comp)-28(osition)-319(hierarc)28(h)27(y)]TJ 0 -13.549 Td [(\050lev)28(els)-307(con)28(taining)-307(smo)-28(others)-306(con)27(tain)1(ing)-307(solv)28(ers\051,)-312(so)-307(that)-307(it)-306(c)-1(an)-306(b)-28(e)-307(ev)28(en)28(tually)-307(caugh)28(t)-307(b)28(y)]TJ 0 -13.549 Td [(the)-333(new)-334(solv)28(er.)]TJ/F44 10.9091 Tf 22.914 -37.579 Td [(smoother)-14(class\050mld_x_base_smoother_type\051)]TJ/F15 10.9091 Tf 45.971 -13.55 Td [(The)-333(user-de\014ned)-334(new)-333(smo)-28(other)-333(to)-333(b)-28(e)-334(emplo)28(y)28(ed)-333(in)-334(the)-333(preconditioner.)]TJ/F44 10.9091 Tf -45.971 -13.549 Td [(solver)-1064(class\050mld_x_base_solver_type\051)]TJ/F15 10.9091 Tf 45.971 -13.549 Td [(The)-333(user-de\014ned)-334(new)-333(solv)28(er)-334(to)-333(b)-28(e)-333(emplo)28(y)28(ed)-334(in)-333(the)-333(preconditioner.)]TJ 0 g 0 G 0 g 0 G ET @@ -6560,10 +6572,10 @@ endstream endobj 603 0 obj << -/Length1 2262 -/Length2 18451 +/Length1 2234 +/Length2 18115 /Length3 0 -/Length 20713 +/Length 20349 >> stream %!PS-AdobeFont-1.0: CMBX10 003.002 @@ -6583,7 +6595,7 @@ FontDirectory/CMBX10 known{/CMBX10 findfont dup/UniqueID known{dup 11 dict begin /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0 ]readonly def -/FontName /XKTSPK+CMBX10 def +/FontName /FOOXCC+CMBX10 def /FontBBox {-56 -250 1164 750 }readonly def /PaintType 0 def /FontInfo 9 dict dup begin @@ -6616,9 +6628,7 @@ dup 79 /O put dup 80 /P put dup 82 /R put dup 83 /S put -dup 84 /T put dup 85 /U put -dup 86 /V put dup 97 /a put dup 98 /b put dup 99 /c put @@ -6692,40 +6702,43 @@ SDa |RR Dt6%'N X^3Z`jFj&cVd*$ry -hdg̙wM Ш@c٧Vu*R{벂5HdѨ#Uۂ.=-TWjTi3WMv+,;*I2i;X#UyYՑ Gg$||F ǘ:g.[~,Xj.O\ &͏J8Ng,$1G| ^-eߵT?~2Ŧa %[Y+#iqOx6@ҫN} oN*#Il S`]ݳhUG_\z!n -vRvo½lYUB.-A!>kg4S!e\Oͯ;Oˁ(jI6ab䤺;yD+O91U^swՌtaO1FedqQ&.4nĩYsietqMf?gI%]C)$wR]-p|.+򆚚9 ʝͮ6 ^b|~I[Ձ"ґ6il`VY`=۱w%2vl|TQvS 1|eV |nQ; )J1am7vOgQx*[B)1ס|c/_Ɂmpi:9)>ʭ39Ό-YǨo|AD[+tp.(Zʚ=ғo|\`QCE`4.ֻL#VJcVm",!>^J]$.?[W9FgD0^g\ naV}B$A -lx^AO cܤ6V0+eY4`eY#jZ /):ٌbpXDsw]B!|lpi,p* g$@dSJ*3{Ipp hgi<ʌ5xwcB(ߵ<}T7\V9i@+ /p1=qoк (3D:ViqN!Knϑ^(qR~hXUzL'~kC|S:c/snE2W]NhGHWɞ5!Ry![9A aq|oZܳwT1&CMo, -IENEo1T[ݡѽm*aCr ,mNk# L7t!uLNs;ƍ$e0}6f,ɛ'*Gr} _~Q {j+Ļu8HW  hܳm\?>Ny]9L4N>eK ?mp\rr%< ,mouA 2oL -n}Zq -y󒊜hlFXi_~6-ݠNlNWPKmoQ~!뵐ǐv>!W |S]G$\mp_*!A5]ء& -a'n2xhT:t~:@pJΞt=Z$ܺ/%1M"|.BRtLNKz6wY,YLh3®_ZRe?RK{;~o~dPW@ECS<_Ut $hps nE9ѴqU^h܁x-oX՟]끨v={{e# lk# ˳k$82dd}~3hDNO3"b-e?S+ص`$ -*6̭i">4O~{ͶņgAޅU'-⎗&cw?$]AZy^rՋl?[ HetS?bȑRzaZFc65\7^FI2t?tW; eV0'3y3/gGY4?B37TRȟ6`WEFrrwKĒ'vn9GO˿!Nl-|VjXVHؓv9ep<9,r"̅(4N2"Ҷʽl 1\Ζn~;K+hi([?-|trn_.=Ed߼P!`{簸2'a$|w^/u74d$gXE<[5<"ũOXȔf8{._ dujH0i6kPdQQ0:gUe}tS ت`"% W$}µX5YL2{ء2xrTaN>#\ IɕE7*vHc§d 9y5^ -Sv 1;,g11Yp/)_V;(!Mpm]^lrR ;K(u%M -YW0 l0J4l0`ٷ`9P]F:ni EKUoMT^Ql 0Շk1(Q(BVX"ѬHtZ9Unon/ۘ|7u| pw,[̛֙)T2Үh-[a@hq~-zm5@<͘l@ -GA"~a\vfxTst%Gh?7 E.]N-=Q;5OZP@EÄX/Qq[sf24!%u"BY sbL XorVgP%dt|ON]hKUG'H0Dyv ꫊k D,JvudnQ٣*&bcy󐭧̚~VmKrȚ䥉ףZXg`9pct[f;b"+,n^.͡ɌbzQ]FLhZjJ5,JcK&frޭ|\$j+%6(+2ȧ]FªG9m}$#>ٴA{&jZ!1:EP w=^74^EKA֜Qk;ZJYS8"eSȦ.iэpCZs˥J8lB^|)D̡Ÿ]'dcҊx}d-G@7)oAw>GYO4ٙ+UqЦ-"WPwcǫQ(M⮶\0v\jF -(Gu3}HcZ_~#']/ˬ|KpxCy  o a x%seAzF++[G͊O!mwJSJc:n]/29qWQo^Ѹ&ƊΤ0;l,`.Ay~{9mL kr>=2&blOm7nc_gSl<))Yĸ&(}h~zKa%\S^ -(}-u; ~GNhK_V"Nȓ~NZabaJX3A8dD0&!8jڕx鷵OV{+DA:m`!R4C_C-ڻI[;o7dIg<HmUX(}T!qdA'IW0Q+Q9?lŰ2JJxl@˩T1U|F1%ayEgBVj~x>yghʜKLr둦~H]}7|Z.]=ھwtd,`dAr+E=4n?K᱅8ռ=O4Xd1ݝo> 66ӟyyr!(`AzJG}EŔeB0DD42Y:.uZW^= UAdUBI9RzsxqE f#w0%r*:]>`~՛ʠT&b`sZkaѵ=OhMMd"3b6/$n~<ַ˃1-?<݋~!&L-Ge)h 4XɴlD)zYH"_:z?m1cxP싸] -51UJn <mޟY#ѥǝgؠ&C8'c[G1b1pOڤ5wLӍ8za]-pS[]tBjDje t钛"(nIZ -܁8P'!j3$.טc6^нvHOP3Cʲ02-zOsyE1 P'#"5jg1~4KXCA O7yc8"!/+'#wBulWؾix.M5((&MOT1#?Q)vM'Fs6iDD=EzՂBRqo[@ -+݇/ -\hrȻ:ZoEooq]HDfS}#> o5(_m!TN@QLFJ_=,yI̔4{&^DS!l 肯ha;g(ի|& -nRZ1ғVSﴉ9UHfw|/@ ܱ`R61е7|ŀ 4ɬH[ ԝ[Bk*F0'M(O*&"omG@nmPuZB( J`2;=P)PZD/ ~1 3⏎8VOZ -3o -BbL9s1PVb=<^v킽KF 09[n_@\6qƒLW:w=t -H@ҩf@5;`6XijׅPNjRhS{_ܻd_63@RlhHjF{0wWx[O\]Gxq2g 咶n!L@ukcTzU\~Rxl PG۳t=#.8ش\rx˙zhQXƒU$kBլZZ/h_Ic={kjy8UyHD!50U7']:>0"[u2cllJpS2F-!I/v;l5 ҾL-B\uiPS^yH;WMbcAo)sx]lVh*KpޞmL@|I'EhВ/N0AY M9٫[yRLMDyl4T lw{uar.UMq&׌W;Fm#|X-8OY]r G\:L⊦enmi6ȞDK:$r^9͚<V5Lewo/\q$>}U|ňnfԶOqpDgïGSSb* mMw9T =ǐRΪ¶Ŧ%Y˘V?A":;sm%,㊏eJ/PÿL=p9}BӞd<4.T{*-Dnf2;VHC>o #ŌWT^qi=cI&gUE…lIx*rk!ɛ -o</? \ϋ B O4%sf9_@H!˾[>or7+ -Fgυ_L4i^FCCm'=".xR3 zҧu.W~Y~ %9~JK7O'Fm>,*r ^3`MbS*_QwL582N-ȪuvU{.C`e ҞܲO$(Q%nF -$װ5O T9gK=ҐL-Yk}ڧyhcꔀg_k6ͤ^-Ǩb lvi,[BcYb{(ynEQuP7$I'/haO"m" i*iЏs FOJcs/m_KM'5ʸ,}.gH^$W1ZRx;/ϼkfR^%FPsLDgYnК,z$BDm7qS$nݖI2q_0U*ʹtVw-$1o q+&"?ʔt^~4_>!v߂7cޣI}'5orh'Ȣ ˠT"9w8@h@fP{dåƢK˶pyE*~_eS#Hm|a7\z4bf%x/8oY۹4G$:dk9x2Wne 䴍R'›P`cAcHhB`<)?Qia9j!21"vw1"-|OY0㺟 ixϹb=+Ss{(^9]i]P+f0µa֏9^YqNՉo~Nq|A,˻RqBrÛyҥ()a&Yhy)_i kj&à Qq#/ [>u /If*x&iyԽvP@˖f%p`CjE3^/WEMd@)r>rrRt\i{=`_hc?ϪS!9(^ڼၒ#FBC!9Jt'Z  p߳ObG*=ڪeG|׻%%u"H϶UJE{xiύ4}c"Ce=Rh1 C`oP;}G1%(Im>Ә~hڰ%b{DBH@# /ׅtkg4S!e\Oͯ;Oˁ(jI6ab䤺;yD+O91U^swՌtaO1FedqQ&.4nĩYsietqMf?gI%]C)$wR]-p|.+򆚚9 ʝͮ6 ^b|~I[Ձ"ґ6il`VY`=۱w%2vl|TQvS 1|eV |nQ; )I)'cSNB'[eG{JTNqvcL09͵n D +uo8!'ol(jm,Q`@Vy$\Ce)lFilu'.0!m1|[92;iQuY@Sw ެtNnB$&D0] +JO#98:m.5 nJ0c\ i ?++! A#3'NQIe }qX›)x83l Da[ϧeA1 W\C-#R /8xة|A;` w[JS.72g$+z$f > aTRɑpy:Khd)0V{Լ `Bո r)#sV+PG`›Ȝ*+)*ٮ_{e:*[e綏ޜJk!'A3<ndh1~&|J6]K*2bfoC#pl/TLEؖA{ȰCY"oiԕ)'9.f 0ŧƖGH7^IqdJ2} 6f26j.'wɉ#:ƙ&aR)q^Gp>)"uz[.] nm_+rհZun1ҁ]&qYmڀ^&ׯpr +c.4-Uwm/ ̀CBj@R)8toh~)b)@jȁӃ +!9Fpxx)'PHJNڨ@8UdwRX^Z.xDE_rk\S)l_'XheOĎw@®>sau5N8.|1kK3CjmSKt/-c]SRU׵ +Ʉz~H{'Ljjq( y&S/`= VTCMѫ٭>/>C;*6<49д;>,D;lMYMrk3Ն`O^ZU8WXgd# ))4t2dI_q7"NӚc-*+tT$<7 +6]>0Yd. KW&VVP 3Z讀\Q1<q1y؛2x.Tٝuk eK,ng9f~ѐe!y`bƏݗ jS(;" ~jT<3 8.oO&`c,[08k4AzY^ +!H [I8ؗ1 TP' :钤|Veնq\e=4HԂlZ\V:bM6^G_HI6LHIDLނP 9MxV[dkzgʟoK1v_hM)slmƋQz:mv@k˖;CkJS>;kglkS0SRmQgC&&6K1(18씩6 %@gY%vys5蛧7 + 61ŕ#ϭ"uK +LޱDZʾFr<1:AQ"3c + @ӡ.PqWBH i+H3'=s0HN TKධL|[`V>9dKpe@yP*+ |D)НgA0gOW7t[ؾA¿:ĨԬOm{݁w!S:g~?tjioZr +@v(h5*5Jڳ;EyvJQıe4{/J#i/M(`K%t ZFt@oVXRhb[jeZt]memm]F֞pЌJZSs67oəѝ\D`ߨV*^rQ]IAJwf +p?!?b]Ez + +)9~T6M̅ʹ\dRۗn:OHnc0ԥyS՛?ⵏZBrkLu `yOdg+OX6՗Dz洬B݀P߁yζƋ pU'Vyu@d#ejW8 GզҶ aT czj|:03΁~%4e#ks-K!N5:ܦ/X<Nq8ͬ~`haY<}Ç5 $t*Ow T$ooejdڊ>u4 $3'=yòjT2unGaPXz:KN> z~ALbN6?tŎseX}Rfr1[Z/ +'% dȪ*9 ߏ ZOb bDirekT +{΂։ՎM>;/p:b2ͺ3WԊӊ&I-4jGZr&>"( .z`b%-;#۱7Mw;v¤A3<:x5eDz [C@Lw(h-~YC0rdH8R[~mƊmhecF͚ prJQTr|6.i3BH붳㐯j8dVPCL:le}J$@@*^R3  LPNa"~dc&.)S) ճiFN[CɱWBT3`<hlc +[5V(O3X%j:qkix0X#?]OVGrl-)#Z fE~,AMnGKx0iB^ߨfoʋOq JD!67Tk0gk8& (H +Z I}Y1aFY7\0U긇rf!i_Mo%z`"0ܳ̽`A1X}tS~)6(]'a#=F(>7iaI¢iIŻ~T^J! afcvq @jYW pZ!#`in63/0 pLI+!}:n[Z~Ґջ`q +]i/)C=/ ;ah0m9e7ph_NʝYZg\{h&kEUuȲrԳ.gG8E#(ng +bϞq;Я)xIC_[jQ44]̯s'1*^ jԺ?OvʛPT}a J}(V`(ySѿ7Z}2oѷ`M-~Ie΍Uj&Va͡u+46a8"{Z0fmQmhi[YkXtmKUg4vӖ.un-쨯39eYdKB~]ù)t;R +cfu.=VYѦ>WаvC".Mӧko)hIMhA7SbGlio(;oDoVHQzY ă+ǾS˪jsu^2R,WDҟIF6|8 +)TeÂ#75F}쓸OSFM o5Kmm̈=qeG,3z|J< C>܁f5V0>@ø150L{d*7XX~~oT[o)>c4Mn!Pʴ֩隗ᖕVm +Uν= LgE: -nDabcUFȾ.-:> ٵ*WL⊖@s^Dw+֠BǶ`aRMYkl`43|'d,gʥW5@Âr}h"m((<O؟qaV1ts'^wӰC Q2v\e>Kp&g?qaup5a{{fOB|2-,޸2EaF0綥Jw xo)3I]A&AOr &H́%fE`4=wudl duwpמOc. ZkXNƯ~斋BIYvhM>ˁgzSJM EP8(;T RpQEBڕy\>جDնsJѸ@(j^`]noT,+تlKSg^v *HAJ {%vU]O`,!qy΍T5G{ƹϵz/u{^کPVu %TRmgpSW:cQ4|^eBDt||gVy8aT" 22mx1w)B.&xW7fs Ya0gu:g%iN3K3,u`, G[il\߁L $DVGQ9Q8>C3g~]e5( NTC ҭQ> \xy+cwS' 7hs==iOw#ioJ_Fy +xla5ۚ%xŨwWWegLEX7Spmgfnp=rܣw*.(0@~lGTzX(o+ +RMCgg|!R $BCB: Ԩ$ҌWXc/7HYcƐ+NpyZyb<Q0W:Nmc/Ă#f:BHB6̶*:/t95#Tz^)o%\ ЎBk˯+oNC!M\{HCƠOwAY$A H2Q'*->Qi14?\ŶpW& dFXTb<O(&XߴǎXgk2vt2Sڤű ߗ~yґOWc{Uԯ<;;8|xJ"(u_ywf O1N 4JP9:e,E=V7Rb$_?m8Z!5b u\gV+ߌ *MU-2R 9jFYQd\G=ߐpԔQЎ#]/q-]>A7'v${$znLs17bk@n:b󯈋 +JP9dipmf_),I\),; +q -h VqY +R^o x]s]k.]TàoҦ*f%KP^lFIƻ 9щ,e4]!E'2S\^QÁ<ѫt +,K%^zVYWۺLEɅOHc?`N\Ս[Dp UPU)0^rRJu_ lKo{ M8ŵGG{_tG2\_ &7ƣUWHu9H~EG}@ F953)iBs!!P<[w![ș@eu,,P-)> }m +f pߣ&^(={4N?ns.|mHΗn +Sپr6SjB="R:jx[ĘG;_B/0Z%OyEp1W$cD'S-njIR1O\s)5#}- ?fQ {@2)|9+ wz{Ia?92:&oX'`k`&!'JZꔩM+D%Dv8c:;];KCozPZMr>8`~Q1URقc *@|4lklqQ*%XL@ ȖV/k ]A9_C: ß4,GTi +:Cd_榁]_Jè Vg= ?b,Aa,Rt:4 >4! PRzF O۬Dlx'_X+#d쌭g0";d%6_Syt}(tԦە?"CK|A¥uy#lsXN <$G:I Xq$a3kBS=SfPDp N[ +ܜǥ@f0Ҧ7Lu3k>Wt6ʌR;o:)<%خhif%[dJIǞ懈(>u[s.//co"%Ӣ]M)u|Gkg4d[7u)>xVR\ۃ݃y J q>WPH;LJCHr@J#T^*ҏEoXQC1gmfC*UJf@e/NNh؋#bFX|YsqZ%cM#|p1E 1!0A2{κ&!x$ߎTL3ră9./T0/j`"gm?Fl VP{vӧ'hVs\;נy% f'bZj.:@R8ՠsuX n qQp1cMyߐL} bbؾK}k8#QmJȥD y@˵ȇr!ܡ#,Y%aaҟ1r(dZ23AFn,xG==Q0S~Z~ R*|:M܀MJ_ `jIUJ,nCo /^Ls G^B!"MdNFLFJQ]>.~+"$*^!K!]S*,'CyΘ".mY ׊'KVv&o>GV˰0 AnINd٩U $A^H+BF8{N> stream 529 0 530 154 535 301 87 355 532 408 539 527 537 661 541 808 91 862 538 915 @@ -7671,7 +7684,7 @@ stream 203 5222 247 5276 246 5330 269 5384 200 5438 333 5492 199 5546 575 5600 583 5706 585 5820 248 5874 198 5928 311 5982 202 6036 582 6090 586 6183 587 6879 588 6947 589 7251 590 7379 591 7411 592 7431 593 8074 594 8446 595 9110 596 9500 597 10092 598 10720 599 11227 600 11872 -601 12467 602 12819 604 13451 606 13844 608 14206 610 14540 612 14834 614 15153 616 15376 618 15620 +601 12467 602 12819 604 13451 606 13840 608 14202 610 14536 612 14830 614 15149 616 15372 618 15616 % 529 0 obj << /Type /Annot @@ -7826,7 +7839,7 @@ stream >> % 555 0 obj << -/Font << /F41 137 0 R /F15 136 0 R /F17 124 0 R /F43 175 0 R /F44 225 0 R /F18 265 0 R >> +/Font << /F41 137 0 R /F15 136 0 R /F17 124 0 R /F25 327 0 R /F44 225 0 R /F18 265 0 R >> /ProcSet [ /PDF /Text ] >> % 561 0 obj @@ -8097,7 +8110,7 @@ stream % 604 0 obj << /Type /FontDescriptor -/FontName /XKTSPK+CMBX10 +/FontName /FOOXCC+CMBX10 /Flags 4 /FontBBox [-56 -250 1164 750] /Ascent 694 @@ -8106,7 +8119,7 @@ stream /ItalicAngle 0 /StemV 114 /XHeight 444 -/CharSet (/A/B/C/D/E/F/G/H/I/K/L/M/N/O/P/R/S/T/U/V/a/b/c/comma/d/e/eight/f/fi/five/four/g/h/hyphen/i/k/l/m/n/nine/o/one/p/period/q/question/quoteright/r/s/seven/six/t/three/two/u/v/w/z/zero) +/CharSet (/A/B/C/D/E/F/G/H/I/K/L/M/N/O/P/R/S/U/a/b/c/comma/d/e/eight/f/fi/five/four/g/h/hyphen/i/k/l/m/n/nine/o/one/p/period/q/question/quoteright/r/s/seven/six/t/three/two/u/v/w/z/zero) /FontFile 603 0 R >> % 606 0 obj @@ -9243,8 +9256,8 @@ endobj 672 0 obj << /Title (MultiLevel Domain Decomposition Parallel Preconditioners Package based on PSBLAS, V. 2.1) /Subject (MultiLevel Domain Decomposition Parallel Preconditioners Package) /Keywords (Parallel Numerical Software, Algebraic Multilevel Preconditioners, Sparse Iterative Solvers, PSBLAS, MPI) /Creator (pdfLaTeX) /Producer ($Id: userguide.tex 2008-04-08 Pasqua D'Ambra, Daniela di Serafino, Salvatore Filippone$) /Author()/Title()/Subject()/Creator(LaTeX with hyperref package)/Producer(pdfTeX-1.40.17)/Keywords() -/CreationDate (D:20170421134257+01'00') -/ModDate (D:20170421134257+01'00') +/CreationDate (D:20170424154232+01'00') +/ModDate (D:20170424154232+01'00') /Trapped /False /PTEX.Fullbanner (This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) kpathsea version 6.2.2) >> @@ -9406,7 +9419,7 @@ stream << /Type /Font /Subtype /Type1 -/BaseFont /XKTSPK+CMBX10 +/BaseFont /FOOXCC+CMBX10 /FontDescriptor 604 0 R /FirstChar 12 /LastChar 122 @@ -10061,20 +10074,20 @@ endobj /W [1 3 1] /Root 671 0 R /Info 672 0 R -/ID [ ] +/ID [ ] /Length 3370 >> stream -1>mCEmBmA'm@9m?  +1>mCEmBmA'm@9m?  :m>  ;m= Jm<\m;]m:6 m96m86m76+m66;m56Nm4 m3!" m2#$m1%&Wm0'(^m/)*m.+,m--.m,/0m+12m*34m)56"m(78&m'9:;?<=m -mmmB@ AFCgDmm IGHKLMNOPQRSTUVWXYZ[\]^_`abcJlm 5mR    - Sdm m(GB@'I<; !"q/%$(#&m*+,-/123456<)8.0767>=F:?@ABCDFG>K= IEHm012?NLśMPROQmUSTWYVX^Z([abc666666666`6 _P6 .H)*+6 6666666 k66mmmmmmmA6666666#6O6m 6 6!6"m6%6&6'6(6)6,6$6*6/606.626-61,6465666768696E6F6B63j6:6<6=6>6?6@6A6M0M6G6H6I6J6K6D6O6C/6L6_6Q6R6S6T6U6V6W6X6Y6[6PT(6Z6c6]6`6\r6^m6a6b!| -    !"#)$%&'(I@49+-*,m1.&>/3725756<8]:;>A=?EBsCDGJFHm NK:LQRSTUPXO6VZ[\_Y -/]bca`R Q   -s m!xc #!3$u%-.C4(589m"JD,EKLMNOPQRSTUVWXYZ[\5]x^_'`a1bYcm@@/m^em|mmm[mI.mmm#m$m%m&mDmEmFmGmHmImJmKmLmMmNmOmPmQmRmSmTmUmVmWmXmYmZm[m\m]m^m_m`mad +mmmB@ AFCgDmm IGHKLMNOPQRSTUVWXYZ[\]^_`abcJlm 5wR    + Snm m(GB@'I<; !"q/%$(#&m*+,-/123456<)8.0767>=F:?@ABCDFG>K=IEHm012?NLťMPROQmUSTWYVX^Z2[abc666666666`6 _Z6 8H)*+6 6666666 k66mmmmmmmA6666666#6Y6m 6 6!6"m6%6&6'6(6)6,6$6*6/606.626-61,6465666768696E6F6B63t6:6<6=6>6?6@6A6M0M6G6H6I6J6K6D6O6C/6L6_6Q6R6S6T6U6V6W6X6Y6[6PT26Z6c6]6`6\r6^m6a6b! +    !"#)$%&'(I@49+-*,m1.&H/3725A56<8]:;>A=?EB}CDGJFHm NKDLQRSTUPXO@VZ[\_Y +9]bca`\B R    +s m!xm` #!3$$%-.C4589m"JDEKLMNOPQRSTUVWXYZ[x\;Y]"^_j`a8b_c CmFnmdmm<mmmOmmmm#m$m%m&mDmEmFmGmHmImJmKmLmMmNmOmPmQmRmSmTmUmVmWmXmYmZm[m\m]m^m_m`ma/ endstream endobj startxref -584176 +585775 %%EOF diff --git a/docs/src/userinterface.tex b/docs/src/userinterface.tex index 8ec6c6a7..48095b4a 100644 --- a/docs/src/userinterface.tex +++ b/docs/src/userinterface.tex @@ -856,31 +856,45 @@ as follows: \clearpage -\section{Adding smoothers and solvers to MLD2P4\label{sec:adding}} - -\textbf{Da ampliare e completare - SALVATORE.} \\ - -Completely new smoother and/or solver classes derived from the -base objects in the library may be used without recompiling the -library itself. Once the new smoother/solver class has been -developed, the user can declare a variable of that new type in the -application, and pass that variable to the \verb|p%set(solver,info)| -call; the new solver object is then dynamically included in the -preconditioner structure. - -\ \\ - -If the user has developed a new type of smoother and/or -solver by extending one of the base MLD2P4 types, and has declared a -variable of the new type in the main program, it is possible to pass -the new smoother/solver variable to the setup routine as follows: +\section{Adding new smoothers and solvers to MLD2P4\label{sec:adding}} + +Developers can add completely new smoother and/or solver classes +derived from the base objects in the library may be used without +recompiling the library itself. To do so it is necessary first to +select the base type to be extended; in our experience, it is quite +likely that the new application needs only require the definition of a +``solver'' object, which is almost always acting only on the local +part of the distributed matrix. The parallel actions required to +connect the various solver objects are most often already provided by +the Block Jacobi or the Additive Schwarz smoothers. +To define a new solver, the developer will then have to define its +components and methods, perhaps taking one of the predefined solvers +as a starting point if possible. + + +Once the new smoother/solver class has been developed, to use it in +the context of the multilevel preconditioners it is necessary to: +\begin{itemize} +\item Declare in the application program a variable of the new type; +\item Pass that variable as the argument to the se routine as in the + following: \begin{center} \verb|call p%set(smoother,info [,ilev, ilmax,pos])|\\ \verb|call p%set(solver,info [,ilev, ilmax,pos])| \end{center} -In this way, the variable will act as a \emph{mold} to which the -preconditioner will conform, even though the MLD2P4 library is not -modified, and thus has no direct knowledge about the new type. +\item Link into the application executable the code implementing the + various methods. +\end{itemize} +The new solver object is then dynamically included in the +preconditioner structure, and will act as a \emph{mold} to which the +preconditioner will conform, even though the MLD2P4 library has not +been modified to account for this new development. + +It is possible to define new values for the keyword \verb|WHAT| in the +\verb|set| routines; if the library code does not recognize a keyword, +it passes it down the composition hierarchy (levels containing +smoothers containing solvers), so that it can be eventually caught by +the new solver. \ \\ diff --git a/mlprec/impl/mld_ccprecset.F90 b/mlprec/impl/mld_ccprecset.F90 index 64800478..1b9518ff 100644 --- a/mlprec/impl/mld_ccprecset.F90 +++ b/mlprec/impl/mld_ccprecset.F90 @@ -106,7 +106,7 @@ subroutine mld_ccprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -118,21 +118,32 @@ subroutine mld_ccprecseti(p,what,val,info,ilev,ilmax,pos) &' should call MLD_PRECINIT' return endif + nlev_ = size(p%precv) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') @@ -151,14 +162,6 @@ subroutine mld_ccprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - ! - ! Rules for fine level are slightly different. - ! - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(psb_toupper(what)) case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& @@ -166,7 +169,9 @@ subroutine mld_ccprecseti(p,what,val,info,ilev,ilmax,pos) & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & & 'SUB_OVR','SUB_FILLIN',& & 'COARSE_MAT') - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do case('COARSE_SUBSOLVE') if (ilev_ /= nlev_) then @@ -279,10 +284,11 @@ subroutine mld_ccprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif else if (.not.present(ilev)) then ! @@ -469,7 +475,7 @@ subroutine mld_ccprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -478,26 +484,41 @@ subroutine mld_ccprecsetc(p,what,string,info,ilev,ilmax,pos) info = 3111 return endif - nlev_ = size(p%precv) + val = mld_stringval(string) - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if + if (val >=0) then - if ((ilev_<1).or.(ilev_ > nlev_)) then - write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ - info = -1 - return - endif + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) - val = mld_stringval(string) - if (val >=0) then - call p%set(what,val,info,ilev=ilev,pos=pos) else - call p%precv(ilev_)%set(what,string,info,pos=pos) + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do end if end subroutine mld_ccprecsetc @@ -556,8 +577,8 @@ subroutine mld_ccprecsetr(p,what,val,info,ilev,ilmax,pos) integer(psb_ipk_), optional, intent(in) :: ilev,ilmax character(len=*), optional, intent(in) :: pos -! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + ! Local variables + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_spk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -568,7 +589,7 @@ subroutine mld_ccprecsetr(p,what,val,info,ilev,ilmax,pos) else ilev_ = 1 end if - + select case(psb_toupper(what)) case ('MIN_CR_RATIO') p%min_cr_ratio = max(sone,val) @@ -584,37 +605,56 @@ subroutine mld_ccprecsetr(p,what,val,info,ilev,ilmax,pos) endif nlev_ = size(p%precv) + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif + ! ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then - ! - ! ilev not specified: set preconditioner parameters at all the appropriate levels - ! + ! + ! ilev not specified: set preconditioner parameters at all the appropriate levels + ! - select case(psb_toupper(what)) - case('COARSE_ILUTHRS') - ilev_=nlev_ - call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) + select case(psb_toupper(what)) + case('COARSE_ILUTHRS') + ilev_=nlev_ + call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) - case default + case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - end do - end select + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + end select endif diff --git a/mlprec/impl/mld_cprecset.F90 b/mlprec/impl/mld_cprecset.F90 index 2d0a6344..f3baa385 100644 --- a/mlprec/impl/mld_cprecset.F90 +++ b/mlprec/impl/mld_cprecset.F90 @@ -105,7 +105,7 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -121,8 +121,14 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if if ((ilev_<1).or.(ilev_ > nlev_)) then @@ -131,6 +137,12 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(what) @@ -150,12 +162,6 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(what) case(mld_smoother_type_,mld_sub_solve_,mld_smoother_sweeps_,& & mld_ml_cycle_,mld_par_aggr_alg_,mld_aggr_ord_,mld_aggr_type_,& @@ -163,8 +169,10 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) & mld_sub_restr_,mld_sub_prol_, & & mld_sub_ovr_,mld_sub_fillin_,& & mld_coarse_mat_) - call p%precv(ilev_)%set(what,val,info,pos=pos) - + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + case(mld_coarse_subsolve_) if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& @@ -194,14 +202,64 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_umf_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_sludist_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) @@ -227,11 +285,11 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) end if call p%precv(nlev_)%set(mld_sub_fillin_,val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif - else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate @@ -259,31 +317,80 @@ subroutine mld_cprecseti(p,what,val,info,ilev,ilmax,pos) case(mld_coarse_solve_) if (nlev_ > 1) then - - call p%precv(nlev_)%set(mld_coarse_solve_,val,info,pos=pos) + call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) select case (val) case(mld_bjac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) -#if defined(HAVE_SLU_) +#if defined(HAVE_SLU_) call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) -#else +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) +#else call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) +#if defined(HAVE_MUMPS_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_umf_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_sludist_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) end select - endif case(mld_coarse_subsolve_) @@ -343,7 +450,11 @@ subroutine mld_cprecsetsm(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 @@ -356,7 +467,12 @@ subroutine mld_cprecsetsm(p,val,info,ilev,ilmax,pos) & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -397,20 +513,29 @@ subroutine mld_cprecsetsv(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -474,7 +599,7 @@ subroutine mld_cprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -499,7 +624,38 @@ subroutine mld_cprecsetc(p,what,string,info,ilev,ilmax,pos) endif val = mld_stringval(string) - if (val >=0) call p%set(what,val,info,ilev=ilev,pos=pos) + if (val >=0) then + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) + else + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do + end if end subroutine mld_cprecsetc @@ -559,7 +715,7 @@ subroutine mld_cprecsetr(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_spk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -571,12 +727,6 @@ subroutine mld_cprecsetr(p,what,val,info,ilev,ilmax,pos) return end select - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if - if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& @@ -585,12 +735,27 @@ subroutine mld_cprecsetr(p,what,val,info,ilev,ilmax,pos) return endif nlev_ = size(p%precv) - + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif @@ -598,8 +763,10 @@ subroutine mld_cprecsetr(p,what,val,info,ilev,ilmax,pos) ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then ! @@ -613,8 +780,8 @@ subroutine mld_cprecsetr(p,what,val,info,ilev,ilmax,pos) case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) end do end select diff --git a/mlprec/impl/mld_dcprecset.F90 b/mlprec/impl/mld_dcprecset.F90 index 7c4e7490..ee07a117 100644 --- a/mlprec/impl/mld_dcprecset.F90 +++ b/mlprec/impl/mld_dcprecset.F90 @@ -112,7 +112,7 @@ subroutine mld_dcprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -124,21 +124,32 @@ subroutine mld_dcprecseti(p,what,val,info,ilev,ilmax,pos) &' should call MLD_PRECINIT' return endif + nlev_ = size(p%precv) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') @@ -157,14 +168,6 @@ subroutine mld_dcprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - ! - ! Rules for fine level are slightly different. - ! - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(psb_toupper(what)) case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& @@ -172,7 +175,9 @@ subroutine mld_dcprecseti(p,what,val,info,ilev,ilmax,pos) & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & & 'SUB_OVR','SUB_FILLIN',& & 'COARSE_MAT') - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do case('COARSE_SUBSOLVE') if (ilev_ /= nlev_) then @@ -299,10 +304,11 @@ subroutine mld_dcprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif else if (.not.present(ilev)) then ! @@ -503,7 +509,7 @@ subroutine mld_dcprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -512,26 +518,41 @@ subroutine mld_dcprecsetc(p,what,string,info,ilev,ilmax,pos) info = 3111 return endif - nlev_ = size(p%precv) + val = mld_stringval(string) - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if + if (val >=0) then - if ((ilev_<1).or.(ilev_ > nlev_)) then - write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ - info = -1 - return - endif + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) - val = mld_stringval(string) - if (val >=0) then - call p%set(what,val,info,ilev=ilev,pos=pos) else - call p%precv(ilev_)%set(what,string,info,pos=pos) + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do end if end subroutine mld_dcprecsetc @@ -590,8 +611,8 @@ subroutine mld_dcprecsetr(p,what,val,info,ilev,ilmax,pos) integer(psb_ipk_), optional, intent(in) :: ilev,ilmax character(len=*), optional, intent(in) :: pos -! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + ! Local variables + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_dpk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -602,7 +623,7 @@ subroutine mld_dcprecsetr(p,what,val,info,ilev,ilmax,pos) else ilev_ = 1 end if - + select case(psb_toupper(what)) case ('MIN_CR_RATIO') p%min_cr_ratio = max(done,val) @@ -618,37 +639,56 @@ subroutine mld_dcprecsetr(p,what,val,info,ilev,ilmax,pos) endif nlev_ = size(p%precv) + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif + ! ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then - ! - ! ilev not specified: set preconditioner parameters at all the appropriate levels - ! + ! + ! ilev not specified: set preconditioner parameters at all the appropriate levels + ! - select case(psb_toupper(what)) - case('COARSE_ILUTHRS') - ilev_=nlev_ - call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) + select case(psb_toupper(what)) + case('COARSE_ILUTHRS') + ilev_=nlev_ + call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) - case default + case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - end do - end select + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + end select endif diff --git a/mlprec/impl/mld_dprecset.F90 b/mlprec/impl/mld_dprecset.F90 index 679c388a..d94257cb 100644 --- a/mlprec/impl/mld_dprecset.F90 +++ b/mlprec/impl/mld_dprecset.F90 @@ -111,7 +111,7 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -127,8 +127,14 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if if ((ilev_<1).or.(ilev_ > nlev_)) then @@ -137,6 +143,12 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(what) @@ -156,12 +168,6 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(what) case(mld_smoother_type_,mld_sub_solve_,mld_smoother_sweeps_,& & mld_ml_cycle_,mld_par_aggr_alg_,mld_aggr_ord_,mld_aggr_type_,& @@ -169,8 +175,10 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) & mld_sub_restr_,mld_sub_prol_, & & mld_sub_ovr_,mld_sub_fillin_,& & mld_coarse_mat_) - call p%precv(ilev_)%set(what,val,info,pos=pos) - + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + case(mld_coarse_subsolve_) if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& @@ -202,22 +210,75 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_umf_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#if defined(HAVE_UMF_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_sludist_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#if defined(HAVE_SLUDIST_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_umf_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) @@ -243,11 +304,11 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) end if call p%precv(nlev_)%set(mld_sub_fillin_,val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif - else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate @@ -275,41 +336,94 @@ subroutine mld_dprecseti(p,what,val,info,ilev,ilmax,pos) case(mld_coarse_solve_) if (nlev_ > 1) then - - call p%precv(nlev_)%set(mld_coarse_solve_,val,info,pos=pos) + call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) select case (val) case(mld_bjac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) #if defined(HAVE_UMF_) call p%precv(nlev_)%set(mld_sub_solve_,mld_umf_,info,pos=pos) -#elif defined(HAVE_SLU_) +#elif defined(HAVE_SLU_) call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) -#else +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) +#else call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) +#if defined(HAVE_MUMPS_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_umf_) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_umf_) +#if defined(HAVE_UMF_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_sludist_) +#if defined(HAVE_SLUDIST_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_umf_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) end select - endif case(mld_coarse_subsolve_) @@ -369,7 +483,11 @@ subroutine mld_dprecsetsm(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 @@ -382,7 +500,12 @@ subroutine mld_dprecsetsm(p,val,info,ilev,ilmax,pos) & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -423,20 +546,29 @@ subroutine mld_dprecsetsv(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -500,7 +632,7 @@ subroutine mld_dprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -525,7 +657,38 @@ subroutine mld_dprecsetc(p,what,string,info,ilev,ilmax,pos) endif val = mld_stringval(string) - if (val >=0) call p%set(what,val,info,ilev=ilev,pos=pos) + if (val >=0) then + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) + else + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do + end if end subroutine mld_dprecsetc @@ -585,7 +748,7 @@ subroutine mld_dprecsetr(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_dpk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -597,12 +760,6 @@ subroutine mld_dprecsetr(p,what,val,info,ilev,ilmax,pos) return end select - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if - if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& @@ -611,12 +768,27 @@ subroutine mld_dprecsetr(p,what,val,info,ilev,ilmax,pos) return endif nlev_ = size(p%precv) - + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif @@ -624,8 +796,10 @@ subroutine mld_dprecsetr(p,what,val,info,ilev,ilmax,pos) ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then ! @@ -639,8 +813,8 @@ subroutine mld_dprecsetr(p,what,val,info,ilev,ilmax,pos) case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) end do end select diff --git a/mlprec/impl/mld_scprecset.F90 b/mlprec/impl/mld_scprecset.F90 index 370c6c5a..8eecffa9 100644 --- a/mlprec/impl/mld_scprecset.F90 +++ b/mlprec/impl/mld_scprecset.F90 @@ -106,7 +106,7 @@ subroutine mld_scprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -118,21 +118,32 @@ subroutine mld_scprecseti(p,what,val,info,ilev,ilmax,pos) &' should call MLD_PRECINIT' return endif + nlev_ = size(p%precv) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') @@ -151,14 +162,6 @@ subroutine mld_scprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - ! - ! Rules for fine level are slightly different. - ! - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(psb_toupper(what)) case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& @@ -166,7 +169,9 @@ subroutine mld_scprecseti(p,what,val,info,ilev,ilmax,pos) & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & & 'SUB_OVR','SUB_FILLIN',& & 'COARSE_MAT') - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do case('COARSE_SUBSOLVE') if (ilev_ /= nlev_) then @@ -279,10 +284,11 @@ subroutine mld_scprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif else if (.not.present(ilev)) then ! @@ -469,7 +475,7 @@ subroutine mld_scprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -478,26 +484,41 @@ subroutine mld_scprecsetc(p,what,string,info,ilev,ilmax,pos) info = 3111 return endif - nlev_ = size(p%precv) + val = mld_stringval(string) - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if + if (val >=0) then - if ((ilev_<1).or.(ilev_ > nlev_)) then - write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ - info = -1 - return - endif + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) - val = mld_stringval(string) - if (val >=0) then - call p%set(what,val,info,ilev=ilev,pos=pos) else - call p%precv(ilev_)%set(what,string,info,pos=pos) + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do end if end subroutine mld_scprecsetc @@ -556,8 +577,8 @@ subroutine mld_scprecsetr(p,what,val,info,ilev,ilmax,pos) integer(psb_ipk_), optional, intent(in) :: ilev,ilmax character(len=*), optional, intent(in) :: pos -! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + ! Local variables + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_spk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -568,7 +589,7 @@ subroutine mld_scprecsetr(p,what,val,info,ilev,ilmax,pos) else ilev_ = 1 end if - + select case(psb_toupper(what)) case ('MIN_CR_RATIO') p%min_cr_ratio = max(sone,val) @@ -584,37 +605,56 @@ subroutine mld_scprecsetr(p,what,val,info,ilev,ilmax,pos) endif nlev_ = size(p%precv) + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif + ! ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then - ! - ! ilev not specified: set preconditioner parameters at all the appropriate levels - ! + ! + ! ilev not specified: set preconditioner parameters at all the appropriate levels + ! - select case(psb_toupper(what)) - case('COARSE_ILUTHRS') - ilev_=nlev_ - call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) + select case(psb_toupper(what)) + case('COARSE_ILUTHRS') + ilev_=nlev_ + call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) - case default + case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - end do - end select + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + end select endif diff --git a/mlprec/impl/mld_sprecset.F90 b/mlprec/impl/mld_sprecset.F90 index 07d5aa48..f6bfece0 100644 --- a/mlprec/impl/mld_sprecset.F90 +++ b/mlprec/impl/mld_sprecset.F90 @@ -105,7 +105,7 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -121,8 +121,14 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if if ((ilev_<1).or.(ilev_ > nlev_)) then @@ -131,6 +137,12 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(what) @@ -150,12 +162,6 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(what) case(mld_smoother_type_,mld_sub_solve_,mld_smoother_sweeps_,& & mld_ml_cycle_,mld_par_aggr_alg_,mld_aggr_ord_,mld_aggr_type_,& @@ -163,8 +169,10 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) & mld_sub_restr_,mld_sub_prol_, & & mld_sub_ovr_,mld_sub_fillin_,& & mld_coarse_mat_) - call p%precv(ilev_)%set(what,val,info,pos=pos) - + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + case(mld_coarse_subsolve_) if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& @@ -194,14 +202,64 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_umf_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_sludist_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) @@ -227,11 +285,11 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) end if call p%precv(nlev_)%set(mld_sub_fillin_,val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif - else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate @@ -259,31 +317,80 @@ subroutine mld_sprecseti(p,what,val,info,ilev,ilmax,pos) case(mld_coarse_solve_) if (nlev_ > 1) then - - call p%precv(nlev_)%set(mld_coarse_solve_,val,info,pos=pos) + call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) select case (val) case(mld_bjac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) -#if defined(HAVE_SLU_) +#if defined(HAVE_SLU_) call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) -#else +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) +#else call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) +#if defined(HAVE_MUMPS_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_umf_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_sludist_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) end select - endif case(mld_coarse_subsolve_) @@ -343,7 +450,11 @@ subroutine mld_sprecsetsm(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 @@ -356,7 +467,12 @@ subroutine mld_sprecsetsm(p,val,info,ilev,ilmax,pos) & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -397,20 +513,29 @@ subroutine mld_sprecsetsv(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -474,7 +599,7 @@ subroutine mld_sprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -499,7 +624,38 @@ subroutine mld_sprecsetc(p,what,string,info,ilev,ilmax,pos) endif val = mld_stringval(string) - if (val >=0) call p%set(what,val,info,ilev=ilev,pos=pos) + if (val >=0) then + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) + else + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do + end if end subroutine mld_sprecsetc @@ -559,7 +715,7 @@ subroutine mld_sprecsetr(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_spk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -571,12 +727,6 @@ subroutine mld_sprecsetr(p,what,val,info,ilev,ilmax,pos) return end select - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if - if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& @@ -585,12 +735,27 @@ subroutine mld_sprecsetr(p,what,val,info,ilev,ilmax,pos) return endif nlev_ = size(p%precv) - + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif @@ -598,8 +763,10 @@ subroutine mld_sprecsetr(p,what,val,info,ilev,ilmax,pos) ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then ! @@ -613,8 +780,8 @@ subroutine mld_sprecsetr(p,what,val,info,ilev,ilmax,pos) case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) end do end select diff --git a/mlprec/impl/mld_zcprecset.F90 b/mlprec/impl/mld_zcprecset.F90 index d1b200ff..265fc5ac 100644 --- a/mlprec/impl/mld_zcprecset.F90 +++ b/mlprec/impl/mld_zcprecset.F90 @@ -112,7 +112,7 @@ subroutine mld_zcprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -124,21 +124,32 @@ subroutine mld_zcprecseti(p,what,val,info,ilev,ilmax,pos) &' should call MLD_PRECINIT' return endif + nlev_ = size(p%precv) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') @@ -157,14 +168,6 @@ subroutine mld_zcprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - ! - ! Rules for fine level are slightly different. - ! - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(psb_toupper(what)) case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& @@ -172,7 +175,9 @@ subroutine mld_zcprecseti(p,what,val,info,ilev,ilmax,pos) & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & & 'SUB_OVR','SUB_FILLIN',& & 'COARSE_MAT') - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do case('COARSE_SUBSOLVE') if (ilev_ /= nlev_) then @@ -299,10 +304,11 @@ subroutine mld_zcprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif else if (.not.present(ilev)) then ! @@ -503,7 +509,7 @@ subroutine mld_zcprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -512,26 +518,41 @@ subroutine mld_zcprecsetc(p,what,string,info,ilev,ilmax,pos) info = 3111 return endif - nlev_ = size(p%precv) + val = mld_stringval(string) - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if + if (val >=0) then - if ((ilev_<1).or.(ilev_ > nlev_)) then - write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ - info = -1 - return - endif + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) - val = mld_stringval(string) - if (val >=0) then - call p%set(what,val,info,ilev=ilev,pos=pos) else - call p%precv(ilev_)%set(what,string,info,pos=pos) + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do end if end subroutine mld_zcprecsetc @@ -590,8 +611,8 @@ subroutine mld_zcprecsetr(p,what,val,info,ilev,ilmax,pos) integer(psb_ipk_), optional, intent(in) :: ilev,ilmax character(len=*), optional, intent(in) :: pos -! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + ! Local variables + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_dpk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -602,7 +623,7 @@ subroutine mld_zcprecsetr(p,what,val,info,ilev,ilmax,pos) else ilev_ = 1 end if - + select case(psb_toupper(what)) case ('MIN_CR_RATIO') p%min_cr_ratio = max(done,val) @@ -618,37 +639,56 @@ subroutine mld_zcprecsetr(p,what,val,info,ilev,ilmax,pos) endif nlev_ = size(p%precv) + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif + ! ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then - ! - ! ilev not specified: set preconditioner parameters at all the appropriate levels - ! + ! + ! ilev not specified: set preconditioner parameters at all the appropriate levels + ! - select case(psb_toupper(what)) - case('COARSE_ILUTHRS') - ilev_=nlev_ - call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) + select case(psb_toupper(what)) + case('COARSE_ILUTHRS') + ilev_=nlev_ + call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) - case default + case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - end do - end select + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + end select endif diff --git a/mlprec/impl/mld_zprecset.F90 b/mlprec/impl/mld_zprecset.F90 index 4edc77ce..0e3628b1 100644 --- a/mlprec/impl/mld_zprecset.F90 +++ b/mlprec/impl/mld_zprecset.F90 @@ -111,7 +111,7 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_ + integer(psb_ipk_) :: ilev_, nlev_, ilmax_, il character(len=*), parameter :: name='mld_precseti' info = psb_success_ @@ -127,8 +127,14 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else - ilev_ = 1 + ilev_ = 1 + ilmax_ = ilev_ end if if ((ilev_<1).or.(ilev_ > nlev_)) then @@ -137,6 +143,12 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif select case(what) @@ -156,12 +168,6 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) ! if (present(ilev)) then - if (ilev_ == 1) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) - - else if (ilev_ > 1) then - select case(what) case(mld_smoother_type_,mld_sub_solve_,mld_smoother_sweeps_,& & mld_ml_cycle_,mld_par_aggr_alg_,mld_aggr_ord_,mld_aggr_type_,& @@ -169,8 +175,10 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) & mld_sub_restr_,mld_sub_prol_, & & mld_sub_ovr_,mld_sub_fillin_,& & mld_coarse_mat_) - call p%precv(ilev_)%set(what,val,info,pos=pos) - + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do + case(mld_coarse_subsolve_) if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& @@ -202,22 +210,75 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_umf_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#if defined(HAVE_UMF_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_sludist_) - call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) - call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) - call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#if defined(HAVE_SLUDIST_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_umf_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) @@ -243,11 +304,11 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) end if call p%precv(nlev_)%set(mld_sub_fillin_,val,info,pos=pos) case default - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do end select - endif - else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate @@ -275,41 +336,94 @@ subroutine mld_zprecseti(p,what,val,info,ilev,ilmax,pos) case(mld_coarse_solve_) if (nlev_ > 1) then - - call p%precv(nlev_)%set(mld_coarse_solve_,val,info,pos=pos) + call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) select case (val) case(mld_bjac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) #if defined(HAVE_UMF_) call p%precv(nlev_)%set(mld_sub_solve_,mld_umf_,info,pos=pos) -#elif defined(HAVE_SLU_) +#elif defined(HAVE_SLU_) call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) -#else +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) +#else call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) #endif + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info) + case(mld_slu_) +#if defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_slu_,mld_ilu_n_, mld_ilu_t_,mld_milu_n_) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_ilu_n_, mld_ilu_t_,mld_milu_n_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) case(mld_mumps_) +#if defined(HAVE_MUMPS_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) - case(mld_umf_) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_umf_) +#if defined(HAVE_UMF_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif + case(mld_sludist_) +#if defined(HAVE_SLUDIST_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,val,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_umf_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_SLU_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_slu_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_repl_mat_,info,pos=pos) +#elif defined(HAVE_MUMPS_) + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_mumps_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) + call p%precv(nlev_)%set(mld_sub_solve_,mld_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) +#endif case(mld_jac_) call p%precv(nlev_)%set(mld_smoother_type_,mld_bjac_,info,pos=pos) call p%precv(nlev_)%set(mld_sub_solve_,mld_diag_scale_,info,pos=pos) call p%precv(nlev_)%set(mld_coarse_mat_,mld_distr_mat_,info,pos=pos) end select - endif case(mld_coarse_subsolve_) @@ -369,7 +483,11 @@ subroutine mld_zprecsetsm(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 @@ -382,7 +500,12 @@ subroutine mld_zprecsetsm(p,val,info,ilev,ilmax,pos) & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -423,20 +546,29 @@ subroutine mld_zprecsetsv(p,val,info,ilev,ilmax,pos) if (present(ilev)) then ilev_ = ilev ilmin_ = ilev - ilmax_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if else ilev_ = 1 ilmin_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& & ': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif do ilev_ = ilmin_, ilmax_ call p%precv(ilev_)%set(val,info,pos=pos) @@ -500,7 +632,7 @@ subroutine mld_zprecsetc(p,what,string,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_, nlev_,val + integer(psb_ipk_) :: ilev_, nlev_,val,ilmax_, il character(len=*), parameter :: name='mld_precsetc' info = psb_success_ @@ -525,7 +657,38 @@ subroutine mld_zprecsetc(p,what,string,info,ilev,ilmax,pos) endif val = mld_stringval(string) - if (val >=0) call p%set(what,val,info,ilev=ilev,pos=pos) + if (val >=0) then + call p%set(what,val,info,ilev=ilev,ilmax=ilmax,pos=pos) + else + nlev_ = size(p%precv) + + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if + if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then + info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ + return + endif + do il=ilev_, ilmax_ + call p%precv(il)%set(what,string,info,pos=pos) + end do + end if end subroutine mld_zprecsetc @@ -585,7 +748,7 @@ subroutine mld_zprecsetr(p,what,val,info,ilev,ilmax,pos) character(len=*), optional, intent(in) :: pos ! Local variables - integer(psb_ipk_) :: ilev_,nlev_ + integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il real(psb_dpk_) :: thr character(len=*), parameter :: name='mld_precsetr' @@ -597,12 +760,6 @@ subroutine mld_zprecsetr(p,what,val,info,ilev,ilmax,pos) return end select - if (present(ilev)) then - ilev_ = ilev - else - ilev_ = 1 - end if - if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& @@ -611,12 +768,27 @@ subroutine mld_zprecsetr(p,what,val,info,ilev,ilmax,pos) return endif nlev_ = size(p%precv) - + if (present(ilev)) then + ilev_ = ilev + if (present(ilmax)) then + ilmax_ = ilmax + else + ilmax_ = ilev_ + end if + else + ilev_ = 1 + ilmax_ = ilev_ + end if if ((ilev_<1).or.(ilev_ > nlev_)) then + info = -1 write(psb_err_unit,*) name,& - & ': Error: invalid ILEV/NLEV combination',& - & ilev_, nlev_ + &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ + return + endif + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 + write(psb_err_unit,*) name,& + &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif @@ -624,8 +796,10 @@ subroutine mld_zprecsetr(p,what,val,info,ilev,ilmax,pos) ! Set preconditioner parameters at level ilev. ! if (present(ilev)) then - - call p%precv(ilev_)%set(what,val,info,pos=pos) + + do il=ilev_, ilmax_ + call p%precv(il)%set(what,val,info,pos=pos) + end do else if (.not.present(ilev)) then ! @@ -639,8 +813,8 @@ subroutine mld_zprecsetr(p,what,val,info,ilev,ilmax,pos) case default - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) + do il=1,nlev_ + call p%precv(il)%set(what,val,info,pos=pos) end do end select