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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 117 - (show annotations)
Fri Apr 1 05:48:57 2005 UTC (15 years ago) by jgs
File MIME type: text/plain
File size: 2766 byte(s)
*** empty log message ***

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_unrollBlocks(Finley_SystemMatrixPattern* pattern, \
24 maybelong row_block_size,maybelong col_block_size) {
25 Finley_SystemMatrixPattern*out=NULL;
26 maybelong *ptr=NULL,*index=NULL;
27 maybelong i,k,j,l;
28 Finley_ErrorCode=NO_ERROR;
29 maybelong block_size=row_block_size*col_block_size;
30 maybelong new_n_ptr=(pattern->n_ptr)*row_block_size;
31 maybelong new_len=(pattern->len)*block_size;
32
33 ptr=MEMALLOC(new_n_ptr+1,maybelong);
34 index=MEMALLOC(new_len,maybelong);
35
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 #pragma omp for private(i,k) schedule(static)
47 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 #pragma omp for private(i,k) schedule(static)
51 for (i=0;i<new_n_ptr;++i)
52 for (k=ptr[i];k<ptr[i+1];++k) index[k]=0;
53
54 #pragma omp for private(i,j,k,l) schedule(static)
55 for (i=0;i<pattern->n_ptr;++i) {
56 for (l=pattern->ptr[i];l<pattern->ptr[i+1];++l) {
57 for (k=0;k<row_block_size;++k) {
58 for (j=0;j<col_block_size;++j) {
59 index[ptr[i*row_block_size+k]+(l-pattern->ptr[i])*col_block_size+j]=(pattern->index[l]-INDEX_OFFSET)*col_block_size+j;
60 }
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 * Revision 1.2 2005/04/01 05:48:56 jgs
77 * *** empty log message ***
78 *
79 * Revision 1.1.2.1 2005/03/15 07:23:55 gross
80 * 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.
81 *
82 *
83 *
84 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26