ESYS13  Revision_
AbstractSystemMatrix.h
Go to the documentation of this file.
00001 
00002 /*******************************************************
00003 *
00004 * Copyright (c) 2003-2012 by University of Queensland
00005 * Earth Systems Science Computational Center (ESSCC)
00006 * http://www.uq.edu.au/esscc
00007 *
00008 * Primary Business: Queensland, Australia
00009 * Licensed under the Open Software License version 3.0
00010 * http://www.opensource.org/licenses/osl-3.0.php
00011 *
00012 *******************************************************/
00013 
00014 
00015 #if !defined  escript_AbstractSystemMatrix_20040628_H
00016 #define escript_AbstractSystemMatrix_20040628_H
00017 #include "system_dep.h"
00018 
00019 #include "FunctionSpace.h"
00020 #include "SystemMatrixException.h"
00021 #include <boost/python/object.hpp>
00022 
00023 
00024 namespace escript {
00025 
00026 //
00027 // Forward declaration
00028 class Data;
00029 
00041 class AbstractSystemMatrix {
00042 
00043  public:
00044 
00058   ESCRIPT_DLL_API
00059   AbstractSystemMatrix();
00060 
00061   ESCRIPT_DLL_API
00062   AbstractSystemMatrix(const int row_blocksize,
00063                        const FunctionSpace& row_functionspace,
00064                        const int column_blocksize,
00065                        const FunctionSpace& column_functionspace);
00070   ESCRIPT_DLL_API
00071   virtual ~AbstractSystemMatrix();
00072 
00073 
00078   ESCRIPT_DLL_API
00079   Data vectorMultiply(Data& right) const;
00080 
00085   ESCRIPT_DLL_API
00086   int isEmpty() const;
00087 
00092   ESCRIPT_DLL_API
00093   inline FunctionSpace getColumnFunctionSpace() const
00094   {
00095        if (isEmpty())
00096             throw SystemMatrixException("Error - Matrix is empty.");
00097        return m_column_functionspace;
00098   }
00099 
00104   ESCRIPT_DLL_API
00105   inline FunctionSpace getRowFunctionSpace() const
00106   {
00107        if (isEmpty())
00108             throw SystemMatrixException("Error - Matrix is empty.");
00109        return m_row_functionspace;
00110   }
00111 
00116   ESCRIPT_DLL_API
00117   inline int getRowBlockSize() const
00118   {
00119        if (isEmpty())
00120             throw SystemMatrixException("Error - Matrix is empty.");
00121        return m_row_blocksize;
00122   }
00123 
00128   ESCRIPT_DLL_API
00129   inline int getColumnBlockSize() const
00130   {
00131        if (isEmpty())
00132             throw SystemMatrixException("Error - Matrix is empty.");
00133        return m_column_blocksize;
00134   }
00135 
00140   ESCRIPT_DLL_API
00141   Data solve(Data& in, boost::python::object& options) const;
00142   
00147   ESCRIPT_DLL_API
00148   virtual void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;  
00149   
00150 
00154   ESCRIPT_DLL_API
00155   virtual void saveMM(const std::string& fileName) const;
00156 
00160   ESCRIPT_DLL_API
00161   virtual void saveHB(const std::string& fileName) const;
00162 
00166   ESCRIPT_DLL_API
00167   virtual void resetValues() const;
00168 
00169  protected:
00170 
00171  private:
00172 
00177   ESCRIPT_DLL_API
00178   virtual void setToSolution(Data& out,Data& in, boost::python::object& options) const;
00179 
00184   ESCRIPT_DLL_API
00185   virtual void ypAx(Data& y,Data& x) const;
00186 
00187   int m_empty;
00188   int m_column_blocksize;
00189   int m_row_blocksize;
00190   FunctionSpace m_row_functionspace;
00191   FunctionSpace m_column_functionspace;
00192 
00193 
00194 };
00195 
00196 ESCRIPT_DLL_API Data operator*(const AbstractSystemMatrix& left,const Data& right) ;
00197 
00198 typedef boost::shared_ptr<AbstractSystemMatrix> ASM_ptr;
00199 
00200 } // end of namespace
00201 #endif