/[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 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 11 months ago) by jgs
Original Path: trunk/finley/src/finleyC/Assemble_addToSystemMatrix.c
File MIME type: text/plain
File size: 5795 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

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     dim_t k_Equa,j_Equa,j_Sol,k_Sol,i_Equa,i_Sol,l_col,l_row,ic,ir,index,k,iptr;
41     dim_t row_block_size=in->row_block_size;
42     dim_t col_block_size=in->col_block_size;
43     dim_t block_size=in->block_size;
44     dim_t num_subblocks_Equa=num_Equa/row_block_size;
45     dim_t num_subblocks_Sol=num_Sol/col_block_size;
46    
47     if (in->type==CSR) {
48     for (k_Equa=0;k_Equa<NN_Equa;++k_Equa) {
49     j_Equa=Nodes_Equa[k_Equa];
50     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
51     iptr=j_Equa*num_subblocks_Equa+l_row;
52     for (k_Sol=0;k_Sol<NN_Sol;++k_Sol) {
53     j_Sol=Nodes_Sol[k_Sol];
54     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
55     index=j_Sol*num_subblocks_Sol+INDEX_OFFSET+l_col;
56     for (k=in->pattern->ptr[iptr]-PTR_OFFSET;k<in->pattern->ptr[iptr+1]-PTR_OFFSET;++k) {
57     if (in->pattern->index[k]==index) {
58     for (ic=0;ic<col_block_size;++ic) {
59     i_Sol=ic+col_block_size*l_col;
60     for (ir=0;ir<row_block_size;++ir) {
61     i_Equa=ir+row_block_size*l_row;
62     in->val[k*block_size+ir+row_block_size*ic]+=
63     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
64     }
65     }
66     break;
67     }
68     }
69     }
70     }
71     }
72     }
73     } else {
74     for (k_Sol=0;k_Sol<NN_Sol;k_Sol++) {
75     j_Sol=Nodes_Sol[k_Sol];
76     for (l_col=0;l_col<num_subblocks_Sol;++l_col) {
77     iptr=j_Sol*num_subblocks_Sol+l_col;
78     for (k_Equa=0;k_Equa<NN_Equa;k_Equa++) {
79     j_Equa=Nodes_Equa[k_Equa];
80     for (l_row=0;l_row<num_subblocks_Equa;++l_row) {
81     index=j_Equa*num_subblocks_Equa+INDEX_OFFSET+l_row;
82     for (k=in->pattern->ptr[iptr]-PTR_OFFSET;k<in->pattern->ptr[iptr+1]-PTR_OFFSET;++k) {
83     if (in->pattern->index[k]==index) {
84     for (ic=0;ic<col_block_size;++ic) {
85     i_Sol=ic+col_block_size*l_col;
86     for (ir=0;ir<row_block_size;++ir) {
87     i_Equa=ir+row_block_size*l_row;
88     in->val[k*block_size+ir+row_block_size*ic]+=
89     array[INDEX4(i_Equa,i_Sol,k_Equa,k_Sol,num_Equa,num_Sol,NN_Equa)];
90     }
91     }
92     break;
93     }
94     }
95     }
96     }
97     }
98     }
99     }
100     }
101     /*
102     * $Log$
103     * Revision 1.2 2005/09/15 03:44:21 jgs
104     * Merge of development branch dev-02 back to main trunk on 2005-09-15
105     *
106     * Revision 1.1.2.1 2005/09/07 09:47:29 gross
107     * missing file
108     *
109     * Revision 1.6 2005/07/08 04:07:58 jgs
110     * Merge of development branch back to main trunk on 2005-07-08
111     *
112     * Revision 1.1.1.1.2.3 2005/06/29 02:34:56 gross
113     * some changes towards 64 integers in finley
114     *
115     * Revision 1.1.1.1.2.2 2005/03/15 07:23:55 gross
116     * 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.
117     *
118     * Revision 1.1.1.1.2.1 2004/11/12 06:58:19 gross
119     * 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
120     *
121     * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
122     * initial import of project esys2
123     *
124     * Revision 1.1 2004/07/02 04:21:13 gross
125     * Finley C code has been included
126     *
127     *
128     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26