00001 00002 /******************************************************* 00003 * 00004 * Copyright (c) 2003-2009 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 // Forward declaration 00024 class Data; 00025 00026 namespace escript { 00027 00039 class AbstractSystemMatrix { 00040 00041 public: 00042 00056 ESCRIPT_DLL_API 00057 AbstractSystemMatrix(); 00058 00059 ESCRIPT_DLL_API 00060 AbstractSystemMatrix(const int row_blocksize, 00061 const FunctionSpace& row_functionspace, 00062 const int column_blocksize, 00063 const FunctionSpace& column_functionspace); 00068 ESCRIPT_DLL_API 00069 virtual ~AbstractSystemMatrix(); 00070 00075 ESCRIPT_DLL_API 00076 Data vectorMultiply(Data& right) const; 00077 00082 ESCRIPT_DLL_API 00083 int isEmpty() const; 00084 00089 ESCRIPT_DLL_API 00090 inline FunctionSpace getColumnFunctionSpace() const 00091 { 00092 if (isEmpty()) 00093 throw SystemMatrixException("Error - Matrix is empty."); 00094 return m_column_functionspace; 00095 } 00096 00101 ESCRIPT_DLL_API 00102 inline FunctionSpace getRowFunctionSpace() const 00103 { 00104 if (isEmpty()) 00105 throw SystemMatrixException("Error - Matrix is empty."); 00106 return m_row_functionspace; 00107 } 00108 00113 ESCRIPT_DLL_API 00114 inline int getRowBlockSize() const 00115 { 00116 if (isEmpty()) 00117 throw SystemMatrixException("Error - Matrix is empty."); 00118 return m_row_blocksize; 00119 } 00120 00125 ESCRIPT_DLL_API 00126 inline int getColumnBlockSize() const 00127 { 00128 if (isEmpty()) 00129 throw SystemMatrixException("Error - Matrix is empty."); 00130 return m_column_blocksize; 00131 } 00132 00137 ESCRIPT_DLL_API 00138 Data solve(Data& in, boost::python::object& options) const; 00139 00143 ESCRIPT_DLL_API 00144 virtual void saveMM(const std::string& fileName) const; 00145 00149 ESCRIPT_DLL_API 00150 virtual void saveHB(const std::string& fileName) const; 00151 00155 ESCRIPT_DLL_API 00156 virtual void resetValues() const; 00157 00158 protected: 00159 00160 private: 00161 00166 ESCRIPT_DLL_API 00167 virtual void setToSolution(Data& out,Data& in, boost::python::object& options) const; 00168 00173 ESCRIPT_DLL_API 00174 virtual void ypAx(Data& y,Data& x) const; 00175 00176 int m_empty; 00177 int m_column_blocksize; 00178 int m_row_blocksize; 00179 FunctionSpace m_row_functionspace; 00180 FunctionSpace m_column_functionspace; 00181 00182 00183 }; 00184 00185 ESCRIPT_DLL_API Data operator*(const AbstractSystemMatrix& left,const Data& right) ; 00186 00187 00188 00189 } // end of namespace 00190 #endif