Escript  Revision_4320
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 extern "C" {
22 #include "paso/SystemMatrix.h"
23 #include "paso/Options.h"
24 }
25 
26 #include "PasoException.h"
27 
28 #include "escript/AbstractSystemMatrix.h"
29 #include "escript/Data.h"
30 #include "escript/UtilC.h"
31 
32 #include <boost/python/object.hpp>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/python/extract.hpp>
35 
36 namespace paso {
37 
39 
48  public:
49 
57 
64  const int row_blocksize,
65  const escript::FunctionSpace& row_functionspace,
66  const int column_blocksize,
67  const escript::FunctionSpace& colum_functionspace);
68 
69 
77 
84 
90  {
91  return dynamic_cast<const escript::AbstractSystemMatrix&>(*this);
92  }
93 
98  inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix)
99  {
100  return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix);
101  }
102 
108  void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
109 
114  virtual void saveMM(const std::string& fileName) const;
115 
120  virtual void saveHB(const std::string& fileName) const;
121 
126  virtual void resetValues() const;
127 
132  static int mapOptionToPaso(const int option);
133 
140  static int getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry, Esys_MPIInfo* mpiInfo);
141 
147  static void escriptToPasoOptions(Paso_Options* paso_options, const boost::python::object& options);
148 
154  static void pasoToEscriptOptions(const Paso_Options* paso_options, boost::python::object& options);
155 
160  void Print_Matrix_Info(const bool) const;
161 
162  protected:
163 
164  private:
165 
171  virtual void setToSolution(escript::Data& out, escript::Data& in, boost::python::object& options) const;
172 
178  virtual void ypAx(escript::Data& y, escript::Data& x) const;
179 
180  //
181  // pointer to the externally created system_matrix.
182  //
183  boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
184 
185 };
186 
187 } // end of namespace
188 #endif