OPC_ThreadLocalData.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. /*
  3. * OPCODE - Optimized Collision Detection
  4. * Copyright (C) 2001 Pierre Terdiman
  5. * Homepage: http://www.codercorner.com/Opcode.htm
  6. */
  7. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. /**
  10. * Contains declaration of thread local data structure.
  11. * \file OPC_ThreadLocalData.h
  12. * \author Oleh Derevenko
  13. * \date April, 16, 2008
  14. */
  15. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  16. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  17. // Include Guard
  18. #ifndef __OPC_THREADLOCALDATA_H__
  19. #define __OPC_THREADLOCALDATA_H__
  20. // InsertionSort has better coherence, RadixSort is better for one-shot queries.
  21. typedef RadixSort PRUNING_SORTER;
  22. //typedef InsertionSort PRUNING_SORTER
  23. struct ThreadLocalData
  24. {
  25. public:
  26. ThreadLocalData() { Init(); }
  27. ~ThreadLocalData() { Finit(); }
  28. protected:
  29. ThreadLocalData(bool): gCompletePruningSorter(0),
  30. gBipartitePruningSorter0(0), gBipartitePruningSorter1(0)
  31. {
  32. }
  33. void Init();
  34. void Finit();
  35. public:
  36. // Static for coherence
  37. PRUNING_SORTER* gCompletePruningSorter;
  38. PRUNING_SORTER* gBipartitePruningSorter0;
  39. PRUNING_SORTER* gBipartitePruningSorter1;
  40. };
  41. typedef ThreadLocalData *(* ThreadLocalDataProviderProc)();
  42. #endif // __OPC_THREADLOCALDATA_H__