ESScript  Revision_4488
SystemMatrixAdapter.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 
17 #if !defined SystemMatrixAdapter_20040610_H
18 #define SystemMatrixAdapter_20040610_H
19 #include "system_dep.h"
20 
21 #include "paso/SystemMatrix.h"
22 #include "paso/Options.h"
23 
24 #include "PasoException.h"
25 
26 #include "escript/AbstractSystemMatrix.h"
27 #include "escript/Data.h"
28 #include "escript/UtilC.h"
29 
30 #include <boost/python/object.hpp>
31 #include <boost/shared_ptr.hpp>
32 #include <boost/python/extract.hpp>
33 
34 namespace paso {
35 
37 
46  public:
47 
55 
62  const int row_blocksize,
63  const escript::FunctionSpace& row_functionspace,
64  const int column_blocksize,
65  const escript::FunctionSpace& colum_functionspace);
66 
67 
75 
82 
88  {
89  return dynamic_cast<const escript::AbstractSystemMatrix&>(*this);
90  }
91 
96  inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix)
97  {
98  return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix);
99  }
100 
106  void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
107 
112  virtual void saveMM(const std::string& fileName) const;
113 
118  virtual void saveHB(const std::string& fileName) const;
119 
124  virtual void resetValues() const;
125 
130  static int mapOptionToPaso(const int option);
131 
138  static int getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry, Esys_MPIInfo* mpiInfo);
139 
145  static void escriptToPasoOptions(Paso_Options* paso_options, const boost::python::object& options);
146 
152  static void pasoToEscriptOptions(const Paso_Options* paso_options, boost::python::object& options);
153 
158  void Print_Matrix_Info(const bool) const;
159 
160  protected:
161 
162  private:
163 
169  virtual void setToSolution(escript::Data& out, escript::Data& in, boost::python::object& options) const;
170 
176  virtual void ypAx(escript::Data& y, escript::Data& x) const;
177 
178  //
179  // pointer to the externally created system_matrix.
180  //
181  boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
182 
183 };
184 
185 } // end of namespace
186 #endif