Salome HOME
Merge from V6_main 01/04/2013
[modules/med.git] / src / MEDMEM / DataTest / testreadCoordinate.sh
1 #!/bin/sh
2 # Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23
24 #  File   : testreadCoordinate.sh
25 #  Module : MED
26 #
27 SALOME=${HOME}/V08
28 SALOME_LIB=${SALOME}/Build/lib
29 SALOME_PATH=${SALOME}/Build/MED/src/MEDMEM
30 LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${SALOME_LIB}
31 RESULT=PourMail
32
33 rm -rf ${RESULT}
34 echo " - Comparaison des Coordonnees : " >> ${RESULT}
35 echo -e " -------------------------------\n">> ${RESULT}
36
37 npb=0;
38 num=1
39 while [ true ]
40 do
41         ligne=`sed -n -e"$num,$num p" Maillages.txt`
42         num=`expr $num + 1 `
43         if [ "$ligne" = "" ] 
44         then 
45                 break 
46         fi
47         if [ `echo $ligne | cut -c1 ` = "#" ] 
48         then 
49                 echo "COMMENTAIRE" 
50                 continue
51         fi
52         fich=`echo $ligne | cut -f1 -d":"`
53         maill=`echo $ligne | cut -f2 -d":"`
54         nb=`echo $ligne | cut -f3 -d":"`
55         if [ "$nb" = "" ]
56         then
57                 Result=Rmem/Rmem.${fich}.coor.dump
58                 Compare=Ref/${fich}.coor.dump
59         else
60                 Result=Rmem/Rmem.${fich}.${nb}.coor.dump
61                 Compare=Ref/${fich}.${nb}.coor.dump
62         fi
63         ${SALOME_PATH}/readCoordinate Data/${fich} "${maill}" > $Result
64
65         echo "   Maillage " $maill "lu dans " $fich  >> ${RESULT} 
66         diff $Result $Compare >> /dev/null
67         rc=$?
68         if [ "$rc" != "0" ]
69         then
70            nb=`diff $Result $Compare| grep -v "Type de repere des coordonnees" | wc -l`
71            nb=`expr $nb + 0 `
72            if [ "$nb" != "2" ]
73            then
74                 echo " Difference entre les resultats des deux methodes de dumps : " >> ${RESULT}
75                 echo " Fichiers compares : $Result et $Compare " >> ${RESULT}
76                 diff $Result $Compare  >> ${RESULT}
77                 echo -e "\n">> ${RESULT}
78                 npb=`expr $npb + 1 `
79            else
80                 echo "   Pas de diffĂ©rence sur les coordonnees                  == test OK == " >> ${RESULT}
81            fi
82         else
83           echo "   Pas de diffĂ©rence sur les coordonnees                        == test OK == " >> ${RESULT}
84         fi
85         echo -e "\n" >> ${RESULT}
86 done