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

Diff of /trunk/paso/src/Pattern_coupling.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2449 by artak, Fri May 29 04:32:53 2009 UTC revision 2450 by artak, Tue Jun 2 01:22:11 2009 UTC
# Line 195  void Paso_Pattern_RS(Paso_SparseMatrix* Line 195  void Paso_Pattern_RS(Paso_SparseMatrix*
195       }       }
196      TMPMEMFREE(index_list);      TMPMEMFREE(index_list);
197    
198      Paso_Pattern_mis(out,mis_marker);      /*Paso_Pattern_mis(out,mis_marker);*/
199        Paso_Pattern_greedy(out,mis_marker);
200  }  }
201    
202  void Paso_Pattern_Aggregiation(Paso_SparseMatrix* A, index_t* mis_marker, double theta)  void Paso_Pattern_Aggregiation(Paso_SparseMatrix* A, index_t* mis_marker, double theta)
# Line 267  void Paso_Pattern_Aggregiation(Paso_Spar Line 268  void Paso_Pattern_Aggregiation(Paso_Spar
268      TMPMEMFREE(index_list);      TMPMEMFREE(index_list);
269      MEMFREE(diags);      MEMFREE(diags);
270            
271      Paso_Pattern_mis(out,mis_marker);      /*Paso_Pattern_mis(out,mis_marker);*/
272        Paso_Pattern_greedy(out,mis_marker);
273    
274  }  }
275    
276    /* Greedy algorithm */
277    void Paso_Pattern_greedy(Paso_Pattern* pattern, index_t* mis_marker) {
278    
279      dim_t i,j;
280      /*double sum;*/
281      index_t iptr;
282      bool_t passed=FALSE;
283      dim_t n=pattern->numOutput;
284    
285      if (pattern->type & PATTERN_FORMAT_SYM) {
286        Paso_setError(TYPE_ERROR,"Paso_Pattern_greedy: symmetric matrix pattern is not supported yet");
287        return;
288      }
289      
290       #pragma omp parallel for private(i) schedule(static)
291       for (i=0;i<n;++i)
292            if(mis_marker[i]==IS_AVAILABLE)
293                        mis_marker[i]=IS_IN_SET;
294    
295    
296        for (i=0;i<n;++i) {
297          if (mis_marker[i]==IS_IN_SET) {
298            for (iptr=pattern->ptr[i];iptr<pattern->ptr[i+1]; ++iptr) {
299                 j=pattern->index[iptr];
300                 mis_marker[j]=IS_REMOVED;
301            }
302          }
303        }
304        
305        
306        
307        for (i=0;i<n;i++) {
308            if (mis_marker[i]==IS_REMOVED) {
309               passed=TRUE;
310               for (iptr=pattern->ptr[i];iptr<pattern->ptr[i+1]; ++iptr) {
311                  j=pattern->index[iptr];
312                    if (mis_marker[j]==IS_REMOVED) {
313                        passed=TRUE;
314                    }
315                    else {
316                        passed=FALSE;
317                        break;
318                    }
319                  }
320               }
321               if (passed) mis_marker[i]=IS_IN_SET;
322            }
323    
324         /* swap to TRUE/FALSE in mis_marker */
325         #pragma omp parallel for private(i) schedule(static)
326         for (i=0;i<n;i++) mis_marker[i]=(mis_marker[i]!=IS_IN_SET);
327        
328    }
329    
330    
331    

Legend:
Removed from v.2449  
changed lines
  Added in v.2450

  ViewVC Help
Powered by ViewVC 1.1.26