Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set the i,j,k index for a multidimensional structarray ? #191

Open
MKAbdElrahman opened this issue May 17, 2021 · 1 comment
Open

Comments

@MKAbdElrahman
Copy link

Currently, to set the field values for the ijk struct, I convert first to linear indexing.

lh = LazyRow(h,i + Ny*(j-1) + Nx*Ny * (k-1));
					
setproperty!(lh,:x,hx)
setproperty!(lh,:y,hy)					
setproperty!(lh,:z,hz)		

I wonder if there is a direct way:

lh = LazyRow(h,(i,j,k));

setproperty!(lh,:x,hx)
setproperty!(lh,:y,hy)					
setproperty!(lh,:z,hz)
@piever
Copy link
Collaborator

piever commented May 18, 2021

Ah, LazyRow is actually a bit too low-level, because it assumes that the passed index type is the optimal one for the array you are using.

lh = LazyRows(t)[i, j, k]

is probably what you want. Keeping the issue open because the docs should probably get updated to make this clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants