Exemplo n.º 1
0
        /***************************************************/

        public static LoadAxis LoadAxisToBHoM(this string cSys)
        {
            LoadAxis axis = new LoadAxis();

            switch (cSys)
            {
            case "Global":
                axis = LoadAxis.Global;
                break;

            case "Local":
                axis = LoadAxis.Local;
                break;

            default:
                axis = LoadAxis.Global;
                break;
            }

            return(axis);
        }
Exemplo n.º 2
0
        /***************************************************/

        public static string ToCSI(this LoadAxis axis)
        {
            string cSys = "";

            switch (axis)
            {
            case LoadAxis.Global:
                cSys = "Global";
                break;

            case LoadAxis.Local:
                cSys = "Local";
                break;

            default:
                cSys = "Global";
                break;
            }

            return(cSys);
        }
Exemplo n.º 3
0
        /***************************************************/

        public static PointVelocity PointVelocity(Loadcase loadcase, BHoMGroup <Node> group, Vector translation = null, Vector rotation = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (translation == null && rotation == null)
            {
                throw new ArgumentException("Point velocity requires either the translation or the rotation vector to be defined");
            }

            return(new PointVelocity
            {
                Loadcase = loadcase,
                Objects = group,
                TranslationalVelocity = translation == null ? new Vector() : translation,
                RotationalVelocity = rotation == null ? new Vector() : rotation,
                Axis = axis,
                Name = name
            });
        }
Exemplo n.º 4
0
        /***************************************************/

        public static PointForce PointForce(Loadcase loadcase, BHoMGroup <Node> group, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                throw new ArgumentException("Point force requires either the force or the moment vector to be defined");
            }

            return(new PointForce
            {
                Loadcase = loadcase,
                Objects = group,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Axis = axis,
                Name = name
            });
        }
Exemplo n.º 5
0
        /***************************************************/

        public static BarVaryingDistributedLoad BarVaryingDistributedLoad(Loadcase loadcase, IEnumerable <Bar> objects, double distFromA = 0, Vector forceA = null, Vector momentA = null, double distFromB = 0, Vector forceB = null, Vector momentB = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(BarVaryingDistributedLoad(loadcase, new BHoMGroup <Bar>()
            {
                Elements = objects.ToList()
            }, distFromA, forceA, momentA, distFromB, forceB, momentB, axis, projected, name));
        }
Exemplo n.º 6
0
        /***************************************************/

        public static BarUniformlyDistributedLoad BarUniformlyDistributedLoad(Loadcase loadcase, IEnumerable <Bar> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(BarUniformlyDistributedLoad(loadcase, new BHoMGroup <Bar>()
            {
                Elements = objects.ToList()
            }, force, moment, axis, projected, name));
        }
Exemplo n.º 7
0
        /***************************************************/

        public static BarTemperatureLoad BarTemperatureLoad(Loadcase loadcase, double temperatureChange, IEnumerable <Bar> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(BarTemperatureLoad(loadcase, temperatureChange, new BHoMGroup <Bar>()
            {
                Elements = objects.ToList()
            }, axis, projected, name));
        }
Exemplo n.º 8
0
        /***************************************************/

        public static BarPointLoad BarPointLoad(Loadcase loadcase, double distFromA, IEnumerable <Bar> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            return(BarPointLoad(loadcase, new BHoMGroup <Bar>()
            {
                Elements = objects.ToList()
            }, distFromA, force, moment, axis, name));
        }
Exemplo n.º 9
0
        public static PointVelocity PointVelocity(Loadcase loadcase, IEnumerable <Node> objects, Vector translationalVelocity = null, Vector rotationalVelocity = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            BHoMGroup <Node> group = new BHoMGroup <Node>();

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

            return(PointVelocity(loadcase, group, translationalVelocity, rotationalVelocity, axis, name));
        }
