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 <SYS/SYS_Hash.h>
18 #include <UT/UT_Assert.h>
19 #include <UT/UT_ParallelUtil.h>
20 #include <UT/UT_IntrusivePtr.h>
21 #include <UT/UT_Vector3.h>
22 #include <UT/UT_Vector4.h>
23 #include <UT/UT_Matrix3.h>
24 #include <UT/UT_Matrix4.h>
25 #include <UT/UT_BoundingBox.h>
26 #include <UT/UT_StackBuffer.h>
27 
28 class UT_StringArray;
29 class UT_JSONWriter;
31 class GA_Attribute;
32 
35 
36 /// @brief Abstract data class for an array of float, int or string data
37 ///
38 /// This is an abstract class. The data does not have to be owned by this
39 /// array. The data can be generated on the fly by the class. Or the data
40 /// might be flat numeric data.
42  : public UT_IntrusiveRefCounter<GT_DataArray>
43 {
44 public:
45  GT_DataArray();
47  virtual ~GT_DataArray();
48 
49  virtual const char *className() const = 0;
50 
51  /// Create a "hardened" version of the array
52  virtual GT_DataArrayHandle harden() const;
53 
54  /// Type of data stored in the array
55  virtual GT_Storage getStorage() const = 0;
56 
57  /// Number of entries in the array
58  virtual GT_Size entries() const = 0;
59 
60  /// Return the number of elements in the array for the given item
61  virtual GT_Size itemSize(GT_Offset) const { return 0; }
62  /// Total number of array elements if this is an array attribute.
63  /// Sum of each entry's array length, as each entry's array length can vary.
64  virtual GT_Size getTotalArrayEntries() const { return 0; }
65 
66  /// Number of elements for each array element
67  virtual GT_Size getTupleSize() const = 0;
68 
69  /// Get an approximation of the memory usage. Since data is shared, this
70  /// may be an over-estimation of the memory used.
71  virtual int64 getMemoryUsage() const = 0;
72 
73  /// Return "type" information for the data. This defaults to GT_TYPE_NONE
74  virtual GT_Type getTypeInfo() const;
75 
76  /// Returns "true" if each entry is an array.
77  virtual bool hasArrayEntries() const { return false; }
78 
79  /// Return "true" if there's pointer aliasing
80  virtual bool getPointerAliasing(const void *data) const
81  { return false; }
82 
83  /// Data array is valid; can be sampled from.
84  virtual bool isValid() const { return true; }
85 
86  /// If the array has backing storage, this method can be used to access the
87  /// storage. The backing storage must be a flat array of interleaved
88  /// values of the given pod type. For example, if the array has 35 entries
89  /// of fpreal32 color (RGB) data, the pointer returned should be mapped to
90  /// an array that's (35*3) fpreal32 values with the first three values
91  /// representing the RGB values for the first item in the array.
92  virtual const void *getBackingData() const { return nullptr; }
93 
94  /// Return the "data id" associated with the data. The data ID will be
95  /// incremented if the data is modified. An ID less than 0 indicates that
96  /// the data ID should always be considered unique and will never be the
97  /// same across evaluations. This data ID can be used to detect whether
98  /// attribute data has changed in similar tesselations.
99  virtual int64 getDataId() const { return myDataId; }
100 
101  /// @{
102  /// Get data out of the data array
103  virtual uint8 getU8(GT_Offset offset, int idx=0) const = 0;
104  virtual int8 getI8(GT_Offset offset, int idx=0) const
105  { return getI32(offset, idx); }
106  virtual int16 getI16(GT_Offset offset, int idx=0) const
107  { return getI32(offset, idx); }
108  virtual int32 getI32(GT_Offset offset, int idx=0) const = 0;
109  virtual int64 getI64(GT_Offset offset, int idx=0) const
110  { return getI32(offset, idx); }
111 
112  virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
113  { return getF32(offset, idx); }
114  virtual fpreal32 getF32(GT_Offset offset, int idx=0) const = 0;
115  virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
116  { return getF32(offset, idx); }
117 
118  virtual GT_String getS(GT_Offset offset, int idx=0) const = 0;
119  virtual bool getSA(UT_StringArray &a, GT_Offset offset) const
120  { return false; }
121 
122  virtual GT_Dict getDict(GT_Offset offset, int idx = 0) const
125  { return false; }
126 
128  { return false; }
130  { return false; }
132  { return false; }
134  { return false; }
135  virtual bool getIA8(UT_ValArray<int8> &a, GT_Offset offset) const
136  { return false; }
138  { return false; }
140  { return false; }
142  { return false; }
143  /// @}
144 
145  /// @{
146  /// Get raw access to the data buffer (or fill the data array passed in)
147  /// If the array is unable to provide a raw pointer to the underlying data,
148  /// the GT_DataArrayHandle will be allocated to store the data, and it's
149  /// raw data will be returned.
150  ///
151  /// This means that the data returned will be destructed when the buffer is
152  /// destructed. Beware.
153  virtual const uint8 *getU8Array(GT_DataArrayHandle &buffer) const;
154  virtual const int8 *getI8Array(GT_DataArrayHandle &buffer) const;
155  virtual const int16 *getI16Array(GT_DataArrayHandle &buffer) const;
156  virtual const int32 *getI32Array(GT_DataArrayHandle &buffer) const;
157  virtual const int64 *getI64Array(GT_DataArrayHandle &buffer) const;
158  virtual const fpreal16 *getF16Array(GT_DataArrayHandle &buffer) const;
159  virtual const fpreal32 *getF32Array(GT_DataArrayHandle &buffer) const;
160  virtual const fpreal64 *getF64Array(GT_DataArrayHandle &buffer) const;
161  const fpreal *getRealArray(GT_DataArrayHandle &buffer) const;
162  /// @}
163 
164  /// Template-friendly version of getU8Array() and related methods.
165  template <typename T>
166  const T *getArray(GT_DataArrayHandle &buffer) const;
167 
168  /// When an array of strings is based on an indexed list of strings, this
169  /// method can be used to query the maximum number of indices. If the
170  /// strings are not indexed, the method should return -1.
171  virtual GT_Size getStringIndexCount() const = 0;
172 
173  /// When an array of strings is based on an indexed list of strings, this
174  /// method can be used to query each element's index. If the strings are
175  /// not indexed, the method should return -1.
176  virtual GT_Offset getStringIndex(GT_Offset offset, int idx=0) const = 0;
177 
178  /// When an array of string arrays is based on an indexed list of strings,
179  /// this method can be used to query each element's indices. If the strings
180  /// are not indexed, this method should return false.
182  GT_Offset offset) const { return false; }
183 
184  /// When an array of strings is based on an indexed list of strings, this
185  /// method can be used to extract all the strings and their corresponding
186  /// indicies. It's possible that the indices may not be contiguous or may
187  /// even be out of order.
188  virtual void getIndexedStrings(UT_StringArray &strings,
189  UT_IntArray &indices) const = 0;
190 
191  /// When an array of strings is based on an indexed list of strings, this
192  /// method can be used to extract all the strings. If an index is not
193  /// used, the string array may contain a NULL pointer. When you call @c
194  /// getStringIndex(), you can look up directly into the @c strings array
195  /// returned here.
196  ///
197  /// Note, if the strings are not stored as an indexed list, this method
198  /// will return an empty array.
199  virtual void getStrings(UT_StringArray &strings) const;
200 
201  /// Fill an array of std::string with the strings corresponding to each
202  /// entry. There must be @c entries() strings in the array. Only a single
203  /// tuple index is extracted.
204  void fillStrings(UT_StringArray &result, int tuple_idx = 0) const;
205 
206  /// Fill array of strings from start to length number of entries.
207  /// This should only be called for an array attribute of strings.
208  /// The @c data will contain a flattened array of strings, with
209  /// the @c sizes array containing the array length per entry.
212  GT_Offset start, GT_Size length) const {}
213 
214  /// When an array of dictionaries is based on an indexed list of dictionaries,
215  /// this method can be used to query the maximum number of indices. If the
216  /// dictionaries are not indexed, the method should return -1.
217  virtual GT_Size getDictIndexCount() const = 0;
218 
219  /// When an array of dictionaries is based on an indexed list of dictionaries,
220  /// this method can be used to query each element's index. If the dictionaries
221  /// are not indexed, the method should return -1.
222  virtual GT_Offset getDictIndex(GT_Offset offset, int idx = 0) const = 0;
223 
224  /// When an array of dictionary arrays is based on an indexed list of
225  /// dictionaries, this method can be used to query each element's indices.
226  /// If the dictonaries are not indexed, this method should return false;
228  GT_Offset offset) const { return false; }
229 
230  /// When an array of dictionaries is based on an indexed list of dictionaries,
231  /// this method can be used to extract all the dictionaries and their
232  /// corresponding indicies. It's possible that the indices may not be contiguous
233  /// or may even be out of order.
234  virtual void getIndexedDicts(UT_Array<UT_OptionsHolder> &dicts,
235  UT_IntArray &indices) const = 0;
236 
237  /// When an array of dictionaries is based on an indexed list of dictionaries,
238  /// this method can be used to extract all the dictionaries. When you call
239  /// @c getDictIndex(), you can look up directly into the @c dictionary array
240  /// returned here.
241  virtual void getDictionaries(UT_Array<UT_OptionsHolder> &dicts) const;
242 
243  /// Fill an array of dictionaries from start to length number of entries.
244  /// This should only be called for an array attribute of dictionaries.
245  /// The @c data will contain a flattened array of dictionaries, with
246  /// the @c sizes array containing the array length per entry.
249  GT_Offset start, GT_Size length) const {}
250 
251  /// For index-pair attributes (GT_TYPE_INDEXPAIR), returns the number of
252  /// sets of objects associated with the indices.
253  virtual int getIndexPairObjectSetCount() const { return 0; }
254  /// For the specified index-pair object set, returns a data array for each
255  /// property containing the objects' values.
256  virtual void getIndexPairObjects(GT_AttributeListHandle &properties,
257  int s = 0) const {}
258 
259  /// @{
260  /// Extract data out of the array in a template friendly fashion.
261  /// Unlike the @c get() methods, these methods will @b always copy data
262  /// into the buffers. If the @c size is 0, the tuple size will be used.
263  /// The data buffer must be big enough.
264  ///
265  /// If the size given is larger than getTupleSize(), only the first
266  /// @c getTupleSize() elements will be filled out (leaving the others
267  /// untouched).
268  void import(GT_Offset idx, int8 *data, GT_Size size=0) const
269  { doImport(idx, data, size); }
270  void import(GT_Offset idx, int16 *data, GT_Size size=0) const
271  { doImport(idx, data, size); }
272  void import(GT_Offset idx, int32 *data, GT_Size size=0) const
273  { doImport(idx, data, size); }
274  void import(GT_Offset idx, int64 *data, GT_Size size=0) const
275  { doImport(idx, data, size); }
276  void import(GT_Offset idx, fpreal16 *data, GT_Size size=0) const
277  { doImport(idx, data, size); }
278  void import(GT_Offset idx, fpreal32 *data, GT_Size size=0) const
279  { doImport(idx, data, size); }
280  void import(GT_Offset idx, fpreal64 *data, GT_Size size=0) const
281  { doImport(idx, data, size); }
282  void import(GT_Offset idx, UT_ValArray<fpreal16> &data) const
283  { doImportArray(idx, data); }
284  void import(GT_Offset idx, UT_ValArray<fpreal32> &data) const
285  { doImportArray(idx, data); }
286  void import(GT_Offset idx, UT_ValArray<fpreal64> &data) const
287  { doImportArray(idx, data); }
288  void import(GT_Offset idx, UT_ValArray<uint8> &data) const
289  { doImportArray(idx, data); }
290  void import(GT_Offset idx, UT_ValArray<int8> &data) const
291  { doImportArray(idx, data); }
292  void import(GT_Offset idx, UT_ValArray<int16> &data) const
293  { doImportArray(idx, data); }
294  void import(GT_Offset idx, UT_ValArray<int32> &data) const
295  { doImportArray(idx, data); }
296  void import(GT_Offset idx, UT_ValArray<int64> &data) const
297  { doImportArray(idx, data); }
298  void import(GT_Offset idx, UT_StringArray &data) const
299  { getSA(data, idx); }
300  void import(GT_Offset idx, UT_Array<UT_OptionsHolder> &data) const
301  { getDictA(data, idx); }
302  void import(GT_Offset idx, uint8 *data, GT_Size size=0,
303  fpreal black=0, fpreal white=1) const
304  {
305  if (GTisFloat(getStorage()))
306  doImportQuantized(idx, data, size, black, white);
307  else
308  doImport(idx, data, size);
309  }
310  /// @}
311 
312  /// @{
313  /// Extract data for the entire array into a flat data array.
314  /// By default, this is implemented as: @code
315  /// if (tuple_size <= 0)
316  /// tuple_size = getTupleSize();
317  /// for (GT_Offset idx = 0; idx < length; ++idx, data += tuple_size)
318  /// import(idx+start, data, tuple_size);
319  /// @endcode
320  /// Obviously, the @c data array should be big enough to hold @c
321  /// length*tuple_size elements.
322  ///
323  /// The tuple size (@c tsize) specifies how many elements to extract from
324  /// each element of this array. The @c stride specifies how many items to
325  /// skip over for each element. With a stride of -1, the stride will be
326  /// set to the @c tsize. Otherwise the stride will be set to the maximum
327  /// of @c tsize and @c stride.
328  ///
329  /// The stride can be useful when trying to interleave data. For example:
330  /// @code
331  /// float uvbuf[ucoord->entries()*2];
332  /// ucoord->fillArray(&uvbuf[0], 0, ucoord->entries(), 1, 2);
333  /// vcoord->fillArray(&uvbuf[1], 0, vcoord->entries(), 1, 2);
334  /// @endcode
336  int tsize, int stride=-1) const
337  { doFillArray(data, start, length, tsize, stride); }
339  int tsize, int stride=-1) const
340  { doFillArray(data, start, length, tsize, stride); }
342  int tsize, int stride=-1) const
343  { doFillArray(data, start, length, tsize, stride); }
345  int tsize, int stride=-1) const
346  { doFillArray(data, start, length, tsize, stride); }
348  int tsize, int stride=-1) const
349  { doFillArray(data, start, length, tsize, stride); }
351  int tsize, int stride=-1) const
352  { doFillArray(data, start, length, tsize, stride); }
354  int tsize, int stride=-1) const
355  { doFillArray(data, start, length, tsize, stride); }
358  int tsize, int stride=-1,
359  fpreal black=0, fpreal white=1) const
360  {
361  if(GTisFloat(getStorage()))
362  doFillQuantizedArray(data, start, length, tsize,
363  stride, black, white);
364  else
365  doFillArray(data, start, length, tsize, stride);
366  }
367 
369  UT_BoundingBoxF &bbox, int tsize, int stride=-1)
370  {
371  UT_ASSERT_P(tsize==3);
372  doFillVec3BBox(dest, start, length, bbox,
373  tsize, stride);
374  }
376  UT_BoundingBoxD &bbox, int tsize, int stride=-1)
377  {
378  UT_ASSERT_P(tsize==3);
379  doFillVec3BBox(dest, start, length, bbox,
380  tsize, stride);
381  }
382  /// @}
383 
384  /// @{
385  /// Extract data for an array attribute into a flat data array.
386  /// Since each entry in an array attribute varies in terms of array size,
387  /// the sizes of each entry will be stored in the @c sizes array.
389  GT_Offset start, GT_Size length) const
390  { doFillArrayAttr(data, sizes, start, length); }
392  GT_Offset start, GT_Size length) const
393  { doFillArrayAttr(data, sizes, start, length); }
395  GT_Offset start, GT_Size length) const
396  { doFillArrayAttr(data, sizes, start, length); }
398  GT_Offset start, GT_Size length) const
399  { doFillArrayAttr(data, sizes, start, length); }
401  GT_Offset start, GT_Size length) const
402  { doFillArrayAttr(data, sizes, start, length); }
404  GT_Offset start, GT_Size length) const
405  { doFillArrayAttr(data, sizes, start, length); }
407  GT_Offset start, GT_Size length) const
408  { doFillArrayAttr(data, sizes, start, length); }
410  GT_Offset start, GT_Size length) const
411  { doFillArrayAttr(data, sizes, start, length); }
412  /// @}
413 
414  virtual void extendedFillArray(uint8 *data,
416  int tsize, int nrepeats,
417  int stride=-1,
418  fpreal black=0, fpreal white=1) const
419  {
420  doExtendedQuantizedFill(data, start, length, tsize,
421  nrepeats, stride, black, white);
422  }
423 
424  /// @{
425  /// Extract an element, but making @c nrepeats copies. The buffer
426  /// should be able to contain @c length*nrepeats*tsize elements
427  /// When filling an RGB color, with a repeat count of 4, the resulting
428  /// buffer will look like: @code
429  /// [ RGB0 RGB0 RGB0 RGB0 RGB1 RGB1 RGB1 RGB1 ... ]
430  /// @endcode
431  /// With a repeat count of 1, this is equivalent to @c fillArray()
433  int tsize, int nrepeats, int stride=-1) const
434  {
435  t_extendedFill(data, start, length, tsize,
436  nrepeats, stride);
437  }
439  int tsize, int nrepeats, int stride=-1) const
440  {
441  t_extendedFill(data, start, length, tsize,
442  nrepeats, stride);
443  }
445  int tsize, int nrepeats, int stride=-1) const
446  {
447  t_extendedFill(data, start, length, tsize,
448  nrepeats, stride);
449  }
451  int tsize, int nrepeats, int stride=-1) const
452  {
453  t_extendedFill(data, start, length, tsize,
454  nrepeats, stride);
455  }
457  int tsize, int nrepeats, int stride=-1) const
458  {
459  t_extendedFill(data, start, length, tsize,
460  nrepeats, stride);
461  }
463  int tsize, int nrepeats, int stride=-1) const
464  {
465  t_extendedFill(data, start, length, tsize,
466  nrepeats, stride);
467  }
469  int tsize, int nrepeats, int stride=-1) const
470  {
471  t_extendedFill(data, start, length, tsize,
472  nrepeats, stride);
473  }
475  int tsize, int nrepeats, int stride=-1) const
476  {
477  t_extendedFill(data, start, length, tsize,
478  nrepeats, stride);
479  }
480  /// @}
481 
482  /// @{
483  /// Copy the data out of the array as a tuple of @em size entries
484  /// The data may be copied, or the array may return a pointer to raw data.
485  /// That is, the sub-class may @b not copy the data into the storage.
486  virtual const uint8 *get(GT_Offset i, uint8 *store, int sz) const;
487  virtual const int8 *get(GT_Offset i, int8 *store, int sz) const;
488  virtual const int16 *get(GT_Offset i, int16 *store, int sz) const;
489  virtual const int32 *get(GT_Offset i, int32 *store, int sz) const;
490  virtual const int64 *get(GT_Offset i, int64 *store, int sz) const;
491  virtual const fpreal16 *get(GT_Offset i, fpreal16 *store, int z) const;
492  virtual const fpreal32 *get(GT_Offset i, fpreal32 *store, int z) const;
493  virtual const fpreal64 *get(GT_Offset i, fpreal64 *store, int z) const;
494  /// @}
495 
496  /// @{
497  /// Get the range of values in the array
498  virtual void getRange(exint &lo, exint &hi, int tuple_idx=0) const;
499  virtual void getRange(fpreal &lo, fpreal &hi, int tidx=0) const;
500  /// @}
501 
502  /// Compare whether two data arrays are equal.
503  virtual bool isEqual(const GT_DataArray &src) const;
504 
505  /// @{
506  /// Compute a hash of the data in the array. The base class hash is computed
507  /// @code
508  /// SYS_HashType hash = 0;
509  /// for (i = begin; i < end; ++i) {
510  /// import(i, tmp, getTupleSize());
511  /// for (t = 0; t < getTupleSize(); t++)
512  /// SYShashCombine(hash, hashNumeric(tmp[t]));
513  /// }
514  /// @endcode
515  /// Where @c hashNumeric returns the value for integer types. Real data is
516  /// cast to the corresponding unsigned integer values. For example, fpreal16 @code
517  /// void hashNumeric(SYS_HashType &hash, fpreal16 v) {
518  /// SYShashCombine(hash, *(const uint16 *)(&v));
519  /// }
520  /// void hashNumeric(SYS_HashType &hash, fpreal32 v) {
521  /// SYShashCombine(hash, *(const uint32 *)(&v));
522  /// }
523  /// @endcode
524  SYS_HashType hash() const { return hashRange(0, entries()); }
525  virtual SYS_HashType hashRange(exint begin, exint end) const;
526  /// @}
527 
528  /// Enlarge a bounding box with values of this 3-tuple array
530  {
531  // Initialize min/max
532  for (int i = 0, n = getTupleSize(); i < n; ++i)
533  {
534  min[i] = SYS_FP64_MAX;
535  max[i] = -SYS_FP64_MAX;
536  }
537  if (getStorage() == GT_STORE_STRING)
538  return false;
539  if (!entries())
540  return true;
541  return computeMinMax(min, max);
542  }
544  {
545  int tsize = getTupleSize();
546  UT_StackBuffer<fpreal64> min(tsize), max(tsize);
547  getMinMax(min, max);
548  if (min[0] <= max[0] && min[1] <= max[1] && min[2] <= max[2])
549  {
550  b.enlargeBounds(min[0], min[1], min[2]);
551  b.enlargeBounds(max[0], max[1], max[2]);
552  }
553  return true;
554  }
555 
556  /// Test to see whether the data array requires int32 or int64 indexing.
557  GT_Storage checkIndexing(GT_IndexingMode mode) const;
558 
559  /// Quick & dirty test to see if a size is bigger than a 32 bit int
560  static bool isBigInteger(GT_Size size)
561  { return size >= (((int64)1) << 31); }
562 
563  /// For debugging, print values to stdout
564  void dumpValues(const char *msg=NULL) const;
565 
566  /// Save array to a JSON stream. The 'flat' determines how to output
567  /// arrays with a tuple size greater than 1. If 'flat' is true, the
568  /// output will be an uninterrupted stream of values. If 'flat' is
569  /// false, then the output will look something like [[1,2,3],[4,5,6], ... ]
570  bool save(UT_JSONWriter &w, bool flat = true) const;
571 
572  /// @{
573  /// For memory tracking, we override the new/delete operators
574  static void *operator new(size_t size);
575  static void *operator new(size_t size, void *p);
576  static void operator delete(void *p, size_t size);
577  /// @}
578 
579  /// Forcibly set the data id for the array. You take responsibility for
580  /// all artifacts and crashes if you call this indiscriminately.
581  void copyDataId(const GT_DataArray &src)
582  { setDataId(src.getDataId()); }
583 
584  /// Set the data id - This is used by geometry arrays to copy over the data
585  /// id from GA. As above, you take responsibility for all artifacts and
586  /// crashes if you set this incorrectly. Do not set this if you don't
587  /// know how data IDs work.
588  void setDataId(int64 id) { myDataId = id; }
589 
590  /// Update cached data, in case the underlying attribute changed.
591  virtual void updateGeoDetail(const GU_ConstDetailHandle &dtl,
592  const char *attrib_name,
593  GT_Owner attrib_owner,
594  const int expected_size) {}
595 
596  /// Return the source data index: a GT_Offset if the data is stored in GT,
597  /// or a GA_Index if the data resides in a GA_Attribute.
598  virtual exint getDataIndex(GT_Offset i) const
599  { return i; }
600  /// Whether there is some indirection from the GT_Offset to the data index.
601  virtual bool isIndirect() const
602  { return false; }
603  /// Whether the other data array shares the same indirection from GT_Offset
604  /// to data index. If the data resides in a GA_Attribute, this returns
605  /// whether the underlying GA elements are the same. This compares
606  /// GT_DataArray metadata, instead of fully checking for equality!
607  virtual bool isSameIndirection(const GT_DataArray &other) const
608  { return !isIndirect() && !other.isIndirect(); }
609  /// The underlying GA_Attribute, if one exists.
610  virtual const GA_Attribute *getBufferAttribute() const
611  { return nullptr; }
612 
613 protected:
614  /// Compute the min & max values for an array. This fails for strings
615  virtual bool computeMinMax(fpreal64 *min, fpreal64 *max) const;
616 
617  /// Ensure the size is set properly when performing an import. If the size
618  /// isn't specified, we use the array's tuple size, otherwise we make sure
619  /// to clamp the tuple size.
622  {
623  return size == 0 ? tuple_size : SYSmin(size, tuple_size);
624  }
625 
626  /// @{
627  /// Virtual implementation for inline methods.
628  /// - @c doImport is for tuple data
629  /// - @c doImportArray is for tuple array data
630  /// - @c doFillArray is for raw array of tuples
631  ///
632  virtual void doImport(GT_Offset idx, uint8 *data, GT_Size size) const;
633  virtual void doImport(GT_Offset idx, int8 *data, GT_Size size) const;
634  virtual void doImport(GT_Offset idx, int16 *data, GT_Size size) const;
635  virtual void doImport(GT_Offset idx, int32 *data, GT_Size size) const;
636  virtual void doImport(GT_Offset idx, int64 *data, GT_Size size) const;
637  virtual void doImport(GT_Offset idx, fpreal16 *data, GT_Size size) const;
638  virtual void doImport(GT_Offset idx, fpreal32 *data, GT_Size size) const;
639  virtual void doImport(GT_Offset idx, fpreal64 *data, GT_Size size) const;
640  virtual void doImportArray(GT_Offset idx, UT_ValArray<fpreal16> &data) const;
641  virtual void doImportArray(GT_Offset idx, UT_ValArray<fpreal32> &data) const;
642  virtual void doImportArray(GT_Offset idx, UT_ValArray<fpreal64> &data) const;
643  virtual void doImportArray(GT_Offset idx, UT_ValArray<uint8> &data) const;
644  virtual void doImportArray(GT_Offset idx, UT_ValArray<int8> &data) const;
645  virtual void doImportArray(GT_Offset idx, UT_ValArray<int16> &data) const;
646  virtual void doImportArray(GT_Offset idx, UT_ValArray<int32> &data) const;
647  virtual void doImportArray(GT_Offset idx, UT_ValArray<int64> &data) const;
648  virtual void doImportQuantized(GT_Offset idx, uint8 *data, GT_Size size,
649  fpreal black, fpreal white) const;
650 
652  int tuple_size, int stride) const
653  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
654 
656  int tuple_size, int stride) const
657  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
659  int tuple_size, int stride) const
660  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
662  int tuple_size, int stride) const
663  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
665  int tuple_size, int stride) const
666  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
668  int tuple_size, int stride) const
669  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
671  int tuple_size, int stride) const
672  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
674  int tuple_size, int stride) const
675  { t_extendedFill(data, start, length, tuple_size, 1, stride); }
677  GT_Offset start, GT_Size length) const
678  { t_extendedFillArray(data, sizes, start, length); }
680  GT_Offset start, GT_Size length) const
681  { t_extendedFillArray(data, sizes, start, length); }
683  GT_Offset start, GT_Size length) const
684  { t_extendedFillArray(data, sizes, start, length); }
686  GT_Offset start, GT_Size length) const
687  { t_extendedFillArray(data, sizes, start, length); }
689  GT_Offset start, GT_Size length) const
690  { t_extendedFillArray(data, sizes, start, length); }
692  GT_Offset start, GT_Size length) const
693  { t_extendedFillArray(data, sizes, start, length); }
695  GT_Offset start, GT_Size length) const
696  { t_extendedFillArray(data, sizes, start, length); }
698  GT_Offset start, GT_Size length) const
699  { t_extendedFillArray(data, sizes, start, length); }
700 
703  int tuple_size, int stride,
704  fpreal black, fpreal white) const
705  {
706  doExtendedQuantizedFill(data, start, length, tuple_size,
707  1, stride, black, white);
708  }
709  virtual void doExtendedQuantizedFill(uint8 *data,
711  int tuple_size, int nrepeats, int stride,
712  fpreal black, fpreal white) const;
713 
714  /// Nested class to perform filling for a POD array
715  template <typename T_POD>
717  {
718  public:
719  fillV3BoxTask(const GT_DataArray &array, T_POD *data,
720  GT_Offset start, int stride)
721  : myArray(array)
722  , myData(data)
723  , myStart(start)
724  , myStride(stride)
725  {
726  myBox.initBounds();
727  }
729  : myArray(src.myArray)
730  , myBox(src.myBox)
731  , myData(src.myData)
732  , myStart(src.myStart)
733  , myStride(src.myStride)
734  {
735  }
737  {
738  exint i = range.begin();
739  T_POD *dest = myData + i*myStride;
740  for (; i != range.end(); ++i, dest += myStride)
741  {
742  myArray.import(i+myStart, dest, 3);
743  myBox.enlargeBounds(dest[0], dest[1], dest[2]);
744  }
745  }
746  void join(const fillV3BoxTask<T_POD> &src)
747  {
748  myBox.enlargeBounds(src.myBox);
749  }
750  const UT_BoundingBox &box() const { return myBox; }
751  private:
752  const GT_DataArray &myArray;
753  UT_BoundingBox myBox;
754  T_POD *myData;
755  GT_Offset myStart;
756  int myStride;
757  };
758 
760  UT_BoundingBoxF &bbox, int, int stride)
761  {
762  stride = SYSmax(stride, 3);
763  fillV3BoxTask<fpreal32> task(*this, dest, start, stride);
765  bbox = task.box();
766  }
768  UT_BoundingBoxD &bbox, int, int stride)
769  {
770  stride = SYSmax(stride, 3);
771  fillV3BoxTask<fpreal64> task(*this, dest, start, stride);
773  bbox = task.box();
774  }
775  /// @}
776 
777  /// Templated method to fill an array
778  template <typename T_POD> void
779  t_extendedFill(T_POD *dest, GT_Offset start, GT_Size length,
780  int tsize, int nrepeats, int stride) const;
781 
782  /// Templated method to fill an array attribute
783  template <typename T_POD> void
784  t_extendedFillArray(UT_Array<T_POD> &dest, UT_Array<int> &sizes,
785  GT_Offset start, GT_Size length) const;
786 
787 private:
788  /// @{
789  /// @private
790  /// Get more complicated POD data types out of the array
791  template <typename T, int tuplesize> class VectorPODAccessor
792  {
793  public:
794  static T getValue(const GT_DataArray &array, GT_Offset offset)
795  {
796  T result;
797  UT_ASSERT_P(array.getTupleSize() >= tuplesize);
798  array.get(offset, result.data(), tuplesize);
799  return result;
800  }
801  };
802  class I32Accessor
803  {
804  public:
805  static int32 getValue(const GT_DataArray &a, GT_Offset i)
806  { return a.getI32(i); }
807  };
808  class I64Accessor
809  {
810  public:
811  static int64 getValue(const GT_DataArray &a, GT_Offset i)
812  { return a.getI64(i); }
813  };
814  class F16Accessor
815  {
816  public:
817  static fpreal16 getValue(const GT_DataArray &a, GT_Offset i)
818  { return a.getF16(i); }
819  };
820  class F32Accessor
821  {
822  public:
823  static fpreal32 getValue(const GT_DataArray &a, GT_Offset i)
824  { return a.getF32(i); }
825  };
826  class F64Accessor
827  {
828  public:
829  static fpreal64 getValue(const GT_DataArray &a, GT_Offset i)
830  { return a.getF64(i); }
831  };
832  /// @}
833 
834  /// @{
835  /// @private
836  /// Private template class to register POD accessors
837  template <typename T, int FAKE> class TypeInfo {};
838  /// @}
839 
840  /// @{
841  /// @private
842  /// Simple scalar and vector accessors
843  template <int FAKE> class TypeInfo<int32, FAKE>
844  { public: typedef I32Accessor Accessors; };
845  template <int FAKE> class TypeInfo<int64, FAKE>
846  { public: typedef I64Accessor Accessors; };
847  template <int FAKE> class TypeInfo<fpreal16, FAKE>
848  { public: typedef F16Accessor Accessors; };
849  template <int FAKE> class TypeInfo<fpreal32, FAKE>
850  { public: typedef F32Accessor Accessors; };
851  template <int FAKE> class TypeInfo<fpreal64, FAKE>
852  { public: typedef F64Accessor Accessors; };
853 
854  template <int FAKE> class TypeInfo<UT_Vector2F, FAKE>
855  { public: typedef VectorPODAccessor<UT_Vector2F, 2> Accessors; };
856  template <int FAKE> class TypeInfo<UT_Vector2D, FAKE>
857  { public: typedef VectorPODAccessor<UT_Vector2D, 2> Accessors; };
858  template <int FAKE> class TypeInfo<UT_Vector3H, FAKE>
859  { public: typedef VectorPODAccessor<UT_Vector3H, 3> Accessors; };
860  template <int FAKE> class TypeInfo<UT_Vector3F, FAKE>
861  { public: typedef VectorPODAccessor<UT_Vector3F, 3> Accessors; };
862  template <int FAKE> class TypeInfo<UT_Vector3D, FAKE>
863  { public: typedef VectorPODAccessor<UT_Vector3D, 3> Accessors; };
864  template <int FAKE> class TypeInfo<UT_Vector4H, FAKE>
865  { public: typedef VectorPODAccessor<UT_Vector4H, 4> Accessors; };
866  template <int FAKE> class TypeInfo<UT_Vector4F, FAKE>
867  { public: typedef VectorPODAccessor<UT_Vector4F, 4> Accessors; };
868  template <int FAKE> class TypeInfo<UT_Vector4D, FAKE>
869  { public: typedef VectorPODAccessor<UT_Vector4D, 4> Accessors; };
870  template <int FAKE> class TypeInfo<UT_Matrix3F, FAKE>
871  { public: typedef VectorPODAccessor<UT_Matrix3F, 9> Accessors; };
872  template <int FAKE> class TypeInfo<UT_Matrix3D, FAKE>
873  { public: typedef VectorPODAccessor<UT_Matrix3D, 9> Accessors; };
874  template <int FAKE> class TypeInfo<UT_Matrix4F, FAKE>
875  { public: typedef VectorPODAccessor<UT_Matrix4F, 16> Accessors; };
876  template <int FAKE> class TypeInfo<UT_Matrix4D, FAKE>
877  { public: typedef VectorPODAccessor<UT_Matrix4D, 16> Accessors; };
878  /// @}
879 public:
880  /// Public accessor for POD types
881  template <typename T> T
883  { return TypeInfo<T, 0>::Accessors::getValue(*this, index); }
884 
885  template <typename T> T
887  {
888  return (1-t)*getValue<T>(i0) + t*getValue<T>(i1);
889  }
890 
891  template <typename T> T
893  GT_Offset u0v1, GT_Offset u1v1, fpreal u, fpreal v)
894  {
895  T l = (1-v)*getValue<T>(u0v0) + v*getValue<T>(u0v1);
896  T r = (1-v)*getValue<T>(u1v0) + v*getValue<T>(u1v1);
897  return (1-u)*l + u*r;
898  }
899 
900 private:
901  int64 myDataId;
902 };
903 
904 #endif
virtual exint getDataIndex(GT_Offset i) const
Definition: GT_DataArray.h:598
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
Definition: glcorearb.h:2621
SYS_HashType hash() const
Definition: GT_DataArray.h:524
#define SYSmax(a, b)
Definition: SYS_Math.h:1952
GT_Storage
Definition: GT_Types.h:19
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:591
virtual void extendedFill(int16 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:444
Definition of a geometry attribute.
Definition: GA_Attribute.h:203
virtual bool getIA32(UT_ValArray< int32 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:139
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:701
virtual bool isValid() const
Data array is valid; can be sampled from.
Definition: GT_DataArray.h:84
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
void fillArray(UT_Array< fpreal64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:409
int int32
Definition: SYS_Types.h:39
GLenum GLint * range
Definition: glcorearb.h:1925
virtual bool getDictIndices(UT_Array< GT_Offset > &indices, GT_Offset offset) const
Definition: GT_DataArray.h:227
virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:112
tbb::split UT_Split
Definition: GA_PolyCounts.h:25
virtual void extendedFill(int32 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:450
void fillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:353
Nested class to perform filling for a POD array.
Definition: GT_DataArray.h:716
virtual bool getFA64(UT_ValArray< fpreal64 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:131
virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:115
T lerpValue(GT_Offset i0, GT_Offset i1, fpreal t) const
Definition: GT_DataArray.h:886
virtual void fillStringArray(UT_StringArray &data, UT_ValArray< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:210
GLboolean * data
Definition: glcorearb.h:131
const GLdouble * v
Definition: glcorearb.h:837
void join(const fillV3BoxTask< T_POD > &src)
Definition: GT_DataArray.h:746
GLuint start
Definition: glcorearb.h:475
void fillArray(UT_Array< fpreal32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:406
virtual void doFillArray(int16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:658
bool enlargeBounds(UT_BoundingBox &b) const
Definition: GT_DataArray.h:543
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
GT_IndexingMode
Definition: GT_Types.h:106
virtual fpreal32 getF32(GT_Offset offset, int idx=0) const =0
virtual const void * getBackingData() const
Definition: GT_DataArray.h:92
#define GT_API
Definition: GT_API.h:13
int64 exint
Definition: SYS_Types.h:125
const UT_BoundingBox & box() const
Definition: GT_DataArray.h:750
GT_Type
Definition: GT_Types.h:36
virtual int64 getI64(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:109
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
GLdouble s
Definition: glad.h:3009
std::size_t SYS_HashType
Define the type for hash values.
Definition: SYS_Hash.h:19
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:560
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
virtual bool getUA8(UT_ValArray< uint8 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:133
void fillArray(int16 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:338
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
virtual void extendedFill(fpreal16 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:462
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:39
**But if you need a result
Definition: thread.h:622
virtual void extendedFill(int64 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:456
3D Vector class.
A reference counter base class for use with UT_IntrusivePtr.
4D Vector class.
Definition: UT_Vector4.h:176
void fillArray(UT_Array< int16 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:394
virtual void doFillArray(int64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:664
virtual GT_Size itemSize(GT_Offset) const
Return the number of elements in the array for the given item.
Definition: GT_DataArray.h:61
float fpreal32
Definition: SYS_Types.h:200
GLuint buffer
Definition: glcorearb.h:660
#define SYS_FP64_MAX
Definition: SYS_Types.h:226
virtual void doFillVec3BBox(fpreal64 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxD &bbox, int, int stride)
Definition: GT_DataArray.h:767
virtual void extendedFill(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:468
virtual void doFillVec3BBox(fpreal32 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxF &bbox, int, int stride)
Definition: GT_DataArray.h:759
void fillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:350
virtual bool getIA64(UT_ValArray< int64 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:141
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:5578
virtual bool getIA16(UT_ValArray< int16 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:137
double fpreal64
Definition: SYS_Types.h:201
unsigned char uint8
Definition: SYS_Types.h:36
virtual void extendedFill(int8 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:438
GLdouble n
Definition: glcorearb.h:2008
virtual void doFillArrayAttr(UT_Array< fpreal16 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:691
virtual void doFillArrayAttr(UT_Array< int32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:685
GLintptr offset
Definition: glcorearb.h:665
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:41
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:432
virtual bool isIndirect() const
Whether there is some indirection from the GT_Offset to the data index.
Definition: GT_DataArray.h:601
UT_IntrusivePtr< GT_DataArray > GT_DataArrayHandle
Definition: GT_DataArray.h:33
virtual void extendedFill(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
Definition: GT_DataArray.h:474
virtual int64 getDataId() const
Definition: GT_DataArray.h:99
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:164
fillV3BoxTask(const GT_DataArray &array, T_POD *data, GT_Offset start, int stride)
Definition: GT_DataArray.h:719
void fillArray(UT_Array< int8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:391
virtual void doFillArray(int8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:655
GLuint GLuint end
Definition: glcorearb.h:475
virtual bool getFA32(UT_ValArray< fpreal32 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:129
virtual bool getIA8(UT_ValArray< int8 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:135
virtual bool getPointerAliasing(const void *data) const
Return "true" if there's pointer aliasing.
Definition: GT_DataArray.h:80
static const UT_OptionsHolder theEmptyOptions
Definition: UT_Options.h:1242
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:872
virtual void doFillArrayAttr(UT_Array< int8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:679
virtual void doFillArrayAttr(UT_Array< int16 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:682
int64 GT_Offset
Definition: GT_Types.h:129
long long int64
Definition: SYS_Types.h:116
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:651
GLuint id
Definition: glcorearb.h:655
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:414
GLint i1
Definition: glad.h:2724
virtual bool getSA(UT_StringArray &a, GT_Offset offset) const
Definition: GT_DataArray.h:119
#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:882
virtual void getIndexPairObjects(GT_AttributeListHandle &properties, int s=0) const
Definition: GT_DataArray.h:256
signed char int8
Definition: SYS_Types.h:35
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1933
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
void enlargeBounds(const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
void fillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:347
void setDataId(int64 id)
Definition: GT_DataArray.h:588
fillV3BoxTask(fillV3BoxTask &src, UT_Split)
Definition: GT_DataArray.h:728
virtual void doFillArrayAttr(UT_Array< fpreal64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:697
void copyDataId(const GT_DataArray &src)
Definition: GT_DataArray.h:581
virtual bool isSameIndirection(const GT_DataArray &other) const
Definition: GT_DataArray.h:607
GLdouble t
Definition: glad.h:2397
GLenum mode
Definition: glcorearb.h:99
GT_Owner
Definition: GT_Types.h:90
int64 GT_Size
Definition: GT_Types.h:128
GLsizeiptr size
Definition: glcorearb.h:664
void fillArray(int8 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:335
virtual bool getFA16(UT_ValArray< fpreal16 > &a, GT_Offset offset) const
Definition: GT_DataArray.h:127
virtual void doFillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:667
void fillVec3BBox(fpreal64 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxD &bbox, int tsize, int stride=-1)
Definition: GT_DataArray.h:375
virtual void doFillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:670
virtual void doFillArrayAttr(UT_Array< fpreal32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:694
bool getMinMax(fpreal64 *min, fpreal64 *max) const
Enlarge a bounding box with values of this 3-tuple array.
Definition: GT_DataArray.h:529
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:587
virtual int16 getI16(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:106
void operator()(const UT_BlockedRange< exint > &range)
Definition: GT_DataArray.h:736
void fillVec3BBox(fpreal32 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxF &bbox, int tsize, int stride=-1)
Definition: GT_DataArray.h:368
short int16
Definition: SYS_Types.h:37
fpreal64 fpreal
Definition: SYS_Types.h:283
virtual bool hasArrayEntries() const
Returns "true" if each entry is an array.
Definition: GT_DataArray.h:77
virtual int getIndexPairObjectSetCount() const
Definition: GT_DataArray.h:253
GLuint index
Definition: glcorearb.h:786
virtual const GA_Attribute * getBufferAttribute() const
The underlying GA_Attribute, if one exists.
Definition: GT_DataArray.h:610
void fillArray(UT_Array< int64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:400
virtual void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:673
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void fillArray(UT_Array< fpreal16 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:403
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:356
virtual GT_Dict getDict(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:122
virtual void doFillArrayAttr(UT_Array< int64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:688
T bilerpValue(GT_Offset u0v0, GT_Offset u1v0, GT_Offset u0v1, GT_Offset u1v1, fpreal u, fpreal v)
Definition: GT_DataArray.h:892
void fillArray(int32 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:341
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
virtual void fillDictionaryArray(UT_Array< UT_OptionsHolder > &data, UT_ValArray< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:247
GLboolean r
Definition: glcorearb.h:1222
void fillArray(int64 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Definition: GT_DataArray.h:344
virtual bool getStringIndices(UT_Array< GT_Offset > &indices, GT_Offset offset) const
Definition: GT_DataArray.h:181
virtual void doFillArray(int32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:661
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:621
virtual int8 getI8(GT_Offset offset, int idx=0) const
Definition: GT_DataArray.h:104
virtual GT_Size getTupleSize() const =0
Number of elements for each array element.
#define SYSmin(a, b)
Definition: SYS_Math.h:1953
void fillArray(UT_Array< uint8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:388
Declare prior to use.
virtual void doFillArrayAttr(UT_Array< uint8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:676
virtual bool getDictA(UT_Array< UT_OptionsHolder > &a, GT_Offset offset) const
Definition: GT_DataArray.h:124
virtual GT_Size getTotalArrayEntries() const
Definition: GT_DataArray.h:64
Definition: format.h:1821
void UTparallelReduceLightItems(const Range &range, Body &body)
void fillArray(UT_Array< int32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Definition: GT_DataArray.h:397
GLenum src
Definition: glcorearb.h:1793