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