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

Annotation of /trunk/esys2/finley/src/finleyC/SystemPattern_unrollBlocks.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: 3142 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 jgs 117 /* $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_unrollBlocks(Finley_SystemMatrixPattern* pattern, \
24 jgs 123 dim_t row_block_size,dim_t col_block_size) {
25 jgs 117 Finley_SystemMatrixPattern*out=NULL;
26 jgs 123 index_t *ptr=NULL,*index=NULL,iPtr;
27     dim_t i,j,k,l;
28 jgs 117 Finley_ErrorCode=NO_ERROR;
29 jgs 123 dim_t block_size=row_block_size*col_block_size;
30     dim_t new_n_ptr=(pattern->n_ptr)*row_block_size;
31     dim_t new_len=(pattern->len)*block_size;
32 jgs 117
33 jgs 123 ptr=MEMALLOC(new_n_ptr+1,index_t);
34     index=MEMALLOC(new_len,index_t);
35 jgs 117
36    
37     if (! ( Finley_checkPtr(ptr) || Finley_checkPtr(index) ) ) {
38     #pragma omp parallel
39     {
40     #pragma omp for private(i) schedule(static)
41     for (i=0;i<new_n_ptr+1;++i) ptr[i]=0;
42    
43     #pragma omp master
44     ptr[new_n_ptr]=new_len;
45    
46 jgs 123 #pragma omp for private(i,k) schedule(static)
47 jgs 117 for (i=0;i<pattern->n_ptr;++i)
48     for (k=0;k<row_block_size;++k) ptr[i*row_block_size+k]=(pattern->ptr[i]-PTR_OFFSET)*block_size+(pattern->ptr[i+1]-pattern->ptr[i])*col_block_size*k;
49    
50 jgs 123 #pragma omp for private(i,iPtr) schedule(static)
51 jgs 117 for (i=0;i<new_n_ptr;++i)
52 jgs 123 for (iPtr=ptr[i];iPtr<ptr[i+1];++iPtr) index[iPtr]=0;
53 jgs 117
54 jgs 123 #pragma omp for private(i,j,iPtr,k) schedule(static)
55 jgs 117 for (i=0;i<pattern->n_ptr;++i) {
56 jgs 123 for (iPtr=pattern->ptr[i];iPtr<pattern->ptr[i+1];++iPtr) {
57 jgs 117 for (k=0;k<row_block_size;++k) {
58     for (j=0;j<col_block_size;++j) {
59 jgs 123 index[ptr[i*row_block_size+k]+(iPtr-pattern->ptr[i])*col_block_size+j]=(pattern->index[iPtr]-INDEX_OFFSET)*col_block_size+j;
60 jgs 117 }
61     }
62     }
63     }
64     }
65     /* create return value */
66     out=Finley_SystemMatrixPattern_alloc(new_n_ptr,ptr,index);
67     }
68     if (Finley_ErrorCode!=NO_ERROR) {
69     MEMFREE(index);
70     MEMFREE(ptr);
71     }
72     return out;
73     }
74     /*
75     * $Log$
76 jgs 123 * Revision 1.3 2005/07/08 04:07:57 jgs
77     * Merge of development branch back to main trunk on 2005-07-08
78     *
79 jgs 117 * Revision 1.2 2005/04/01 05:48:56 jgs
80     * *** empty log message ***
81     *
82 jgs 123 * Revision 1.1.2.4 2005/07/01 07:02:13 gross
83     * some bug with OPENMP fixed
84     *
85     * Revision 1.1.2.3 2005/06/30 01:53:56 gross
86     * a bug in coloring fixed
87     *
88     * Revision 1.1.2.2 2005/06/29 02:34:56 gross
89     * some changes towards 64 integers in finley
90     *
91 jgs 117 * Revision 1.1.2.1 2005/03/15 07:23:55 gross
92     * 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.
93     *
94     *
95     *
96     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26