OpenVDB copyFromArray throws memory error

18 Views Asked by At

A simple code that uses openvdb copyFromArray is failing with the following error

free(): invalid pointer
Aborted (core dumped)

Can someone please tell me why is this failing?

thanks.

Packages:

Python 3.8.10
Name: pyopenvdb-3.8
Version: 0.1.5

Code:

import openvdb
import numpy as np

# Create a sample 3D NumPy array
data = np.random.rand(100, 100, 100)  # 100x100x100 array of random values

# Create an empty FloatGrid
grid = openvdb.FloatGrid()

# Copy the NumPy array into the grid
grid.copyFromArray(data)

# Print grid information
print("Grid metadata:", grid.meta())
print("Active voxel count:", grid.activeVoxelCount())

# Write the grid to a VDB file
openvdb.write('output.vdb', grids=[grid])
0

There are 0 best solutions below