Changeset 2019


Ignore:
Timestamp:
01/23/07 00:11:50 (17 years ago)
Author:
bittner
Message:

merge

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r2015 r2019  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 22. I 17:10:45 2007 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: po 22. I 22:05:05 2007 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r2015 r2019  
    55#include <vector> 
    66#include "common.h" 
     7#include <math.h> 
     8using namespace std; 
    79 
    810namespace GtpVisibilityPreprocessor { 
     
    171173 
    172174public: 
    173  
    174         Pvs(): mSamples(0), mEntries(), mLastSorted(0) {} 
     175   
     176        Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {} 
    175177 
    176178        /** creates pvs and initializes it with the given entries.  
     
    312314          // the last part should not be more than log of the sorted part. this 
    313315          // 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; 
    317331        } 
    318332 
     
    342356   
    343357        /// Last sorted entry in the pvs (important for find and merge) 
    344         int mLastSorted;   
     358        int mLastSorted; 
     359 
     360  int mQueriesSinceSort; 
    345361}; 
    346362 
     
    367383        sort(it, newEnd); 
    368384        //sort(mEntries.begin(), mEntries.end()); 
    369  
     385         
    370386        // now merge sorted ranges 
    371387        ObjectPvs newPvs; 
    372388        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); 
    376395         
    377396        mEntries = newPvs.mEntries; 
    378397        mLastSorted = (int)mEntries.size(); 
     398        mQueriesSinceSort = 0; 
    379399} 
    380400 
     
    382402void Pvs<T, S>::SimpleSort() 
    383403{ 
    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   
    385410  mLastSorted = (int)mEntries.size(); 
     411  mQueriesSinceSort = 0; 
    386412} 
    387413 
     
    610636{ 
    611637  PvsEntry<T, S> dummy(sample, PvsData()); 
     638  mQueriesSinceSort++; 
    612639   
    613640  // only check clean part 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2015 r2019  
    548548  } 
    549549 
     550#if 0 
    550551  pvsTimer.Entry(); 
    551552  // resort pvss 
    552553  mPreprocessor.mViewCellsManager->SortViewCellPvs(); 
    553554  pvsTimer.Exit(); 
     555#endif 
    554556   
    555557  UpdateRatios(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2017 r2019  
    25382538        ObjectPvs &pvs = (*it)->GetPvs(); 
    25392539        if (pvs.RequiresResortLog()) 
    2540           pvs.Sort(); 
     2540          pvs.SimpleSort(); 
    25412541  } 
    25422542} 
     
    25812581        if (viewCell->GetPvs().RequiresResort())  
    25822582          viewCell->GetPvs().SimpleSort(); 
     2583         
     2584        //        viewCell->GetPvs().SimpleSort(); 
    25832585 
    25842586#if CONTRIBUTION_RELATIVE_TO_PVS_SIZE 
Note: See TracChangeset for help on using the changeset viewer.