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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26