MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / setitem_vector

Method setitem_vector

src/python/PyImath/PyImathFixedVArray.cpp:480–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478}
479template <class T>
480void
481FixedVArray<T>::setitem_vector (PyObject* index, const FixedVArray<T>& data)
482{
483 if (!_writable)
484 throw std::invalid_argument ("Fixed V-array is read-only.");
485
486 size_t start = 0;
487 size_t end = 0;
488 size_t sliceLength = 0;
489 Py_ssize_t step;
490 extract_slice_indices (index, start, end, step, sliceLength, _length);
491
492 if ((size_t) data.len() != sliceLength)
493 {
494 PyErr_SetString (PyExc_IndexError,
495 "Dimensions of source do not match destination");
496 boost::python::throw_error_already_set();
497 }
498
499 if (_indices)
500 {
501 for (size_t i = 0; i < sliceLength; ++i)
502 {
503 _ptr[raw_ptr_index(start + i*step)*_stride] = data[i];
504 }
505 }
506 else
507 {
508 for (size_t i = 0; i < sliceLength; ++i)
509 {
510 _ptr[(start + i*step)*_stride] = data[i];
511 }
512 }
513}
514
515template <class T>
516void

Callers

nothing calls this directly

Calls 4

extract_slice_indicesFunction · 0.85
lenMethod · 0.45
writableMethod · 0.45
raw_ptr_indexMethod · 0.45

Tested by

no test coverage detected