1 #ifndef GfxTL__CELLSIZEDATATREESTRATEGY_HEADER__
2 #define GfxTL__CELLSIZEDATATREESTRATEGY_HEADER__
6 template<
class InheritedStrategyT,
class KernelT >
12 :
public InheritedStrategyT::CellData
29 template<
class BaseT >
31 :
public InheritedStrategyT::template
StrategyBase< BaseT >
40 typedef std::pair< HandleType, HandleType >
CellRange;
61 template<
class BaseTraversalT >
63 :
public BaseTraversalT
66 template<
class BaseTraversalT >
68 :
public BaseTraversalT
84 template<
class BuildInformationT >
90 template<
class BuildInformationT >
92 const BuildInformationT& parentInfo,
unsigned int childIdx,
93 BuildInformationT* bi)
const
95 Range(parent, parentInfo.Range(), childIdx, &bi->Range());
98 template<
class BuildInformationT >
101 cell->m_size = bi.Range().second - bi.Range().first;
104 template<
class BuildInformationT >
106 const BuildInformationT& parentInfo,
unsigned int childIdx,
107 const BuildInformationT& bi,
CellType* cell)
109 cell->m_size = bi.Range().second - bi.Range().first;
112 template<
class TraversalInformationT >
114 TraversalInformationT* ti)
const
119 template<
class TraversalInformationT >
121 const TraversalInformationT& pTi,
unsigned int childIdx,
122 TraversalInformationT* ti)
const
124 Range(parent, pTi.Range(), childIdx, &ti->Range());
129 r->first = KernelT::BeginHandle();
130 r->second = KernelT::EndHandle();
134 const CellRange& parentRange,
unsigned int child,
137 r->first = parentRange.first;
138 for (
unsigned int i = 0; i < child; ++i)
141 r->first += parent[i].m_size;
143 r->second = r->first + parent[child].m_size;
146 template<
class TraversalInformationT >
153 template<
class SplitterT,
class BuildInformationT >
155 const BuildInformationT& parentInfo,
CellType* left,
158 unsigned int sizes[2];
160 left->m_size = sizes[0];
161 right->m_size = sizes[1];
164 template<
class SplitterT,
class BuildInformationT >
166 const unsigned int numSplitters,
const CellType&,
167 const BuildInformationT& parentInfo,
CellType** cells)
169 unsigned int* sizes =
new unsigned int[1 << numSplitters];
170 SplitData(splitters, numSplitters, parentInfo.Range(),
172 unsigned int childCount = 0;
173 for (
unsigned int i = 0;
174 i < (unsigned)(1 << numSplitters); ++i)
178 cells[i]->m_size = sizes[i];
185 if (!cells[0] && childCount)
192 template<
class SplitterT >
194 const unsigned int numSplitters,
195 const CellRange& range,
unsigned int* sizes)
197 const unsigned int numChildren = 1 << numSplitters;
198 SplitData(splitters[0], range, &(sizes[0]),
199 &(sizes[numChildren >> 1]));
200 if (numSplitters == 1)
205 range.first + sizes[0]),
206 rightRange(leftRange.second, range.second);
207 SplitData(splitters + 1, numSplitters - 1, leftRange,
209 SplitData(splitters + 1, numSplitters - 1, rightRange,
210 sizes + (numChildren >> 1));
213 template<
class SplitterT >
215 const CellRange& range,
unsigned int* left,
unsigned int* right)
217 if (range.second - range.first == 0)
227 while (j <= k &&
split(at(Dereference(j))))
231 while (j < k && !
split(at(Dereference(k))))
246 *left = j - range.first;
247 *right = (range.second - range.first)
251 template<
class SplitterT >
255 if (
split(KernelT::back()))
269 KernelT::InsertBack(range.second - 1);