#!/bin/sh
#============================================================================
#
#                    Code_Saturne version 1.3
#                    ------------------------
#
#
#     This file is part of the Code_Saturne Kernel, element of the
#     Code_Saturne CFD tool.
#
#     Copyright (C) 1998-2007 EDF S.A., France
#
#     contact: saturne-support@edf.fr
#
#     The Code_Saturne Kernel is free software; you can redistribute it
#     and/or modify it under the terms of the GNU General Public License
#     as published by the Free Software Foundation; either version 2 of
#     the License, or (at your option) any later version.
#
#     The Code_Saturne Kernel is distributed in the hope that it will be
#     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
#     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
#
#     You should have received a copy of the GNU General Public License
#     along with the Code_Saturne Kernel; if not, write to the
#     Free Software Foundation, Inc.,
#     51 Franklin St, Fifth Floor,
#     Boston, MA  02110-1301  USA
#
#============================================================================
#
# Localisation de l'enveloppe
  ecs=$ECS_HOME/bin/ecs
  slc2ideas=$ECS_HOME/bin/slc2ideas

# Utilisation
  usage() {
    echo
    echo "   usage : verifmail maillage [couleurs pour lesquelles generer des parts Ensight]"
    echo "                         : verification d'un maillage (unv, des...) sans        "
    echo "                             recollement, avec generation d'un cas Ensight et     "
    echo "                             visualisation de couleurs eventuelles                "
    echo "                           le listing est fourni a l'ecran                        "
    echo 
    echo "                           Les maillages slc sont convertis en maillages unv.     "
    echo 
    echo "           verifmail -h  : ce message                                             "
    echo 
    exit
  }

# Test du nombre d'arg et du premier
  if [ $# = 0 ] ; then 
    usage
    exit
  fi
  if [ $1 = "-h" ] ; then 
    usage
    exit
  fi

# Le maillage existe t il 
  maillage=$1
  if [ ! -f $maillage ] ; then 
    echo 
    echo Le fichier de maillage $maillage n existe pas  
    usage 
  fi 

# Format par defaut 
  format=""

# Le maillage est il slc ou tlc
  grepslc=`echo ${maillage%%.slc}` 
  greptlc=`echo ${maillage%%.tlc}`  
  if [ "$grepslc" != "$maillage" -o "$greptlc" != "$maillage" ] ; then 
    echo ' Le maillage doit etre converti au format unv '
    maillageunv=${maillage%.slc}
    maillageunv=${maillageunv%.tlc}.unv
    if [ ! -f $maillageunv ] ; then 
      $slc2ideas $maillage $maillageunv
      if [ $? = 0 ] ; then  
        echo ' Le maillage a ete converti au format unv '
        maillage=$maillageunv
      else
        echo ' Le maillage n a pu etre converti au format unv '
        exit
      fi
    else
      echo ' Le fichier ' $maillageunv ' existe deja '
      exit
    fi
  fi

# Creation de la commande 
  commande="$ecs -maillage $maillage -ensight -sc"

# Execution de la commande 
  eval $commande
  echo 
  echo ' Fin de l execution de '
  echo $commande

# Sortie
  exit


syntax highlighted by Code2HTML, v. 0.9.1