| 1 |
!----------------------------------------------------------------- |
| 2 |
! |
| 3 |
! This file is (or was) part of SPLASH, a visualisation tool |
| 4 |
! for Smoothed Particle Hydrodynamics written by Daniel Price: |
| 5 |
! |
| 6 |
! http://users.monash.edu.au/~dprice/splash |
| 7 |
! |
| 8 |
! SPLASH comes with ABSOLUTELY NO WARRANTY. |
| 9 |
! This is free software; and you are welcome to redistribute |
| 10 |
! it under the terms of the GNU General Public License |
| 11 |
! (see LICENSE file for details) and the provision that |
| 12 |
! this notice remains intact. If you modify this file, please |
| 13 |
! note section 2a) of the GPLv2 states that: |
| 14 |
! |
| 15 |
! a) You must cause the modified files to carry prominent notices |
| 16 |
! stating that you changed the files and the date of any change. |
| 17 |
! |
| 18 |
! Copyright (C) 2005-2009 Daniel Price. All rights reserved. |
| 19 |
! Contact: [email protected] |
| 20 |
! |
| 21 |
!----------------------------------------------------------------- |
| 22 |
|
| 23 |
module colourparts |
| 24 |
implicit none |
| 25 |
|
| 26 |
contains |
| 27 |
|
| 28 |
subroutine colour_particles(dat,datmin,datmax,icolour,npart) |
| 29 |
use plotlib, only: plot_qcir |
| 30 |
integer, intent(in) :: npart |
| 31 |
real, dimension(npart), intent(in) :: dat |
| 32 |
real, intent(in) :: datmin, datmax |
| 33 |
integer, dimension(npart), intent(out) :: icolour |
| 34 |
integer :: i,icolourmin,icolourmax,icolourtemp |
| 35 |
real :: dx |
| 36 |
|
| 37 |
call plot_qcir(icolourmin,icolourmax) |
| 38 |
|
| 39 |
dx = (datmax - datmin)/real(icolourmax - icolourmin) |
| 40 |
|
| 41 |
do i=1,npart |
| 42 |
icolourtemp = int((dat(i) - datmin)/dx) + icolourmin |
| 43 |
if (icolourtemp > icolourmax) icolourtemp = icolourmax |
| 44 |
if (icolourtemp < icolourmin) icolourtemp = icolourmin |
| 45 |
icolour(i) = icolourtemp |
| 46 |
enddo |
| 47 |
|
| 48 |
return |
| 49 |
end subroutine colour_particles |
| 50 |
|
| 51 |
end module colourparts |