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) |
59 |
#ifdef BOUNDS_CHECK |
#ifdef BOUNDS_CHECK |
60 |
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); } |
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); } |
61 |
#endif |
#endif |
62 |
if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) independent=FALSE; |
if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) { |
63 |
|
independent=FALSE; |
64 |
|
break; |
65 |
|
} |
66 |
} |
} |
67 |
/* 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 */ |
68 |
if (independent) { |
if (independent) { |
69 |
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; |
70 |
in->Color[e]=in->maxColor+1; |
in->Color[e]=in->maxColor+1; |
71 |
} else { |
} else { |
72 |
numUncoloredElements++; |
numUncoloredElements++; |
73 |
} |
} |
74 |
} |
} |
75 |
} |
} |
76 |
in->maxColor++; |
in->maxColor++; |