11 #ifndef __GT_DataArray__
12 #define __GT_DataArray__
48 virtual const char *className()
const = 0;
57 virtual GT_Size entries()
const = 0;
66 virtual GT_Size getTupleSize()
const = 0;
70 virtual int64 getMemoryUsage()
const = 0;
73 virtual GT_Type getTypeInfo()
const;
83 virtual bool isValid()
const {
return true; }
104 {
return getI32(offset, idx); }
106 {
return getI32(offset, idx); }
109 {
return getI32(offset, idx); }
112 {
return getF32(offset, idx); }
115 {
return getF32(offset, idx); }
164 template <
typename T>
170 virtual GT_Size getStringIndexCount()
const = 0;
210 virtual GT_Size getDictIndexCount()
const = 0;
262 { doImportArray(idx,
data); }
264 { doImportArray(idx,
data); }
266 { doImportArray(idx,
data); }
268 { doImportArray(idx,
data); }
270 { doImportArray(idx,
data); }
272 { doImportArray(idx,
data); }
274 { doImportArray(idx,
data); }
276 { doImportArray(idx,
data); }
278 { getSA(
data, idx); }
280 { getDictA(
data, idx); }
284 if (GTisFloat(getStorage()))
285 doImportQuantized(idx,
data,
size, black, white);
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); }
340 if(GTisFloat(getStorage()))
341 doFillQuantizedArray(data, start, length, tsize,
344 doFillArray(data, start, length, tsize,
stride);
351 doFillVec3BBox(dest, start, length, bbox,
358 doFillVec3BBox(dest, start, length, bbox,
369 { doFillArrayAttr(data, sizes, start, length); }
372 { doFillArrayAttr(data, sizes, start, length); }
375 { doFillArrayAttr(data, sizes, start, length); }
378 { doFillArrayAttr(data, sizes, start, length); }
381 { doFillArrayAttr(data, sizes, start, length); }
384 { doFillArrayAttr(data, sizes, start, length); }
387 { doFillArrayAttr(data, sizes, start, length); }
390 { doFillArrayAttr(data, sizes, start, length); }
395 int tsize,
int nrepeats,
399 doExtendedQuantizedFill(data, start, length, tsize,
400 nrepeats,
stride, black, white);
412 int tsize,
int nrepeats,
int stride=-1)
const
414 t_extendedFill(data, start, length, tsize,
418 int tsize,
int nrepeats,
int stride=-1)
const
420 t_extendedFill(data, start, length, tsize,
424 int tsize,
int nrepeats,
int stride=-1)
const
426 t_extendedFill(data, start, length, tsize,
430 int tsize,
int nrepeats,
int stride=-1)
const
432 t_extendedFill(data, start, length, tsize,
436 int tsize,
int nrepeats,
int stride=-1)
const
438 t_extendedFill(data, start, length, tsize,
442 int tsize,
int nrepeats,
int stride=-1)
const
444 t_extendedFill(data, start, length, tsize,
448 int tsize,
int nrepeats,
int stride=-1)
const
450 t_extendedFill(data, start, length, tsize,
454 int tsize,
int nrepeats,
int stride=-1)
const
456 t_extendedFill(data, start, length, tsize,
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;
511 for (
int i = 0,
n = getTupleSize(); i <
n; ++i)
520 return computeMinMax(min, max);
524 int tsize = getTupleSize();
527 if (
min[0] <= max[0] &&
min[1] <= max[1] &&
min[2] <= max[2])
540 {
return size >= (((
int64)1) << 31); }
543 void dumpValues(
const char *msg=NULL)
const;
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);
571 const char *attrib_name,
573 const int expected_size) {}
582 , myTupleSize(array.getTupleSize())
585 for (
int j = 0;
j < myTupleSize; ++
j)
592 : myArray(src.myArray)
593 , myTupleSize(src.myTupleSize)
596 std::copy(src.myMin, src.myMin+myTupleSize, myMin);
597 std::copy(src.myMax, src.myMax+myTupleSize, myMax);
601 if (myMin != myMinBuffer)
610 for (
GT_Size i = range.begin(),
n = range.end(); i <
n; ++i)
612 myArray.import(i, myPos, myTupleSize);
613 for (
int j = 0;
j < myTupleSize; ++
j)
615 myMin[
j] =
SYSmin(myMin[
j], myPos[j]);
616 myMax[
j] =
SYSmax(myMax[j], myPos[j]);
622 for (
int j = 0;
j < myTupleSize; ++
j)
625 max[
j] =
SYSmax(max[j], myMax[j]);
630 for (
int j = 0;
j < myTupleSize; ++
j)
632 myMin[
j] =
SYSmin(myMin[
j], src.myMin[j]);
633 myMax[
j] =
SYSmax(myMax[j], src.myMax[j]);
639 if (myTupleSize > 16)
674 return size == 0 ? tuple_size :
SYSmin(size, tuple_size);
701 int tuple_size,
int stride)
const
702 { t_extendedFill(data, start, length, tuple_size, 1, stride); }
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); }
727 { t_extendedFillArray(data, sizes, start, length); }
730 { t_extendedFillArray(data, sizes, start, length); }
733 { t_extendedFillArray(data, sizes, start, length); }
736 { t_extendedFillArray(data, sizes, start, length); }
739 { t_extendedFillArray(data, sizes, start, length); }
742 { t_extendedFillArray(data, sizes, start, length); }
745 { t_extendedFillArray(data, sizes, start, length); }
748 { t_extendedFillArray(data, sizes, start, length); }
752 int tuple_size,
int stride,
755 doExtendedQuantizedFill(data, start, length, tuple_size,
756 1, stride, black, white);
758 virtual void doExtendedQuantizedFill(
uint8 *
data,
760 int tuple_size,
int nrepeats,
int stride,
764 template <
typename T_POD>
778 : myArray(src.myArray)
781 , myStart(src.myStart)
782 , myStride(src.myStride)
787 exint i = range.begin();
788 T_POD *dest = myData + i*myStride;
789 for (; i != range.end(); ++i, dest += myStride)
791 myArray.import(i+myStart, dest, 3);
792 myBox.enlargeBounds(dest[0], dest[1], dest[2]);
797 myBox.enlargeBounds(src.myBox);
811 stride =
SYSmax(stride, 3);
819 stride =
SYSmax(stride, 3);
827 template <
typename T_POD>
void
829 int tsize,
int nrepeats,
int stride)
const;
832 template <
typename T_POD>
void
840 template <
typename T,
int tuplesize>
class VectorPODAccessor
847 array.
get(offset, result.data(), tuplesize);
881 template <
typename T,
int FAKE>
class TypeInfo {};
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; };
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; };
921 template <
typename T>
T
925 template <
typename T>
T
928 return (1-t)*getValue<T>(i0) + t*getValue<T>(i1);
931 template <
typename T>
T
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;
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
SYS_HashType hash() const
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.
virtual void extendedFill(int16 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
virtual bool getIA32(UT_ValArray< int32 > &a, GT_Offset offset) const
virtual void doFillQuantizedArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride, fpreal black, fpreal white) const
virtual bool isValid() const
Data array is valid; can be sampled from.
GLsizei GLenum const void * indices
void fillArray(UT_Array< fpreal64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
virtual void extendedFill(int32 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
void fillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
Nested class to perform filling for a POD array.
virtual bool getFA64(UT_ValArray< fpreal64 > &a, GT_Offset offset) const
virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
T lerpValue(GT_Offset i0, GT_Offset i1, fpreal t) const
virtual void fillStringArray(UT_StringArray &data, UT_ValArray< int > &sizes, GT_Offset start, GT_Size length) const
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
void join(const fillV3BoxTask< T_POD > &src)
void fillArray(UT_Array< fpreal32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual void doFillArray(int16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
bool enlargeBounds(UT_BoundingBox &b) const
GLdouble GLdouble GLdouble z
virtual fpreal32 getF32(GT_Offset offset, int idx=0) const =0
virtual const void * getBackingData() const
const UT_BoundingBox & box() const
virtual int64 getI64(GT_Offset offset, int idx=0) const
GLboolean GLboolean GLboolean GLboolean a
std::size_t SYS_HashType
Define the type for hash values.
static bool isBigInteger(GT_Size size)
Quick & dirty test to see if a size is bigger than a 32 bit int.
GLuint GLsizei GLsizei * length
virtual bool getUA8(UT_ValArray< uint8 > &a, GT_Offset offset) const
void fillArray(int16 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
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
Class which writes ASCII or binary JSON streams.
minMaxTask(const GT_DataArray &array)
**But if you need a result
virtual void extendedFill(int64 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
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
virtual void doFillArray(int64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
virtual GT_Size itemSize(GT_Offset) const
Return the number of elements in the array for the given item.
virtual void doFillVec3BBox(fpreal64 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxD &bbox, int, int stride)
virtual void extendedFill(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
virtual void doFillVec3BBox(fpreal32 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxF &bbox, int, int stride)
void fillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
virtual bool getIA64(UT_ValArray< int64 > &a, GT_Offset offset) const
__hostdev__ float getValue(uint32_t i) const
virtual bool computeMinMax(fpreal64 *min, fpreal64 *max) const
virtual bool getIA16(UT_ValArray< int16 > &a, GT_Offset offset) const
virtual void extendedFill(int8 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
virtual void doFillArrayAttr(UT_Array< fpreal16 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
void getResult(fpreal64 *min, fpreal64 *max) const
virtual void doFillArrayAttr(UT_Array< int32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Abstract data class for an array of float, int or string data.
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
UT_IntrusivePtr< GT_DataArray > GT_DataArrayHandle
virtual void extendedFill(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int nrepeats, int stride=-1) const
virtual int64 getDataId() const
fillV3BoxTask(const GT_DataArray &array, T_POD *data, GT_Offset start, int stride)
void fillArray(UT_Array< int8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual void doFillArray(int8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
virtual bool getFA32(UT_ValArray< fpreal32 > &a, GT_Offset offset) const
virtual bool getIA8(UT_ValArray< int8 > &a, GT_Offset offset) const
virtual bool getPointerAliasing(const void *data) const
Return "true" if there's pointer aliasing.
static const UT_OptionsHolder theEmptyOptions
GLint GLenum GLboolean GLsizei stride
virtual void doFillArrayAttr(UT_Array< int8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual void doFillArrayAttr(UT_Array< int16 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
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
virtual bool getSA(UT_StringArray &a, GT_Offset offset) const
#define SYS_STATIC_FORCE_INLINE
T getValue(GT_Offset index) const
Public accessor for POD types.
GLsizei const GLchar *const * strings
GLboolean GLboolean GLboolean b
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
fillV3BoxTask(fillV3BoxTask &src, UT_Split)
virtual void doFillArrayAttr(UT_Array< fpreal64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
void copyDataId(const GT_DataArray &src)
void operator()(const UT_BlockedRange< GT_Size > &range)
minMaxTask(minMaxTask &src, UT_Split)
void fillArray(int8 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
virtual bool getFA16(UT_ValArray< fpreal16 > &a, GT_Offset offset) const
virtual void doFillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
void fillVec3BBox(fpreal64 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxD &bbox, int tsize, int stride=-1)
virtual void doFillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
virtual void doFillArrayAttr(UT_Array< fpreal32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
bool getMinMax(fpreal64 *min, fpreal64 *max) const
Enlarge a bounding box with values of this 3-tuple array.
virtual int16 getI16(GT_Offset offset, int idx=0) const
void operator()(const UT_BlockedRange< exint > &range)
void fillVec3BBox(fpreal32 *dest, GT_Offset start, GT_Size length, UT_BoundingBoxF &bbox, int tsize, int stride=-1)
virtual bool hasArrayEntries() const
Returns "true" if each entry is an array.
void fillArray(UT_Array< int64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
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
void fillArray(uint8 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1, fpreal black=0, fpreal white=1) const
virtual GT_Dict getDict(GT_Offset offset, int idx=0) const
virtual void doFillArrayAttr(UT_Array< int64 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
T bilerpValue(GT_Offset u0v0, GT_Offset u1v0, GT_Offset u0v1, GT_Offset u1v1, fpreal u, fpreal v)
void fillArray(int32 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
GLubyte GLubyte GLubyte GLubyte w
virtual void fillDictionaryArray(UT_Array< UT_OptionsHolder > &data, UT_ValArray< int > &sizes, GT_Offset start, GT_Size length) const
void fillArray(int64 *data, GT_Offset start, GT_Size length, int tsize, int stride=-1) const
virtual void doFillArray(int32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
void join(const minMaxTask &src)
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)
virtual int8 getI8(GT_Offset offset, int idx=0) const
virtual GT_Size getTupleSize() const =0
Number of elements for each array element.
void fillArray(UT_Array< uint8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
virtual void doFillArrayAttr(UT_Array< uint8 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
Compute the min & max values for an array. This fails for strings.
virtual bool getDictA(UT_Array< UT_OptionsHolder > &a, GT_Offset offset) const
virtual GT_Size getTotalArrayEntries() const
void UTparallelReduceLightItems(const Range &range, Body &body)
void fillArray(UT_Array< int32 > &data, UT_Array< int > &sizes, GT_Offset start, GT_Size length) const
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.