/[escript]/trunk/trilinoswrap/src/PreconditionerFactory.cpp
ViewVC logotype

Diff of /trunk/trilinoswrap/src/PreconditionerFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6798 by caltinay, Thu Jul 21 05:00:24 2016 UTC revision 6799 by aellery, Mon Mar 25 05:53:58 2019 UTC
# Line 53  RCP<OpType<ST> > createPreconditioner(RC Line 53  RCP<OpType<ST> > createPreconditioner(RC
53          case escript::SO_PRECONDITIONER_AMG:          case escript::SO_PRECONDITIONER_AMG:
54              {              {
55  #if 1 //ndef ESYS_INDEXTYPE_LONG  #if 1 //ndef ESYS_INDEXTYPE_LONG
                 params->set("max levels", sb.getLevelMax());  
56                  params->set("number of equations", 1);                  params->set("number of equations", 1);
57                  params->set("cycle type", sb.getCycleType()==1 ? "V" : "W");                  params->set("problem: symmetric", sb.isSymmetric() || sb.isHermitian());
                 params->set("problem: symmetric", sb.isSymmetric());  
58                  params->set("verbosity", sb.isVerbose()? "high":"none");                  params->set("verbosity", sb.isVerbose()? "high":"none");
59                  // override parameters if set explicitly for trilinos                  // override parameters if set explicitly for trilinos
60                  // The set of available parameters is documented in the MueLu                  // The set of available parameters is documented in the MueLu
# Line 122  RCP<OpType<ST> > createPreconditioner(RC Line 120  RCP<OpType<ST> > createPreconditioner(RC
120              }              }
121              break;              break;
122          case escript::SO_PRECONDITIONER_ILUT:          case escript::SO_PRECONDITIONER_ILUT:
123            {
124              ifprec = factory.create<const Matrix>("ILUT", mat);              ifprec = factory.create<const Matrix>("ILUT", mat);
125              params->set("fact: drop tolerance", sb.getDropTolerance());              params->set("fact: drop tolerance", sb.getDropTolerance());
126              params->set("fact: relax value", sb.getRelaxationFactor());              params->set("fact: relax value", sb.getRelaxationFactor());
# Line 131  RCP<OpType<ST> > createPreconditioner(RC Line 130  RCP<OpType<ST> > createPreconditioner(RC
130              extractParamIfSet<int>("fact: ilut level-of-fill", pyParams, *params);              extractParamIfSet<int>("fact: ilut level-of-fill", pyParams, *params);
131              extractParamIfSet<ST>("fact: absolute threshold", pyParams, *params);              extractParamIfSet<ST>("fact: absolute threshold", pyParams, *params);
132              extractParamIfSet<ST>("fact: relative threshold", pyParams, *params);              extractParamIfSet<ST>("fact: relative threshold", pyParams, *params);
133            }
134              break;              break;
135          case escript::SO_PRECONDITIONER_GAUSS_SEIDEL:          case escript::SO_PRECONDITIONER_GAUSS_SEIDEL:
136          case escript::SO_PRECONDITIONER_JACOBI:          {
           {  
137              ifprec = factory.create<const Matrix>("RELAXATION", mat);              ifprec = factory.create<const Matrix>("RELAXATION", mat);
138              if (sb.getPreconditioner() == escript::SO_PRECONDITIONER_JACOBI) {              params->set("relaxation: type", ((sb.isSymmetric() || sb.isHermitian())?
                 params->set("relaxation: type", "Jacobi");  
             } else {  
                 params->set("relaxation: type", (sb.isSymmetric() ?  
139                              "Symmetric Gauss-Seidel" : "Gauss-Seidel"));                              "Symmetric Gauss-Seidel" : "Gauss-Seidel"));
             }  
140              params->set("relaxation: sweeps", sb.getNumSweeps());              params->set("relaxation: sweeps", sb.getNumSweeps());
141              const ST fac = static_cast<ST>(sb.getRelaxationFactor());              const ST fac = static_cast<ST>(sb.getRelaxationFactor());
142              params->set("relaxation: damping factor", fac);              params->set("relaxation: damping factor", fac);
143              // override if set explicitly for trilinos              // override if set explicitly for trilinos
144              extractParamIfSet<int>("relaxation: sweeps", pyParams, *params);              extractParamIfSet<int>("relaxation: sweeps", pyParams, *params);
145              extractParamIfSet<ST>("relaxation: damping factor", pyParams, *params);              extractParamIfSet<ST>("relaxation: damping factor", pyParams, *params);
146              extractParamIfSet<ST>("relaxation: min diagonal value", pyParams, *params);              extractParamIfSet<bool>("relaxation: backward mode", pyParams, *params);
147                extractParamIfSet<bool>("relaxation: use l1", pyParams, *params);
148                extractParamIfSet<ST>("relaxation: l1 eta", pyParams, *params);
149              extractParamIfSet<bool>("relaxation: zero starting solution", pyParams, *params);              extractParamIfSet<bool>("relaxation: zero starting solution", pyParams, *params);
150                extractParamIfSet<bool>("relaxation: fix tiny diagonal entries", pyParams, *params);
151                extractParamIfSet<ST>("relaxation: min diagonal value", pyParams, *params);
152                extractParamIfSet<bool>("relaxation: check diagonal entries", pyParams, *params);
153                // extractParamIfSet<ST>("relaxation: local smoothing indices", pyParams, *params);
154            }
155                break;
156            case escript::SO_PRECONDITIONER_JACOBI:
157            {
158                ifprec = factory.create<const Matrix>("RELAXATION", mat);
159                params->set("relaxation: type", "Jacobi");
160                params->set("relaxation: sweeps", sb.getNumSweeps());
161                const ST fac = static_cast<ST>(sb.getRelaxationFactor());
162                params->set("relaxation: damping factor", fac);
163                // override if set explicitly for trilinos
164                extractParamIfSet<int>("relaxation: sweeps", pyParams, *params);
165                extractParamIfSet<ST>("relaxation: damping factor", pyParams, *params);
166              extractParamIfSet<bool>("relaxation: backward mode", pyParams, *params);              extractParamIfSet<bool>("relaxation: backward mode", pyParams, *params);
167                extractParamIfSet<bool>("relaxation: use l1", pyParams, *params);
168                extractParamIfSet<ST>("relaxation: l1 eta", pyParams, *params);
169                extractParamIfSet<bool>("relaxation: zero starting solution", pyParams, *params);
170                extractParamIfSet<bool>("relaxation: fix tiny diagonal entries", pyParams, *params);
171                extractParamIfSet<ST>("relaxation: min diagonal value", pyParams, *params);
172                extractParamIfSet<bool>("relaxation: check diagonal entries", pyParams, *params);
173                // extractParamIfSet<ST>("relaxation: local smoothing indices", pyParams, *params);
174            }
175              break;              break;
           }  
