13 #ifndef MESHCOLORIZER_HPP_
14 #define MESHCOLORIZER_HPP_
25 template<
class Gr
idType>
27 typedef std::vector<int> IntVec;
28 typedef std::vector<IntVec> IntMat;
57 int getStripDirection (
int nel1,
int nel2,
int nel3,
int parts)
59 int s1 = nel1 / parts;
60 int s2 = nel2 / parts;
61 int s3 = nel3 / parts;
62 int r1 = nel1 - s1*parts;
63 int r2 = nel2 - s2*parts;
64 int r3 = nel3 - s3*parts;
66 if (r1*nel2*nel3 < nel1*r2*nel3 && r1*nel2*nel3 < nel1*nel2*r3)
68 else if (nel1*r2*nel3 < r1*nel2*nel3 && nel1*r2*nel3 < nel1*nel2*r3)
70 else if (nel1*nel2*r3 < r1*nel2*nel3 && nel1*nel2*r3 < nel1*r2*nel3)
74 if (r1*nel2*nel3 > nel1*r2*nel3)
75 return nel2 > nel3 ? 1 : 2;
76 else if (nel1*r2*nel3 > nel1*nel2*r3)
77 return nel1 > nel3 ? 0 : 2;
78 else if (nel1*nel2*r3 > r1*nel2*nel3)
79 return nel1 > nel2 ? 0 : 1;
82 if (nel1 >= nel2 && nel1 >= nel3)
84 else if (nel2 >= nel1 && nel2 >= nel3)
MeshColorizer(const GridType &grid_)
Default constructor.
Definition: meshcolorizer.hpp:33
const IntMat & operator[](unsigned int i)
Return a color group.
Definition: meshcolorizer.hpp:41
Generate a coloring of a mesh suitable for threaded assembly. The mesh is assumed structured...
Definition: meshcolorizer.hpp:26
void calcGroups()
Calculate the coloring.