/[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 100 - (show annotations)
Wed Dec 15 03:48:48 2004 UTC (15 years ago) by jgs
File MIME type: text/plain
File size: 2503 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 /**************************************************************/
25
26 void Finley_SystemMatrix_solve(Finley_SystemMatrix* A,
27 escriptDataC* out,
28 escriptDataC* in,
29 Finley_SolverOptions* options) {
30 if (A->num_rows!=A->num_cols || A->col_block_size!=A->row_block_size) {
31 Finley_ErrorCode=TYPE_ERROR;
32 sprintf(Finley_ErrorMsg,"matrix has to be a square matrix.");
33 } else if (A->num_rows*A->row_block_size!=getLength(in) ) {
34 Finley_ErrorCode=TYPE_ERROR;
35 sprintf(Finley_ErrorMsg,"number of rows and length of right hand side don't match.");
36 } else if (A->num_cols*A->col_block_size!=getLength(out) ) {
37 Finley_ErrorCode=TYPE_ERROR;
38 sprintf(Finley_ErrorMsg,"number of rows and length of solution vector don't match.");
39 } else if (!isExpanded(in)) {
40 Finley_ErrorCode=TYPE_ERROR;
41 sprintf(Finley_ErrorMsg,"input Data object has to be expanded");
42 } else if (!isExpanded(out)) {
43 Finley_ErrorCode=TYPE_ERROR;
44 sprintf(Finley_ErrorMsg,"output Data object has to be expanded");
45 }
46
47 #ifdef Finley_TRACE
48 printf("Finley calls direct solver.\n");
49 #endif
50 #if DIRECT_SOLVER == SGI_SCSL
51 Finley_SCSL_solve(A,getSampleData(out,0),getSampleData(in,0),options);
52 #else
53 Finley_Solver(A,getSampleData(out,0),getSampleData(in,0),options);
54 #endif
55 #ifdef Finley_TRACE
56 printf("direct solver finalized.\n");
57 #endif
58 }
59
60 /* free memory possibly resereved for a recall */
61
62 void Finley_SystemMatrix_solve_free(Finley_SystemMatrix* in) {
63 #if DIRECT_SOLVER == SGI_SCSL
64 Finley_SCSL_solve_free(in);
65 #else
66 Finley_Solver_free(in);
67 #endif
68 }
69 /*
70 * $Log$
71 * Revision 1.3 2004/12/15 03:48:47 jgs
72 * *** empty log message ***
73 *
74 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
75 * initial import of project esys2
76 *
77 * Revision 1.1 2004/07/02 04:21:13 gross
78 * Finley C code has been included
79 *
80 *
81 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26