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

StaticArrays usage #185

Closed
martinmestre opened this issue Aug 30, 2024 · 4 comments
Closed

StaticArrays usage #185

martinmestre opened this issue Aug 30, 2024 · 4 comments

Comments

@martinmestre
Copy link

Hi, thanks for the package. I would like to know in which script or line of code you use StaticArrays, and how do you work with the number of particles which is not know at compile time.
Does your ODE solver require a phase-space SVector with dimension proportional to the number of particles ?
Thank you very much.

@jgreener64
Copy link
Collaborator

We use Vector{SVector{3, Float64}} or similar to represent coordinates. So the dimension of the SVector is the dimension of the space in which the simulation happens.

@martinmestre
Copy link
Author

martinmestre commented Aug 30, 2024

Thanks a lot! I understand that Vector{SVector{3, Float64}} is a static array, right? When calling the ODE solver, do you need to flatten it into a single array? That is the problem I am having when trying to use solvers in DifferentialEquations.jl. In some part I need to do u[1:n] and that breaks the static format.

@jgreener64
Copy link
Collaborator

Vector{SVector{3, Float64}} is a vector of static arrays, but itself is not static. I'm not so familiar with DifferentialEquations as we don't use it, but you can use reinterpret to get a Vector{Float64} with 3x the length.

@martinmestre
Copy link
Author

Thanks a lot!

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