Index: palm/trunk/SCRIPTS/.dvrserver.config
===================================================================
--- palm/trunk/SCRIPTS/.dvrserver.config	(revision 260)
+++ palm/trunk/SCRIPTS/.dvrserver.config	(revision 260)
@@ -0,0 +1,8 @@
+SOCKBUF=262144
+MTU=262144
+BASEDIR=<replace by dvr data directory>
+RTSPPORT=1876
+DATAPORT=1878
+UID=<replace by user id>
+GID=<replace by group id>
+# comment
Index: palm/trunk/SCRIPTS/.mrun.config.default
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.default	(revision 259)
+++ palm/trunk/SCRIPTS/.mrun.config.default	(revision 260)
@@ -31,9 +31,9 @@
 %compiler_name     mpif90                                        <hi> parallel
 %compiler_name_ser ifort                                         <hi> parallel
-%cpp_options       -D__mpi2:-DMPI_REAL=MPI_DOUBLE_PRECISION:-DMPI_2REAL=MPI_2DOUBLE_PRECISION:-D__netcdf:-D__netcdf_64bit:-D__intel_openmp_bug   <hi> parallel
+%cpp_options       -D__mpi2:-DMPI_REAL=MPI_DOUBLE_PRECISION:-DMPI_2REAL=MPI_2DOUBLE_PRECISION:-D__netcdf:-D__netcdf_64bit   <hi> parallel
 %netcdf_inc        -I:<replace by netcdf include path>           <hi> parallel
 %netcdf_lib        -L<replace by netcdf library path>:-lnetcdf   <hi> parallel
-%fopts             -axW:-cpp:-openmp:-r8:-nbs:-convert:little_endian:-I:<replace by mpi include path>   <hi> parallel
-%lopts             -axW:-cpp:-openmp:-r8:-nbs:-Vaxlib:-L:<replace by mpi library path>                  <hi> parallel
+%fopts             -axW:-cpp:-r8:-nbs:-convert:little_endian:-I:<replace by mpi include path>   <hi> parallel
+%lopts             -axW:-cpp:-r8:-nbs:-Vaxlib:-L:<replace by mpi library path>                  <hi> parallel
 # if you want to use your own hostfile, uncomment next line
 #%hostfile          $base_directory/.hostfile                    <hi> parallel
Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 259)
+++ palm/trunk/SCRIPTS/mrun	(revision 260)
@@ -171,4 +171,10 @@
      #                     interactive runs
      # 05/03/09 - Siggi  - adjustments for new NEC-SX9 at RIAM (necriam)
+     # 16/03/09 - Siggi  - dvrp_lib, dvrp_inc replaced by dvr_lib, dvr_inc,
+     #                     dvr streaming server is automatically started using
+     #                     new variable dvr_server and a configuration file
+     #                     .dvrserver.config,
+     #                     processing of dvr output files implemented, in order
+     #                     to make dvr application more user friendly
 
 
@@ -225,4 +231,5 @@
  localhost_realname=$(hostname)
  local_compile=false
+ local_dvrserver_running=.FALSE.
  locat=normal
  mainprog=""
@@ -360,4 +367,9 @@
              [[ $delete_temporary_catalog = true ]]  &&  rm -rf $TEMPDIR
           fi
+          if [[ "$dvrserver_id" != "" ]]
+          then
+             echo "+++ killing dvrserver_id=$dvrserver_id"
+             kill $dvrserver_id
+          fi
           if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]]
           then
@@ -378,4 +390,9 @@
        then
           rm -rf  ~/job_queue/JOBINFO.$QSUB_REQID
+       fi
+       if [[ "$dvrserver_id" != "" ]]
+       then
+          echo "+++ killing dvrserver_id=$dvrserver_id"
+          kill $dvrserver_id
        fi
        printf "\n+++ MRUN killed by \"^C\" \n\n"
@@ -1320,7 +1337,10 @@
     if [[ ! ( $fromhost != $localhost  &&  ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]]
     then
-       if [[ "${actionout[$i]}" = tr  ||  "${actionout[$i]}" = trpe ]]
+       if [[ "${actionout[$i]}" = tr ]]
        then
           actionout[$i]=""
+       elif [[ "${actionout[$i]}" = trpe ]]
+       then
+          actionout[$i]=pe
        elif [[ "${actionout[$i]}" = tra ]]
        then
@@ -1429,18 +1449,18 @@
 
 
-     # DAS DVRP-PAKET ERFORDERT EINE ENTSPRECHENDE BIBLIOTHEK
+     # DAS DVR-PAKET ERFORDERT EINE ENTSPRECHENDE BIBLIOTHEK
  if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]]
  then
