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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2484 - (show annotations)
Mon Jun 22 04:22:19 2009 UTC (10 years, 2 months ago) by gross
File MIME type: text/plain
File size: 3376 byte(s)
numarray removed from docu; Locator revised.
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 MKL
31 #include "MKL.h"
32 #endif
33
34 #ifdef UMFPACK
35 #include "UMFPACK.h"
36 #endif
37
38 /**************************************************************/
39
40 void Paso_solve(Paso_SystemMatrix* A,
41 double* out,
42 double* in,
43 Paso_Options* options) {
44
45 Paso_Performance pp;
46 index_t package;
47 Paso_resetError();
48 if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
49 || A->col_block_size!=A->row_block_size) {
50 Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
51 return;
52 }
53 /* Paso_Options_show(options); */
54 Performance_open(&pp,options->verbose);
55 package=Paso_Options_getPackage(options->method,options->package,options->symmetric, A->mpi_info);
56 if (Paso_noError()) {
57 switch(package) {
58
59 case PASO_PASO:
60 Paso_Solver(A,out,in,options,&pp);
61 A->solver_package=PASO_PASO;
62 break;
63
64 #ifdef MKL
65 case PASO_MKL:
66 if (A->mpi_info->size>1) {
67 Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
68 return;
69 }
70 Paso_MKL(A,out,in,options,&pp);
71 A->solver_package=PASO_MKL;
72 break;
73 #endif
74
75 #ifdef UMFPACK
76 case PASO_UMFPACK:
77 if (A->mpi_info->size>1) {
78 Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
79 return;
80 }
81 Paso_UMFPACK(A,out,in,options,&pp);
82 A->solver_package=PASO_UMFPACK;
83 break;
84 #endif
85
86 default:
87 Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
88 break;
89 }
90 }
91 /*
92 cancel divergence errors
93 */
94 if (options->accept_failed_convergence) {
95 if (Paso_getErrorType() == DIVERGED) {
96 Paso_resetError();
97 if (options->verbose) printf("PASO: failed convergence error has been canceled requested.");
98 }
99 }
100 Performance_close(&pp,options->verbose);
101 Paso_Options_showDiagnostics(options);
102 return;
103 }
104
105 /* free memory possibly resereved for a recall */
106
107 void Paso_solve_free(Paso_SystemMatrix* in) {
108
109 if (in==NULL) return;
110
111 switch(in->solver_package) {
112
113 case PASO_PASO:
114 Paso_Solver_free(in);
115 break;
116
117 #ifdef MKL
118 case PASO_MKL:
119 Paso_MKL_free(in);
120 break;
121 #endif
122
123 #ifdef UMFPACK
124 case PASO_UMFPACK:
125 Paso_UMFPACK_free(in);
126 break;
127 #endif
128
129 }
130 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26