00001
00008 #include "TreeNode.h"
00009 #include "indexHolder.h"
00010 #include "Sort.h"
00011 #include "dtypes.h"
00012 #include "odaUtils.h"
00013 #include "parUtils.h"
00014 #include "cnumEtypes.h"
00015 #include "dendro.h"
00016
00017 #ifdef __DEBUG__
00018 #ifndef __DEBUG_DA__
00019 #define __DEBUG_DA__
00020 #endif
00021 #endif
00022
00023 namespace ot {
00024
00025 inline unsigned int DA::curr() {
00026 #ifdef __DEBUG_DA__
00027 assert(m_bIamActive);
00028 #endif
00029 return m_uiCurrent;
00030 }
00031
00032 inline unsigned int DA::currWithInfo() {
00033 #ifdef __DEBUG_DA__
00034 assert(m_bIamActive);
00035 #endif
00036
00037 m_lcLoopInfo.currentOffset = m_ptCurrentOffset;
00038 m_lcLoopInfo.currentIndex = m_uiCurrent;
00039 m_lcLoopInfo.qCounter = m_uiQuotientCounter;
00040 m_lcLoopInfo.pgQcounter = m_uiPreGhostQuotientCnt;
00041 return m_uiCurrent;
00042 }
00043
00044 inline unsigned char DA::getFlag(unsigned int i) {
00045 #ifdef __DEBUG_DA__
00046 assert(m_bIamActive);
00047 #endif
00048 return m_ucpOctLevels[i] ;
00049 }
00050
00051 inline unsigned char DA::getLevel(unsigned int i) {
00052 #ifdef __DEBUG_DA__
00053 assert(m_bIamActive);
00054 #endif
00055 return(m_ucpOctLevels[i] & ot::TreeNode::MAX_LEVEL );
00056 }
00057
00058 inline bool DA::isNode(unsigned int i) {
00059 #ifdef __DEBUG_DA__
00060 assert(m_bIamActive);
00061 #endif
00062 return( m_ucpOctLevels[i] & ot::TreeNode::NODE);
00063 }
00064
00065 inline bool DA::isGhost(unsigned int i) {
00066 #ifdef __DEBUG_DA__
00067 assert(m_bIamActive);
00068 #endif
00069 return( ( i < m_uiElementBegin) || (i >= m_uiPostGhostBegin) );
00070 }
00071
00072 inline bool DA::isHanging(unsigned int i) {
00073 #ifdef __DEBUG_DA__
00074 assert(m_bIamActive);
00075 #endif
00076 return( m_ucpLutMasksPtr[(i<<1) + 1] );
00077 }
00078
00079 inline bool DA::computedLocalToGlobalElems() {
00080 return m_bComputedLocalToGlobalElems;
00081 }
00082
00083 inline bool DA::computedLocalToGlobal() {
00084 return m_bComputedLocalToGlobal;
00085 }
00086
00087 inline unsigned int DA::getDimension() {
00088 return m_uiDimension;
00089 }
00090
00091 inline unsigned int DA::getMaxDepth() {
00092 return m_uiMaxDepth;
00093 }
00094
00095 inline std::vector<ot::TreeNode> DA::getBlocks() {
00096 return m_tnBlocks;
00097 }
00098
00099 inline unsigned int DA::getNumBlocks() {
00100 return static_cast<unsigned int>(m_tnBlocks.size());
00101 }
00102
00103 inline std::vector<ot::TreeNode> DA::getMinAllBlocks() {
00104 return m_tnMinAllBlocks;
00105 }
00106
00107 inline bool DA::isLUTcompressed() {
00108 return m_bCompressLut;
00109 }
00110
00111 inline unsigned int DA::getLocalBufferSize() {
00112 return m_uiLocalBufferSize;
00113 }
00114
00115 inline unsigned int DA::getElementSize() {
00116 return m_uiElementSize;
00117 }
00118
00119 inline unsigned int DA::getPreGhostElementSize() {
00120 return m_uiPreGhostElementSize;
00121 }
00122
00123 inline unsigned int DA::getIndependentSize() {
00124 return m_uiIndependentElementSize;
00125 }
00126
00127 inline unsigned int DA::getGhostedNodeSize() {
00128 return (m_uiNodeSize + m_uiBoundaryNodeSize +
00129 m_uiPreGhostNodeSize + m_uiPreGhostBoundaryNodeSize +
00130 m_uiPostGhostNodeSize);
00131 }
00132
00133 inline unsigned int DA::getGhostedElementSize() {
00134 return m_uiElementSize + m_uiPreGhostElementSize;
00135 }
00136
00137 inline unsigned int DA::getInternalNodeSize() {
00138 return m_uiNodeSize;
00139 }
00140
00141 inline unsigned int DA::getNodeSize() {
00142 return (m_uiNodeSize + m_uiBoundaryNodeSize);
00143 }
00144
00145 inline unsigned int DA::getBoundaryNodeSize() {
00146 return m_uiBoundaryNodeSize;
00147 }
00148
00149 inline unsigned int DA::getInputSize() {
00150 return m_uiInputSize;
00151 }
00152
00153 inline unsigned int DA::getIdxElementBegin() {
00154 return m_uiElementBegin;
00155 }
00156
00157 inline unsigned int DA::getIdxElementEnd() {
00158 return m_uiElementEnd;
00159 }
00160
00161 inline unsigned int DA::getIdxPostGhostBegin() {
00162 return m_uiPostGhostBegin;
00163 }
00164
00165 inline bool DA::iAmActive() {
00166 return m_bIamActive;
00167 }
00168
00169 inline MPI_Comm DA::getComm() {
00170 return m_mpiCommAll;
00171 }
00172
00173 inline MPI_Comm DA::getCommActive() {
00174 return m_mpiCommActive;
00175 }
00176
00177 inline int DA::getNpesAll() {
00178 return m_iNpesAll;
00179 }
00180
00181 inline int DA::getNpesActive() {
00182 return m_iNpesActive;
00183 }
00184
00185 inline int DA::getRankAll() {
00186 return m_iRankAll;
00187 }
00188
00189 inline int DA::getRankActive() {
00190 return m_iRankActive;
00191 }
00192
00193 inline Point DA::getCurrentOffset() {
00194 #ifdef __DEBUG_DA__
00195 assert(m_bIamActive);
00196 #endif
00197 return m_ptCurrentOffset;
00198 }
00199
00200 inline Point DA::getGhostedOffset() {
00201 #ifdef __DEBUG_DA__
00202 assert(m_bIamActive);
00203 #endif
00204 return m_ptGhostedOffset;
00205 }
00206
00207 inline Point DA::getOffset() {
00208 #ifdef __DEBUG_DA__
00209 assert(m_bIamActive);
00210 #endif
00211 return m_ptOffset;
00212 }
00213
00214 inline DendroIntL* DA::getLocalToGlobalMap() {
00215 return m_dilpLocalToGlobal;
00216 }
00217
00218 inline DendroIntL* DA::getLocalToGlobalElemsMap() {
00219 return m_dilpLocalToGlobalElems;
00220 }
00221
00222
00223
00224
00225
00226
00227
00228 template<>
00229 inline unsigned int DA::next<ot::DA_FLAGS::ALL>() {
00230 #ifdef __DEBUG_DA__
00231 assert(m_bIamActive);
00232 #endif
00233 if ( m_uiElementBegin && (m_uiCurrent < (m_uiElementBegin - 1)) ) {
00234 incrementPreGhostOffset();
00235 } else {
00236 incrementCurrentOffset();
00237 }
00238 m_uiCurrent++;
00239
00240 while ( (m_uiCurrent < (m_uiPreGhostElementSize + m_uiElementSize)) &&
00241 ( m_ucpLutMasks[(2*m_uiCurrent) + 1] == ot::DA_FLAGS::FOREIGN) ) {
00242
00243 if(m_bCompressLut) {
00244 updateQuotientCounter();
00245 }
00246 if ( m_uiElementBegin && (m_uiCurrent < (m_uiElementBegin - 1)) ) {
00247 incrementPreGhostOffset();
00248 } else {
00249 incrementCurrentOffset();
00250 }
00251 m_uiCurrent++;
00252 }
00253
00254 return m_uiCurrent;
00255 }
00256
00257 template<>
00258 inline unsigned int DA::next<ot::DA_FLAGS::INDEPENDENT>() {
00259 #ifdef __DEBUG_DA__
00260 assert(m_bIamActive);
00261 #endif
00262 incrementCurrentOffset();
00263 m_uiCurrent++;
00264 while ( (m_uiCurrent < m_uiIndependentElementEnd) &&
00265 (m_ucpOctLevels[m_uiCurrent] & ot::DA_FLAGS::DEP_ELEM) ) {
00266
00267 if(m_bCompressLut) {
00268 updateQuotientCounter();
00269 }
00270 incrementCurrentOffset();
00271 m_uiCurrent++;
00272 }
00273 return m_uiCurrent;
00274 }
00275
00276 template<>
00277 inline unsigned int DA::next<ot::DA_FLAGS::DEPENDENT>() {
00278 #ifdef __DEBUG_DA__
00279 assert(m_bIamActive);
00280 #endif
00281 if ( m_uiElementBegin && (m_uiCurrent < (m_uiElementBegin - 1)) ) {
00282 incrementPreGhostOffset();
00283 } else {
00284 incrementCurrentOffset();
00285 }
00286 m_uiCurrent++;
00287
00288 while ( (m_uiCurrent < (m_uiPreGhostElementSize + m_uiElementSize)) &&
00289 ( (!(m_ucpOctLevels[m_uiCurrent] & ot::DA_FLAGS::DEP_ELEM )) ||
00290 ( m_ucpLutMasks[(2*m_uiCurrent) + 1] == ot::DA_FLAGS::FOREIGN) ) ) {
00291 if(m_bCompressLut) {
00292 updateQuotientCounter();
00293 }
00294 if ( m_uiElementBegin && (m_uiCurrent < (m_uiElementBegin - 1)) ) {
00295 incrementPreGhostOffset();
00296 } else {
00297 incrementCurrentOffset();
00298 }
00299 m_uiCurrent++;
00300 }
00301 return m_uiCurrent;
00302 }
00303
00304 template<>
00305 inline unsigned int DA::next<ot::DA_FLAGS::W_DEPENDENT>() {
00306 #ifdef __DEBUG_DA__
00307 assert(m_bIamActive);
00308 #endif
00309 incrementCurrentOffset();
00310 m_uiCurrent++;
00311 while ( (m_uiCurrent < (m_uiPreGhostElementSize + m_uiElementSize)) &&
00312 ( (!(m_ucpOctLevels[m_uiCurrent] & ot::DA_FLAGS::DEP_ELEM )) ||
00313 ( m_ucpLutMasks[(2*m_uiCurrent) + 1] == ot::DA_FLAGS::FOREIGN) ) ) {
00314
00315 if(m_bCompressLut) {
00316 updateQuotientCounter();
00317 }
00318 incrementCurrentOffset();
00319 m_uiCurrent++;
00320 }
00321 return m_uiCurrent;
00322 }
00323
00324 template<>
00325 inline unsigned int DA::next<ot::DA_FLAGS::WRITABLE>() {
00326 #ifdef __DEBUG_DA__
00327 assert(m_bIamActive);
00328 #endif
00329 incrementCurrentOffset();
00330 m_uiCurrent++;
00331 return m_uiCurrent;
00332 }
00333
00334
00335
00336 template<>
00337 inline void DA::init<ot::DA_FLAGS::ALL>() {
00338 #ifdef __DEBUG_DA__
00339 assert(m_bIamActive);
00340 #endif
00341 m_ptCurrentOffset = m_ptGhostedOffset;
00342 m_uiCurrent = 0;
00343 m_uiQuotientCounter = 0;
00344 m_uiPreGhostQuotientCnt= 0;
00345 if ( (m_uiCurrent < (m_uiPreGhostElementSize + m_uiElementSize))
00346 && ( m_ucpLutMasks[(2*m_uiCurrent) + 1] == ot::DA_FLAGS::FOREIGN) ) {
00347 if(m_bCompressLut) {
00348 updateQuotientCounter();
00349 }
00350 next<ot::DA_FLAGS::ALL>();
00351 }
00352 }
00353
00354 template<>
00355 inline void DA::init<ot::DA_FLAGS::INDEPENDENT>() {
00356 #ifdef __DEBUG_DA__
00357 assert(m_bIamActive);
00358 #endif
00359 m_ptCurrentOffset = m_ptIndependentOffset;
00360 m_uiCurrent = m_uiIndependentElementBegin;
00361 m_uiQuotientCounter = m_uiIndependentElementQuotient;
00362 m_uiPreGhostQuotientCnt = static_cast<unsigned int>(m_ptsPreGhostOffsets.size());
00363 }
00364
00365 template<>
00366 inline void DA::init<ot::DA_FLAGS::DEPENDENT>() {
00367 #ifdef __DEBUG_DA__
00368 assert(m_bIamActive);
00369 #endif
00370 m_ptCurrentOffset = m_ptGhostedOffset;
00371 m_uiCurrent = 0;
00372 m_uiQuotientCounter = 0;
00373 m_uiPreGhostQuotientCnt= 0;
00374
00375 if (m_iNpesActive==1) {
00376 m_uiCurrent = m_uiPreGhostElementSize + m_uiElementSize;
00377 }else {
00378 if ( (m_uiCurrent < (m_uiPreGhostElementSize + m_uiElementSize) ) &&
00379 ( ( m_ucpLutMasks[(2*m_uiCurrent) + 1] == ot::DA_FLAGS::FOREIGN) ||
00380 (!(m_ucpOctLevels[m_uiCurrent] & ot::DA_FLAGS::DEP_ELEM)) ) ) {
00381 if(m_bCompressLut) {
00382 updateQuotientCounter();
00383 }
00384 next<ot::DA_FLAGS::DEPENDENT>();
00385 }
00386 }
00387 }
00388
00389 template<>
00390 inline void DA::init<ot::DA_FLAGS::WRITABLE>() {
00391 #ifdef __DEBUG_DA__
00392 assert(m_bIamActive);
00393 #endif
00394 m_ptCurrentOffset = m_ptOffset;
00395 m_uiCurrent = m_uiElementBegin;
00396 m_uiQuotientCounter = m_uiElementQuotient;
00397 m_uiPreGhostQuotientCnt = m_ptsPreGhostOffsets.size();
00398 }
00399
00400 template<>
00401 inline void DA::init<ot::DA_FLAGS::FROM_STORED>() {
00402 #ifdef __DEBUG_DA__
00403 assert(m_bIamActive);
00404 #endif
00405
00406 m_ptCurrentOffset = m_lcLoopInfo.currentOffset;
00407 m_uiCurrent = m_lcLoopInfo.currentIndex;
00408 m_uiQuotientCounter = m_lcLoopInfo.qCounter;
00409 m_uiPreGhostQuotientCnt = m_lcLoopInfo.pgQcounter;
00410 }
00411
00412 template<>
00413 inline void DA::init<ot::DA_FLAGS::W_DEPENDENT>() {
00414 #ifdef __DEBUG_DA__
00415 assert(m_bIamActive);
00416 #endif
00417 m_ptCurrentOffset = m_ptOffset;
00418 m_uiCurrent = m_uiElementBegin;
00419 m_uiQuotientCounter = m_uiElementQuotient;
00420 m_uiPreGhostQuotientCnt = m_ptsPreGhostOffsets.size();
00421
00422 if (m_iNpesActive==1) {
00423 m_uiCurrent = m_uiPreGhostElementSize + m_uiElementSize;
00424 }else {
00425 if ( (m_uiCurrent < (m_uiPreGhostElementSize + m_uiElementSize) ) &&
00426 ( ( m_ucpLutMasks[(2*m_uiCurrent) + 1] == ot::DA_FLAGS::FOREIGN) ||
00427 (!(m_ucpOctLevels[m_uiCurrent] & ot::DA_FLAGS::DEP_ELEM)) ) ) {
00428 if(m_bCompressLut) {
00429 updateQuotientCounter();
00430 }
00431 next<ot::DA_FLAGS::W_DEPENDENT>();
00432 }
00433 }
00434 }
00435
00436
00437 template<>
00438 inline unsigned int DA::end<ot::DA_FLAGS::ALL>() {
00439 #ifdef __DEBUG_DA__
00440 assert(m_bIamActive);
00441 #endif
00442 return (m_uiPreGhostElementSize + m_uiElementSize);
00443 }
00444
00445 template<>
00446 inline unsigned int DA::end<ot::DA_FLAGS::DEPENDENT>() {
00447 #ifdef __DEBUG_DA__
00448 assert(m_bIamActive);
00449 #endif
00450 return (m_uiPreGhostElementSize + m_uiElementSize);
00451 }
00452
00453 template<>
00454 inline unsigned int DA::end<ot::DA_FLAGS::WRITABLE>() {
00455 #ifdef __DEBUG_DA__
00456 assert(m_bIamActive);
00457 #endif
00458 return (m_uiPreGhostElementSize + m_uiElementSize);
00459 }
00460
00461 template<>
00462 inline unsigned int DA::end<ot::DA_FLAGS::W_DEPENDENT>() {
00463 #ifdef __DEBUG_DA__
00464 assert(m_bIamActive);
00465 #endif
00466 return (m_uiPreGhostElementSize + m_uiElementSize);
00467 }
00468
00469 template<>
00470 inline unsigned int DA::end<ot::DA_FLAGS::INDEPENDENT>() {
00471 #ifdef __DEBUG_DA__
00472 assert(m_bIamActive);
00473 #endif
00474 return m_uiIndependentElementEnd;
00475 }
00476
00477
00478
00479 template <typename T>
00480 int DA::ReadFromGhostsBegin ( T* arr, unsigned int dof) {
00481 PROF_READ_GHOST_NODES_BEGIN_BEGIN
00482
00483
00484 T* sendK = NULL;
00485 if(m_uipScatterMap.size()) {
00486 sendK = new T[dof*m_uipScatterMap.size()];
00487 }
00488 for (unsigned int i = 0; i < m_uipScatterMap.size(); i++ ) {
00489
00490 for (unsigned int j = 0; j < dof; j++) {
00491 sendK[dof*i + j] = arr[dof*m_uipScatterMap[i]+j];
00492 }
00493 }
00494
00495
00496 updateContext ctx;
00497 ctx.buffer = arr;
00498 ctx.keys = sendK;
00499
00500
00501 for (unsigned int i = 0; i < m_uipRecvProcs.size(); i++) {
00502 MPI_Request *req = new MPI_Request();
00503 par::Mpi_Irecv<T>(arr + dof*m_uipRecvOffsets[i], dof*m_uipRecvCounts[i],
00504 m_uipRecvProcs[i], m_uiCommTag, m_mpiCommActive, req );
00505 ctx.requests.push_back(req);
00506 }
00507
00508
00509 for (unsigned int i = 0; i < m_uipSendProcs.size(); i++) {
00510 MPI_Request *req = new MPI_Request();
00511 par::Mpi_Issend<T>( sendK + dof*m_uipSendOffsets[i], dof*m_uipSendCounts[i],
00512 m_uipSendProcs[i], m_uiCommTag, m_mpiCommActive, req );
00513 ctx.requests.push_back(req);
00514 }
00515
00516
00517 m_uiCommTag++;
00518
00519 m_mpiContexts.push_back(ctx);
00520
00521 PROF_READ_GHOST_NODES_BEGIN_END
00522 }
00523
00524 template <typename T>
00525 int DA::ReadFromGhostsEnd(T* arr) {
00526 PROF_READ_GHOST_NODES_END_BEGIN
00527
00528
00529 unsigned int ctx;
00530 for ( ctx = 0; ctx < m_mpiContexts.size(); ctx++) {
00531 if ( m_mpiContexts[ctx].buffer == arr) {
00532 break;
00533 }
00534 }
00535
00536 MPI_Status status;
00537
00538 for (unsigned int i = 0; i < m_mpiContexts[ctx].requests.size(); i++) {
00539 MPI_Wait(m_mpiContexts[ctx].requests[i], &status);
00540 delete m_mpiContexts[ctx].requests[i];
00541 }
00542
00543
00544 T *sendK = static_cast<T *>(m_mpiContexts[ctx].keys);
00545
00546 if(sendK) {
00547 delete [] sendK;
00548 sendK = NULL;
00549 }
00550
00551
00552 assert(ctx < m_mpiContexts.size());
00553 m_mpiContexts[ctx].requests.clear();
00554
00555
00556 m_mpiContexts.erase(m_mpiContexts.begin() + ctx);
00557
00558 PROF_READ_GHOST_NODES_END_END
00559 }
00560
00561
00562 template <typename T>
00563 int DA::WriteToGhostsBegin ( T* arr, unsigned int dof) {
00564 PROF_WRITE_GHOST_NODES_BEGIN_BEGIN
00565
00566
00567 T* recvK = NULL;
00568 if(m_uipScatterMap.size()) {
00569 recvK = new T[dof*m_uipScatterMap.size()];
00570 }
00571
00572
00573 updateContext ctx;
00574 ctx.buffer = arr;
00575 ctx.keys = recvK;
00576
00577
00578 for (unsigned int i = 0; i < m_uipSendProcs.size(); i++) {
00579 MPI_Request *req = new MPI_Request();
00580 par::Mpi_Irecv<T>( recvK + dof*m_uipSendOffsets[i], dof*m_uipSendCounts[i],
00581 m_uipSendProcs[i], m_uiCommTag, m_mpiCommActive, req );
00582 ctx.requests.push_back(req);
00583 }
00584
00585
00586
00587 for (unsigned int i = 0; i < m_uipRecvProcs.size(); i++) {
00588 MPI_Request *req = new MPI_Request();
00589 par::Mpi_Issend<T>( arr + dof*m_uipRecvOffsets[i], dof*m_uipRecvCounts[i],
00590 m_uipRecvProcs[i], m_uiCommTag, m_mpiCommActive, req );
00591 ctx.requests.push_back(req);
00592 }
00593
00594
00595 m_uiCommTag++;
00596
00597 m_mpiContexts.push_back(ctx);
00598
00599 PROF_WRITE_GHOST_NODES_BEGIN_END
00600 }
00601
00602 template <typename T>
00603 int DA::WriteToGhostsEnd(T* arr, unsigned int dof) {
00604 PROF_WRITE_GHOST_NODES_END_BEGIN
00605
00606
00607 unsigned int ctx;
00608 for ( ctx = 0; ctx < m_mpiContexts.size(); ctx++) {
00609 if ( m_mpiContexts[ctx].buffer == arr) {
00610 break;
00611 }
00612 }
00613
00614 MPI_Status status;
00615
00616 for (unsigned int i = 0; i < m_mpiContexts[ctx].requests.size(); i++) {
00617 MPI_Wait(m_mpiContexts[ctx].requests[i], &status);
00618 delete m_mpiContexts[ctx].requests[i];
00619 }
00620
00621
00622 T *recvK = static_cast<T *>(m_mpiContexts[ctx].keys);
00623 for (unsigned int i=0; i<m_uipScatterMap.size(); i++ ) {
00624 for (unsigned int j=0; j<dof; j++) {
00625 arr[dof*m_uipScatterMap[i]+j] += recvK[dof*i + j];
00626 }
00627 }
00628
00629
00630 if(recvK) {
00631 delete [] recvK;
00632 recvK = NULL;
00633 }
00634
00635
00636 assert(ctx < m_mpiContexts.size());
00637 m_mpiContexts[ctx].requests.clear();
00638
00639
00640 m_mpiContexts.erase(m_mpiContexts.begin() + ctx);
00641
00642 PROF_WRITE_GHOST_NODES_END_END
00643 }
00644
00645
00646
00647 template <typename T>
00648 int DA::ReadFromGhostElemsBegin ( T* arr, unsigned int dof) {
00649 PROF_READ_GHOST_ELEMS_BEGIN_BEGIN
00650
00651
00652 T* sendK = NULL;
00653
00654 if(m_uipElemScatterMap.size()) {
00655 sendK = new T[dof*m_uipElemScatterMap.size()];
00656 }
00657
00658 for (unsigned int i = 0; i < m_uipElemScatterMap.size(); i++ ) {
00659
00660 for (unsigned int j = 0; j < dof; j++) {
00661 sendK[dof*i + j] = arr[dof*m_uipElemScatterMap[i]+j];
00662 }
00663 }
00664
00665
00666 updateContext ctx;
00667 ctx.buffer = arr;
00668 ctx.keys = sendK;
00669
00670
00671 for (unsigned int i = 0; i < m_uipElemRecvProcs.size(); i++) {
00672 MPI_Request *req = new MPI_Request();
00673 par::Mpi_Irecv<T>( arr + dof*m_uipElemRecvOffsets[i], dof*m_uipElemRecvCounts[i],
00674 m_uipElemRecvProcs[i], m_uiCommTag, m_mpiCommActive, req );
00675 ctx.requests.push_back(req);
00676 }
00677
00678
00679 for (unsigned int i = 0; i < m_uipElemSendProcs.size(); i++) {
00680 MPI_Request *req = new MPI_Request();
00681 par::Mpi_Issend<T>( sendK + dof*m_uipElemSendOffsets[i], dof*m_uipElemSendCounts[i],
00682 m_uipElemSendProcs[i], m_uiCommTag, m_mpiCommActive, req );
00683 ctx.requests.push_back(req);
00684 }
00685
00686
00687 m_uiCommTag++;
00688
00689 m_mpiContexts.push_back(ctx);
00690
00691 PROF_READ_GHOST_ELEMS_BEGIN_END
00692 }
00693
00694 template <typename T>
00695 int DA::ReadFromGhostElemsEnd(T* arr) {
00696 PROF_READ_GHOST_ELEMS_END_BEGIN
00697
00698
00699 unsigned int ctx;
00700 for ( ctx = 0; ctx < m_mpiContexts.size(); ctx++) {
00701 if ( m_mpiContexts[ctx].buffer == arr) {
00702 break;
00703 }
00704 }
00705
00706 MPI_Status status;
00707
00708 for (unsigned int i = 0; i < m_mpiContexts[ctx].requests.size(); i++) {
00709 MPI_Wait(m_mpiContexts[ctx].requests[i], &status);
00710 delete m_mpiContexts[ctx].requests[i];
00711 }
00712
00713
00714 T *sendK = static_cast<T *>(m_mpiContexts[ctx].keys);
00715
00716 if(sendK) {
00717 delete [] sendK;
00718 sendK = NULL;
00719 }
00720
00721
00722 assert(ctx < m_mpiContexts.size());
00723 m_mpiContexts[ctx].requests.clear();
00724
00725
00726 m_mpiContexts.erase(m_mpiContexts.begin() + ctx);
00727
00728 PROF_READ_GHOST_ELEMS_END_END
00729 }
00730
00731
00732 template <typename T>
00733 int DA::WriteToGhostElemsBegin ( T* arr, unsigned int dof) {
00734
00735 PROF_WRITE_GHOST_ELEMS_BEGIN_BEGIN
00736
00737
00738 T* recvK = NULL;
00739 if(m_uipElemScatterMap.size()) {
00740 recvK = new T[dof*m_uipElemScatterMap.size()];
00741 }
00742
00743
00744 updateContext ctx;
00745 ctx.buffer = arr;
00746 ctx.keys = recvK;
00747
00748
00749 for (unsigned int i = 0; i < m_uipElemSendProcs.size(); i++) {
00750 MPI_Request *req = new MPI_Request();
00751 par::Mpi_Irecv<T>( recvK + dof*m_uipElemSendOffsets[i], dof*m_uipElemSendCounts[i],
00752 m_uipElemSendProcs[i], m_uiCommTag, m_mpiCommActive, req );
00753 ctx.requests.push_back(req);
00754 }
00755
00756
00757
00758 for (unsigned int i = 0; i < m_uipElemRecvProcs.size(); i++) {
00759 MPI_Request *req = new MPI_Request();
00760 par::Mpi_Issend<T>( arr + dof*m_uipElemRecvOffsets[i], dof*m_uipElemRecvCounts[i],
00761 m_uipElemRecvProcs[i], m_uiCommTag, m_mpiCommActive, req );
00762 ctx.requests.push_back(req);
00763 }
00764
00765
00766 m_uiCommTag++;
00767
00768 m_mpiContexts.push_back(ctx);
00769
00770 PROF_WRITE_GHOST_ELEMS_BEGIN_END
00771 }
00772
00773 template <typename T>
00774 int DA::WriteToGhostElemsEnd(T* arr, unsigned int dof) {
00775
00776 PROF_WRITE_GHOST_ELEMS_END_BEGIN
00777
00778
00779 unsigned int ctx;
00780 for ( ctx = 0; ctx < m_mpiContexts.size(); ctx++) {
00781 if ( m_mpiContexts[ctx].buffer == arr) {
00782 break;
00783 }
00784 }
00785
00786 MPI_Status status;
00787
00788 for (unsigned int i = 0; i < m_mpiContexts[ctx].requests.size(); i++) {
00789 MPI_Wait(m_mpiContexts[ctx].requests[i], &status);
00790 delete m_mpiContexts[ctx].requests[i];
00791 }
00792
00793
00794 T *recvK = static_cast<T *>(m_mpiContexts[ctx].keys);
00795 for (unsigned int i = 0; i < m_uipElemScatterMap.size(); i++ ) {
00796 for (unsigned int j = 0; j < dof; j++) {
00797 arr[dof*m_uipElemScatterMap[i]+j] += recvK[dof*i + j];
00798 }
00799 }
00800
00801
00802 if(recvK) {
00803 delete [] recvK;
00804 recvK = NULL;
00805 }
00806
00807
00808 assert(ctx < m_mpiContexts.size());
00809 m_mpiContexts[ctx].requests.clear();
00810
00811
00812 m_mpiContexts.erase(m_mpiContexts.begin() + ctx);
00813
00814 PROF_WRITE_GHOST_ELEMS_END_END
00815 }
00816
00817
00818 template <typename T>
00819 int DA::createVector(std::vector<T> &arr, bool isElemental,
00820 bool isGhosted, unsigned int dof) {
00821
00822 unsigned int sz = 0;
00823 if(m_bIamActive) {
00824 if (isElemental) {
00825 sz = m_uiElementSize;
00826 if (isGhosted) {
00827 sz += m_uiPreGhostElementSize;
00828 }
00829 } else {
00830 sz = m_uiNodeSize + m_uiBoundaryNodeSize;
00831 if (isGhosted) {
00832 sz += (m_uiPreGhostNodeSize + m_uiPreGhostBoundaryNodeSize + m_uiPostGhostNodeSize);
00833 }
00834 }
00835
00836 sz *= dof;
00837 }
00838
00839
00840 arr.resize(sz);
00841
00842 return 0;
00843 }
00844
00845 template < typename T >
00846 int DA::vecGetBuffer(std::vector<T> &in, T* &out, bool isElemental,
00847 bool isGhosted, bool isReadOnly, unsigned int dof) {
00848
00849
00850
00851 unsigned int sz = 0;
00852 if(m_bIamActive) {
00853 if (isElemental) {
00854 sz = m_uiElementSize;
00855 if (isGhosted) {
00856 sz += m_uiPreGhostElementSize;
00857 }
00858 } else {
00859 sz = m_uiNodeSize + m_uiBoundaryNodeSize;
00860 if (isGhosted) {
00861 sz += (m_uiPreGhostNodeSize + m_uiPreGhostBoundaryNodeSize + m_uiPostGhostNodeSize);
00862 }
00863 }
00864
00865 sz *= dof;
00866 }
00867
00868 unsigned int vecSz = static_cast<unsigned int>(in.size());
00869
00870 if ( sz != vecSz) {
00871 std::cerr << "In function " << __func__ << " sizes are unequal, sz is " << sz
00872 << " and vecSz is " << vecSz << std::endl;
00873 assert(false);
00874 return -1;
00875 };
00876
00877 if(!m_bIamActive) {
00878 assert(m_uiLocalBufferSize == 0);
00879 assert(m_uiElementBegin == 0);
00880 assert(m_uiElementEnd == 0);
00881 assert(m_uiPostGhostBegin == 0);
00882 }
00883
00884
00885 T *array = NULL;
00886 if(!in.empty()) {
00887 array = &(*(in.begin()));
00888 }
00889
00890 if(isGhosted && isElemental) {
00891
00892
00893
00894 out = array;
00895 }else {
00896
00897
00898 sz = dof*m_uiLocalBufferSize;
00899
00900
00901 if(sz) {
00902 out = new T[sz];
00903 } else {
00904 out = NULL;
00905 }
00906 }
00907
00908 unsigned int vecCnt=0;
00909
00910
00911 if (isGhosted) {
00912 if (isElemental) {
00913
00914 } else {
00915
00916
00917 for (unsigned int i=0; i<m_uiLocalBufferSize; i++) {
00918
00919 if ( ! (m_ucpOctLevels[i] & ot::TreeNode::NODE ) ) {
00920 continue;
00921 }
00922 for (unsigned int j=0; j<dof; j++) {
00923 out[dof*i+j] = array[dof*vecCnt + j];
00924 }
00925 vecCnt++;
00926 }
00927 }
00928 } else {
00929 if (isElemental) {
00930
00931
00932 for (unsigned int i = m_uiElementBegin; i < m_uiElementEnd; i++) {
00933 for (unsigned int j = 0; j < dof; j++) {
00934 out[dof*i+j] = array[dof*vecCnt + j];
00935 }
00936 vecCnt++;
00937 }
00938 } else {
00939
00940 for (unsigned int i = m_uiElementBegin; i < m_uiElementEnd; i++) {
00941 if ( ! (m_ucpOctLevels[i] & ot::TreeNode::NODE ) ) {
00942 continue;
00943 }
00944 for (unsigned int j = 0; j < dof; j++) {
00945 out[dof*i+j] = array[dof*vecCnt + j];
00946 }
00947 vecCnt++;
00948 }
00949 for (unsigned int i = m_uiElementEnd; i < m_uiPostGhostBegin; i++) {
00950
00951 if ( ! ( (m_ucpOctLevels[i] & ot::TreeNode::NODE ) &&
00952 (m_ucpOctLevels[i] & ot::TreeNode::BOUNDARY ) ) ) {
00953 continue;
00954 }
00955 for (unsigned int j = 0; j < dof; j++) {
00956 out[dof*i+j] = array[dof*vecCnt + j];
00957 }
00958 vecCnt++;
00959 }
00960 }
00961 }
00962 return 0;
00963 }
00964
00965 template < typename T >
00966 int DA::vecRestoreBuffer(std::vector<T> &in, T* out, bool isElemental,
00967 bool isGhosted, bool isReadOnly, unsigned int dof) {
00968
00969
00970 unsigned int sz = 0;
00971 if(m_bIamActive) {
00972 if (isElemental) {
00973 sz = m_uiElementSize;
00974 if (isGhosted) {
00975 sz += m_uiPreGhostElementSize;
00976 }
00977 } else {
00978 sz = m_uiNodeSize + m_uiBoundaryNodeSize;
00979 if (isGhosted) {
00980 sz += (m_uiPreGhostNodeSize + m_uiPreGhostBoundaryNodeSize + m_uiPostGhostNodeSize);
00981 }
00982 }
00983
00984 sz *= dof;
00985 }
00986
00987 unsigned int vecSz = static_cast<unsigned int>(in.size());
00988
00989 if ( sz != vecSz) {
00990 std::cerr << "In function STL::" << __func__ << " sizes are unequal, sz is " <<
00991 sz << " and vecSz is " << vecSz << std::endl;
00992 assert(false);
00993 return -1;
00994 };
00995
00996 if(!m_bIamActive) {
00997 assert(m_uiLocalBufferSize == 0);
00998 assert(m_uiElementBegin == 0);
00999 assert(m_uiElementEnd == 0);
01000 assert(m_uiPostGhostBegin == 0);
01001 }
01002
01003 unsigned int vecCnt=0;
01004
01005
01006 if ( isGhosted && isElemental ) {
01007 out = NULL;
01008 } else if ( isReadOnly ) {
01009
01010 if(out) {
01011 delete [] out;
01012 out = NULL;
01013 }
01014 } else {
01015
01016
01017 T *array = NULL;
01018 if(!in.empty()) {
01019 array = &(*in.begin());
01020 }
01021
01022 if ( isElemental ) {
01023
01024 for (unsigned int i = m_uiElementBegin; i < m_uiElementEnd; i++) {
01025 for (unsigned int j = 0; j < dof; j++) {
01026 array[dof*vecCnt + j] = out[dof*i+j];
01027 }
01028 vecCnt++;
01029 }
01030 } else if ( isGhosted ) {
01031
01032 for (unsigned int i = 0; i < m_uiLocalBufferSize; i++) {
01033
01034 if ( ! (m_ucpOctLevels[i] & ot::TreeNode::NODE ) ) {
01035 continue;
01036 }
01037 for (unsigned int j = 0; j < dof; j++) {
01038 array[dof*vecCnt + j] = out[dof*i+j];
01039 }
01040 vecCnt++;
01041 }
01042 } else {
01043
01044 for (unsigned int i = m_uiElementBegin; i < m_uiElementEnd; i++) {
01045 if ( ! (m_ucpOctLevels[i] & ot::TreeNode::NODE ) ) {
01046 continue;
01047 }
01048 for (unsigned int j = 0; j < dof; j++) {
01049 array[dof*vecCnt + j] = out[dof*i+j];
01050 }
01051 vecCnt++;
01052 }
01053 for (unsigned int i = m_uiElementEnd; i < m_uiPostGhostBegin; i++) {
01054
01055 if ( ! ( (m_ucpOctLevels[i] & ot::TreeNode::NODE ) &&
01056 (m_ucpOctLevels[i] & ot::TreeNode::BOUNDARY ) ) ) {
01057 continue;
01058 }
01059 for (unsigned int j = 0; j < dof; j++) {
01060 array[dof*vecCnt + j] = out[dof*i+j];
01061 }
01062 vecCnt++;
01063 }
01064 }
01065
01066 if(out) {
01067 delete [] out;
01068 out = NULL;
01069 }
01070 }
01071 return 0;
01072 }
01073
01074 inline unsigned char DA::getChildNumber() {
01075 #ifdef __DEBUG_DA__
01076 assert(m_bIamActive);
01077 #endif
01078
01079 if( m_bCompressLut && m_ucpLutMasksPtr[(m_uiCurrent << 1) + 1] ) {
01080 return ( m_ucpSortOrdersPtr[m_uiCurrent] );
01081 }else {
01082 unsigned int lev = m_ucpOctLevels[m_uiCurrent] & ot::TreeNode::MAX_LEVEL;
01083 unsigned int len = (unsigned int)(1u << ( m_uiMaxDepth - lev ) );
01084 unsigned int len_par = (unsigned int)(1u << ( m_uiMaxDepth - lev +1 ) );
01085
01086 unsigned int i = m_ptCurrentOffset.xint() % len_par;
01087 unsigned int j = m_ptCurrentOffset.yint() % len_par;
01088 unsigned int k = m_ptCurrentOffset.zint() % len_par;
01089
01090 i /= len;
01091 j /= len;
01092 k /= len;
01093
01094 return static_cast<unsigned char>((k << 2) + (j << 1) + i);
01095 }
01096 }
01097
01098 inline int DA::getNodeIndices(unsigned int* nodes) {
01099 #ifdef __DEBUG_DA__
01100 assert(m_bIamActive);
01101 #endif
01102 #ifdef __DEBUG_DA__
01103 if ( m_ucpLutMasksPtr[2*m_uiCurrent+1] == ot::DA_FLAGS::FOREIGN ) {
01104 std::cerr << RED"Passing foreign mask for index "NRM << m_uiCurrent << std::endl;
01105 assert(false);
01106 }
01107 #endif
01108
01109 unsigned int ii = (m_uiCurrent << 3);
01110
01111 if(!m_bCompressLut) {
01112 for(unsigned int j = 0; j < 8; j++) {
01113 nodes[j] = m_uiNlistPtr[ii + j];
01114 }
01115 }else {
01116
01117 unsigned char _mask = m_ucpLutMasksPtr[(m_uiCurrent << 1)];
01118
01119
01120 unsigned int nn[8];
01121
01122
01123
01124 nn[0] = m_ucpLutRemaindersPtr[ii];
01125 if ( _mask & 1) {
01126 nn[0] += (static_cast<unsigned int>(m_uspLutQuotientsPtr[m_uiQuotientCounter++]) << 8);
01127 }
01128 nn[0] = m_uiCurrent - nn[0];
01129
01130 for (unsigned int j = 1; j < 8; j++) {
01131 nn[j] = m_ucpLutRemaindersPtr[ii + j];
01132 if ( _mask & (1 << j ) ) {
01133 nn[j] += (static_cast<unsigned int>(m_uspLutQuotientsPtr[m_uiQuotientCounter++]) << 8);
01134 }
01135 nn[j] += nn[j-1];
01136 }
01137
01138
01139
01140 unsigned char hnMask = m_ucpLutMasksPtr[(m_uiCurrent << 1) + 1];
01141
01142 if ( hnMask ) {
01143
01144 unsigned int d = (m_ucpOctLevels[m_uiCurrent] & ot::TreeNode::MAX_LEVEL);
01145 unsigned int sz = ( 1u << (m_uiMaxDepth - d) );
01146
01147 unsigned int x = m_ptCurrentOffset.xint();
01148 unsigned int y = m_ptCurrentOffset.yint();
01149 unsigned int z = m_ptCurrentOffset.zint();
01150
01151 unsigned int xp = x + sz;
01152 unsigned int yp = y + sz;
01153 unsigned int zp = z + sz;
01154
01155 unsigned int childNum = m_ucpSortOrdersPtr[m_uiCurrent];
01156
01157 ot::TreeNode vertices[8];
01158
01159 {
01160 vertices[0] = TreeNode(x,y,z,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01161
01162 vertices[1] = TreeNode(xp,y,z,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01163
01164 vertices[2] = TreeNode(x,yp,z,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01165
01166 vertices[3] = TreeNode(xp,yp,z,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01167
01168 vertices[4] = TreeNode(x,y,zp,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01169
01170 vertices[5] = TreeNode(xp,y,zp,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01171
01172 vertices[6] = TreeNode(x,yp,zp,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01173
01174 vertices[7] = TreeNode(xp,yp,zp,m_uiMaxDepth,m_uiDimension,m_uiMaxDepth);
01175 }
01176
01177 switch (childNum) {
01178 case 0:
01179 {
01180
01181
01182 switch( hnMask ) {
01183 case cNumEtype<0>::ET_Y:
01184 {
01185
01186 vertices[2] = TreeNode(x ,yp + sz ,
01187 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01188 break;
01189 }
01190 case cNumEtype<0>::ET_X:
01191 {
01192
01193 vertices[1] = TreeNode(xp + sz, y ,
01194 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01195 break;
01196 }
01197 case cNumEtype<0>::ET_XY:
01198 {
01199
01200 vertices[1] = TreeNode(xp + sz, y ,
01201 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01202
01203 vertices[2] = TreeNode(x ,yp + sz ,
01204 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01205 break;
01206 }
01207 case cNumEtype<0>::ET_Z:
01208 {
01209
01210 vertices[4] = TreeNode(x,
01211 y,zp + sz, m_uiMaxDepth,
01212 m_uiDimension, m_uiMaxDepth);
01213
01214 break;
01215 }
01216 case cNumEtype<0>::ET_ZY:
01217 {
01218
01219 vertices[4] = TreeNode(x,
01220 y,zp + sz, m_uiMaxDepth,
01221 m_uiDimension, m_uiMaxDepth);
01222
01223 vertices[2] = TreeNode(x ,yp + sz ,
01224 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01225
01226 break;
01227 }
01228 case cNumEtype<0>::ET_ZX:
01229 {
01230
01231 vertices[4] = TreeNode(x,
01232 y,zp + sz, m_uiMaxDepth,
01233 m_uiDimension, m_uiMaxDepth);
01234
01235 vertices[1] = TreeNode(xp + sz, y ,
01236 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01237
01238
01239 break;
01240 }
01241 case cNumEtype<0>::ET_ZXY:
01242 {
01243
01244 vertices[4] = TreeNode(x,
01245 y,zp + sz, m_uiMaxDepth,
01246 m_uiDimension, m_uiMaxDepth);
01247
01248 vertices[1] = TreeNode(xp + sz, y ,
01249 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01250
01251 vertices[2] = TreeNode(x ,yp + sz ,
01252 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01253
01254 break;
01255 }
01256 case cNumEtype<0>::ET_XY_XY:
01257 {
01258
01259 vertices[3] = TreeNode(xp + sz,
01260 yp + sz,z, m_uiMaxDepth,
01261 m_uiDimension, m_uiMaxDepth);
01262
01263 vertices[1] = TreeNode(xp + sz, y ,
01264 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01265
01266 vertices[2] = TreeNode(x ,yp + sz ,
01267 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01268
01269 break;
01270 }
01271 case cNumEtype<0>::ET_XY_ZXY:
01272 {
01273
01274 vertices[3] = TreeNode(xp + sz,
01275 yp + sz,z, m_uiMaxDepth,
01276 m_uiDimension, m_uiMaxDepth);
01277
01278 vertices[4] = TreeNode(x,
01279 y,zp + sz, m_uiMaxDepth,
01280 m_uiDimension, m_uiMaxDepth);
01281
01282 vertices[1] = TreeNode(xp + sz, y ,
01283 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01284
01285 vertices[2] = TreeNode(x ,yp + sz ,
01286 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01287
01288 break;
01289 }
01290 case cNumEtype<0>::ET_YZ_ZY:
01291 {
01292
01293 vertices[6] = TreeNode(x,
01294 yp + sz,zp + sz, m_uiMaxDepth,
01295 m_uiDimension, m_uiMaxDepth);
01296
01297 vertices[4] = TreeNode(x,
01298 y,zp + sz, m_uiMaxDepth,
01299 m_uiDimension, m_uiMaxDepth);
01300
01301 vertices[2] = TreeNode(x ,yp + sz ,
01302 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01303
01304 break;
01305 }
01306 case cNumEtype<0>::ET_YZ_ZXY:
01307 {
01308
01309 vertices[6] = TreeNode(x,
01310 yp + sz,zp + sz, m_uiMaxDepth,
01311 m_uiDimension, m_uiMaxDepth);
01312
01313 vertices[4] = TreeNode(x,
01314 y,zp + sz, m_uiMaxDepth,
01315 m_uiDimension, m_uiMaxDepth);
01316
01317 vertices[1] = TreeNode(xp + sz, y ,
01318 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01319
01320 vertices[2] = TreeNode(x ,yp + sz ,
01321 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01322
01323 break;
01324 }
01325 case cNumEtype<0>::ET_YZ_XY_ZXY:
01326 {
01327
01328 vertices[6] = TreeNode(x,
01329 yp + sz,zp + sz, m_uiMaxDepth,
01330 m_uiDimension, m_uiMaxDepth);
01331
01332 vertices[3] = TreeNode(xp + sz,
01333 yp + sz,z, m_uiMaxDepth,
01334 m_uiDimension, m_uiMaxDepth);
01335
01336 vertices[4] = TreeNode(x,
01337 y,zp + sz, m_uiMaxDepth,
01338 m_uiDimension, m_uiMaxDepth);
01339
01340 vertices[1] = TreeNode(xp + sz, y ,
01341 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01342
01343 vertices[2] = TreeNode(x ,yp + sz ,
01344 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01345
01346 break;
01347 }
01348 case cNumEtype<0>::ET_ZX_ZX:
01349 {
01350
01351 vertices[5] = TreeNode(xp + sz,
01352 y,zp + sz, m_uiMaxDepth,
01353 m_uiDimension, m_uiMaxDepth);
01354
01355 vertices[4] = TreeNode(x,
01356 y,zp + sz, m_uiMaxDepth,
01357 m_uiDimension, m_uiMaxDepth);
01358
01359 vertices[1] = TreeNode(xp + sz, y ,
01360 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01361
01362
01363 break;
01364 }
01365 case cNumEtype<0>::ET_ZX_ZXY:
01366 {
01367
01368 vertices[5] = TreeNode(xp + sz,
01369 y,zp + sz, m_uiMaxDepth,
01370 m_uiDimension, m_uiMaxDepth);
01371
01372 vertices[4] = TreeNode(x,
01373 y,zp + sz, m_uiMaxDepth,
01374 m_uiDimension, m_uiMaxDepth);
01375
01376 vertices[1] = TreeNode(xp + sz, y ,
01377 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01378
01379 vertices[2] = TreeNode(x ,yp + sz ,
01380 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01381
01382 break;
01383 }
01384 case cNumEtype<0>::ET_ZX_XY_ZXY:
01385 {
01386
01387 vertices[5] = TreeNode(xp + sz,
01388 y,zp + sz, m_uiMaxDepth,
01389 m_uiDimension, m_uiMaxDepth);
01390
01391 vertices[3] = TreeNode(xp + sz,
01392 yp + sz,z, m_uiMaxDepth,
01393 m_uiDimension, m_uiMaxDepth);
01394
01395 vertices[4] = TreeNode(x,
01396 y,zp + sz, m_uiMaxDepth,
01397 m_uiDimension, m_uiMaxDepth);
01398
01399 vertices[1] = TreeNode(xp + sz, y ,
01400 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01401
01402 vertices[2] = TreeNode(x ,yp + sz ,
01403 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01404
01405 break;
01406 }
01407 case cNumEtype<0>::ET_ZX_YZ_ZXY:
01408 {
01409
01410 vertices[5] = TreeNode(xp + sz,
01411 y,zp + sz, m_uiMaxDepth,
01412 m_uiDimension, m_uiMaxDepth);
01413
01414 vertices[6] = TreeNode(x,
01415 yp + sz,zp + sz, m_uiMaxDepth,
01416 m_uiDimension, m_uiMaxDepth);
01417
01418 vertices[4] = TreeNode(x,
01419 y,zp + sz, m_uiMaxDepth,
01420 m_uiDimension, m_uiMaxDepth);
01421
01422 vertices[1] = TreeNode(xp + sz, y ,
01423 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01424
01425 vertices[2] = TreeNode(x ,yp + sz ,
01426 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01427
01428 break;
01429 }
01430 case cNumEtype<0>::ET_ZX_YZ_XY_ZXY:
01431 {
01432
01433
01434 vertices[5] = TreeNode(xp + sz,
01435 y,zp + sz, m_uiMaxDepth,
01436 m_uiDimension, m_uiMaxDepth);
01437
01438 vertices[6] = TreeNode(x,
01439 yp + sz,zp + sz, m_uiMaxDepth,
01440 m_uiDimension, m_uiMaxDepth);
01441
01442 vertices[3] = TreeNode(xp + sz,
01443 yp + sz,z, m_uiMaxDepth,
01444 m_uiDimension, m_uiMaxDepth);
01445
01446 vertices[4] = TreeNode(x,
01447 y,zp + sz, m_uiMaxDepth,
01448 m_uiDimension, m_uiMaxDepth);
01449
01450 vertices[1] = TreeNode(xp + sz, y ,
01451 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01452
01453 vertices[2] = TreeNode(x ,yp + sz ,
01454 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01455
01456 break;
01457 }
01458 default:
01459 assert(false);
01460
01461 }
01462 break;
01463 }
01464 case 1:
01465 {
01466
01467
01468 switch( hnMask ) {
01469 case cNumEtype<1>::ET_Y:
01470 {
01471
01472 vertices[0] = TreeNode(x - sz,y,
01473 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01474
01475 break;
01476 }
01477 case cNumEtype<1>::ET_X:
01478 {
01479
01480 vertices[3] = TreeNode(xp,yp + sz,
01481 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01482
01483 break;
01484 }
01485 case cNumEtype<1>::ET_XY:
01486 {
01487
01488 vertices[0] = TreeNode(x - sz,y,
01489 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01490
01491 vertices[3] = TreeNode(xp,yp + sz,
01492 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01493
01494 break;
01495 }
01496 case cNumEtype<1>::ET_Z:
01497 {
01498
01499 vertices[5] = TreeNode(xp,y,
01500 zp + sz, m_uiMaxDepth, m_uiDimension,
01501 m_uiMaxDepth);
01502
01503 break;
01504 }
01505 case cNumEtype<1>::ET_ZY:
01506 {
01507
01508 vertices[0] = TreeNode(x - sz,y,
01509 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01510
01511 vertices[5] = TreeNode(xp,y,
01512 zp + sz, m_uiMaxDepth, m_uiDimension,
01513 m_uiMaxDepth);
01514
01515 break;
01516 }
01517 case cNumEtype<1>::ET_ZX:
01518 {
01519
01520 vertices[5] = TreeNode(xp,y,
01521 zp + sz, m_uiMaxDepth, m_uiDimension,
01522 m_uiMaxDepth);
01523
01524 vertices[3] = TreeNode(xp,yp + sz,
01525 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01526
01527 break;
01528 }
01529 case cNumEtype<1>::ET_ZXY:
01530 {
01531
01532 vertices[5] = TreeNode(xp,y,
01533 zp + sz, m_uiMaxDepth, m_uiDimension,
01534 m_uiMaxDepth);
01535
01536 vertices[0] = TreeNode(x - sz,y,
01537 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01538
01539 vertices[3] = TreeNode(xp,yp + sz,
01540 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01541
01542 break;
01543 }
01544 case cNumEtype<1>::ET_XY_XY:
01545 {
01546
01547 vertices[2] = TreeNode(x - sz,yp + sz,
01548 z, m_uiMaxDepth, m_uiDimension,
01549 m_uiMaxDepth);
01550
01551 vertices[0] = TreeNode(x - sz,y,
01552 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01553
01554 vertices[3] = TreeNode(xp,yp + sz,
01555 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01556
01557 break;
01558 }
01559 case cNumEtype<1>::ET_XY_ZXY:
01560 {
01561
01562 vertices[2] = TreeNode(x - sz,yp + sz,
01563 z, m_uiMaxDepth, m_uiDimension,
01564 m_uiMaxDepth);
01565
01566 vertices[5] = TreeNode(xp,y,
01567 zp + sz, m_uiMaxDepth, m_uiDimension,
01568 m_uiMaxDepth);
01569
01570 vertices[0] = TreeNode(x - sz,y,
01571 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01572
01573 vertices[3] = TreeNode(xp,yp + sz,
01574 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01575
01576 break;
01577 }
01578 case cNumEtype<1>::ET_YZ_ZY:
01579 {
01580
01581 vertices[4] = TreeNode(x - sz,y,
01582 zp + sz, m_uiMaxDepth, m_uiDimension,
01583 m_uiMaxDepth);
01584
01585 vertices[5] = TreeNode(xp,y,
01586 zp + sz, m_uiMaxDepth, m_uiDimension,
01587 m_uiMaxDepth);
01588
01589 vertices[0] = TreeNode(x - sz,y,
01590 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01591
01592 break;
01593 }
01594 case cNumEtype<1>::ET_YZ_ZXY:
01595 {
01596
01597 vertices[4] = TreeNode(x - sz,y,
01598 zp + sz, m_uiMaxDepth, m_uiDimension,
01599 m_uiMaxDepth);
01600
01601 vertices[5] = TreeNode(xp,y,
01602 zp + sz, m_uiMaxDepth, m_uiDimension,
01603 m_uiMaxDepth);
01604
01605 vertices[0] = TreeNode(x - sz,y,
01606 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01607
01608 vertices[3] = TreeNode(xp,yp + sz,
01609 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01610
01611 break;
01612 }
01613 case cNumEtype<1>::ET_YZ_XY_ZXY:
01614 {
01615
01616 vertices[4] = TreeNode(x - sz,y,
01617 zp + sz, m_uiMaxDepth, m_uiDimension,
01618 m_uiMaxDepth);
01619
01620 vertices[2] = TreeNode(x - sz,yp + sz,
01621 z, m_uiMaxDepth, m_uiDimension,
01622 m_uiMaxDepth);
01623
01624 vertices[5] = TreeNode(xp,y,
01625 zp + sz, m_uiMaxDepth, m_uiDimension,
01626 m_uiMaxDepth);
01627
01628 vertices[0] = TreeNode(x - sz,y,
01629 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01630
01631 vertices[3] = TreeNode(xp,yp + sz,
01632 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01633
01634 break;
01635 }
01636 case cNumEtype<1>::ET_ZX_ZX:
01637 {
01638
01639 vertices[7] = TreeNode(xp,yp + sz,
01640 zp + sz, m_uiMaxDepth, m_uiDimension,
01641 m_uiMaxDepth);
01642
01643 vertices[5] = TreeNode(xp,y,
01644 zp + sz, m_uiMaxDepth, m_uiDimension,
01645 m_uiMaxDepth);
01646
01647 vertices[3] = TreeNode(xp,yp + sz,
01648 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01649
01650 break;
01651 }
01652 case cNumEtype<1>::ET_ZX_ZXY:
01653 {
01654
01655 vertices[7] = TreeNode(xp,yp + sz,
01656 zp + sz, m_uiMaxDepth, m_uiDimension,
01657 m_uiMaxDepth);
01658
01659 vertices[5] = TreeNode(xp,y,
01660 zp + sz, m_uiMaxDepth, m_uiDimension,
01661 m_uiMaxDepth);
01662
01663 vertices[0] = TreeNode(x - sz,y,
01664 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01665
01666 vertices[3] = TreeNode(xp,yp + sz,
01667 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01668
01669 break;
01670 }
01671 case cNumEtype<1>::ET_ZX_XY_ZXY:
01672 {
01673
01674 vertices[7] = TreeNode(xp,yp + sz,
01675 zp + sz, m_uiMaxDepth, m_uiDimension,
01676 m_uiMaxDepth);
01677
01678 vertices[2] = TreeNode(x - sz,yp + sz,
01679 z, m_uiMaxDepth, m_uiDimension,
01680 m_uiMaxDepth);
01681
01682 vertices[5] = TreeNode(xp,y,
01683 zp + sz, m_uiMaxDepth, m_uiDimension,
01684 m_uiMaxDepth);
01685
01686 vertices[0] = TreeNode(x - sz,y,
01687 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01688
01689 vertices[3] = TreeNode(xp,yp + sz,
01690 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01691
01692 break;
01693 }
01694 case cNumEtype<1>::ET_ZX_YZ_ZXY:
01695 {
01696
01697 vertices[7] = TreeNode(xp,yp + sz,
01698 zp + sz, m_uiMaxDepth, m_uiDimension,
01699 m_uiMaxDepth);
01700
01701 vertices[4] = TreeNode(x - sz,y,
01702 zp + sz, m_uiMaxDepth, m_uiDimension,
01703 m_uiMaxDepth);
01704
01705 vertices[5] = TreeNode(xp,y,
01706 zp + sz, m_uiMaxDepth, m_uiDimension,
01707 m_uiMaxDepth);
01708
01709 vertices[0] = TreeNode(x - sz,y,
01710 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01711
01712 vertices[3] = TreeNode(xp,yp + sz,
01713 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01714
01715 break;
01716 }
01717 case cNumEtype<1>::ET_ZX_YZ_XY_ZXY:
01718 {
01719
01720 vertices[7] = TreeNode(xp,yp + sz,
01721 zp + sz, m_uiMaxDepth, m_uiDimension,
01722 m_uiMaxDepth);
01723
01724 vertices[4] = TreeNode(x - sz,y,
01725 zp + sz, m_uiMaxDepth, m_uiDimension,
01726 m_uiMaxDepth);
01727
01728 vertices[2] = TreeNode(x - sz,yp + sz,
01729 z, m_uiMaxDepth, m_uiDimension,
01730 m_uiMaxDepth);
01731
01732 vertices[5] = TreeNode(xp,y,
01733 zp + sz, m_uiMaxDepth, m_uiDimension,
01734 m_uiMaxDepth);
01735
01736 vertices[0] = TreeNode(x - sz,y,
01737 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01738
01739 vertices[3] = TreeNode(xp,yp + sz,
01740 z , m_uiMaxDepth, m_uiDimension, m_uiMaxDepth);
01741
01742 break;
01743 }
01744 default:
01745 assert(false);
01746
01747 }
01748
01749 break;
01750 }
01751 case 2:
01752 {
01753
01754
01755 switch( hnMask ) {
01756 case cNumEtype<2>::ET_Y:
01757 {
01758
01759 vertices[3] = TreeNode(xp + sz,yp,
01760 z , m_uiMaxDepth, m_uiDimension,
01761 m_uiMaxDepth);
01762
01763 break;
01764 }
01765 case cNumEtype<2>::ET_X:
01766 {
01767
01768 vertices[0] = TreeNode(x,y - sz,
01769 z , m_uiMaxDepth, m_uiDimension,
01770 m_uiMaxDepth);
01771
01772 break;
01773 }
01774 case cNumEtype<2>::ET_XY:
01775 {
01776
01777 vertices[0] = TreeNode(x,y - sz,
01778 z , m_uiMaxDepth, m_uiDimension,
01779 m_uiMaxDepth);
01780
01781 vertices[3] = TreeNode(xp + sz,yp,
01782 z , m_uiMaxDepth, m_uiDimension,
01783 m_uiMaxDepth);
01784
01785 break;
01786 }
01787 case cNumEtype<2>::ET_Z:
01788 {
01789
01790 vertices[6] = TreeNode(x,yp,
01791 zp + sz , m_uiMaxDepth, m_uiDimension,
01792 m_uiMaxDepth);
01793
01794 break;
01795 }
01796 case cNumEtype<2>::ET_ZY:
01797 {
01798
01799 vertices[6] = TreeNode(x,yp,
01800 zp + sz , m_uiMaxDepth, m_uiDimension,
01801 m_uiMaxDepth);
01802
01803 vertices[3] = TreeNode(xp + sz,yp,
01804 z , m_uiMaxDepth, m_uiDimension,
01805 m_uiMaxDepth);
01806
01807 break;
01808 }
01809 case cNumEtype<2>::ET_ZX:
01810 {
01811
01812 vertices[6] = TreeNode(x,yp,
01813 zp + sz , m_uiMaxDepth, m_uiDimension,
01814 m_uiMaxDepth);
01815
01816 vertices[0] = TreeNode(x,y - sz,
01817 z , m_uiMaxDepth, m_uiDimension,
01818 m_uiMaxDepth);
01819
01820 break;
01821 }
01822 case cNumEtype<2>::ET_ZXY:
01823 {
01824
01825 vertices[6] = TreeNode(x,yp,
01826 zp + sz , m_uiMaxDepth, m_uiDimension,
01827 m_uiMaxDepth);
01828
01829 vertices[0] = TreeNode(x,y - sz,
01830 z , m_uiMaxDepth, m_uiDimension,
01831 m_uiMaxDepth);
01832
01833 vertices[3] = TreeNode(xp + sz,yp,
01834 z , m_uiMaxDepth, m_uiDimension,
01835 m_uiMaxDepth);
01836
01837 break;
01838 }
01839 case cNumEtype<2>::ET_XY_XY:
01840 {
01841
01842 vertices[1] = TreeNode(xp + sz,y - sz,
01843 z, m_uiMaxDepth, m_uiDimension,
01844 m_uiMaxDepth);
01845
01846 vertices[0] = TreeNode(x,y - sz,
01847 z , m_uiMaxDepth, m_uiDimension,
01848 m_uiMaxDepth);
01849
01850 vertices[3] = TreeNode(xp + sz,yp,
01851 z , m_uiMaxDepth, m_uiDimension,
01852 m_uiMaxDepth);
01853
01854 break;
01855 }
01856 case cNumEtype<2>::ET_XY_ZXY:
01857 {
01858
01859 vertices[1] = TreeNode(xp + sz,y - sz,
01860 z, m_uiMaxDepth, m_uiDimension,
01861 m_uiMaxDepth);
01862
01863 vertices[6] = TreeNode(x,yp,
01864 zp + sz , m_uiMaxDepth, m_uiDimension,
01865 m_uiMaxDepth);
01866
01867 vertices[0] = TreeNode(x,y - sz,
01868 z , m_uiMaxDepth, m_uiDimension,
01869 m_uiMaxDepth);
01870
01871 vertices[3] = TreeNode(xp + sz,yp,
01872 z , m_uiMaxDepth, m_uiDimension,
01873 m_uiMaxDepth);
01874
01875 break;
01876 }
01877 case cNumEtype<2>::ET_YZ_ZY:
01878 {
01879
01880 vertices[7] = TreeNode(xp + sz,yp,
01881 zp + sz, m_uiMaxDepth, m_uiDimension,
01882 m_uiMaxDepth);
01883
01884 vertices[6] = TreeNode(x,yp,
01885 zp + sz , m_uiMaxDepth, m_uiDimension,
01886 m_uiMaxDepth);
01887
01888 vertices[3] = TreeNode(xp + sz,yp,
01889 z , m_uiMaxDepth, m_uiDimension,
01890 m_uiMaxDepth);
01891
01892 break;
01893 }
01894 case cNumEtype<2>::ET_YZ_ZXY:
01895 {
01896
01897 vertices[7] = TreeNode(xp + sz,yp,
01898 zp + sz, m_uiMaxDepth, m_uiDimension,
01899 m_uiMaxDepth);
01900
01901 vertices[6] = TreeNode(x,yp,
01902 zp + sz , m_uiMaxDepth, m_uiDimension,
01903 m_uiMaxDepth);
01904
01905 vertices[0] = TreeNode(x,y - sz,
01906 z , m_uiMaxDepth, m_uiDimension,
01907 m_uiMaxDepth);
01908
01909 vertices[3] = TreeNode(xp + sz,yp,
01910 z , m_uiMaxDepth, m_uiDimension,
01911 m_uiMaxDepth);
01912
01913 break;
01914 }
01915 case cNumEtype<2>::ET_YZ_XY_ZXY:
01916 {
01917
01918 vertices[7] = TreeNode(xp + sz,yp,
01919 zp + sz, m_uiMaxDepth, m_uiDimension,
01920 m_uiMaxDepth);
01921
01922 vertices[1] = TreeNode(xp + sz,y - sz,
01923 z, m_uiMaxDepth, m_uiDimension,
01924 m_uiMaxDepth);
01925
01926 vertices[6] = TreeNode(x,yp,
01927 zp + sz , m_uiMaxDepth, m_uiDimension,
01928 m_uiMaxDepth);
01929
01930 vertices[0] = TreeNode(x,y - sz,
01931 z , m_uiMaxDepth, m_uiDimension,
01932 m_uiMaxDepth);
01933
01934 vertices[3] = TreeNode(xp + sz,yp,
01935 z , m_uiMaxDepth, m_uiDimension,
01936 m_uiMaxDepth);
01937
01938 break;
01939 }
01940 case cNumEtype<2>::ET_ZX_ZX:
01941 {
01942
01943 vertices[4] = TreeNode(x,y - sz,
01944 zp + sz, m_uiMaxDepth, m_uiDimension,
01945 m_uiMaxDepth);
01946
01947 vertices[6] = TreeNode(x,yp,
01948 zp + sz , m_uiMaxDepth, m_uiDimension,
01949 m_uiMaxDepth);
01950
01951 vertices[0] = TreeNode(x,y - sz,
01952 z , m_uiMaxDepth, m_uiDimension,
01953 m_uiMaxDepth);
01954
01955 break;
01956 }
01957 case cNumEtype<2>::ET_ZX_ZXY:
01958 {
01959
01960 vertices[4] = TreeNode(x,y - sz,
01961 zp + sz, m_uiMaxDepth, m_uiDimension,
01962 m_uiMaxDepth);
01963
01964 vertices[6] = TreeNode(x,yp,
01965 zp + sz , m_uiMaxDepth, m_uiDimension,
01966 m_uiMaxDepth);
01967
01968 vertices[0] = TreeNode(x,y - sz,
01969 z , m_uiMaxDepth, m_uiDimension,
01970 m_uiMaxDepth);
01971
01972 vertices[3] = TreeNode(xp + sz,yp,
01973 z , m_uiMaxDepth, m_uiDimension,
01974 m_uiMaxDepth);
01975
01976 break;
01977 }
01978 case cNumEtype<2>::ET_ZX_XY_ZXY:
01979 {
01980
01981 vertices[4] = TreeNode(x,y - sz,
01982 zp + sz, m_uiMaxDepth, m_uiDimension,
01983 m_uiMaxDepth);
01984
01985 vertices[1] = TreeNode(xp + sz,y - sz,
01986 z, m_uiMaxDepth, m_uiDimension,
01987 m_uiMaxDepth);
01988
01989 vertices[6] = TreeNode(x,yp,
01990 zp + sz , m_uiMaxDepth, m_uiDimension,
01991 m_uiMaxDepth);
01992
01993 vertices[0] = TreeNode(x,y - sz,
01994 z , m_uiMaxDepth, m_uiDimension,
01995 m_uiMaxDepth);
01996
01997 vertices[3] = TreeNode(xp + sz,yp,
01998 z , m_uiMaxDepth, m_uiDimension,
01999 m_uiMaxDepth);
02000
02001 break;
02002 }
02003 case cNumEtype<2>::ET_ZX_YZ_ZXY:
02004 {
02005
02006 vertices[4] = TreeNode(x,y - sz,
02007 zp + sz, m_uiMaxDepth, m_uiDimension,
02008 m_uiMaxDepth);
02009
02010 vertices[7] = TreeNode(xp + sz,yp,
02011 zp + sz, m_uiMaxDepth, m_uiDimension,
02012 m_uiMaxDepth);
02013
02014 vertices[6] = TreeNode(x,yp,
02015 zp + sz , m_uiMaxDepth, m_uiDimension,
02016 m_uiMaxDepth);
02017
02018 vertices[0] = TreeNode(x,y - sz,
02019 z , m_uiMaxDepth, m_uiDimension,
02020 m_uiMaxDepth);
02021
02022 vertices[3] = TreeNode(xp + sz,yp,
02023 z , m_uiMaxDepth, m_uiDimension,
02024 m_uiMaxDepth);
02025
02026 break;
02027 }
02028 case cNumEtype<2>::ET_ZX_YZ_XY_ZXY:
02029 {
02030
02031 vertices[4] = TreeNode(x,y - sz,
02032 zp + sz, m_uiMaxDepth, m_uiDimension,
02033 m_uiMaxDepth);
02034
02035 vertices[7] = TreeNode(xp + sz,yp,
02036 zp + sz, m_uiMaxDepth, m_uiDimension,
02037 m_uiMaxDepth);
02038
02039 vertices[1] = TreeNode(xp + sz,y - sz,
02040 z, m_uiMaxDepth, m_uiDimension,
02041 m_uiMaxDepth);
02042
02043 vertices[6] = TreeNode(x,yp,
02044 zp + sz , m_uiMaxDepth, m_uiDimension,
02045 m_uiMaxDepth);
02046
02047 vertices[0] = TreeNode(x,y - sz,
02048 z , m_uiMaxDepth, m_uiDimension,
02049 m_uiMaxDepth);
02050
02051 vertices[3] = TreeNode(xp + sz,yp,
02052 z , m_uiMaxDepth, m_uiDimension,
02053 m_uiMaxDepth);
02054
02055 break;
02056 }
02057 default:
02058 assert(false);
02059
02060 }
02061
02062
02063 break;
02064 }
02065 case 3:
02066 {
02067
02068
02069 switch( hnMask ) {
02070 case cNumEtype<3>::ET_Y:
02071 {
02072
02073 vertices[1] = TreeNode(xp,y - sz,
02074 z, m_uiMaxDepth, m_uiDimension,
02075 m_uiMaxDepth);
02076
02077 break;
02078 }
02079 case cNumEtype<3>::ET_X:
02080 {
02081
02082 vertices[2] = TreeNode(x - sz,yp,
02083 z, m_uiMaxDepth, m_uiDimension,
02084 m_uiMaxDepth);
02085
02086 break;
02087 }
02088 case cNumEtype<3>::ET_XY:
02089 {
02090
02091 vertices[2] = TreeNode(x - sz,yp,
02092 z, m_uiMaxDepth, m_uiDimension,
02093 m_uiMaxDepth);
02094
02095 vertices[1] = TreeNode(xp,y - sz,
02096 z, m_uiMaxDepth, m_uiDimension,
02097 m_uiMaxDepth);
02098
02099 break;
02100 }
02101 case cNumEtype<3>::ET_Z:
02102 {
02103
02104 vertices[7] = TreeNode(xp,yp,
02105 zp + sz, m_uiMaxDepth, m_uiDimension,
02106 m_uiMaxDepth);
02107
02108 break;
02109 }
02110 case cNumEtype<3>::ET_ZY:
02111 {
02112
02113 vertices[7] = TreeNode(xp,yp,
02114 zp + sz, m_uiMaxDepth, m_uiDimension,
02115 m_uiMaxDepth);
02116
02117 vertices[1] = TreeNode(xp,y - sz,
02118 z, m_uiMaxDepth, m_uiDimension,
02119 m_uiMaxDepth);
02120
02121 break;
02122 }
02123 case cNumEtype<3>::ET_ZX:
02124 {
02125
02126 vertices[7] = TreeNode(xp,yp,
02127 zp + sz, m_uiMaxDepth, m_uiDimension,
02128 m_uiMaxDepth);
02129
02130 vertices[2] = TreeNode(x - sz,yp,
02131 z, m_uiMaxDepth, m_uiDimension,
02132 m_uiMaxDepth);
02133
02134 break;
02135 }
02136 case cNumEtype<3>::ET_ZXY:
02137 {
02138
02139 vertices[7] = TreeNode(xp,yp,
02140 zp + sz, m_uiMaxDepth, m_uiDimension,
02141 m_uiMaxDepth);
02142
02143 vertices[2] = TreeNode(x - sz,yp,
02144 z, m_uiMaxDepth, m_uiDimension,
02145 m_uiMaxDepth);
02146
02147 vertices[1] = TreeNode(xp,y - sz,
02148 z, m_uiMaxDepth, m_uiDimension,
02149 m_uiMaxDepth);
02150
02151 break;
02152 }
02153 case cNumEtype<3>::ET_XY_XY:
02154 {
02155
02156 vertices[0] = TreeNode(x - sz,y - sz,
02157 z, m_uiMaxDepth, m_uiDimension,
02158 m_uiMaxDepth);
02159
02160 vertices[2] = TreeNode(x - sz,yp,
02161 z, m_uiMaxDepth, m_uiDimension,
02162 m_uiMaxDepth);
02163
02164 vertices[1] = TreeNode(xp,y - sz,
02165 z, m_uiMaxDepth, m_uiDimension,
02166 m_uiMaxDepth);
02167
02168 break;
02169 }
02170 case cNumEtype<3>::ET_XY_ZXY:
02171 {
02172
02173 vertices[0] = TreeNode(x - sz,y - sz,
02174 z, m_uiMaxDepth, m_uiDimension,
02175 m_uiMaxDepth);
02176
02177 vertices[7] = TreeNode(xp,yp,
02178 zp + sz, m_uiMaxDepth, m_uiDimension,
02179 m_uiMaxDepth);
02180
02181 vertices[2] = TreeNode(x - sz,yp,
02182 z, m_uiMaxDepth, m_uiDimension,
02183 m_uiMaxDepth);
02184
02185 vertices[1] = TreeNode(xp,y - sz,
02186 z, m_uiMaxDepth, m_uiDimension,
02187 m_uiMaxDepth);
02188
02189 break;
02190 }
02191 case cNumEtype<3>::ET_YZ_ZY:
02192 {
02193
02194 vertices[5] = TreeNode(xp,y - sz,
02195 zp + sz, m_uiMaxDepth, m_uiDimension,
02196 m_uiMaxDepth);
02197
02198 vertices[7] = TreeNode(xp,yp,
02199 zp + sz, m_uiMaxDepth, m_uiDimension,
02200 m_uiMaxDepth);
02201
02202 vertices[1] = TreeNode(xp,y - sz,
02203 z, m_uiMaxDepth, m_uiDimension,
02204 m_uiMaxDepth);
02205
02206 break;
02207 }
02208 case cNumEtype<3>::ET_YZ_ZXY:
02209 {
02210
02211 vertices[5] = TreeNode(xp,y - sz,
02212 zp + sz, m_uiMaxDepth, m_uiDimension,
02213 m_uiMaxDepth);
02214
02215 vertices[7] = TreeNode(xp,yp,
02216 zp + sz, m_uiMaxDepth, m_uiDimension,
02217 m_uiMaxDepth);
02218
02219 vertices[2] = TreeNode(x - sz,yp,
02220 z, m_uiMaxDepth, m_uiDimension,
02221 m_uiMaxDepth);
02222
02223 vertices[1] = TreeNode(xp,y - sz,
02224 z, m_uiMaxDepth, m_uiDimension,
02225 m_uiMaxDepth);
02226
02227 break;
02228 }
02229 case cNumEtype<3>::ET_YZ_XY_ZXY:
02230 {
02231
02232 vertices[5] = TreeNode(xp,y - sz,
02233 zp + sz, m_uiMaxDepth, m_uiDimension,
02234 m_uiMaxDepth);
02235
02236 vertices[0] = TreeNode(x - sz,y - sz,
02237 z, m_uiMaxDepth, m_uiDimension,
02238 m_uiMaxDepth);
02239
02240 vertices[7] = TreeNode(xp,yp,
02241 zp + sz, m_uiMaxDepth, m_uiDimension,
02242 m_uiMaxDepth);
02243
02244 vertices[2] = TreeNode(x - sz,yp,
02245 z, m_uiMaxDepth, m_uiDimension,
02246 m_uiMaxDepth);
02247
02248 vertices[1] = TreeNode(xp,y - sz,
02249 z, m_uiMaxDepth, m_uiDimension,
02250 m_uiMaxDepth);
02251
02252 break;
02253 }
02254 case cNumEtype<3>::ET_ZX_ZX:
02255 {
02256
02257 vertices[6] = TreeNode(x - sz,yp,
02258 zp + sz, m_uiMaxDepth, m_uiDimension,
02259 m_uiMaxDepth);
02260
02261 vertices[7] = TreeNode(xp,yp,
02262 zp + sz, m_uiMaxDepth, m_uiDimension,
02263 m_uiMaxDepth);
02264
02265 vertices[2] = TreeNode(x - sz,yp,
02266 z, m_uiMaxDepth, m_uiDimension,
02267 m_uiMaxDepth);
02268
02269 break;
02270 }
02271 case cNumEtype<3>::ET_ZX_ZXY:
02272 {
02273
02274 vertices[6] = TreeNode(x - sz,yp,
02275 zp + sz, m_uiMaxDepth, m_uiDimension,
02276 m_uiMaxDepth);
02277
02278 vertices[7] = TreeNode(xp,yp,
02279 zp + sz, m_uiMaxDepth, m_uiDimension,
02280 m_uiMaxDepth);
02281
02282 vertices[2] = TreeNode(x - sz,yp,
02283 z, m_uiMaxDepth, m_uiDimension,
02284 m_uiMaxDepth);
02285
02286 vertices[1] = TreeNode(xp,y - sz,
02287 z, m_uiMaxDepth, m_uiDimension,
02288 m_uiMaxDepth);
02289
02290 break;
02291 }
02292 case cNumEtype<3>::ET_ZX_XY_ZXY:
02293 {
02294
02295 vertices[6] = TreeNode(x - sz,yp,
02296 zp + sz, m_uiMaxDepth, m_uiDimension,
02297 m_uiMaxDepth);
02298
02299 vertices[0] = TreeNode(x - sz,y - sz,
02300 z, m_uiMaxDepth, m_uiDimension,
02301 m_uiMaxDepth);
02302
02303 vertices[7] = TreeNode(xp,yp,
02304 zp + sz, m_uiMaxDepth, m_uiDimension,
02305 m_uiMaxDepth);
02306
02307 vertices[2] = TreeNode(x - sz,yp,
02308 z, m_uiMaxDepth, m_uiDimension,
02309 m_uiMaxDepth);
02310
02311 vertices[1] = TreeNode(xp,y - sz,
02312 z, m_uiMaxDepth, m_uiDimension,
02313 m_uiMaxDepth);
02314
02315 break;
02316 }
02317 case cNumEtype<3>::ET_ZX_YZ_ZXY:
02318 {
02319
02320 vertices[6] = TreeNode(x - sz,yp,
02321 zp + sz, m_uiMaxDepth, m_uiDimension,
02322 m_uiMaxDepth);
02323
02324 vertices[5] = TreeNode(xp,y - sz,
02325 zp + sz, m_uiMaxDepth, m_uiDimension,
02326 m_uiMaxDepth);
02327
02328 vertices[7] = TreeNode(xp,yp,
02329 zp + sz, m_uiMaxDepth, m_uiDimension,
02330 m_uiMaxDepth);
02331
02332 vertices[2] = TreeNode(x - sz,yp,
02333 z, m_uiMaxDepth, m_uiDimension,
02334 m_uiMaxDepth);
02335
02336 vertices[1] = TreeNode(xp,y - sz,
02337 z, m_uiMaxDepth, m_uiDimension,
02338 m_uiMaxDepth);
02339
02340 break;
02341 }
02342 case cNumEtype<3>::ET_ZX_YZ_XY_ZXY:
02343 {
02344
02345 vertices[6] = TreeNode(x - sz,yp,
02346 zp + sz, m_uiMaxDepth, m_uiDimension,
02347 m_uiMaxDepth);
02348
02349 vertices[5] = TreeNode(xp,y - sz,
02350 zp + sz, m_uiMaxDepth, m_uiDimension,
02351 m_uiMaxDepth);
02352
02353 vertices[0] = TreeNode(x - sz,y - sz,
02354 z, m_uiMaxDepth, m_uiDimension,
02355 m_uiMaxDepth);
02356
02357 vertices[7] = TreeNode(xp,yp,
02358 zp + sz, m_uiMaxDepth, m_uiDimension,
02359 m_uiMaxDepth);
02360
02361 vertices[2] = TreeNode(x - sz,yp,
02362 z, m_uiMaxDepth, m_uiDimension,
02363 m_uiMaxDepth);
02364
02365 vertices[1] = TreeNode(xp,y - sz,
02366 z, m_uiMaxDepth, m_uiDimension,
02367 m_uiMaxDepth);
02368
02369 break;
02370 }
02371 default:
02372 assert(false);
02373
02374 }
02375
02376
02377 break;
02378 }
02379 case 4:
02380 {
02381
02382
02383 switch( hnMask ) {
02384 case cNumEtype<4>::ET_Y:
02385 {
02386
02387 vertices[0] = TreeNode(x,y,
02388 z - sz, m_uiMaxDepth, m_uiDimension,
02389 m_uiMaxDepth);
02390
02391 break;
02392 }
02393 case cNumEtype<4>::ET_X:
02394 {
02395
02396 vertices[5] = TreeNode(xp+sz,y,
02397 zp, m_uiMaxDepth, m_uiDimension,
02398 m_uiMaxDepth);
02399
02400 break;
02401 }
02402 case cNumEtype<4>::ET_XY:
02403 {
02404
02405 vertices[5] = TreeNode(xp+sz,y,
02406 zp, m_uiMaxDepth, m_uiDimension,
02407 m_uiMaxDepth);
02408
02409 vertices[0] = TreeNode(x,y,
02410 z - sz, m_uiMaxDepth, m_uiDimension,
02411 m_uiMaxDepth);
02412
02413 break;
02414 }
02415 case cNumEtype<4>::ET_Z:
02416 {
02417
02418 vertices[6] = TreeNode(x,yp+sz,
02419 zp, m_uiMaxDepth, m_uiDimension,
02420 m_uiMaxDepth);
02421
02422 break;
02423 }
02424 case cNumEtype<4>::ET_ZY:
02425 {
02426
02427 vertices[6] = TreeNode(x,yp+sz,
02428 zp, m_uiMaxDepth, m_uiDimension,
02429 m_uiMaxDepth);
02430
02431 vertices[0] = TreeNode(x,y,
02432 z - sz, m_uiMaxDepth, m_uiDimension,
02433 m_uiMaxDepth);
02434
02435 break;
02436 }
02437 case cNumEtype<4>::ET_ZX:
02438 {
02439
02440 vertices[6] = TreeNode(x,yp+sz,
02441 zp, m_uiMaxDepth, m_uiDimension,
02442 m_uiMaxDepth);
02443
02444 vertices[5] = TreeNode(xp+sz,y,
02445 zp, m_uiMaxDepth, m_uiDimension,
02446 m_uiMaxDepth);
02447
02448 break;
02449 }
02450 case cNumEtype<4>::ET_ZXY:
02451 {
02452
02453 vertices[6] = TreeNode(x,yp+sz,
02454 zp, m_uiMaxDepth, m_uiDimension,
02455 m_uiMaxDepth);
02456
02457 vertices[5] = TreeNode(xp+sz,y,
02458 zp, m_uiMaxDepth, m_uiDimension,
02459 m_uiMaxDepth);
02460
02461 vertices[0] = TreeNode(x,y,
02462 z - sz, m_uiMaxDepth, m_uiDimension,
02463 m_uiMaxDepth);
02464
02465 break;
02466 }
02467 case cNumEtype<4>::ET_XY_XY:
02468 {
02469
02470 vertices[1] = TreeNode(xp+sz,y,
02471 z-sz, m_uiMaxDepth, m_uiDimension,
02472 m_uiMaxDepth);
02473
02474 vertices[5] = TreeNode(xp+sz,y,
02475 zp, m_uiMaxDepth, m_uiDimension,
02476 m_uiMaxDepth);
02477
02478 vertices[0] = TreeNode(x,y,
02479 z-sz, m_uiMaxDepth, m_uiDimension,
02480 m_uiMaxDepth);
02481
02482 break;
02483 }
02484 case cNumEtype<4>::ET_XY_ZXY:
02485 {
02486
02487 vertices[1] = TreeNode(xp+sz,y,
02488 z-sz, m_uiMaxDepth, m_uiDimension,
02489 m_uiMaxDepth);
02490
02491 vertices[6] = TreeNode(x,yp+sz,
02492 zp, m_uiMaxDepth, m_uiDimension,
02493 m_uiMaxDepth);
02494
02495 vertices[5] = TreeNode(xp+sz,y,
02496 zp, m_uiMaxDepth, m_uiDimension,
02497 m_uiMaxDepth);
02498
02499 vertices[0] = TreeNode(x,y,
02500 z - sz, m_uiMaxDepth, m_uiDimension,
02501 m_uiMaxDepth);
02502
02503 break;
02504 }
02505 case cNumEtype<4>::ET_YZ_ZY:
02506 {
02507
02508 vertices[2] = TreeNode(x,yp+sz,
02509 z-sz, m_uiMaxDepth, m_uiDimension,
02510 m_uiMaxDepth);
02511
02512 vertices[6] = TreeNode(x,yp+sz,
02513 zp, m_uiMaxDepth, m_uiDimension,
02514 m_uiMaxDepth);
02515
02516 vertices[0] = TreeNode(x,y,
02517 z - sz, m_uiMaxDepth, m_uiDimension,
02518 m_uiMaxDepth);
02519
02520 break;
02521 }
02522 case cNumEtype<4>::ET_YZ_ZXY:
02523 {
02524
02525 vertices[2] = TreeNode(x,yp+sz,
02526 z-sz, m_uiMaxDepth, m_uiDimension,
02527 m_uiMaxDepth);
02528
02529 vertices[6] = TreeNode(x,yp+sz,
02530 zp, m_uiMaxDepth, m_uiDimension,
02531 m_uiMaxDepth);
02532
02533 vertices[5] = TreeNode(xp+sz,y,
02534 zp, m_uiMaxDepth, m_uiDimension,
02535 m_uiMaxDepth);
02536
02537 vertices[0] = TreeNode(x,y,
02538 z - sz, m_uiMaxDepth, m_uiDimension,
02539 m_uiMaxDepth);
02540
02541 break;
02542 }
02543 case cNumEtype<4>::ET_YZ_XY_ZXY:
02544 {
02545
02546 vertices[2] = TreeNode(x,yp+sz,
02547 z-sz, m_uiMaxDepth, m_uiDimension,
02548 m_uiMaxDepth);
02549
02550 vertices[1] = TreeNode(xp+sz,y,
02551 z-sz, m_uiMaxDepth, m_uiDimension,
02552 m_uiMaxDepth);
02553
02554 vertices[6] = TreeNode(x,yp+sz,
02555 zp, m_uiMaxDepth, m_uiDimension,
02556 m_uiMaxDepth);
02557
02558 vertices[5] = TreeNode(xp+sz,y,
02559 zp, m_uiMaxDepth, m_uiDimension,
02560 m_uiMaxDepth);
02561
02562 vertices[0] = TreeNode(x,y,
02563 z - sz, m_uiMaxDepth, m_uiDimension,
02564 m_uiMaxDepth);
02565
02566 break;
02567 }
02568 case cNumEtype<4>::ET_ZX_ZX:
02569 {
02570
02571 vertices[7] = TreeNode(xp+sz,yp+sz,
02572 zp, m_uiMaxDepth, m_uiDimension,
02573 m_uiMaxDepth);
02574
02575 vertices[6] = TreeNode(x,yp+sz,
02576 zp, m_uiMaxDepth, m_uiDimension,
02577 m_uiMaxDepth);
02578
02579 vertices[5] = TreeNode(xp+sz,y,
02580 zp, m_uiMaxDepth, m_uiDimension,
02581 m_uiMaxDepth);
02582
02583 break;
02584 }
02585 case cNumEtype<4>::ET_ZX_ZXY:
02586 {
02587
02588 vertices[7] = TreeNode(xp+sz,yp+sz,
02589 zp, m_uiMaxDepth, m_uiDimension,
02590 m_uiMaxDepth);
02591
02592 vertices[6] = TreeNode(x,yp+sz,
02593 zp, m_uiMaxDepth, m_uiDimension,
02594 m_uiMaxDepth);
02595
02596 vertices[5] = TreeNode(xp+sz,y,
02597 zp, m_uiMaxDepth, m_uiDimension,
02598 m_uiMaxDepth);
02599
02600 vertices[0] = TreeNode(x,y,
02601 z - sz, m_uiMaxDepth, m_uiDimension,
02602 m_uiMaxDepth);
02603
02604 break;
02605 }
02606 case cNumEtype<4>::ET_ZX_XY_ZXY:
02607 {
02608
02609 vertices[7] = TreeNode(xp+sz,yp+sz,
02610 zp, m_uiMaxDepth, m_uiDimension,
02611 m_uiMaxDepth);
02612
02613 vertices[1] = TreeNode(xp+sz,y,
02614 z-sz, m_uiMaxDepth, m_uiDimension,
02615 m_uiMaxDepth);
02616
02617 vertices[6] = TreeNode(x,yp+sz,
02618 zp, m_uiMaxDepth, m_uiDimension,
02619 m_uiMaxDepth);
02620
02621 vertices[5] = TreeNode(xp+sz,y,
02622 zp, m_uiMaxDepth, m_uiDimension,
02623 m_uiMaxDepth);
02624
02625 vertices[0] = TreeNode(x,y,
02626 z - sz, m_uiMaxDepth, m_uiDimension,
02627 m_uiMaxDepth);
02628
02629 break;
02630 }
02631 case cNumEtype<4>::ET_ZX_YZ_ZXY:
02632 {
02633
02634 vertices[7] = TreeNode(xp+sz,yp+sz,
02635 zp, m_uiMaxDepth, m_uiDimension,
02636 m_uiMaxDepth);
02637
02638 vertices[2] = TreeNode(x,yp+sz,
02639 z-sz, m_uiMaxDepth, m_uiDimension,
02640 m_uiMaxDepth);
02641
02642 vertices[6] = TreeNode(x,yp+sz,
02643 zp, m_uiMaxDepth, m_uiDimension,
02644 m_uiMaxDepth);
02645
02646 vertices[5] = TreeNode(xp+sz,y,
02647 zp, m_uiMaxDepth, m_uiDimension,
02648 m_uiMaxDepth);
02649
02650 vertices[0] = TreeNode(x,y,
02651 z - sz, m_uiMaxDepth, m_uiDimension,
02652 m_uiMaxDepth);
02653
02654 break;
02655 }
02656 case cNumEtype<4>::ET_ZX_YZ_XY_ZXY:
02657 {
02658
02659 vertices[7] = TreeNode(xp+sz,yp+sz,
02660 zp, m_uiMaxDepth, m_uiDimension,
02661 m_uiMaxDepth);
02662
02663 vertices[2] = TreeNode(x,yp+sz,
02664 z-sz, m_uiMaxDepth, m_uiDimension,
02665 m_uiMaxDepth);
02666
02667 vertices[1] = TreeNode(xp+sz,y,
02668 z-sz, m_uiMaxDepth, m_uiDimension,
02669 m_uiMaxDepth);
02670
02671 vertices[6] = TreeNode(x,yp+sz,
02672 zp, m_uiMaxDepth, m_uiDimension,
02673 m_uiMaxDepth);
02674
02675 vertices[5] = TreeNode(xp+sz,y,
02676 zp, m_uiMaxDepth, m_uiDimension,
02677 m_uiMaxDepth);
02678
02679 vertices[0] = TreeNode(x,y,
02680 z - sz, m_uiMaxDepth, m_uiDimension,
02681 m_uiMaxDepth);
02682
02683 break;
02684 }
02685 default:
02686 assert(false);
02687
02688 }
02689
02690
02691 break;
02692 }
02693 case 5:
02694 {
02695
02696
02697 switch( hnMask ) {
02698 case cNumEtype<5>::ET_Y:
02699 {
02700
02701 vertices[1] = TreeNode(xp,y,
02702 z-sz, m_uiMaxDepth, m_uiDimension,
02703 m_uiMaxDepth);
02704
02705 break;
02706 }
02707 case cNumEtype<5>::ET_X:
02708 {
02709
02710 vertices[7] = TreeNode(xp,yp+sz,
02711 zp, m_uiMaxDepth, m_uiDimension,
02712 m_uiMaxDepth);
02713
02714 break;
02715 }
02716 case cNumEtype<5>::ET_XY:
02717 {
02718
02719 vertices[7] = TreeNode(xp,yp+sz,
02720 zp, m_uiMaxDepth, m_uiDimension,
02721 m_uiMaxDepth);
02722
02723 vertices[1] = TreeNode(xp,y,
02724 z-sz, m_uiMaxDepth, m_uiDimension,
02725 m_uiMaxDepth);
02726
02727 break;
02728 }
02729 case cNumEtype<5>::ET_Z:
02730 {
02731
02732 vertices[4] = TreeNode(x-sz,y,
02733 zp, m_uiMaxDepth, m_uiDimension,
02734 m_uiMaxDepth);
02735
02736 break;
02737 }
02738 case cNumEtype<5>::ET_ZY:
02739 {
02740
02741 vertices[4] = TreeNode(x-sz,y,
02742 zp, m_uiMaxDepth, m_uiDimension,
02743 m_uiMaxDepth);
02744
02745 vertices[1] = TreeNode(xp,y,
02746 z-sz, m_uiMaxDepth, m_uiDimension,
02747 m_uiMaxDepth);
02748
02749 break;
02750 }
02751 case cNumEtype<5>::ET_ZX:
02752 {
02753
02754 vertices[4] = TreeNode(x-sz,y,
02755 zp, m_uiMaxDepth, m_uiDimension,
02756 m_uiMaxDepth);
02757
02758 vertices[7] = TreeNode(xp,yp+sz,
02759 zp, m_uiMaxDepth, m_uiDimension,
02760 m_uiMaxDepth);
02761
02762 break;
02763 }
02764 case cNumEtype<5>::ET_ZXY:
02765 {
02766
02767 vertices[4] = TreeNode(x-sz,y,
02768 zp, m_uiMaxDepth, m_uiDimension,
02769 m_uiMaxDepth);
02770
02771 vertices[7] = TreeNode(xp,yp+sz,
02772 zp, m_uiMaxDepth, m_uiDimension,
02773 m_uiMaxDepth);
02774
02775 vertices[1] = TreeNode(xp,y,
02776 z-sz, m_uiMaxDepth, m_uiDimension,
02777 m_uiMaxDepth);
02778
02779 break;
02780 }
02781 case cNumEtype<5>::ET_XY_XY:
02782 {
02783
02784 vertices[3] = TreeNode(xp,yp+sz,
02785 z-sz, m_uiMaxDepth, m_uiDimension,
02786 m_uiMaxDepth);
02787
02788 vertices[7] = TreeNode(xp,yp+sz,
02789 zp, m_uiMaxDepth, m_uiDimension,
02790 m_uiMaxDepth);
02791
02792 vertices[1] = TreeNode(xp,y,
02793 z-sz, m_uiMaxDepth, m_uiDimension,
02794 m_uiMaxDepth);
02795
02796 break;
02797 }
02798 case cNumEtype<5>::ET_XY_ZXY:
02799 {
02800
02801 vertices[3] = TreeNode(xp,yp+sz,
02802 z-sz, m_uiMaxDepth, m_uiDimension,
02803 m_uiMaxDepth);
02804
02805 vertices[4] = TreeNode(x-sz,y,
02806 zp, m_uiMaxDepth, m_uiDimension,
02807 m_uiMaxDepth);
02808
02809 vertices[7] = TreeNode(xp,yp+sz,
02810 zp, m_uiMaxDepth, m_uiDimension,
02811 m_uiMaxDepth);
02812
02813 vertices[1] = TreeNode(xp,y,
02814 z-sz, m_uiMaxDepth, m_uiDimension,
02815 m_uiMaxDepth);
02816
02817 break;
02818 }
02819 case cNumEtype<5>::ET_YZ_ZY:
02820 {
02821
02822 vertices[4] = TreeNode(x-sz,y,
02823 zp, m_uiMaxDepth, m_uiDimension,
02824 m_uiMaxDepth);
02825
02826 vertices[1] = TreeNode(xp,y,
02827 z-sz, m_uiMaxDepth, m_uiDimension,
02828 m_uiMaxDepth);
02829
02830 vertices[0] = TreeNode(x-sz,y,
02831 z-sz, m_uiMaxDepth, m_uiDimension,
02832 m_uiMaxDepth);
02833
02834 break;
02835 }
02836 case cNumEtype<5>::ET_YZ_ZXY:
02837 {
02838
02839 vertices[4] = TreeNode(x-sz,y,
02840 zp, m_uiMaxDepth, m_uiDimension,
02841 m_uiMaxDepth);
02842
02843 vertices[7] = TreeNode(xp,yp+sz,
02844 zp, m_uiMaxDepth, m_uiDimension,
02845 m_uiMaxDepth);
02846
02847 vertices[1] = TreeNode(xp,y,
02848 z-sz, m_uiMaxDepth, m_uiDimension,
02849 m_uiMaxDepth);
02850
02851 vertices[0] = TreeNode(x-sz,y,
02852 z-sz, m_uiMaxDepth, m_uiDimension,
02853 m_uiMaxDepth);
02854
02855 break;
02856 }
02857 case cNumEtype<5>::ET_YZ_XY_ZXY:
02858 {
02859
02860 vertices[3] = TreeNode(xp,yp+sz,
02861 z-sz, m_uiMaxDepth, m_uiDimension,
02862 m_uiMaxDepth);
02863
02864 vertices[4] = TreeNode(x-sz,y,
02865 zp, m_uiMaxDepth, m_uiDimension,
02866 m_uiMaxDepth);
02867
02868 vertices[7] = TreeNode(xp,yp+sz,
02869 zp, m_uiMaxDepth, m_uiDimension,
02870 m_uiMaxDepth);
02871
02872 vertices[1] = TreeNode(xp,y,
02873 z-sz, m_uiMaxDepth, m_uiDimension,
02874 m_uiMaxDepth);
02875
02876 vertices[0] = TreeNode(x-sz,y,
02877 z-sz, m_uiMaxDepth, m_uiDimension,
02878 m_uiMaxDepth);
02879
02880 break;
02881 }
02882 case cNumEtype<5>::ET_ZX_ZX:
02883 {
02884
02885 vertices[4] = TreeNode(x-sz,y,
02886 zp, m_uiMaxDepth, m_uiDimension,
02887 m_uiMaxDepth);
02888
02889 vertices[7] = TreeNode(xp,yp+sz,
02890 zp, m_uiMaxDepth, m_uiDimension,
02891 m_uiMaxDepth);
02892
02893 vertices[6] = TreeNode(x-sz,yp+sz,
02894 zp, m_uiMaxDepth, m_uiDimension,
02895 m_uiMaxDepth);
02896
02897 break;
02898 }
02899 case cNumEtype<5>::ET_ZX_ZXY:
02900 {
02901
02902 vertices[4] = TreeNode(x-sz,y,
02903 zp, m_uiMaxDepth, m_uiDimension,
02904 m_uiMaxDepth);
02905
02906 vertices[7] = TreeNode(xp,yp+sz,
02907 zp, m_uiMaxDepth, m_uiDimension,
02908 m_uiMaxDepth);
02909
02910 vertices[1] = TreeNode(xp,y,
02911 z-sz, m_uiMaxDepth, m_uiDimension,
02912 m_uiMaxDepth);
02913
02914 vertices[6] = TreeNode(x-sz,yp+sz,
02915 zp, m_uiMaxDepth, m_uiDimension,
02916 m_uiMaxDepth);
02917
02918 break;
02919 }
02920 case cNumEtype<5>::ET_ZX_XY_ZXY:
02921 {
02922
02923 vertices[3] = TreeNode(xp,yp+sz,
02924 z-sz, m_uiMaxDepth, m_uiDimension,
02925 m_uiMaxDepth);
02926
02927 vertices[4] = TreeNode(x-sz,y,
02928 zp, m_uiMaxDepth, m_uiDimension,
02929 m_uiMaxDepth);
02930
02931 vertices[7] = TreeNode(xp,yp+sz,
02932 zp, m_uiMaxDepth, m_uiDimension,
02933 m_uiMaxDepth);
02934
02935 vertices[1] = TreeNode(xp,y,
02936 z-sz, m_uiMaxDepth, m_uiDimension,
02937 m_uiMaxDepth);
02938
02939 vertices[6] = TreeNode(x-sz,yp+sz,
02940 zp, m_uiMaxDepth, m_uiDimension,
02941 m_uiMaxDepth);
02942
02943 break;
02944 }
02945 case cNumEtype<5>::ET_ZX_YZ_ZXY:
02946 {
02947
02948 vertices[4] = TreeNode(x-sz,y,
02949 zp, m_uiMaxDepth, m_uiDimension,
02950 m_uiMaxDepth);
02951
02952 vertices[7] = TreeNode(xp,yp+sz,
02953 zp, m_uiMaxDepth, m_uiDimension,
02954 m_uiMaxDepth);
02955
02956 vertices[1] = TreeNode(xp,y,
02957 z-sz, m_uiMaxDepth, m_uiDimension,
02958 m_uiMaxDepth);
02959
02960 vertices[6] = TreeNode(x-sz,yp+sz,
02961 zp, m_uiMaxDepth, m_uiDimension,
02962 m_uiMaxDepth);
02963
02964 vertices[0] = TreeNode(x-sz,y,
02965 z-sz, m_uiMaxDepth, m_uiDimension,
02966 m_uiMaxDepth);
02967
02968 break;
02969 }
02970 case cNumEtype<5>::ET_ZX_YZ_XY_ZXY:
02971 {
02972
02973 vertices[3] = TreeNode(xp,yp+sz,
02974 z-sz, m_uiMaxDepth, m_uiDimension,
02975 m_uiMaxDepth);
02976
02977 vertices[4] = TreeNode(x-sz,y,
02978 zp, m_uiMaxDepth, m_uiDimension,
02979 m_uiMaxDepth);
02980
02981 vertices[7] = TreeNode(xp,yp+sz,
02982 zp, m_uiMaxDepth, m_uiDimension,
02983 m_uiMaxDepth);
02984
02985 vertices[1] = TreeNode(xp,y,
02986 z-sz, m_uiMaxDepth, m_uiDimension,
02987 m_uiMaxDepth);
02988
02989 vertices[6] = TreeNode(x-sz,yp+sz,
02990 zp, m_uiMaxDepth, m_uiDimension,
02991 m_uiMaxDepth);
02992
02993 vertices[0] = TreeNode(x-sz,y,
02994 z-sz, m_uiMaxDepth, m_uiDimension,
02995 m_uiMaxDepth);
02996
02997 break;
02998 }
02999 default:
03000 assert(false);
03001
03002 }
03003
03004
03005 break;
03006 }
03007 case 6:
03008 {
03009
03010
03011 switch( hnMask ) {
03012 case cNumEtype<6>::ET_Y:
03013 {
03014
03015 vertices[2] = TreeNode(x,yp,
03016 z-sz, m_uiMaxDepth, m_uiDimension,
03017 m_uiMaxDepth);
03018
03019 break;
03020 }
03021 case cNumEtype<6>::ET_X:
03022 {
03023
03024 vertices[4] = TreeNode(x,y-sz,
03025 zp, m_uiMaxDepth, m_uiDimension,
03026 m_uiMaxDepth);
03027
03028 break;
03029 }
03030 case cNumEtype<6>::ET_XY:
03031 {
03032
03033 vertices[4] = TreeNode(x,y-sz,
03034 zp, m_uiMaxDepth, m_uiDimension,
03035 m_uiMaxDepth);
03036
03037 vertices[2] = TreeNode(x,yp,
03038 z-sz, m_uiMaxDepth, m_uiDimension,
03039 m_uiMaxDepth);
03040
03041 break;
03042 }
03043 case cNumEtype<6>::ET_Z:
03044 {
03045
03046 vertices[7] = TreeNode(xp+sz,yp,
03047 zp, m_uiMaxDepth, m_uiDimension,
03048 m_uiMaxDepth);
03049
03050 break;
03051 }
03052 case cNumEtype<6>::ET_ZY:
03053 {
03054
03055 vertices[7] = TreeNode(xp+sz,yp,
03056 zp, m_uiMaxDepth, m_uiDimension,
03057 m_uiMaxDepth);
03058
03059 vertices[2] = TreeNode(x,yp,
03060 z-sz, m_uiMaxDepth, m_uiDimension,
03061 m_uiMaxDepth);
03062
03063 break;
03064 }
03065 case cNumEtype<6>::ET_ZX:
03066 {
03067
03068 vertices[4] = TreeNode(x,y-sz,
03069 zp, m_uiMaxDepth, m_uiDimension,
03070 m_uiMaxDepth);
03071
03072 vertices[7] = TreeNode(xp+sz,yp,
03073 zp, m_uiMaxDepth, m_uiDimension,
03074 m_uiMaxDepth);
03075
03076 break;
03077 }
03078 case cNumEtype<6>::ET_ZXY:
03079 {
03080
03081 vertices[4] = TreeNode(x,y-sz,
03082 zp, m_uiMaxDepth, m_uiDimension,
03083 m_uiMaxDepth);
03084
03085 vertices[7] = TreeNode(xp+sz,yp,
03086 zp, m_uiMaxDepth, m_uiDimension,
03087 m_uiMaxDepth);
03088
03089 vertices[2] = TreeNode(x,yp,
03090 z-sz, m_uiMaxDepth, m_uiDimension,
03091 m_uiMaxDepth);
03092
03093 break;
03094 }
03095 case cNumEtype<6>::ET_XY_XY:
03096 {
03097
03098 vertices[4] = TreeNode(x,y-sz,
03099 zp, m_uiMaxDepth, m_uiDimension,
03100 m_uiMaxDepth);
03101
03102 vertices[2] = TreeNode(x,yp,
03103 z-sz, m_uiMaxDepth, m_uiDimension,
03104 m_uiMaxDepth);
03105
03106 vertices[0] = TreeNode(x,y-sz,
03107 z-sz, m_uiMaxDepth, m_uiDimension,
03108 m_uiMaxDepth);
03109
03110 break;
03111 }
03112 case cNumEtype<6>::ET_XY_ZXY:
03113 {
03114
03115 vertices[4] = TreeNode(x,y-sz,
03116 zp, m_uiMaxDepth, m_uiDimension,
03117 m_uiMaxDepth);
03118
03119 vertices[7] = TreeNode(xp+sz,yp,
03120 zp, m_uiMaxDepth, m_uiDimension,
03121 m_uiMaxDepth);
03122
03123 vertices[2] = TreeNode(x,yp,
03124 z-sz, m_uiMaxDepth, m_uiDimension,
03125 m_uiMaxDepth);
03126
03127 vertices[0] = TreeNode(x,y-sz,
03128 z-sz, m_uiMaxDepth, m_uiDimension,
03129 m_uiMaxDepth);
03130
03131 break;
03132 }
03133 case cNumEtype<6>::ET_YZ_ZY:
03134 {
03135
03136 vertices[3] = TreeNode(xp+sz,yp,
03137 z-sz, m_uiMaxDepth, m_uiDimension,
03138 m_uiMaxDepth);
03139
03140 vertices[7] = TreeNode(xp+sz,yp,
03141 zp, m_uiMaxDepth, m_uiDimension,
03142 m_uiMaxDepth);
03143
03144 vertices[2] = TreeNode(x,yp,
03145 z-sz, m_uiMaxDepth, m_uiDimension,
03146 m_uiMaxDepth);
03147
03148 break;
03149 }
03150 case cNumEtype<6>::ET_YZ_ZXY:
03151 {
03152
03153 vertices[3] = TreeNode(xp+sz,yp,
03154 z-sz, m_uiMaxDepth, m_uiDimension,
03155 m_uiMaxDepth);
03156
03157 vertices[4] = TreeNode(x,y-sz,
03158 zp, m_uiMaxDepth, m_uiDimension,
03159 m_uiMaxDepth);
03160
03161 vertices[7] = TreeNode(xp+sz,yp,
03162 zp, m_uiMaxDepth, m_uiDimension,
03163 m_uiMaxDepth);
03164
03165 vertices[2] = TreeNode(x,yp,
03166 z-sz, m_uiMaxDepth, m_uiDimension,
03167 m_uiMaxDepth);
03168
03169 break;
03170 }
03171 case cNumEtype<6>::ET_YZ_XY_ZXY:
03172 {
03173
03174 vertices[3] = TreeNode(xp+sz,yp,
03175 z-sz, m_uiMaxDepth, m_uiDimension,
03176 m_uiMaxDepth);
03177
03178 vertices[4] = TreeNode(x,y-sz,
03179 zp, m_uiMaxDepth, m_uiDimension,
03180 m_uiMaxDepth);
03181
03182 vertices[7] = TreeNode(xp+sz,yp,
03183 zp, m_uiMaxDepth, m_uiDimension,
03184 m_uiMaxDepth);
03185
03186 vertices[2] = TreeNode(x,yp,
03187 z-sz, m_uiMaxDepth, m_uiDimension,
03188 m_uiMaxDepth);
03189
03190 vertices[0] = TreeNode(x,y-sz,
03191 z-sz, m_uiMaxDepth, m_uiDimension,
03192 m_uiMaxDepth);
03193
03194 break;
03195 }
03196 case cNumEtype<6>::ET_ZX_ZX:
03197 {
03198
03199 vertices[4] = TreeNode(x,y-sz,
03200 zp, m_uiMaxDepth, m_uiDimension,
03201 m_uiMaxDepth);
03202
03203 vertices[7] = TreeNode(xp+sz,yp,
03204 zp, m_uiMaxDepth, m_uiDimension,
03205 m_uiMaxDepth);
03206
03207 vertices[5] = TreeNode(xp+sz,y-sz,
03208 zp, m_uiMaxDepth, m_uiDimension,
03209 m_uiMaxDepth);
03210
03211 break;
03212 }
03213 case cNumEtype<6>::ET_ZX_ZXY:
03214 {
03215
03216 vertices[4] = TreeNode(x,y-sz,
03217 zp, m_uiMaxDepth, m_uiDimension,
03218 m_uiMaxDepth);
03219
03220 vertices[7] = TreeNode(xp+sz,yp,
03221 zp, m_uiMaxDepth, m_uiDimension,
03222 m_uiMaxDepth);
03223
03224 vertices[2] = TreeNode(x,yp,
03225 z-sz, m_uiMaxDepth, m_uiDimension,
03226 m_uiMaxDepth);
03227
03228 vertices[5] = TreeNode(xp+sz,y-sz,
03229 zp, m_uiMaxDepth, m_uiDimension,
03230 m_uiMaxDepth);
03231
03232 break;
03233 }
03234 case cNumEtype<6>::ET_ZX_XY_ZXY:
03235 {
03236
03237 vertices[4] = TreeNode(x,y-sz,
03238 zp, m_uiMaxDepth, m_uiDimension,
03239 m_uiMaxDepth);
03240
03241 vertices[7] = TreeNode(xp+sz,yp,
03242 zp, m_uiMaxDepth, m_uiDimension,
03243 m_uiMaxDepth);
03244
03245 vertices[2] = TreeNode(x,yp,
03246 z-sz, m_uiMaxDepth, m_uiDimension,
03247 m_uiMaxDepth);
03248
03249 vertices[5] = TreeNode(xp+sz,y-sz,
03250 zp, m_uiMaxDepth, m_uiDimension,
03251 m_uiMaxDepth);
03252
03253 vertices[0] = TreeNode(x,y-sz,
03254 z-sz, m_uiMaxDepth, m_uiDimension,
03255 m_uiMaxDepth);
03256
03257 break;
03258 }
03259 case cNumEtype<6>::ET_ZX_YZ_ZXY:
03260 {
03261
03262 vertices[3] = TreeNode(xp+sz,yp,
03263 z-sz, m_uiMaxDepth, m_uiDimension,
03264 m_uiMaxDepth);
03265
03266 vertices[4] = TreeNode(x,y-sz,
03267 zp, m_uiMaxDepth, m_uiDimension,
03268 m_uiMaxDepth);
03269
03270 vertices[7] = TreeNode(xp+sz,yp,
03271 zp, m_uiMaxDepth, m_uiDimension,
03272 m_uiMaxDepth);
03273
03274 vertices[2] = TreeNode(x,yp,
03275 z-sz, m_uiMaxDepth, m_uiDimension,
03276 m_uiMaxDepth);
03277
03278 vertices[5] = TreeNode(xp+sz,y-sz,
03279 zp, m_uiMaxDepth, m_uiDimension,
03280 m_uiMaxDepth);
03281
03282 break;
03283 }
03284 case cNumEtype<6>::ET_ZX_YZ_XY_ZXY:
03285 {
03286
03287 vertices[3] = TreeNode(xp+sz,yp,
03288 z-sz, m_uiMaxDepth, m_uiDimension,
03289 m_uiMaxDepth);
03290
03291 vertices[4] = TreeNode(x,y-sz,
03292 zp, m_uiMaxDepth, m_uiDimension,
03293 m_uiMaxDepth);
03294
03295 vertices[7] = TreeNode(xp+sz,yp,
03296 zp, m_uiMaxDepth, m_uiDimension,
03297 m_uiMaxDepth);
03298
03299 vertices[2] = TreeNode(x,yp,
03300 z-sz, m_uiMaxDepth, m_uiDimension,
03301 m_uiMaxDepth);
03302
03303 vertices[5] = TreeNode(xp+sz,y-sz,
03304 zp, m_uiMaxDepth, m_uiDimension,
03305 m_uiMaxDepth);
03306
03307 vertices[0] = TreeNode(x,y-sz,
03308 z-sz, m_uiMaxDepth, m_uiDimension,
03309 m_uiMaxDepth);
03310
03311 break;
03312 }
03313 default:
03314 assert(false);
03315
03316 }
03317
03318 break;
03319 }
03320 case 7:
03321 {
03322
03323
03324 switch( hnMask ) {
03325 case cNumEtype<7>::ET_Y:
03326 {
03327
03328 vertices[3] = TreeNode(xp,yp,
03329 z-sz, m_uiMaxDepth, m_uiDimension,
03330 m_uiMaxDepth);
03331
03332 break;
03333 }
03334 case cNumEtype<7>::ET_X:
03335 {
03336
03337 vertices[6] = TreeNode(x-sz,yp,
03338 zp, m_uiMaxDepth, m_uiDimension,
03339 m_uiMaxDepth);
03340
03341 break;
03342 }
03343 case cNumEtype<7>::ET_XY:
03344 {
03345
03346 vertices[3] = TreeNode(xp,yp,
03347 z-sz, m_uiMaxDepth, m_uiDimension,
03348 m_uiMaxDepth);
03349
03350 vertices[6] = TreeNode(x-sz,yp,
03351 zp, m_uiMaxDepth, m_uiDimension,
03352 m_uiMaxDepth);
03353
03354 break;
03355 }
03356 case cNumEtype<7>::ET_Z:
03357 {
03358
03359 vertices[5] = TreeNode(xp,y-sz,
03360 zp, m_uiMaxDepth, m_uiDimension,
03361 m_uiMaxDepth);
03362
03363 break;
03364 }
03365 case cNumEtype<7>::ET_ZY:
03366 {
03367
03368 vertices[3] = TreeNode(xp,yp,
03369 z-sz, m_uiMaxDepth, m_uiDimension,
03370 m_uiMaxDepth);
03371
03372 vertices[5] = TreeNode(xp,y-sz,
03373 zp, m_uiMaxDepth, m_uiDimension,
03374 m_uiMaxDepth);
03375
03376 break;
03377 }
03378 case cNumEtype<7>::ET_ZX:
03379 {
03380
03381 vertices[6] = TreeNode(x-sz,yp,
03382 zp, m_uiMaxDepth, m_uiDimension,
03383 m_uiMaxDepth);
03384
03385 vertices[5] = TreeNode(xp,y-sz,
03386 zp, m_uiMaxDepth, m_uiDimension,
03387 m_uiMaxDepth);
03388
03389 break;
03390 }
03391 case cNumEtype<7>::ET_ZXY:
03392 {
03393
03394 vertices[3] = TreeNode(xp,yp,
03395 z-sz, m_uiMaxDepth, m_uiDimension,
03396 m_uiMaxDepth);
03397
03398 vertices[6] = TreeNode(x-sz,yp,
03399 zp, m_uiMaxDepth, m_uiDimension,
03400 m_uiMaxDepth);
03401
03402 vertices[5] = TreeNode(xp,y-sz,
03403 zp, m_uiMaxDepth, m_uiDimension,
03404 m_uiMaxDepth);
03405
03406 break;
03407 }
03408 case cNumEtype<7>::ET_XY_XY:
03409 {
03410
03411 vertices[3] = TreeNode(xp,yp,
03412 z-sz, m_uiMaxDepth, m_uiDimension,
03413 m_uiMaxDepth);
03414
03415 vertices[2] = TreeNode(x-sz,yp,
03416 z-sz, m_uiMaxDepth, m_uiDimension,
03417 m_uiMaxDepth);
03418
03419 vertices[6] = TreeNode(x-sz,yp,
03420 zp, m_uiMaxDepth, m_uiDimension,
03421 m_uiMaxDepth);
03422
03423 break;
03424 }
03425 case cNumEtype<7>::ET_XY_ZXY:
03426 {
03427
03428 vertices[3] = TreeNode(xp,yp,
03429 z-sz, m_uiMaxDepth, m_uiDimension,
03430 m_uiMaxDepth);
03431
03432 vertices[2] = TreeNode(x-sz,yp,
03433 z-sz, m_uiMaxDepth, m_uiDimension,
03434 m_uiMaxDepth);
03435
03436 vertices[6] = TreeNode(x-sz,yp,
03437 zp, m_uiMaxDepth, m_uiDimension,
03438 m_uiMaxDepth);
03439
03440 vertices[5] = TreeNode(xp,y-sz,
03441 zp, m_uiMaxDepth, m_uiDimension,
03442 m_uiMaxDepth);
03443
03444 break;
03445 }
03446 case cNumEtype<7>::ET_YZ_ZY:
03447 {
03448
03449 vertices[3] = TreeNode(xp,yp,
03450 z-sz, m_uiMaxDepth, m_uiDimension,
03451 m_uiMaxDepth);
03452
03453 vertices[1] = TreeNode(xp,y-sz,
03454 z-sz, m_uiMaxDepth, m_uiDimension,
03455 m_uiMaxDepth);
03456
03457 vertices[5] = TreeNode(xp,y-sz,
03458 zp, m_uiMaxDepth, m_uiDimension,
03459 m_uiMaxDepth);
03460
03461 break;
03462 }
03463 case cNumEtype<7>::ET_YZ_ZXY:
03464 {
03465
03466 vertices[3] = TreeNode(xp,yp,
03467 z-sz, m_uiMaxDepth, m_uiDimension,
03468 m_uiMaxDepth);
03469
03470 vertices[1] = TreeNode(xp,y-sz,
03471 z-sz, m_uiMaxDepth, m_uiDimension,
03472 m_uiMaxDepth);
03473
03474 vertices[6] = TreeNode(x-sz,yp,
03475 zp, m_uiMaxDepth, m_uiDimension,
03476 m_uiMaxDepth);
03477
03478 vertices[5] = TreeNode(xp,y-sz,
03479 zp, m_uiMaxDepth, m_uiDimension,
03480 m_uiMaxDepth);
03481
03482 break;
03483 }
03484 case cNumEtype<7>::ET_YZ_XY_ZXY:
03485 {
03486
03487 vertices[3] = TreeNode(xp,yp,
03488 z-sz, m_uiMaxDepth, m_uiDimension,
03489 m_uiMaxDepth);
03490
03491 vertices[2] = TreeNode(x-sz,yp,
03492 z-sz, m_uiMaxDepth, m_uiDimension,
03493 m_uiMaxDepth);
03494
03495 vertices[1] = TreeNode(xp,y-sz,
03496 z-sz, m_uiMaxDepth, m_uiDimension,
03497 m_uiMaxDepth);
03498
03499 vertices[6] = TreeNode(x-sz,yp,
03500 zp, m_uiMaxDepth, m_uiDimension,
03501 m_uiMaxDepth);
03502
03503 vertices[5] = TreeNode(xp,y-sz,
03504 zp, m_uiMaxDepth, m_uiDimension,
03505 m_uiMaxDepth);
03506
03507 break;
03508 }
03509 case cNumEtype<7>::ET_ZX_ZX:
03510 {
03511
03512 vertices[4] = TreeNode(x-sz,y-sz,
03513 zp, m_uiMaxDepth, m_uiDimension,
03514 m_uiMaxDepth);
03515
03516 vertices[6] = TreeNode(x-sz,yp,
03517 zp, m_uiMaxDepth, m_uiDimension,
03518 m_uiMaxDepth);
03519
03520 vertices[5] = TreeNode(xp,y-sz,
03521 zp, m_uiMaxDepth, m_uiDimension,
03522 m_uiMaxDepth);
03523
03524 break;
03525 }
03526 case cNumEtype<7>::ET_ZX_ZXY:
03527 {
03528
03529 vertices[3] = TreeNode(xp,yp,
03530 z-sz, m_uiMaxDepth, m_uiDimension,
03531 m_uiMaxDepth);
03532
03533 vertices[4] = TreeNode(x-sz,y-sz,
03534 zp, m_uiMaxDepth, m_uiDimension,
03535 m_uiMaxDepth);
03536
03537 vertices[6] = TreeNode(x-sz,yp,
03538 zp, m_uiMaxDepth, m_uiDimension,
03539 m_uiMaxDepth);
03540
03541 vertices[5] = TreeNode(xp,y-sz,
03542 zp, m_uiMaxDepth, m_uiDimension,
03543 m_uiMaxDepth);
03544
03545 break;
03546 }
03547 case cNumEtype<7>::ET_ZX_XY_ZXY:
03548 {
03549
03550 vertices[3] = TreeNode(xp,yp,
03551 z-sz, m_uiMaxDepth, m_uiDimension,
03552 m_uiMaxDepth);
03553
03554 vertices[4] = TreeNode(x-sz,y-sz,
03555 zp, m_uiMaxDepth, m_uiDimension,
03556 m_uiMaxDepth);
03557
03558 vertices[2] = TreeNode(x-sz,yp,
03559 z-sz, m_uiMaxDepth, m_uiDimension,
03560 m_uiMaxDepth);
03561
03562 vertices[6] = TreeNode(x-sz,yp,
03563 zp, m_uiMaxDepth, m_uiDimension,
03564 m_uiMaxDepth);
03565
03566 vertices[5] = TreeNode(xp,y-sz,
03567 zp, m_uiMaxDepth, m_uiDimension,
03568 m_uiMaxDepth);
03569
03570 break;
03571 }
03572 case cNumEtype<7>::ET_ZX_YZ_ZXY:
03573 {
03574
03575 vertices[3] = TreeNode(xp,yp,
03576 z-sz, m_uiMaxDepth, m_uiDimension,
03577 m_uiMaxDepth);
03578
03579 vertices[4] = TreeNode(x-sz,y-sz,
03580 zp, m_uiMaxDepth, m_uiDimension,
03581 m_uiMaxDepth);
03582
03583 vertices[1] = TreeNode(xp,y-sz,
03584 z-sz, m_uiMaxDepth, m_uiDimension,
03585 m_uiMaxDepth);
03586
03587 vertices[6] = TreeNode(x-sz,yp,
03588 zp, m_uiMaxDepth, m_uiDimension,
03589 m_uiMaxDepth);
03590
03591 vertices[5] = TreeNode(xp,y-sz,
03592 zp, m_uiMaxDepth, m_uiDimension,
03593 m_uiMaxDepth);
03594
03595 break;
03596 }
03597 case cNumEtype<7>::ET_ZX_YZ_XY_ZXY:
03598 {
03599
03600 vertices[3] = TreeNode(xp,yp,
03601 z-sz, m_uiMaxDepth, m_uiDimension,
03602 m_uiMaxDepth);
03603
03604 vertices[4] = TreeNode(x-sz,y-sz,
03605 zp, m_uiMaxDepth, m_uiDimension,
03606 m_uiMaxDepth);
03607
03608 vertices[2] = TreeNode(x-sz,yp,
03609 z-sz, m_uiMaxDepth, m_uiDimension,
03610 m_uiMaxDepth);
03611
03612 vertices[1] = TreeNode(xp,y-sz,
03613 z-sz, m_uiMaxDepth, m_uiDimension,
03614 m_uiMaxDepth);
03615
03616 vertices[6] = TreeNode(x-sz,yp,
03617 zp, m_uiMaxDepth, m_uiDimension,
03618 m_uiMaxDepth);
03619
03620 vertices[5] = TreeNode(xp,y-sz,
03621 zp, m_uiMaxDepth, m_uiDimension,
03622 m_uiMaxDepth);
03623
03624 break;
03625 }
03626 default:
03627 assert(false);
03628
03629 }
03630
03631 break;
03632 }
03633 default:
03634 assert(false);
03635 }
03636
03637
03638 std::vector<seq::IndexHolder<ot::TreeNode> > idxHolder(8);
03639 {
03640 idxHolder[0].value = &vertices[0];
03641 idxHolder[0].index = 0;
03642
03643 idxHolder[1].value = &vertices[1];
03644 idxHolder[1].index = 1;
03645
03646 idxHolder[2].value = &vertices[2];
03647 idxHolder[2].index = 2;
03648
03649 idxHolder[3].value = &vertices[3];
03650 idxHolder[3].index = 3;
03651
03652 idxHolder[4].value = &vertices[4];
03653 idxHolder[4].index = 4;
03654
03655 idxHolder[5].value = &vertices[5];
03656 idxHolder[5].index = 5;
03657
03658 idxHolder[6].value = &vertices[6];
03659 idxHolder[6].index = 6;
03660
03661 idxHolder[7].value = &vertices[7];
03662 idxHolder[7].index = 7;
03663 }
03664
03665 sort < seq::IndexHolder<ot::TreeNode> *> (&(*idxHolder.begin()), 8);
03666
03667 for (int k = 0; k < 8; k++) {
03668 nodes[idxHolder[k].index] = nn[k];
03669 }
03670
03671 } else {
03672
03673 nodes[0] = nn[0];
03674 switch(m_ucpSortOrdersPtr[m_uiCurrent]) {
03675 case ot::DA_FLAGS::ZYX: {
03676 nodes[4] = nn[1];
03677 nodes[2] = nn[2];
03678 nodes[6] = nn[3];
03679 nodes[1] = nn[4];
03680 nodes[5] = nn[5];
03681 nodes[3] = nn[6];
03682 break;
03683 }
03684 case ot::DA_FLAGS::YZX: {
03685 nodes[2] = nn[1];
03686 nodes[4] = nn[2];
03687 nodes[6] = nn[3];
03688 nodes[1] = nn[4];
03689 nodes[3] = nn[5];
03690 nodes[5] = nn[6];
03691 break;
03692 }
03693 case ot::DA_FLAGS::YXZ: {
03694 nodes[2] = nn[1];
03695 nodes[1] = nn[2];
03696 nodes[3] = nn[3];
03697 nodes[4] = nn[4];
03698 nodes[6] = nn[5];
03699 nodes[5] = nn[6];
03700 break;
03701 }
03702 case ot::DA_FLAGS::ZXY: {
03703 nodes[4] = nn[1];
03704 nodes[1] = nn[2];
03705 nodes[5] = nn[3];
03706 nodes[2] = nn[4];
03707 nodes[6] = nn[5];
03708 nodes[3] = nn[6];
03709 break;
03710 }
03711 case ot::DA_FLAGS::XZY: {
03712 nodes[1] = nn[1];
03713 nodes[4] = nn[2];
03714 nodes[5] = nn[3];
03715 nodes[2] = nn[4];
03716 nodes[3] = nn[5];
03717 nodes[6] = nn[6];
03718 break;
03719 }
03720 case ot::DA_FLAGS::XYZ: {
03721 nodes[1] = nn[1];
03722 nodes[2] = nn[2];
03723 nodes[3] = nn[3];
03724 nodes[4] = nn[4];
03725 nodes[5] = nn[5];
03726 nodes[6] = nn[6];
03727 break;
03728 }
03729 }
03730 nodes[7] = nn[7];
03731 }
03732 #ifdef __DEBUG_DA__
03733 for ( unsigned int i=0; i<8; i++) {
03734 if (nodes[i] >= m_uiLocalBufferSize) {
03735 std::cout << m_iRankActive << RED" Node index is out of bounds( "<<nodes[i]<<" ) for element "NRM<< m_uiCurrent << std::endl;
03736 std::cout << m_iRankActive << " preElem: "<<m_uiPreGhostElementSize<<" elemBeg: "<<m_uiElementBegin<<" elemEnd: "<<m_uiElementEnd<<" postBeg: "<<m_uiPostGhostBegin<<" bufSz: "<<m_uiLocalBufferSize << std::endl;
03737 std::cout<<"CNum: "<<this->getChildNumber()<<std::endl;
03738 std::cout<<"nlist after decompression..."<<std::endl;
03739 for(unsigned int j=0; j< 8; j++) {
03740 std::cout<<nodes[j]<<", ";
03741 }
03742 std::cout<<std::endl;
03743 assert(false);
03744 }
03745 }
03746 #endif
03747 }
03748 return(0);
03749 }
03750
03751 template <typename T>
03752 void injectNodalVector(ot::DA* dac, ot::DA* daf, unsigned int dof,
03753 std::vector<T>& fVec, std::vector<T>& cVec, void (*setZero)(T&)) {
03754
03755 dac->createVector<T>(cVec, false, false, dof);
03756
03757 T* cArr = NULL;
03758 T* fArr = NULL;
03759 dac->vecGetBuffer<T>(cVec, cArr, false, false, false, dof);
03760 daf->vecGetBuffer<T>(fVec, fArr, false, false, true, dof);
03761
03762 for(int i = 0; i < (dof*(dac->getLocalBufferSize())); i++) {
03763 (*setZero)(cArr[i]);
03764 }
03765
03766 daf->ReadFromGhostsBegin<T>(fArr, dof);
03767 daf->ReadFromGhostsEnd<T>(fArr);
03768
03769 if(dac->iAmActive()) {
03770 for(dac->init<ot::DA_FLAGS::WRITABLE>(), daf->init<ot::DA_FLAGS::WRITABLE>();
03771 dac->curr() < dac->end<ot::DA_FLAGS::WRITABLE>();
03772 dac->next<ot::DA_FLAGS::WRITABLE>()) {
03773 unsigned int idxC = dac->curr();
03774 Point cPt = dac->getCurrentOffset();
03775 Point fPt = daf->getCurrentOffset();
03776 assert(cPt == fPt);
03777 unsigned char currentFlags;
03778 unsigned char hnMask = dac->getHangingNodeIndex(idxC);
03779 bool isBoundary = dac->isBoundaryOctant(¤tFlags);
03780 unsigned int cIndices[8];
03781 if(currentFlags > ot::TreeNode::NEG_POS_DEMARCATION) {
03782
03783 dac->getNodeIndices(cIndices);
03784 } else {
03785 if(dac->isLUTcompressed()) {
03786 dac->updateQuotientCounter();
03787 }
03788 }
03789 int xPosBdy = (currentFlags & ot::TreeNode::X_POS_BDY);
03790 int yPosBdy = (currentFlags & ot::TreeNode::Y_POS_BDY);
03791 int zPosBdy = (currentFlags & ot::TreeNode::Z_POS_BDY);
03792 if(daf->getLevel(daf->curr()) == dac->getLevel(idxC)) {
03793 unsigned int idxF = daf->curr();
03794 unsigned int fIndices[8];
03795 if(currentFlags > ot::TreeNode::NEG_POS_DEMARCATION) {
03796 daf->getNodeIndices(fIndices);
03797 } else {
03798 if(daf->isLUTcompressed()) {
03799 daf->updateQuotientCounter();
03800 }
03801 }
03802 if(xPosBdy) {
03803 if(!(hnMask & (1<<1))) {
03804 for(int d = 0; d < dof; d++) {
03805 cArr[(dof*cIndices[1]) + d] = fArr[(dof*fIndices[1]) + d];
03806 }
03807 }
03808 }
03809 if(yPosBdy) {
03810 if(!(hnMask & (1<<2))) {
03811 for(int d = 0; d < dof; d++) {
03812 cArr[(dof*cIndices[2]) + d] = fArr[(dof*fIndices[2]) + d];
03813 }
03814 }
03815 }
03816 if(zPosBdy) {
03817 if(!(hnMask & (1<<4))) {
03818 for(int d = 0; d < dof; d++) {
03819 cArr[(dof*cIndices[4]) + d] = fArr[(dof*fIndices[4]) + d];
03820 }
03821 }
03822 }
03823 if(xPosBdy && yPosBdy) {
03824 if(!(hnMask & (1<<3))) {
03825 for(int d = 0; d < dof; d++) {
03826 cArr[(dof*cIndices[3]) + d] = fArr[(dof*fIndices[3]) + d];
03827 }
03828 }
03829 }
03830 if(xPosBdy && zPosBdy) {
03831 if(!(hnMask & (1<<5))) {
03832 for(int d = 0; d < dof; d++) {
03833 cArr[(dof*cIndices[5]) + d] = fArr[(dof*fIndices[5]) + d];
03834 }
03835 }
03836 }
03837 if(yPosBdy && zPosBdy) {
03838 if(!(hnMask & (1<<6))) {
03839 for(int d = 0; d < dof; d++) {
03840 cArr[(dof*cIndices[6]) + d] = fArr[(dof*fIndices[6]) + d];
03841 }
03842 }
03843 }
03844 if(xPosBdy && yPosBdy && zPosBdy) {
03845 if(!(hnMask & (1<<7))) {
03846 for(int d = 0; d < dof; d++) {
03847 cArr[(dof*cIndices[7]) + d] = fArr[(dof*fIndices[7]) + d];
03848 }
03849 }
03850 }
03851 if(!(hnMask & 1)) {
03852
03853 for(int d = 0; d < dof; d++) {
03854 cArr[(dof*idxC) + d] = fArr[(dof*idxF) + d];
03855 }
03856 }
03857 daf->next<ot::DA_FLAGS::WRITABLE>();
03858 } else {
03859 for(unsigned int cNumFine = 0; cNumFine < 8; cNumFine++) {
03860 unsigned int idxF = daf->curr();
03861 unsigned int fIndices[8];
03862 if(currentFlags > ot::TreeNode::NEG_POS_DEMARCATION) {
03863 daf->getNodeIndices(fIndices);
03864 } else {
03865 if(daf->isLUTcompressed()) {
03866 daf->updateQuotientCounter();
03867 }
03868 }
03869 if(xPosBdy) {
03870 if(cNumFine == 1) {
03871 if(!(hnMask & (1<<1))) {
03872 for(int d = 0; d < dof; d++) {
03873 cArr[(dof*cIndices[1]) + d] = fArr[(dof*fIndices[1]) + d];
03874 }
03875 }
03876 }
03877 }
03878 if(yPosBdy) {
03879 if(cNumFine == 2) {
03880 if(!(hnMask & (1<<2))) {
03881 for(int d = 0; d < dof; d++) {
03882 cArr[(dof*cIndices[2]) + d] = fArr[(dof*fIndices[2]) + d];
03883 }
03884 }
03885 }
03886 }
03887 if(zPosBdy) {
03888 if(cNumFine == 4) {
03889 if(!(hnMask & (1<<4))) {
03890 for(int d = 0; d < dof; d++) {
03891 cArr[(dof*cIndices[4]) + d] = fArr[(dof*fIndices[4]) + d];
03892 }
03893 }
03894 }
03895 }
03896 if(xPosBdy && yPosBdy) {
03897 if(cNumFine == 3) {
03898 if(!(hnMask & (1<<3))) {
03899 for(int d = 0; d < dof; d++) {
03900 cArr[(dof*cIndices[3]) + d] = fArr[(dof*fIndices[3]) + d];
03901 }
03902 }
03903 }
03904 }
03905 if(xPosBdy && zPosBdy) {
03906 if(cNumFine == 5) {
03907 if(!(hnMask & (1<<5))) {
03908 for(int d = 0; d < dof; d++) {
03909 cArr[(dof*cIndices[5]) + d] = fArr[(dof*fIndices[5]) + d];
03910 }
03911 }
03912 }
03913 }
03914 if(yPosBdy && zPosBdy) {
03915 if(cNumFine == 6) {
03916 if(!(hnMask & (1<<6))) {
03917 for(int d = 0; d < dof; d++) {
03918 cArr[(dof*cIndices[6]) + d] = fArr[(dof*fIndices[6]) + d];
03919 }
03920 }
03921 }
03922 }
03923 if(xPosBdy && yPosBdy && zPosBdy) {
03924 if(cNumFine == 7) {
03925 if(!(hnMask & (1<<7))) {
03926 for(int d = 0; d < dof; d++) {
03927 cArr[(dof*cIndices[7]) + d] = fArr[(dof*fIndices[7]) + d];
03928 }
03929 }
03930 }
03931 }
03932 if(cNumFine == 0) {
03933 if(!(hnMask & 1)) {
03934
03935 for(int d = 0; d < dof; d++) {
03936 cArr[(dof*idxC) + d] = fArr[(dof*idxF) + d];
03937 }
03938 }
03939 }
03940 daf->next<ot::DA_FLAGS::WRITABLE>();
03941 }
03942 }
03943 }
03944 }
03945
03946 dac->WriteToGhostsBegin<T>(cArr, dof);
03947 dac->WriteToGhostsEnd<T>(cArr, dof);
03948
03949 dac->vecRestoreBuffer<T>(cVec, cArr, false, false, false, dof);
03950 daf->vecRestoreBuffer<T>(fVec, fArr, false, false, true, dof);
03951 }
03952
03953 }
03954