Escript  Revision_4320
AbstractSystemMatrix.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 escript_AbstractSystemMatrix_20040628_H
18 #define escript_AbstractSystemMatrix_20040628_H
19 #include "system_dep.h"
20 
21 #include "FunctionSpace.h"
22 #include "SystemMatrixException.h"
23 #include <boost/python/object.hpp>
24 
25 
26 namespace escript {
27 
28 //
29 // Forward declaration
30 class Data;
31 
44 
45  public:
46 
62 
64  AbstractSystemMatrix(const int row_blocksize,
65  const FunctionSpace& row_functionspace,
66  const int column_blocksize,
67  const FunctionSpace& column_functionspace);
73  virtual ~AbstractSystemMatrix();
74 
75 
81  Data vectorMultiply(Data& right) const;
82 
88  int isEmpty() const;
89 
96  {
97  if (isEmpty())
98  throw SystemMatrixException("Error - Matrix is empty.");
100  }
101 
108  {
109  if (isEmpty())
110  throw SystemMatrixException("Error - Matrix is empty.");
111  return m_row_functionspace;
112  }
113 
119  inline int getRowBlockSize() const
120  {
121  if (isEmpty())
122  throw SystemMatrixException("Error - Matrix is empty.");
123  return m_row_blocksize;
124  }
125 
131  inline int getColumnBlockSize() const
132  {
133  if (isEmpty())
134  throw SystemMatrixException("Error - Matrix is empty.");
135  return m_column_blocksize;
136  }
137 
143  Data solve(Data& in, boost::python::object& options) const;
144 
150  virtual void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
151 
152 
157  virtual void saveMM(const std::string& fileName) const;
158 
163  virtual void saveHB(const std::string& fileName) const;
164 
169  virtual void resetValues() const;
170 
171  protected:
172 
173  private:
174 
180  virtual void setToSolution(Data& out,Data& in, boost::python::object& options) const;
181 
187  virtual void ypAx(Data& y,Data& x) const;
188 
189  int m_empty;
194 
195 
196 };
197 
198 ESCRIPT_DLL_API Data operator*(const AbstractSystemMatrix& left,const Data& right) ;
199 
200 typedef boost::shared_ptr<AbstractSystemMatrix> ASM_ptr;
201 
202 } // end of namespace
203 #endif