-    if [[ "$dvrp_inc" = "" ]]
-    then
-       printf "\n\n  +++ no value for \"dvrp_inc\" given in configuration file"
+    if [[ "$dvr_inc" = "" ]]
+    then
+       printf "\n\n  +++ no value for \"dvr_inc\" given in configuration file"
        printf "\n      This is required for the dvrp_graphics package.\n"
-       locat=dvrp; exit
-    fi
-    if [[ "$dvrp_lib" = "" ]]
-    then
-       printf "\n\n  +++ no value for \"dvrp_lib\" given in configuration file"
+       locat=dvr; exit
+    fi
+    if [[ "$dvr_lib" = "" ]]
+    then
+       printf "\n\n  +++ no value for \"dvr_lib\" given in configuration file"
        printf "\n      This is required for the dvrp_graphics package.\n"
-       locat=dvrp; exit
+       locat=dvr; exit
     fi
  fi
@@ -1953,6 +1973,6 @@
 
     # COMPILE- UND LINK-OPTIONEN BESTIMMEN
- fopts="$fopts $netcdf_inc $dvrp_inc"
- lopts="$lopts $netcdf_lib $dvrp_lib"
+ fopts="$fopts $netcdf_inc $dvr_inc"
+ lopts="$lopts $netcdf_lib $dvr_lib"
  ROPTS="$ropts"
  if [[ ( $(echo $host | cut -c1-3) = nec  ||  $(echo $host | cut -c1-3) = ibm  ||  $host = lcsgih  ||  $host = lcsgib  ||  $host = lctit  ||  $host = lcfimm  ||  $host = lcxt4 )  &&  -n $numprocs ]]
@@ -2742,4 +2762,79 @@
 
 
+       # EVENTUELLE INPUT-KOMMANDOS ABARBEITEN
+    (( i = 0 ))
+    while (( i < iic ))
+    do
+       (( i = i + 1 ))
+       if (( i == 1 ))
+       then
+          printf "\n\n  *** execution of INPUT-commands:\n$striche"
+       fi
+       printf "\n  >>> ${in_command[$i]}"
+       eval  ${in_command[$i]}
+       if (( i == iic ))
+       then
+          printf "\n$striche\n"
+       fi
+    done
+
+
+       # VERBLEIBENDE CPU-ZEIT BERECHNEN
+    cpurest=${cpumax}.
+
+
+       # START DVR STREAMING SERVER
+    if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]]
+    then
+       if [[ "$dvr_server" != "" ]]
+       then
+
+          printf "\n\n  *** preparing the dvr streaming server configuration file"
+
+             # Check, if a dvr server is already running
+          running_dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config | grep -v grep) | cut -d" " -f2`
+          if [[ "$running_dvrserver_id" != "" ]]
+          then
+
+             printf "\n  +++ WARNING: A dvr server with id=$running_dvrserver_id is already running!"
+             printf "\n      This server is used instead starting a new one!"
+
+          else
+
+                # COPY CONFIGURATION FILE FOR STREAMING SERVER FROM REPOSITORY TO HERE
+             if [[ -f ${PALM_BIN}/.dvrserver.config ]]
+             then
+                cp  ${PALM_BIN}/.dvrserver.config  .
+
+                   # Entering the BASEDIR, UID and GID into this file
+                user_id=`id -u`
+                group_id=`id -g`
+                   # & is needed as seperator, because TEMPDIR contains /
+                sed "s&<replace by dvr data directory>&${TEMPDIR}&g" .dvrserver.config > .dvrserver.1
+                sed "s/<replace by user id>/$user_id/g"    .dvrserver.1 > .dvrserver.2
+                sed "s/<replace by group id>/$group_id/g"  .dvrserver.2 > .dvrserver.3
+                mv  .dvrserver.3  .dvrserver.config
+                rm  .dvrserver.1  .dvrserver.2
+
+                   # Start dvr server in background, get his id and print on terminal
+                $dvr_server  .dvrserver.config  >>  DVR_LOGFILE  2>&1  &
+                dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config) | cut -d" " -f2`
+                printf "\n  *** streaming server with id=$dvrserver_id is started in background"
+                local_dvrserver_running=.TRUE.
+             else
+                printf "\n  +++ missing file \".dvrserver.config\" in directory:"
+                printf "\n      \"$PALM_BIN\" "
+                locat=dvr
+                exit
+             fi
+
+          fi
+
+       else
+          printf "\n\n  --- INFORMATIVE: no dvr streaming server will be started"
+       fi
+    fi
+
+
        # NAMELIST-DATEI MIT WERTEN VON ENVIRONMENT-VARIABLEN ERZEUGEN (ZU
        # LESEN VON PALM)
