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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2474 - (hide annotations)
Tue Jun 16 06:32:15 2009 UTC (9 years, 10 months ago) by gross
File MIME type: text/plain
File size: 3554 byte(s)
linearPDEs has is now using the SolverOptions class to talk to PASO
1 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
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 dhawcroft 631
14 ksteube 1811
15 jgs 150 /**************************************************************/
16    
17     /* Paso: interface to the direct solvers */
18    
19     /**************************************************************/
20    
21     /* Copyrights by ACcESS Australia 2003 */
22     /* Author: gross@access.edu.au */
23    
24     /**************************************************************/
25    
26     #include "Paso.h"
27 gross 584 #include "performance.h"
28 gross 700 #include "Solver.h"
29 jgs 150
30     #ifdef SCSL
31 gross 411 #include "SCSL.h"
32 jgs 150 #endif
33    
34     #ifdef MKL
35 gross 411 #include "MKL.h"
36 jgs 150 #endif
37    
38     #ifdef UMFPACK
39 gross 411 #include "UMFPACK.h"
40 jgs 150 #endif
41    
42     /**************************************************************/
43    
44     void Paso_solve(Paso_SystemMatrix* A,
45 gross 1361 double* out,
46     double* in,
47     Paso_Options* options) {
48 ksteube 1312
49 gross 584 Paso_Performance pp;
50 gross 1028 index_t package;
51 jgs 150 Paso_resetError();
52 ksteube 1312 if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
53     || A->col_block_size!=A->row_block_size) {
54 gross 415 Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
55 jgs 150 return;
56     }
57 gross 2474 Paso_Options_show(options);
58 gross 584 Performance_open(&pp,options->verbose);
59 gross 2315 package=Paso_Options_getPackage(options->method,options->package,options->symmetric, A->mpi_info);
60 jgs 150 if (Paso_noError()) {
61     switch(package) {
62    
63     case PASO_PASO:
64 gross 584 Paso_Solver(A,out,in,options,&pp);
65 gross 727 A->solver_package=PASO_PASO;
66 jgs 150 break;
67    
68     #ifdef SCSL
69     case PASO_SCSL:
70 ksteube 1312 if (A->mpi_info->size>1) {
71     Paso_setError(VALUE_ERROR,"Paso_solve: SCSL package does not support MPI.");
72     return;
73     }
74 gross 584 Paso_SCSL(A,out,in,options,&pp);
75 gross 727 A->solver_package=PASO_SCSL;
76 jgs 150 break;
77     #endif
78    
79 gross 425
80     #ifdef MKL
81 jgs 150 case PASO_MKL:
82 ksteube 1312 if (A->mpi_info->size>1) {
83     Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
84     return;
85     }
86 gross 584 Paso_MKL(A,out,in,options,&pp);
87 gross 727 A->solver_package=PASO_MKL;
88 jgs 150 break;
89 gross 425 #endif
90 jgs 150
91 gross 805 #ifdef UMFPACK
92 jgs 150 case PASO_UMFPACK:
93 ksteube 1312 if (A->mpi_info->size>1) {
94     Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
95     return;
96     }
97 gross 806 Paso_UMFPACK(A,out,in,options,&pp);
98 gross 727 A->solver_package=PASO_UMFPACK;
99 jgs 150 break;
100 gross 805 #endif
101 jgs 150
102     default:
103 gross 415 Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
104 gross 584 break;
105 jgs 150 }
106     }
107 gross 584 Performance_close(&pp,options->verbose);
108 gross 2474 Paso_Options_showDiagnostics(options);
109 jgs 150 return;
110     }
111    
112     /* free memory possibly resereved for a recall */
113    
114     void Paso_solve_free(Paso_SystemMatrix* in) {
115 gross 727
116 gross 1417 if (in==NULL) return;
117    
118 gross 425 switch(in->solver_package) {
119    
120     case PASO_PASO:
121 jgs 150 Paso_Solver_free(in);
122 gross 425 break;
123    
124     #ifdef SCSL
125     case PASO_SCSL:
126 jgs 150 Paso_SCSL_free(in);
127 gross 425 break;
128     #endif
129    
130    
131     #ifdef MKL
132     case PASO_MKL:
133     Paso_MKL_free(in);
134     break;
135     #endif
136    
137 gross 806 #ifdef UMFPACK
138 gross 425 case PASO_UMFPACK:
139     Paso_UMFPACK_free(in);
140     break;
141 gross 806 #endif
142 ksteube 1312
143 gross 425 }
144 jgs 150 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26