c kspectrum (http://www.meso-star.com/en_Products.html) - This file is part of kspectrum c Copyright (C) 2008-2015 - Méso-Star - Vincent Eymet c c This file must be used under the terms of the CeCILL license. c This source file is licensed as described in the file COPYING, which c you should have received as part of this distribution. The terms c are also available at c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt c subroutine powercut(over,last_i,last_band,dbr,lastf,lastl,pass) implicit none integer over,last_i,last_band,dbr,lastf,lastl,pass integer ios c Detection of failures (so-called "power cuts") in the previous computation c File './over' contains a single integer value: c + if 0, the previous computation was interupted c + if 1, the previous computation ran fine open(10,file='./over',status='old',iostat=ios) if (ios.ne.0) then ! file not found over=1 else read(10,*) over endif close(10) if (over.eq.0) then open(11,file='./backup.txt',status='old',iostat=ios) if (ios.ne.0) then ! file not found write(*,*) 'Error from subroutine "powercut":' write(*,*) 'Previous computation was interrupted,' write(*,*) 'but file "./backup.txt" could not be found' stop else read(11,*) last_i read(11,*) last_band read(11,*) dbr read(11,*) lastf read(11,*) lastl read(11,*) pass endif close(11) else ! previous computation is over dbr=1 lastf=1 lastl=0 pass=1 endif call write_over(0) return end