36 |
/***************************************************************/ |
/***************************************************************/ |
37 |
|
|
38 |
#define IS_AVAILABLE -1 |
#define IS_AVAILABLE -1 |
39 |
#define IS_IN_SET -3 |
#define IS_IN_SET -3 /* Week connection */ |
40 |
#define IS_REMOVED -4 |
#define IS_REMOVED -4 /* strong */ |
41 |
|
|
42 |
void Paso_Pattern_coup(Paso_SparseMatrix* A, index_t* mis_marker, double threshold) { |
void Paso_Pattern_coup(Paso_SparseMatrix* A, index_t* mis_marker, double threshold) { |
43 |
|
|
44 |
dim_t i,j; |
dim_t i,j; |
45 |
/*double threshold=0.05;*/ |
/*double sum;*/ |
|
double sum; |
|
46 |
index_t iptr,*index,*where_p,*diagptr; |
index_t iptr,*index,*where_p,*diagptr; |
47 |
bool_t passed=FALSE; |
bool_t passed=FALSE; |
48 |
dim_t n=A->numRows; |
dim_t n=A->numRows; |
93 |
/*This loop cannot be parallelized, as order matters here.*/ |
/*This loop cannot be parallelized, as order matters here.*/ |
94 |
for (i=0;i<n;i++) { |
for (i=0;i<n;i++) { |
95 |
if (mis_marker[i]==IS_REMOVED) { |
if (mis_marker[i]==IS_REMOVED) { |
96 |
|
passed=TRUE; |
97 |
for (iptr=A->pattern->ptr[i];iptr<A->pattern->ptr[i+1]; ++iptr) { |
for (iptr=A->pattern->ptr[i];iptr<A->pattern->ptr[i+1]; ++iptr) { |
98 |
j=A->pattern->index[iptr]; |
j=A->pattern->index[iptr]; |
99 |
if (mis_marker[j]==IS_IN_SET) { |
if (mis_marker[j]==IS_IN_SET) { |
105 |
break; |
break; |
106 |
} |
} |
107 |
} |
} |
108 |
} |
} |
109 |
if (passed) { |
if (passed) mis_marker[i]=IS_IN_SET; |
|
mis_marker[i]=IS_IN_SET; |
|
|
passed=FALSE; |
|
|
} |
|
110 |
} |
} |
111 |
} |
} |
|
|
|
112 |
/* This check is to make sure we dont get some nusty rows which were not removed durring coarsening process.*/ |
/* This check is to make sure we dont get some nusty rows which were not removed durring coarsening process.*/ |
113 |
/* TODO: we have to mechanism that this does not happend at all, and get rid of this 'If'. */ |
/* TODO: we have to mechanism that this does not happend at all, and get rid of this 'If'. */ |
114 |
#pragma omp parallel for private(i,iptr,j,sum) schedule(static) |
/*#pragma omp parallel for private(i,iptr,j,sum) schedule(static) |
115 |
for (i=0;i<n;i++) { |
for (i=0;i<n;i++) { |
116 |
if (mis_marker[i]==IS_REMOVED) { |
if (mis_marker[i]==IS_REMOVED) { |
117 |
sum=0; |
sum=0; |
124 |
mis_marker[i]=IS_IN_SET; |
mis_marker[i]=IS_IN_SET; |
125 |
} |
} |
126 |
} |
} |
127 |
|
*/ |
128 |
|
|
129 |
/* swap to TRUE/FALSE in mis_marker */ |
/* swap to TRUE/FALSE in mis_marker */ |
130 |
#pragma omp parallel for private(i) schedule(static) |
#pragma omp parallel for private(i) schedule(static) |
179 |
if(A->val[iptr]<=threshold) { |
if(A->val[iptr]<=threshold) { |
180 |
if(j!=i) { |
if(j!=i) { |
181 |
Paso_IndexList_insertIndex(&(index_list[i]),j); |
Paso_IndexList_insertIndex(&(index_list[i]),j); |
182 |
|
Paso_IndexList_insertIndex(&(index_list[j]),i); |
183 |
} |
} |
184 |
} |
} |
185 |
} |
} |