/[escript]/trunk/dudley/src/ElementFile_createColoring.c
ViewVC logotype

Diff of /trunk/dudley/src/ElementFile_createColoring.c

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

revision 1315 by ksteube, Tue Sep 25 02:41:13 2007 UTC revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC
# Line 43  void Finley_ElementFile_createColoring(F Line 43  void Finley_ElementFile_createColoring(F
43           #pragma omp parallel for private(e) schedule(static)           #pragma omp parallel for private(e) schedule(static)
44           for (e=0;e<in->numElements;e++) in->Color[e]=-1;           for (e=0;e<in->numElements;e++) in->Color[e]=-1;
45           numUncoloredElements=in->numElements;           numUncoloredElements=in->numElements;
46             in->minColor=0;
47             in->maxColor=in->minColor-1;
48           while (numUncoloredElements>0) {           while (numUncoloredElements>0) {
49              /* initialize the mask marking nodes used by a color */              /* initialize the mask marking nodes used by a color */
50              #pragma omp parallel for private(n) schedule(static)              #pragma omp parallel for private(n) schedule(static)
# Line 53  void Finley_ElementFile_createColoring(F Line 55  void Finley_ElementFile_createColoring(F
55                    if (in->Color[e]<0) {                    if (in->Color[e]<0) {
56                       /* find out if element e is independend from the elements already colored: */                       /* find out if element e is independend from the elements already colored: */
57                       independent=TRUE;                       independent=TRUE;
58                       for (i=0;i<NN;i++) if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) independent=FALSE;                       for (i=0;i<NN;i++) {
59    #ifdef BOUNDS_CHECK
60    if (in->Nodes[INDEX2(i,e,NN)] < 0 || in->Nodes[INDEX2(i,e,NN)] >= numNodes) { printf("BOUNDS_CHECK %s %d i=%d e=%d NN=%d min_id=%d in->Nodes[INDEX2...]=%d\n", __FILE__, __LINE__, i, e, NN, min_id, in->Nodes[INDEX2(i,e,NN)]); exit(1); }
61    if ((degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id) >= len || (degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id) < 0) { printf("BOUNDS_CHECK %s %d i=%d e=%d NN=%d min_id=%d dof=%d\n", __FILE__, __LINE__, i, e, NN, min_id, degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id); exit(1); }
62    #endif
63                    if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) {
64                                 independent=FALSE;
65                                 break;
66                            }
67                 }
68                       /* if e is independend a new color is assigned and the nodes are marked as being used */                       /* if e is independend a new color is assigned and the nodes are marked as being used */
69                       if (independent) {                       if (independent) {
70                           for (i=0;i<NN;i++) maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]=1;                             for (i=0;i<NN;i++) maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]=1;
71                           in->Color[e]=in->maxColor+1;                             in->Color[e]=in->maxColor+1;
72                        } else {                       } else {
73                           numUncoloredElements++;                               numUncoloredElements++;
74                        }                       }
75                    }                    }
76    
77              }              }
78              in->maxColor++;              in->maxColor++;
79           }  /* end of while loop */           }  /* end of while loop */

Legend:
Removed from v.1315  
changed lines
  Added in v.1388

  ViewVC Help
Powered by ViewVC 1.1.26