Skip to content

Commit

Permalink
update 3d combination case result importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristjan Nielsen committed Oct 5, 2023
1 parent e807abf commit 75be8c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Binary file modified ExampleFiles/GsaGH_Example6_3dBoxes.gh
Binary file not shown.
10 changes: 8 additions & 2 deletions GsaGH/Helpers/GsaAPI/Results/CombinationCaseQuantities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,10 @@ internal static ConcurrentDictionary<int, GsaResultsValues> GetElement3DResultVa
var xyzRes = new ConcurrentDictionary<int, GsaResultQuantity>();
xyzRes.AsParallel().AsOrdered();

Parallel.For(0, values.Count,
Parallel.For(1, values.Count,
i => xyzRes.TryAdd(i, GetQuantityResult(values[i], lengthUnit)));
xyzRes[values.Count]
= GetQuantityResult(values[0], lengthUnit); // add centre point at the end
r.XyzResults.TryAdd(key, xyzRes);
});
r.UpdateMinMax();
Expand Down Expand Up @@ -485,10 +487,14 @@ internal static ConcurrentDictionary<int, GsaResultsValues> GetElement3DResultVa
var xxyyzzRes = new ConcurrentDictionary<int, GsaResultQuantity>();
xxyyzzRes.AsParallel().AsOrdered();

Parallel.For(0, values.Count, i => {
Parallel.For(1, values.Count, i => {
xyzRes.TryAdd(i, GetQuantityResult(values[i], stressUnit));
xxyyzzRes.TryAdd(i, GetQuantityResult(values[i], stressUnit, true));
});
xyzRes[values.Count]
= GetQuantityResult(values[0], stressUnit); // add centre point at the end
xxyyzzRes[values.Count] = GetQuantityResult(values[0], stressUnit, true);

r.XyzResults.TryAdd(key, xyzRes);
r.XxyyzzResults.TryAdd(key, xxyyzzRes);
});
Expand Down
16 changes: 8 additions & 8 deletions IntegrationTests/1_ExampleFiles/GsaGH_Example6_3dBoxes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ public void CombinationStress3dTest() {
var output4 = (GH_Number)param.VolatileData.get_Branch(0)[3];
var output5 = (GH_Number)param.VolatileData.get_Branch(0)[4];
var output6 = (GH_Number)param.VolatileData.get_Branch(0)[5];
Assert.Equal(5.52, output1.Value, 1);
Assert.Equal(5.24, output2.Value, 1);
Assert.Equal(24.3, output3.Value, 1);
Assert.Equal(6.069, output1.Value, 1);
Assert.Equal(6.069, output2.Value, 1);
Assert.Equal(22.93, output3.Value, 1);
Assert.Equal(0, output4.Value, 1);
Assert.Equal(3.0, output5.Value, 1);
Assert.Equal(5.44, output6.Value, 1);
Assert.Equal(2.580, output5.Value, 1);
Assert.Equal(8.023, output6.Value, 1);
}

[Fact]
Expand All @@ -75,9 +75,9 @@ public void CombinationDisplament3dTest() {
var output1 = (GH_Number)param.VolatileData.get_Branch(0)[0];
var output2 = (GH_Number)param.VolatileData.get_Branch(0)[1];
var output3 = (GH_Number)param.VolatileData.get_Branch(0)[2];
Assert.Equal(0.52031, output1.Value, 4);
Assert.Equal(0.32057, output2.Value, 4);
Assert.Equal(0.585575, output3.Value, 4);
Assert.Equal(0.5203, output1.Value, 4);
Assert.Equal(0.3206, output2.Value, 4);
Assert.Equal(0.5856, output3.Value, 4);
}

[Fact]
Expand Down

0 comments on commit 75be8c0

Please sign in to comment.