From bd53550e509e8d13dfdcab014d96bf5f3a3ea6fb Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Thu, 13 Jun 2019 14:25:52 +0200
Subject: [PATCH] ParallelStructures: new method for array of admissible
 LoiDebit

---
 src/pab/pab.ts                      |  4 ++--
 src/structure/parallel_structure.ts | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/pab/pab.ts b/src/pab/pab.ts
index cc384f64..3c693009 100644
--- a/src/pab/pab.ts
+++ b/src/pab/pab.ts
@@ -38,9 +38,9 @@ export class Pab extends Nub {
 
     public Calc(sVarCalc?: string, rInit?: number): Result  {
         // Update array of PabCloisons with last Models current values
-        for (const cl of this.children) {
+        /* for (const cl of this.children) {
             cl.prms.setCurrentValuesFromModel();
-        }
+        } */
         return super.Calc(sVarCalc, rInit);
     }
 
diff --git a/src/structure/parallel_structure.ts b/src/structure/parallel_structure.ts
index bd8ebfd4..0b13bd51 100644
--- a/src/structure/parallel_structure.ts
+++ b/src/structure/parallel_structure.ts
@@ -34,10 +34,22 @@ export class ParallelStructure extends Nub {
         return this._prms as ParallelStructureParams;
     }
 
+    /** Returns admissible LoiDebit grouped by StructureType */
     public getLoisAdmissibles(): { [key: string]: LoiDebit[]; } {
         return loiAdmissiblesOuvrages;
     }
 
+    /** Returns a flat array of all admissible LoiDebit */
+    public getLoisAdmissiblesArray(): LoiDebit[] {
+        let loisAdm: LoiDebit[] = [];
+        const lois = this.getLoisAdmissibles();
+        // tslint:disable-next-line:forin
+        for (const k in lois) {
+            loisAdm = loisAdm.concat(lois[k]);
+        }
+        return loisAdm;
+    }
+
     /** Returns the 1st deep item from LoisAdmissibles */
     public getDefaultLoiDebit(): LoiDebit {
         const lois = this.getLoisAdmissibles();
-- 
GitLab