ITL_OEMSolver.h 3.1 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20
21
22
23
24
25
26

/** \file ITL_OEMSolver.h */


#ifndef AMDIS_ITL_OEM_SOLVER_H
#define AMDIS_ITL_OEM_SOLVER_H

27
28
29
#include "MTL4Solver.h"
#include "ITL_OEMSolver.hh"
#include "MTL4Types.h"
30
31
32
33
34
35
36
37
38
39

#include <boost/numeric/itl/itl.hpp>
#include <boost/numeric/mtl/mtl.hpp>

namespace AMDiS {

  /**
   * \ingroup Solver
   * 
   *\brief
40
41
42
   * Template for using solvers from ITL in AMDiS.
   * Uses a previous definition of MTLMatrix and MTLVector.
   * Additional template generalization of ITL_OEMSolver destroys class hierarchy 
43
   */
44

45
  template <typename ITLSolver>
46
  class ITL_OEMSolver : public MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_OEMSolver_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector> >  {
47

48
49
  protected:
  public:
50
    /// The constructor reads needed parameters and sets solvers \ref name.
51
    ITL_OEMSolver(std::string name) : 
52
      MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_OEMSolver_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >(name)  {}
53

54
55
56
57
58
59
60
61
62
63
  
    ~ITL_OEMSolver() {}

    /// Creator class used in the OEMSolverMap.
    class Creator : public OEMSolverCreator
    {
    public:
      virtual ~Creator() {}
      
      /// Returns a new CGSolver object.
64
65
      OEMSolver* create() 
      { 
Thomas Witkowski's avatar
Thomas Witkowski committed
66
	return new ITL_OEMSolver<ITLSolver>(this->name); 
67
      }
Thomas Witkowski's avatar
Thomas Witkowski committed
68
    };
69
70
71
72
73
74
75
76
77
78
79
  
  };

  /**
   * \ingroup Solver
   * 
   *\brief
   * Template for using solvers from ITL that have one run-time parameter in AMDiS. 
   */
  template <typename ITLSolver>
  class ITL_OEMSolver_para
80
    : public MTL4Solver< MTLMatrix, MTLVector, ITL_OEMSolver_para_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector > > // ITL_OEMSolver<ITLSolver>
81
82
  {
  public:
83
84
    /// The constructor reads needed parameters and sets solvers \ref name.
    ITL_OEMSolver_para(std::string name) 
85
      : MTL4Solver< MTLMatrix, MTLVector, ITL_OEMSolver_para_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >(name) 
86
    {
87

88
    }
89
      
90
    ~ITL_OEMSolver_para() {}
91

92
    /// Set parameter of iterative solver
93
94
95
96
97
98
99

    class Creator : public OEMSolverCreator
    {
    public:
      virtual ~Creator() {}
      
      /// Returns a new CGSolver object.
100
101
      OEMSolver* create() 
      { 
Thomas Witkowski's avatar
Thomas Witkowski committed
102
	return new ITL_OEMSolver_para<ITLSolver>(this->name); 
103
104
105
106
107
108
109
110
      }
    }; 
      
  private:
  };
} // namespace AMDiS

#endif // AMDIS_ITL_OEM_SOLVER_H