|
From: <de...@us...> - 2003-07-04 14:22:44
|
Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/reflux
In directory sc8-pr-cvs1:/tmp/cvs-serv31279/reflux
Modified Files:
TestCorEleBth.java TestDunes.java TestINP.java
Log Message:
Maj des test pour H2d
Index: TestCorEleBth.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/reflux/TestCorEleBth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TestCorEleBth.java 19 May 2003 13:54:02 -0000 1.4
--- TestCorEleBth.java 4 Jul 2003 14:22:41 -0000 1.5
***************
*** 10,16 ****
import java.io.File;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
import java.util.HashMap;
--- 10,13 ----
***************
*** 21,24 ****
--- 18,26 ----
import org.fudaa.dodico.corba.geometrie.SMaillageIndex;
import org.fudaa.dodico.corba.geometrie.SPoint;
+ import org.fudaa.dodico.fichiers.FileFormat;
+ import org.fudaa.dodico.fichiers.FileOperationSynthese;
+ import org.fudaa.dodico.h2d.H2dElement;
+ import org.fudaa.dodico.h2d.H2dMaillage;
+ import org.fudaa.dodico.h2d.H2dPoint;
import org.fudaa.dodico.reflux.io.CorEleBthFileFormat;
import org.fudaa.dodico.reflux.io.CorEleBthInterface;
***************
*** 26,30 ****
import org.fudaa.dodico.reflux.io.CorEleBthWriter;
import org.fudaa.dodico.test.TestIO;
- import org.fudaa.dodico.h2d.H2dFileReadView;
/**
--- 28,31 ----
***************
*** 35,105 ****
public class TestCorEleBth extends TestIO
{
!
public TestCorEleBth()
{
! super("corelebth.cor",CorEleBthFileFormat.getInstance());
!
}
!
! public void _interfaceTest(H2dFileReadView _t)
{
! assertNotNull(_t);
! assertTrue(_t.getAnalyzes()[0].isEmpty());
! assertTrue(_t.getAnalyzes()[1].isEmpty());
! assertTrue(_t.getAnalyzes()[2].isEmpty());
! assertTrue(_t.getSource() instanceof CorEleBthInterface);
! CorEleBthInterface t=(CorEleBthInterface)_t.getSource();
! SMaillageIndex maill = t.getMaillage();
assertNotNull(maill);
! assertEquals(maill.typeElement, LTypeElement.T6);
! SPoint[] pts = maill.points;
! assertEquals(pts.length, 1791);
//test sur le point 34
! double d = 15.1515007;
! double dLu = pts[33].x;
assertEquals(d, dLu, eps_);
! d = 7.5;
! dLu = pts[33].y;
assertEquals(d, dLu, eps_);
! d = 14.954545975;
! dLu = pts[33].z;
assertEquals(d, dLu, eps_);
//test sur le point 1791
! d = 1000;
! dLu = pts[1790].x;
assertEquals(d, dLu, eps_);
! d = 10;
! dLu = pts[1790].y;
assertEquals(d, dLu, eps_);
! d = 12;
! dLu = pts[1790].z;
assertEquals(d, dLu, eps_);
//test sur l'element 33
! int[] elems = maill.elements[33];
! assertEquals(maill.elements.length, 792);
assertEquals(elems.length, 6);
! int i = 306;
! int iLu = elems[0];
assertEquals(i, iLu);
! i = 307;
! iLu = elems[1];
assertEquals(i, iLu);
! i = 308;
! iLu = elems[2];
assertEquals(i, iLu);
! i = 298;
! iLu = elems[3];
assertEquals(i, iLu);
! i = 288;
! iLu = elems[4];
assertEquals(i, iLu);
! i = 297;
! iLu = elems[5];
assertEquals(i, iLu);
}
-
-
public static void printAnalyze(String _titre, DodicoAnalyze _analyze)
{
--- 36,99 ----
public class TestCorEleBth extends TestIO
{
!
public TestCorEleBth()
{
! super("corelebth.cor");
}
! public void _interfaceTest(
! CorEleBthInterface _inter)
{
! assertNotNull(_inter);
! CorEleBthInterface t= _inter;
! H2dMaillage maill= t.getMaillage();
assertNotNull(maill);
! assertEquals(maill.getEltType(), H2dElement.T6);
! //H2dPoint[] pts= maill.getPts();
! assertEquals(maill.getPtsNb(), 1791);
//test sur le point 34
! double d= 15.1515007;
! double dLu= maill.getPt(33).getX();
assertEquals(d, dLu, eps_);
! d= 7.5;
! dLu= maill.getPt(33).getY();
assertEquals(d, dLu, eps_);
! d= 14.954545975;
! dLu= maill.getPt(33).getZ();
assertEquals(d, dLu, eps_);
//test sur le point 1791
! d= 1000;
! dLu= maill.getPt(1790).getX();
assertEquals(d, dLu, eps_);
! d= 10;
! dLu= maill.getPt(1790).getY();
assertEquals(d, dLu, eps_);
! d= 12;
! dLu= maill.getPt(1790).getZ();
assertEquals(d, dLu, eps_);
//test sur l'element 33
! int[] elems= maill.getElts()[33].getPtIndex();
! assertEquals(maill.getEltNb(), 792);
assertEquals(elems.length, 6);
! int i= 306;
! int iLu= elems[0];
assertEquals(i, iLu);
! i= 307;
! iLu= elems[1];
assertEquals(i, iLu);
! i= 308;
! iLu= elems[2];
assertEquals(i, iLu);
! i= 298;
! iLu= elems[3];
assertEquals(i, iLu);
! i= 288;
! iLu= elems[4];
assertEquals(i, iLu);
! i= 297;
! iLu= elems[5];
assertEquals(i, iLu);
}
public static void printAnalyze(String _titre, DodicoAnalyze _analyze)
{
***************
*** 113,120 ****
public static void main(String[] args)
{
! HashMap arg = DodicoLib.parseArgs(args);
! String fileName = (String) arg.get("-f");
if (fileName == null)
! fileName = (String) arg.get("-file");
if (fileName == null)
{
--- 107,114 ----
public static void main(String[] args)
{
! HashMap arg= DodicoLib.parseArgs(args);
! String fileName= (String) arg.get("-f");
if (fileName == null)
! fileName= (String) arg.get("-file");
if (fileName == null)
{
***************
*** 122,126 ****
return;
}
! File f = new File(fileName);
if (!f.exists())
{
--- 116,120 ----
return;
}
! File f= new File(fileName);
if (!f.exists())
{
***************
*** 128,133 ****
return;
}
! String base = f.getAbsolutePath();
! int temp = base.lastIndexOf('.');
if (temp < 0)
{
--- 122,127 ----
return;
}
! String base= f.getAbsolutePath();
! int temp= base.lastIndexOf('.');
if (temp < 0)
{
***************
*** 135,140 ****
return;
}
! base = base.substring(0, temp);
! File cor = new File(base + ".cor");
if (!cor.exists())
{
--- 129,134 ----
return;
}
! base= base.substring(0, temp);
! File cor= new File(base + ".cor");
if (!cor.exists())
{
***************
*** 143,147 ****
return;
}
! File ele = new File(base + ".ele");
if (!cor.exists())
{
--- 137,141 ----
return;
}
! File ele= new File(base + ".ele");
if (!cor.exists())
{
***************
*** 150,154 ****
return;
}
! File bth = new File(base + ".bth");
if (!cor.exists())
{
--- 144,148 ----
return;
}
! File bth= new File(base + ".bth");
if (!cor.exists())
{
***************
*** 157,197 ****
return;
}
! CorEleBthReader reader = null;
! CorEleBthInterface t = null;
! try
! {
! reader = new CorEleBthReader(CorEleBthFileFormat.getInstance());
! reader.setIn(
! new FileReader(cor),
! new FileReader(ele),
! new FileReader(bth));
! reader.setProgressReceiver(new ProgressionBuAdapter(null));
! reader.read();
! DodicoAnalyze[] analyses = reader.getAnalyzes();
! printAnalyze("FICHIER cor", analyses[0]);
! printAnalyze("FICHIER ele", analyses[1]);
! printAnalyze("FICHIER bth", analyses[2]);
! SMaillageIndex mail = reader.getMaillage();
! t = reader.getCorEleBthInterface();
! if (mail != null)
! {
! DodicoLib.printFields(mail, false);
! }
! }
! catch (IOException _e)
! {
! _e.printStackTrace();
! }
! finally
{
!
! if (reader != null)
! {
! IOException[] exs = reader.close();
! if (exs != null)
! System.err.println("probleme severe impossible de fermer le flux");
!
! }
!
}
if (t == null)
--- 151,167 ----
return;
}
! CorEleBthReader reader= null;
! CorEleBthInterface t= null;
! reader= new CorEleBthReader(CorEleBthFileFormat.getInstance());
! reader.setIn(cor, ele, bth);
! reader.setProgressReceiver(new ProgressionBuAdapter(null));
! FileOperationSynthese op= new FileOperationSynthese();
! t= reader.read(op);
! DodicoAnalyze analyse= op.getAnalyze();
! printAnalyze("FICHIERS cor,ele,bth", analyse);
! H2dMaillage mail= t.getMaillage();
! if (mail != null)
{
! DodicoLib.printFields(mail, false);
}
if (t == null)
***************
*** 199,206 ****
System.out.println("probl de lecture");
}
! String out = (String) arg.get("-out");
if (out == null)
return;
! File corOut = new File(out + ".cor");
if (corOut.exists())
{
--- 169,176 ----
System.out.println("probl de lecture");
}
! String out= (String) arg.get("-out");
if (out == null)
return;
! File corOut= new File(out + ".cor");
if (corOut.exists())
{
***************
*** 208,212 ****
return;
}
! File eleOut = new File(out + ".ele");
if (eleOut.exists())
{
--- 178,182 ----
return;
}
! File eleOut= new File(out + ".ele");
if (eleOut.exists())
{
***************
*** 214,218 ****
return;
}
! File bthOut = new File(out + ".bth");
if (bthOut.exists())
{
--- 184,188 ----
return;
}
! File bthOut= new File(out + ".bth");
if (bthOut.exists())
{
***************
*** 220,256 ****
return;
}
! CorEleBthWriter w = null;
! try
! {
! w = new CorEleBthWriter(CorEleBthFileFormat.getInstance());
! w.setOut(
! new FileWriter(corOut),
! new FileWriter(eleOut),
! new FileWriter(bthOut));
! w.setCorEleBthInterface(t);
! w.setProgressReceiver(new ProgressionBuAdapter(null));
! w.write();
! DodicoAnalyze[] analyses = w.getAnalyzes();
! System.out.println("Ecriture");
! printAnalyze("FICHIER cor", analyses[0]);
! printAnalyze("FICHIER ele", analyses[1]);
! printAnalyze("FICHIER bth", analyses[2]);
! }
! catch (IOException e)
! {
! }
! finally
! {
! if (w != null)
! {
! IOException[] exs = w.close();
! if (exs != null)
! {
! System.err.println("Fatal erreur");
! }
! }
}
}
}
--- 190,233 ----
return;
}
! CorEleBthWriter w= null;
! w= new CorEleBthWriter(CorEleBthFileFormat.getInstance());
! w.setFile(corOut, eleOut, bthOut);
! w.setProgressReceiver(new ProgressionBuAdapter(null));
! FileOperationSynthese opW= new FileOperationSynthese();
! w.write(t, opW);
! System.out.println("Ecriture");
! printAnalyze("FICHIER", opW.getAnalyze());
+ }
+
+ /**
+ *
+ */
+ public void testEcriture()
+ {
+ CorEleBthInterface inter=getInter(fic_);
+ File tmpFile=createTempFile();
+ FileOperationSynthese syntheseR=CorEleBthFileFormat.getInstance().write(tmpFile, inter, null);
+ assertNull(syntheseR.getAnalyze());
+ _interfaceTest(getInter(tmpFile));
+
}
+ public CorEleBthInterface getInter(File _f)
+ {
+ FileOperationSynthese syntheseR= new FileOperationSynthese();
+ CorEleBthInterface r=CorEleBthFileFormat.getInstance().read(_f, syntheseR, null);
+ assertNull(syntheseR.getAnalyze());
+ return r;
+ }
+
+ /**
+ *
+ */
+ public void testLecture()
+ {
+ _interfaceTest(getInter(fic_));
+
}
+
}
Index: TestDunes.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/reflux/TestDunes.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TestDunes.java 19 May 2003 13:54:03 -0000 1.5
--- TestDunes.java 4 Jul 2003 14:22:41 -0000 1.6
***************
*** 23,28 ****
import org.fudaa.dodico.dunes.io.DunesReader;
import org.fudaa.dodico.dunes.io.DunesWriter;
import org.fudaa.dodico.test.TestIO;
- import org.fudaa.dodico.h2d.H2dFileReadView;
import com.memoire.bu.BuTask;
--- 23,31 ----
import org.fudaa.dodico.dunes.io.DunesReader;
import org.fudaa.dodico.dunes.io.DunesWriter;
+ import org.fudaa.dodico.fichiers.FileOperationSynthese;
+ import org.fudaa.dodico.h2d.H2dElement;
+ import org.fudaa.dodico.h2d.H2dMaillage;
+ import org.fudaa.dodico.h2d.H2dPoint;
import org.fudaa.dodico.test.TestIO;
import com.memoire.bu.BuTask;
***************
*** 38,50 ****
public TestDunes()
{
! super("mesh.mail",DunesFileFormat.getInstance());
}
! public synchronized void _interfaceTest(H2dFileReadView _t)
{
! assertNotNull(_t);
! assertTrue(_t.getAnalyzes()[0].isEmpty());
! assertTrue(_t.getSource() instanceof DunesInterface);
! DunesInterface t=(DunesInterface)_t.getSource();
double[] adapt = t.getAdaptatifValeur();
int temp = adapt.length;
--- 41,51 ----
public TestDunes()
{
! super("mesh.mail");
}
! public synchronized void _interfaceTest(DunesInterface _inter)
{
! assertNotNull(_inter);
! DunesInterface t=_inter;
double[] adapt = t.getAdaptatifValeur();
int temp = adapt.length;
***************
*** 60,82 ****
assertEquals(adapt[8], 1d, eps_);
assertNotNull(t.getMaillage());
! SPoint[] pts = t.getMaillage().points;
! temp = pts.length;
assertEquals(temp, 9);
! SPoint pt = pts[0];
! assertEquals(pt.x, 0d, eps_);
! assertEquals(pt.y, 0d, eps_);
! assertEquals(pt.z, 0.25, eps_);
! pt = pts[4];
! assertEquals(pt.x, 0d, eps_);
! assertEquals(pt.y, 3d, eps_);
! assertEquals(pt.z, 0.25, eps_);
! pt = pts[8];
! assertEquals(pt.x, 2d, eps_);
! assertEquals(pt.y, 1d, eps_);
! assertEquals(pt.z, 0.1, eps_);
! int[][] elems = t.getMaillage().elements;
temp = elems.length;
assertEquals(temp, 9);
! int[] indices = elems[1];
temp = indices.length;
assertEquals(temp, 3);
--- 61,83 ----
assertEquals(adapt[8], 1d, eps_);
assertNotNull(t.getMaillage());
! H2dMaillage m=t.getMaillage();
! temp = m.getPtsNb();
assertEquals(temp, 9);
! H2dPoint pt = m.getPt(0);
! assertEquals(pt.getX(), 0d, eps_);
! assertEquals(pt.getY(), 0d, eps_);
! assertEquals(pt.getZ(), 0.25, eps_);
! pt =m.getPt(4);
! assertEquals(pt.getX(), 0d, eps_);
! assertEquals(pt.getY(), 3d, eps_);
! assertEquals(pt.getZ(), 0.25, eps_);
! pt = m.getPt(8);
! assertEquals(pt.getX(), 2d, eps_);
! assertEquals(pt.getY(), 1d, eps_);
! assertEquals(pt.getZ(), 0.1, eps_);
! H2dElement[] elems = t.getMaillage().getElts();
temp = elems.length;
assertEquals(temp, 9);
! int[] indices = elems[1].getPtIndex();
temp = indices.length;
assertEquals(temp, 3);
***************
*** 84,88 ****
assertEquals(indices[1], 0);
assertEquals(indices[2], 5);
! indices = elems[6];
temp = indices.length;
assertEquals(temp, 3);
--- 85,89 ----
assertEquals(indices[1], 0);
assertEquals(indices[2], 5);
! indices = elems[6].getPtIndex();
temp = indices.length;
assertEquals(temp, 3);
***************
*** 91,94 ****
--- 92,128 ----
assertEquals(indices[2], 6);
}
+
+ /**
+ *
+ */
+ public void testEcriture()
+ {
+ DunesInterface inter=getInter(fic_);
+ File tmpFile=createTempFile();
+ FileOperationSynthese syntheseR=DunesFileFormat.getInstance().write(tmpFile, inter, null);
+ assertNull(syntheseR.getAnalyze());
+ _interfaceTest(getInter(tmpFile));
+
+ }
+
+ public static DunesInterface getInter(File _f)
+ {
+ FileOperationSynthese syntheseR= new FileOperationSynthese();
+ DunesInterface r=DunesFileFormat.getInstance().read(_f, syntheseR, null);
+ assertNull(syntheseR.getAnalyze());
+ if(syntheseR.containsMessages())
+ syntheseR.getAnalyze().printResume();
+ return r;
+ }
+
+ /**
+ *
+ */
+ public void testLecture()
+ {
+ _interfaceTest(getInter(fic_));
+
+ }
+
***************
*** 111,151 ****
return;
}
- DunesReader r = null;
- DunesInterface inter = null;
ProgressionBuAdapter progress = new ProgressionBuAdapter(new BuTask());
! try
! {
! r = new DunesReader();
! r.setIn(new FileReader(f));
! r.setProgressReceiver(progress);
! r.read();
! inter = r.getDunesInterface();
! DodicoAnalyze infos = r.getAnalyze();
! if(infos!=null) infos.printResume();
!
! if (inter != null)
! {
!
! System.out.println("+ source");
! DodicoLib.printFields(inter, true);
! DodicoLib.printFields(inter.getMaillage(), false);
! }
! else
! System.out.println("Attention Pas de source");
! }
! catch (IOException e)
! {
! e.printStackTrace();
! }
!
! finally
! {
! if (r != null)
! {
! IOException[] exs = r.close();
! if (exs != null)
! System.err.println("Impossible de fermer le flux");
! }
! }
fileName = (String) arg.get("-out");
if (fileName == null)
--- 145,152 ----
return;
}
ProgressionBuAdapter progress = new ProgressionBuAdapter(new BuTask());
! FileOperationSynthese op=new FileOperationSynthese();
! DunesInterface inter = DunesFileFormat.getInstance().read(f, op, progress);
! if(op.containsMessages()) op.getAnalyze().printResume();
fileName = (String) arg.get("-out");
if (fileName == null)
***************
*** 160,185 ****
return;
}
! DunesWriter w = null;
! try
! {
! w = new DunesWriter();
! w.setOut(new FileWriter(out));
! w.setProgressReceiver(progress);
! w.setDunesInterface(inter);
! w.write();
! }
! catch (IOException io)
! {
! io.printStackTrace();
! }
! finally
! {
! if (w != null)
! {
! IOException[] exs = w.close();
! if (exs != null)
! System.err.println("Impossible de fermer le flux");
! }
! }
}
--- 161,166 ----
return;
}
! FileOperationSynthese opw=DunesFileFormat.getInstance().write(out, inter, progress);
! if(opw.containsMessages()) opw.getAnalyze().printResume();
}
Index: TestINP.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/reflux/TestINP.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TestINP.java 19 May 2003 13:54:03 -0000 1.3
--- TestINP.java 4 Jul 2003 14:22:41 -0000 1.4
***************
*** 10,37 ****
import java.io.File;
- import java.io.IOException;
import java.util.HashMap;
import org.fudaa.dodico.commun.DodicoAnalyze;
import org.fudaa.dodico.commun.DodicoLib;
import org.fudaa.dodico.commun.ProgressionBuAdapter;
! import org.fudaa.dodico.corba.geometrie.SPoint;
! import org.fudaa.dodico.corba.tr.LTrMethodeResolution;
! import org.fudaa.dodico.corba.tr.LTrSchemaResolution;
! import org.fudaa.dodico.corba.tr.LTrTypeBord;
! import org.fudaa.dodico.corba.tr.LTrTypeProjet;
! import org.fudaa.dodico.corba.tr.STrConditionLimite;
! import org.fudaa.dodico.corba.tr.STrGroupeTemps;
! import org.fudaa.dodico.corba.tr.STrProjetH2d;
! import org.fudaa.dodico.corba.tr.STrProprieteElementaire;
! import org.fudaa.dodico.corba.tr.STrProprieteElementaireValeur;
import org.fudaa.dodico.reflux.io.INPFileFormat;
import org.fudaa.dodico.reflux.io.INPInterface;
- import org.fudaa.dodico.reflux.io.INPReader;
import org.fudaa.dodico.test.TestIO;
- import org.fudaa.dodico.h2d.H2dFileReadView;
- import org.fudaa.dodico.h2d.H2dParametres;
-
- import com.memoire.bu.BuTask;
/**
--- 10,42 ----
import java.io.File;
import java.util.HashMap;
+ import java.util.Map;
+
+ import com.memoire.bu.BuTask;
+
+ import org.fudaa.dodico.corba.tr.STrProjetH2d;
import org.fudaa.dodico.commun.DodicoAnalyze;
import org.fudaa.dodico.commun.DodicoLib;
import org.fudaa.dodico.commun.ProgressionBuAdapter;
! import org.fudaa.dodico.dico.DicoEntite;
! import org.fudaa.dodico.fichiers.FileOperationSynthese;
! import org.fudaa.dodico.h2d.H2dConditionLimiteReflux;
! import org.fudaa.dodico.h2d.H2dElement;
! import org.fudaa.dodico.h2d.H2dGroupePasTemps;
! import org.fudaa.dodico.h2d.H2dMaillage;
! import org.fudaa.dodico.h2d.H2dPoint;
! import org.fudaa.dodico.h2d.H2dProprieteElementaire;
! import org.fudaa.dodico.h2d.H2dRefluxDicoModel;
! import org.fudaa.dodico.h2d.type.H2dBordType;
! import org.fudaa.dodico.h2d.type.H2dClType;
! import org.fudaa.dodico.h2d.type.H2dMethodeResolutionType;
! import org.fudaa.dodico.h2d.type.H2dProjetType;
! import org.fudaa.dodico.h2d.type.H2dRefluxImpressionType;
! import org.fudaa.dodico.h2d.type.H2dSchemaResolutionType;
! import org.fudaa.dodico.h2d.type.H2dVariableType;
import org.fudaa.dodico.reflux.io.INPFileFormat;
import org.fudaa.dodico.reflux.io.INPInterface;
import org.fudaa.dodico.test.TestIO;
/**
***************
*** 44,48 ****
public TestINP()
{
! super("canal_s.inp",INPFileFormat.getInstance());
}
--- 49,53 ----
public TestINP()
{
! super("canal_s.inp");
}
***************
*** 51,97 ****
* @see org.fudaa.dodico.test.TestIO#_interfaceTest(TrFileReadView)
*/
! public void _interfaceTest(H2dFileReadView _r)
{
! INPInterface t=(INPInterface)_r.getSource();
! STrProjetH2d pr=t.getProjet();
! String v=pr.version;
! System.out.println(v);
! assertTrue("5.0".equals(v));
! assertEquals(pr.typeProjet, LTrTypeProjet.COURANTOLOGIE_2D);
! assertNotNull(pr.parametresCalcul);
! assertEquals(pr.parametresCalcul.impressions[0],"ITERATION");
! SPoint[] pts=pr.maillage.points;
! assertEquals(pts.length, 1791);
! SPoint pt=pts[1790];
! assertEquals(pt.x, 1000,eps_);
! assertEquals(pt.y, 10,eps_);
! assertEquals(pt.z, 12,eps_);
! pt=pts[1770];
! assertEquals(pt.x, 989.898987,eps_);
! assertEquals(pt.y, 7.5,eps_);
! assertEquals(pt.z, 12.030303,eps_);
! int[] itemp=pr.maillage.pointsExtremitesElements;
assertNotNull("Les points frontiere ne sont pas nuls",itemp);
assertEquals(itemp[5], 18);
assertEquals(itemp[499],1790);
! STrConditionLimite[] tabCl=pr.conditionsLimites;
! STrConditionLimite cl=getForIndex(tabCl, 818);
! assertEquals(cl.uCode, H2dParametres.CODE_PERMANENT);
! assertEquals(cl.u,0,eps_);
cl=getForIndex(tabCl, 1790);
! assertEquals(cl.vCode, H2dParametres.CODE_PERMANENT);
! assertEquals(cl.v,0,eps_);
! assertEquals(cl.normale, 0,eps_);
! assertEquals(cl.hCode, H2dParametres.CODE_PERMANENT);
! assertEquals(cl.h,13.3,eps_);
cl=getForIndex(tabCl, 1781);
! assertEquals(cl.normale, 90.0000041,eps_);
cl=getForIndex(tabCl, 0);
! assertEquals(cl.hCode, H2dParametres.CODE_PERMANENT);
! assertEquals(cl.h,16.325,eps_);
itemp=new int[]{1430,1421,1412,1403,1394};
--- 56,99 ----
* @see org.fudaa.dodico.test.TestIO#_interfaceTest(TrFileReadView)
*/
! public void _interfaceTest(INPInterface _t)
{
! INPInterface t=_t;
! assertTrue("5.0".equals(t.getVersion()));
! assertEquals(t.getTypeProjet(), H2dProjetType.COURANTOLOGIE_2D);
! assertNotNull(t.getEntiteValue());
! assertTrue(t.getEntiteValue().containsKey(t.getDicoModel().getEntite("ITERATION")));
! H2dMaillage m=t.getMaillage();
! assertEquals(m.getPtsNb(), 1791);
! H2dPoint pt=m.getPt(1790);
! assertEquals(pt.getX(), 1000,eps_);
! assertEquals(pt.getY(), 10,eps_);
! assertEquals(pt.getZ(), 12,eps_);
! pt=m.getPt(1770);
! assertEquals(pt.getX(), 989.898987,eps_);
! assertEquals(pt.getY(), 7.5,eps_);
! assertEquals(pt.getZ(), 12.030303,eps_);
! int[] itemp=t.getMaillage().getPtsExtremitesElement();
assertNotNull("Les points frontiere ne sont pas nuls",itemp);
assertEquals(itemp[5], 18);
assertEquals(itemp[499],1790);
! H2dConditionLimiteReflux[] tabCl=t.getConditionLimite();
! H2dConditionLimiteReflux cl=getForIndex(tabCl, 818);
! assertEquals(cl.getUType(), H2dClType.PERMANENT);
! assertEquals(cl.getU(),0,eps_);
cl=getForIndex(tabCl, 1790);
! assertEquals(cl.getVType(), H2dClType.PERMANENT);
! assertEquals(cl.getV(),0,eps_);
! assertEquals(cl.getNormale(), 0,eps_);
! assertEquals(cl.getHType(), H2dClType.PERMANENT);
! assertEquals(cl.getH(),13.3,eps_);
cl=getForIndex(tabCl, 1781);
! assertEquals(cl.getNormale(), 90.0000041,eps_);
cl=getForIndex(tabCl, 0);
! assertEquals(cl.getHType(), H2dClType.PERMANENT);
! assertEquals(cl.getH(),16.325,eps_);
itemp=new int[]{1430,1421,1412,1403,1394};
***************
*** 100,113 ****
{
cl=getForIndex(tabCl, itemp[i]);
! assertEquals(LTrTypeBord.SOLIDE,cl.typeBord);
! assertEquals(H2dParametres.CODE_PERMANENT,cl.stricklerCode);
! assertEquals(1d/3d,cl.strickler ,eps_);
}
! int[][] elems=pr.maillage.elements;
assertEquals(elems.length, 792);
! itemp=elems[791];
assertEquals(itemp[0], 1788);
assertEquals(itemp[1], 1789);
--- 102,115 ----
{
cl=getForIndex(tabCl, itemp[i]);
! assertEquals(H2dBordType.SOLIDE,cl.getBordType());
! assertEquals(H2dClType.PERMANENT,cl.getRugositeType());
! assertEquals(3d,cl.getRugosite(),eps_);
}
! H2dElement[] elems=t.getMaillage().getElts();
assertEquals(elems.length, 792);
! itemp=elems[791].getPtIndex();
assertEquals(itemp[0], 1788);
assertEquals(itemp[1], 1789);
***************
*** 117,154 ****
assertEquals(itemp[5], 1779);
! STrProprieteElementaire[] propelem=pr.proprietesElementaires;
! STrProprieteElementaire prTemp=propelem[0];
! assertEquals("VISCOSITE", prTemp.nom);
! assertEquals(prTemp.valeursTransitoires.length, 0);
! assertEquals(prTemp.valeurs.length, 0);
! assertEquals(prTemp.elementsLibres.length, 0);
! assertEquals(prTemp.valeurParDefaut,0.01,eps_);
prTemp=propelem[1];
! assertEquals("RUGOSITE", prTemp.nom);
! assertEquals(prTemp.valeursTransitoires.length, 0);
! assertEquals(prTemp.valeurs.length, 0);
! assertEquals(prTemp.elementsLibres.length, 0);
! assertEquals(prTemp.valeurParDefaut,0.025,eps_);
prTemp=propelem[2];
! assertEquals("LONGUEUR MELANGE", prTemp.nom);
! assertEquals(prTemp.valeursTransitoires.length, 0);
! assertEquals(prTemp.valeurs.length, 0);
! assertEquals(prTemp.elementsLibres.length, 0);
! assertEquals(prTemp.valeurParDefaut,0.0,eps_);
prTemp=propelem[3];
! assertEquals("PERTE CHARGE", prTemp.nom);
! assertEquals(prTemp.valeursTransitoires.length, 0);
! assertEquals(prTemp.elementsLibres.length, 0);
! assertEquals(prTemp.valeurParDefaut,0.0,eps_);
! assertEquals(prTemp.valeurs.length, 792);
! STrProprieteElementaireValeur[] vals=prTemp.valeurs;
for(int i=790;i>=0;i--)
{
if(i!=758)
! assertEquals(vals[i].valeur, 0.0,eps_);
else
! assertEquals(vals[i].valeur, 0.01,eps_);
}
String[] fics=t.getFichiers();
--- 119,156 ----
assertEquals(itemp[5], 1779);
! H2dProprieteElementaire[] propelem=t.getPropElementaires();
! H2dProprieteElementaire prTemp=propelem[0];
! assertEquals(prTemp.getVariableType(), H2dVariableType.VISCOSITE);
! assertEquals(prTemp.getValeurTransitoireNb(), 0);
! assertEquals(prTemp.getPermanentNb(), 0);
! assertEquals(prTemp.getValeurLibreNb(), 0);
! assertEquals(prTemp.getDefaultValue(),0.01,eps_);
prTemp=propelem[1];
! assertEquals(prTemp.getVariableType(), H2dVariableType.RUGOSITE);
! assertEquals(prTemp.getValeurTransitoireNb(), 0);
! assertEquals(prTemp.getPermanentNb(), 0);
! assertEquals(prTemp.getValeurLibreNb(), 0);
! assertEquals(prTemp.getDefaultValue(),0.025,eps_);
prTemp=propelem[2];
! assertEquals(prTemp.getVariableType(), H2dVariableType.ALPHA_LONGUEUR_MELANGE);
! assertEquals(prTemp.getValeurTransitoireNb(), 0);
! assertEquals(prTemp.getPermanentNb(), 0);
! assertEquals(prTemp.getValeurLibreNb(), 0);
! assertEquals(prTemp.getDefaultValue(),0.0,eps_);
prTemp=propelem[3];
! assertEquals(prTemp.getVariableType(), H2dVariableType.PERTE_CHARGE);
! assertEquals(prTemp.getValeurTransitoireNb(), 0);
! assertEquals(prTemp.getPermanentNb(), 792);
! assertEquals(prTemp.getValeurLibreNb(), 0);
! assertEquals(prTemp.getDefaultValue(),0.0,eps_);
!
for(int i=790;i>=0;i--)
{
if(i!=758)
! assertEquals(prTemp.getPermanentValueForIndex(i), 0.0,eps_);
else
! assertEquals(prTemp.getPermanentValueForIndex(i), 0.01,eps_);
}
String[] fics=t.getFichiers();
***************
*** 160,197 ****
assertFalse(t.contientSollicitationsReparties());
assertFalse(t.contientVent());
! STrGroupeTemps[] gts=pr.parametresTemporels;
assertNotNull(gts);
assertEquals(gts.length, 1);
! STrGroupeTemps gt=gts[0];
assertNotNull(gt);
! assertEquals(gt.nbPasTemps, 1);
! assertEquals(gt.schema, LTrSchemaResolution.STATIONNAIRE);
! assertEquals(gt.methode, LTrMethodeResolution.SELECT_LUMPING);
! assertEquals(gt.relaxation, 1,eps_);
! assertEquals(gt.precision , 0.001,eps_);
! assertEquals(gt.precisionBancCouvrantDecouvrant , 0.05,eps_);
! assertEquals(gt.nombreIterationMax , 2);
! double[] dtemp=gt.coefficientsContribution;
assertNotNull(dtemp);
! for(int i=dtemp.length-1;i>=0;i--)
{
! assertEquals(dtemp[i] , i,eps_);
}
}
! private STrConditionLimite getForIndex(STrConditionLimite[] _tab,int _index)
{
int l=_tab.length-1;
for(int i=l;i>=0;i--)
{
! if(_tab[i].indexsPt==_index) return _tab[i];
}
return null;
}
public void testEcriture()
{
! //PAs implanter
}
--- 162,231 ----
assertFalse(t.contientSollicitationsReparties());
assertFalse(t.contientVent());
!
! H2dGroupePasTemps[] gts=t.getGroupePasTemps();
assertNotNull(gts);
assertEquals(gts.length, 1);
! H2dGroupePasTemps gt=gts[0];
assertNotNull(gt);
! assertEquals(gt.getNbPasTemps(), 1);
! assertEquals(gt.getSchema(), H2dSchemaResolutionType.STATIONNAIRE);
! assertEquals(gt.getMethode(), H2dMethodeResolutionType.SELECT_LUMPING);
! assertEquals(gt.getRelaxation(), 1,eps_);
! assertEquals(gt.getPrecision(), 0.001,eps_);
! assertEquals(gt.getPrecisionBancCouvrantDecouvrant(), 0.05,eps_);
! assertEquals(gt.getNombreIterationMax(), 2);
! Map dtemp=t.getEntiteValue();
assertNotNull(dtemp);
! H2dRefluxDicoModel model=t.getDicoModel();
! for(int i=8;i>=0;i--)
{
! DicoEntite ent=model.getCoefContribution(i);
! assertNotNull(ent);
! assertEquals(Double.parseDouble((String)dtemp.get(ent)) , i,eps_);
}
}
! private H2dConditionLimiteReflux getForIndex(H2dConditionLimiteReflux[] _tab,int _index)
{
int l=_tab.length-1;
for(int i=l;i>=0;i--)
{
! if(_tab[i].getIndexPt()==_index) return _tab[i];
}
return null;
}
+ /**
+ *
+ */
public void testEcriture()
{
! // CorEleBthInterface inter=getInter(fic_);
! // File tmpFile=createTempFile();
! // FileOperationSynthese syntheseR=CorEleBthFileFormat.getInstance().write(tmpFile, inter, null);
! // assertNull(syntheseR.getAnalyze());
! // _interfaceTest(getInter(tmpFile));
!
! }
!
! public INPInterface getInter(File _f)
! {
! FileOperationSynthese syntheseR= new FileOperationSynthese();
! INPInterface r=INPFileFormat.getInstance().read(_f, syntheseR, null);
! if(syntheseR.getAnalyze()!=null)
! System.out.println( syntheseR.getAnalyze().getResume());
! assertNull(syntheseR.getAnalyze());
! return r;
}
+
+ /**
+ *
+ */
+ public void testLecture()
+ {
+ _interfaceTest(getInter(fic_));
+
+ }
+
***************
*** 216,262 ****
return;
}
- INPReader r = null;
- STrProjetH2d inter = null;
- ProgressionBuAdapter progress = new ProgressionBuAdapter(new BuTask());
! r = new INPReader();
! r.setIn(f);
! r.setProgressReceiver(progress);
! r.read();
! inter = r.getINPInterface().getProjet();
! DodicoAnalyze infos = r.getAnalyze();
if (infos != null)
infos.printResume();
- IOException[] exs = r.close();
- if (exs != null)
- System.err.println("Impossible de fermer le flux");
! if (inter != null)
! {
! if (inter.typeProjet.equals(LTrTypeProjet.COURANTOLOGIE_2D))
! System.out.println("courant 2D");
! else if (inter.typeProjet.equals(LTrTypeProjet.COURANTOLOGIE_2D_LMG))
! System.out.println("courant 2D LMG");
! else if (inter.typeProjet.equals(LTrTypeProjet.TRANSPORT_2D))
! System.out.println("transport 2D");
! else
! System.out.println("type inconnu");
! System.out.println();
! DodicoLib.printFields(inter, false);
! }
! if (inter.parametresCalcul != null)
! {
! System.out.println();
! System.out.println("Paramètres de calcul");
! DodicoLib.printFields(inter.parametresCalcul, true);
! }
! try
! {
! Thread.currentThread().sleep(10000);
! }
! catch(Exception e)
{
! e.printStackTrace();
}
}
--- 250,273 ----
return;
}
! FileOperationSynthese syntheseR= new FileOperationSynthese();
! INPInterface inpInter=INPFileFormat.getInstance().read(f, syntheseR, null);
! DodicoAnalyze infos = syntheseR.getAnalyze();
if (infos != null)
infos.printResume();
! if (inpInter != null)
{
! System.out.println(inpInter.getTypeProjet().toString());
! DodicoLib.printFields(inpInter, false);
}
+ // try
+ // {
+ // Thread.currentThread().sleep(10000);
+ // }
+ // catch(Exception e)
+ // {
+ // e.printStackTrace();
+ // }
}
|