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

Contents of /trunk/esys2/finley/src/finleyC/SystemPattern_getSubpattern.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (show annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 9 months ago) by jgs
File MIME type: text/plain
File size: 3007 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* Finley: SystemMatrixPatternPattern */
6
7 /**************************************************************/
8
9 /* Copyrights by ACcESS Australia 2003, 2004, 2005 */
10 /* Author: gross@access.edu.au */
11
12 /**************************************************************/
13
14 #include "Finley.h"
15 #include "Common.h"
16 #include "Util.h"
17 #include "SystemPattern.h"
18
19 /**************************************************************/
20
21 /* creates SystemMatrixPattern */
22
23 Finley_SystemMatrixPattern* Finley_SystemMatrixPattern_getSubpattern(Finley_SystemMatrixPattern* pattern, \
24 int new_n_rows, index_t* row_list,index_t* new_col_index) {
25 Finley_SystemMatrixPattern*out=NULL;
26 index_t *ptr=NULL,*index=NULL,k,j,subpattern_row,tmp;
27 dim_t i;
28 Finley_ErrorCode=NO_ERROR;
29
30 ptr=MEMALLOC(new_n_rows+1,index_t);
31 if (! Finley_checkPtr(ptr)) {
32 #pragma omp parallel
33 {
34 #pragma omp for private(i) schedule(static)
35 for (i=0;i<new_n_rows+1;++i) ptr[i]=0;
36
37 /* find the number column entries in each row */
38 #pragma omp for private(i,k,j,subpattern_row) schedule(static)
39 for (i=0;i<new_n_rows;++i) {
40 j=0;
41 subpattern_row=row_list[i];
42 for (k=pattern->ptr[subpattern_row]-PTR_OFFSET;k<pattern->ptr[subpattern_row+1]-PTR_OFFSET;++k)
43 if (new_col_index[pattern->index[k]-INDEX_OFFSET]>-1) j++;
44 ptr[i]=j;
45 }
46 }
47 /* accummulate ptr */
48 ptr[new_n_rows]=Finley_Util_cumsum(new_n_rows,ptr);
49 index=MEMALLOC(ptr[new_n_rows],index_t);
50 if (Finley_checkPtr(index)) {
51 MEMFREE(ptr);
52 } else {
53 /* find the number column entries in each row */
54 #pragma omp parallel for private(i,k,j,subpattern_row,tmp) schedule(static)
55 for (i=0;i<new_n_rows;++i) {
56 j=ptr[i];
57 subpattern_row=row_list[i];
58 for (k=pattern->ptr[subpattern_row]-PTR_OFFSET;k<pattern->ptr[subpattern_row+1]-PTR_OFFSET;++k) {
59 tmp=new_col_index[pattern->index[k]-INDEX_OFFSET];
60 if (tmp>-1) {
61 index[j]=tmp;
62 ++j;
63 }
64 }
65 }
66 /* create return value */
67 out=Finley_SystemMatrixPattern_alloc(new_n_rows,ptr,index);
68 if (Finley_ErrorCode!=NO_ERROR) {
69 MEMFREE(index);
70 MEMFREE(ptr);
71 }
72 }
73 }
74 return out;
75 }
76 /*
77 * $Log$
78 * Revision 1.4 2005/07/08 04:07:57 jgs
79 * Merge of development branch back to main trunk on 2005-07-08
80 *
81 * Revision 1.1.2.3 2005/06/29 02:34:56 gross
82 * some changes towards 64 integers in finley
83 *
84 * Revision 1.1.2.2 2005/03/02 23:35:06 gross
85 * reimplementation of the ILU in Finley. block size>1 still needs some testing
86 *
87 * Revision 1.1.2.1 2005/02/18 02:27:31 gross
88 * two function that will be used for a reimplementation of the ILU preconditioner
89 *
90 *
91 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26