private void InitializeDetailedM11() { mike11Observations = new List <DetailedMike11>(); DFS0 simdata = new DFS0(mshe.Files.DetailedTimeSeriesM11); Dictionary <string, DFS0> ObsCache = new Dictionary <string, DFS0>(); foreach (var obs in mshe.Input.MIKESHE_FLOWMODEL.StoringOfResults.DetailedM11TimeseriesOutput.Item_1s) { var m = new DetailedMike11() { Chainage = obs.Chainage, Name = obs.Name }; m.Branch = mshe.River.network.GetBranch(obs.BranchName, obs.Chainage); if (m.Branch != null) { m.Location = m.Branch.GetPointAtChainage(obs.Chainage); var item = simdata.Items.FirstOrDefault(i => i.Name == m.Name); if (item != null) { m.Simulation = simdata.GetTimeSpanSeries(item.ItemNumber); } if (obs.InclObserved == 1) { DFS0 obsdata; if (!ObsCache.TryGetValue(obs.TIME_SERIES_FILE.FILE_NAME, out obsdata)) { obsdata = new DFS0(obs.TIME_SERIES_FILE.FILE_NAME); ObsCache.Add(obs.TIME_SERIES_FILE.FILE_NAME, obsdata); } m.Observation = obsdata.GetTimeSpanSeries(obs.TIME_SERIES_FILE.ITEM_NUMBERS); } mike11Observations.Add(m); } } simdata.Dispose(); foreach (var obsdata in ObsCache.Values) { obsdata.Dispose(); } }
private void InitializeDetailedM11() { mike11Observations = new List<DetailedMike11>(); DFS0 simdata = new DFS0(mshe.Files.DetailedTimeSeriesM11); Dictionary<string, DFS0> ObsCache= new Dictionary<string,DFS0>(); foreach (var obs in mshe.Input.MIKESHE_FLOWMODEL.StoringOfResults.DetailedM11TimeseriesOutput.Item_1s) { var m = new DetailedMike11() { Chainage = obs.Chainage, Name = obs.Name }; m.Branch = mshe.River.network.GetBranch(obs.BranchName, obs.Chainage); if (m.Branch != null) { m.Location = m.Branch.GetPointAtChainage(obs.Chainage); var item = simdata.Items.FirstOrDefault(i => i.Name == m.Name); if (item != null) m.Simulation = simdata.GetTimeSpanSeries(item.ItemNumber); if (obs.InclObserved == 1) { DFS0 obsdata; if (!ObsCache.TryGetValue(obs.TIME_SERIES_FILE.FILE_NAME, out obsdata)) { obsdata = new DFS0(obs.TIME_SERIES_FILE.FILE_NAME); ObsCache.Add(obs.TIME_SERIES_FILE.FILE_NAME, obsdata); } m.Observation = obsdata.GetTimeSpanSeries(obs.TIME_SERIES_FILE.ITEM_NUMBERS); } mike11Observations.Add(m); } } simdata.Dispose(); foreach (var obsdata in ObsCache.Values) obsdata.Dispose(); }