- Timestamp:
- 01/23/07 00:11:50 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2015 r2019 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 22. I 17:10:45 20073 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 22. I 22:05:05 2007 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2015 r2019 5 5 #include <vector> 6 6 #include "common.h" 7 #include <math.h> 8 using namespace std; 7 9 8 10 namespace GtpVisibilityPreprocessor { … … 171 173 172 174 public: 173 174 Pvs(): mSamples(0), mEntries(), mLastSorted(0) {}175 176 Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {} 175 177 176 178 /** creates pvs and initializes it with the given entries. … … 312 314 // the last part should not be more than log of the sorted part. this 313 315 // way we can achieve logarithmic behaviour for insertion and find 314 const int dirtySize = (int)mEntries.size() - mLastSorted; 315 return dirtySize > 500; 316 // 4*(int)(log((double)mEntries.size()) / log(2.0)); 316 const int n = mEntries.size(); 317 const int dirtySize = n - mLastSorted; 318 319 #define LOG2E 1.442695040f 320 321 const float logN = log((float)max(1, n))/LOG2E; 322 const float logS = log((float)max(1, mLastSorted))/LOG2E; 323 const float logD = log((float)max(1, dirtySize))/LOG2E; 324 325 if (8*(n + 2*dirtySize*logD) < 326 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) { 327 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 328 return true; 329 } 330 return false; 317 331 } 318 332 … … 342 356 343 357 /// Last sorted entry in the pvs (important for find and merge) 344 int mLastSorted; 358 int mLastSorted; 359 360 int mQueriesSinceSort; 345 361 }; 346 362 … … 367 383 sort(it, newEnd); 368 384 //sort(mEntries.begin(), mEntries.end()); 369 385 370 386 // now merge sorted ranges 371 387 ObjectPvs newPvs; 372 388 Merge(newPvs, 373 mEntries.begin(), it, 374 it, newEnd, 375 mSamples, 0); 389 mEntries.begin(), 390 it, 391 it, 392 newEnd, 393 mSamples, 394 0); 376 395 377 396 mEntries = newPvs.mEntries; 378 397 mLastSorted = (int)mEntries.size(); 398 mQueriesSinceSort = 0; 379 399 } 380 400 … … 382 402 void Pvs<T, S>::SimpleSort() 383 403 { 384 sort(mEntries.begin(), mEntries.end()); 404 // sort(mEntries.begin(), mEntries.end()); 405 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 406 407 sort(it, mEntries.end()); 408 inplace_merge(mEntries.begin(), it, mEntries.end()); 409 385 410 mLastSorted = (int)mEntries.size(); 411 mQueriesSinceSort = 0; 386 412 } 387 413 … … 610 636 { 611 637 PvsEntry<T, S> dummy(sample, PvsData()); 638 mQueriesSinceSort++; 612 639 613 640 // only check clean part -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2015 r2019 548 548 } 549 549 550 #if 0 550 551 pvsTimer.Entry(); 551 552 // resort pvss 552 553 mPreprocessor.mViewCellsManager->SortViewCellPvs(); 553 554 pvsTimer.Exit(); 555 #endif 554 556 555 557 UpdateRatios(); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2017 r2019 2538 2538 ObjectPvs &pvs = (*it)->GetPvs(); 2539 2539 if (pvs.RequiresResortLog()) 2540 pvs.S ort();2540 pvs.SimpleSort(); 2541 2541 } 2542 2542 } … … 2581 2581 if (viewCell->GetPvs().RequiresResort()) 2582 2582 viewCell->GetPvs().SimpleSort(); 2583 2584 // viewCell->GetPvs().SimpleSort(); 2583 2585 2584 2586 #if CONTRIBUTION_RELATIVE_TO_PVS_SIZE
Note: See TracChangeset
for help on using the changeset viewer.