@@ -2748,29 +2843,8 @@
           write_binary = '$write_binary', tasks_per_node = $tasks_per_node,
           maximum_cpu_time_allowed = ${cpumax}.,
-          revision = '$global_revision' /
+          revision = '$global_revision',
+          local_dvrserver_running = $local_dvrserver_running /
 
 %%END%%
-
-
-       # EVENTUELLE INPUT-KOMMANDOS ABARBEITEN
-    (( i = 0 ))
-    while (( i < iic ))
-    do
-       (( i = i + 1 ))
-       if (( i == 1 ))
-       then
-          printf "\n\n  *** execution of INPUT-commands:\n$striche"
-       fi
-       printf "\n  >>> ${in_command[$i]}"
-       eval  ${in_command[$i]}
-       if (( i == iic ))
-       then
-          printf "\n$striche\n"
-       fi
-    done
-
-
-       # VERBLEIBENDE CPU-ZEIT BERECHNEN
-    cpurest=${cpumax}.
 
 
@@ -3178,4 +3252,11 @@
 #       [[ ! ( "$cond1" = debug  ||  "$cond2" = debug ) ]]  &&  cat  aout_output*
        printf "\n$striche\n  *** execution finished \n"
+
+          # Stop the dvr streaming server
+       if [[ "$dvrserver_id" != "" ]]
+       then
+          kill $dvrserver_id
+          printf "\n  *** dvr server with id=$dvrserver_id has been stopped"
+       fi
     fi
 
@@ -3254,5 +3335,5 @@
        then
           printf "\n  +++ temporary OUTPUT-file  ${localout[$i]}  does not exist\n"
-       elif [[ ! -f ${localout[$i]}/_0000  &&  $files_for_pes = true ]]
+       elif [[ ! -d ${localout[$i]}  &&  $files_for_pes = true ]]
        then
           printf "\n  +++ temporary OUTPUT-file  ${localout[$i]}/....  does not exist\n"
