HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_PrimConnector.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: GEO Library (C++)
7  *
8  * COMMENTS: This class builds a useful structure for determining the
9  * connectivity of primitives.
10  *
11  */
12 
13 #ifndef __GEO_PrimConnector_h__
14 #define __GEO_PrimConnector_h__
15 
16 #include "GEO_API.h"
17 #include "GEO_Detail.h"
18 #include <UT/UT_Array.h>
19 #include <UT/UT_BitArray.h>
20 #include <UT/UT_IntArray.h>
21 
23 
25 
26 class GEO_PrimClassifier;
27 
29 {
30 public:
32  const GEO_PrimClassifier &classifier);
33  virtual ~GEO_PrimConnector();
34 
35  int getTreeCount() const
36  { return (int)myForest.entries(); }
37  int getMaxTreeCount() const;
38 
39  // Query the prims list of tree i.
41  { return myForest((unsigned)i)->myConnectedPrims; }
42 
43  // Clears the connections built
44  virtual void clear();
45 
46  // This method returns the tree index for primitives connected to
47  // the supplied primitive. Returns -1 if we have not yet built the
48  // tree for this connected group.
49  int getPrimTree(const GEO_Primitive &prim);
50 
51  int buildTree(const GEO_Primitive &prim);
52 
53  // This method fills the trees array with all the indices of any
54  // primitive trees which reference the given point. The return
55  // value is the number of trees found, whether those trees are added
56  // to the trees list or not (we don't add dupliactes). This method
57  // will construct the trees if they do not already exist.
58  virtual int getPrimTrees(GA_Offset ptoff,
59  UT_IntArray &trees) = 0;
60 
61  int64 getMemoryUsage(bool inclusive) const
62  {
63  int64 mem = inclusive ? sizeof(*this) : 0;
64  mem += myForest.getMemoryUsage(false);
65  for (exint i = 0; i < myForest.entries(); i++)
66  {
67  if (myForest(i))
68  {
69  mem += sizeof(*myForest(i));
70  mem += myForest(i)->myConnectedPrims.getMemoryUsage(false);
71  }
72  }
73  mem += myVisitedPoints.getMemoryUsage(false);
74  return mem;
75  }
76 
77 protected:
78  int buildClassTree(int class_num);
79 
81  {
82  public:
83 #ifdef INTEL_COMPILER
84  geo_ConnectedTree() { }
85 #endif
87  private:
88 #ifdef INTEL_COMPILER
90 #endif
91 
92  };
93 
94  // Members:
97 
98  // The forest contains the lists of connected points (trees)
101 };
102 
103 class GEO_PointClassifier;
104 
106 {
107 public:
109  const GEO_PrimClassifier &classifier,
110  const GEO_PointClassifier &ptclassifier);
111  ~GEO_PrimConnector3D() override;
112 
113  // This method fills the trees array with all the indices of any
114  // primitive trees which reference the given point. The return
115  // value is the number of trees found. This method will construct
116  // the trees if they do not already exist.
117  int getPrimTrees(GA_Offset ptoff,
118  UT_IntArray &trees) override;
119 
120 private:
121  const GEO_PointClassifier *myPointClassifier;
122 };
123 
125 {
126 public:
128  const GEO_PrimClassifier &classifier);
129  ~GEO_PrimConnectorUV() override;
130 
131  // This method fills the trees array with all the indices of any
132  // primitive trees which reference the given point. The return
133  // value is the number of trees found. This method will construct
134  // the trees if they do not already exist.
135  int getPrimTrees(GA_Offset ptoff,
136  UT_IntArray &trees) override;
137 };
138 
139 #endif
virtual int getPrimTrees(GA_Offset ptoff, UT_IntArray &trees)=0
const geo_ConnectedPrimArray & connectedPrims(int i) const
geo_ConnectedPrimArray myConnectedPrims
const GEO_PrimClassifier * myClassifier
int64 getMemoryUsage(bool inclusive) const
int64 exint
Definition: SYS_Types.h:125
int getTreeCount() const
GA_Size GA_Offset
Definition: GA_Types.h:646
UT_Array< geo_ConnectedTree * > myForest
UT_BitArray myVisitedPoints
#define GEO_API
Definition: GEO_API.h:14
long long int64
Definition: SYS_Types.h:116
UT_Array< GEO_Primitive * > geo_ConnectedPrimArray