176          case escript::SO_PRECONDITIONER_ILU0: // to avoid test failures          case escript::SO_PRECONDITIONER_ILU0: // to avoid test failures
177          case escript::SO_PRECONDITIONER_RILU:          case escript::SO_PRECONDITIONER_RILU:
178            {
179              if (dynamic_cast<const Tpetra::Experimental::BlockCrsMatrix<ST,LO,GO,NT>* >(mat.get())) {              if (dynamic_cast<const Tpetra::Experimental::BlockCrsMatrix<ST,LO,GO,NT>* >(mat.get())) {
180                  ifprec = factory.create<const Matrix>("RBILUK", mat);                  ifprec = factory.create<const Matrix>("RBILUK", mat);
181              } else {              } else {
# Line 167  RCP<OpType<ST> > createPreconditioner(RC Line 188  RCP<OpType<ST> > createPreconditioner(RC
188              extractParamIfSet<int>("fact: iluk level-of-overlap", pyParams, *params);              extractParamIfSet<int>("fact: iluk level-of-overlap", pyParams, *params);
189              extractParamIfSet<ST>("fact: absolute threshold", pyParams, *params);              extractParamIfSet<ST>("fact: absolute threshold", pyParams, *params);
190              extractParamIfSet<ST>("fact: relative threshold", pyParams, *params);              extractParamIfSet<ST>("fact: relative threshold", pyParams, *params);
191            }
192              break;              break;
193          default:          default:
194              throw escript::ValueError("Unsupported preconditioner requested.");              throw escript::ValueError("Unsupported preconditioner requested.");

Legend:
Removed from v.6798  
changed lines
  Added in v.6799

  ViewVC Help
Powered by ViewVC 1.1.26