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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years, 1 month ago) by ksteube
File MIME type: text/plain
File size: 3470 byte(s)
Copyright updated in all files

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 584 Performance_open(&pp,options->verbose);
58 gross 1028 package=Paso_Options_getPackage(options->method,options->package,options->symmetric);
59 jgs 150 if (Paso_noError()) {
60     switch(package) {
61    
62     case PASO_PASO:
63 gross 584 Paso_Solver(A,out,in,options,&pp);
64 gross 727 A->solver_package=PASO_PASO;
65 jgs 150 break;
66    
67     #ifdef SCSL
68     case PASO_SCSL:
69 ksteube 1312 if (A->mpi_info->size>1) {
70     Paso_setError(VALUE_ERROR,"Paso_solve: SCSL package does not support MPI.");
71     return;
72     }
73 gross 584 Paso_SCSL(A,out,in,options,&pp);
74 gross 727 A->solver_package=PASO_SCSL;
75 jgs 150 break;
76     #endif
77    
78 gross 425
79     #ifdef MKL
80 jgs 150 case PASO_MKL:
81 ksteube 1312 if (A->mpi_info->size>1) {
82     Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
83     return;
84     }
85 gross 584 Paso_MKL(A,out,in,options,&pp);
86 gross 727 A->solver_package=PASO_MKL;
87 jgs 150 break;
88 gross 425 #endif
89 jgs 150
90 gross 805 #ifdef UMFPACK
91 jgs 150 case PASO_UMFPACK:
92 ksteube 1312 if (A->mpi_info->size>1) {
93     Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
94     return;
95     }
96 gross 806 Paso_UMFPACK(A,out,in,options,&pp);
97 gross 727 A->solver_package=PASO_UMFPACK;
98 jgs 150 break;
99 gross 805 #endif
100 jgs 150
101     default:
102 gross 415 Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
103 gross 584 break;
104 jgs 150 }
105     }
106 gross 584 Performance_close(&pp,options->verbose);
107 jgs 150 return;
108     }
109    
110     /* free memory possibly resereved for a recall */
111    
112     void Paso_solve_free(Paso_SystemMatrix* in) {
113 gross 727
114 gross 1417 if (in==NULL) return;
115    
116 gross 425 switch(in->solver_package) {
117    
118     case PASO_PASO:
119 jgs 150 Paso_Solver_free(in);
120 gross 425 break;
121    
122     #ifdef SCSL
123     case PASO_SCSL:
124 jgs 150 Paso_SCSL_free(in);
125 gross 425 break;
126     #endif
127    
128    
129     #ifdef MKL
130     case PASO_MKL:
131     Paso_MKL_free(in);
132     break;
133     #endif
134    
135 gross 806 #ifdef UMFPACK
136 gross 425 case PASO_UMFPACK:
137     Paso_UMFPACK_free(in);
138     break;
139 gross 806 #endif
140 ksteube 1312
141 gross 425 }
142 jgs 150 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26