array.h File Reference
+ Include dependency graph for array.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  VtArray< ELEM >
 Represents an arbitrary dimensional rectangular container class. More...
 

Macros

#define VT_ARRAY_EXTERN_TMPL(r, unused, elem)   extern template class VtArray< VT_TYPE(elem) >;
 
#define VTOPERATOR_CPPARRAY(op)
 
#define VTOPERATOR_CPPSCALAR_TYPE(op, arraytype, scalartype, rettype)
 
#define VTOPERATOR_CPPSCALAR(op)   VTOPERATOR_CPPSCALAR_TYPE(op,ElemType,ElemType,ElemType)
 
#define VTOPERATOR_CPPSCALAR_DOUBLE(op)
 

Functions

template<class HashState , class ELEM >
std::enable_if_t< VtIsHashable< ELEM >)> TfHashAppend (HashState &h, VtArray< ELEM > const &array)
 
template<class ELEM >
std::enable_if< VtIsHashable< ELEM >), size_t >::type hash_value (VtArray< ELEM > const &array)
 
ARCH_PRAGMA_PUSH ARCH_PRAGMA_FORCING_TO_BOOL ARCH_PRAGMA_UNSAFE_USE_OF_BOOL ARCH_PRAGMA_UNARY_MINUS_ON_UNSIGNED VTOPERATOR_CPPARRAY (+)
 
 VTOPERATOR_CPPARRAY (-)
 
VTOPERATOR_CPPARRAY * VTOPERATOR_CPPARRAY (/);VTOPERATOR_CPPARRAY(%
 
template<class T >
VtArray< T > operator- (VtArray< T > const &a)
 

Macro Definition Documentation

◆ VTOPERATOR_CPPARRAY

#define VTOPERATOR_CPPARRAY (   op)
Value:
template <class T> \
VtArray<T> \
operator op (VtArray<T> const &lhs, VtArray<T> const &rhs) \
{ \
/* accept empty vecs */ \
if (!lhs.empty() && !rhs.empty() && lhs.size() != rhs.size()) { \
TF_CODING_ERROR("Non-conforming inputs for operator %s", #op); \
return VtArray<T>(); \
} \
/* promote empty vecs to vecs of zeros */ \
const bool leftEmpty = lhs.size() == 0, rightEmpty = rhs.size() == 0; \
VtArray<T> ret(leftEmpty ? rhs.size() : lhs.size()); \
T zero = VtZero<T>(); \
if (leftEmpty) { \
std::transform(rhs.begin(), rhs.end(), ret.begin(), \
[zero](T const &r) { return T(zero op r); }); \
} \
else if (rightEmpty) { \
std::transform(lhs.begin(), lhs.end(), ret.begin(), \
[zero](T const &l) { return T(l op zero); }); \
} \
else { \
std::transform(lhs.begin(), lhs.end(), rhs.begin(), ret.begin(), \
[](T const &l, T const &r) { return T(l op r); }); \
} \
return ret; \
}
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:229

Definition at line 960 of file array.h.

◆ VTOPERATOR_CPPSCALAR_DOUBLE

#define VTOPERATOR_CPPSCALAR_DOUBLE (   op)
Value:
template<typename ElemType> \
typename boost::disable_if<boost::is_same<ElemType, double>, \
VtArray<ElemType> >::type \
operator op (double const &scalar, \
VtArray<ElemType> const &vec) { \
VtArray<ElemType> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = scalar op vec[i]; \
} \
return ret; \
} \
template<typename ElemType> \
typename boost::disable_if<boost::is_same<ElemType, double>, \
VtArray<ElemType> >::type \
operator op (VtArray<ElemType> const &vec, \
double const &scalar) { \
VtArray<ElemType> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = vec[i] op scalar; \
} \
return ret; \
}
size_t size() const
Return the total number of elements in this array.
Definition: array.h:490
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:229

Definition at line 1041 of file array.h.

◆ VTOPERATOR_CPPSCALAR_TYPE

#define VTOPERATOR_CPPSCALAR_TYPE (   op,
  arraytype,
  scalartype,
  rettype 
)
Value:
template<typename arraytype> \
VtArray<ElemType> \
operator op (scalartype const &scalar, \
VtArray<arraytype> const &vec) { \
VtArray<rettype> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = scalar op vec[i]; \
} \
return ret; \
} \
template<typename arraytype> \
VtArray<ElemType> \
operator op (VtArray<arraytype> const &vec, \
scalartype const &scalar) { \
VtArray<rettype> ret(vec.size()); \
for (size_t i = 0; i<vec.size(); ++i) { \
ret[i] = vec[i] op scalar; \
} \
return ret; \
}
size_t size() const
Return the total number of elements in this array.
Definition: array.h:490
Represents an arbitrary dimensional rectangular container class.
Definition: array.h:229

Definition at line 1013 of file array.h.