/// <inheritdoc/> public AreaValues GetAreaValues() { var alpha = new AreaValues(); foreach (var p in pathways) { if (p.Type == PathwayType.Ac1) { alpha.Ac1 = p.CO2Rate; } else if (p.Type == PathwayType.Ac2) { alpha.Ac2 = p.CO2Rate; } else { alpha.Aj = p.CO2Rate; } } alpha.A = CO2AssimilationRate; alpha.E = WaterUse; return(alpha); }
/// <inheritdoc/> public AreaValues GetAreaValues() { // Casting to an array to ensure we don't change pathways outside of this method var temp = pathways.ToArray().OrderBy(p => p.CO2Rate).First().Temperature; var ac1 = pathways.FirstOrDefault(p => p.Type == PathwayType.Ac1).GetPathValues(); var ac2 = pathways.FirstOrDefault(p => p.Type == PathwayType.Ac2) is AssimilationPathway path?path.GetPathValues() : new PathValues(); var aj = pathways.FirstOrDefault(p => p.Type == PathwayType.Aj).GetPathValues(); var values = new AreaValues() { A = CO2AssimilationRate, Water = WaterUse, Temperature = temp, Ac1 = ac1, Ac2 = ac2, Aj = aj }; return(values); }