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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1417 - (show annotations)
Mon Feb 25 04:45:48 2008 UTC (11 years, 2 months ago) by gross
File MIME type: text/plain
File size: 3505 byte(s)
some more work on the transport solver.
1
2 /* $Id$ */
3
4 /*******************************************************
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
16 /**************************************************************/
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 #include "performance.h"
29 #include "Solver.h"
30
31 #ifdef SCSL
32 #include "SCSL.h"
33 #endif
34
35 #ifdef MKL
36 #include "MKL.h"
37 #endif
38
39 #ifdef UMFPACK
40 #include "UMFPACK.h"
41 #endif
42
43 /**************************************************************/
44
45 void Paso_solve(Paso_SystemMatrix* A,
46 double* out,
47 double* in,
48 Paso_Options* options) {
49
50 Paso_Performance pp;
51 index_t package;
52 Paso_resetError();
53 if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
54 || A->col_block_size!=A->row_block_size) {
55 Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
56 return;
57 }
58 Performance_open(&pp,options->verbose);
59 package=Paso_Options_getPackage(options->method,options->package,options->symmetric);
60 if (Paso_noError()) {
61 switch(package) {
62
63 case PASO_PASO:
64 Paso_Solver(A,out,in,options,&pp);
65 A->solver_package=PASO_PASO;
66 break;
67
68 #ifdef SCSL
69 case PASO_SCSL:
70 if (A->mpi_info->size>1) {
71 Paso_setError(VALUE_ERROR,"Paso_solve: SCSL package does not support MPI.");
72 return;
73 }
74 Paso_SCSL(A,out,in,options,&pp);
75 A->solver_package=PASO_SCSL;
76 break;
77 #endif
78
79
80 #ifdef MKL
81 case PASO_MKL:
82 if (A->mpi_info->size>1) {
83 Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
84 return;
85 }
86 Paso_MKL(A,out,in,options,&pp);
87 A->solver_package=PASO_MKL;
88 break;
89 #endif
90
91 #ifdef UMFPACK
92 case PASO_UMFPACK:
93 if (A->mpi_info->size>1) {
94 Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
95 return;
96 }
97 Paso_UMFPACK(A,out,in,options,&pp);
98 A->solver_package=PASO_UMFPACK;
99 break;
100 #endif
101
102 default:
103 Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
104 break;
105 }
106 }
107 Performance_close(&pp,options->verbose);
108 return;
109 }
110
111 /* free memory possibly resereved for a recall */
112
113 void Paso_solve_free(Paso_SystemMatrix* in) {
114
115 if (in==NULL) return;
116
117 switch(in->solver_package) {
118
119 case PASO_PASO:
120 Paso_Solver_free(in);
121 break;
122
123 #ifdef SCSL
124 case PASO_SCSL:
125 Paso_SCSL_free(in);
126 break;
127 #endif
128
129
130 #ifdef MKL
131 case PASO_MKL:
132 Paso_MKL_free(in);
133 break;
134 #endif
135
136 #ifdef UMFPACK
137 case PASO_UMFPACK:
138 Paso_UMFPACK_free(in);
139 break;
140 #endif
141
142 }
143 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26