HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GT_Refine.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GT_Refine.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_Refine__
12 #define __GT_Refine__
13 
14 #include "GT_API.h"
15 #include "GT_Handles.h"
16 #include <SYS/SYS_Types.h>
17 #include <UT/UT_ParallelUtil.h>
18 
19 ///@brief Processes primitives generated by refinement process
21 public:
22  /// Default constructor
23  GT_Refine() {}
24 
25  /// Destructor
26  virtual ~GT_Refine();
27 
28  /// Return true if the refinement allows threaded refinement of primitives
29  virtual bool allowThreading() const { return true; }
30 
31  /// This method is called for all primitives generated during the
32  /// refinement process.
33  virtual void addPrimitive(const GT_PrimitiveHandle &prim) = 0;
34 
35  /// Convenience method called by primitives which support parallel for
36  /// loops for refinement.
37  template <typename Range, typename Body>
38  void refineRange(const Range &range, const Body &body)
39  {
40  if (allowThreading())
41  UTparallelFor(range, body);
42  else
43  UTserialFor(range, body);
44  }
45 
46 public:
47  /// @{
48  /// For memory tracking, we override the new/delete operators
49  static void *operator new(size_t size);
50  static void *operator new(size_t size, void *p);
51  static void operator delete(void *p, size_t size);
52  /// @}
53 
54 protected:
55 };
56 
57 #endif
GT_Refine()
Default constructor.
Definition: GT_Refine.h:23
GLenum GLint * range
Definition: glcorearb.h:1924
#define GT_API
Definition: GT_API.h:11
GLsizeiptr size
Definition: glcorearb.h:663
virtual bool allowThreading() const
Return true if the refinement allows threaded refinement of primitives.
Definition: GT_Refine.h:29
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
void refineRange(const Range &range, const Body &body)
Definition: GT_Refine.h:38
void UTparallelFor(const Range &range, const Body &body, const int subscribe_ratio=2, const int min_grain_size=1)
void UTserialFor(const Range &range, const Body &body)