Skip to content

Commit

Permalink
up tests & according info
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrichet committed Oct 13, 2021
1 parent 76956f7 commit e7deb35
Show file tree
Hide file tree
Showing 165 changed files with 13,323 additions and 722 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/funz/Telemac/TelemacCPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ protected int runCommand() throws Exception {

if (TelemacHelper.writeCSVfromCASRES(cas, pois)) {
File resfile = new File(cas.getAbsoluteFile().getParentFile(), TelemacHelper.readFichiersDe(cas, "RESULT")[0]);
System.err.println("Could extract CSV, will delete results file: "+resfile+ " (exists: "+resfile.isFile()+")");
if (resfile.isFile()) {
FileUtils.forceDelete(resfile);
if (resfile.getName().endsWith(".res")) {
System.err.println("Could extract CSV, will delete results file: "+resfile+ " (exists: "+resfile.isFile()+")");
if (resfile.isFile()) {
FileUtils.forceDelete(resfile);
}
}
} else System.err.println("Could not extract CSV, keep results file");

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/funz/Telemac/TelemacHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,21 @@ static double[][] readDoubleArray2D(String s) {
}
return d;
}

static Object simplify(double[][] a) {
if (a==null) return null;
if (a.length==1) {
return a[0];
} else if (a.length>1 && a[0]!=null && a[0].length==1) {
double[] a0 = new double[a.length];
for (int i =0; i < a.length; i++) {
if (a[i].length>0)
a0[i] = a[i][0];
else
a0[i] = Double.NaN;
}
return a0;
} else
return a;
}
}
12 changes: 9 additions & 3 deletions src/main/java/org/funz/Telemac/TelemacIOPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.commons.io.FileUtils;
import static org.funz.Telemac.TelemacHelper.CommentLine;
import static org.funz.Telemac.TelemacHelper.readDoubleArray2D;
import static org.funz.Telemac.TelemacHelper.simplify;
import static org.funz.Telemac.TelemacHelper.readVarsSortiesGraphiques;
import org.funz.ioplugin.*;
import org.funz.parameter.OutputFunctionExpression;
Expand Down Expand Up @@ -122,7 +123,7 @@ public boolean accept(File pathname) {
});

