00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #if !defined finley_SystemMatrixAdapter_20040610_H
00016 #define finley_SystemMatrixAdapter_20040610_H
00017 #include "system_dep.h"
00018
00019 extern "C" {
00020 #include "paso/SystemMatrix.h"
00021 #include "paso/Options.h"
00022 }
00023
00024 #include "FinleyAdapterException.h"
00025 #include "FinleyError.h"
00026
00027 #include "escript/AbstractSystemMatrix.h"
00028 #include "escript/Data.h"
00029 #include "escript/UtilC.h"
00030
00031 #include <boost/python/object.hpp>
00032 #include <boost/shared_ptr.hpp>
00033 #include <boost/python/extract.hpp>
00034
00035 namespace finley {
00036
00037 class SystemMatrixAdapter:public escript::AbstractSystemMatrix {
00038
00047 public:
00048
00054 FINLEY_DLL_API
00055 SystemMatrixAdapter();
00056
00061 FINLEY_DLL_API
00062 SystemMatrixAdapter(Paso_SystemMatrix* system_matrix,
00063 const int row_blocksize,
00064 const escript::FunctionSpace& row_functionspace,
00065 const int column_blocksize,
00066 const escript::FunctionSpace& colum_functionspace);
00067
00068
00074 FINLEY_DLL_API
00075 ~SystemMatrixAdapter();
00076
00081 FINLEY_DLL_API
00082 Paso_SystemMatrix* getPaso_SystemMatrix() const;
00083
00088 inline const escript::AbstractSystemMatrix& asAbstractSystemMatrix() const
00089 {
00090 return dynamic_cast<const escript::AbstractSystemMatrix&>(*this);
00091 }
00092
00097 inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix)
00098 {
00099 return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix);
00100 }
00101
00106 FINLEY_DLL_API
00107 void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const;
00108
00112 FINLEY_DLL_API
00113 virtual void saveMM(const std::string& fileName) const;
00114
00118 FINLEY_DLL_API
00119 virtual void saveHB(const std::string& fileName) const;
00120
00124 FINLEY_DLL_API
00125 virtual void resetValues() const;
00126
00130 FINLEY_DLL_API
00131 static int mapOptionToPaso(const int option);
00132
00137 FINLEY_DLL_API
00138 static void escriptToPasoOptions(Paso_Options* paso_options, const boost::python::object& options);
00139
00144 FINLEY_DLL_API
00145 static void pasoToEscriptOptions(const Paso_Options* paso_options,boost::python::object& options);
00146
00150 FINLEY_DLL_API
00151 void Print_Matrix_Info(const bool) const;
00152
00153 protected:
00154
00155 private:
00156
00161 FINLEY_DLL_API
00162 virtual void setToSolution(escript::Data& out, escript::Data& in, boost::python::object& options) const;
00163
00168 FINLEY_DLL_API
00169 virtual void ypAx(escript::Data& y, escript::Data& x) const;
00170
00171
00172
00173
00174 boost::shared_ptr<Paso_SystemMatrix> m_system_matrix;
00175
00176 };
00177
00178 }
00179 #endif