|
From: <bma...@us...> - 2003-02-18 16:52:17
|
Update of /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/refonde
In directory sc8-pr-cvs1:/tmp/cvs-serv22669
Modified Files:
RefondeModeleCalcul.java
Log Message:
Ajout de la prise en compte des fonds poreux, de la condition absorbante d'ordre 2, gestion de la sauvegarde/restitution.
Index: RefondeModeleCalcul.java
===================================================================
RCS file: /cvsroot/fudaa/fudaa_devel/fudaa/src/org/fudaa/fudaa/refonde/RefondeModeleCalcul.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RefondeModeleCalcul.java 30 Jan 2003 13:09:46 -0000 1.1
--- RefondeModeleCalcul.java 18 Feb 2003 16:52:13 -0000 1.2
***************
*** 29,32 ****
--- 29,37 ----
public static final int DEFER_ECRETAGE=2;
+ public static final int BORD_COND_ORDRE_1 =0;
+ public static final int BORD_FORM_ANA_ILE =1;
+ public static final int BORD_FORM_ANA_PORT=2;
+ public static final int BORD_COND_ORDRE_2 =3;
+
public static final int FORMULE_GODA_SANS_PENTE=0;
public static final int FORMULE_GODA_AVEC_PENTE=1;
***************
*** 49,55 ****
protected double hauteurHoule_ =0;
// protected double profondeurOrigine_ =0;
! protected int casBordOuvert_ =0; // 0: Condition absorbante, 1: f.a. ile, 2: f.a. port
protected int ordreMax_ =0;
protected int typeHoule_ =HOULE_REG;
// Déferlement
--- 54,62 ----
protected double hauteurHoule_ =0;
// protected double profondeurOrigine_ =0;
! protected int casBordOuvert_ =BORD_COND_ORDRE_1;
protected int ordreMax_ =0;
protected int typeHoule_ =HOULE_REG;
+ /** Fonds poreux */
+ protected boolean fondsPoreux_ =false;
// Déferlement
***************
*** 223,226 ****
--- 230,245 ----
/**
+ * Prise en compte ou non des fonds poreux.
+ * @param _b <code>true</code> Les fonds sont poreux, <code>false</code> sinon.
+ */
+ public void setFondsPoreux(boolean _b) { setModifie(); fondsPoreux_=_b; }
+
+ /**
+ * Les fonds sont-ils poreux ?
+ * @return <code>true</code> Les fonds sont poreux, <code>false</code> sinon.
+ */
+ public boolean isFondsPoreux() { return fondsPoreux_; }
+
+ /**
* Attribut Modèle modifié
*/
***************
*** 300,304 ****
else if (version.compareTo("5.08")<=0) cal.lire508(_projet,file);
else if (version.compareTo("5.12")<=0) cal.lire512(_projet,file);
! else cal.lire(_projet,file); // Ajout des angles supplémentaires sur les contours
}
catch (NumberFormatException _exc) {
--- 319,328 ----
else if (version.compareTo("5.08")<=0) cal.lire508(_projet,file);
else if (version.compareTo("5.12")<=0) cal.lire512(_projet,file);
! // Ajout des angles supplémentaires sur les contours
! else if (version.compareTo("5.14")<=0) cal.lire514(_projet,file);
! // Suppression longueur onde
! // Ajout prise en compte fonds poreux
! // Ajout condition absorbante ordre 2
! else cal.lire(_projet,file);
}
catch (NumberFormatException _exc) {
***************
*** 341,345 ****
/**
! * Lecture des informations sur version 506
*/
private void lire506(RefondeProjet _projet, StreamTokenizer _file)
--- 365,369 ----
/**
! * Lecture des informations sur version 506 et moins
*/
private void lire506(RefondeProjet _projet, StreamTokenizer _file)
***************
*** 484,488 ****
/**
! * Lecture des informations sur version 508
*/
private void lire508(RefondeProjet _projet, StreamTokenizer _file)
--- 508,512 ----
/**
! * Lecture des informations sur version 508 et moins
*/
private void lire508(RefondeProjet _projet, StreamTokenizer _file)
***************
*** 750,756 ****
/**
! * Lecture des informations sur version courante
*/
! private void lire(RefondeProjet _projet, StreamTokenizer _file)
throws RefondeIOException, IOException {
double val=0;
--- 774,780 ----
/**
! * Lecture des informations sur version 512 et moins
*/
! private void lire512(RefondeProjet _projet, StreamTokenizer _file)
throws RefondeIOException, IOException {
double val=0;
***************
*** 943,946 ****
--- 967,1308 ----
else throw new IOException();
+ _file.nextToken();
+ ais.add(ai);
+ }
+
+ aiss.add(ais);
+ }
+
+ Object[] objs=aiss.toArray();
+ angles_=new Vector[objs.length];
+ for (int i=0; i<angles_.length; i++) angles_[i]=(Vector)objs[i];
+ // Correction des angles
+ corrigeAngles();
+
+ // Angles d'incidence sur les digues
+
+ // Nombre d'angles d'incidence sur les digues
+ if (_file.nextToken()!=WORD || !_file.sval.equals("<angles_incidence>"))
+ throw new IOException();
+ if (_file.nextToken()!=WORD) throw new IOException();
+ nbAiDigue=Integer.parseInt(_file.sval);
+
+ // Angles d'incidence sur les digues
+ // ai2pl_=new Hashtable(nbAiDigue);
+ for (int i=0; i<nbAiDigue; i++) {
+
+ // Polyligne support
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ival=Integer.parseInt(_file.sval);
+ if (ival<0 || ival>vpls.size()) throw new IOException();
+ pl=(RefondePolyligne)vpls.get(ival);
+
+ // Abscisse de début
+ if (_file.nextToken()!=WORD) throw new IOException();
+ sDeb=Double.parseDouble(_file.sval);
+
+ // Abscisse de fin
+ if (_file.nextToken()!=WORD) throw new IOException();
+ sFin=Double.parseDouble(_file.sval);
+
+ // Type de l'angle
+ if (_file.nextToken()!=WORD) throw new IOException();
+
+ // Absolu => Angle absolu
+ if (_file.sval.equals("absolu")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai=new RefondeAngle();
+ ai.setAbsolu(sDeb,sFin,angle);
+ }
+
+ // Relatif => Angle par rapport a la normale sur le bord
+ else if (_file.sval.equals("relatif")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai=new RefondeAngle();
+ ai.setRelatif(sDeb,sFin,angle);
+ }
+
+ // Diffracté => Position x, y du point de diffraction
+ else if (_file.sval.equals("diffracte")) {
+ ptDiff=new GrPoint();
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ptDiff.x=Double.parseDouble(_file.sval);
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ptDiff.y=Double.parseDouble(_file.sval);
+ ptDiff.z=0.;
+
+ ai=new RefondeAngle();
+ ai.setDiffracte(sDeb,sFin,ptDiff);
+ }
+
+ else throw new IOException();
+
+ ai2pl_.put(ai,pl);
+ }
+
+ // Angles de transmission sur les digues
+
+ // Nombre d'angles de transmission sur les digues
+ if (_file.nextToken()!=WORD || !_file.sval.equals("<angles_transmission>"))
+ throw new IOException();
+ if (_file.nextToken()!=WORD) throw new IOException();
+ nbAtDigue=Integer.parseInt(_file.sval);
+
+ // Angles dde transmission sur les digues
+ at2pl_=new Hashtable(nbAtDigue);
+ for (int i=0; i<nbAtDigue; i++) {
+
+ // Polyligne support
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ival=Integer.parseInt(_file.sval);
+ if (ival<0 || ival>vpls.size()) throw new IOException();
+ pl=(RefondePolyligne)vpls.get(ival);
+
+ // Abscisse de début
+ if (_file.nextToken()!=WORD) throw new IOException();
+ sDeb=Double.parseDouble(_file.sval);
+
+ // Abscisse de fin
+ if (_file.nextToken()!=WORD) throw new IOException();
+ sFin=Double.parseDouble(_file.sval);
+
+ // Type de l'angle
+ if (_file.nextToken()!=WORD) throw new IOException();
+
+ // Absolu => Angle absolu
+ if (_file.sval.equals("absolu")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai=new RefondeAngle();
+ ai.setAbsolu(sDeb,sFin,angle);
+ }
+
+ // Relatif => Angle par rapport a la normale sur le bord
+ else if (_file.sval.equals("relatif")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai=new RefondeAngle();
+ ai.setRelatif(sDeb,sFin,angle);
+ }
+
+ // Diffracté => Position x, y du point de diffraction
+ else if (_file.sval.equals("diffracte")) {
+ ptDiff=new GrPoint();
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ptDiff.x=Double.parseDouble(_file.sval);
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ptDiff.y=Double.parseDouble(_file.sval);
+ ptDiff.z=0.;
+
+ ai=new RefondeAngle();
+ ai.setDiffracte(sDeb,sFin,ptDiff);
+ }
+
+ else throw new IOException();
+
+ at2pl_.put(ai,pl);
+ }
+ }
+
+ /**
+ * Lecture des informations sur version 5.14 et moins
+ */
+ private void lire514(RefondeProjet _projet, StreamTokenizer _file)
+ throws RefondeIOException, IOException {
+ double val=0;
+ int nbAiDigue;
+ int nbAtDigue;
+ int ival;
+
+ RefondeAngle ai;
+ RefondePolyligne pl;
+ Vector ais;
+ Vector aiss;
+ double sDeb;
+ double sFin;
+ double angle;
+ GrPoint ptDiff;
+
+ RefondeGeometrie geo=_projet.getGeometrie();
+ Vector vpls=geo.getPolylignes();
+
+ // Identifiant de géométrie
+ if (_file.nextToken()!=WORD || !_file.sval.equals("<identifiant_geometrie>"))
+ throw new IOException();
+ if (_file.nextToken()!=WORD || Integer.parseInt(_file.sval)!=geo.identifiant())
+ throw new RefondeIOException(
+ "Le numéro de version de la géométrie n'est pas compatible avec le projet");
+
+ // Paramètres généraux
+
+ if (_file.nextToken()!=WORD || !_file.sval.equals("<parametres>"))
+ throw new IOException();
+
+ // Hauteur de mer
+ if (_file.nextToken()!=WORD) throw new IOException();
+ hauteurMer_=Double.parseDouble(_file.sval);
+
+ // Profondeur d'origine (inutilisée à partir de version 5.12. A supprimer).
+ if (_file.nextToken()!=WORD) throw new IOException();
+ // profondeurOrigine_=Double.parseDouble(_file.sval);
+ double dummy=Double.parseDouble(_file.sval);
+
+ // Cas de bord ouvert
+ if (_file.nextToken()!=WORD) throw new IOException();
+ if (_file.sval.equals("cond_absorbante")) casBordOuvert_=BORD_COND_ORDRE_1;
+ else if (_file.sval.equals("fa_ile")) casBordOuvert_=BORD_FORM_ANA_ILE;
+ else if (_file.sval.equals("fa_port")) casBordOuvert_=BORD_FORM_ANA_PORT;
+ else throw new IOException();
+
+ // Ordre max de troncature
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ordreMax_=(int)Double.parseDouble(_file.sval);
+
+ // Paramètres de houle
+
+ if (_file.nextToken()!=WORD || !_file.sval.equals("houle"))
+ throw new IOException();
+
+ // Cas de houle
+ if (_file.nextToken()!=WORD) throw new IOException();
+ if (_file.sval.equals("reguliere")) typeHoule(HOULE_REG);
+ else if (_file.sval.equals("aleatoire")) typeHoule(HOULE_ALEA);
+ else throw new IOException();
+
+ // Houle régulière
+ if (typeHoule()==HOULE_REG) {
+
+ // Hauteur
+ if (_file.nextToken()!=WORD) throw new IOException();
+ hauteurHoule_=Double.parseDouble(_file.sval);
+ // Période
+ if (_file.nextToken()!=WORD) throw new IOException();
+ periodeHoule_=Double.parseDouble(_file.sval);
+ // Direction
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angleHoule_=Double.parseDouble(_file.sval);
+ }
+
+ // Houle aléatoire
+ else {
+
+ // Nombre de periodes
+ if (_file.nextToken()!=WORD) throw new IOException();
+ nbPeriodes_=(int)Double.parseDouble(_file.sval);
+ // Periode min.
+ if (_file.nextToken()!=WORD) throw new IOException();
+ periodeHouleMin_=Double.parseDouble(_file.sval);
+ // Periode max.
+ if (_file.nextToken()!=WORD) throw new IOException();
+ periodeHouleMax_=Double.parseDouble(_file.sval);
+ // Nombre de directions
+ if (_file.nextToken()!=WORD) throw new IOException();
+ nbAnglesHoule_=(int)Double.parseDouble(_file.sval);
+ // Direction min.
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angleHouleMin_=Double.parseDouble(_file.sval);
+ // Direction max.
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angleHouleMax_=Double.parseDouble(_file.sval);
+ // Hauteur significative
+ if (_file.nextToken()!=WORD) throw new IOException();
+ hauteurHoule_=Double.parseDouble(_file.sval);
+ // Periode de pic
+ if (_file.nextToken()!=WORD) throw new IOException();
+ periodeHoule_=Double.parseDouble(_file.sval);
+ // Rehaussement du pic
+ if (_file.nextToken()!=WORD) throw new IOException();
+ rehaussementPic_=Double.parseDouble(_file.sval);
+ // Direction principale
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angleHoule_=Double.parseDouble(_file.sval);
+ // Répartition angulaire
+ if (_file.nextToken()!=WORD) throw new IOException();
+ repartitionAngle_=Double.parseDouble(_file.sval);
+ }
+
+ // Paramètres de déferlement
+
+ if (_file.nextToken()!=WORD || !_file.sval.equals("deferlement"))
+ throw new IOException();
+
+ // Cas de déferlement
+ if (_file.nextToken()!=WORD) throw new IOException();
+ if (_file.sval.equals("sans")) deferlement_=DEFER_SANS;
+ else if (_file.sval.equals("iteratif")) deferlement_=DEFER_ITERATIF;
+ else if (_file.sval.equals("ecretage")) deferlement_=DEFER_ECRETAGE;
+ else throw new IOException();
+
+ // Formule pour l'ecretage
+ if (deferlement_==DEFER_ECRETAGE) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ if (_file.sval.equals("goda_sans")) formule_=FORMULE_GODA_SANS_PENTE;
+ else if (_file.sval.equals("goda_avec")) formule_=FORMULE_GODA_AVEC_PENTE;
+ else if (_file.sval.equals("miche")) formule_=FORMULE_MICHE_MODIFIEE;
+ else if (_file.sval.equals("munk")) formule_=FORMULE_MUNK;
+ else throw new IOException();
+ }
+
+ // Angles d'incidence sur les frontières
+
+ aiss=new Vector();
+ while (_file.nextToken()!=WORD || !_file.sval.equals("<fin>")) {
+
+ // Pour chaque contour
+ ais=new Vector();
+
+ while (_file.ttype!=WORD || !_file.sval.equals("<fin>")) {
+ if (_file.ttype==EOF) throw new IOException();
+
+ // Abscisse de début de segment
+ if (_file.ttype!=WORD) throw new IOException();
+ sDeb=Double.parseDouble(_file.sval);
+
+ // Abscisse de fin du segment
+ if (_file.nextToken()!=WORD) throw new IOException();
+ sFin=Double.parseDouble(_file.sval);
+
+ // Type de l'angle
+ if (_file.nextToken()!=WORD) throw new IOException();
+
+ // Absolu => Angle absolu
+ if (_file.sval.equals("absolu")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai=new RefondeAngle();
+ ai.setAbsolu(sDeb,sFin,angle);
+ }
+
+ // Relatif => Angle par rapport a la normale sur le bord
+ else if (_file.sval.equals("relatif")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai=new RefondeAngle();
+ ai.setRelatif(sDeb,sFin,angle);
+ }
+
+ // Diffracté => Position x, y du point de diffraction
+ else if (_file.sval.equals("diffracte")) {
+ ptDiff=new GrPoint();
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ptDiff.x=Double.parseDouble(_file.sval);
+ if (_file.nextToken()!=WORD) throw new IOException();
+ ptDiff.y=Double.parseDouble(_file.sval);
+ ptDiff.z=0.;
+
+ ai=new RefondeAngle();
+ ai.setDiffracte(sDeb,sFin,ptDiff);
+ }
+
+ else throw new IOException();
+
// Angle supplémentaire associé.
***************
*** 1113,1117 ****
* Lecture des informations sur version courante
*/
! private void lire512(RefondeProjet _projet, StreamTokenizer _file)
throws RefondeIOException, IOException {
double val=0;
--- 1475,1479 ----
* Lecture des informations sur version courante
*/
! private void lire(RefondeProjet _projet, StreamTokenizer _file)
throws RefondeIOException, IOException {
double val=0;
***************
*** 1148,1161 ****
hauteurMer_=Double.parseDouble(_file.sval);
- // Profondeur d'origine (inutilisée à partir de version 5.12. A supprimer).
- if (_file.nextToken()!=WORD) throw new IOException();
- // profondeurOrigine_=Double.parseDouble(_file.sval);
- double dummy=Double.parseDouble(_file.sval);
-
// Cas de bord ouvert
if (_file.nextToken()!=WORD) throw new IOException();
! if (_file.sval.equals("cond_absorbante")) casBordOuvert_=0;
! else if (_file.sval.equals("fa_ile")) casBordOuvert_=1;
! else if (_file.sval.equals("fa_port")) casBordOuvert_=2;
else throw new IOException();
--- 1510,1519 ----
hauteurMer_=Double.parseDouble(_file.sval);
// Cas de bord ouvert
if (_file.nextToken()!=WORD) throw new IOException();
! if (_file.sval.equals("cond_abs_ordre1")) casBordOuvert_=BORD_COND_ORDRE_1;
! else if (_file.sval.equals("cond_abs_ordre2")) casBordOuvert_=BORD_COND_ORDRE_2;
! else if (_file.sval.equals("fa_ile")) casBordOuvert_=BORD_FORM_ANA_ILE;
! else if (_file.sval.equals("fa_port")) casBordOuvert_=BORD_FORM_ANA_PORT;
else throw new IOException();
***************
*** 1164,1167 ****
--- 1522,1531 ----
ordreMax_=(int)Double.parseDouble(_file.sval);
+ // Fonds poreux
+ if (_file.nextToken()!=WORD) throw new IOException();
+ if (_file.sval.equals("poreux")) fondsPoreux_=true;
+ else if (_file.sval.equals("non_poreux")) fondsPoreux_=false;
+ else throw new IOException();
+
// Paramètres de houle
***************
*** 1304,1307 ****
--- 1668,1694 ----
else throw new IOException();
+ // Angle supplémentaire associé.
+
+ // Type de l'angle supplémentaire
+ if (_file.nextToken()!=WORD) throw new IOException();
+
+ // Absolu => Angle absolu
+ if (_file.sval.equals("absolu")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai.setSupAbsolu(angle);
+ }
+
+ // Relatif => Angle par rapport a la normale sur le bord
+ else if (_file.sval.equals("relatif")) {
+ if (_file.nextToken()!=WORD) throw new IOException();
+ angle=Double.parseDouble(_file.sval);
+
+ ai.setSupRelatif(angle);
+ }
+
+ else throw new IOException();
+
_file.nextToken();
ais.add(ai);
***************
*** 1492,1506 ****
// Profondeur d'origine (inutilisé, à supprimer du format).
// file.print(profondeurOrigine_+" ; ");
! file.print("0 ; ");
// Cas de bord ouvert
switch (casBordOuvert_) {
! case 0: file.print("cond_absorbante ; "); break;
! case 1: file.print("fa_ile ; ") ; break;
! case 2: file.print("fa_port ; "); ; break;
}
// Ordre max de troncature
! file.print(ordreMax_);
file.println();
--- 1879,1897 ----
// Profondeur d'origine (inutilisé, à supprimer du format).
// file.print(profondeurOrigine_+" ; ");
! // file.print("0 ; ");
// Cas de bord ouvert
switch (casBordOuvert_) {
! case BORD_COND_ORDRE_1: file.print("cond_abs_ordre1 ; "); break;
! case BORD_COND_ORDRE_2: file.print("cond_abs_ordre2 ; "); break;
! case BORD_FORM_ANA_ILE: file.print("fa_ile ; ") ; break;
! case BORD_FORM_ANA_PORT: file.print("fa_port ; ") ; break;
}
// Ordre max de troncature
! file.print(ordreMax_+" ; ");
!
! // Fonds poreux
! file.print(fondsPoreux_ ? "poreux":"non_poreux");
file.println();
|