/***************************************************/ private static void SetElementType(IFMeshLine lusasLineMesh, BarFEAType barFEAType) { if (barFEAType == BarFEAType.Axial) { lusasLineMesh.addElementName("BRS2"); } else if (barFEAType == BarFEAType.Flexural) { lusasLineMesh.addElementName("BMI21"); } }
/***************************************************/ private bool CreateCollection(IEnumerable <MeshSettings1D> meshSettings1Ds) { foreach (MeshSettings1D meshSettings1D in meshSettings1Ds) { if (meshSettings1D != null) { IFMeshLine lusasLineMesh = CreateMeshSettings1D(meshSettings1D); } } return(true); }
/***************************************************/ private static void SetEndConditions(IFMeshLine lusasLineMesh, BarRelease barReleases) { if (barReleases.StartRelease.TranslationX == DOFType.Free) { lusasLineMesh.setEndRelease("Start", "u", "free"); } if (barReleases.StartRelease.TranslationY == DOFType.Free) { lusasLineMesh.setEndRelease("Start", "v", "free"); } if (barReleases.StartRelease.TranslationY == DOFType.Free) { lusasLineMesh.setEndRelease("Start", "w", "free"); } if (barReleases.StartRelease.RotationX == DOFType.Free) { lusasLineMesh.setEndRelease("Start", "thx", "free"); } if (barReleases.StartRelease.RotationY == DOFType.Free) { lusasLineMesh.setEndRelease("Start", "thy", "free"); } if (barReleases.StartRelease.RotationZ == DOFType.Free) { lusasLineMesh.setEndRelease("Start", "thz", "free"); } if (barReleases.EndRelease.TranslationX == DOFType.Free) { lusasLineMesh.setEndRelease("End", "u", "free"); } if (barReleases.EndRelease.TranslationY == DOFType.Free) { lusasLineMesh.setEndRelease("End", "v", "free"); } if (barReleases.EndRelease.TranslationY == DOFType.Free) { lusasLineMesh.setEndRelease("End", "w", "free"); } if (barReleases.EndRelease.RotationX == DOFType.Free) { lusasLineMesh.setEndRelease("End", "thx", "free"); } if (barReleases.EndRelease.RotationY == DOFType.Free) { lusasLineMesh.setEndRelease("End", "thy", "free"); } if (barReleases.EndRelease.RotationZ == DOFType.Free) { lusasLineMesh.setEndRelease("End", "thz", "free"); } }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static MeshSettings1D ToMeshSettings1D(this IFAttribute lusasAttrbute) { string attributeName = GetName(lusasAttrbute); IFMeshLine lusasMeshLine = (IFMeshLine)lusasAttrbute; double value = 0; Split1D splitMethod = Split1D.Automatic; int meshType = 0; lusasMeshLine.getMeshDivisions(ref meshType); if (meshType == 0) { value = 0; } else if (meshType == 1) { splitMethod = Split1D.Divisions; object[] ratios = lusasMeshLine.getValue("ratio"); value = ratios.Count(); if (value == 0) { value = 4; } } else if (meshType == 2) { splitMethod = Split1D.Length; value = lusasMeshLine.getValue("size"); } MeshSettings1D meshSettings1D = new MeshSettings1D { Name = attributeName, SplitMethod = splitMethod, SplitParameter = value }; int adapterNameId = GetAdapterID(lusasMeshLine, 'e'); meshSettings1D.SetAdapterId(typeof(LusasId), adapterNameId); return(meshSettings1D); }
/***************************************************/ private static BarRelease GetBarRelease(IFMeshLine lusasLineMesh) { object[] startReleases = lusasLineMesh.getValue("start"); object[] endReleases = lusasLineMesh.getValue("end"); List <DOFType> startReleaseType = GetConstraints(startReleases); List <DOFType> endReleaseType = GetConstraints(endReleases); Constraint6DOF startConstraint = SetConstraint(startReleaseType); Constraint6DOF endConstraint = SetConstraint(endReleaseType); BarRelease barRelease = new BarRelease { StartRelease = startConstraint, EndRelease = endConstraint }; return(barRelease); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private List <MeshSettings1D> ReadMeshSettings1D(List <string> ids = null) { List <MeshSettings1D> meshSettings1Ds = new List <MeshSettings1D>(); object[] lusasMesh1Ds = d_LusasData.getAttributes("Line Mesh"); for (int i = 0; i < lusasMesh1Ds.Count(); i++) { IFMeshLine lusasMesh1D = (IFMeshLine)lusasMesh1Ds[i]; MeshSettings1D meshSettings1D = Adapters.Lusas.Convert.ToMeshSettings1D(lusasMesh1D); List <string> analysisName = new List <string> { lusasMesh1D.getAttributeType() }; meshSettings1D.Tags = new HashSet <string>(analysisName); if (meshSettings1D != null) { meshSettings1Ds.Add(meshSettings1D); } } return(meshSettings1Ds); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ public static Tuple <bool, double, BarRelease, BarFEAType> GetMeshProperties(IFLine lusasLine) { bool meshAssigned = true; double betaAngle = 0; BarRelease barRelease = null; BarFEAType barType = BarFEAType.Flexural; object[] meshAssignments = lusasLine.getAssignments("Mesh"); if (meshAssignments.Length > 0) { foreach (object assignment in meshAssignments) { IFAssignment lusasAssignment = (IFAssignment)assignment; IFAttribute lusasMesh = lusasAssignment.getAttribute(); IFMeshLine lusasLineMesh = (IFMeshLine)lusasMesh; betaAngle = lusasAssignment.getBetaAngle(); barRelease = GetBarRelease(lusasLineMesh); object[] barMeshName = lusasLineMesh.getElementNames(); foreach (object type in barMeshName) { barType = GetFEAType(type); } } } else { meshAssigned = false; } Tuple <bool, double, BarRelease, BarFEAType> lineMeshProperties = new Tuple <bool, double, BarRelease, BarFEAType>(meshAssigned, betaAngle, barRelease, barType); return(lineMeshProperties); }
/***************************************************/ private static void SetSplitMethod(IFMeshLine lusasLineMesh, MeshSettings1D meshSettings1D, BarFEAType barFEAType) { if (meshSettings1D.SplitMethod == Split1D.Length) { if (barFEAType == BarFEAType.Axial) { lusasLineMesh.setSize("BRS2", meshSettings1D.SplitParameter); } else if (barFEAType == BarFEAType.Flexural) { lusasLineMesh.setSize("BMI21", meshSettings1D.SplitParameter); } } else if (meshSettings1D.SplitMethod == Split1D.Automatic) { lusasLineMesh.setValue("uiSpacing", "uniform"); SetElementType(lusasLineMesh, barFEAType); } else if (meshSettings1D.SplitMethod == Split1D.Divisions) { lusasLineMesh.addSpacing(System.Convert.ToInt32(meshSettings1D.SplitParameter), 1); SetElementType(lusasLineMesh, barFEAType); } }