if (csvfiles == null || csvfiles.length == 0) {
lout.put("warning","Could not find csv files, so reading results from .res.");
lout.put("warning","Could not find csv files, so reading results from results slf.");
File cas = null;
Properties pois = new Properties();
try {
Expand Down Expand Up @@ -167,8 +168,7 @@ public boolean accept(File pathname) {
e.printStackTrace(pw);
lout.put("error","Could not read coord "+pois+" in results of cas "+cas.getName()+" : "+sw.toString());
}
}

} else {
for (File f : csvfiles) {
try {
lout.put(f.getName().substring(0, f.getName().indexOf(".csv")), readDoubleArray2D(FileUtils.readFileToString(f)));
Expand All @@ -179,6 +179,12 @@ public boolean accept(File pathname) {
lout.put("error","Could not read csv file "+f.getName()+" : "+sw.toString());
}
}
}

for (String k:lout.keySet()) { // simplify if possible to 1D arrays
if (lout.get(k) instanceof double[][])
lout.put(k,simplify((double[][])lout.get(k)));
}

return lout;
}
Expand Down
50 changes: 50 additions & 0 deletions src/test/cases/t2d_breach.cas/cases.xml

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions src/test/cases/t2d_breach.cas/history.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# all-in-one
[17:00:25] Instanciating files
[17:00:25] Instanciated files[/home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/t2d_breach_slf.cas, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/t2d_breach.poi, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/r2d_breach.slf_md5, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/geo_breach.cli, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/t2d_breach.liq, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/geo_breach.slf_md5, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/ini_breach.slf_md5, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/breach.txt]
[17:00:25] Searching in cache: [[/home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/old]]
[17:00:25] Cache not found.
[17:00:25] Searching client ...
[17:00:25] Got provider...
[17:00:25] Got client from provider...
[17:00:25] reserved client ip=127.0.0.1 sc=1634136797098
[17:00:25] Has a client: org.funz.api.BatchRun_v1$NewClientProvider$1@57712bf9
[17:00:25] Trying to reserve client org.funz.api.BatchRun_v1$NewClientProvider$1@57712bf9
[17:00:25] Using client localhost:34943
[17:00:26] Sent files [/home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/t2d_breach_slf.cas, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/t2d_breach.poi, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/r2d_breach.slf_md5, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/geo_breach.cli, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/t2d_breach.liq, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/geo_breach.slf_md5, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/ini_breach.slf_md5, /home/richet/.Funz/projects/t2d_breach_slf.cas_20211013-170019/spool/input/breach.txt]
[17:00:26] Executing Telemac
[17:00:28] info: ftp://127.0.0.1:2137 null
[17:00:28] info: ftp://127.0.0.1:2137 null saved.
[17:00:30] Execution done.
[17:00:31] Remote archiving done.
[17:00:31] Transfer done.
[17:00:31] /null_xymediumright.csv
[17:00:31] /H_xymediumcenter.csv
[17:00:31] /B_XY.csv
[17:00:31] /U_xymediumcenter.csv
[17:00:31] /S_xylowerright.csv
[17:00:31] /U_xymediumright.csv
[17:00:31] /t2d_breach_slf.cas
[17:00:31] /B_xylowerright.csv
[17:00:31] /H_XY.csv
[17:00:31] /geo_breach.slf
[17:00:31] /W_XY.csv
[17:00:31] /H_xylowerright.csv
[17:00:31] /U_XY.csv
[17:00:31] /geo_breach.cli
[17:00:31] /H_xylowercenter.csv
[17:00:31] /B_xylowercenter.csv
[17:00:31] /S_XY.csv
[17:00:31] /L_xylowercenter.csv
[17:00:31] /r2d_breach.slf
[17:00:31] /log.txt
[17:00:31] /V_xylowercenter.csv
[17:00:31] /T.csv
[17:00:31] /W_xymediumright.csv
[17:00:31] /S_xylowercenter.csv
[17:00:31] /B_xymediumcenter.csv
[17:00:31] /ini_breach.slf
[17:00:31] /W_xylowercenter.csv
[17:00:31] /L_xylowerright.csv
[17:00:31] /breach.txt
[17:00:31] /null_xymediumcenter.csv
[17:00:31] /V_xymediumright.csv
[17:00:31] /H_xymediumright.csv
[17:00:31] /S_xymediumcenter.csv
[17:00:31] /S_xymediumright.csv
[17:00:31] /L_XY.csv
[17:00:31] /W_xymediumcenter.csv
[17:00:31] /V_XY.csv
[17:00:31] /t2d_breach.poi
[17:00:31] /U_xylowerright.csv
[17:00:31] /L_xymediumright.csv
[17:00:31] /L_xymediumcenter.csv
[17:00:31] /out.txt
[17:00:31] /null_XY.csv
[17:00:31] /t2d_breach.liq
[17:00:31] /V_xymediumcenter.csv
[17:00:31] /xy_XY.csv
[17:00:31] /null_xylowerright.csv
[17:00:31] /null_xylowercenter.csv
[17:00:31] /err.txt
[17:00:31] /B_xymediumright.csv
[17:00:31] /U_xylowercenter.csv
[17:00:31] /V_xylowerright.csv
[17:00:31] /W_xylowerright.csv
[17:00:31] Local unzip done.
[17:00:31] Parsing results.
[17:00:31] Results parsed: {V_xymediumcenter=[D@508682b2, B_XY=[[D@4cb99614, W_XY=[[D@3479794c, null_XY=[[D@7faf57dc, U_XY=[[D@1b58d989, null_xylowerright=[D@1b51e5c0, L_xylowercenter=[D@641d4cff, L_xymediumright=[D@6109f617, B_xymediumcenter=[D@3c40ef2e, S_XY=[[D@28ab7283, B_xymediumright=[D@26dfa9dd, B_xylowercenter=[D@8c84a5f, B_xylowerright=[D@33caedf7, S_xymediumright=[D@4006be67, S_xylowercenter=[D@1bcc76fb, path=, null_xymediumright=[D@511c4d6f, T=[D@35dda7ee, H_xylowerright=[D@40ddc2b4, V_xylowercenter=[D@385e1ffa, W_xymediumcenter=[D@b1a4aab, U_xymediumright=[D@53a06ef1, W_xymediumright=[D@7dc6de53, V_XY=[[D@352fbfde, W_xylowerright=[D@6c39e4c2, [T]=[D@35dda7ee, H_xylowercenter=[D@3c3ed852, S_xylowerright=[D@7741bdc0, H_xymediumright=[D@3fd83db9, S_xymediumcenter=[D@1c64c174, null_xymediumcenter=[D@56d276e2, xy_XY=[[D@2c876e45, U_xylowerright=[D@52ccbb99, V_xylowerright=[D@6899afd5, L_xylowerright=[D@2d39b142, null_xylowercenter=[D@3a5b07e6, U_xylowercenter=[D@dfc7347, U_xymediumcenter=[D@283e922a, L_XY=[[D@486d85ce, H_xymediumcenter=[D@2a6bcf12, W_xylowercenter=[D@44e3f753, H_XY=[[D@18909227, V_xymediumright=[D@3c77370e, L_xymediumcenter=[D@48907ccd}
88 changes: 44 additions & 44 deletions src/test/cases/t2d_breach.cas/info.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/test/cases/t2d_breach.cas/input/r2d_breach.slf_md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
?o\:����R���Ww
2 changes: 1 addition & 1 deletion src/test/cases/t2d_breach.cas/input/t2d_breach.cas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/ ENTREES-SORTIES, FICHIERS
/---------------------------------------------------------------------
/
RESULTS FILE ='r2d_breach.slf'
RESULTS FILE ='r2d_breach.res'
/
BOUNDARY CONDITIONS FILE ='geo_breach.cli'
/
Expand Down
Loading

0 comments on commit e7deb35

Please sign in to comment.