Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
More updates to the collision snapshot taker
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 9, 2022
1 parent df77b32 commit 245c9bd
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1300,14 +1300,35 @@ module subroutine symba_util_take_collision_snapshot(self, param, t, stage)
character(*), intent(in) :: stage !! Either before or after
! Arguments
class(fraggle_collision_snapshot), allocatable :: snapshot
integer(I4B) :: i,j

select case(stage)
case("before")
associate (idx => self%colliders%idx, ncoll => self%colliders%ncoll)
allocate(fraggle_collision_snapshot :: snapshot)
allocate(snapshot%colliders, source=self%colliders)
allocate(symba_pl :: snapshot%colliders%pl)
select type(pl => snapshot%colliders%pl)
class is (symba_pl)
call pl%setup(ncoll, param)
pl%id(:) = self%pl%id(idx(:))
pl%Gmass(:) = self%pl%Gmass(idx(:))
pl%radius(:) = self%pl%radius(idx(:))
pl%rot(:,:) = self%pl%rot(:,idx(:))
pl%Ip(:,:) = self%pl%Ip(:,idx(:))
pl%rh(:,:) = self%pl%rh(:,idx(:))
pl%vh(:,:) = self%pl%vh(:,idx(:))
pl%info(:) = self%pl%info(idx(:))
end select
end associate

case("after")

end select


! Save the self
call symba_util_save_storage(self,snapshot,t)
return
end subroutine symba_util_take_collision_snapshot

Expand Down Expand Up @@ -1411,12 +1432,6 @@ module subroutine symba_util_take_encounter_snapshot(self, param, t)
end select
end select

select type(snapshot)
class is (fraggle_collision_snapshot)
allocate(snapshot%colliders, source=self%colliders)
allocate(snapshot%fragments, source=self%fragments)
end select

! Save the snapshot
call symba_util_save_storage(self,snapshot,t)
end select
Expand Down

0 comments on commit 245c9bd

Please sign in to comment.