Index: palm/trunk/SCRIPTS/process_dvr_output
===================================================================
--- palm/trunk/SCRIPTS/process_dvr_output	(revision 260)
+++ palm/trunk/SCRIPTS/process_dvr_output	(revision 260)
@@ -0,0 +1,165 @@
+#!/bin/ksh
+# process_dvr_output - a script processing dvr steering + data files
+# $Id$
+
+     # Last changes:
+     # 16/03/09 - Siggi - Generating the first version
+
+
+
+    # variable declarations + default values
+ camera=false
+ groundplate=false
+ topography=false
+
+ typeset  -i  i nstream nscenes
+
+
+    # read shellscript options
+ while  getopts  :d:f: option
+ do
+   case  $option  in
+       (d)   data_catalog=$OPTARG;;
+       (f)   file_identifier=$OPTARG;;
+       (\?)  printf "\n  +++ unknown option $OPTARG \n"
+             printf "\n      allowed option are -d and -f \n"
+             exit;;
+   esac
+ done
+
+
+    # find out the number of streams
+ (( i = 0 ))
+ while true
+ do
+    (( i = i + 1 ))
+    if (( i < 10 ))
+    then
+       cstream=0$i
+    else
+       cstream=$i
+    fi
+
+    if [[ $(ls -1 *.* | grep -c $cstream) = 0 ]]
+    then
+       (( i = i - 1 ))
+       break
+    fi
+
+       # find out the stream name
+    streamname[$i]=`ls -1 ${cstream}_*-ge.dvrs | cut -f1 -d"-"`
+
+       # get addres
+    adr[$i]=`grep ADR= ${streamname[$i]}.dvrs | grep '*' | cut -f2 -d"="`
+
+       # get maxbytes
+    maxbytes[$i]=`head -1 ${streamname[$i]}.max`
+
+       # get number of frames
+    frames[$i]=`tail -1 ${streamname[$i]}.max`
+
+ done
+
+ nstream=$i
+ nscenes=$nstream
+
+ echo "*** number of detected streams = $i"
+
+ (( i = 0 ))
+ while (( i < nstream ))
+ do
+
+    (( i = i + 1 ))
+    echo "*** streamname: \"${streamname[$i]}\" "
+    echo "    adr = \"${adr[$i]}\" "
+    echo "    maxbytes = \"${maxbytes[$i]}\" "
+    echo "    frames = \"${frames[$i]}\" "
+
+ done
+
+    # Check, if there are files containing the camera data, the ground plate
+    # and topography data.
+    # Check the first stream only, because all streams have the same files.
+ if [[ -f ${streamname[1]}_camera.max ]]
+ then
+    camera=true
+    adr_camera=`grep ADR= ${streamname[1]}.dvrs | grep 'camera' | cut -f2 -d"="`
+    maxbytes_camera=`head -1 ${streamname[1]}_camera.max`
+    (( nscenes = nscenes + 1 ))
+ fi
+ if [[ -f ${streamname[1]}_groundplate.max ]]
+ then
+    groundplate=true
+    adr_groundplate=`echo $adr_camera | sed "s/camera/groundplate/g"`
+    maxbytes_groundplate=`head -1 ${streamname[1]}_groundplate.max`
+    (( nscenes = nscenes + 1 ))
+ fi
+ if [[ -f ${streamname[1]}_topography.max ]]
+ then
+    topography=true
+    adr_topography=`echo $adr_camera | sed "s/camera/topography/g"`
+    maxbytes_topography=`head -1 ${streamname[1]}_topography.max`
+    (( nscenes = nscenes + 1 ))
+ fi
+
+
+
+    # start with writing the dvrs file for the combined streams
+ dvr_file=${file_identifier}.dvrs
+
+ echo  "SCENES=$nscenes"  >  $dvr_file
+
+    # first, add the static scenes
+ if [[ $camera = true ]]
+ then
+    echo  "MED=TCP"                    >>  $dvr_file
+    echo  "ADR=$adr_camera"            >>  $dvr_file
+    echo  "MAXBYTES=$maxbytes_camera"  >>  $dvr_file
+    echo  "FRAMES=1"                   >>  $dvr_file
+    echo  "FRAMES_P_SEC=0"             >>  $dvr_file
+    echo  "SCENEEND"                   >>  $dvr_file
+ fi
+
+ if [[ $groundplate = true ]]
+ then
+    echo  "MED=TCP"                         >>  $dvr_file
+    echo  "ADR=$adr_groundplate"            >>  $dvr_file
+    echo  "MAXBYTES=$maxbytes_groundplate"  >>  $dvr_file
+    echo  "FRAMES=1"                        >>  $dvr_file
+    echo  "FRAMES_P_SEC=0"                  >>  $dvr_file
+    echo  "SCENEEND"                        >>  $dvr_file
+ fi
+
+ if [[ $topography = true ]]
+ then
+    echo  "MED=TCP"                        >>  $dvr_file
+    echo  "ADR=$adr_topography"            >>  $dvr_file
+    echo  "MAXBYTES=$maxbytes_topography"  >>  $dvr_file
+    echo  "FRAMES=1"                       >>  $dvr_file
+    echo  "FRAMES_P_SEC=0"                 >>  $dvr_file
+    echo  "SCENEEND"                       >>  $dvr_file
+ fi
+
+
+     # now add the streams
+ (( i = 0 ))
+ while (( i < nstream ))
+ do
+
+    (( i = i + 1 ))
+
+    echo  "MED=TCP"                   >>  $dvr_file
+    echo  "ADR=${adr[$i]}"            >>  $dvr_file
+    echo  "MAXBYTES=${maxbytes[$i]}"  >>  $dvr_file
+    echo  "FRAMES=${frames[$i]}"      >>  $dvr_file
+    echo  "FRAMES_P_SEC=25"           >>  $dvr_file
+    echo  "SCENEEND"                  >>  $dvr_file
+
+ done
+
+
+    # create the html file for the combined scenes
+ cp  01_*-ge.html  tmp.html
+ replace=$(echo `grep src= tmp.html`)
+ sed "s&${replace}&src=\"${file_identifier}.dvrs\"&g" tmp.html > ${file_identifier}.html
+ rm tmp.html
Index: palm/trunk/SOURCE/init_dvrp.f90
===================================================================
--- palm/trunk/SOURCE/init_dvrp.f90	(revision 259)
+++ palm/trunk/SOURCE/init_dvrp.f90	(revision 260)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! Output names are changed: surface=groundplate, buildings=topography
 ! Output of messages replaced by message handling routine.
 ! Clipping implemented.
@@ -146,4 +147,10 @@
     ENDIF
 
+!
+!-- A local dvrserver running always outputs on temporary directory DATA_DVR
+    IF ( local_dvrserver_running )  THEN
+       dvrp_directory = 'DATA_DVR'
+    ENDIF
+
     IF ( dvrp_output /= 'local' )  THEN
        IF ( dvrp_file /= 'default'  .AND.  dvrp_file /= '/dev/null' )  THEN
@@ -176,5 +183,5 @@
             mode_dvrp(m)(1:9)  /= 'pathlines' )  THEN
 
