Implement BMI get_value_ptr method in C++ template
mdpiper opened this issue · 1 comments
mdpiper commented
This is a request to implement the BMI get_value_ptr method in the C++ cookiecutter template.
mdpiper commented
Here's a possible way to do it:
cpdef get_value_ptr(self, name):
cdef int gid = self.get_var_grid(name)
cdef int size = self.get_grid_size(gid)
cdef void* ptr
ptr = self._bmi.GetValuePtr(<char*>name)
return np.asarray(<np.float_t[:size]>ptr)
This is C-like, though; I'm not sure if there's a cleaner C++ way to do this.