escript  Revision_4925
AbstractSystemMatrix.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 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 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #if !defined escript_AbstractSystemMatrix_20040628_H
19 #define escript_AbstractSystemMatrix_20040628_H
20 #include "system_dep.h"
21 
22 #include "FunctionSpace.h"
23 #include "SystemMatrixException.h"
24 #include <boost/python/object.hpp>
25 
26 
27 namespace escript {
28 
29 //
30 // Forward declaration
31 class Data;
32 
45 
46  public:
47 
63 
65  AbstractSystemMatrix(const int row_blocksize,
66  const FunctionSpace& row_functionspace,
67  const int column_blocksize,
68  const FunctionSpace& column_functionspace);
74  virtual ~AbstractSystemMatrix();
75 
76 
82  Data vectorMultiply(Data& right) const;
83 
89  int isEmpty() const;
90 
97  {
98  if (isEmpty())
99  throw SystemMatrixException("Error - Matrix is empty.");
100  return m_column_functionspace;
101  }
102 
109  {
110  if (isEmpty())
111  throw SystemMatrixException("Error - Matrix is empty.");
112  return m_row_functionspace;
113  }
114 
120  inline int getRowBlockSize() const
121  {
122  if (isEmpty())
123  throw SystemMatrixException("Error - Matrix is empty.");
124  return m_row_blocksize;
125  }
126 
132  inline int getColumnBlockSize() const
133  {
134  if (isEmpty())
135  throw SystemMatrixException("Error - Matrix is empty.");
136  return m_column_blocksize;
137  }
138 
144  Data solve(Data& in, boost::python::object& options) const;
145 
151  virtual void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
152 
153 
158  virtual void saveMM(const std::string& fileName) const;
159 
164  virtual void saveHB(const std::string& fileName) const;
165 
170  virtual void resetValues() const;
171 
172  protected:
173 
174  private:
175 
181  virtual void setToSolution(Data& out,Data& in, boost::python::object& options) const;
182 
188  virtual void ypAx(Data& y,Data& x) const;
189 
190  int m_empty;
195 
196 
197 };
198 
199 ESCRIPT_DLL_API Data operator*(const AbstractSystemMatrix& left,const Data& right) ;
200 
201 typedef boost::shared_ptr<AbstractSystemMatrix> ASM_ptr;
202 
203 } // end of namespace
204 #endif
Give a short description of what FunctionSpace does.
Definition: FunctionSpace.h:46
int m_column_blocksize
Definition: AbstractSystemMatrix.h:191
Data solve(Data &in, boost::python::object &options) const
returns the solution u of the linear system this*u=in
Definition: AbstractSystemMatrix.cpp:82
virtual ~AbstractSystemMatrix()
Destructor.
Definition: AbstractSystemMatrix.cpp:49
virtual void resetValues() const
resets the matrix entries
Definition: AbstractSystemMatrix.cpp:115
int getColumnBlockSize() const
returns the column block size
Definition: AbstractSystemMatrix.h:132
virtual void saveHB(const std::string &fileName) const
writes the matrix to a file using the Harwell-Boeing file format
Definition: AbstractSystemMatrix.cpp:111
SystemMatrixException exception class.
Definition: SystemMatrixException.h:35
virtual void saveMM(const std::string &fileName) const
writes the matrix to a file using the Matrix Market file format
Definition: AbstractSystemMatrix.cpp:107
FunctionSpace m_column_functionspace
Definition: AbstractSystemMatrix.h:194
AbstractSystemMatrix()
Default constructor for AbstractSystemMatrix.
Definition: AbstractSystemMatrix.cpp:25
int m_row_blocksize
Definition: AbstractSystemMatrix.h:192
int getRowBlockSize() const
returns the row block size
Definition: AbstractSystemMatrix.h:120
Data vectorMultiply(Data &right) const
matrix*vector multiplication
Definition: AbstractSystemMatrix.cpp:62
virtual void nullifyRowsAndCols(escript::Data &row_q, escript::Data &col_q, const double mdv) const
nullifyRowsAndCols - calls Paso_SystemMatrix_nullifyRowsAndCols.
Definition: AbstractSystemMatrix.cpp:102
FunctionSpace getRowFunctionSpace() const
returns the row function space
Definition: AbstractSystemMatrix.h:108
Data represents a collection of datapoints.
Definition: Data.h:71
int m_empty
Definition: AbstractSystemMatrix.h:190
virtual void setToSolution(Data &out, Data &in, boost::python::object &options) const
solves the linear system this*out=in
Definition: AbstractSystemMatrix.cpp:96
FunctionSpace m_row_functionspace
Definition: AbstractSystemMatrix.h:193
virtual void ypAx(Data &y, Data &x) const
performs y+=this*x
Definition: AbstractSystemMatrix.cpp:77
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:64
Data operator*(const AbstractSystemMatrix &left, const Data &right)
Definition: AbstractSystemMatrix.cpp:56
Give a short description of what AbstractSystemMatrix does.
Definition: AbstractSystemMatrix.h:44
boost::shared_ptr< AbstractSystemMatrix > ASM_ptr
Definition: AbstractSystemMatrix.h:201
FunctionSpace getColumnFunctionSpace() const
returns the column function space
Definition: AbstractSystemMatrix.h:96
int isEmpty() const
returns true if the matrix is empty
Definition: AbstractSystemMatrix.cpp:52