/[escript]/trunk/esys2/finley/src/finleyC/System_solve.c
ViewVC logotype

Contents of /trunk/esys2/finley/src/finleyC/System_solve.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (show annotations)
Wed Dec 15 07:08:39 2004 UTC (14 years, 11 months ago) by jgs
File MIME type: text/plain
File size: 2996 byte(s)
*** empty log message ***

1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* Finley: interface to the direct solvers */
6
7 /**************************************************************/
8
9 /* Copyrights by ACcESS Australia 2003 */
10 /* Author: gross@access.edu.au */
11
12 /**************************************************************/
13
14 #include "escript/Data/DataC.h"
15 #include "Finley.h"
16 #include "System.h"
17
18 #if DIRECT_SOLVER == SGI_SCSL
19 #include "SCSL/SCSL.h"
20 #else
21 #include "Solvers/Solver.h"
22 #endif
23
24 #if ITERATIVE_SOLVER == SGI_SCSL
25 #include "SCSL/SCSL.h"
26 #else
27 #include "Solvers/Solver.h"
28 #endif
29
30 /**************************************************************/
31
32 void Finley_SystemMatrix_solve(Finley_SystemMatrix* A,
33 escriptDataC* out,
34 escriptDataC* in,
35 Finley_SolverOptions* options) {
36 if (A->num_rows!=A->num_cols || A->col_block_size!=A->row_block_size) {
37 Finley_ErrorCode=TYPE_ERROR;
38 sprintf(Finley_ErrorMsg,"matrix has to be a square matrix.");
39 } else if (A->num_rows*A->row_block_size!=getLength(in) ) {
40 Finley_ErrorCode=TYPE_ERROR;
41 sprintf(Finley_ErrorMsg,"number of rows and length of right hand side don't match.");
42 } else if (A->num_cols*A->col_block_size!=getLength(out) ) {
43 Finley_ErrorCode=TYPE_ERROR;
44 sprintf(Finley_ErrorMsg,"number of rows and length of solution vector don't match.");
45 } else if (!isExpanded(in)) {
46 Finley_ErrorCode=TYPE_ERROR;
47 sprintf(Finley_ErrorMsg,"input Data object has to be expanded");
48 } else if (!isExpanded(out)) {
49 Finley_ErrorCode=TYPE_ERROR;
50 sprintf(Finley_ErrorMsg,"output Data object has to be expanded");
51 }
52 if (options->method==ESCRIPT_DIRECT || options->method==ESCRIPT_CHOLEVSKY) {
53 #ifdef Finley_TRACE
54 printf("Finley calls direct solver.\n");
55 #endif
56 #if DIRECT_SOLVER == SGI_SCSL
57 Finley_SCSL(A,getSampleData(out,0),getSampleData(in,0),options);
58 #else
59 Finley_Solver(A,getSampleData(out,0),getSampleData(in,0),options);
60 #endif
61 } else {
62 #ifdef Finley_TRACE
63 printf("Iterative solver is called with tolerance %e.\n",options->tolerance);
64 #endif
65 #if ITERATIVE_SOLVER == SGI_SCSL
66 Finley_SCSL(A,getSampleData(out,0),getSampleData(in,0),options);
67 #else
68 Finley_Solver(A,getSampleData(out,0),getSampleData(in,0),options);
69 #endif
70 }
71 }
72
73 /* free memory possibly resereved for a recall */
74
75 void Finley_SystemMatrix_solve_free(Finley_SystemMatrix* in) {
76 #if DIRECT_SOLVER == SGI_SCSL
77 Finley_SCSL_free(in);
78 #else
79 Finley_Solver_free(in);
80 #endif
81 #if ITERATIVE_SOLVER == SGI_SCSL
82 Finley_SCSL_free(in);
83 #else
84 Finley_Solver_free(in);
85 #endif
86 }
87 /*
88 * $Log$
89 * Revision 1.4 2004/12/15 07:08:34 jgs
90 * *** empty log message ***
91 *
92 *
93 *
94 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26