Skip to content

Adding Verlet Integration in Swift #263

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

Merged
merged 2 commits into from
Aug 27, 2018
Merged

Adding Verlet Integration in Swift #263

merged 2 commits into from
Aug 27, 2018

Conversation

Wesley-Arrington
Copy link
Contributor

Added Verlet Integration in Swift

@Gathros Gathros added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jul 17, 2018
@Butt4cak3
Copy link
Contributor

The code looks good, but take a look at #257. We decided to move the print statements from inside the verlet functions to main and make the functions return times and velocities instead.

@Wesley-Arrington
Copy link
Contributor Author

Sounds good just updated my code accordingly 👍

Copy link
Contributor

@Butt4cak3 Butt4cak3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a few days to get back to this, but let's get it done now.


func stormerVerlet(pos: Double, acc: Double, dt: Double) -> (time: Double, vel: Double) {
var temp_pos, time, vel: Double
var paramPos = pos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick question: Why is this variable needed? Are parameters immutable by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya parameters in Swift are immutable by default. Your comment made me realize though that there is a much cleaner way to do the same thing. So I replaced var paramPos = pos with var pos = pos.

var prev_pos = pos
time = 0.0

while (paramPos > 0){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ew! No space between ) and {...

vel = 0
time = 0

while (paramPos > 0){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as further up. No space.

@Butt4cak3 Butt4cak3 self-assigned this Jul 21, 2018
@Wesley-Arrington
Copy link
Contributor Author

Just made the necessary revisions

@jiegillet
Copy link
Member

@Butt4cak3, are you good with the changes?

@Butt4cak3
Copy link
Contributor

I'm sorry that it took me so long to get back to this. I was taking a break and thought I was done with everything I was assigned to. I'll merge this as soon as I get home today.

@Butt4cak3
Copy link
Contributor

Alright. I had to get into this again because it's been a while. Everything checks out, so this can go straight to master. Sorry again, @CDsigma.

@Butt4cak3 Butt4cak3 merged commit 954ebfa into algorithm-archivists:master Aug 27, 2018
@Wesley-Arrington Wesley-Arrington deleted the verletSwift branch September 10, 2018 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants