/[escript]/branches/diaplayground/ripley/src/RipleyDomain.cpp
ViewVC logotype

Diff of /branches/diaplayground/ripley/src/RipleyDomain.cpp

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

revision 5135 by caltinay, Mon Sep 8 07:17:34 2014 UTC revision 5136 by caltinay, Tue Sep 9 07:13:55 2014 UTC
# Line 763  void RipleyDomain::Print_Mesh_Info(bool Line 763  void RipleyDomain::Print_Mesh_Info(bool
763      }      }
764  }  }
765    
766  int RipleyDomain::getSystemMatrixTypeId(int solver, int preconditioner,  int RipleyDomain::getSystemMatrixTypeId(const bp::object& options) const
                                         int package, bool symmetry) const  
767  {  {
768      // TODO      const escript::SolverBuddy& sb = bp::extract<escript::SolverBuddy>(options);
769      if (package == escript::SO_PACKAGE_CUSP)      int package = sb.getPackage();
         return 4711;  
770    
771      return 4711;      // use CUSP for single rank and supported solvers+preconditioners,
772        // PASO otherwise
773        if (package == escript::SO_DEFAULT) {
774            if (m_mpiInfo->size == 1) {
775                switch (sb.getSolverMethod()) {
776                    case escript::SO_DEFAULT:
777                    case escript::SO_METHOD_BICGSTAB:
778                    case escript::SO_METHOD_GMRES:
779                    case escript::SO_METHOD_LSQR:
780                    case escript::SO_METHOD_PCG:
781                    case escript::SO_METHOD_PRES20:
782                        package = escript::SO_PACKAGE_CUSP;
783                        break;
784                    default:
785                        package = escript::SO_PACKAGE_PASO;
786                }
787                if (package == escript::SO_PACKAGE_CUSP) {
788                    if (sb.getPreconditioner() != escript::SO_PRECONDITIONER_NONE &&
789                            sb.getPreconditioner() != escript::SO_PRECONDITIONER_JACOBI) {
790                        package = escript::SO_PACKAGE_PASO;
791                    }
792                }
793            } else {
794                package = escript::SO_PACKAGE_PASO;
795            }
796        }
797    
798        if (package == escript::SO_PACKAGE_CUSP) {
799            if (m_mpiInfo->size > 1) {
800                throw RipleyException("CUSP matrices are not supported with more than one rank");
801            }
802            return (int)SMT_CUSP;
803        }
804    
805        // in all other cases we use PASO
806        return (int)SMT_PASO | paso::SystemMatrixAdapter::getSystemMatrixTypeId(
807                sb.getSolverMethod(), sb.getPreconditioner(), sb.getPackage(),
808                sb.isSymmetric(), m_mpiInfo);
809  }  }
810    
811  int RipleyDomain::getTransportTypeId(int solver, int preconditioner,  int RipleyDomain::getTransportTypeId(int solver, int preconditioner,
# Line 813  escript::ASM_ptr RipleyDomain::newSystem Line 848  escript::ASM_ptr RipleyDomain::newSystem
848      //if (reduceRowOrder || reduceColOrder)      //if (reduceRowOrder || reduceColOrder)
849      //    throw RipleyException("newSystemMatrix: reduced order not supported");      //    throw RipleyException("newSystemMatrix: reduced order not supported");
850    
851      const int numMatrixRows = getNumDOF();      if (type == (int)SMT_CUSP) {
852      escript::ASM_ptr sm(new SystemMatrix(m_mpiInfo, row_blocksize,          const int numMatrixRows = getNumDOF();
853                  row_functionspace, numMatrixRows, getDiagonalIndices()));          escript::ASM_ptr sm(new SystemMatrix(m_mpiInfo, row_blocksize,
854      return sm;                      row_functionspace, numMatrixRows, getDiagonalIndices()));
855  /*          return sm;
856      paso::SystemMatrixPattern_ptr pattern(getPasoMatrixPattern(reduceRowOrder,      } else if (type & (int)SMT_PASO) {
857                                                                reduceColOrder));          paso::SystemMatrixPattern_ptr pattern(getPasoMatrixPattern(
858      paso::SystemMatrix_ptr matrix(new paso::SystemMatrix(type, pattern,                                              reduceRowOrder, reduceColOrder));
859              row_blocksize, column_blocksize, false));          type -= (int)SMT_PASO;
860      paso::checkPasoError();          paso::SystemMatrix_ptr matrix(new paso::SystemMatrix(type, pattern,
861      escript::ASM_ptr sma(new SystemMatrixAdapter(matrix, row_blocksize,                  row_blocksize, column_blocksize, false));
862                  row_functionspace, column_blocksize, column_functionspace));          escript::ASM_ptr sm(new paso::SystemMatrixAdapter(matrix,
863      return sma;                      row_blocksize, row_functionspace, column_blocksize,
864  */                      column_functionspace));
865            return sm;
866        } else {
867            throw RipleyException("newSystemMatrix: unknown matrix type ID");
868        }
869  }  }
870    
871  void RipleyDomain::addToSystem(escript::AbstractSystemMatrix& mat,  void RipleyDomain::addToSystem(escript::AbstractSystemMatrix& mat,

Legend:
Removed from v.5135  
changed lines
  Added in v.5136

  ViewVC Help
Powered by ViewVC 1.1.26