|
From: <bma...@us...> - 2013-06-10 08:40:43
|
Revision: 8418
http://sourceforge.net/p/fudaa/svn/8418
Author: bmarchan
Date: 2013-06-10 08:40:40 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/soft/fudaa-mascaret/server/src/main/java/org/fudaa/dodico/hydraulique1d/conv/ConvMasc_H1D.java
trunk/soft/fudaa-mascaret/ui/src/main/java/org/fudaa/fudaa/hydraulique1d/Hydraulique1dImport.java
Modified: trunk/soft/fudaa-mascaret/server/src/main/java/org/fudaa/dodico/hydraulique1d/conv/ConvMasc_H1D.java
===================================================================
--- trunk/soft/fudaa-mascaret/server/src/main/java/org/fudaa/dodico/hydraulique1d/conv/ConvMasc_H1D.java 2013-06-07 15:44:33 UTC (rev 8417)
+++ trunk/soft/fudaa-mascaret/server/src/main/java/org/fudaa/dodico/hydraulique1d/conv/ConvMasc_H1D.java 2013-06-10 08:40:40 UTC (rev 8418)
@@ -1346,6 +1346,7 @@
MetierLoiHydraulique[] objLois = new MetierLoiHydraulique[_params.nb - nbLoiSup];
boolean btitle=false;
+ NEXT_LOI:
for (int i = 0; i < objLois.length; i++) {
// Transformation des donn\xE9es temps suivant l'unit\xE9 de temps
@@ -1444,6 +1445,17 @@
for (int j=0; j<_params.lois[i].donnees.cote2.length; j++) {
int idebit=ldebit.indexOf(_params.lois[i].donnees.debit[j]);
int izaval=lzaval.indexOf(_params.lois[i].donnees.cote[j]);
+ if (idebit==-1 || izaval==-1) {
+ if (!btitle) {
+ btitle=true;
+ sbufRecup_.append("<br><b>").append(getS("Lecture des lois")).append("</b> :");
+ }
+ sbufRecup_.append("<br>").append(getS("Loi '")).append(_params.lois[i].nom).append("' de type 6").append(":\n");
+ sbufRecup_.append(getS("Le nombre de cote amont doit \xEAtre \xE9gale au produit")+"\n");
+ sbufRecup_.append(getS("du nombre de d\xE9bits diff\xE9rents avec le nombre de cotes avals diff\xE9rentes")+"\n");
+
+ continue NEXT_LOI;
+ }
zamont[idebit][izaval]=_params.lois[i].donnees.cote2[j];
}
Modified: trunk/soft/fudaa-mascaret/ui/src/main/java/org/fudaa/fudaa/hydraulique1d/Hydraulique1dImport.java
===================================================================
--- trunk/soft/fudaa-mascaret/ui/src/main/java/org/fudaa/fudaa/hydraulique1d/Hydraulique1dImport.java 2013-06-07 15:44:33 UTC (rev 8417)
+++ trunk/soft/fudaa-mascaret/ui/src/main/java/org/fudaa/fudaa/hydraulique1d/Hydraulique1dImport.java 2013-06-10 08:40:40 UTC (rev 8418)
@@ -34,6 +34,7 @@
import org.fudaa.dodico.corba.lido.SParametresPRO;
import org.fudaa.dodico.corba.mascaret.SParametresCAS;
import org.fudaa.dodico.corba.mascaret.SParametresGEO;
+import org.fudaa.dodico.corba.mascaret.SParametresLoi;
import org.fudaa.dodico.hydraulique1d.metier.EnumMetierMethodeMaillage;
import org.fudaa.dodico.hydraulique1d.metier.MetierBief;
import org.fudaa.dodico.hydraulique1d.metier.MetierDefinitionSectionsParSections;
@@ -70,6 +71,7 @@
import com.memoire.fu.FuLog;
import org.fudaa.ctulu.CtuluDefaultLogFormatter;
import org.fudaa.ctulu.CtuluIOResult;
+import org.fudaa.ctulu.CtuluLibArray;
import org.fudaa.dodico.mascaret.EdamoxXMLContent;
/**
@@ -289,7 +291,7 @@
}
return imports;
}
-
+
public static double[][] importTableauLoiHydraulique(
File filename,
MetierLoiHydraulique loi) {
@@ -297,7 +299,16 @@
if ("SEUIL".equals(loi.typeLoi())) {
imports = Hydraulique1dImport.importLoiSeuil(filename);
} else {
- imports = Hydraulique1dImport.importLoi2_3Vec(filename);
+ StringBuilder sb=new StringBuilder();
+ sb.append(getS("R\xE9sultat de l'importation de ")).append(filename.getPath()).append(":\n\n");
+ try {
+ imports = Hydraulique1dImport.importLoi(filename);
+ sb.append("OK\n");
+ }
+ catch (IOException _exc) {
+ sb.append(_exc.getMessage());
+ }
+ showMessage(sb.toString());
}
return imports;
}
@@ -388,12 +399,12 @@
return nouveauTableau;
}
- public static double[][] importLoi2_3Vec(File filename) {
+ public static double[][] importLoi(File filename) throws IOException {
double[][] nouveauTableau = null;
- Vector lignesTableau = new Vector();
- Vector ligneTableau;
- String logMsg =
- getS("R\xE9sultat de l'importation de ") + filename.getPath() + ":\n\n";
+ Vector<Vector<Double>> lignesTableau = new Vector<Vector<Double>>();
+ Vector<Double> ligneTableau;
+// String logMsg =
+// getS("R\xE9sultat de l'importation de ") + filename.getPath() + ":\n\n";
int lineNb = 0;
int motNb = 0;
String line = null;
@@ -408,7 +419,7 @@
continue; // ligne suivante
}
StringTokenizer st = new StringTokenizer(line);
- ligneTableau = new Vector();
+ ligneTableau = new Vector<Double>();
motNb = 0;
while (st.hasMoreTokens()) { // \"
String mot = st.nextToken();
@@ -435,35 +446,28 @@
} // fin while( (line=fic.readLine())!=null )
fic.close();
System.err.println("OK");
- logMsg += "OK\n";
+// logMsg += "OK\n";
} catch (NumberFormatException e) {
- my_perror(
- getS("format d'un champ incorrecte dans la ligne numero ")
- + lineNb
- + " '"
- + line
- + "' champ numero "
- + motNb);
- logMsg += getS("format d'un champ incorrecte dans la ligne numero ")
- + lineNb
- + " '"
- + line
- + "' champ numero "
- + motNb
- + "\n";
- } catch (IOException e) {
- my_perror(e);
+ String s=getS("format d'un champ incorrecte dans la ligne numero ")
+ + lineNb
+ + " '"
+ + line
+ + "' champ numero "
+ + motNb;
+ my_perror(s);
+ throw new IOException(s);
+// } catch (IOException e) {
+// my_perror(e);
}
- showMessage(logMsg);
+// showMessage(logMsg);
int nbLignes = lignesTableau.size();
if (nbLignes > 0) {
- int nbColonnes = ((Vector) lignesTableau.get(0)).size();
+ int nbColonnes = lignesTableau.get(0).size();
nouveauTableau =
new double[nbLignes][nbColonnes];
for (int i = 0; i < nbLignes; i++) {
for (int j = 0; j < nbColonnes; j++) {
- nouveauTableau[i][j] =
- ((Double) ((Vector) lignesTableau.get(i)).get(j)).doubleValue();
+ nouveauTableau[i][j] = lignesTableau.get(i).get(j).doubleValue();
if ((uniteTemps != null) && (j == 0)) {
if (uniteTemps.equals("M")) {
nouveauTableau[i][j] = nouveauTableau[i][j] * 60;
@@ -2392,10 +2396,69 @@
SParametresGEO pargeo = DParametresMascaret.litParametresGEO(geo);
MetierBief[] biefsGeo = ConvMasc_H1D.convertirGEO(pargeo);
+ // Lecture des lois sur fichiers
+ StringBuffer sbLoi=new StringBuffer();
+ SParametresLoi[] lois=params.parametresLoisHydrau.lois;
+ for (int i=0; i<lois.length; i++) {
+ if (lois[i].donnees.modeEntree == 1) {
+ try {
+ double[][] vals = importLoi(new File(lois[i].donnees.fichier));
+ vals = CtuluLibArray.transpose(vals);
+
+ lois[i].donnees.modeEntree=2;
+ lois[i].donnees.uniteTps=1;
+ lois[i].donnees.nbPoints=vals[0].length;
+
+ switch (lois[i].type) {
+ case 1: // 1->"HYDROGRAMME Q(T)"
+ lois[i].donnees.tps = vals[0];
+ lois[i].donnees.debit = vals[1];
+ break;
+
+ case 2: // 2->"LIMNIGRAMME Z(T)"
+ lois[i].donnees.tps = vals[0];
+ lois[i].donnees.cote = vals[1];
+ break;
+
+ case 3: // 3->"LIMNHYDROGRAMME Z,Q(T)"
+ lois[i].donnees.tps = vals[0];
+ lois[i].donnees.cote = vals[1];
+ lois[i].donnees.debit = vals[2];
+ break;
+
+ case 4: // 4->"COURBE DE TARAGE Z=f(Q)"
+ lois[i].donnees.debit = vals[0];
+ lois[i].donnees.cote = vals[1];
+ break;
+
+ case 5: // 5->"COURBE DE TARAGE Q=f(Z)"
+ lois[i].donnees.cote = vals[0];
+ lois[i].donnees.debit = vals[1];
+ break;
+
+ case 6: // 6->"SEUIL Zam=f(Zav,Q)
+ lois[i].donnees.debit = vals[0];
+ lois[i].donnees.cote = vals[1];
+ lois[i].donnees.cote2 = vals[2];
+ break;
+
+ case 7: // 7->"OUVERTURE VANNE Zinf,Zsup=f(T)
+ lois[i].donnees.tps = vals[0];
+ lois[i].donnees.cote = vals[1];
+ lois[i].donnees.cote2 = vals[2];
+ break;
+ }
+ }
+ catch (IOException exc) {
+ sbLoi.append(exc.getMessage()).append("<br>");
+ }
+ }
+ }
+
// transfert Mascaret -> Hydraulique1d
StringBuffer sb = ConvMasc_H1D.convertirCas(params, etude, biefsGeo);
if (sb.length() != 0) {
- showMessage("<HTML><body><b>" + getS("RESULTAT DE L'IMPORT") + "</b>:<br><br>" + sb.toString());
+ showMessage("<HTML><body><b>" + getS("RESULTAT DE L'IMPORT") + "</b>:<br><br>" + sbLoi.toString()+sb.toString());
}
} // Pb de lecture geo
catch (FichierMascaretException ex) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|