Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20934/test/telemac Modified Files: SerafinArchConvertGUI.java TestCL.java TestCas.java TestClMng.java TestSerafin.java TestSerafinArchConvert.java TestSinusx.java cas.txt Added Files: TestTrigrid.java csv1.txt csv2.txt trigrid.geo trigrid.ngh Log Message: Maj version 0.05 prepro --- NEW FILE: TestTrigrid.java --- /* * @file TestTrigrid.java * @creation 27 janv. 2004 * @modification $Date: 2004/02/12 15:32:51 $ * @license GNU General Public License 2 * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne * @mail de...@fu... */ package org.fudaa.dodico.test.telemac; import java.io.File; import org.fudaa.ctulu.CtuluLib; import org.fudaa.dodico.commun.DodicoAnalyze; import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.commun.ProgressionTestAdapter; import org.fudaa.dodico.ef.EfElement; import org.fudaa.dodico.ef.EfGrid; import org.fudaa.dodico.ef.EfGridSource; import org.fudaa.dodico.ef.EfLib; import org.fudaa.dodico.ef.EfNode; import org.fudaa.dodico.telemac.io.SerafinFileFormat; import org.fudaa.dodico.test.TestIO; import org.fudaa.dodico.trigrid.TrigridFileFormat; import org.fudaa.dodico.trigrid.TrigridReader; import org.fudaa.dodico.trigrid.TrigridWriter; /** * @author deniger * @version $Id: TestTrigrid.java,v 1.1 2004/02/12 15:32:51 deniger Exp $ */ public class TestTrigrid extends TestIO { EfGrid g_; /** * @param _fic */ public TestTrigrid() { super("trigrid.ngh"); g_=( (EfGridSource)TrigridFileFormat .getInstance() .getLastVersionImpl() .readGrid(fic_, null) .getSource()).getGrid(); } /** * */ public void testEcriture() { File f= createTempFile(); TrigridFileFormat.getInstance().getLastVersionImpl().write( f, g_,null); System.out.println(f.getAbsolutePath()); EfGrid g= ((EfGridSource)TrigridFileFormat .getInstance() .getLastVersionImpl() .readGrid(f, null) .getSource()).getGrid(); f.delete(); internTestGridWriter(g); } /** * Un test assez long sur le lecture de fichier serafin:<br> * 1- test de la conformite du maillage lu<br> * 2- Comparaison avec un maillage equivalent issu du fichier serafin * "trigrid.geo" * 3- Test pour retrouver les connexions */ public void testLecture() { assertNotNull(g_); internTestGrid(g_); File f= getFile("trigrid.geo"); EfGrid g2= ((EfGridSource)SerafinFileFormat .getInstance() .getLastVersionImpl() .readGrid(f, null) .getSource()).getGrid(); assertNotNull(g2); assertTrue(g2.isEquivalent(g_, false, 1e-3d)); g_.computeBord(null); g2.computeBord(null); g_.getFrontiers().isSame(g2.getFrontiers().getArray()); internTestConnectionFound(g_); } private void internTestConnectionFound(EfGrid _g) { DodicoAnalyze a= new DodicoAnalyze(); int[][] r= EfLib.getConnexionFor(_g, null, a); assertTrue(a.isEmpty()); assertEquals(_g.getPtsNb(), r.length); //test de la ligne suivante // 1 6813.839 7844.116 1 1.078 1534 3684 1547 0 0 0 0 0 int[] rToTest= r[0]; assertEquals(3, rToTest.length); assertTrue(DodicoLib.findInt(rToTest, 1533) >= 0); assertTrue(DodicoLib.findInt(rToTest, 3683) >= 0); assertTrue(DodicoLib.findInt(rToTest, 1546) >= 0); // 3214 6567.800 6187.305 0 1.245 3084 2247 2443 3102 2990 2432 0 0 rToTest= r[3213]; assertEquals(6, rToTest.length); assertTrue(DodicoLib.findInt(rToTest, 3083) >= 0); assertTrue(DodicoLib.findInt(rToTest, 2246) >= 0); assertTrue(DodicoLib.findInt(rToTest, 2442) >= 0); assertTrue(DodicoLib.findInt(rToTest, 3101) >= 0); assertTrue(DodicoLib.findInt(rToTest, 2989) >= 0); assertTrue(DodicoLib.findInt(rToTest, 2431) >= 0); } private void internTestGrid(EfGrid _g) { assertEquals(3724, _g.getPtsNb()); //Attention les index sont decales EfNode p= _g.getPt(0); assertDoubleEquals(6813.839, p.getX()); assertDoubleEquals(7844.116, p.getY()); assertDoubleEquals(1.078, p.getZ()); p= _g.getPt(1790); assertDoubleEquals(5104.207, p.getX()); assertDoubleEquals(5580.120, p.getY()); assertDoubleEquals(-0.372, p.getZ()); //le dernier point p= _g.getPt(3723); assertDoubleEquals(4987.752, p.getX()); assertDoubleEquals(5484.865, p.getY()); assertDoubleEquals(-0.182, p.getZ()); assertEquals(5788, _g.getEltNb()); EfElement el= _g.getElement(0); assertTrue(el.containsIndex(0)); assertTrue(el.containsIndex(1533)); assertTrue(el.containsIndex(3683)); el= _g.getElement(44); assertTrue(el.containsIndex(23)); assertTrue(el.containsIndex(1718)); assertTrue(el.containsIndex(1592)); el= _g.getElement(132); assertTrue(el.containsIndex(64)); assertTrue(el.containsIndex(904)); assertTrue(el.containsIndex(1941)); el= _g.getElement(5787); assertTrue(el.containsIndex(3633)); assertTrue(el.containsIndex(3681)); assertTrue(el.containsIndex(3625)); } private void internTestGridWriter(EfGrid _g) { assertEquals(3724, _g.getPtsNb()); //Attention les index sont decales EfNode p= _g.getPt(0); assertDoubleEquals(6813.839, p.getX()); assertDoubleEquals(7844.116, p.getY()); assertDoubleEquals(1.078, p.getZ()); p= _g.getPt(1790); assertDoubleEquals(5104.207, p.getX()); assertDoubleEquals(5580.120, p.getY()); assertDoubleEquals(-0.372, p.getZ()); //le dernier point p= _g.getPt(3723); assertDoubleEquals(4987.752, p.getX()); assertDoubleEquals(5484.865, p.getY()); assertDoubleEquals(-0.182, p.getZ()); assertEquals(5788, _g.getEltNb()); EfElement el= new EfElement(new int[] { 0, 1533, 3683 }); assertTrue(_g.isEltPresentInGrid(el)); el= new EfElement(new int[] { 23, 1718, 1592 }); assertTrue(_g.isEltPresentInGrid(el)); el= new EfElement(new int[] { 64, 904, 1941 }); assertTrue(_g.isEltPresentInGrid(el)); el= new EfElement(new int[] { 3633, 3681, 3625 }); assertTrue(_g.isEltPresentInGrid(el)); } } --- NEW FILE: csv1.txt --- #essai 1;2;3 3;4;5 7;8 --- NEW FILE: csv2.txt --- #essai 1 2 3 3 4 5 7 8 --- NEW FILE: trigrid.geo --- (This appears to be a binary file; contents omitted.) --- NEW FILE: trigrid.ngh --- 3724 8 6879.562 7958.460 4391.370 5030.580 1 6813.839 7844.116 1 1.078 1534 3684 1547 0 0 0 0 0 2 4393.200 5052.120 1 -0.971 7 1673 1620 0 0 0 0 0 3 6390.918 6791.710 1 0.959 892 1778 165 0 0 0 0 0 4 6853.990 7956.400 1 2.051 1308 2635 858 0 0 0 0 0 5 6822.140 7934.980 1 1.318 3619 543 1268 0 0 0 0 0 6 5359.598 5770.917 1 -0.209 1589 1800 809 0 0 0 0 0 7 4391.370 5061.510 1 -1.140 2 1673 1347 0 0 0 0 0 8 6696.120 7689.570 1 -0.079 3510 53 1601 0 0 0 0 0 9 6112.342 5694.353 1 1.000 3653 240 155 0 0 0 0 0 10 5798.769 6290.186 1 -0.220 2864 1065 1651 0 0 0 0 0 11 6069.023 6676.904 1 -0.209 594 3647 696 0 0 0 0 0 12 6021.854 5616.363 1 1.007 690 3648 1408 0 0 0 0 0 13 6606.516 6647.503 1 1.324 423 3639 355 0 0 0 0 0 14 6334.890 7034.820 1 0.011 1665 20 923 0 0 0 0 0 15 5703.275 6137.555 1 -0.304 1627 3715 1365 0 0 0 0 0 16 6737.217 7783.338 1 -0.087 1321 3659 1506 0 0 0 0 0 [...3688 lines suppressed...] 3705 6386.724 7216.995 0 -1.045 2251 3651 1726 1667 1682 3422 2588 0 3706 5850.226 5460.339 0 0.641 2855 2069 17 208 1889 1595 3476 0 3707 6675.620 7686.093 0 -0.247 1025 638 3325 3510 1959 3262 3512 0 3708 4891.340 5139.988 0 0.390 2185 1915 2737 1727 2026 3104 1898 0 3709 5095.257 5591.085 0 -0.568 2903 2388 3605 2109 1798 2526 1592 0 3710 6842.934 7275.417 0 0.628 3064 2679 2273 2946 1669 3133 1668 0 3711 6321.671 7090.289 0 -0.498 1092 1768 2975 2828 2959 1616 1786 0 3712 6817.005 7797.621 0 0.502 191 80 3700 1763 3445 2731 2426 0 3713 5222.328 5691.851 0 -0.543 2417 1700 1805 3629 1672 1718 2863 0 3714 5872.229 6385.787 0 -0.793 3187 1706 2742 1314 2331 3525 767 0 3715 5716.954 6129.873 0 -0.687 1627 15 3225 3338 1749 1365 2146 0 3716 5208.920 5210.450 0 0.127 1615 442 1856 3702 297 849 2190 0 3717 5252.227 5714.860 0 -0.529 1446 22 3083 2862 2748 1223 1968 0 3718 5836.290 5452.990 0 0.707 1606 1595 1289 1731 3476 1216 3675 0 3719 6104.099 6721.857 0 -0.319 2667 3551 1582 1739 2031 2704 1511 0 3720 6272.904 7031.573 0 -1.051 3296 3072 1944 3615 1703 1993 3722 0 3721 6839.679 6695.933 0 1.146 1742 3693 428 2162 3190 381 1681 0 3722 6275.182 7014.240 0 -0.575 1744 2603 1695 1703 3720 1637 1770 3072 3723 6548.375 7459.657 0 -0.436 3146 1095 2135 1750 1600 1787 2320 2460 3724 4987.752 5484.865 0 -0.182 431 2286 1712 1781 928 909 610 1746 Index: SerafinArchConvertGUI.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/SerafinArchConvertGUI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SerafinArchConvertGUI.java 25 Nov 2003 10:12:02 -0000 1.6 --- SerafinArchConvertGUI.java 12 Feb 2004 15:32:50 -0000 1.7 *************** *** 196,200 **** w.setFile(fileOut_); w.setProgressReceiver(progression_); ! DodicoAnalyze a= w.write(si_).getAnalyze().toAnalyze(); if (a != null) { new BuDialogMessage(null, null, a.getResume()); --- 196,200 ---- w.setFile(fileOut_); w.setProgressReceiver(progression_); ! DodicoAnalyze a= w.write(si_).getAnalyze(); if (a != null) { new BuDialogMessage(null, null, a.getResume()); *************** *** 238,242 **** FileOperationSynthese s= reader.read(); if (s.containsMessages()) ! s.getAnalyze().toAnalyze().printResume(); si_= (SerafinInterface)s.getSource(); isInSparc_= FortranBinaryInputStream.isSparc(reader.getMachineId()); --- 238,242 ---- FileOperationSynthese s= reader.read(); if (s.containsMessages()) ! s.getAnalyze().printResume(); si_= (SerafinInterface)s.getSource(); isInSparc_= FortranBinaryInputStream.isSparc(reader.getMachineId()); Index: TestCL.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestCL.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TestCL.java 25 Nov 2003 10:12:02 -0000 1.13 --- TestCL.java 12 Feb 2004 15:32:51 -0000 1.14 *************** *** 195,199 **** null); if (syntheseR.containsMessages()) ! syntheseR.getAnalyze().toAnalyze().printResume(); assertFalse(syntheseR.containsMessages()); _interfaceTest(getInter(tmpFile)); --- 195,199 ---- null); if (syntheseR.containsMessages()) ! syntheseR.getAnalyze().printResume(); assertFalse(syntheseR.containsMessages()); _interfaceTest(getInter(tmpFile)); Index: TestCas.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestCas.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestCas.java 25 Nov 2003 10:12:02 -0000 1.8 --- TestCas.java 12 Feb 2004 15:32:51 -0000 1.9 *************** *** 48,51 **** --- 48,56 ---- t= inter.getValue(ent); assertEquals(t, "1600"); + ent= dico.getEntite("FICHIER DES PARAMETRES"); + assertNotNull(ent); + t=inter.getCommentaire(ent); + assertNotNull(t); + assertEquals("LE FICHIER QUI VA BIEN",t); } /** *************** *** 68,72 **** DicoCasInterface r= (DicoCasInterface)syntheseR.getSource(); if (syntheseR.containsMessages()) { ! syntheseR.getAnalyze().toAnalyze().printResume("Message: "); } assertFalse(syntheseR.containsMessages()); --- 73,77 ---- DicoCasInterface r= (DicoCasInterface)syntheseR.getSource(); if (syntheseR.containsMessages()) { ! syntheseR.getAnalyze().printResume("Message: "); } assertFalse(syntheseR.containsMessages()); Index: TestClMng.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestClMng.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestClMng.java 11 Dec 2003 12:41:29 -0000 1.7 --- TestClMng.java 12 Feb 2004 15:32:51 -0000 1.8 *************** *** 10,18 **** import java.io.File; import junit.framework.TestCase; import org.fudaa.dodico.fichiers.FileOperationSynthese; import org.fudaa.dodico.h2d.H2dBoundary; import org.fudaa.dodico.h2d.H2dBcFrontierBlockInterface; - import org.fudaa.dodico.h2d.H2dGrid; - import org.fudaa.dodico.h2d.H2dFrontier; import org.fudaa.dodico.h2d.telemac.H2dTelemacBoundary; import org.fudaa.dodico.h2d.telemac.H2dTelemacCLElementSource; --- 10,19 ---- import java.io.File; import junit.framework.TestCase; + + import org.fudaa.dodico.ef.EfFrontier; + import org.fudaa.dodico.ef.EfGrid; import org.fudaa.dodico.fichiers.FileOperationSynthese; import org.fudaa.dodico.h2d.H2dBoundary; import org.fudaa.dodico.h2d.H2dBcFrontierBlockInterface; import org.fudaa.dodico.h2d.telemac.H2dTelemacBoundary; import org.fudaa.dodico.h2d.telemac.H2dTelemacCLElementSource; *************** *** 30,34 **** */ public class TestClMng extends TestCase { ! H2dGrid m_; H2dTelemacCLSourceInterface cl_; public TestClMng() { --- 31,35 ---- */ public class TestClMng extends TestCase { ! EfGrid m_; H2dTelemacCLSourceInterface cl_; public TestClMng() { *************** *** 40,45 **** assertFalse(op.containsFatalError()); SerafinInterface inter= (SerafinInterface)op.getSource(); ! m_= inter.getMaillage(); ! H2dGrid.computeBord(m_, inter.getPtsFrontiere(), null); op= TelemacCLFileFormat.getInstance().getLastVersionImpl().read( --- 41,46 ---- assertFalse(op.containsFatalError()); SerafinInterface inter= (SerafinInterface)op.getSource(); ! m_= inter.getGrid(); ! EfGrid.computeBord(m_, inter.getPtsFrontiere(), null); op= TelemacCLFileFormat.getInstance().getLastVersionImpl().read( *************** *** 52,61 **** assertNotNull(m_); assertNotNull(m_.getFrontiers()); ! H2dFrontier frontiere= m_.getFrontiers(); assertEquals(2, frontiere.getNbFrontier()); //test extern frontier assertEquals(282, frontiere.getNbPt(0)); ! assertEquals(13, frontiere.getBordPrincPointIdx(0)); ! assertEquals(28, frontiere.getBordPrincPointIdx(281)); //test intern frontier assertEquals(16, frontiere.getNbPt(1)); --- 53,62 ---- assertNotNull(m_); assertNotNull(m_.getFrontiers()); ! EfFrontier frontiere= m_.getFrontiers(); assertEquals(2, frontiere.getNbFrontier()); //test extern frontier assertEquals(282, frontiere.getNbPt(0)); ! assertEquals(13, frontiere.getIdxGlobalPrinc(0)); ! assertEquals(28, frontiere.getIdxGlobalPrinc(281)); //test intern frontier assertEquals(16, frontiere.getNbPt(1)); Index: TestSerafin.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestSerafin.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TestSerafin.java 11 Dec 2003 12:41:29 -0000 1.17 --- TestSerafin.java 12 Feb 2004 15:32:51 -0000 1.18 *************** *** 9,27 **** package org.fudaa.dodico.test.telemac; import java.io.File; ! import org.apache.tools.ant.taskdefs.TempFile; import org.fudaa.dodico.commun.DodicoLib; ! import org.fudaa.dodico.fichiers.FileFormat; ! import org.fudaa.dodico.fichiers.FileFormatVersion; import org.fudaa.dodico.fichiers.FileOperationSynthese; - import org.fudaa.dodico.h2d.H2dElement; - import org.fudaa.dodico.h2d.H2dLib; - import org.fudaa.dodico.h2d.H2dGrid; - import org.fudaa.dodico.h2d.H2dFrontier; - import org.fudaa.dodico.h2d.type.H2dElementType; import org.fudaa.dodico.mnt.MNTSemis; import org.fudaa.dodico.mnt.MNTZone; import org.fudaa.dodico.telemac.io.SerafinFileFormat; import org.fudaa.dodico.telemac.io.SerafinInterface; - import org.fudaa.dodico.telemac.io.SerafinMNTAdapter; import org.fudaa.dodico.telemac.io.SerafinWriter; import org.fudaa.dodico.test.TestIO; --- 9,22 ---- package org.fudaa.dodico.test.telemac; import java.io.File; ! import org.fudaa.dodico.commun.DodicoLib; ! import org.fudaa.dodico.ef.EfElementType; ! import org.fudaa.dodico.ef.EfFrontier; ! import org.fudaa.dodico.ef.EfGrid; import org.fudaa.dodico.fichiers.FileOperationSynthese; import org.fudaa.dodico.mnt.MNTSemis; import org.fudaa.dodico.mnt.MNTZone; import org.fudaa.dodico.telemac.io.SerafinFileFormat; import org.fudaa.dodico.telemac.io.SerafinInterface; import org.fudaa.dodico.telemac.io.SerafinWriter; import org.fudaa.dodico.test.TestIO; *************** *** 44,52 **** "MODELE MARITIME - CALCUL1 SERAPHIN"); //NBV1 ! assertEquals(_t.getNbv1(), 6); //TEXT ! String temp= _t.getVariable(0); assertEquals(temp, "VITESSE U"); ! temp= _t.getVariable(5); assertEquals(temp, "VITESSE SCALAIRE"); //LUNIT --- 39,47 ---- "MODELE MARITIME - CALCUL1 SERAPHIN"); //NBV1 ! assertEquals(_t.getValueNb(), 6); //TEXT ! String temp= _t.getValueId(0); assertEquals(temp, "VITESSE U"); ! temp= _t.getValueId(5); assertEquals(temp, "VITESSE SCALAIRE"); //LUNIT *************** *** 60,69 **** assertEquals(_t.getIdate(), 0); //NELEM ! H2dGrid maillage= _t.getMaillage(); assertEquals(maillage.getEltNb(), 3087); //NPOIN1 assertEquals(maillage.getPtsNb(), 1676); //NPPEL1 ! assertEquals(maillage.getEltType(), H2dElementType.T3); //IKLE1 assertEquals(maillage.getElement(0).getPtIndex(1), 1545); --- 55,64 ---- assertEquals(_t.getIdate(), 0); //NELEM ! EfGrid maillage= _t.getGrid(); assertEquals(maillage.getEltNb(), 3087); //NPOIN1 assertEquals(maillage.getPtsNb(), 1676); //NPPEL1 ! assertEquals(maillage.getEltType(), EfElementType.T3); //IKLE1 assertEquals(maillage.getElement(0).getPtIndex(1), 1545); *************** *** 85,96 **** eps_); //Nombre de pas temps ! int tempInt= _t.getNbPasDeTemps(); assertEquals(tempInt, 2); ! double tempDouble= _t.getPasDeTemps(1); assertEquals(tempDouble, (double)Float.intBitsToFloat(1153138688), eps_); //pas de temps 1, variable 3 //premiere variable assertEquals( ! _t.getDonnees(0, 2, 0), (double)Float.intBitsToFloat(1076258406), eps_); --- 80,91 ---- eps_); //Nombre de pas temps ! int tempInt= _t.getTimeStepNb(); assertEquals(tempInt, 2); ! double tempDouble= _t.getTimeStep(1); assertEquals(tempDouble, (double)Float.intBitsToFloat(1153138688), eps_); //pas de temps 1, variable 3 //premiere variable assertEquals( ! _t.getValue(2, 0, 0), (double)Float.intBitsToFloat(1076258406), eps_); *************** *** 98,142 **** //derniere variable assertEquals( ! _t.getDonnees(1, 3, maillage.getPtsNb() - 1), (double)Float.intBitsToFloat(1093124747), eps_); } ! public void testMntAdapter() { ! SerafinInterface t= inter_; ! assertNotNull(t); ! int id= SerafinMNTAdapter.getIndex(t, "HAUTEUR D'EAU"); ! assertEquals(id, 2); ! SerafinMNTAdapter a= new SerafinMNTAdapter(t, id, 0); ! try { ! String[] r= a.read(); ! if (r != null) ! DodicoLib.printStringArray(r); ! assertNull(r); ! MNTZone[] zones= a.getMNTZones(); ! assertNotNull(zones); ! assertNotNull(zones[0]); ! MNTSemis semis= zones[0].getSemis(); ! assertNotNull(semis); ! //X1 ! assertEquals( ! semis.getX(9), ! (double)Float.intBitsToFloat(1160462115), ! eps_); ! //Y1 ! assertEquals( ! semis.getY(11), ! (double)Float.intBitsToFloat(1140111573), ! eps_); ! assertEquals( ! semis.getZ(0), ! (double)Float.intBitsToFloat(1076258406), ! eps_); ! } catch (Exception _e) { ! _e.printStackTrace(); ! } ! } ! /** ! * ! */ public void testEcriture() { SerafinInterface inter= inter_; --- 93,101 ---- //derniere variable assertEquals( ! _t.getValue(3, maillage.getPtsNb() - 1, 1), (double)Float.intBitsToFloat(1093124747), eps_); } ! public void testEcriture() { SerafinInterface inter= inter_; *************** *** 162,174 **** public void testRechercheFrontiereWithIpobo() { SerafinInterface inter= inter_; ! H2dGrid.computeBordFast(inter.getMaillage(), inter.getPtsFrontiere(), null); ! H2dFrontier b= inter.getMaillage().getFrontiers(); assertEquals(b.getNbFrontierIntern(), 1); } public void testRechercheFrontiereinterne() { SerafinInterface inter= inter_; ! inter.getMaillage().computeBord(null); assertTrue( ! inter.getMaillage().getFrontiers().isSame(inter.getPtsFrontiere())); } /** --- 121,133 ---- public void testRechercheFrontiereWithIpobo() { SerafinInterface inter= inter_; ! EfGrid.computeBordFast(inter.getGrid(), inter.getPtsFrontiere(), null); ! EfFrontier b= inter.getGrid().getFrontiers(); assertEquals(b.getNbFrontierIntern(), 1); } public void testRechercheFrontiereinterne() { SerafinInterface inter= inter_; ! inter.getGrid().computeBord(null); assertTrue( ! inter.getGrid().getFrontiers().isSame(inter.getPtsFrontiere())); } /** Index: TestSerafinArchConvert.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestSerafinArchConvert.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestSerafinArchConvert.java 25 Nov 2003 10:12:03 -0000 1.6 --- TestSerafinArchConvert.java 12 Feb 2004 15:32:51 -0000 1.7 *************** *** 67,71 **** SerafinInterface sinter= (SerafinInterface)synthese.getSource(); if (synthese.containsMessages()) ! synthese.getAnalyze().toAnalyze().printResume(); if (t.getMachineId().equals(sortieID)) { System.out.println("les formats d'entree et de sortie sont identiques"); --- 67,71 ---- SerafinInterface sinter= (SerafinInterface)synthese.getSource(); if (synthese.containsMessages()) ! synthese.getAnalyze().printResume(); if (t.getMachineId().equals(sortieID)) { System.out.println("les formats d'entree et de sortie sont identiques"); *************** *** 77,81 **** System.out.println(""); if (synthese.containsMessages()) ! synthese.getAnalyze().toAnalyze().printResume(); } } --- 77,81 ---- System.out.println(""); if (synthese.containsMessages()) ! synthese.getAnalyze().printResume(); } } Index: TestSinusx.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestSinusx.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestSinusx.java 25 Nov 2003 10:12:03 -0000 1.9 --- TestSinusx.java 12 Feb 2004 15:32:51 -0000 1.10 *************** *** 10,26 **** import java.io.File; import java.io.FileReader; - import java.io.FileWriter; import java.io.IOException; - import java.io.PrintWriter; import java.net.URL; import junit.framework.TestCase; import com.memoire.bu.BuTask; import org.fudaa.dodico.commun.ProgressionBuAdapter; ! import org.fudaa.dodico.mnt.MNTPoint; import org.fudaa.dodico.mnt.MNTPolyligne; import org.fudaa.dodico.mnt.MNTSemis; import org.fudaa.dodico.mnt.MNTZone; import org.fudaa.dodico.telemac.io.SinusxReader; - import org.fudaa.dodico.telemac.io.SinusxWriter; /** * @version $Id$ --- 10,33 ---- import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.URL; + import junit.framework.TestCase; + import com.memoire.bu.BuTask; + + import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.commun.ProgressionBuAdapter; ! import org.fudaa.dodico.fichiers.FileOperationSynthese; ! import org.fudaa.dodico.mnt.MNTPointMutable; ! import org.fudaa.dodico.mnt.ListMNTPoint; ! import org.fudaa.dodico.mnt.MNTCsvFileFormat; ! import org.fudaa.dodico.mnt.MNTCsvReader; ! import org.fudaa.dodico.mnt.MNTCsvWriter; import org.fudaa.dodico.mnt.MNTPolyligne; import org.fudaa.dodico.mnt.MNTSemis; import org.fudaa.dodico.mnt.MNTZone; + import org.fudaa.dodico.telemac.io.SinusxFileFormat; import org.fudaa.dodico.telemac.io.SinusxReader; /** * @version $Id$ *************** *** 46,63 **** assertNotNull(_f); assertTrue(_f.exists()); ! String nom= _f.getName(); ! SinusxReader r= ! new SinusxReader( ! new FileReader(_f), ! new ProgressionBuAdapter(new BuTask()), ! nom, ! (int)_f.length()); ! r.read(); ! MNTZone[] zones= r.getMNTZones(); assertEquals(1, zones.length); MNTZone zone= zones[0]; ! assertEquals(zone.getNom(), _f.getName()); assertEquals(zone.getNbPointsSemis(), 5); ! MNTPoint p= new MNTPoint(); double t; MNTSemis semis= zone.getSemis(); --- 53,64 ---- assertNotNull(_f); assertTrue(_f.exists()); ! FileOperationSynthese op= ! SinusxFileFormat.getInstance().getLastVersionInstance().read(_f, null); ! MNTZone[] zones= (MNTZone[])op.getSource(); assertEquals(1, zones.length); MNTZone zone= zones[0]; ! assertEquals(zone.getNom(), DodicoLib.getSansExtension(_f.getName())); assertEquals(zone.getNbPointsSemis(), 5); ! MNTPointMutable p= new MNTPointMutable(); double t; MNTSemis semis= zone.getSemis(); *************** *** 74,78 **** assertEquals(poly.getNbPoints(), 4); assertEquals(poly.getNom(), "courbe"); ! p= new MNTPoint(-1, -1, -1); for (int i= 0; i < 4; i++) { poly.getPoint(p, i); --- 75,79 ---- assertEquals(poly.getNbPoints(), 4); assertEquals(poly.getNom(), "courbe"); ! p= new MNTPointMutable(-1d, -1d, -1d); for (int i= 0; i < 4; i++) { poly.getPoint(p, i); *************** *** 85,89 **** assertEquals(poly.getNbPoints(), 2); assertEquals(poly.getNom(), "niveau"); ! p= new MNTPoint(-1, -1, -1); for (int i= 0; i < 2; i++) { poly.getPoint(p, i); --- 86,90 ---- assertEquals(poly.getNbPoints(), 2); assertEquals(poly.getNom(), "niveau"); ! p= new MNTPointMutable(-1, -1, -1); for (int i= 0; i < 2; i++) { poly.getPoint(p, i); *************** *** 105,111 **** f= File.createTempFile("testSinux", ".sx"); assertNotNull(f); ! SinusxWriter o= ! new SinusxWriter(new PrintWriter(new FileWriter(f)), zones); ! o.write(); lecture(f); } catch (Exception _e) { --- 106,113 ---- f= File.createTempFile("testSinux", ".sx"); assertNotNull(f); ! SinusxFileFormat.getInstance().getLastVersionInstance().write( ! f, ! zones, ! null); lecture(f); } catch (Exception _e) { *************** *** 127,129 **** --- 129,197 ---- return new File(url.getPath()); } + + public void testMNTCsv() { + File f= getFile("csv1.txt"); + assertNotNull(f); + MNTCsvReader reader= new MNTCsvReader(); + reader.setFile(f); + assertEquals(";", reader.getSepChar()); + FileOperationSynthese s= reader.read(); + ListMNTPoint l= (ListMNTPoint)s.getSource(); + assertEquals(3, l.nombre()); + assertEquals(1, l.renvoieX(0), 1e-15); + assertEquals(2, l.renvoieY(0), 1e-15); + assertEquals(3, l.renvoieZ(0), 1e-15); + assertEquals(3, l.renvoieX(1), 1e-15); + assertEquals(4, l.renvoieY(1), 1e-15); + assertEquals(5, l.renvoieZ(1), 1e-15); + assertEquals(7, l.renvoieX(2), 1e-15); + assertEquals(8, l.renvoieY(2), 1e-15); + assertEquals(0, l.renvoieZ(2), 1e-15); + f= getFile("csv2.txt"); + assertNotNull(f); + reader= new MNTCsvReader(); + reader.setFile(f); + assertEquals("\t", reader.getSepChar()); + s= reader.read(); + l= (ListMNTPoint)s.getSource(); + assertEquals(3, l.nombre()); + assertEquals(1, l.renvoieX(0), 1e-15); + assertEquals(2, l.renvoieY(0), 1e-15); + assertEquals(3, l.renvoieZ(0), 1e-15); + assertEquals(3, l.renvoieX(1), 1e-15); + assertEquals(4, l.renvoieY(1), 1e-15); + assertEquals(5, l.renvoieZ(1), 1e-15); + assertEquals(7, l.renvoieX(2), 1e-15); + assertEquals(8, l.renvoieY(2), 1e-15); + assertEquals(0, l.renvoieZ(2), 1e-15); + File fW= null; + try { + fW= File.createTempFile("fudaa", ".sx"); + } catch (IOException e) { + e.printStackTrace(); + } + if (fW != null) { + MNTCsvWriter w= new MNTCsvWriter(); + w.setFile(fW); + w.setSep("\t"); + w.write(l); + reader= new MNTCsvReader(); + reader.setFile(fW); + s= reader.read(); + assertEquals("\t", reader.getSepChar()); + l= (ListMNTPoint)s.getSource(); + assertEquals(3, l.nombre()); + assertEquals(1, l.renvoieX(0), 1e-15); + assertEquals(2, l.renvoieY(0), 1e-15); + assertEquals(3, l.renvoieZ(0), 1e-15); + assertEquals(3, l.renvoieX(1), 1e-15); + assertEquals(4, l.renvoieY(1), 1e-15); + assertEquals(5, l.renvoieZ(1), 1e-15); + assertEquals(7, l.renvoieX(2), 1e-15); + assertEquals(8, l.renvoieY(2), 1e-15); + assertEquals(0, l.renvoieZ(2), 1e-15); + fW.delete(); + } + + } } Index: cas.txt =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/cas.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cas.txt 8 Oct 2003 11:54:19 -0000 1.3 --- cas.txt 12 Feb 2004 15:32:51 -0000 1.4 *************** *** 1,3 **** ! /---------------------------------------------------------------------- / TELEMAC-2D Version 5.2R0 - Septembre 2001 / Exemple d'initiation - Calcul numero 4 / Calcul d'écoulement sur zone sèche /---------------------------------------------------------------------- / ENVIRONNEMENT INFORMATIQUE /---------------------------------------------------------------------- / FICHIER DES PARAMETRES : './cas4.txt' FICHIER DES CONDITIONS AUX LIMITES : '../../matisse/cli2.txt' FICHIER DE GEOMETRIE : '../../matisse/geo1' FICHIER DES RESULTATS : './resu4.slf' / /---------------------------------------------------------------------- / OPTIONS GENERALES /---------------------------------------------------------------------- / TITRE : 'TELEMAC-2D - Initiation - Calcul numero 4' / VARIABLES POUR LES SORTIES GRAPHIQUES : 'U,V,S,B,H,Q,M,L' VARIABLES A IMPRIMER : '' PAS DE TEMPS : 1. DUREE DU CALCUL : 1600 PERIODE POUR LES SORTIES GRAPHIQUES : 15 PERIODE DE SORTIE LISTING : 15 SUITE DE CALCUL : NON --- 1,3 ---- ! /---------------------------------------------------------------------- / TELEMAC-2D Version 5.2R0 - Septembre 2001 / Exemple d'initiation - Calcul numero 4 / Calcul d'écoulement sur zone sèche /---------------------------------------------------------------------- / ENVIRONNEMENT INFORMATIQUE /---------------------------------------------------------------------- /LE FICHIER QUI VA BIEN FICHIER DES PARAMETRES : './cas4.txt' FICHIER DES CONDITIONS AUX LIMITES : '../../matisse/cli2.txt' FICHIER DE GEOMETRIE : '../../matisse/geo1' FICHIER DES RESULTATS : './resu4.slf' / /---------------------------------------------------------------------- / OPTIONS GENERALES /---------------------------------------------------------------------- / TITRE : 'TELEMAC-2D - Initiation - Calcul numero 4' / VARIABLES POUR LES SORTIES GRAPHIQUES : 'U,V,S,B,H,Q,M,L' VARIABLES A IMPRIMER : '' PAS DE TEMPS : 1. DUREE DU CALCUL : 1600 PERIODE POUR LES SORTIES GRAPHIQUES : 15 PERIODE DE SORTIE LISTING : 15 SUITE DE CALCUL : NON |