#!/bin/csh

#@ i=$argv[1]

set i = $argv[1]

# ======================================================================
# Generace souboru pro gnuplot
# ======================================================================

cat << EOF  > tisk.gnu
set terminal  jpeg
EOF

if($argv[2] == vocal) then
#  Not for step
cat << EOF  >> tisk.gnu
  #set nokey
  set notics
  set size 1., 1.
  
  set size ratio -1
  set output 'P_ISO-$i.jpg'
  p 'P_ISO-$i'w l
EOF
endif

if($argv[2] == gamm || $argv[2] == cyl || $argv[2] == naca) then
#  Not for step
cat << EOF  >> tisk.gnu

set output 'P_WALLS-$i.jpg'
plot 'P_WALLS-$i' with lines
#set output 'M_WALLS-$i.jpg'
#plot  'M_WALLS-$i' with lines
EOF
endif


if($argv[2] == shishkin) then
#  Not for step
cat << EOF  >> tisk.gnu

#unset key
set size 0.88, 0.8
#set output 'u-$i.jpg'
set output 'u-$i.jpg'
##splot  'u-3D-$i' w l
#splot [0:1][0:1] [0:1.3] 'u-iso-$i' w l

set size 0.88, 0.66
plot [0:1] [-0.25:1.35] 'u-0-$i't "exact" w l, 'u-FEM-$i't"FEM" w l, 'u-FVM-$i't "FVM" w l

#plot [0:1] [-0.05:1.35] 'u-0-$i' t'eps = 0' w l,'u-4-$i' t'eps = 0.0001' w l,'u-3-$i' t'eps = 0.001' w l,'u-2-$i' t'eps = 0.01' w l
EOF
endif

if($argv[2] == shishkin) then
#  Not for step
cat << EOF  >> tisk.gnu

#unset key
set size 0.88, 0.8
#set output 'u-$i.jpg'
set output 'u-$i.jpg'
##splot  'u-3D-$i' w l
#splot [0:1][0:1] [0:1.3] 'u-iso-$i' w l

set size 0.88, 0.66
plot [0:1] [-0.25:1.35] 'u-0-$i't "exact" w l, 'u-FEM-$i't"FEM" w l, 'u-FVM-$i't "FVM" w l

#plot [0:1] [-0.05:1.35] 'u-0-$i' t'eps = 0' w l,'u-4-$i' t'eps = 0.0001' w l,'u-3-$i' t'eps = 0.001' w l,'u-2-$i' t'eps = 0.01' w l
EOF
endif

if($argv[2] == shock) then
#  Not for step
cat << EOF  >> tisk.gnu
set size 0.75, 1.0
set size ratio -1
set output 'P_ISO-$i.jpg'
plot [0:2] [0:2] 'P_ISO-$i' with lines 

EOF
endif

set nokey
set noxtics
set noytics
set noborder

if($argv[2] == gamm) then
### GAMM channel
cat << EOF  >> tisk.gnu
set size 1., 0.5
set view 86, 32
#set nokey
#set output 'M_3D-$i.jpg'
#splot 'M_3D-$i' with lines 


set size 1.25, 1.0
set size ratio -1
set output 'M_ISO-$i.jpg'
plot [-1:1] [0:1] 'M_ISO-$i' with lines 
#set output 'Ma_ISO-$i.jpg'
#plot [0:0.4] [0:0.3] 'M_ISO-$i' with lines 


 ###  set output 'P_tr-$i.jpg'
#set output 'P_ISO-$i.jpg'
#plot [-1:1] [0:1] 'P_ISO-$i' with lines 

##set output 'M_ISO-det-$i.jpg'
##plot [-4:4] [-4:4] 'M_ISO-$i' with lines 
##set output 'P_ISO-det-$i.jpg'
##plot [-4:4] [-4:4] 'P_ISO-$i' with lines 

#set output 'M_ISO-$i.jpg'
#plot [-0.5:1.5] [-1:1] 'M_ISO-$i' with lines 
#set output 'P_ISO-$i.jpg'
#plot [-0.5:1.5] [-1:1] 'P_ISO-$i' with lines 

EOF
endif

if($argv[2] == blasius) then
### GAMM channel
cat << EOF  >> tisk.gnu
#set size ratio -1
set output 'M_ISO-$i.jpg'
plot [-0.1:1.0][-0.01:0.1]  'M_ISO-$i' with lines 

EOF
endif


if($argv[2] == cyl) then
### GAMM channel
cat << EOF  >> tisk.gnu
### cylinder
set size 1.5, 1.05
set size ratio -1
set output 'M_ISO-$i.jpg'
plot [-4:4] [-4:4] 'M_ISO-$i' with lines 
#set output 'Ma_ISO-$i.jpg'
#plot [:] [:] 'M_ISO-$i' with lines 

#set output 'P_ISO-$i.jpg'
#plot [-4:4] [-4:4] 'P_ISO-$i' with lines 

#set output 'Vor-mesh.jpg'
#plot [0:10] [0:10] 'gnu.1' with lines 

EOF
endif


if($argv[2] == naca) then
### NACA profile
cat << EOF  >> tisk.gnu
set size 1., 0.7
set size ratio -1

set output 'M_ISO-$i.jpg'
#plot  'M_ISO-$i' with lines 
plot [-0.5:2.5] [-1:1] 'M_ISO-$i' with lines 

#set output 'Ma_ISO-$i.jpg'
#plot 'M_ISO-$i' with lines 

#set output 'MESH.jpg'
#plot [-1:2] [0:1.2] 'MESH-ref$i' with lines 

EOF
endif


if($argv[2] == step) then
### GAMM channel
cat << EOF  >> tisk.gnu

set size 1., 0.5
set view 80,15
#set output 'M_3D-$i.jpg'
#splot 'M_3D-$i' with lines 

set size 1., 0.27
set size ratio -1
#set output 'M_ISO-$i.jpg'
#plot [0:3] [0:1] 'M_ISO-$i' with lines 

##set output 'P_tr-$i.jpg'
set output 'RO_ISO-$i.jpg'
plot [0:3] [0:1] 'RO_ISO-$i' with lines 
EOF
endif


if($argv[2] == DMR) then
### GAMM channel
cat << EOF  >> tisk.gnu

#set output 'RO_CUT-$i.jpg'
#plot [][1:9] 'RO_cut0.25-$i'w l,'RO_cut0.50-$i'w l,'RO_cut0.75-$i'w l


set size 1., 0.5
set view 80,15
#set output 'M_3D-$i.jpg'
#splot 'M_3D-$i' with lines 

set key

set size 2., 0.8
set size ratio -1

set output 'RO_ISO-$i.jpg'
plot [0:4] [0:1] 'RO_ISO-$i' with lines 
EOF

endif

