/[escript]/trunk/finley/src/ElementFile_improveColoring.c
ViewVC logotype

Diff of /trunk/finley/src/ElementFile_improveColoring.c

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

revision 123 by jgs, Fri Jul 8 04:08:13 2005 UTC revision 126 by jgs, Fri Jul 22 03:53:08 2005 UTC
# Line 47  void Finley_ElementFile_improveColoring( Line 47  void Finley_ElementFile_improveColoring(
47           in->minColor=0;           in->minColor=0;
48           numUncoloredElements=in->numElements;           numUncoloredElements=in->numElements;
49           while (numUncoloredElements>0) {           while (numUncoloredElements>0) {
50              #pragma omp parallel private(color)              /* initialize the mask marking nodes used by a color */
51              {              #pragma omp parallel for private(n) schedule(static)
52                 /* initialize the mask marking nodes used by a color */              for (n=0;n<len;n++) maskDOF[n]=-1;
53                 #pragma omp for private(n) schedule(static)              /* the existing coloring is used to make sure that the new coloring can be done in parallel */
54                 for (n=0;n<len;n++) maskDOF[n]=-1;              numUncoloredElements=0;
55                 /* the existing coloring is used to make sure that the new coloring can be done in parallel */              if ((old_maxColor-old_minColor+1)*NN<in->numElements) {
                #pragma omp master  
                numUncoloredElements=0;  
56                 for (color=old_minColor;color<=old_maxColor;color++) {                 for (color=old_minColor;color<=old_maxColor;color++) {
57                    #pragma omp for private(i,e,independent) schedule(static) reduction(+:numUncoloredElements)                    #pragma omp parallel for private(i,e,independent) schedule(static) reduction(+:numUncoloredElements)
58                    for (e=0;e<in->numElements;e++) {                    for (e=0;e<in->numElements;e++) {
59                       if (old_Color[e]==color) {                       if (old_Color[e]==color) {
60                          /* find out if element e is independend from the elements already colored: */                          /* find out if element e is independend from the elements already colored: */
# Line 73  void Finley_ElementFile_improveColoring( Line 71  void Finley_ElementFile_improveColoring(
71                       }                       }
72                    }                    }
73                 } /* end of color loop */                 } /* end of color loop */
74                 } else {
75                   for (e=0;e<in->numElements;e++) {
76                      if (old_Color[e]!=-1) {
77                         /* find out if element e is independend from the elements already colored: */
78                         independent=TRUE;
79                         for (i=0;i<NN;i++) if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) independent=FALSE;
80                         /* if e is independend a new color is assigned and the nodes are marked as being used */
81                         if (independent) {
82                             for (i=0;i<NN;i++) maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]=1;
83                             old_Color[e]=-1;
84                             in->Color[e]=in->maxColor+1;
85                          } else {
86                             numUncoloredElements++;
87                          }
88                      }
89                   }
90              }              }
91              in->maxColor++;              in->maxColor++;
92           }  /* end of while loop */           }  /* end of while loop */
# Line 85  void Finley_ElementFile_improveColoring( Line 99  void Finley_ElementFile_improveColoring(
99  }  }
100  /*  /*
101  * $Log$  * $Log$
102    * Revision 1.6  2005/07/22 03:53:07  jgs
103    * Merge of development branch back to main trunk on 2005-07-22
104    *
105  * Revision 1.5  2005/07/08 04:07:49  jgs  * Revision 1.5  2005/07/08 04:07:49  jgs
106  * Merge of development branch back to main trunk on 2005-07-08  * Merge of development branch back to main trunk on 2005-07-08
107  *  *
108  * Revision 1.4  2004/12/15 07:08:32  jgs  * Revision 1.4  2004/12/15 07:08:32  jgs
109  * *** empty log message ***  * *** empty log message ***
110    * Revision 1.1.1.1.2.3  2005/07/18 10:34:54  gross
111    * some informance improvements when reading meshes
112    *
113  * Revision 1.1.1.1.2.2  2005/06/29 02:34:49  gross  * Revision 1.1.1.1.2.2  2005/06/29 02:34:49  gross
114  * some changes towards 64 integers in finley  * some changes towards 64 integers in finley
115  *  *

Legend:
Removed from v.123  
changed lines
  Added in v.126

  ViewVC Help
Powered by ViewVC 1.1.26