Exemplo n.º 10
0
        public static PointVelocity PointVelocity(Loadcase loadcase, BHoMGroup <Node> group, Vector translationalVelocity = null, Vector rotationalVelocity = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (translationalVelocity == null && rotationalVelocity == null)
            {
                Reflection.Compute.RecordError("PointVelocity requires at least the translation or the rotation vector to be defined");
                return(null);
            }

            return(new PointVelocity
            {
                Loadcase = loadcase,
                Objects = group,
                TranslationalVelocity = translationalVelocity == null ? new Vector() : translationalVelocity,
                RotationalVelocity = rotationalVelocity == null ? new Vector() : rotationalVelocity,
                Axis = axis,
                Name = name
            });
        }
Exemplo n.º 11
0
 public static ContourLoad ContourLoad(Polyline contour, Vector loadVector, Loadcase loadcase, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
 {
     return(new ContourLoad
     {
         Contour = contour,
         Force = loadVector,
         Loadcase = loadcase,
         Axis = axis,
         Projected = projected,
         Name = name
     });
 }
Exemplo n.º 12
0
        public static BarUniformTemperatureLoad BarUniformTemperatureLoad(Loadcase loadcase, double temperatureChange, IEnumerable <Bar> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

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

            return(loadcase.IsNull() ? null : new BarUniformTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureChange = temperatureChange,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }
Exemplo n.º 13
0
        public static BarPointLoad BarPointLoad(Loadcase loadcase, double distFromA, IEnumerable <Bar> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            BHoMGroup <Bar> group = new BHoMGroup <Bar>();

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

            return(BarPointLoad(loadcase, group, distFromA, force, moment, axis, name));
        }
Exemplo n.º 14
0
        public static BarPointLoad BarPointLoad(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                Reflection.Compute.RecordError("BarPointLoad requires at least the force or the moment vector to be defined.");
                return(null);
            }

            return(new BarPointLoad
            {
                Loadcase = loadcase,
                DistanceFromA = distFromA,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Objects = group,
                Axis = axis,
                Name = name
            });
        }
Exemplo n.º 15
0
        private static List <ILoad> DistributedBarLoadsFromSt7(double loadX, double loadY, double loadZ, int distributionType, double barLength, double[] forces, double[] moments, Loadcase ldcase, Bar bar, bool projected, LoadAxis loadAxis)
        {
            List <ILoad> bhLoads = new List <ILoad>();
            double       a;
            double       b;

            if (IsZeroSqLength(forces))
            {
                a = moments[4];
                b = moments[5];
            }
            else
            {
                a = forces[4];
                b = forces[5];
            }
            ILoad bhLoad;
            ILoad bhLoad2;
            ILoad bhLoad3;

            switch (distributionType)
            {
            case St7.dlConstant:
                bhLoad = new BarUniformlyDistributedLoad()
                {
                    Moment    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    Force     = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    Loadcase  = ldcase,
                    Projected = projected,
                    Axis      = loadAxis,
                    Objects   = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad);
                break;

            case St7.dlLinear:
                if (moments[0] == moments[1] && forces[0] == forces[1] && a == 0 && b == 0)
                {
                    bhLoad = new BarUniformlyDistributedLoad()
                    {
                        Moment    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                        Force     = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                        Loadcase  = ldcase,
                        Projected = projected,
                        Axis      = loadAxis,
                        Objects   = new BHoMGroup <Bar>()
                        {
                            Elements = { bar }
                        }
                    };
                }
                else
                {
                    bhLoad = new BarVaryingDistributedLoad()
                    {
                        StartPosition = barLength * a,
                        EndPosition   = barLength * b,
                        MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                        MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[1],
                        ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                        ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[1],
                        Loadcase      = ldcase,
                        Projected     = projected,
                        Axis          = loadAxis,
                        Objects       = new BHoMGroup <Bar>()
                        {
                            Elements = { bar }
                        }
                    };
                }
                bhLoads.Add(bhLoad);
                break;

            case St7.dlTriangular:
                bhLoad = new BarVaryingDistributedLoad()
                {
                    StartPosition = 0,
                    EndPosition   = barLength * (1 - a),
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[2],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[2],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad);
                bhLoad2 = new BarVaryingDistributedLoad()
                {
                    StartPosition = barLength * a,
                    EndPosition   = 0,
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[3],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[3],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad2);
                break;

            case St7.dlThreePoint0:
                bhLoad = new BarVaryingDistributedLoad()
                {
                    StartPosition = 0,
                    EndPosition   = barLength * (1 - a),
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[2],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[2],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad);
                bhLoad2 = new BarVaryingDistributedLoad()
                {
                    StartPosition = barLength * a,
                    EndPosition   = barLength * b,
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[1],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[1],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad2);
                break;

            case St7.dlThreePoint1:
                bhLoad = new BarVaryingDistributedLoad()
                {
                    StartPosition = barLength * a,
                    EndPosition   = barLength * b,
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[1],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[1],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad);
                bhLoad2 = new BarVaryingDistributedLoad()
                {
                    StartPosition = barLength * (1 - b),
                    EndPosition   = 0,
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[1],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[3],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[1],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[3],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad2);
                break;

            case St7.dlTrapezoidal:
                bhLoad = new BarVaryingDistributedLoad()
                {
                    StartPosition = 0,
                    EndPosition   = barLength * (1 - a),
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[2],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[2],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad);
                bhLoad2 = new BarVaryingDistributedLoad()
                {
                    StartPosition = barLength * a,
                    EndPosition   = barLength * b,
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[0],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[1],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[0],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[1],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad2);
                bhLoad3 = new BarVaryingDistributedLoad()
                {
                    StartPosition = barLength * (1 - b),
                    EndPosition   = 0,
                    MomentAtStart = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[1],
                    MomentAtEnd   = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * moments[3],
                    ForceAtStart  = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[1],
                    ForceAtEnd    = BH.Engine.Geometry.Create.Vector(loadX, loadY, loadZ) * forces[3],
                    Loadcase      = ldcase,
                    Projected     = projected,
                    Axis          = loadAxis,
                    Objects       = new BHoMGroup <Bar>()
                    {
                        Elements = { bar }
                    }
                };
                bhLoads.Add(bhLoad3);
                break;
            }
            return(bhLoads);
        }
Exemplo n.º 16
0
        /***************************************************/

        public static AreaUniformalyDistributedLoad AreaUniformalyDistributedLoad(Loadcase loadcase, Vector pressure, IEnumerable <IAreaElement> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(AreaUniformalyDistributedLoad(loadcase, pressure, new BHoMGroup <IAreaElement>()
            {
                Elements = objects.ToList()
            }, axis, projected, name));
        }
Exemplo n.º 17
0
        /***************************************************/

        public static BarPointLoad BarPointLoad(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            if (force == null && moment == null)
            {
                throw new ArgumentException("Bar point load requires either the force or the moment vector to be defined");
            }

            return(new BarPointLoad {
                Loadcase = loadcase,
                DistanceFromA = distFromA,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Objects = group,
                Axis = axis,
                Name = name
            });
        }
Exemplo n.º 18
0
        public static BarUniformlyDistributedLoad BarUniformlyDistributedLoad(Loadcase loadcase, BHoMGroup <Bar> group, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            if (force == null && moment == null)
            {
                Reflection.Compute.RecordError("BarUniformLoad requires at least the force or the moment vector to be defined");
                return(null);
            }

            return(new BarUniformlyDistributedLoad
            {
                Loadcase = loadcase,
                Objects = group,
                Force = force == null ? new Vector() : force,
                Moment = moment == null ? new Vector() : moment,
                Axis = axis,
                Name = name,
                Projected = projected
            });
        }
Exemplo n.º 19
0
        /***************************************************/

        public static BarTemperatureLoad BarTemperatureLoad(Loadcase loadcase, double temperatureChange, BHoMGroup <Bar> group, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(new BarTemperatureLoad
            {
                Loadcase = loadcase,
                TemperatureChange = temperatureChange,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }
Exemplo n.º 20
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private static Vector[] BarForceVectors(Bar bar, Vector globalForce, Vector globalMoment, LoadAxis axis, bool isProjected, out Cartesian system)
        {
            if (axis == LoadAxis.Global)
            {
                system = null;
                if (isProjected)
                {
                    Point  startPos = bar.StartNode.Position();
                    Vector tan      = bar.Tangent();

                    Vector tanUnit    = tan.Normalise();
                    Vector forceUnit  = globalForce.Normalise();
                    Vector momentUnit = globalMoment.Normalise();

                    double scaleFactorForce  = (tanUnit - tanUnit.DotProduct(forceUnit) * forceUnit).Length();
                    double scaleFactorMoment = (tanUnit - tanUnit.DotProduct(momentUnit) * momentUnit).Length();

                    return(new Vector[] { globalForce *scaleFactorForce, globalMoment *scaleFactorMoment });
                }
                else
                {
                    return(new Vector[] { globalForce, globalMoment });
                }
            }
            else
            {
                Vector normal  = bar.Normal();
                Vector tan     = bar.Tangent();
                Vector tanUnit = tan.Normalise();
                Vector y       = normal.CrossProduct(tanUnit);

                system = new Cartesian(new Point(), tanUnit, y, normal);

                return(new Vector[] { globalForce, globalMoment });
            }
        }
Exemplo n.º 21
0
        /***************************************************/

        public static BarUniformlyDistributedLoad BarUniformlyDistributedLoad(Loadcase loadcase, BHoMGroup <Bar> group, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            if (force == null && moment == null)
            {
                throw new ArgumentException("Bar uniform load requires either the force or the moment vector to be defined");
            }

            return(new BarUniformlyDistributedLoad
            {
                Loadcase = loadcase,
                Objects = group,
                Force = force == null? new Vector(): force,
                Moment = moment == null? new Vector():moment,
                Axis = axis,
                Name = name,
                Projected = projected
            });
        }
Exemplo n.º 22
0
 public static AreaUniformlyDistributedLoad AreaUniformlyDistributedLoad(Loadcase loadcase, Vector pressure, IEnumerable <IAreaElement> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
 {
     return(new AreaUniformlyDistributedLoad
     {
         Loadcase = loadcase,
         Pressure = pressure,
         Objects = new BHoMGroup <IAreaElement>()
         {
             Elements = objects.ToList()
         },
         Axis = axis,
         Projected = projected,
         Name = name
     });
 }
Exemplo n.º 23
0
        /***************************************************/

        public static BarVaryingDistributedLoad BarVaryingDistributedLoad(Loadcase loadcase, BHoMGroup <Bar> group, double distFromA = 0, Vector forceA = null, Vector momentA = null, double distFromB = 0, Vector forceB = null, Vector momentB = null, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            if ((forceA == null || forceB == null) && (momentA == null || momentB == null))
            {
                throw new ArgumentException("Bar varying load requires either the force at A and B OR the moment at A and B to be defined");
            }

            return(new BarVaryingDistributedLoad
            {
                Loadcase = loadcase,
                Objects = group,
                DistanceFromA = distFromA,
                DistanceFromB = distFromB,
                ForceA = forceA == null ? new Vector() : forceA,
                ForceB = forceB == null ? new Vector():forceB,
                MomentA = momentA == null? new Vector() : momentA,
                MomentB = momentB == null? new Vector() : momentB,
                Projected = projected,
                Axis = axis,
                Name = name
            });
        }
Exemplo n.º 24
0
 public static AreaUniformlyDistributedLoad AreaUniformalyDistributedLoad(Loadcase loadcase, Vector pressure, BHoMGroup <IAreaElement> group, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
 {
     return(AreaUniformlyDistributedLoad(loadcase, pressure, group, axis, projected, name));
 }
Exemplo n.º 25
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/


        public static ILoad Load(LoadType type, Loadcase loadCase, List <double> magnitude, string groupName, LoadAxis axis, bool isProjected, string units = "kN")
        {
            units = units.ToUpper();
            units = units.Replace(" ", "");

            double sFac = 1;

            switch (units)
            {
            case "N":
            case "NEWTON":
            case "NEWTONS":
                sFac = 1;
                break;

            case "KN":
            case "KILONEWTON":
            case "KILONEWTONS":
                sFac = 1000;
                break;

            case "C":
            case "CELSIUS":
            case "K":
            case "KELVIN":
                sFac = 1;
                break;

            default:
                throw new ArgumentException("Unrecognised unit type");
            }

            Vector force  = null;
            Vector moment = null;
            double mag;

            if (magnitude.Count < 1)
            {
                throw new ArgumentException("Need at least one maginute value");
            }

            mag = magnitude[0] * sFac;

            if (magnitude.Count > 2)
            {
                force = new Vector()
                {
                    X = magnitude[0], Y = magnitude[1], Z = magnitude[2]
                }
            }
            *sFac;

            if (magnitude.Count > 5)
            {
                moment = new Vector()
                {
                    X = magnitude[3], Y = magnitude[4], Z = magnitude[5]
                }
            }
            *sFac;

            switch (type)
            {
            case LoadType.Selfweight:
            {
                BHoMGroup <BHoMObject> group = new BHoMGroup <BHoMObject>()
                {
                    Name = groupName
                };
                return(GravityLoad(loadCase, force, group, groupName));
            }

            case LoadType.PointForce:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointForce(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.PointDisplacement:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointDisplacement(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.PointVelocity:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointVelocity(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.PointAcceleration:
            {
                BHoMGroup <Node> group = new BHoMGroup <Node>()
                {
                    Name = groupName
                };
                return(PointAcceleration(loadCase, group, force, moment, axis, groupName));
            }

            case LoadType.BarUniformLoad:
            {
                BHoMGroup <Bar> group = new BHoMGroup <Bar>()
                {
                    Name = groupName
                };
                return(BarUniformlyDistributedLoad(loadCase, group, force, moment, axis, isProjected, groupName));
            }

            case LoadType.BarTemperature:
            {
                BHoMGroup <Bar> group = new BHoMGroup <Bar>()
                {
                    Name = groupName
                };
                return(BarTemperatureLoad(loadCase, mag, group, axis, isProjected, groupName));
            }

            case LoadType.AreaUniformLoad:
            {
                BHoMGroup <IAreaElement> group = new BHoMGroup <IAreaElement>()
                {
                    Name = groupName
                };
                return(AreaUniformalyDistributedLoad(loadCase, force, group, axis, isProjected, groupName));
            }

            case LoadType.BarVaryingLoad:
            case LoadType.BarPointLoad:
            case LoadType.AreaTemperature:
            case LoadType.Pressure:
            case LoadType.Geometrical:
            default:
                throw new NotImplementedException("Load type not implemented");
            }
        }
Exemplo n.º 26
0
        /***************************************************/

        public static AreaTemperatureLoad AreaTemperatureLoad(Loadcase loadcase, double t, BHoMGroup <IAreaElement> group, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(new AreaTemperatureLoad {
                Loadcase = loadcase,
                TemperatureChange = t,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }
Exemplo n.º 27
0
 /***************************************************/
 public static PointForce PointForce(Loadcase loadcase, IEnumerable <Node> objects, Vector force = null, Vector moment = null, LoadAxis axis = LoadAxis.Global, string name = "")
 {
     return(PointForce(loadcase, new BHoMGroup <Node>()
     {
         Elements = objects.ToList()
     }, force, moment, axis, name));
 }
Exemplo n.º 28
0
        /***************************************************/

        public static AreaTemperatureLoad AreaTemperatureLoad(Loadcase loadcase, double t, IEnumerable <IAreaElement> objects, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(AreaTemperatureLoad(loadcase, t, new BHoMGroup <IAreaElement>()
            {
                Elements = objects.ToList()
            }, axis, projected, name));
        }
Exemplo n.º 29
0
        /***************************************************/

        public static PointVelocity PointVelocity(Loadcase loadcase, IEnumerable <Node> objects, Vector translation = null, Vector rotation = null, LoadAxis axis = LoadAxis.Global, string name = "")
        {
            return(PointVelocity(loadcase, new BHoMGroup <Node>()
            {
                Elements = objects.ToList()
            }, translation, rotation, axis, name));
        }
Exemplo n.º 30
0
        /***************************************************/

        public static AreaUniformalyDistributedLoad AreaUniformalyDistributedLoad(Loadcase loadcase, Vector pressure, BHoMGroup <IAreaElement> group, LoadAxis axis = LoadAxis.Global, bool projected = false, string name = "")
        {
            return(new AreaUniformalyDistributedLoad
            {
                Loadcase = loadcase,
                Pressure = pressure,
                Objects = group,
                Axis = axis,
                Projected = projected,
                Name = name
            });
        }