escript
Revision_
|
00001 00002 /***************************************************************************** 00003 * 00004 * Copyright (c) 2003-2014 by University of Queensland 00005 * http://www.uq.edu.au 00006 * 00007 * Primary Business: Queensland, Australia 00008 * Licensed under the Open Software License version 3.0 00009 * http://www.opensource.org/licenses/osl-3.0.php 00010 * 00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 00012 * Development 2012-2013 by School of Earth Sciences 00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp) 00014 * 00015 *****************************************************************************/ 00016 00017 00018 #if !defined escript_AbstractSystemMatrix_20040628_H 00019 #define escript_AbstractSystemMatrix_20040628_H 00020 #include "system_dep.h" 00021 00022 #include "FunctionSpace.h" 00023 #include "SystemMatrixException.h" 00024 #include <boost/python/object.hpp> 00025 00026 00027 namespace escript { 00028 00029 // 00030 // Forward declaration 00031 class Data; 00032 00044 class AbstractSystemMatrix { 00045 00046 public: 00047 00061 ESCRIPT_DLL_API 00062 AbstractSystemMatrix(); 00063 00064 ESCRIPT_DLL_API 00065 AbstractSystemMatrix(const int row_blocksize, 00066 const FunctionSpace& row_functionspace, 00067 const int column_blocksize, 00068 const FunctionSpace& column_functionspace); 00073 ESCRIPT_DLL_API 00074 virtual ~AbstractSystemMatrix(); 00075 00076 00081 ESCRIPT_DLL_API 00082 Data vectorMultiply(Data& right) const; 00083 00088 ESCRIPT_DLL_API 00089 int isEmpty() const; 00090 00095 ESCRIPT_DLL_API 00096 inline FunctionSpace getColumnFunctionSpace() const 00097 { 00098 if (isEmpty()) 00099 throw SystemMatrixException("Error - Matrix is empty."); 00100 return m_column_functionspace; 00101 } 00102 00107 ESCRIPT_DLL_API 00108 inline FunctionSpace getRowFunctionSpace() const 00109 { 00110 if (isEmpty()) 00111 throw SystemMatrixException("Error - Matrix is empty."); 00112 return m_row_functionspace; 00113 } 00114 00119 ESCRIPT_DLL_API 00120 inline int getRowBlockSize() const 00121 { 00122 if (isEmpty()) 00123 throw SystemMatrixException("Error - Matrix is empty."); 00124 return m_row_blocksize; 00125 } 00126 00131 ESCRIPT_DLL_API 00132 inline int getColumnBlockSize() const 00133 { 00134 if (isEmpty()) 00135 throw SystemMatrixException("Error - Matrix is empty."); 00136 return m_column_blocksize; 00137 } 00138 00143 ESCRIPT_DLL_API 00144 Data solve(Data& in, boost::python::object& options) const; 00145 00150 ESCRIPT_DLL_API 00151 virtual void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const; 00152 00153 00157 ESCRIPT_DLL_API 00158 virtual void saveMM(const std::string& fileName) const; 00159 00163 ESCRIPT_DLL_API 00164 virtual void saveHB(const std::string& fileName) const; 00165 00169 ESCRIPT_DLL_API 00170 virtual void resetValues() const; 00171 00172 protected: 00173 00174 private: 00175 00180 ESCRIPT_DLL_API 00181 virtual void setToSolution(Data& out,Data& in, boost::python::object& options) const; 00182 00187 ESCRIPT_DLL_API 00188 virtual void ypAx(Data& y,Data& x) const; 00189 00190 int m_empty; 00191 int m_column_blocksize; 00192 int m_row_blocksize; 00193 FunctionSpace m_row_functionspace; 00194 FunctionSpace m_column_functionspace; 00195 00196 00197 }; 00198 00199 ESCRIPT_DLL_API Data operator*(const AbstractSystemMatrix& left,const Data& right) ; 00200 00201 typedef boost::shared_ptr<AbstractSystemMatrix> ASM_ptr; 00202 00203 } // end of namespace 00204 #endif