You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having the possibility to have a different type for the LazyRow index other than I
struct LazyRow{T, N, C, Ic, Ii}
columns::StructArray{T, N, C, Ic} # a `Columns` object
index::Ii
end
allows me to define a StructArray of points and a StructArray of triangles, with indexes being of type StaticVectors (a triangle always contains 3 points):
struct Point{T}
position::SVector{3,T}
force::SVector{3,T}
end
struct Triangle{Tp}
points::Tp
end
points = StructArray([Point{Float64}(rand(3), zeros(3)) for _ in 1:10])
tris = StructArray([Triangle(LazyRow(points, @SVector [rand(1:10), rand(1:10), rand(1:10)])) for _ in 1:5])
I can now update the point forces in the triangles this way, which is really helpful in my case:
for t in tris
pos = t.points.position
f1 = sum.(pos)
f2 = tan.(f1)
f3 = sin.(f1)
f = Vec3(f1, f2, f3)
t.points.force += f
end
Does that make sense? Would that make some thing break somewhere?
Thanks
The text was updated successfully, but these errors were encountered:
Having the possibility to have a different type for the LazyRow index other than
I
allows me to define a StructArray of points and a StructArray of triangles, with indexes being of type StaticVectors (a triangle always contains 3 points):
I can now update the point forces in the triangles this way, which is really helpful in my case:
Does that make sense? Would that make some thing break somewhere?
Thanks
The text was updated successfully, but these errors were encountered: