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 SystemMatrixAdapter_20040610_H 00019 #define SystemMatrixAdapter_20040610_H 00020 #include "system_dep.h" 00021 00022 #include "paso/SystemMatrix.h" 00023 #include "paso/Options.h" 00024 00025 #include "PasoException.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 paso { 00036 00037 PASOWRAP_DLL_API 00038 class SystemMatrixAdapter: public escript::AbstractSystemMatrix 00039 { 00040 00049 public: 00050 00056 SystemMatrixAdapter(); 00057 00062 SystemMatrixAdapter(SystemMatrix_ptr 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 ~SystemMatrixAdapter(); 00075 00080 SystemMatrix_ptr getPaso_SystemMatrix() const; 00081 00086 inline const escript::AbstractSystemMatrix& asAbstractSystemMatrix() const 00087 { 00088 return dynamic_cast<const escript::AbstractSystemMatrix&>(*this); 00089 } 00090 00095 inline static const SystemMatrixAdapter& asSystemMatrixAdapter(const AbstractSystemMatrix& systemmatrix) 00096 { 00097 return dynamic_cast<const SystemMatrixAdapter&>(systemmatrix); 00098 } 00099 00104 void nullifyRowsAndCols(escript::Data& row_q, escript::Data& col_q, const double mdv) const; 00105 00109 virtual void saveMM(const std::string& filename) const; 00110 00114 virtual void saveHB(const std::string& filename) const; 00115 00119 virtual void resetValues() const; 00120 00124 static int mapOptionToPaso(const int option); 00125 00131 static int getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry, Esys_MPIInfo* mpiInfo); 00132 00137 static void escriptToPasoOptions(Options* paso_options, const boost::python::object& options); 00138 00143 static void pasoToEscriptOptions(const Options* paso_options, boost::python::object& options); 00144 00148 void Print_Matrix_Info(const bool) const; 00149 00150 protected: 00151 00152 private: 00153 00158 virtual void setToSolution(escript::Data& out, escript::Data& in, boost::python::object& options) const; 00159 00164 virtual void ypAx(escript::Data& y, escript::Data& x) const; 00165 00166 // 00167 // pointer to the externally created system_matrix. 00168 // 00169 SystemMatrix_ptr m_system_matrix; 00170 00171 }; 00172 00173 } // end of namespace 00174 #endif