/[escript]/trunk/finley/src/Assemble_addToSystemMatrix.c
ViewVC logotype

Annotation of /trunk/finley/src/Assemble_addToSystemMatrix.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 616 - (hide annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 6 months ago) by elspeth
File MIME type: text/plain
File size: 5559 byte(s)
Copyright added to more source files.

1 jgs 150 /*
2 elspeth 616 ************************************************************
3     * Copyright 2006 by ACcESS MNRF *
4     * *
5     * http://www.access.edu.au *
6     * Primary Business: Queensland, Australia *
7     * Licensed under the Open Software License version 3.0 *
8     * http://www.opensource.org/licenses/osl-3.0.php *
9     * *
10     ************************************************************
11 jgs 150 */
12     /**************************************************************/
13    
14     /* Finley: SystemMatrix and SystemVector */
15    
16     /* adds the matrix array[Equa,Sol,NN,NN] onto the matrix in. */
17     /* the rows/columns are given by */
18     /* i_Equa+Equa*Nodes_Equa[Nodes[j_Equa]] (i_Equa=0:Equa; j_Equa=0:NN_Equa). */
19     /* the routine has to be called from a parallel region */
20    
21     /* This routine assumes that in->Equa=in->Sol=1, i.e. */
22     /* array is fully packed. */
23     /* TODO: the case in->Equa!=1 */
24    
25     /**************************************************************/
26    
27     /* Author: gross@access.edu.au */
28     /* Version: $Id$ */
29    
30     /**************************************************************/
31    
32     #include "Assemble.h"
33    
34     /**************************************************************/
35    
36     void Finley_Assemble_addToSystemMatrix(Paso_SystemMatrix* in,dim_t NN_Equa,index_t* Nodes_Equa, dim_t num_Equa,
37     dim_t NN_Sol,index_t* Nodes_Sol, dim_t num_Sol, double* array) {
38 gross 416 index_t index_offset=(in->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
39 jgs 150 dim_t k_Equa,j_Equa,j_Sol,k_Sol,i_Equa,i_Sol,l_col,l_row,ic,ir,index,k,iptr;
40     dim_t row_block_size=in->row_block_size;
41     dim_t col_block_size=in->col_block_size;
42     dim_t block_size=in->block_size;
43     dim_t num_subblocks_Equa=num_Equa/row_block_size;
44     dim_t num_subblocks_Sol=num_Sol/col_block_size;
45    
46 gross 416 if (in->type & MATRIX_FORMAT_CSC) {
47     for (k_Sol=0;k_Sol<NN_Sol;k_Sol++) {
48     j_Sol=Nodes_Sol[k_Sol];
49     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
50     iptr=j_Sol*num_subblocks_Sol+l_col;
51     for (k_Equa=0;k_Equa<NN_Equa;k_Equa++) {
52     j_Equa=Nodes_Equa[k_Equa];
53     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
54     index=j_Equa*num_subblocks_Equa+index_offset+l_row;
55     for (k=in->pattern->ptr[iptr]-index_offset;k<in->pattern->ptr[iptr+1]-index_offset;++k) {
56 jgs 150 if (in->pattern->index[k]==index) {
57     for (ic=0;ic<col_block_size;++ic) {
58     i_Sol=ic+col_block_size*l_col;
59     for (ir=0;ir<row_block_size;++ir) {
60     i_Equa=ir+row_block_size*l_row;
61     in->val[k*block_size+ir+row_block_size*ic]+=
62     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
63     }
64     }
65     break;
66     }
67     }
68     }
69     }
70 gross 416 }
71     }
72     } else {
73     for (k_Equa=0;k_Equa<NN_Equa;++k_Equa) {
74     j_Equa=Nodes_Equa[k_Equa];
75     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
76     iptr=j_Equa*num_subblocks_Equa+l_row;
77     for (k_Sol=0;k_Sol<NN_Sol;++k_Sol) {
78     j_Sol=Nodes_Sol[k_Sol];
79     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
80     index=j_Sol*num_subblocks_Sol+index_offset+l_col;
81     for (k=in->pattern->ptr[iptr]-index_offset;k<in->pattern->ptr[iptr+1]-index_offset;++k) {
82 jgs 150 if (in->pattern->index[k]==index) {
83     for (ic=0;ic<col_block_size;++ic) {
84     i_Sol=ic+col_block_size*l_col;
85     for (ir=0;ir<row_block_size;++ir) {
86     i_Equa=ir+row_block_size*l_row;
87     in->val[k*block_size+ir+row_block_size*ic]+=
88     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
89     }
90     }
91     break;
92     }
93     }
94     }
95     }
96 gross 416 }
97     }
98 jgs 150 }
99     }
100     /*
101     * $Log$
102     * Revision 1.2 2005/09/15 03:44:21 jgs
103     * Merge of development branch dev-02 back to main trunk on 2005-09-15
104     *
105     * Revision 1.1.2.1 2005/09/07 09:47:29 gross
106     * missing file
107     *
108     * Revision 1.6 2005/07/08 04:07:58 jgs
109     * Merge of development branch back to main trunk on 2005-07-08
110     *
111     * Revision 1.1.1.1.2.3 2005/06/29 02:34:56 gross
112     * some changes towards 64 integers in finley
113     *
114     * Revision 1.1.1.1.2.2 2005/03/15 07:23:55 gross
115     * 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.
116     *
117     * Revision 1.1.1.1.2.1 2004/11/12 06:58:19 gross
118     * 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
119     *
120     * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
121     * initial import of project esys2
122     *
123     * Revision 1.1 2004/07/02 04:21:13 gross
124     * Finley C code has been included
125     *
126     *
127     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26