escript  Revision_Unversioneddirectory
SystemMatrixAdapter.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #if !defined SystemMatrixAdapter_20040610_H
19 #define SystemMatrixAdapter_20040610_H
20 #include "system_dep.h"
21 
22 #include "paso/SystemMatrix.h"
23 #include "paso/Options.h"
24 
25 #include "PasoException.h"
26 
27 #include "escript/AbstractSystemMatrix.h"
28 #include "escript/Data.h"
29 #include "escript/UtilC.h"
30 
31 #include <boost/python/object.hpp>
32 #include <boost/shared_ptr.hpp>
33 #include <boost/python/extract.hpp>
34 
35 namespace paso {
36 
39 {
40 
49  public:
50 
57 
63  int row_blocksize,
64  const escript::FunctionSpace& row_functionspace,
65  int column_blocksize,
66  const escript::FunctionSpace& colum_functionspace);
67 
68 
75 
81 
87  {
88  return dynamic_cast<const escript::AbstractSystemMatrix&>(*this);
89  }
90 
95  inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix)
96  {
97  return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix);
98  }
99 
104  void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, double mdv);
105 
109  virtual void saveMM(const std::string& filename) const;
110 
114  virtual void saveHB(const std::string& filename) const;
115 
119  virtual void resetValues();
120 
124  static int mapOptionToPaso(int option);
125 
131  static int getSystemMatrixTypeId(int solver, int preconditioner, int package, const bool symmetry, const esysUtils::JMPI& mpiInfo);
132 
137  static void escriptToPasoOptions(Options* paso_options, const boost::python::object& options);
138 
143  static void pasoToEscriptOptions(const Options* paso_options, boost::python::object& options);
144 
148  void Print_Matrix_Info(bool) const;
149 
150  protected:
151 
152  private:
153 
158  virtual void setToSolution(escript::Data& out, escript::Data& in, boost::python::object& options) const;
159 
164  virtual void ypAx(escript::Data& y, escript::Data& x) const;
165 
166  //
167  // pointer to the externally created system_matrix.
168  //
170 
171 };
172 
173 } // end of namespace
174 #endif
virtual void setToSolution(escript::Data &out, escript::Data &in, boost::python::object &options) const
solves the linear system this*out=in
Definition: SystemMatrixAdapter.cpp:263
Definition: FunctionSpace.h:34
static void escriptToPasoOptions(Options *paso_options, const boost::python::object &options)
extract paso options from SolutionOptions class
Definition: SystemMatrixAdapter.cpp:348
~SystemMatrixAdapter()
Destructor for SystemMatrixAdapter. As specified in the constructor this deallocates the pointer give...
Definition: SystemMatrixAdapter.cpp:42
Definition: Options.h:90
SystemMatrixAdapter()
Wrapper for paso::SystemMatrix.
Definition: SystemMatrixAdapter.cpp:29
virtual void resetValues()
sets the matrix entries to zero
Definition: SystemMatrixAdapter.cpp:323
void nullifyRowsAndCols(escript::Data &row_q, escript::Data &col_q, double mdv)
nullifyRowsAndCols - calls SystemMatrix::nullifyRowsAndCols.
Definition: SystemMatrixAdapter.cpp:289
static int mapOptionToPaso(int option)
maps escript options onto Paso options
Definition: SystemMatrixAdapter.cpp:72
Definition: SystemMatrixAdapter.h:38
static void pasoToEscriptOptions(const Options *paso_options, boost::python::object &options)
copies diagnostic data back to the solver options
Definition: SystemMatrixAdapter.cpp:330
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:38
Definition: AMG.cpp:38
const escript::AbstractSystemMatrix & asAbstractSystemMatrix() const
Returns the system matrix as a const AbstractSystemMatrix&.
Definition: SystemMatrixAdapter.h:86
AbstractSystemMatrix()
Default constructor for AbstractSystemMatrix.
Definition: AbstractSystemMatrix.h:45
virtual void saveHB(const std::string &filename) const
writes the matrix to a file using the Harwell-Boeing file format
Definition: SystemMatrixAdapter.cpp:317
static const SystemMatrixAdapter & asSystemMatrixAdapter(const AbstractSystemMatrix &systemmatrix)
Returns a system matrix as a const SystemMatrixAdapter&.
Definition: SystemMatrixAdapter.h:95
Data represents a collection of datapoints.
Definition: Data.h:68
SystemMatrix_ptr m_system_matrix
Definition: SystemMatrixAdapter.h:169
SystemMatrix_ptr getPaso_SystemMatrix() const
Returns the pointer to the system matrix.
Definition: SystemMatrixAdapter.cpp:46
virtual void ypAx(escript::Data &y, escript::Data &x) const
performs y+=this*x
Definition: SystemMatrixAdapter.cpp:51
Base class for escript system matrices.
Definition: AbstractSystemMatrix.h:37
static int getSystemMatrixTypeId(int solver, int preconditioner, int package, const bool symmetry, const esysUtils::JMPI &mpiInfo)
returns the identifier of the matrix type to be used for the global stiffness matrix when the given s...
Definition: SystemMatrixAdapter.cpp:186
#define PASOWRAP_DLL_API
Definition: pasowrap/src/system_dep.h:31
void Print_Matrix_Info(bool) const
prints information about a system matrix
Definition: SystemMatrixAdapter.cpp:196
boost::shared_ptr< JMPI_ > JMPI
Definition: Esys_MPI.h:79
virtual void saveMM(const std::string &filename) const
writes the matrix to a file using the Matrix Market file format
Definition: SystemMatrixAdapter.cpp:311