From 7724802efdfbf95d1b01910866d597b2c8dda52e Mon Sep 17 00:00:00 2001 From: Kristjan Nielsen Date: Tue, 10 Oct 2023 15:19:30 +0200 Subject: [PATCH 1/5] stress unit abbreviation --- GsaGH/Components/5_Results/Element2dStresses.cs | 2 +- GsaGH/Components/5_Results/Element3dStresses.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GsaGH/Components/5_Results/Element2dStresses.cs b/GsaGH/Components/5_Results/Element2dStresses.cs index 767e7a959..34f536721 100644 --- a/GsaGH/Components/5_Results/Element2dStresses.cs +++ b/GsaGH/Components/5_Results/Element2dStresses.cs @@ -63,7 +63,7 @@ protected override void InitialiseDropdowns() { _selectedItems = new List(); _dropDownItems.Add(UnitsHelper.GetFilteredAbbreviations(EngineeringUnits.Stress)); - _selectedItems.Add(_stresshUnit.ToString()); + _selectedItems.Add(Pressure.GetAbbreviation(_stresshUnit)); _isInitialised = true; } diff --git a/GsaGH/Components/5_Results/Element3dStresses.cs b/GsaGH/Components/5_Results/Element3dStresses.cs index e547b355f..1a60c5225 100644 --- a/GsaGH/Components/5_Results/Element3dStresses.cs +++ b/GsaGH/Components/5_Results/Element3dStresses.cs @@ -63,7 +63,7 @@ protected override void InitialiseDropdowns() { _selectedItems = new List(); _dropDownItems.Add(UnitsHelper.GetFilteredAbbreviations(EngineeringUnits.Stress)); - _selectedItems.Add(_stresshUnit.ToString()); + _selectedItems.Add(Pressure.GetAbbreviation(_stresshUnit)); _isInitialised = true; } From 2f1f48d0e808260bd3a57b7e2d8d6263825131ff Mon Sep 17 00:00:00 2001 From: Kristjan Nielsen Date: Tue, 10 Oct 2023 15:20:09 +0200 Subject: [PATCH 2/5] remove 3d rotation results as they dont exists --- .../5_Results/Element3dDisplacements.cs | 81 +++++-------------- 1 file changed, 18 insertions(+), 63 deletions(-) diff --git a/GsaGH/Components/5_Results/Element3dDisplacements.cs b/GsaGH/Components/5_Results/Element3dDisplacements.cs index ae7e11d43..cc6a3297c 100644 --- a/GsaGH/Components/5_Results/Element3dDisplacements.cs +++ b/GsaGH/Components/5_Results/Element3dDisplacements.cs @@ -75,9 +75,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) { protected override void RegisterOutputParams(GH_OutputParamManager pManager) { string unitAbbreviation = Length.GetAbbreviation(_lengthUnit); - string note = ResultNotes.Note2dResults; - pManager.AddGenericParameter("Translations X [" + unitAbbreviation + "]", "Ux", "Translations in X-direction in Global Axis." + note, GH_ParamAccess.tree); pManager.AddGenericParameter("Translations Y [" + unitAbbreviation + "]", "Uy", @@ -86,14 +84,6 @@ protected override void RegisterOutputParams(GH_OutputParamManager pManager) { "Translations in Z-direction in Global Axis." + note, GH_ParamAccess.tree); pManager.AddGenericParameter("Translations |XYZ| [" + unitAbbreviation + "]", "|U|", "Combined |XYZ| Translations." + note, GH_ParamAccess.tree); - pManager.AddGenericParameter("Rotations XX [rad]", "Rxx", - "Rotations around X-axis in Global Axis." + note, GH_ParamAccess.tree); - pManager.AddGenericParameter("Rotations YY [rad]", "Ryy", - "Rotations around Y-axis in Global Axiss." + note, GH_ParamAccess.tree); - pManager.AddGenericParameter("Rotations ZZ [rad]", "Rzz", - "Rotations around Z-axis in Global Axis." + note, GH_ParamAccess.tree); - pManager.AddGenericParameter("Rotations |XYZ| [rad]", "|R|", - "Combined |XXYYZZ| Rotations." + note, GH_ParamAccess.tree); } protected override void SolveInternal(IGH_DataAccess da) { @@ -147,57 +137,26 @@ protected override void SolveInternal(IGH_DataAccess da) { continue; } - Parallel.For(0, 2, thread => // split computation in two for xyz and xxyyzz - { - switch (thread) { - case 0: { - foreach (KeyValuePair> kvp in + foreach (KeyValuePair> kvp in vals[perm - 1].XyzResults) { - int elementId = kvp.Key; - ConcurrentDictionary res = kvp.Value; - if (res.Count == 0) { - continue; - } - - var path = new GH_Path(result.CaseId, - result.SelectedPermutationIds == null ? 0 : perm, elementId); - - outTransX.AddRange( - res.Select(x => new GH_UnitNumber(x.Value.X.ToUnit(_lengthUnit))), - path); // use ToUnit to capture changes in dropdown - outTransY.AddRange( - res.Select(x => new GH_UnitNumber(x.Value.Y.ToUnit(_lengthUnit))), path); - outTransZ.AddRange( - res.Select(x => new GH_UnitNumber(x.Value.Z.ToUnit(_lengthUnit))), path); - outTransXyz.AddRange( - res.Select(x => new GH_UnitNumber(x.Value.Xyz.ToUnit(_lengthUnit))), path); - } - - break; - } - case 1: { - foreach (KeyValuePair> kvp in - vals[perm - 1].XxyyzzResults) { - int elementId = kvp.Key; - ConcurrentDictionary res = kvp.Value; - if (res.Count == 0) { - continue; - } - - var path = new GH_Path(result.CaseId, - result.SelectedPermutationIds == null ? 0 : perm, elementId); - - outRotX.AddRange(res.Select(x => new GH_UnitNumber(x.Value.X)), - path); // always use [rad] units - outRotY.AddRange(res.Select(x => new GH_UnitNumber(x.Value.Y)), path); - outRotZ.AddRange(res.Select(x => new GH_UnitNumber(x.Value.Z)), path); - outRotXyz.AddRange(res.Select(x => new GH_UnitNumber(x.Value.Xyz)), path); - } - - break; - } + int elementId = kvp.Key; + ConcurrentDictionary res = kvp.Value; + if (res.Count == 0) { + continue; } - }); + + var path = new GH_Path(result.CaseId, + result.SelectedPermutationIds == null ? 0 : perm, elementId); + // use ToUnit to capture changes in dropdown + outTransX.AddRange( + res.Select(x => new GH_UnitNumber(x.Value.X.ToUnit(_lengthUnit))), path); + outTransY.AddRange( + res.Select(x => new GH_UnitNumber(x.Value.Y.ToUnit(_lengthUnit))), path); + outTransZ.AddRange( + res.Select(x => new GH_UnitNumber(x.Value.Z.ToUnit(_lengthUnit))), path); + outTransXyz.AddRange( + res.Select(x => new GH_UnitNumber(x.Value.Xyz.ToUnit(_lengthUnit))), path); + } } } @@ -205,10 +164,6 @@ protected override void SolveInternal(IGH_DataAccess da) { da.SetDataTree(1, outTransY); da.SetDataTree(2, outTransZ); da.SetDataTree(3, outTransXyz); - da.SetDataTree(4, outRotX); - da.SetDataTree(5, outRotY); - da.SetDataTree(6, outRotZ); - da.SetDataTree(7, outRotXyz); PostHog.Result(result.Type, 3, GsaResultsValues.ResultType.Displacement); } From a8f035168b1400fa7b1b134db7825f33b1b77a50 Mon Sep 17 00:00:00 2001 From: Kristjan Nielsen Date: Tue, 10 Oct 2023 15:20:43 +0200 Subject: [PATCH 3/5] cleanup --- GsaGH/Components/5_Results/Element3dDisplacements.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/GsaGH/Components/5_Results/Element3dDisplacements.cs b/GsaGH/Components/5_Results/Element3dDisplacements.cs index cc6a3297c..6c2f02006 100644 --- a/GsaGH/Components/5_Results/Element3dDisplacements.cs +++ b/GsaGH/Components/5_Results/Element3dDisplacements.cs @@ -95,10 +95,6 @@ protected override void SolveInternal(IGH_DataAccess da) { var outTransY = new DataTree(); var outTransZ = new DataTree(); var outTransXyz = new DataTree(); - var outRotX = new DataTree(); - var outRotY = new DataTree(); - var outRotZ = new DataTree(); - var outRotXyz = new DataTree(); var ghTypes = new List(); if (!da.GetDataList(0, ghTypes)) { From b9f765be65fbaf7c6236dbbcd259aebbf3f7786b Mon Sep 17 00:00:00 2001 From: Kristjan Nielsen Date: Tue, 10 Oct 2023 17:54:31 +0200 Subject: [PATCH 4/5] update test --- GsaGHTests/3_Components/ComponentsTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GsaGHTests/3_Components/ComponentsTests.cs b/GsaGHTests/3_Components/ComponentsTests.cs index 624352502..e32a7924b 100644 --- a/GsaGHTests/3_Components/ComponentsTests.cs +++ b/GsaGHTests/3_Components/ComponentsTests.cs @@ -125,10 +125,10 @@ public void WhenInitialiseDropdowns_ThenDropDownItems_ShouldBeNull(Type t) { [InlineData(typeof(Contour2dResults), "Displacement", "Footfall")] [InlineData(typeof(Element2dDisplacements), "mm", "ft")] [InlineData(typeof(Element2dForcesAndMoments), "kN/m", "kipf/ft")] - [InlineData(typeof(Element2dStresses), "Megapascal", "kipf/ft²")] + [InlineData(typeof(Element2dStresses), "MPa", "kipf/ft²")] [InlineData(typeof(Contour3dResults), "Displacement", "Stress")] [InlineData(typeof(Element3dDisplacements), "mm", "ft")] - [InlineData(typeof(Element3dStresses), "Megapascal", "kipf/ft²")] + [InlineData(typeof(Element3dStresses), "MPa", "kipf/ft²")] [InlineData(typeof(GlobalPerformanceResults), "t", "slug")] [InlineData(typeof(ContourNodeResults), "Displacement", "Footfall")] [InlineData(typeof(NodeDisplacements), "mm", "ft")] From c0c2008d2e8bf283a0521abd5fd2315a59528222 Mon Sep 17 00:00:00 2001 From: Kristjan Nielsen Date: Tue, 10 Oct 2023 18:44:51 +0200 Subject: [PATCH 5/5] use default colour for annotation if user has not set an input --- GsaGH/Components/6_Display/ResultDiagrams.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GsaGH/Components/6_Display/ResultDiagrams.cs b/GsaGH/Components/6_Display/ResultDiagrams.cs index 9269b8011..0f8270dca 100644 --- a/GsaGH/Components/6_Display/ResultDiagrams.cs +++ b/GsaGH/Components/6_Display/ResultDiagrams.cs @@ -306,6 +306,10 @@ private List GenerateAnnotations( = $"{Math.Round(valResult * valueScaleFactor, significantDigits)} {Message}"; } + if (color == Color.Empty) { + color = (Color)annotation.Colour; + } + diagramAnnotations.Add(new GsaAnnotationGoo( new GsaAnnotationDot(location, color, valueToAnnotate))); }