public static BarDifferentialTemperatureLoad BarDifferentialTemperatureLoad(Loadcase loadcase, List <double> positions, List <double> temperatures, DifferentialTemperatureLoadDirection localLoadDirection, IEnumerable <Bar> objects, string name = "")
        {
            if (loadcase.IsNull() || positions.IsNullOrEmpty() || temperatures.IsNullOrEmpty())
            {
                return(null);
            }

            //Checks for positions and profiles
            if (positions.Count != temperatures.Count)
            {
                Reflection.Compute.RecordError("Number of positions and temperatures provided are not equal");
                return(null);
            }
            else if (positions.Exists((double d) => { return(d > 1); }) || positions.Exists((double d) => { return(d < 0); }))
            {
                Reflection.Compute.RecordError("Positions must exist between 0 and 1 (inclusive)");
                return(null);
            }

            // Check that top and bottom positions are included
            if (!(positions.Contains(0) && positions.Contains(1)))
            {
                Reflection.Compute.RecordError("Positions must inlude the bottom (0) and top (1) position.");
                return(null);
            }

            if (positions.Zip(positions.Skip(1), (a, b) => new { a, b }).Any(p => p.a > p.b))
            {
                Reflection.Compute.RecordError("Positions must be sorted in ascending order.");
                return(null);
            }

            //Create ditionary for TaperedProfile
            Dictionary <Double, Double> temperatureProfile = positions.Zip(temperatures, (z, t) => new { z, t })
                                                             .ToDictionary(x => x.z, x => x.t);

            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

            if (objects == null)
            {
                group = null;
            }
            else
            {
                group.Elements = objects.ToList();
            }

            return(new BarDifferentialTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureProfile = temperatureProfile,
                LoadDirection = localLoadDirection,
                Objects = group,
                Name = name
            });
        }
 public static BarDifferentialTemperatureLoad BarDifferentialTemperatureLoad(Loadcase loadcase, double topTemperature, double bottomTemperature, DifferentialTemperatureLoadDirection localLoadDirection, IEnumerable <Bar> objects, string name = "")
 {
     return(BarDifferentialTemperatureLoad(loadcase, new List <double>()
     {
         0, 1
     }, new List <double>()
     {
         topTemperature, bottomTemperature
     }, localLoadDirection, objects, name));
 }