Mtl4Solver.cc 2.91 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "parallel/Mtl4Solver.h"
#include "parallel/PITL_Solver.h"
#include "parallel/ParallelMapper.h"

namespace AMDiS {
  namespace Parallel {

    void Mtl4Solver::addPMTLSolvers()
    {
      OEMSolverCreator *creator;

      creator = new CGSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pcg", creator);

      creator = new CGSSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pcgs", creator);

      creator = new BiCGSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pbicg", creator);

      creator = new BiCGStabSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pbicgstab", creator);

      creator = new BiCGStab2Solver::Creator;
      CreatorMap< OEMSolver >::addCreator("pbicgstab2", creator);

      creator = new BiCGStabEllSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pbicgstab_ell", creator);

      creator = new QMRSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pqmr", creator);

      creator = new TFQMRSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("ptfqmr", creator);

      creator = new GMResSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pgmres", creator);

      creator = new IDRsSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pidr_s", creator);

      creator = new MinResSolver::Creator;
      CreatorMap< OEMSolver >::addCreator("pminres", creator);
    }

  
    void Mtl4Solver::createSolver()
    {
      FUNCNAME("Parallel::Mtl4Solver::createSolver()");

      // === create solver ===
      std::string solverType("0");
      Parameters::get(name + "->solver", solverType);
      solverType = "p" + solverType;
      OEMSolverCreator *solverCreator = 
	dynamic_cast<OEMSolverCreator*>(CreatorMap<OEMSolver>::getCreator(solverType));
      TEST_EXIT(solverCreator)("no solver type\n");
      solverCreator->setName(name + "->solver");
      solver = solverCreator->create();
      solver->initParameters();
    }


64
65
    void Mtl4Solver::createPrecon()
    {}
66
67

    
68
69
    void Mtl4Solver::solve(AdaptInfo* adaptInfo, bool createMatrixData, 
		           bool storeMatrixData)
70
    {
71
72
73
74
      FUNCNAME("Mtl4Solver::solve()");

      clock_t first = clock();

75
76
      ParallelMapper pmapper(*meshDistributor, nComponents);
      solver->solveSystem(solverMatrix, *solution, *rhs, pmapper);
77
78
79

      INFO(info, 8)("solution of discrete system needed %.5f seconds\n", 
		    TIME_USED(first, clock()));    
80
81
82
83
84
85
    }
  }

  template< > 
  void CreatorMap< Parallel::ParallelPreconditioner >::addDefaultCreators() {
    Parallel::ParallelPreconditionCreator *creator;
86
87
88
89
90
91
92
93
94
95
96
97
    
    creator =  new Parallel::DiagonalPreconditioner::Creator;
    addCreator("diag", creator);
    
    creator = new Parallel::ILUPreconditioner::Creator;
    addCreator("ilu", creator);
    
    creator = new Parallel::ICPreconditioner::Creator;
    addCreator("ic", creator);
    
    creator =  new Parallel::IdentityPreconditioner::Creator;
    addCreator("no", creator);
98
99
  }
}