Function getNoOfObservers() result(no_of_observers) use ParamfileRegions implicit none integer :: no_of_observers ! ! --------------- ! Local variables ! --------------- ! character(len=LINE_LENGTH) :: case_name, line integer :: fID integer :: io ! ! Initialize ! ---------- no_of_observers = 0 ! ! Get case file name ! ------------------ call get_command_argument(1, case_name) ! ! Open case file ! -------------- open ( newunit = fID , file = case_name , status = "old" , action = "read" ) ! ! Read the whole file to find the observers ! ------------------------------------ readloop:do read ( fID , '(A)' , iostat = io ) line if ( io .lt. 0 ) then ! ! End of file ! ----------- line = "" exit readloop elseif ( io .gt. 0 ) then ! ! Error ! ----- errorMessage(STD_OUT) error stop "Stopped." else ! ! Succeeded ! --------- line = getSquashedLine( line ) if ( index ( line , '#defineacousticobserver' ) .gt. 0 ) then no_of_observers = no_of_observers + 1 end if end if end do readloop ! ! Close case file ! --------------- close(fID) End Function getNoOfObservers