/[escript]/trunk/finley/src/CPPAdapter/SystemMatrixAdapter.cpp
ViewVC logotype

Diff of /trunk/finley/src/CPPAdapter/SystemMatrixAdapter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1363 by ksteube, Wed Nov 7 01:53:12 2007 UTC revision 1364 by gross, Mon Dec 17 07:22:45 2007 UTC
# Line 188  void SystemMatrixAdapter::setToSolution( Line 188  void SystemMatrixAdapter::setToSolution(
188  {  {
189      Paso_SystemMatrix* mat=getPaso_SystemMatrix();      Paso_SystemMatrix* mat=getPaso_SystemMatrix();
190      Paso_Options paso_options;      Paso_Options paso_options;
191      Paso_Options_setDefaults(&paso_options);      dictToPasoOptions(&paso_options,options);
192        // Paso_Options_setDefaults(&paso_options);
193      // extract options      // extract options
194      #define EXTRACT(__key__,__val__,__type__) if ( options.has_key(__key__)) paso_options.__val__=boost::python::extract<__type__>(options.get(__key__))      // #define EXTRACT(__key__,__val__,__type__) if ( options.has_key(__key__)) paso_options.__val__=boost::python::extract<__type__>(options.get(__key__))
195      #define EXTRACT_OPTION(__key__,__val__,__type__) if ( options.has_key(__key__)) paso_options.__val__=mapOptionToPaso(boost::python::extract<__type__>(options.get(__key__)))      // #define EXTRACT_OPTION(__key__,__val__,__type__) if ( options.has_key(__key__)) paso_options.__val__=mapOptionToPaso(boost::python::extract<__type__>(options.get(__key__)))
196      EXTRACT("verbose",verbose,int);      // EXTRACT("verbose",verbose,int);
197      EXTRACT_OPTION("reordering",reordering,int);      // EXTRACT_OPTION("reordering",reordering,int);
198      EXTRACT(ESCRIPT_TOLERANCE_KEY,tolerance,double);      // EXTRACT(ESCRIPT_TOLERANCE_KEY,tolerance,double);
199      EXTRACT_OPTION(ESCRIPT_METHOD_KEY,method,int);      // EXTRACT_OPTION(ESCRIPT_METHOD_KEY,method,int);
200      EXTRACT(ESCRIPT_SYMMETRY_KEY,symmetric,int);      // EXTRACT(ESCRIPT_SYMMETRY_KEY,symmetric,int);
201      EXTRACT_OPTION(ESCRIPT_PACKAGE_KEY,package,int);      // EXTRACT_OPTION(ESCRIPT_PACKAGE_KEY,package,int);
202      EXTRACT_OPTION("preconditioner",preconditioner,int);      // EXTRACT_OPTION("preconditioner",preconditioner,int);
203      EXTRACT("iter_max",iter_max,int);      // EXTRACT("iter_max",iter_max,int);
204      EXTRACT("drop_tolerance",drop_tolerance,double);      // EXTRACT("drop_tolerance",drop_tolerance,double);
205      EXTRACT("drop_storage",drop_storage,double);      // EXTRACT("drop_storage",drop_storage,double);
206      EXTRACT("truncation",truncation,int);      // EXTRACT("truncation",truncation,int);
207      EXTRACT("restart",restart,int);      // EXTRACT("restart",restart,int);
208      #undef EXTRACT      // #undef EXTRACT
209      #undef EXTRACT_OPTION      // #undef EXTRACT_OPTION
210      if ( out.getDataPointSize()  != getColumnBlockSize()) {      if ( out.getDataPointSize()  != getColumnBlockSize()) {
211       throw FinleyAdapterException("solve : column block size does not match the number of components of solution.");       throw FinleyAdapterException("solve : column block size does not match the number of components of solution.");
212      } else if ( in.getDataPointSize() != getRowBlockSize()) {      } else if ( in.getDataPointSize() != getRowBlockSize()) {
# Line 275  void SystemMatrixAdapter::resetValues() Line 276  void SystemMatrixAdapter::resetValues()
276     checkPasoError();     checkPasoError();
277  }  }
278    
279    void SystemMatrixAdapter::dictToPasoOptions(Paso_Options* paso_options, const boost::python::dict& options)
280    {
281        Paso_Options_setDefaults(paso_options);
282        #define EXTRACT(__key__,__val__,__type__) if ( options.has_key(__key__)) paso_options->__val__=boost::python::extract<__type__>(options.get(__key__))
283        #define EXTRACT_OPTION(__key__,__val__,__type__) if ( options.has_key(__key__)) paso_options->__val__=mapOptionToPaso(boost::python::extract<__type__>(options.get(__key__)))
284        EXTRACT("verbose",verbose,int);
285        EXTRACT_OPTION("reordering",reordering,int);
286        EXTRACT(ESCRIPT_TOLERANCE_KEY,tolerance,double);
287        EXTRACT_OPTION(ESCRIPT_METHOD_KEY,method,int);
288        EXTRACT(ESCRIPT_SYMMETRY_KEY,symmetric,int);
289        EXTRACT_OPTION(ESCRIPT_PACKAGE_KEY,package,int);
290        EXTRACT_OPTION("preconditioner",preconditioner,int);
291        EXTRACT("iter_max",iter_max,int);
292        EXTRACT("drop_tolerance",drop_tolerance,double);
293        EXTRACT("drop_storage",drop_storage,double);
294        EXTRACT("truncation",truncation,int);
295        EXTRACT("restart",restart,int);
296        #undef EXTRACT
297        #undef EXTRACT_OPTION
298    }
299        
300    
301  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.1363  
changed lines
  Added in v.1364

  ViewVC Help
Powered by ViewVC 1.1.26