/***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static BarUniformlyDistributedLoad FromRFEM(this rf.MemberLoad rfMemberLoad, Loadcase bhLoadcase, oM.Base.BHoMGroup <Bar> objectGroup)
        {
            LoadAxis loadAxis;
            bool     projected;
            string   direction;

            BarUniformlyDistributedLoad barUniformLoad = new BarUniformlyDistributedLoad();

            barUniformLoad.Loadcase = bhLoadcase;
            barUniformLoad.Objects  = objectGroup;
            barUniformLoad.SetAdapterId(typeof(RFEMId), rfMemberLoad.No);

            GetLoadingParameters(rfMemberLoad, out loadAxis, out projected, out direction);
            barUniformLoad.Axis      = loadAxis;
            barUniformLoad.Projected = projected;

            switch (direction)
            {
            case "FX":
                barUniformLoad.Force.X = rfMemberLoad.Magnitude1;
                break;

            case "FY":
                barUniformLoad.Force.Y = rfMemberLoad.Magnitude1;
                break;

            case "FZ":
                barUniformLoad.Force.Z = rfMemberLoad.Magnitude1;
                break;

            case "UX":
                barUniformLoad.Moment.X = rfMemberLoad.Magnitude1;
                break;

            case "UY":
                barUniformLoad.Moment.Y = rfMemberLoad.Magnitude1;
                break;

            case "UZ":
                barUniformLoad.Moment.Z = rfMemberLoad.Magnitude1;
                break;

            default:
                break;
            }

            return(barUniformLoad);
        }
示例#2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static List <rf.MemberLoad> ToRFEM(this BarUniformlyDistributedLoad load, int loadId, int loadcaseId)
        {
            List <rf.MemberLoad> rfLoadList = new List <rf.MemberLoad>();

            rf.MemberLoad rfLoad = new rf.MemberLoad();
            rfLoad.Distribution      = rf.LoadDistributionType.UniformType;
            rfLoad.RelativeDistances = false;
            rfLoad.ReferenceTo       = rf.MemberLoadReferenceType.MembersType;

            List <string> objectIds      = load.Objects.Elements.Select(x => x.AdapterId <int>(typeof(RFEMId)).ToString()).ToList();
            string        objectIdString = string.Join(",", objectIds);

            rfLoad.ObjectList = objectIdString;

            rfLoad.IsValid = true;
            rfLoad.Comment = "";
            rfLoad.ID      = "";
            rfLoad.Tag     = "";

            if (load.Force.Length() == 0 & load.Moment.Length() == 0)
            {
                Engine.Base.Compute.RecordWarning("Zero forces set. No load pushed!");
                return(rfLoadList);
            }

            if (load.Force.Length() != 0)
            {
                rfLoad.Type = rf.LoadType.ForceType;
                if (load.Force.X != 0)
                {
                    rfLoad.No = loadId;
                    rf.MemberLoad xLoad = rfLoad;
                    xLoad.Direction  = load.Axis == LoadAxis.Global ? rf.LoadDirectionType.GlobalXType : rf.LoadDirectionType.LocalXType;
                    xLoad.Magnitude1 = load.Force.X;
                    rfLoadList.Add(xLoad);
                    loadId++;
                }

                if (load.Force.Y != 0)
                {
                    rfLoad.No = loadId;
                    rf.MemberLoad yLoad = rfLoad;
                    yLoad.Direction  = load.Axis == LoadAxis.Global ? rf.LoadDirectionType.GlobalYType : rf.LoadDirectionType.LocalYType;
                    yLoad.Magnitude1 = load.Force.Y;
                    rfLoadList.Add(yLoad);
                    loadId++;
                }

                if (load.Force.Z != 0)
                {
                    rfLoad.No = loadId;
                    rf.MemberLoad zLoad = rfLoad;
                    zLoad.Direction  = load.Axis == LoadAxis.Global ? rf.LoadDirectionType.GlobalZType : rf.LoadDirectionType.LocalZType;
                    zLoad.Magnitude1 = load.Force.Z;
                    rfLoadList.Add(zLoad);
                    loadId++;
                }
            }

            if (load.Moment.Length() != 0)
            {
                rfLoad.Type = rf.LoadType.MomentType;
                if (load.Moment.X != 0)
                {
                    rfLoad.No = loadId;
                    rf.MemberLoad uxLoad = rfLoad;
                    uxLoad.Direction  = load.Axis == LoadAxis.Global ? rf.LoadDirectionType.GlobalXType : rf.LoadDirectionType.LocalXType;
                    uxLoad.Magnitude1 = load.Moment.X;
                    rfLoadList.Add(uxLoad);
                    loadId++;
                }

                if (load.Moment.Y != 0)
                {
                    rfLoad.No = loadId;
                    rf.MemberLoad uyLoad = rfLoad;
                    uyLoad.Direction  = load.Axis == LoadAxis.Global ? rf.LoadDirectionType.GlobalXType : rf.LoadDirectionType.LocalXType;
                    uyLoad.Magnitude1 = load.Moment.X;
                    rfLoadList.Add(uyLoad);
                    loadId++;
                }

                if (load.Moment.X != 0)
                {
                    rfLoad.No = loadId;
                    rf.MemberLoad uzLoad = rfLoad;
                    uzLoad.Direction  = load.Axis == LoadAxis.Global ? rf.LoadDirectionType.GlobalXType : rf.LoadDirectionType.LocalXType;
                    uzLoad.Magnitude1 = load.Moment.X;
                    rfLoadList.Add(uzLoad);
                    loadId++;
                }
            }


            return(rfLoadList);
        }
        /***************************************************/

        private static void GetLoadingParameters(rf.MemberLoad rfMemberLoad, out LoadAxis loadAxis, out bool projected, out string direction)
        {
            loadAxis  = LoadAxis.Global;
            projected = false;
            direction = "";

            switch (rfMemberLoad.Type)
            {
            case rf.LoadType.ForceType:
                direction = "F";
                break;

            case rf.LoadType.MomentType:
                direction = "U";
                break;

            case rf.LoadType.TemperatureType:
            case rf.LoadType.AxialStrainType:
            case rf.LoadType.AxialDisplacementType:
            case rf.LoadType.PrecamberType:
            case rf.LoadType.InitialPrestressType:
            case rf.LoadType.EndPrestressType:
            case rf.LoadType.DisplacementType:
            case rf.LoadType.RotationLoadType:
            case rf.LoadType.FullPipeContentType:
            case rf.LoadType.PartialPipeContentType:
            case rf.LoadType.PipeInternalPressureType:
            case rf.LoadType.RotaryMotionType:
            case rf.LoadType.BuoyancyType:
            case rf.LoadType.UnknownLoadType:
                Engine.Base.Compute.RecordWarning("Load type: " + rfMemberLoad.Type.ToString() + " is not supported!");
                break;

            default:
                break;
            }

            switch (rfMemberLoad.Direction)
            {
            case rf.LoadDirectionType.GlobalXType:
                loadAxis   = LoadAxis.Global;
                direction += "X";
                break;

            case rf.LoadDirectionType.GlobalYType:
                loadAxis   = LoadAxis.Global;
                direction += "Y";
                break;

            case rf.LoadDirectionType.GlobalZType:
                loadAxis   = LoadAxis.Global;
                direction += "Z";
                break;

            case rf.LoadDirectionType.LocalXType:
                loadAxis   = LoadAxis.Local;
                direction += "X";
                break;

            case rf.LoadDirectionType.LocalYType:
                loadAxis   = LoadAxis.Local;
                direction += "Y";
                break;

            case rf.LoadDirectionType.LocalZType:
                loadAxis   = LoadAxis.Local;
                direction += "Z";
                break;

            case rf.LoadDirectionType.ProjectXType:
                loadAxis   = LoadAxis.Global;
                projected  = true;
                direction += "X";
                break;

            case rf.LoadDirectionType.ProjectYType:
                loadAxis   = LoadAxis.Global;
                projected  = true;
                direction += "Y";
                break;

            case rf.LoadDirectionType.ProjectZType:
                loadAxis   = LoadAxis.Global;
                projected  = true;
                direction += "Z";
                break;

            case rf.LoadDirectionType.PerpendicularZType:
            case rf.LoadDirectionType.UnknownLoadDirectionType:
            case rf.LoadDirectionType.LocalUType:
            case rf.LoadDirectionType.LocalVType:
                Engine.Base.Compute.RecordWarning("Load direction type: " + rfMemberLoad.Direction.ToString() + " is not supported!");
                break;

            default:
                break;
            }
        }