/[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 123 - (hide annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 10 months ago) by jgs
File MIME type: text/plain
File size: 4772 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 jgs 82 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* Finley: SystemMatrix and SystemVector */
6    
7 jgs 102 /* adds the matrix array[Equa,Sol,NN,NN] onto the matrix in. */
8 jgs 82 /* the rows/columns are given by */
9 jgs 102 /* 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 102 /* This routine assumes that in->Equa=in->Sol=1, i.e. */
13 jgs 82 /* array is fully packed. */
14 jgs 102 /* 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 123 void Finley_SystemMatrix_add(Finley_SystemMatrix* in,dim_t NN_Equa,index_t* Nodes_Equa, dim_t num_Equa,
29     dim_t NN_Sol,index_t* Nodes_Sol, dim_t num_Sol, double* array) {
30     dim_t k_Equa,j_Equa,j_Sol,k_Sol,i_Equa,i_Sol,l_col,l_row,ic,ir,index,k,iptr;
31     dim_t row_block_size=in->row_block_size;
32     dim_t col_block_size=in->col_block_size;
33     dim_t block_size=in->block_size;
34     dim_t num_subblocks_Equa=num_Equa/row_block_size;
35     dim_t num_subblocks_Sol=num_Sol/col_block_size;
36 jgs 102
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 102 }
58     }
59     }
60     }
61     }
62 jgs 82 }
63 jgs 102 } 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 jgs 117 i_Sol=ic+col_block_size*l_col;
76 jgs 102 for (ir=0;ir<row_block_size;++ir) {
77 jgs 117 i_Equa=ir+row_block_size*l_row;
78 jgs 102 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 jgs 123 /*
92     * $Log$
93     * Revision 1.6 2005/07/08 04:07:58 jgs
94     * Merge of development branch back to main trunk on 2005-07-08
95     *
96     * Revision 1.1.1.1.2.3 2005/06/29 02:34:56 gross
97     * some changes towards 64 integers in finley
98     *
99     * Revision 1.1.1.1.2.2 2005/03/15 07:23:55 gross
100     * Finley's interface to the SCSL library can deal with systems of PDEs now. tests shows that the SCSL library cannot deal with problems with more then 200000 unknowns. problem has been reported to SGI.
101     *
102     * Revision 1.1.1.1.2.1 2004/11/12 06:58:19 gross
103     * 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
104     *
105     * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
106     * initial import of project esys2
107     *
108     * Revision 1.1 2004/07/02 04:21:13 gross
109     * Finley C code has been included
110     *
111     *
112     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26