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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1417 - (hide annotations)
Mon Feb 25 04:45:48 2008 UTC (11 years, 1 month ago) by gross
File MIME type: text/plain
File size: 3505 byte(s)
some more work on the transport solver.
1 ksteube 1312
2 jgs 150 /* $Id$ */
3    
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 dhawcroft 631
16 jgs 150 /**************************************************************/
17    
18     /* Paso: interface to the direct solvers */
19    
20     /**************************************************************/
21    
22     /* Copyrights by ACcESS Australia 2003 */
23     /* Author: gross@access.edu.au */
24    
25     /**************************************************************/
26    
27     #include "Paso.h"
28 gross 584 #include "performance.h"
29 gross 700 #include "Solver.h"
30 jgs 150
31     #ifdef SCSL
32 gross 411 #include "SCSL.h"
33 jgs 150 #endif
34    
35     #ifdef MKL
36 gross 411 #include "MKL.h"
37 jgs 150 #endif
38    
39     #ifdef UMFPACK
40 gross 411 #include "UMFPACK.h"
41 jgs 150 #endif
42    
43     /**************************************************************/
44    
45     void Paso_solve(Paso_SystemMatrix* A,
46 gross 1361 double* out,
47     double* in,
48     Paso_Options* options) {
49 ksteube 1312
50 gross 584 Paso_Performance pp;
51 gross 1028 index_t package;
52 jgs 150 Paso_resetError();
53 ksteube 1312 if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
54     || A->col_block_size!=A->row_block_size) {
55 gross 415 Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
56 jgs 150 return;
57     }
58 gross 584 Performance_open(&pp,options->verbose);
59 gross 1028 package=Paso_Options_getPackage(options->method,options->package,options->symmetric);
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 jgs 150 return;
109     }
110    
111     /* free memory possibly resereved for a recall */
112    
113     void Paso_solve_free(Paso_SystemMatrix* in) {
114 gross 727
115 gross 1417 if (in==NULL) return;
116    
117 gross 425 switch(in->solver_package) {
118    
119     case PASO_PASO:
120 jgs 150 Paso_Solver_free(in);
121 gross 425 break;
122    
123     #ifdef SCSL
124     case PASO_SCSL:
125 jgs 150 Paso_SCSL_free(in);
126 gross 425 break;
127     #endif
128    
129    
130     #ifdef MKL
131     case PASO_MKL:
132     Paso_MKL_free(in);
133     break;
134     #endif
135    
136 gross 806 #ifdef UMFPACK
137 gross 425 case PASO_UMFPACK:
138     Paso_UMFPACK_free(in);
139     break;
140 gross 806 #endif
141 ksteube 1312
142 gross 425 }
143 jgs 150 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26