/[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 416 - (hide annotations)
Wed Jan 4 05:38:35 2006 UTC (13 years, 9 months ago) by gross
Original Path: trunk/finley/src/finley/Assemble_addToSystemMatrix.c
File MIME type: text/plain
File size: 5881 byte(s)
changes in Paso have been worked in
1 jgs 150 /*
2     ******************************************************************************
3     * *
4     * COPYRIGHT ACcESS 2003,2004,2005 - All Rights Reserved *
5     * *
6     * This software is the property of ACcESS. No part of this code *
7     * may be copied in any form or by any means without the expressed written *
8     * consent of ACcESS. Copying, use or modification of this software *
9     * by any unauthorised person is illegal unless that person has a software *
10     * license agreement with ACcESS. *
11     * *
12     ******************************************************************************
13     */
14     /**************************************************************/
15    
16     /* Finley: SystemMatrix and SystemVector */
17    
18     /* adds the matrix array[Equa,Sol,NN,NN] onto the matrix in. */
19     /* the rows/columns are given by */
20     /* i_Equa+Equa*Nodes_Equa[Nodes[j_Equa]] (i_Equa=0:Equa; j_Equa=0:NN_Equa). */
21     /* the routine has to be called from a parallel region */
22    
23     /* This routine assumes that in->Equa=in->Sol=1, i.e. */
24     /* array is fully packed. */
25     /* TODO: the case in->Equa!=1 */
26    
27     /**************************************************************/
28    
29     /* Author: gross@access.edu.au */
30     /* Version: $Id$ */
31    
32     /**************************************************************/
33    
34     #include "Assemble.h"
35    
36     /**************************************************************/
37    
38     void Finley_Assemble_addToSystemMatrix(Paso_SystemMatrix* in,dim_t NN_Equa,index_t* Nodes_Equa, dim_t num_Equa,
39     dim_t NN_Sol,index_t* Nodes_Sol, dim_t num_Sol, double* array) {
40 gross 416 index_t index_offset=(in->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
41 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;
42     dim_t row_block_size=in->row_block_size;
43     dim_t col_block_size=in->col_block_size;
44     dim_t block_size=in->block_size;
45     dim_t num_subblocks_Equa=num_Equa/row_block_size;
46     dim_t num_subblocks_Sol=num_Sol/col_block_size;
47    
48 gross 416 if (in->type & MATRIX_FORMAT_CSC) {
49     for (k_Sol=0;k_Sol<NN_Sol;k_Sol++) {
50     j_Sol=Nodes_Sol[k_Sol];
51     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
52     iptr=j_Sol*num_subblocks_Sol+l_col;
53     for (k_Equa=0;k_Equa<NN_Equa;k_Equa++) {
54     j_Equa=Nodes_Equa[k_Equa];
55     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
56     index=j_Equa*num_subblocks_Equa+index_offset+l_row;
57     for (k=in->pattern->ptr[iptr]-index_offset;k<in->pattern->ptr[iptr+1]-index_offset;++k) {
58 jgs 150 if (in->pattern->index[k]==index) {
59     for (ic=0;ic<col_block_size;++ic) {
60     i_Sol=ic+col_block_size*l_col;
61     for (ir=0;ir<row_block_size;++ir) {
62     i_Equa=ir+row_block_size*l_row;
63     in->val[k*block_size+ir+row_block_size*ic]+=
64     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
65     }
66     }
67     break;
68     }
69     }
70     }
71     }
72 gross 416 }
73     }
74     } else {
75     for (k_Equa=0;k_Equa<NN_Equa;++k_Equa) {
76     j_Equa=Nodes_Equa[k_Equa];
77     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
78     iptr=j_Equa*num_subblocks_Equa+l_row;
79     for (k_Sol=0;k_Sol<NN_Sol;++k_Sol) {
80     j_Sol=Nodes_Sol[k_Sol];
81     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
82     index=j_Sol*num_subblocks_Sol+index_offset+l_col;
83     for (k=in->pattern->ptr[iptr]-index_offset;k<in->pattern->ptr[iptr+1]-index_offset;++k) {
84 jgs 150 if (in->pattern->index[k]==index) {
85     for (ic=0;ic<col_block_size;++ic) {
86     i_Sol=ic+col_block_size*l_col;
87     for (ir=0;ir<row_block_size;++ir) {
88     i_Equa=ir+row_block_size*l_row;
89     in->val[k*block_size+ir+row_block_size*ic]+=
90     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
91     }
92     }
93     break;
94     }
95     }
96     }
97     }
98 gross 416 }
99     }
100 jgs 150 }
101     }
102     /*
103     * $Log$
104     * Revision 1.2 2005/09/15 03:44:21 jgs
105     * Merge of development branch dev-02 back to main trunk on 2005-09-15
106     *
107     * Revision 1.1.2.1 2005/09/07 09:47:29 gross
108     * missing file
109     *
110     * Revision 1.6 2005/07/08 04:07:58 jgs
111     * Merge of development branch back to main trunk on 2005-07-08
112     *
113     * Revision 1.1.1.1.2.3 2005/06/29 02:34:56 gross
114     * some changes towards 64 integers in finley
115     *
116     * Revision 1.1.1.1.2.2 2005/03/15 07:23:55 gross
117     * 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.
118     *
119     * Revision 1.1.1.1.2.1 2004/11/12 06:58:19 gross
120     * 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
121     *
122     * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
123     * initial import of project esys2
124     *
125     * Revision 1.1 2004/07/02 04:21:13 gross
126     * Finley C code has been included
127     *
128     *
129     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26