| 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 titles |
| 24 |
implicit none |
| 25 |
integer, parameter, private :: maxtitles = 50 |
| 26 |
integer, parameter, private :: maxsteplegend = 100 |
| 27 |
integer, parameter, public :: lensteplegend = 60 |
| 28 |
integer, parameter, public :: lenpagetitles = 60 |
| 29 |
character(len=lenpagetitles), dimension(maxtitles), public :: pagetitles |
| 30 |
character(len=lensteplegend), dimension(maxsteplegend), public :: steplegend |
| 31 |
public :: read_titles, read_steplegend |
| 32 |
|
| 33 |
private |
| 34 |
|
| 35 |
contains |
| 36 |
! |
| 37 |
!--reads a list of titles (one per line), to be used to label each plot on page |
| 38 |
! |
| 39 |
subroutine read_titles(ntitles) |
| 40 |
use asciiutils, only:read_asciifile |
| 41 |
use filenames, only:fileprefix |
| 42 |
integer, intent(out) :: ntitles |
| 43 |
character(len=50) :: titlefile |
| 44 |
logical :: iexist |
| 45 |
|
| 46 |
titlefile = trim(fileprefix)//'.titles' |
| 47 |
!--also allow obsolete title filename |
| 48 |
inquire(file=titlefile,exist=iexist) |
| 49 |
if (.not.iexist) then |
| 50 |
inquire(file='titlelist',exist=iexist) |
| 51 |
if (iexist) titlefile='titlelist' |
| 52 |
endif |
| 53 |
ntitles = 0 |
| 54 |
|
| 55 |
call read_asciifile(titlefile,ntitles,pagetitles) |
| 56 |
if (ntitles > 0) print "(a)",'read plot titles from file '//trim(titlefile) |
| 57 |
|
| 58 |
return |
| 59 |
end subroutine read_titles |
| 60 |
! |
| 61 |
!--reads a list of labels (one per line) to be used in the timestep legend |
| 62 |
! (ie. for multiple timesteps on same page) |
| 63 |
! |
| 64 |
subroutine read_steplegend(nsteptitles) |
| 65 |
use asciiutils, only:read_asciifile |
| 66 |
use filenames, only:fileprefix |
| 67 |
integer, intent(out) :: nsteptitles |
| 68 |
character(len=50) :: legendfile |
| 69 |
logical :: iexist |
| 70 |
|
| 71 |
legendfile = trim(fileprefix)//'.legend' |
| 72 |
!--also allow obsolete legend filename |
| 73 |
inquire(file=legendfile,exist=iexist) |
| 74 |
if (.not.iexist) then |
| 75 |
inquire(file='legend',exist=iexist) |
| 76 |
if (iexist) legendfile='legend' |
| 77 |
endif |
| 78 |
nsteptitles = 0 |
| 79 |
|
| 80 |
call read_asciifile(legendfile,nsteptitles,steplegend) |
| 81 |
if (nsteptitles > 0) print "(a)"//'read legend text from file '''//trim(legendfile)//'''' |
| 82 |
|
| 83 |
return |
| 84 |
end subroutine read_steplegend |
| 85 |
|
| 86 |
end module titles |