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

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

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

revision 3093 by gross, Thu Apr 22 11:17:42 2010 UTC revision 3094 by gross, Fri Aug 13 08:38:06 2010 UTC
# Line 93  Paso_Pattern* Paso_Pattern_alloc(int typ Line 93  Paso_Pattern* Paso_Pattern_alloc(int typ
93        out->ptr=ptr;        out->ptr=ptr;
94        out->index=index;        out->index=index;
95        out->main_iptr = NULL;        out->main_iptr = NULL;
96          out->coloring = NULL;
97          out->numColors=-1;
98    
99        if (out->ptr == NULL) {        if (out->ptr == NULL) {
100            out->len=0;            out->len=0;
# Line 121  void Paso_Pattern_free(Paso_Pattern* in) Line 123  void Paso_Pattern_free(Paso_Pattern* in)
123          MEMFREE(in->ptr);          MEMFREE(in->ptr);
124          MEMFREE(in->index);          MEMFREE(in->index);
125      MEMFREE(in->main_iptr);      MEMFREE(in->main_iptr);
126        MEMFREE(in->coloring);
127          MEMFREE(in);          MEMFREE(in);
128       }       }
129     }     }
# Line 411  index_t* Paso_Pattern_borrowMainDiagonal Line 414  index_t* Paso_Pattern_borrowMainDiagonal
414       }       }
415       return A->main_iptr;       return A->main_iptr;
416  }  }
417    
418    dim_t Paso_Pattern_getNumColors(Paso_Pattern* A)
419    {
420       Paso_Pattern_borrowColoringPointer(A);  /* make sure numColors is defined */
421       return A->numColors;
422    }
423    index_t* Paso_Pattern_borrowColoringPointer(Paso_Pattern* A)
424    {
425       dim_t n=A->numInput;
426       /* is coloring available ? */
427       if (A->coloring == NULL) {
428          
429          A->coloring=MEMALLOC(n,index_t);
430          if ( ! Paso_checkPtr(A->coloring)) {
431         Paso_Pattern_color(A,&(A->numColors),A->coloring);
432         if (! Paso_noError()) {
433            MEMFREE(A->coloring);
434         }
435          }
436       }
437       return A->coloring;
438    }

Legend:
Removed from v.3093  
changed lines
  Added in v.3094

  ViewVC Help
Powered by ViewVC 1.1.26