/[escript]/trunk/paso/src/solve.c
ViewVC logotype

Diff of /trunk/paso/src/solve.c

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

revision 631 by dhawcroft, Thu Mar 23 04:27:32 2006 UTC revision 2484 by gross, Mon Jun 22 04:22:19 2009 UTC
# Line 1  Line 1 
 /* $Id$ */  
1    
2    /*******************************************************
3    *
4    * Copyright (c) 2003-2008 by University of Queensland
5    * Earth Systems Science Computational Center (ESSCC)
6    * http://www.uq.edu.au/esscc
7    *
8    * Primary Business: Queensland, Australia
9    * Licensed under the Open Software License version 3.0
10    * http://www.opensource.org/licenses/osl-3.0.php
11    *
12    *******************************************************/
13    
 /*  
 ********************************************************************************  
 *               Copyright 2006 by ACcESS MNRF                                *  
 *                                                                              *  
 *                 http://www.access.edu.au                                     *  
 *           Primary Business: Queensland, Australia                            *  
 *     Licensed under the Open Software License version 3.0             *  
 *        http://www.opensource.org/licenses/osl-3.0.php                        *  
 ********************************************************************************  
 */  
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 25  Line 25 
25    
26  #include "Paso.h"  #include "Paso.h"
27  #include "performance.h"  #include "performance.h"
28  #include "Solvers/Solver.h"  #include "Solver.h"
   
 #ifdef SCSL  
 #include "SCSL.h"  
 #endif  
29    
30  #ifdef MKL  #ifdef MKL
31  #include "MKL.h"  #include "MKL.h"
# Line 42  Line 38 
38  /**************************************************************/  /**************************************************************/
39    
40  void Paso_solve(Paso_SystemMatrix* A,  void Paso_solve(Paso_SystemMatrix* A,
41                                 double* out,                  double* out,
42                                 double* in,                  double* in,
43                                 Paso_Options* options) {                  Paso_Options* options) {
44    
45    Paso_Performance pp;    Paso_Performance pp;
46      index_t package;
47    Paso_resetError();    Paso_resetError();
48    if (A->num_rows!=A->num_cols || A->col_block_size!=A->row_block_size) {    if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
49                    || A->col_block_size!=A->row_block_size) {
50         Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");         Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
51         return;         return;
52    }    }
53      /* Paso_Options_show(options); */
54    Performance_open(&pp,options->verbose);    Performance_open(&pp,options->verbose);
55    index_t package=Paso_Options_getPackage(options->method,options->package,options->symmetric);    package=Paso_Options_getPackage(options->method,options->package,options->symmetric, A->mpi_info);
56    if (Paso_noError()) {    if (Paso_noError()) {
57       switch(package) {       switch(package) {
58    
59          case PASO_PASO:          case PASO_PASO:
60            Paso_Solver(A,out,in,options,&pp);            Paso_Solver(A,out,in,options,&pp);
61            if (Paso_noError()) A->solver_package=PASO_PASO;            A->solver_package=PASO_PASO;
           break;  
   
         #ifdef SCSL  
         case PASO_SCSL:  
           Paso_SCSL(A,out,in,options,&pp);  
           if (Paso_noError()) A->solver_package=PASO_SCSL;  
62            break;            break;
         #endif  
63    
     
64          #ifdef MKL          #ifdef MKL
65          case PASO_MKL:          case PASO_MKL:
66              if (A->mpi_info->size>1) {
67                  Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
68                  return;
69              }
70            Paso_MKL(A,out,in,options,&pp);            Paso_MKL(A,out,in,options,&pp);
71            if (Paso_noError()) A->solver_package=PASO_MKL;            A->solver_package=PASO_MKL;
72            break;            break;
73          #endif          #endif
74    
75  /*          #ifdef UMFPACK
76          case PASO_UMFPACK:          case PASO_UMFPACK:
77            Paso_UMFPACK(A,out,in,options);            if (A->mpi_info->size>1) {
78            if (Paso_noError()) A->solver_package=PASO_UMFPACK;                Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
79                  return;
80              }
81              Paso_UMFPACK(A,out,in,options,&pp);
82              A->solver_package=PASO_UMFPACK;
83            break;            break;
84  */          #endif
85    
86          default:          default:
87             Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");             Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
88             break;             break;
89       }       }
90    }    }
91      /*
92           cancel divergence errors
93      */
94      if (options->accept_failed_convergence) {
95             if (Paso_getErrorType() == DIVERGED) {
96                 Paso_resetError();
97                 if (options->verbose) printf("PASO: failed convergence error has been canceled requested.");
98             }
99      }
100    Performance_close(&pp,options->verbose);    Performance_close(&pp,options->verbose);
101      Paso_Options_showDiagnostics(options);
102    return;    return;
103  }  }
104    
105  /*  free memory possibly resereved for a recall */  /*  free memory possibly resereved for a recall */
106    
107  void Paso_solve_free(Paso_SystemMatrix* in) {  void Paso_solve_free(Paso_SystemMatrix* in) {
108    
109         if (in==NULL) return;
110    
111       switch(in->solver_package) {       switch(in->solver_package) {
112    
113          case PASO_PASO:          case PASO_PASO:
114            Paso_Solver_free(in);            Paso_Solver_free(in);
115            break;            break;
116    
         #ifdef SCSL  
         case PASO_SCSL:  
           Paso_SCSL_free(in);  
           break;  
         #endif  
   
     
117          #ifdef MKL          #ifdef MKL
118          case PASO_MKL:          case PASO_MKL:
119            Paso_MKL_free(in);            Paso_MKL_free(in);
120            break;            break;
121          #endif          #endif
122    
123  /*          #ifdef UMFPACK
124          case PASO_UMFPACK:          case PASO_UMFPACK:
125            Paso_UMFPACK_free(in);            Paso_UMFPACK_free(in);
126            break;            break;
127  */          #endif
128    
129     }     }
130  }  }
 /*  
  * $Log$  
  * Revision 1.2  2005/09/15 03:44:39  jgs  
  * Merge of development branch dev-02 back to main trunk on 2005-09-15  
  *  
  * Revision 1.1.2.2  2005/09/07 00:59:08  gross  
  * some inconsistent renaming fixed to make the linking work.  
  *  
  * Revision 1.1.2.1  2005/09/05 06:29:49  gross  
  * These files have been extracted from finley to define a stand alone libray for iterative  
  * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but  
  * has not been tested yet.  
  *  
  *  
  */  

Legend:
Removed from v.631  
changed lines
  Added in v.2484

  ViewVC Help
Powered by ViewVC 1.1.26