/[escript]/trunk/paso/src/SystemMatrixPattern_unrollBlocks.c
ViewVC logotype

Annotation of /trunk/paso/src/SystemMatrixPattern_unrollBlocks.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (hide annotations)
Thu Sep 15 03:44:45 2005 UTC (14 years, 5 months ago) by jgs
Original Path: trunk/esys2/paso/src/SystemMatrixPattern_unrollBlocks.c
File MIME type: text/plain
File size: 2754 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

1 jgs 150 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* Paso: SystemMatrixPatternPattern */
6    
7     /**************************************************************/
8    
9     /* Copyrights by ACcESS Australia 2003, 2004, 2005 */
10     /* Author: gross@access.edu.au */
11    
12     /**************************************************************/
13    
14     #include "Paso.h"
15     #include "SystemMatrixPattern.h"
16    
17     /**************************************************************/
18    
19     /* creates SystemMatrixPattern */
20    
21     Paso_SystemMatrixPattern* Paso_SystemMatrixPattern_unrollBlocks(Paso_SystemMatrixPattern* pattern, \
22     dim_t row_block_size,dim_t col_block_size) {
23     Paso_SystemMatrixPattern*out=NULL;
24     index_t *ptr=NULL,*index=NULL,iPtr;
25     dim_t i,j,k,l;
26     Paso_resetError();
27     dim_t block_size=row_block_size*col_block_size;
28     dim_t new_n_ptr=(pattern->n_ptr)*row_block_size;
29     dim_t new_len=(pattern->len)*block_size;
30    
31     ptr=MEMALLOC(new_n_ptr+1,index_t);
32     index=MEMALLOC(new_len,index_t);
33    
34    
35     if (! ( Paso_checkPtr(ptr) || Paso_checkPtr(index) ) ) {
36     #pragma omp parallel
37     {
38     #pragma omp for private(i) schedule(static)
39     for (i=0;i<new_n_ptr+1;++i) ptr[i]=0;
40    
41     #pragma omp master
42     ptr[new_n_ptr]=new_len;
43    
44     #pragma omp for private(i,k) schedule(static)
45     for (i=0;i<pattern->n_ptr;++i)
46     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;
47    
48     #pragma omp for private(i,iPtr) schedule(static)
49     for (i=0;i<new_n_ptr;++i)
50     for (iPtr=ptr[i];iPtr<ptr[i+1];++iPtr) index[iPtr]=0;
51    
52     #pragma omp for private(i,j,iPtr,k) schedule(static)
53     for (i=0;i<pattern->n_ptr;++i) {
54     for (iPtr=pattern->ptr[i];iPtr<pattern->ptr[i+1];++iPtr) {
55     for (k=0;k<row_block_size;++k) {
56     for (j=0;j<col_block_size;++j) {
57     index[ptr[i*row_block_size+k]+(iPtr-pattern->ptr[i])*col_block_size+j]=(pattern->index[iPtr]-INDEX_OFFSET)*col_block_size+j;
58     }
59     }
60     }
61     }
62     }
63     /* create return value */
64     out=Paso_SystemMatrixPattern_alloc(new_n_ptr,ptr,index);
65     }
66     if (! Paso_noError()) {
67     MEMFREE(index);
68     MEMFREE(ptr);
69     }
70     return out;
71     }
72     /*
73     * $Log$
74     * Revision 1.2 2005/09/15 03:44:39 jgs
75     * Merge of development branch dev-02 back to main trunk on 2005-09-15
76     *
77     * Revision 1.1.2.1 2005/09/05 06:29:47 gross
78     * These files have been extracted from finley to define a stand alone libray for iterative
79     * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
80     * has not been tested yet.
81     *
82     *
83     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26