22 |
triangle of the matrix is stored. */ |
triangle of the matrix is stored. */ |
23 |
|
|
24 |
void Finley_IndexList_insertElements(Finley_IndexList* index_list, Finley_ElementFile* elements, |
void Finley_IndexList_insertElements(Finley_IndexList* index_list, Finley_ElementFile* elements, |
25 |
int reduce_row_order, int packed_row_block_size, maybelong* row_Label, |
bool_t reduce_row_order, index_t* row_Label, |
26 |
int reduce_col_order, int packed_col_block_size, maybelong* col_Label, |
bool_t reduce_col_order, index_t* col_Label) { |
27 |
int symmetric, Finley_SystemMatrixType matType) { |
index_t color; |
28 |
maybelong e,kr,ir,kc,ic,NN_row,NN_col,i; |
dim_t e,kr,kc,NN_row,NN_col,i,icol,irow; |
|
Finley_IndexList * tmp_list; |
|
|
maybelong jr,jc,icol,irow,color; |
|
|
|
|
29 |
|
|
30 |
if (elements!=NULL) { |
if (elements!=NULL) { |
31 |
maybelong NN=elements->ReferenceElement->Type->numNodes; |
dim_t NN=elements->ReferenceElement->Type->numNodes; |
32 |
maybelong id[NN],*row_node,*col_node; |
index_t id[NN],*row_node,*col_node; |
33 |
for (i=0;i<NN;i++) id[i]=i; |
for (i=0;i<NN;i++) id[i]=i; |
34 |
if (reduce_col_order) { |
if (reduce_col_order) { |
35 |
col_node=elements->ReferenceElement->Type->linearNodes; |
col_node=elements->ReferenceElement->Type->linearNodes; |
45 |
row_node=id; |
row_node=id; |
46 |
NN_row=elements->ReferenceElement->Type->numNodes; |
NN_row=elements->ReferenceElement->Type->numNodes; |
47 |
} |
} |
48 |
|
for (color=elements->minColor;color<=elements->maxColor;color++) { |
49 |
#pragma omp parallel private(color) |
#pragma omp for private(e,irow,kr,kc,icol) schedule(static) |
50 |
{ |
for (e=0;e<elements->numElements;e++) { |
51 |
switch(matType) { |
if (elements->Color[e]==color) { |
52 |
case CSR: |
for (kr=0;kr<NN_row;kr++) { |
53 |
if (symmetric) { |
irow=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]]; |
54 |
for (color=0;color<elements->numColors;color++) { |
for (kc=0;kc<NN_col;kc++) { |
55 |
#pragma omp for private(e,kr,jr,kc,jc,ir,irow,ic,icol,tmp_list) schedule(static) |
icol=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]]; |
56 |
for (e=0;e<elements->numElements;e++) { |
Finley_IndexList_insertIndex(&(index_list[irow]),icol); |
|
if (elements->Color[e]==color) { |
|
|
for (kr=0;kr<NN_row;kr++) { |
|
|
jr=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]]; |
|
|
for (ir=0;ir<packed_row_block_size;ir++) { |
|
|
irow=ir+packed_row_block_size*jr; |
|
|
tmp_list=&(index_list[irow]); |
|
|
for (kc=0;kc<NN_col;kc++) { |
|
|
jc=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]]; |
|
|
for (ic=0;ic<packed_col_block_size;ic++) { |
|
|
icol=ic+packed_col_block_size*jc; |
|
|
if (irow<=icol) Finley_IndexList_insertIndex(tmp_list,icol); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
for (color=0;color<elements->numColors;color++) { |
|
|
#pragma omp for private(e,kr,jr,kc,jc,ir,irow,ic,icol,tmp_list) schedule(static) |
|
|
for (e=0;e<elements->numElements;e++) { |
|
|
if (elements->Color[e]==color) { |
|
|
for (kr=0;kr<NN_row;kr++) { |
|
|
jr=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]]; |
|
|
for (ir=0;ir<packed_row_block_size;ir++) { |
|
|
irow=ir+packed_row_block_size*jr; |
|
|
tmp_list=&(index_list[irow]); |
|
|
for (kc=0;kc<NN_col;kc++) { |
|
|
jc=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]]; |
|
|
for (ic=0;ic<packed_col_block_size;ic++) { icol=ic+packed_col_block_size*jc; |
|
|
Finley_IndexList_insertIndex(tmp_list,icol); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} /* if else */ |
|
|
break; |
|
|
case CSC: |
|
|
if (symmetric) { |
|
|
for (color=0;color<elements->numColors;color++) { |
|
|
#pragma omp for private (e,kr,jr,kc,jc,ir,irow,ic,icol,tmp_list) schedule(static) |
|
|
for (e=0;e<elements->numElements;e++) { |
|
|
if (elements->Color[e]==color) { |
|
|
for (kc=0;kc<NN_col;kc++) { |
|
|
jc=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]]; |
|
|
for (ic=0;ic<packed_col_block_size;ic++) { |
|
|
icol=ic+packed_col_block_size*jc; |
|
|
tmp_list=&(index_list[icol]); |
|
|
for (kr=0;kr<NN_row;kr++) { |
|
|
jr=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]]; |
|
|
for (ir=0;ir<packed_row_block_size;ir++) { |
|
|
irow=ir+packed_row_block_size*jr; |
|
|
if (irow<=icol) Finley_IndexList_insertIndex(tmp_list,irow); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
57 |
} |
} |
58 |
} |
} |
59 |
} |
} |
60 |
} else { |
} |
61 |
for (color=0;color<elements->numColors;color++) { |
} |
|
#pragma omp for private (e,kr,jr,kc,jc,ir,irow,ic,icol,tmp_list) schedule(static) |
|
|
for (e=0;e<elements->numElements;e++) { |
|
|
if (elements->Color[e]==color) { |
|
|
for (kc=0;kc<NN_col;kc++) { |
|
|
jc=col_Label[elements->Nodes[INDEX2(col_node[kc],e,NN)]]; |
|
|
for (ic=0;ic<packed_col_block_size;ic++) { |
|
|
icol=ic+packed_col_block_size*jc; |
|
|
tmp_list=&(index_list[icol]); |
|
|
for (kr=0;kr<NN_row;kr++) { |
|
|
jr=row_Label[elements->Nodes[INDEX2(row_node[kr],e,NN)]]; |
|
|
for (ir=0;ir<packed_row_block_size;ir++) { |
|
|
irow=ir+packed_row_block_size*jr; |
|
|
Finley_IndexList_insertIndex(tmp_list,irow); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} /* if else */ |
|
|
} /* switch matType */ |
|
|
} |
|
62 |
} |
} |
63 |
return; |
return; |
64 |
} |
} |
65 |
|
|
66 |
/* inserts row index row into the Finley_IndexList in if it does not exist */ |
/* inserts row index row into the Finley_IndexList in if it does not exist */ |
67 |
|
|
68 |
void Finley_IndexList_insertIndex(Finley_IndexList* in, maybelong index) { |
void Finley_IndexList_insertIndex(Finley_IndexList* in, index_t index) { |
69 |
int i; |
dim_t i; |
70 |
/* is index in in? */ |
/* is index in in? */ |
71 |
for (i=0;i<in->n;i++) { |
for (i=0;i<in->n;i++) { |
72 |
if (in->index[i]==index) return; |
if (in->index[i]==index) return; |
73 |
} |
} |
74 |
/* index could not be found */ |
/* index could not be found */ |
75 |
if (in->n==INDEXLIST_LENGTH) { |
if (in->n==INDEXLIST_LENGTH) { |
76 |
/* if in->index is full check the extension */ |
/* if in->index is full check the extension */ |
77 |
if (in->extension==NULL) { |
if (in->extension==NULL) { |
78 |
in->extension=(Finley_IndexList*) TMPMEMALLOC(sizeof(Finley_IndexList)); |
in->extension=TMPMEMALLOC(1,Finley_IndexList); |
79 |
if (Finley_checkPtr(in->extension)) return; |
if (Finley_checkPtr(in->extension)) return; |
80 |
in->extension->n=0; |
in->extension->n=0; |
81 |
in->extension->extension=NULL; |
in->extension->extension=NULL; |
90 |
|
|
91 |
/* counts the number of row indices in the Finley_IndexList in */ |
/* counts the number of row indices in the Finley_IndexList in */ |
92 |
|
|
93 |
int Finley_IndexList_count(Finley_IndexList* in) { |
dim_t Finley_IndexList_count(Finley_IndexList* in) { |
94 |
if (in==NULL) { |
if (in==NULL) { |
95 |
return 0; |
return 0; |
96 |
} else { |
} else { |
100 |
|
|
101 |
/* count the number of row indices in the Finley_IndexList in */ |
/* count the number of row indices in the Finley_IndexList in */ |
102 |
|
|
103 |
void Finley_IndexList_toArray(Finley_IndexList* in, maybelong* array) { |
void Finley_IndexList_toArray(Finley_IndexList* in, index_t* array) { |
104 |
int i; |
dim_t i; |
105 |
if (in!=NULL) { |
if (in!=NULL) { |
106 |
for (i=0;i<in->n;i++) array[i]=in->index[i]+INDEX_OFFSET; |
for (i=0;i<in->n;i++) array[i]=in->index[i]+INDEX_OFFSET; |
107 |
Finley_IndexList_toArray(in->extension,&(array[in->n])); |
Finley_IndexList_toArray(in->extension,&(array[in->n])); |
119 |
|
|
120 |
/* |
/* |
121 |
* $Log$ |
* $Log$ |
122 |
* Revision 1.3 2004/12/15 03:48:45 jgs |
* Revision 1.5 2005/07/08 04:07:51 jgs |
123 |
* *** empty log message *** |
* Merge of development branch back to main trunk on 2005-07-08 |
|
* |
|
|
* Revision 1.1.1.1 2004/10/26 06:53:57 jgs |
|
|
* initial import of project esys2 |
|
124 |
* |
* |
125 |
* Revision 1.1.2.2 2004/10/26 06:36:39 jgs |
* Revision 1.4 2004/12/15 07:08:32 jgs |
126 |
* committing Lutz's changes to branch jgs |
* *** empty log message *** |
127 |
|
* Revision 1.1.1.1.2.3 2005/06/29 02:34:50 gross |
128 |
|
* some changes towards 64 integers in finley |
129 |
* |
* |
130 |
* Revision 1.2 2004/10/13 01:53:42 gross |
* Revision 1.1.1.1.2.2 2004/11/24 01:37:13 gross |
131 |
* bug in CSC assembling fixed |
* some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now |
132 |
* |
* |
|
* Revision 1.1 2004/07/02 04:21:13 gross |
|
|
* Finley C code has been included |
|
133 |
* |
* |
134 |
* |
* |
135 |
*/ |
*/ |