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

Annotation of /trunk/esys2/finley/src/finleyC/System_add.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations)
Tue Dec 14 05:39:33 2004 UTC (15 years, 5 months ago) by jgs
File MIME type: text/plain
File size: 4369 byte(s)
*** empty log message ***

1 jgs 82 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* Finley: SystemMatrix and SystemVector */
6    
7 jgs 97 /* adds the matrix array[Equa,Sol,NN,NN] onto the matrix in. */
8 jgs 82 /* the rows/columns are given by */
9 jgs 97 /* i_Equa+Equa*Nodes_Equa[Nodes[j_Equa]] (i_Equa=0:Equa; j_Equa=0:NN_Equa). */
10 jgs 82 /* the routine has to be called from a parallel region */
11    
12 jgs 97 /* This routine assumes that in->Equa=in->Sol=1, i.e. */
13 jgs 82 /* array is fully packed. */
14 jgs 97 /* TODO: the case in->Equa!=1 */
15 jgs 82
16     /**************************************************************/
17    
18     /* Copyrights by ACcESS Australia 2003/04 */
19     /* Author: gross@access.edu.au */
20    
21     /**************************************************************/
22    
23     #include "Finley.h"
24     #include "System.h"
25    
26     /**************************************************************/
27    
28 jgs 97 void Finley_SystemMatrix_add(Finley_SystemMatrix* in,int NN_Equa,maybelong* Nodes_Equa, int num_Equa,
29     int NN_Sol,maybelong* Nodes_Sol, int num_Sol, double* array) {
30     int k_Equa,j_Equa,j_Sol,k_Sol,i_Equa,i_Sol,l_col,l_row,ic,ir,index,k,iptr;
31     int row_block_size=in->row_block_size;
32     int col_block_size=in->col_block_size;
33     int block_size=in->block_size;
34     int num_subblocks_Equa=num_Equa/row_block_size;
35     int num_subblocks_Sol=num_Sol/col_block_size;
36    
37     if (in->type==CSR) {
38     for (k_Equa=0;k_Equa<NN_Equa;++k_Equa) {
39     j_Equa=Nodes_Equa[k_Equa];
40     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
41     iptr=j_Equa*num_subblocks_Equa+l_row;
42     for (k_Sol=0;k_Sol<NN_Sol;++k_Sol) {
43     j_Sol=Nodes_Sol[k_Sol];
44     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
45     index=j_Sol*num_subblocks_Sol+INDEX_OFFSET+l_col;
46     for (k=in->pattern->ptr[iptr]-PTR_OFFSET;k<in->pattern->ptr[iptr+1]-PTR_OFFSET;++k) {
47     if (in->pattern->index[k]==index) {
48     for (ic=0;ic<col_block_size;++ic) {
49     i_Sol=ic+col_block_size*l_col;
50     for (ir=0;ir<row_block_size;++ir) {
51     i_Equa=ir+row_block_size*l_row;
52     in->val[k*block_size+ir+row_block_size*ic]+=
53     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
54     }
55     }
56 jgs 82 break;
57 jgs 97 }
58     }
59     }
60     }
61     }
62 jgs 82 }
63 jgs 97 } else {
64     for (k_Sol=0;k_Sol<NN_Sol;k_Sol++) {
65     j_Sol=Nodes_Sol[k_Sol];
66     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
67     iptr=j_Sol*num_subblocks_Sol+l_col;
68     for (k_Equa=0;k_Equa<NN_Equa;k_Equa++) {
69     j_Equa=Nodes_Equa[k_Equa];
70     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
71     index=j_Equa*num_subblocks_Equa+INDEX_OFFSET+l_row;
72     for (k=in->pattern->ptr[iptr]-PTR_OFFSET;k<in->pattern->ptr[iptr+1]-PTR_OFFSET;++k) {
73     if (in->pattern->index[k]==index) {
74     for (ic=0;ic<col_block_size;++ic) {
75     i_Sol=ic+num_subblocks_Sol*l_col;
76     for (ir=0;ir<row_block_size;++ir) {
77     i_Equa=ir+num_subblocks_Equa*l_row;
78     in->val[k*block_size+ir+row_block_size*ic]+=
79     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
80     }
81     }
82     break;
83     }
84     }
85     }
86     }
87     }
88     }
89     }
90 jgs 82 }
91     /*
92     * $Log$
93 jgs 97 * Revision 1.2 2004/12/14 05:39:30 jgs
94     * *** empty log message ***
95 jgs 82 *
96 jgs 97 * Revision 1.1.1.1.2.1 2004/11/12 06:58:19 gross
97     * a lot of changes to get the linearPDE class running: most important change is that there is no matrix format exposed to the user anymore. the format is chosen by the Domain according to the solver and symmetry
98     *
99     * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
100     * initial import of project esys2
101     *
102 jgs 82 * Revision 1.1 2004/07/02 04:21:13 gross
103     * Finley C code has been included
104     *
105     *
106     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26