-          message_string = 'mode_dvrp="' // TRIM( mode_dvrp ) // '" not allowed'
+          message_string = 'mode_dvrp="' // TRIM( mode_dvrp(m) ) // '" not allowed'
           CALL message( 'init_dvrp', 'PA0198', 1, 2, 0, 6, 0 )
           CALL local_stop
@@ -259,9 +266,9 @@
 
 !
-!--          Create filename for buildings
+!--          Create filename for topography
              IF ( dvrp_output == 'rtsp' )  THEN
 
                 dvrp_file   = prefix_chr // TRIM( mode_dvrp(m) )  &
-                              // '/buildings.dvr'
+                              // '/topography.dvr'
                 dvrp_file_c = dvrp_file
                 CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host_c, dvrp_username_c, &
@@ -272,5 +279,5 @@
 
                 dvrp_file   = prefix_chr // TRIM( mode_dvrp(m) )  &
-                              // '.buildings.dvr'
+                              // '.topography.dvr'
                 dvrp_file_c = dvrp_file
 !                CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host_c, dvrp_username_c, &
@@ -282,5 +289,5 @@
                 IF ( dvrp_file(1:9) /= '/dev/null' )  THEN
                    dvrp_file_local   = prefix_chr // TRIM( mode_dvrp(m) )  &
-                                       // '.buildings.dvr'
+                                       // '.topography.dvr'
                    dvrp_file_local_c = dvrp_file_local
                 ELSE
@@ -378,5 +385,5 @@
 
 !
-!--       Write the surface isosurface (ground plate at z=0) on file
+!--       Write the ground plate (z=0) isosurface on file
           CALL DVRP_INIT( m-1, 0 )
 
@@ -385,5 +392,6 @@
           IF ( dvrp_output == 'rtsp' )  THEN
 
-             dvrp_file   = prefix_chr // TRIM( mode_dvrp(m) ) // '/surface.dvr'
+             dvrp_file   = prefix_chr // TRIM( mode_dvrp(m) ) // &
+                           '/groundplate.dvr'
              dvrp_file_c = dvrp_file
              CALL DVRP_OUTPUT_RTSP( m-1, dvrp_host_c, dvrp_username_c, &
@@ -393,5 +401,6 @@
           ELSEIF ( dvrp_output == 'ftp' )  THEN
 
-             dvrp_file   = prefix_chr // TRIM( mode_dvrp(m) ) // '.surface.dvr'
+             dvrp_file   = prefix_chr // TRIM( mode_dvrp(m) ) // &
+                           '.groundplate.dvr'
              dvrp_file_c = dvrp_file
 !             CALL DVRP_OUTPUT_FTP( m-1, 0, dvrp_host_c, dvrp_username_c, &
@@ -403,5 +412,5 @@
              IF ( dvrp_file(1:9) /= '/dev/null' )  THEN
                 dvrp_file_local   = prefix_chr // TRIM( mode_dvrp(m) )  &
-                     // '.surface.dvr'
+                     // '.groundplate.dvr'
                 dvrp_file_local_c = dvrp_file_local
              ELSE
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 259)
+++ palm/trunk/SOURCE/modules.f90	(revision 260)
@@ -6,5 +6,5 @@
 ! -----------------
 ! +clip_dvrp_*, cluster_size, dvrp_overlap, dvrp_total_overlap,
-! n*_dvrp in dvrp_variables
+! local_dvrserver_running, n*_dvrp in dvrp_variables
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
 ! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
@@ -549,5 +549,5 @@
 
     LOGICAL ::  cyclic_dvrp = .FALSE., dvrp_overlap, dvrp_total_overlap, &
-                lock_steering_update = .FALSE.,                          &
+                local_dvrserver_running, lock_steering_update = .FALSE., &
                 use_seperate_pe_for_dvrp_output = .FALSE.
 
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 259)
+++ palm/trunk/SOURCE/parin.f90	(revision 260)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! +local_dvrserver_running in envpar
 ! Output of messages replaced by message handling routine.
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
@@ -72,4 +73,5 @@
     USE averaging
     USE control_parameters
+    USE dvrp_variables
     USE grid_variables
     USE indices
@@ -159,7 +161,7 @@
 
 
-    NAMELIST /envpar/  host, maximum_cpu_time_allowed, revision, return_addres,&
-                       return_username, run_identifier, tasks_per_node, &
-                       write_binary
+    NAMELIST /envpar/  host, local_dvrserver_running, maximum_cpu_time_allowed,  &
+                       revision, return_addres, return_username, run_identifier, &
+                       tasks_per_node, write_binary
 
 !
