Commit e98ef245 authored by Grand Francois's avatar Grand Francois
Browse files

fix: parallel structures: remove results in case of submergence error

refs #302
Showing with 50 additions and 1 deletion
+50 -1
...@@ -82,6 +82,12 @@ export class ParallelStructure extends Nub { ...@@ -82,6 +82,12 @@ export class ParallelStructure extends Nub {
this.result.globalLog.addLog(st.result.log); this.result.globalLog.addLog(st.result.log);
} }
// si une erreur d'ennoiement est survenue dans les structures, on annule les résultats
if (res.hasMessage(MessageCode.ERROR_STRUCTURE_SUBMERGENCE_LOWER_THAN, true)) {
res.removeValues();
}
return res; return res;
} }
......
import { JalhydObject } from "../internal_modules"; import { JalhydObject, MessageCode } from "../internal_modules";
import { Nub } from "../internal_modules"; import { Nub } from "../internal_modules";
import { cLog } from "../internal_modules"; import { cLog } from "../internal_modules";
import { Message, MessageSeverity } from "../internal_modules"; import { Message, MessageSeverity } from "../internal_modules";
...@@ -272,6 +272,33 @@ export class Result extends JalhydObject { ...@@ -272,6 +272,33 @@ export class Result extends JalhydObject {
return true; return true;
} }
/**
* determine if a message is present in result
* @param code message code to find
* @param recurs if true, search into nub children
*/
public hasMessage(code: MessageCode, recurs: boolean = false): boolean {
if (this._globalLog.contains(code)) {
return true;
}
for (const r of this._resultElements) {
if (r.log.contains(code)) {
return true;
}
}
if (recurs && this._sourceNub !== undefined) {
for (const n of this._sourceNub.getChildren()) {
if (n.result.hasMessage(code, true)) {
return true;
}
}
}
return false;
}
/** /**
* compute log stats (# of error, warning, info) on all result element * compute log stats (# of error, warning, info) on all result element
*/ */
...@@ -330,4 +357,13 @@ export class Result extends JalhydObject { ...@@ -330,4 +357,13 @@ export class Result extends JalhydObject {
re.removeExtraResults(); re.removeExtraResults();
} }
} }
/**
* Removes all values in result elements
*/
public removeValues() {
for (const re of this._resultElements) {
re.removeValues();
}
}
} }
...@@ -192,6 +192,13 @@ export class ResultElement { ...@@ -192,6 +192,13 @@ export class ResultElement {
} }
} }
/**
* Removes all values
*/
public removeValues() {
this._values = {};
}
public toString(): string { public toString(): string {
if (this.vCalc !== undefined) { if (this.vCalc !== undefined) {
return String(this.vCalc); return String(this.vCalc);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment