#!/bin/csh

if( $#argv != 4) then

  echo "compute.sh <max_adapt_level> <numel <eps1> <p>"
  exit

  endif

  cd ../FEM-code/FEM-code3/
  make
  cd ../../MainTask4
  
 cp triangLL  triang
  rm -f res_out

@ max_lev = $argv[1]
set numel = $argv[2]
set eps1 = $argv[3]
set pp = $argv[4]

cat << EOF > paramet
   1           ityp ( 0 - uniform trian,  >0 - component of solution)
   1           ndim
   0           ifv ( 0 -cell vertex, 1- cell centered)
 0.02         pos   (=positivity)
   $numel          numel (= c)
  $eps1       epsilon1
   $pp          p
EOF

@ i = 0


while($i <= $max_lev)

     ./femP1 B S > smazFE

  cp sol.gn sol.lev_$i.gn
     

   if($i < $max_lev) then
     ./side  > smaz
     cp triangx triang
   endif
  
@ i++

 end

 echo " "
 echo " END of computation"
 echo " "

 more res_out


 tail -n 1 res_out >> Fin_conv
 
