static bool IsEqual(NodeDisplacement nodeDisplacement1, NodeDisplacement nodeDisplacement2) { return(nodeDisplacement1.NodeIdx == nodeDisplacement2.NodeIdx && CompareDouble(nodeDisplacement1.Displacement.X, nodeDisplacement2.Displacement.X) && CompareDouble(nodeDisplacement1.Displacement.Y, nodeDisplacement2.Displacement.Y) && CompareDouble(nodeDisplacement1.Displacement.Z, nodeDisplacement2.Displacement.Z) && CompareDouble(nodeDisplacement1.Rotation.X, nodeDisplacement2.Rotation.X) && CompareDouble(nodeDisplacement1.Rotation.Y, nodeDisplacement2.Rotation.Y) && CompareDouble(nodeDisplacement1.Rotation.Z, nodeDisplacement2.Rotation.Z)); }
public void SetProcessNode(string op, string text) { //16 1 -0.64289E-02 -0.88362E-02 0.64941E-02 0.10075E-03 -0.16080E-03 0.75179E-02 string temp = text.ToUpper().Trim().TrimEnd().TrimStart().Replace('\t', ' '); int indx = -1; while (temp.IndexOf(" ") != -1) { temp = temp.Replace(" ", " "); } MyStrings mList = new MyStrings(temp, ' '); double dx = 0.0d, dy = 0.0d, dz = 0.0d; try { // 0 1 2 3 4 5 6 7 //16 1 -0.64289E-02 -0.88362E-02 0.64941E-02 0.10075E-03 -0.16080E-03 0.75179E-02 ndisp = new NodeDisplacement(); int index = 0; if (mList.StringList.Count == 8) { nodeNo = mList.GetInt(index); index++; ndisp.Node.NodeNo = nodeNo; ndisp.LoadCase = mList.GetInt(index); index++; ndisp.Tx = mList.GetDouble(index); index++; ndisp.Ty = mList.GetDouble(index); index++; ndisp.Tz = mList.GetDouble(index); index++; ndisp.Rx = mList.GetDouble(index); index++; ndisp.Ry = mList.GetDouble(index); index++; ndisp.Rz = mList.GetDouble(index); index++; nDispCol.Add(ndisp); } else if (mList.StringList.Count == 7) { ndisp.Node.NodeNo = nodeNo; ndisp.LoadCase = mList.GetInt(index); index++; ndisp.Tx = mList.GetDouble(index); index++; ndisp.Ty = mList.GetDouble(index); index++; ndisp.Tz = mList.GetDouble(index); index++; ndisp.Rx = mList.GetDouble(index); index++; ndisp.Ry = mList.GetDouble(index); index++; ndisp.Rz = mList.GetDouble(index); index++; nDispCol.Add(ndisp); } } catch (Exception exx) { } }
public frmPostProcess(ASTRADoc AstDoc, vdDocument document) { InitializeComponent(); astDoc = new ASTRADoc(); astDoc = AstDoc; orgASTDoc = new ASTRADoc(); orgASTDoc = AstDoc; doc = document; beamMomentCol = new BeamForceMomentCollection(); beamMoment = new BeamForceMoment(); repFileName = Path.Combine(Path.GetDirectoryName(astDoc.FileName), "ANALYSIS_REP.TXT"); nDispCol = new NodeDisplacementCollection(); ndisp = new NodeDisplacement(); }
/***************************************************/ private List <NodeDisplacement> ReadNodeDisplacement(List <string> nodeIds) { List <NodeDisplacement> nodeDisplacements = new List <NodeDisplacement>(); int resultCount = 0; string[] loadcaseNames = null; string[] objects = null; string[] elm = null; string[] stepType = null; double[] stepNum = null; double[] ux = null; double[] uy = null; double[] uz = null; double[] rx = null; double[] ry = null; double[] rz = null; for (int i = 0; i < nodeIds.Count; i++) { int ret = m_model.Results.JointDispl(nodeIds[i].ToString(), eItemTypeElm.ObjectElm, ref resultCount, ref objects, ref elm, ref loadcaseNames, ref stepType, ref stepNum, ref ux, ref uy, ref uz, ref rx, ref ry, ref rz); if (ret == 0) { for (int j = 0; j < resultCount; j++) { NodeDisplacement nd = new NodeDisplacement(nodeIds[i], loadcaseNames[j], -1, stepNum[j], oM.Geometry.Basis.XY, ux[j], uy[j], uz[j], rx[j], ry[j], rz[j]); nodeDisplacements.Add(nd); } } } return(nodeDisplacements); }
public frmPostProcess(ASTRADoc AstDoc, vdDocument mainDoc, vdDocument postProcess1, vdDocument postProcess2, vdDocument postProcess3) { //InitializeComponent(); //astDoc = new ASTRADoc(); //astDoc = AstDoc; //orgASTDoc = AstDoc; //doc = mainDoc; ASTDoc_Load1 = new ASTRADoc(AstDoc.FileName); ASTDoc_Load2 = new ASTRADoc(AstDoc.FileName); ASTDoc_Load3 = new ASTRADoc(AstDoc.FileName); //ASTDoc_Load1 = AstDoc; //ASTDoc_Load2 = AstDoc; //ASTDoc_Load3 = AstDoc; InitializeComponent(); astDoc = new ASTRADoc(); astDoc = AstDoc; orgASTDoc = new ASTRADoc(); orgASTDoc = AstDoc; doc = mainDoc; this.mainDoc = mainDoc; this.postProcess1 = postProcess1; this.postProcess2 = postProcess2; this.postProcess3 = postProcess3; beamMomentCol = new BeamForceMomentCollection(); beamMoment = new BeamForceMoment(); repFileName = Path.Combine(Path.GetDirectoryName(astDoc.FileName), "ANALYSIS_REP.TXT"); nDispCol = new NodeDisplacementCollection(); ndisp = new NodeDisplacement(); }
private IEnumerable <IResult> ExtractNodeDisplacement(List <int> ids, List <int> loadcaseIds) { List <NodeDisplacement> nodeDisplacements = new List <NodeDisplacement>(); IFView view = m_LusasApplication.getCurrentView(); IFResultsContext resultsContext = m_LusasApplication.newResultsContext(view); string entity = "Displacement"; string location = "Nodal"; foreach (int loadcaseId in loadcaseIds) { IFLoadset loadset = d_LusasData.getLoadset(loadcaseId); if (!loadset.needsAssociatedValues()) { resultsContext.setActiveLoadset(loadset); } IFUnitSet unitSet = d_LusasData.getModelUnits(); double forceSIConversion = 1 / unitSet.getForceFactor(); double lengthSIConversion = 1 / unitSet.getLengthFactor(); List <string> components = new List <string>() { "DX", "DY", "DZ", "THX", "THY", "THZ" }; d_LusasData.startUsingScriptedResults(); Dictionary <string, IFResultsComponentSet> resultsSets = GetResultsSets(entity, components, location, resultsContext); foreach (int nodeId in ids) { Dictionary <string, double> featureResults = GetFeatureResults(components, resultsSets, unitSet, nodeId, "P", 6); double uX = 0; double uY = 0; double uZ = 0; double rX = 0; double rY = 0; double rZ = 0; featureResults.TryGetValue("DX", out uX); featureResults.TryGetValue("DY", out uY); featureResults.TryGetValue("DZ", out uZ); featureResults.TryGetValue("THX", out rX); featureResults.TryGetValue("THY", out rY); featureResults.TryGetValue("THZ", out rZ); //TODO: resolve below identifiers extractable through the API int mode = -1; double timeStep = 0; NodeDisplacement nodeDisplacement = new NodeDisplacement( nodeId, Adapters.Lusas.Convert.GetName(loadset.getName()), mode, timeStep, oM.Geometry.Basis.XY, uX * lengthSIConversion, uY * lengthSIConversion, uZ * lengthSIConversion, rX, rY, rZ ); nodeDisplacements.Add(nodeDisplacement); } d_LusasData.stopUsingScriptedResults(); d_LusasData.flushScriptedResults(); } return(nodeDisplacements); }
/***************************************************/ public static double TotalDisplacement(this NodeDisplacement disp) { return(Math.Sqrt(disp.UX * disp.UX + disp.UY * disp.UY + disp.UZ * disp.UZ)); }
private List <LoadCaseOutput> ParseLines(string frame3DDoutput) { List <LoadCaseOutput> outputLines = new List <LoadCaseOutput>(); var reader = new StringReader(frame3DDoutput); while (true) { string currentLine = ReadUntil(reader, (s) => s.StartsWith("L O A D C A S E")); var forceLines = new List <PeakFrameElementInternalForce>(); var displacementLines = new List <NodeDisplacement>(); var reactionLines = new List <ReactionOutput>(); var frameElementEndForceLines = new List <FrameElementEndForce>(); if (currentLine == null) { return(outputLines); } int loadCaseIdx = int.Parse(Regex.Match(currentLine, @"L O A D C A S E\s*(\d+)\s*O F\s*(\d+)").Groups[1].Value) - 1; // node displacements if (ReadUntil(reader, s => s.StartsWith("N O D E D I S P L A C E M E N T S (global)")) == null) { break; } if (reader.ReadLine() == null) //skip headers { break; } while (true) { var resultLine = NodeDisplacement.FromLine(reader.ReadLine(), loadCaseIdx); if (resultLine == null) { break; } displacementLines.Add(resultLine); } // frame element end forces if (ReadUntil(reader, s => s.Contains("Elmnt")) == null) { break; } while (true) { var resultLine = FrameElementEndForce.FromLine(reader.ReadLine(), loadCaseIdx); if (resultLine == null) { break; } frameElementEndForceLines.Add(resultLine); } // reactions if (ReadUntil(reader, s => s.Contains("Node")) == null) { break; } while (true) { var resultLine = ReactionOutput.FromLine(reader.ReadLine(), loadCaseIdx); if (resultLine == null) { break; } reactionLines.Add(resultLine); } // internal forces if (ReadUntil(reader, s => s.StartsWith("P E A K F R A M E E L E M E N T I N T E R N A L F O R C E S")) == null) { break; } if (reader.ReadLine() == null) //skip headers { break; } while (true) { var resultLine = PeakFrameElementInternalForce.FromLine(reader.ReadLine(), loadCaseIdx); if (resultLine == null) { break; } forceLines.Add(resultLine); } outputLines.Add(new LoadCaseOutput(0, displacementLines, frameElementEndForceLines, reactionLines, forceLines)); } return(outputLines); }
private void SET_NodalDisplacement(string text) { NodeDisplacement nd = new NodeDisplacement(); MyStrings mList = new MyStrings(MyStrings.RemoveAllSpaces(text), ' '); int indx = 0; if (mList.Count == 8) { indx = 0; nd.Node.NodeNo = mList.GetInt(indx); indx++; lastNodeNo = nd.Node.NodeNo; nd.LoadCase = mList.GetInt(indx); indx++; maxLoadCase = nd.LoadCase; nd.Tx = mList.GetDouble(indx); indx++; nd.Ty = mList.GetDouble(indx); indx++; nd.Tz = mList.GetDouble(indx); indx++; nd.Rx = mList.GetDouble(indx); indx++; nd.Ry = mList.GetDouble(indx); indx++; nd.Rz = mList.GetDouble(indx); indx++; } else if (mList.Count == 7) { indx = 0; nd.Node.NodeNo = lastNodeNo; nd.LoadCase = mList.GetInt(indx); indx++; maxLoadCase = nd.LoadCase; nd.Tx = mList.GetDouble(indx); indx++; nd.Ty = mList.GetDouble(indx); indx++; nd.Tz = mList.GetDouble(indx); indx++; nd.Rx = mList.GetDouble(indx); indx++; nd.Ry = mList.GetDouble(indx); indx++; nd.Rz = mList.GetDouble(indx); indx++; } #region Calculate Proportionate /**/ double x, y, z, prp, dif; x = y = z = prp = dif = 0.0; if (nd.Tx < nd.Ty && nd.Tx < nd.Tz) { x = nd.Tx; if (x < 1.0d) { dif = 1.0d - x; prp = x / dif; x = 1.0d; y = y * prp; z = z * prp; //nd.Tx = x; //nd.Ty += y; //nd.Tz += z; } } else if (nd.Ty < nd.Tx && nd.Ty < nd.Tz) { y = nd.Ty; if (y < 1.0) { dif = 1.0d - y; prp = y / dif; y = 1.0d; x = x * prp; z = z * prp; //nd.Tx += x; //nd.Ty = y; //nd.Tz += z; } } else if (nd.Tz < nd.Tx && nd.Tz < nd.Ty) { z = nd.Tz; if (z < 1.0d) { dif = 1.0d - z; prp = z / dif; z = 1.0d; y = y * prp; x = x * prp; //nd.Tx += x; //nd.Ty += y; //nd.Tz = z; } } /* * if (nd.Tx > 0.0) * { * nd.Tx += x; * } * else * { * nd.Tx -= x; * } * * if (nd.Ty > 0.0) * { * nd.Ty += y; * } * else * { * nd.Tx -= y; * } * * if (nd.Tz > 0.0) * { * nd.Tz += z; * } * else * { * nd.Tz -= z; * } * /**/ double factor = 1d; nd.Tx = nd.Tx * factor; nd.Ty = nd.Ty * factor; nd.Tz = nd.Tz * factor; #endregion //Chiranjit [2014 08 14] if (nd.Ty > 0) { nd.Ty = nd.Ty * -1; } ndispCol.Add(nd); }
private IEnumerable <IResult> GetNodeResults(Type type, IList ids = null, IList cases = null) { List <NodeResult> results = new List <NodeResult>(); int resultType = -1; if (type == typeof(NodeAcceleration)) { resultType = St7.rtNodeAcc; } else if (type == typeof(NodeDisplacement)) { resultType = St7.rtNodeDisp; } else if (type == typeof(NodeReaction)) { resultType = St7.rtNodeReact; } else if (type == typeof(NodeVelocity)) { resultType = St7.rtNodeVel; } List <int> loadcaseIds = new List <int>(); List <int> nodeIds = new List <int>(); int err; // checking node ids if (ids == null || ids.Count == 0) { int nodeCount = 0; err = St7.St7GetTotal(1, St7.tyNODE, ref nodeCount); if (!St7Error(err)) { return(null); } nodeIds = Enumerable.Range(1, nodeCount).ToList(); } else { nodeIds = ids.Cast <int>().ToList(); } // checking load ids if (cases == null) { BHError("No load cases are provided"); } else { foreach (object one_case in cases) { if (one_case is ICase) { loadcaseIds.Add(GetAdapterId <int>(one_case as ICase)); } else if (one_case is int) { loadcaseIds.Add((int)one_case); } } } double[] nodeResArray = new double[6]; NodeResult nd; foreach (int loadcaseId in loadcaseIds) { double caseTime = 0; err = St7.St7GetResultCaseTime(1, loadcaseId, ref caseTime); foreach (int nodeId in nodeIds) { err = St7.St7GetNodeResult(1, resultType, nodeId, loadcaseId, nodeResArray); switch (resultType) { case St7.rtNodeAcc: nd = new NodeAcceleration(nodeId, loadcaseId, 1, caseTime, oM.Geometry.Basis.XY, nodeResArray[0], nodeResArray[1], nodeResArray[2], nodeResArray[3], nodeResArray[4], nodeResArray[5]); break; case St7.rtNodeDisp: nd = new NodeDisplacement(nodeId, loadcaseId, 1, caseTime, oM.Geometry.Basis.XY, nodeResArray[0], nodeResArray[1], nodeResArray[2], nodeResArray[3], nodeResArray[4], nodeResArray[5]); break; case St7.rtNodeVel: nd = new NodeVelocity(nodeId, loadcaseId, 1, caseTime, oM.Geometry.Basis.XY, nodeResArray[0], nodeResArray[1], nodeResArray[2], nodeResArray[3], nodeResArray[4], nodeResArray[5]); break; case St7.rtNodeReact: nd = new NodeReaction(nodeId, loadcaseId, 1, caseTime, oM.Geometry.Basis.XY, nodeResArray[0], nodeResArray[1], nodeResArray[2], nodeResArray[3], nodeResArray[4], nodeResArray[5]); break; default: nd = null; BHError("Unknown Result type"); break; } results.Add(nd); } } return(results); }
public static List<NodeDisplacement> GetNodeDisplacement(cSapModel model, IList ids = null, IList cases = null) { List<string> loadcaseIds = new List<string>(); List<string> nodeIds = new List<string>(); List<NodeDisplacement> nodeDisplacements = new List<NodeDisplacement>(); int resultCount = 0; string[] loadcaseNames = null; string[] objects = null; string[] elm = null; string[] stepType = null; double[] stepNum = null; double[] fx = null; double[] fy = null; double[] fz = null; double[] mx = null; double[] my = null; double[] mz = null; if (ids == null) { int nodes = 0; string[] names = null; model.PointObj.GetNameList(ref nodes, ref names); nodeIds = names.ToList(); } else { for (int i = 0; i < ids.Count; i++) { nodeIds.Add(ids[i].ToString()); } } //Get out loadcases, get all for null list loadcaseIds = CheckAndGetCases(model, cases); model.Results.Setup.DeselectAllCasesAndCombosForOutput(); for (int loadcase = 0; loadcase < loadcaseIds.Count; loadcase++) { // Try setting it as a Load Case if (model.Results.Setup.SetCaseSelectedForOutput(loadcaseIds[loadcase]) != 0) { // If that fails, try setting it as a Load Combination if (model.Results.Setup.SetComboSelectedForOutput(loadcaseIds[loadcase]) != 0) { Engine.Reflection.Compute.RecordWarning("Failed to setup result extraction for case " + loadcaseIds[loadcase]); } } } for (int i = 0; i < nodeIds.Count; i++) { int ret = model.Results.JointDispl(nodeIds[i].ToString(), eItemTypeElm.ObjectElm, ref resultCount, ref objects, ref elm, ref loadcaseNames, ref stepType, ref stepNum, ref fx, ref fy, ref fz, ref mx, ref my, ref mz); if (ret == 0) { for (int j = 0; j < resultCount; j++) { //string step = stepType[j] != null ? stepType[j] == "Max" ? " Max" : stepType[j] == "Min" ? " Min" : "1" : "0"; //nodeForces.Add(new NodeDisplacement<string, string, string>(objects[j], loadcaseNames[j], step, fx[j], fy[j], fz[j], mx[j], my[j], mz[j])); NodeDisplacement nd = new NodeDisplacement() { ResultCase = loadcaseNames[j], ObjectId = nodeIds[i], RX = mx[j], RY = my[j], RZ = mz[j], UX = fx[j], UY = fy[j], UZ = fz[j], TimeStep = stepNum[j] }; nodeDisplacements.Add(nd); } } } return nodeDisplacements; }