This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import partio | |
import numpy as np | |
p = partio.create() | |
size = 3 | |
posattr = p.addAttribute("pos",partio.FLOAT,size) | |
for i in range(8): | |
p.addParticle() | |
data = tuple(i+j*100 for j in range(size)) | |
p.set(posattr, i, data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ensure array is contiguous, aligned and correct data type */ | |
array = PyArray_FROM_OTF(input_array, NPY_FLOAT32, NPY_CARRAY_RO); | |
/* reshape the input array to the correct dimensions */ | |
PyArray_Dims dims; | |
npy_intp shape[2] = {-1, attr.count}; | |
dims.len = 2; | |
dims.ptr = shape; | |
array = PyArray_Newshape((PyArrayObject *)array, &dims, NPY_CORDER); |
NewerOlder