/[escript]/branches/trilinos_from_5897/dudley/src/ElementFile_createColoring.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/ElementFile_createColoring.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 11 months ago) by caltinay
File size: 3581 byte(s)
Big commit - making dudley much more like finley to make it more
managable. Fixed quite a few issues that had been fixed in finley.
Disposed of all ReducedNode/ReducedDOF entities that dudley never supported.
Compiles and passes tests.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #include "ElementFile.h"
18 #include "Util.h"
19
20 namespace dudley {
21
22 void ElementFile::createColoring(dim_t nNodes, const index_t* degreeOfFreedom)
23 {
24 if (numElements < 1)
25 return;
26
27 //const std::pair<index_t,index_t> idRange(util::getMinMaxInt(
28 // 1, dofMap.size(), &dofMap[0]));
29 const std::pair<index_t,index_t> idRange(util::getMinMaxInt(
30 1, nNodes, degreeOfFreedom));
31
32 const dim_t NN = numNodes;
33 index_t min_id = idRange.first;
34 index_t max_id = idRange.second;
35 dim_t len = max_id - min_id + 1;
36 index_t* maskDOF = new index_t[len];
37 #pragma omp parallel for
38 for (index_t e = 0; e < numElements; e++)
39 Color[e] = -1;
40 dim_t numUncoloredElements = numElements;
41 minColor = 0;
42 maxColor = minColor - 1;
43 while (numUncoloredElements > 0) {
44 // initialize the mask marking nodes used by a color
45 #pragma omp parallel for
46 for (index_t n = 0; n < len; n++)
47 maskDOF[n] = -1;
48 numUncoloredElements = 0;
49 for (index_t e = 0; e < numElements; e++) {
50 if (Color[e] < 0) {
51 // find out if element e is independent from the elements
52 // already colored:
53 bool independent = true;
54 for (int i = 0; i < NN; i++) {
55 #ifdef BOUNDS_CHECK
56 if (Nodes[INDEX2(i, e, NN)] < 0 || Nodes[INDEX2(i, e, NN)] >= nNodes)
57 {
58 printf("BOUNDS_CHECK %s %d i=%d e=%d NN=%d min_id=%d Nodes[INDEX2...]=%d\n", __FILE__,
59 __LINE__, i, e, NN, min_id, Nodes[INDEX2(i, e, NN)]);
60 exit(1);
61 }
62 if ((degreeOfFreedom[Nodes[INDEX2(i, e, NN)]] - min_id) >= len
63 || (degreeOfFreedom[Nodes[INDEX2(i, e, NN)]] - min_id) < 0)
64 {
65 printf("BOUNDS_CHECK %s %d i=%d e=%d NN=%d min_id=%d dof=%d\n", __FILE__, __LINE__, i, e,
66 NN, min_id, degreeOfFreedom[Nodes[INDEX2(i, e, NN)]] - min_id);
67 exit(1);
68 }
69 #endif
70 if (maskDOF[degreeOfFreedom[Nodes[INDEX2(i, e, NN)]] - min_id] > 0)
71 {
72 independent = false;
73 break;
74 }
75 }
76 // if e is independent a new color is assigned and the nodes
77 // are marked as being used
78 if (independent) {
79 for (int i = 0; i < NN; i++)
80 maskDOF[degreeOfFreedom[Nodes[INDEX2(i, e, NN)]] - min_id] = 1;
81 Color[e] = maxColor + 1;
82 } else {
83 numUncoloredElements++;
84 }
85 }
86 } // for all elements
87 maxColor++;
88 } // end of while loop
89 delete[] maskDOF;
90 }
91
92 } // namespace dudley
93

Properties

Name Value
svn:mergeinfo /branches/4.0fordebian/dudley/src/ElementFile_createColoring.cpp:5567-5588 /branches/lapack2681/finley/src/ElementFile_createColoring.cpp:2682-2741 /branches/pasowrap/dudley/src/ElementFile_createColoring.cpp:3661-3674 /branches/py3_attempt2/dudley/src/ElementFile_createColoring.cpp:3871-3891 /branches/restext/finley/src/ElementFile_createColoring.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/ElementFile_createColoring.cpp:3669-3791 /branches/stage3.0/finley/src/ElementFile_createColoring.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/ElementFile_createColoring.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/ElementFile_createColoring.cpp:3517-3974 /release/3.0/finley/src/ElementFile_createColoring.cpp:2591-2601 /release/4.0/dudley/src/ElementFile_createColoring.cpp:5380-5406 /trunk/dudley/src/ElementFile_createColoring.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/ElementFile_createColoring.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26