Contents of /trunk/finley/src/ElementFile_createColoring.cpp

Revision 4425 - (show annotations)
Mon May 27 05:44:28 2013 UTC (6 years ago) by caltinay
File size: 3303 byte(s)
```svn server test and finley stuff.

```
 1 2 /***************************************************************************** 3 * 4 * Copyright (c) 2003-2013 by University of Queensland 5 6 * 7 * Primary Business: Queensland, Australia 8 * Licensed under the Open Software License version 3.0 9 10 * 11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 12 * Development since 2012 by School of Earth Sciences 13 * 14 *****************************************************************************/ 15 16 17 /**************************************************************************** 18 19 Finley: ElementFile 20 21 This routine tries to reduce the number of colours used to colour elements 22 in the Finley_ElementFile 'in'. 23 24 *****************************************************************************/ 25 26 #include "ElementFile.h" 27 #include "Util.h" 28 29 #include 30 31 void Finley_ElementFile_createColoring(Finley_ElementFile* in, dim_t numNodes, 32 index_t* degreeOfFreedom) 33 { 34 if (!in || in->numElements < 1) 35 return; 36 37 const int NN = in->numNodes; 38 const int min_id=Finley_Util_getMinInt(1, numNodes, degreeOfFreedom); 39 const int max_id=Finley_Util_getMaxInt(1, numNodes, degreeOfFreedom); 40 const int len=max_id-min_id+1; 41 42 // reset color vector 43 #pragma omp parallel for 44 for (int e=0; enumElements; e++) 45 in->Color[e]=-1; 46 47 int numUncoloredElements=in->numElements; 48 in->minColor=0; 49 in->maxColor=in->minColor-1; 50 while (numUncoloredElements>0) { 51 // initialize the mask marking nodes used by a color 52 std::vector maskDOF(len, -1); 53 numUncoloredElements=0; 54 55 // TODO: OMP 56 for (int e=0; enumElements; e++) { 57 if (in->Color[e] < 0) { 58 // find out if element e is independent from the elements 59 // already coloured: 60 bool independent = true; 61 for (int i=0; iNodes[INDEX2(i,e,NN)] < 0 || in->Nodes[INDEX2(i,e,NN)] >= numNodes) { 64 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)]); 65 exit(1); 66 } 67 if ((degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id) >= len || (degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id) < 0) { 68 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); 69 exit(1); 70 } 71 #endif 72 if (maskDOF[degreeOfFreedom[in->Nodes[INDEX2(i,e,NN)]]-min_id]>0) { 73 independent=false; 74 break; 75 } 76 } 77 // if e is independent a new color is assigned and the nodes 78 // are marked as being used 79 if (independent) { 80 for (int i=0; iNodes[INDEX2(i,e,NN)]]-min_id] = 1; 82 in->Color[e]=in->maxColor+1; 83 } else { 84 numUncoloredElements++; 85 } 86 } // if no colour yet 87 } // for all elements 88 in->maxColor++; 89 } // end of while loop 90 }

Properties

Name Value
svn:mergeinfo /branches/lapack2681/finley/src/ElementFile_createColoring.cpp:2682-2741 /branches/pasowrap/finley/src/ElementFile_createColoring.cpp:3661-3674 /branches/py3_attempt2/finley/src/ElementFile_createColoring.cpp:3871-3891 /branches/restext/finley/src/ElementFile_createColoring.cpp:2610-2624 /branches/ripleygmg_from_3668/finley/src/ElementFile_createColoring.cpp:3669-3791 /branches/stage3.0/finley/src/ElementFile_createColoring.cpp:2569-2590 /branches/symbolic_from_3470/finley/src/ElementFile_createColoring.cpp:3471-3974 /release/3.0/finley/src/ElementFile_createColoring.cpp:2591-2601 /trunk/finley/src/ElementFile_createColoring.cpp:4257-4344