HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_DataArray.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_DataArray.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_DataArray__
12 #define __GT_DataArray__
13 
14 #include "GT_API.h"
15 #include "GT_Types.h"
16 #include "GT_Handles.h"
17 #include <UT/UT_Assert.h>
18 #include <UT/UT_ParallelUtil.h>
19 #include <UT/UT_IntrusivePtr.h>
20 #include <UT/UT_Vector3.h>
21 #include <UT/UT_Vector4.h>
22 #include <UT/UT_Matrix3.h>
23 #include <UT/UT_Matrix4.h>
24 #include <UT/UT_BoundingBox.h>
25 
26 class UT_StringArray;
27 class UT_JSONWriter;
29 
32 
33 /// @brief Abstract data class for an array of float, int or string data
34 ///
35 /// This is an abstract class. The data does not have to be owned by this
36 /// array. The data can be generated on the fly by the class. Or the data
37 /// might be flat numeric data.
39  : public UT_IntrusiveRefCounter<GT_DataArray>
40 {
41 public:
42  GT_DataArray();
44  virtual ~GT_DataArray();
45 
46  virtual const char *className() const = 0;
47 
48  /// Create a "hardened" version of the array
49  virtual GT_DataArrayHandle harden() const;
50 
51  /// Type of data stored in the array
52  virtual GT_Storage getStorage() const = 0;
53 
54  /// Number of entries in the array
55  virtual GT_Size entries() const = 0;
56 
57  /// Number of elements for each array element
58  virtual GT_Size getTupleSize() const = 0;
59 
60  /// Get an approximation of the memory usage. Since data is shared, this
61  /// may be an over-estimation of the memory used.
62  virtual int64 getMemoryUsage() const = 0;
63 
64  /// Return "type" information for the data. This defaults to GT_TYPE_NONE
65  virtual GT_Type getTypeInfo() const;
66 
67  /// Returns "true" if each entry is an array.
68  virtual bool hasArrayEntries() const { return false; }
69 
70  /// Return "true" if there's pointer aliasing
71  virtual bool getPointerAliasing(const void *data) const
72  { return false; }
73 
74  /// Data array is valid; can be sampled from.
75  virtual bool isValid() const { return true; }
76 
77  /// Return the "data id" associated with the data. The data ID will be
78  /// incremented if the data is modified. An ID less than 0 indicates that
79  /// the data ID should always be considered unique and will never be the
80  /// same across evaluations. This data ID can be used to detect whether
81  /// attribute data has changed in similar tesselations.
82  virtual int64 getDataId() const { return myDataId; }
83 
84  /// @{
85  /// Get data out of the data array
86  virtual uint8 getU8(GT_Offset offset, int idx=0) const = 0;
87  virtual int8 getI8(GT_Offset offset, int idx=0) const
88  { return getI32(offset, idx); }
89  virtual int16 getI16(GT_Offset offset, int idx=0) const
90  { return getI32(offset, idx); }
91  virtual int32 getI32(GT_Offset offset, int idx=0) const = 0;
92  virtual int64 getI64(GT_Offset offset, int idx=0) const
93  { return getI32(offset, idx); }
94 
95  virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
96  { return getF32(offset, idx); }
97  virtual fpreal32 getF32(GT_Offset offset, int idx=0) const = 0;
98  virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
99  { return getF32(offset, idx); }
100 
101  virtual GT_String getS(GT_Offset offset, int idx=0) const = 0;
102  virtual bool getSA(UT_StringArray &a, GT_Offset offset) const
103  { return false; }
104 
106  { return false; }
107  virtual bool getIA32(UT_ValArray<int32> &a, GT_Offset offset) const
108  { return false; }
109  /// @}
110 
111  /// @{
112  /// Get raw access to the data buffer (or fill the data array passed in)
113  /// If the array is unable to provide a raw pointer to the underlying data,
114  /// the GT_DataArrayHandle will be allocated to store the data, and it's
115  /// raw data will be returned.
116  ///
117  /// This means that the data returned will be destructed when the buffer is
118  /// destructed. Beware.
119  virtual const uint8 *getU8Array(GT_DataArrayHandle &buffer) const;
120  virtual const int8 *getI8Array(GT_DataArrayHandle &buffer) const;
121  virtual const int16 *getI16Array(GT_DataArrayHandle &buffer) const;
122  virtual const int32 *getI32Array(GT_DataArrayHandle &buffer) const;
123  virtual const int64 *getI64Array(GT_DataArrayHandle &buffer) const;
124  virtual const fpreal16 *getF16Array(GT_DataArrayHandle &buffer) const;
125  virtual const fpreal32 *getF32Array(GT_DataArrayHandle &buffer) const;
126  virtual const fpreal64 *getF64Array(GT_DataArrayHandle &buffer) const;
127  const fpreal *getRealArray(GT_DataArrayHandle &buffer) const;
128  /// @}
129 
130  /// When an array of strings is based on an indexed list of strings, this
131  /// method can be used to query the maximum number of indices. If the
132  /// strings are not indexed, the method should return -1.
133  virtual GT_Size getStringIndexCount() const = 0;
134 
135  /// When an array of strings is based on an indexed list of strings, this
136  /// method can be used to query each element's index. If the strings are
137  /// not indexed, the method should return -1.
138  virtual GT_Offset getStringIndex(GT_Offset offset, int idx=0) const = 0;
139 
140  /// When an array of strings is based on an indexed list of strings, this
141  /// method can be used to extract all the strings and their corresponding
142  /// indicies. It's possible that the indices may not be contiguous or may
143  /// even be out of order.
144  virtual void getIndexedStrings(UT_StringArray &strings,
145  UT_IntArray &indices) const = 0;
146  /// When an array of strings is based on an indexed list of strings, this
147  /// method can be used to extract all the strings. If an index is not
148  /// used, the string array may contain a NULL pointer. When you call @c
149  /// getStringIndex(), you can look up directly into the @c strings array
150  /// returned here.
151  ///
152  /// Note, if the strings are not stored as an indexed list, this method
153  /// will return an empty array.
154  virtual void getStrings(UT_StringArray &strings) const;
155 
156  /// Fill an array of std::string with the strings corresponding to each
157  /// entry. There must be @c entries() strings in the array. Only a single
158  /// tuple index is extracted.
159  void fillStrings(std::string *strings,
160  int tuple_idx=0) const;
161 
162  /// @{
163  /// Extract data out of the array in a template friendly fashion.
164  /// Unlike the @c get() methods, these methods will @b always copy data
165  /// into the buffers. If the @c size is 0, the tuple size will be used.
166  /// The data buffer must be big enough.
167  ///
168  /// If the size given is larger than getTupleSize(), only the first
169  /// @c getTupleSize() elements will be filled out (leaving the others
170  /// untouched).
171  void import(GT_Offset idx, int8 *data, GT_Size size=0) const
172  { doImport(idx, data, size); }
173  void import(GT_Offset idx, int16 *data, GT_Size size=0) const
174  { doImport(idx, data, size); }
175  void import(GT_Offset idx, int32 *data, GT_Size size=0) const
176  { doImport(idx, data, size); }
177  void import(GT_Offset idx, int64 *data, GT_Size size=0) const
178  { doImport(idx, data, size); }
179  void import(GT_Offset idx, fpreal16 *data, GT_Size size=0) const
180  { doImport(idx, data, size); }
181  void import(GT_Offset idx, fpreal32 *data, GT_Size size=0) const
182  { doImport(idx, data, size); }
183  void import(GT_Offset idx, fpreal64 *data, GT_Size size=0) const
184  { doImport(idx, data, size); }
185  void import(GT_Offset idx, UT_ValArray<fpreal32> &data) const
186  { doImportArray(idx, data); }
187  void import(GT_Offset idx, UT_ValArray<int32> &data) const
188  { doImportArray(idx, data); }
189  void import(GT_Offset idx, uint8 *data, GT_Size size=0,
190  fpreal black=0, fpreal white=1) const
191  {
192  if (GTisFloat(getStorage()))
193  doImportQuantized(idx, data, size, black, white);
194  else
195  doImport(idx, data, size);
196  }
197  /// @}
198 
199  /// @{
200  /// Extract data for the entire array into a flat data array.
201  /// By default, this is implemented as: @code
202  /// if (tuple_size <= 0)
203  /// tuple_size = getTupleSize();
204  /// for (GT_Offset idx = 0; idx < length; ++idx, data += tuple_size)
205  /// import(idx+start, data, tuple_size);
206  /// @endcode
207  /// Obviously, the @c data array should be big enough to hold @c
208  /// length*tuple_size elements.
209  ///
210  /// The tuple size (@c tsize) specifies how many elements to extract from
211  /// each element of this array. The @c stride specifies how many items to
212  /// skip over for each element. With a stride of -1, the stride will be
213  /// set to the @c tsize. Otherwise the stride will be set to the maximum
214  /// of @c tsize and @c stride.
215  ///
216  /// The stride can be useful when trying to interleave data. For example:
217  /// @code
218  /// float uvbuf[ucoord->entries()*2];
219  /// ucoord->fillArray(&uvbuf[0], 0, ucoord->entries(), 1, 2);
220  /// vcoord->fillArray(&uvbuf[1], 0, vcoord->entries(), 1, 2);
221  /// @endcode
223  int tsize, int stride=-1) const
224  { doFillArray(data, start, length, tsize, stride); }
226  int tsize, int stride=-1) const
227  { doFillArray(data, start, length, tsize, stride); }
229  int tsize, int stride=-1) const
230  { doFillArray(data, start, length, tsize, stride); }
232  int tsize, int stride=-1) const
233  { doFillArray(data, start, length, tsize, stride); }
235  int tsize, int stride=-1) const
236  { doFillArray(data, start, length, tsize, stride); }
238  int tsize, int stride=-1) const
239  { doFillArray(data, start, length, tsize, stride); }
241  int tsize, int stride=-1) const
242  { doFillArray(data, start, length, tsize, stride); }
245  int tsize, int stride=-1,
246  fpreal black=0, fpreal white=1) const
247  {
248  if(GTisFloat(getStorage()))
249  doFillQuantizedArray(data, start, length, tsize,
250  stride, black, white);
251  else
252  doFillArray(data, start, length, tsize, stride);
253  }
254 
256  UT_BoundingBoxF &bbox, int tsize, int stride=-1)
257  {
258  UT_ASSERT_P(tsize==3);
259  doFillVec3BBox(dest, start, length, bbox,
260  tsize, stride);
261  }
263  UT_BoundingBoxD &bbox, int tsize, int stride=-1)
264  {
265  UT_ASSERT_P(tsize==3);
266  doFillVec3BBox(dest, start, length, bbox,
267  tsize, stride);
268  }
269  /// @}
270 
271  virtual void extendedFillArray(uint8 *data,
273  int tsize, int nrepeats,
274  int stride=-1,
275  fpreal black=0, fpreal white=1) const
276  {
277  doExtendedQuantizedFill(data, start, length, tsize,
278  nrepeats, stride, black, white);
279  }
280 
281  /// @{
282  /// Extract an element, but making @c nrepeats copies. The buffer
283  /// should be able to contain @c length*nrepeats*tsize elements
284  /// When filling an RGB color, with a repeat count of 4, the resulting
285  /// buffer will look like: @code
286  /// [ RGB0 RGB0 RGB0 RGB0 RGB1 RGB1 RGB1 RGB1 ... ]
287  /// @endcode
288  /// With a repeat count of 1, this is equivalent to @c fillArray()
290  int tsize, int nrepeats, int stride=-1) const
291  {
292  t_extendedFill(data, start, length, tsize,
293  nrepeats, stride);
294  }
296  int tsize, int nrepeats, int stride=-1) const
297  {
298  t_extendedFill(data, start, length, tsize,
299  nrepeats, stride);
300  }
302  int tsize, int nrepeats, int stride=-1) const
303  {
304  t_extendedFill(data, start, length, tsize,
305  nrepeats, stride);
306  }
308  int tsize, int nrepeats, int stride=-1) const
309  {
310  t_extendedFill(data, start, length, tsize,
311  nrepeats, stride);
312  }
314  int tsize, int nrepeats, int stride=-1) const
315  {
316  t_extendedFill(data, start, length, tsize,
317  nrepeats, stride);
318  }
320  int tsize, int nrepeats, int stride=-1) const
321  {
322  t_extendedFill(data, start, length, tsize,
323  nrepeats, stride);
324  }
326  int tsize, int nrepeats, int stride=-1) const
327  {
328  t_extendedFill(data, start, length, tsize,
329  nrepeats, stride);
330  }
332  int tsize, int nrepeats, int stride=-1) const
333  {
334  t_extendedFill(data, start, length, tsize,
335  nrepeats, stride);
336  }
337  /// @}
338 
339  /// @{
340  /// Copy the data out of the array as a tuple of @em size entries
341  /// The data may be copied, or the array may return a pointer to raw data.
342  /// That is, the sub-class may @b not copy the data into the storage.
343  virtual const uint8 *get(GT_Offset i, uint8 *store, int sz) const;
344  virtual const int8 *get(GT_Offset i, int8 *store, int sz) const;
345  virtual const int16 *get(GT_Offset i, int16 *store, int sz) const;
346  virtual const int32 *get(GT_Offset i, int32 *store, int sz) const;
347  virtual const int64 *get(GT_Offset i, int64 *store, int sz) const;
348  virtual const fpreal16 *get(GT_Offset i, fpreal16 *store, int z) const;
349  virtual const fpreal32 *get(GT_Offset i, fpreal32 *store, int z) const;
350  virtual const fpreal64 *get(GT_Offset i, fpreal64 *store, int z) const;
351  /// @}
352 
353  /// @{
354  /// Get the range of values in the array
355  virtual void getRange(exint &lo, exint &hi, int tuple_idx=0) const;
356  virtual void getRange(fpreal &lo, fpreal &hi, int tidx=0) const;
357  /// @}
358 
359  /// Compare whether two data arrays are equal.
360  bool isEqual(const GT_DataArray &src) const;
361 
362  /// Test to see whether the data array requires int32 or int64 indexing.
363  GT_Storage checkIndexing(GT_IndexingMode mode) const;
364 
365  /// Quick & dirty test to see if a size is bigger than a 32 bit int
366  static bool isBigInteger(GT_Size size)
367  { return size >= (((int64)1) << 31); }
368 
369  /// For debugging, print values to stdout
370  void dumpValues(const char *msg=NULL) const;
371 
372  /// Save array to a JSON stream. The 'flat' determines how to output
373  /// arrays with a tuple size greater than 1. If 'flat' is true, the
374  /// output will be an uninterrupted stream of values. If 'flat' is
375  /// false, then the output will look something like [[1,2,3],[4,5,6], ... ]
376  bool save(UT_JSONWriter &w, bool flat = true) const;
377 
378  /// @{
379  /// For memory tracking, we override the new/delete operators
380  static void *operator new(size_t size);
381  static void *operator new(size_t size, void *p);
382  static void operator delete(void *p, size_t size);
383  /// @}
384 
385  /// Forcibly set the data id for the array. You take responsibility for
386  /// all artifacts and crashes if you call this indiscriminately.
387  void copyDataId(const GT_DataArray &src)
388  { setDataId(src.getDataId()); }
389 
390  /// Set the data id - This is used by geometry arrays to copy over the data
391  /// id from GA. As above, you take responsibility for all artifacts and
392  /// crashes if you set this incorrectly. Do not set this if you don't
393  /// know how data IDs work.
394  void setDataId(int64 id) { myDataId = id; }
395 
396  /// Update cached data, in case the underlying attribute changed.
397  virtual void updateGeoDetail(const GU_ConstDetailHandle &dtl,
398  const char *attrib_name,
399  GT_Owner attrib_owner,
400  const int expected_size) {}
401 
402 protected:
403  /// Ensure the size is set properly when performing an import. If the size
404  /// isn't specified, we use the array's tuple size, otherwise we make sure
405  /// to clamp the tuple size.
408  {
409  return size == 0 ? tuple_size : SYSmin(size, tuple_size);
410  }
411 
412  /// @{
413  /// Virtual implementation for inline methods.
414  /// Note that @c doImport is for tuple data, while @c doImportArray
415  /// is for tuple array data.
416  virtual void doImport(GT_Offset idx, uint8 *data, GT_Size size) const;
417  virtual void doImport(GT_Offset idx, int8 *data, GT_Size size) const;
418  virtual void doImport(GT_Offset idx, int16 *data, GT_Size size) const;
419  virtual void doImport(GT_Offset idx, int32 *data, GT_Size size) const;
420  virtual void doImport(GT_Offset idx, int64 *data, GT_Size size) const;
421  virtual void doImport(GT_Offset idx, fpreal16 *data, GT_Size size) const;
422  virtual void doImport(GT_Offset idx, fpreal32 *data, GT_Size size) const;
423  virtual void doImport(GT_Offset idx, fpreal64 *data, GT_Size size) const;
424  virtual void doImportArray(GT_Offset idx, UT_ValArray<fpreal32> &data) const;
425  virtual void doImportArray(GT_Offset idx, UT_ValArray<int32> &data) const;
426  virtual void doImportQuantized(GT_Offset idx, uint8 *data, GT_Size size,
427  fpreal black, fpreal white) const;
428 
430  int tuple_size, int stride) const
431  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
432 
434  int tuple_size, int stride) const
435  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
437  int tuple_size, int stride) const
438  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
440  int tuple_size, int stride) const
441  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
443  int tuple_size, int stride) const
444  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
446  int tuple_size, int stride) const
447  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
449  int tuple_size, int stride) const
450  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
452  int tuple_size, int stride) const
453  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
454 
457  int tuple_size, int stride,
458  fpreal black, fpreal white) const
459  {
460  doExtendedQuantizedFill(data, start, length, tuple_size,
461  1, stride, black, white);
462  }
463  virtual void doExtendedQuantizedFill(uint8 *data,
465  int tuple_size, int nrepeats, int stride,
466  fpreal black, fpreal white) const;
467 
468  /// Nested class to perform filling for a POD array
469  template <typename T_POD>
471  {
472  public:
473  fillV3BoxTask(const GT_DataArray &array, T_POD *data,
474  GT_Offset start, int stride)
475  : myArray(array)
476  , myData(data)
477  , myStart(start)
478  , myStride(stride)
479  {
480  myBox.initBounds();
481  }
483  : myArray(src.myArray)
484  , myBox(src.myBox)
485  , myData(src.myData)
486  , myStart(src.myStart)
487  , myStride(src.myStride)
488  {
489  }
491  {
492  exint i = range.begin();
493  T_POD *dest = myData + i*myStride;
494  for (; i != range.end(); ++i, dest += myStride)
495  {
496  myArray.import(i+myStart, dest, 3);
497  myBox.enlargeBounds(dest[0], dest[1], dest[2]);
498  }
499  }
500  void join(const fillV3BoxTask<T_POD> &src)
501  {
502  myBox.enlargeBounds(src.myBox);
503  }
504  const UT_BoundingBox &box() const { return myBox; }
505  private:
506  const GT_DataArray &myArray;
507  UT_BoundingBox myBox;
508  T_POD *myData;
509  GT_Offset myStart;
510  int myStride;
511  };
512 
514  UT_BoundingBoxF &bbox, int, int stride)
515  {
516  stride = SYSmax(stride, 3);
517  fillV3BoxTask<fpreal32> task(*this, dest, start, stride);
519  bbox = task.box();
520  }
522  UT_BoundingBoxD &bbox, int, int stride)
523  {
524  stride = SYSmax(stride, 3);
525  fillV3BoxTask<fpreal64> task(*this, dest, start, stride);
527  bbox = task.box();
528  }
529  /// @}
530 
531  /// Templated method to fill an array
532  template <typename T_POD> void
533  t_extendedFill(T_POD *dest, GT_Offset start, GT_Size length,
534  int tsize, int nrepeats, int stride) const;
535 
536 private:
537  /// @{
538  /// @private
539  /// Get more complicated POD data types out of the array
540  template <typename T, int tuplesize> class VectorPODAccessor
541  {
542  public:
543  static T getValue(const GT_DataArray &array, GT_Offset offset)
544  {
545  T result;
546  UT_ASSERT_P(array.getTupleSize() >= tuplesize);
547  array.get(offset, result.data(), tuplesize);
548  return result;
549  }
550  };
551  class I32Accessor {
552  public:
553  static int32 getValue(const GT_DataArray &a, GT_Offset i)
554  { return a.getI32(i); }
555  };
556  class I64Accessor {
557  public:
558  static int64 getValue(const GT_DataArray &a, GT_Offset i)
559  { return a.getI64(i); }
560  };
561  class F16Accessor {
562  public:
563  static fpreal16 getValue(const GT_DataArray &a, GT_Offset i)
564  { return a.getF16(i); }
565  };
566  class F32Accessor {
567  public:
568  static fpreal32 getValue(const GT_DataArray &a, GT_Offset i)
569  { return a.getF32(i); }
570  };
571  class F64Accessor {
572  public:
573  static fpreal64 getValue(const GT_DataArray &a, GT_Offset i)
574  { return a.getF64(i); }
575  };
576  /// @}
577 
578  /// @{
579  /// @private
580  /// Private template class to register POD accessors
581  template <typename T, int FAKE> class TypeInfo {};
582 
583  /// @{
584  /// @private
585  /// Simple scalar and vector accessors
586  template <int FAKE> class TypeInfo<int32, FAKE>
587  { public: typedef I32Accessor Accessors; };
588  template <int FAKE> class TypeInfo<int64, FAKE>
589  { public: typedef I64Accessor Accessors; };
590  template <int FAKE> class TypeInfo<fpreal16, FAKE>
591  { public: typedef F16Accessor Accessors; };
592  template <int FAKE> class TypeInfo<fpreal32, FAKE>
593  { public: typedef F32Accessor Accessors; };
594  template <int FAKE> class TypeInfo<fpreal64, FAKE>
595  { public: typedef F64Accessor Accessors; };
596 
597  template <int FAKE> class TypeInfo<UT_Vector3F, FAKE>
598  { public: typedef VectorPODAccessor<UT_Vector3F, 3> Accessors; };
599  template <int FAKE> class TypeInfo<UT_Vector3D, FAKE>
600  { public: typedef VectorPODAccessor<UT_Vector3D, 3> Accessors; };
601  template <int FAKE> class TypeInfo<UT_Vector4F, FAKE>
602  { public: typedef VectorPODAccessor<UT_Vector4F, 4> Accessors; };
603  template <int FAKE> class TypeInfo<UT_Vector4D, FAKE>
604  { public: typedef VectorPODAccessor<UT_Vector4D, 4> Accessors; };
605  template <int FAKE> class TypeInfo<UT_Matrix3F, FAKE>
606  { public: typedef VectorPODAccessor<UT_Matrix3F, 9> Accessors; };
607  template <int FAKE> class TypeInfo<UT_Matrix3D, FAKE>
608  { public: typedef VectorPODAccessor<UT_Matrix3D, 9> Accessors; };
609  template <int FAKE> class TypeInfo<UT_Matrix4F, FAKE>
610  { public: typedef VectorPODAccessor<UT_Matrix4F, 16> Accessors; };
611  template <int FAKE> class TypeInfo<UT_Matrix4D, FAKE>
612  { public: typedef VectorPODAccessor<UT_Matrix4D, 16> Accessors; };
613  /// @}
614 public:
615  /// Public accessor for POD types
616  template <typename T> T
618  { return TypeInfo<T, 0>::Accessors::getValue(*this, index); }
619 
620  template <typename T> T
622  {
623  return (1-t)*getValue<T>(i0) + t*getValue<T>(i1);
624  }
625 
626  template <typename T> T
628  GT_Offset u0v1, GT_Offset u1v1, fpreal u, fpreal v)
629  {
630  T l = (1-v)*getValue<T>(u0v0) + v*getValue<T>(u0v1);
631  T r = (1-v)*getValue<T>(u1v0) + v*getValue<T>(u1v1);
632  return (1-u)*l + u*r;
633  }
634 
635 private:
636  int64 myDataId;
637 };
638 
639 #endif
#define SYSmax(a, b)
Definition: SYS_Math.h:1367
GT_Storage
Definition: GT_Types.h:17
virtual void updateGeoDetail(const GU_ConstDetailHandle &dtl, const char *attrib_name, GT_Owner attrib_owner, const int expected_size)
Update cached data, in case the underlying attribute changed.
Definition: GT_DataArray.h:397
virtual void extendedFill(int16 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:301
virtual bool getIA32(UT_ValArray< int32 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:107
virtual void doFillQuantizedArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride, fpreal black, fpreal white) const
Definition: GT_DataArray.h:455
virtual bool isValid() const
Data array is valid; can be sampled from.
Definition: GT_DataArray.h:75
GLsizei GLenum const void * indices
Definition: glcorearb.h:405
GLenum GLint * range
Definition: glcorearb.h:1924
virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:95
tbb::split UT_Split
Definition: GA_PolyCounts.h:24
virtual void extendedFill(int32 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:307
void fillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:240
Nested class to perform filling for a POD array.
Definition: GT_DataArray.h:470
virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:98
T lerpValue(GT_Offset i0, GT_Offset i1, fpreal t) const
Definition: GT_DataArray.h:621
const GLdouble * v
Definition: glcorearb.h:836
void join(const fillV3BoxTask< T_POD > &src)
Definition: GT_DataArray.h:500
GLuint start
Definition: glcorearb.h:474
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
const char * GT_String
Definition: GT_Types.h:111
virtual void doFillArray(int16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:436
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:847
GT_IndexingMode
Definition: GT_Types.h:91
virtual fpreal32 getF32(GT_Offset offset, int idx=0) const =0
#define GT_API
Definition: GT_API.h:11
const UT_BoundingBox & box() const
Definition: GT_DataArray.h:504
GT_Type
Definition: GT_Types.h:33
virtual int64 getI64(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:92
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
static bool isBigInteger(GT_Size size)
Quick & dirty test to see if a size is bigger than a 32 bit int.
Definition: GT_DataArray.h:366
void fillArray(int16 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:225
virtual void extendedFill(fpreal16 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:319
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
virtual void extendedFill(int64 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:313
A reference counter base class for use with UT_IntrusivePtr.
virtual void doFillArray(int64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:442
GLuint buffer
Definition: glcorearb.h:659
png_uint_32 i
Definition: png.h:2877
virtual void doFillVec3BBox(fpreal64 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxD &bbox, int, int stride)
Definition: GT_DataArray.h:521
virtual void extendedFill(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:325
virtual void doFillVec3BBox(fpreal32 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxF &bbox, int, int stride)
Definition: GT_DataArray.h:513
void fillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:237
GLsizeiptr size
Definition: glcorearb.h:663
signed char int8
Definition: SYS_Types.h:31
GLuint id
Definition: glcorearb.h:654
long long int64
Definition: SYS_Types.h:107
virtual void extendedFill(int8 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:295
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:38
virtual const uint8 * get(GT_Offset i, uint8 *store, int sz) const
virtual void extendedFill(uint8 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:289
UT_IntrusivePtr< GT_DataArray > GT_DataArrayHandle
Definition: GT_DataArray.h:30
int64 exint
Definition: SYS_Types.h:116
virtual void extendedFill(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:331
virtual int64 getDataId() const
Definition: GT_DataArray.h:82
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:125
fillV3BoxTask(const GT_DataArray &array, T_POD *data, GT_Offset start, int stride)
Definition: GT_DataArray.h:473
double fpreal64
Definition: SYS_Types.h:192
virtual void doFillArray(int8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:433
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:871
virtual bool getFA32(UT_ValArray< fpreal32 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:105
GLintptr offset
Definition: glcorearb.h:664
virtual bool getPointerAliasing(const void *data) const
Return "true" if there's pointer aliasing.
Definition: GT_DataArray.h:71
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:429
virtual void extendedFillArray(uint8 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1, fpreal black=0, fpreal white=1) const
Definition: GT_DataArray.h:271
virtual bool getSA(UT_StringArray &a, GT_Offset offset) const
Definition: GT_DataArray.h:102
#define SYS_STATIC_FORCE_INLINE
Definition: SYS_Inline.h:48
T getValue(GT_Offset index) const
Public accessor for POD types.
Definition: GT_DataArray.h:617
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:35
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1932
void fillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:234
void setDataId(int64 id)
Definition: GT_DataArray.h:394
fillV3BoxTask(fillV3BoxTask &src, UT_Split)
Definition: GT_DataArray.h:482
void copyDataId(const GT_DataArray &src)
Definition: GT_DataArray.h:387
GLenum mode
Definition: glcorearb.h:98
GT_Owner
Definition: GT_Types.h:75
void fillArray(int8 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:222
virtual void doFillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:445
double fpreal
Definition: SYS_Types.h:270
void fillVec3BBox(fpreal64 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxD &bbox, int tsize, int stride=-1)
Definition: GT_DataArray.h:262
png_infop png_sPLT_tpp entries
Definition: png.h:2481
virtual void doFillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:448
virtual int16 getI16(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:89
void operator()(const UT_BlockedRange< exint > &range)
Definition: GT_DataArray.h:490
void fillVec3BBox(fpreal32 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxF &bbox, int tsize, int stride=-1)
Definition: GT_DataArray.h:255
unsigned char uint8
Definition: SYS_Types.h:32
virtual bool hasArrayEntries() const
Returns "true" if each entry is an array.
Definition: GT_DataArray.h:68
GLuint index
Definition: glcorearb.h:785
virtual void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:451
void fillArray(uint8 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1, fpreal black=0, fpreal white=1) const
Definition: GT_DataArray.h:243
T bilerpValue(GT_Offset u0v0, GT_Offset u1v0, GT_Offset u0v1, GT_Offset u1v1, fpreal u, fpreal v)
Definition: GT_DataArray.h:627
void fillArray(int32 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:228
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
GLboolean r
Definition: glcorearb.h:1221
int64 GT_Offset
Definition: GT_Types.h:113
int64 GT_Size
Definition: GT_Types.h:112
void fillArray(int64 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:231
short int16
Definition: SYS_Types.h:33
virtual void doFillArray(int32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:439
virtual int32 getI32(GT_Offset offset, int idx=0) const =0
SYS_STATIC_FORCE_INLINE GT_Size fixImportTupleSize(GT_Size size, GT_Size tuple_size)
Definition: GT_DataArray.h:407
virtual int8 getI8(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:87
virtual GT_Size getTupleSize() const =0
Number of elements for each array element.
#define SYSmin(a, b)
Definition: SYS_Math.h:1368
Declare prior to use.
float fpreal32
Definition: SYS_Types.h:191
void UTparallelReduceLightItems(const Range &range, Body &body)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
GLenum src
Definition: glcorearb.h:1792