Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GsaGH-389 remove tuples #543

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions GsaGH/Components/5_Results/NodeDisplacements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
return;
}

(List<GsaResultsValues> vals, List<int> sortedIDs)
= result.NodeDisplacementValues(nodeList, _lengthUnit);
List<GsaResultsValues> vals = result.NodeDisplacementValues(nodeList, _lengthUnit);

List<int> permutations = result.SelectedPermutationIds ?? new List<int>() {
1,
Expand All @@ -161,31 +160,32 @@ protected override void SolveInternal(IGH_DataAccess da) {
{
switch (item) {
case 0: {
foreach (int id in sortedIDs) {
ids.Add(id);
ConcurrentDictionary<int, GsaResultQuantity> res = vals[perm - 1].XyzResults[id];
GsaResultQuantity values = res[0]; // there is only one result per node
transX.Add(
new GH_UnitNumber(
values.X.ToUnit(_lengthUnit))); // use ToUnit to capture changes in dropdown
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_lengthUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_lengthUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_lengthUnit)));
foreach (int id in vals[perm - 1].Ids) {
tlmnrnhrdt marked this conversation as resolved.
Show resolved Hide resolved
ids.Add(id);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XyzResults[id][0];
// use ToUnit to capture changes in dropdown
transX.Add(new GH_UnitNumber(values.X.ToUnit(_lengthUnit)));
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_lengthUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_lengthUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_lengthUnit)));
}

break;
}

break;
}
case 1: {
foreach (GsaResultQuantity values in sortedIDs
.Select(id => vals[perm - 1].XxyyzzResults[id]).Select(res => res[0])) {
rotX.Add(new GH_UnitNumber(values.X));
rotY.Add(new GH_UnitNumber(values.Y));
rotZ.Add(new GH_UnitNumber(values.Z));
rotXyz.Add(new GH_UnitNumber(values.Xyz));
foreach (int id in vals[perm - 1].Ids) {
ids.Add(id);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XyzResults[id][0];
rotX.Add(new GH_UnitNumber(values.X));
rotY.Add(new GH_UnitNumber(values.Y));
rotZ.Add(new GH_UnitNumber(values.Z));
rotXyz.Add(new GH_UnitNumber(values.Xyz));
}

break;
}

break;
}
}
});

Expand Down
49 changes: 25 additions & 24 deletions GsaGH/Components/5_Results/ReactionForces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
return;
}

(List<GsaResultsValues> vals, List<int> sortedIDs)
List<GsaResultsValues> vals
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit);

List<int> permutations = result.SelectedPermutationIds ?? new List<int>() {
Expand All @@ -182,32 +182,33 @@ protected override void SolveInternal(IGH_DataAccess da) {
{
switch (item) {
case 0: {
foreach (int key in sortedIDs) {
ids.Add(key);
ConcurrentDictionary<int, GsaResultQuantity> res = vals[perm - 1].XyzResults[key];
GsaResultQuantity values = res[0]; // there is only one result per node
transX.Add(
new GH_UnitNumber(
values.X.ToUnit(_forceUnit))); // use ToUnit to capture changes in dropdown
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_forceUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_forceUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_forceUnit)));
foreach (int key in vals[perm - 1].Ids) {
ids.Add(key);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XyzResults[key][0];
// use ToUnit to capture changes in dropdown
transX.Add(new GH_UnitNumber(values.X.ToUnit(_forceUnit)));
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_forceUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_forceUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_forceUnit)));
}

break;
}

break;
}
case 1: {
foreach (GsaResultQuantity values in sortedIDs
.Select(id => vals[perm - 1].XxyyzzResults[id]).Select(res => res[0])) {
rotX.Add(new GH_UnitNumber(
values.X.ToUnit(_momentUnit))); // use ToUnit to capture changes in dropdown
rotY.Add(new GH_UnitNumber(values.Y.ToUnit(_momentUnit)));
rotZ.Add(new GH_UnitNumber(values.Z.ToUnit(_momentUnit)));
rotXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_momentUnit)));
foreach (int key in vals[perm - 1].Ids) {
ids.Add(key);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XxyyzzResults[key][0];
// use ToUnit to capture changes in dropdown
rotX.Add(new GH_UnitNumber(values.X.ToUnit(_momentUnit)));
rotY.Add(new GH_UnitNumber(values.Y.ToUnit(_momentUnit)));
rotZ.Add(new GH_UnitNumber(values.Z.ToUnit(_momentUnit)));
rotXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_momentUnit)));
}

break;
}

break;
}
}
});

Expand Down
51 changes: 25 additions & 26 deletions GsaGH/Components/5_Results/SpringReactionForces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
return;
}

Tuple<List<GsaResultsValues>, List<int>> resultgetter
List<GsaResultsValues> vals
= result.SpringReactionForceValues(nodeList, _forceUnit, _momentUnit);
List<GsaResultsValues> vals = resultgetter.Item1;
List<int> sortedIDs = resultgetter.Item2;

List<int> permutations = result.SelectedPermutationIds ?? new List<int>() {
1,
Expand All @@ -184,32 +182,33 @@ Tuple<List<GsaResultsValues>, List<int>> resultgetter
{
switch (item) {
case 0: {
foreach (int id in sortedIDs) {
ids.Add(id);
ConcurrentDictionary<int, GsaResultQuantity> res = vals[perm - 1].XyzResults[id];
GsaResultQuantity values = res[0]; // there is only one result per node
transX.Add(
new GH_UnitNumber(
values.X.ToUnit(_forceUnit))); // use ToUnit to capture changes in dropdown
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_forceUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_forceUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_forceUnit)));
foreach (int key in vals[perm - 1].Ids) {
ids.Add(key);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XyzResults[key][0];
// use ToUnit to capture changes in dropdown
transX.Add(new GH_UnitNumber(values.X.ToUnit(_forceUnit)));
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_forceUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_forceUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_forceUnit)));
}

break;
}

break;
}
case 1: {
foreach (GsaResultQuantity values in sortedIDs
.Select(id => vals[perm - 1].XxyyzzResults[id]).Select(res => res[0])) {
rotX.Add(new GH_UnitNumber(
values.X.ToUnit(_momentUnit))); // use ToUnit to capture changes in dropdown
rotY.Add(new GH_UnitNumber(values.Y.ToUnit(_momentUnit)));
rotZ.Add(new GH_UnitNumber(values.Z.ToUnit(_momentUnit)));
rotXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_momentUnit)));
foreach (int key in vals[perm - 1].Ids) {
ids.Add(key);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XxyyzzResults[key][0];
// use ToUnit to capture changes in dropdown
rotX.Add(new GH_UnitNumber(values.X.ToUnit(_momentUnit)));
rotY.Add(new GH_UnitNumber(values.Y.ToUnit(_momentUnit)));
rotZ.Add(new GH_UnitNumber(values.Z.ToUnit(_momentUnit)));
rotXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_momentUnit)));
}

break;
}

break;
}
}
});

Expand Down
10 changes: 3 additions & 7 deletions GsaGH/Components/6_Display/ContourNodeResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,16 +482,12 @@ protected override void SolveInternal(IGH_DataAccess da) {
var res = new GsaResultsValues();
switch (_mode) {
case FoldMode.Displacement:
Tuple<List<GsaResultsValues>, List<int>> nodedisp
= result.NodeDisplacementValues(nodeList, _lengthResultUnit);
res = nodedisp.Item1[0];
res = result.NodeDisplacementValues(nodeList, _lengthResultUnit)[0];
break;

case FoldMode.Reaction:
Tuple<List<GsaResultsValues>, List<int>> resultgetter
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit);
res = resultgetter.Item1[0];
nodeList = string.Join(" ", resultgetter.Item2);
res = result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit)[0];
nodeList = string.Join(" ", res.Ids);
break;

case FoldMode.Footfall:
Expand Down
8 changes: 3 additions & 5 deletions GsaGH/Components/6_Display/ReactionForceDiagrams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,9 @@ protected override void SolveInternal(IGH_DataAccess da) {
result = (ghObject.Value as GsaResultGoo).Value;
string nodeList = Inputs.GetNodeListDefinition(this, da, 1, result.Model);

Tuple<List<GsaResultsValues>, List<int>> reactionForceValues
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit);
GsaResultsValues forceValues = reactionForceValues.Item1[0];
nodeList = string.Join(" ", reactionForceValues.Item2);

GsaResultsValues forceValues
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit)[0];
nodeList = string.Join(" ", forceValues.Ids);
LengthUnit lengthUnit = GetLengthUnit(result);

ReadOnlyDictionary<int, Node> gsaFilteredNodes = result.Model.Model.Nodes(nodeList);
Expand Down
12 changes: 4 additions & 8 deletions GsaGH/Components/GraveyardComp/NodeContourResults_OBSOLETE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,13 @@ protected override void SolveInternal(IGH_DataAccess da) {
var res = new GsaResultsValues();
switch (_mode) {
case FoldMode.Displacement:
Tuple<List<GsaResultsValues>, List<int>> nodedisp
= result.NodeDisplacementValues(nodeList, _lengthUnit);
res = nodedisp.Item1[0];
res = result.NodeDisplacementValues(nodeList, _lengthUnit)[0];
break;

case FoldMode.Reaction:
Tuple<List<GsaResultsValues>, List<int>> resultgetter
= result.NodeReactionForceValues(nodeList, DefaultUnits.ForceUnit,
DefaultUnits.MomentUnit);
res = resultgetter.Item1[0];
nodeList = string.Join(" ", resultgetter.Item2);
res = result.NodeReactionForceValues(nodeList, DefaultUnits.ForceUnit,
DefaultUnits.MomentUnit)[0];
nodeList = string.Join(" ", res.Ids);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ protected override void SolveInternal(IGH_DataAccess da) {
result = (ghObject.Value as GsaResultGoo).Value;
string nodeList = Inputs.GetNodeListDefinition(this, da, 1, result.Model);

Tuple<List<GsaResultsValues>, List<int>> reactionForceValues
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit);
GsaResultsValues forceValues = reactionForceValues.Item1[0];
nodeList = string.Join(" ", reactionForceValues.Item2);
GsaResultsValues forceValues
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit)[0];
nodeList = string.Join(" ", forceValues.Ids);

LengthUnit lengthUnit = GetLengthUnit(result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,8 @@ protected override void SolveInternal(IGH_DataAccess da) {
result = (ghObject.Value as GsaResultGoo).Value;
string nodeList = Inputs.GetNodeListDefinition(this, da, 1, result.Model);

Tuple<List<GsaResultsValues>, List<int>> reactionForceValues
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit);
GsaResultsValues forceValues = reactionForceValues.Item1[0];
nodeList = string.Join(" ", reactionForceValues.Item2);
GsaResultsValues forceValues = result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit)[0];
nodeList = string.Join(" ", forceValues.Ids);

LengthUnit lengthUnit = GetLengthUnit(result);

Expand Down
49 changes: 25 additions & 24 deletions GsaGH/Components/GraveyardComp/ReactionForce_OBSOLETE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected override void SolveInternal(IGH_DataAccess da) {
return;
}

(List<GsaResultsValues> vals, List<int> sortedIDs)
List<GsaResultsValues> vals
= result.NodeReactionForceValues(nodeList, _forceUnit, _momentUnit);

List<int> permutations = result.SelectedPermutationIds ?? new List<int>() {
Expand All @@ -189,32 +189,33 @@ protected override void SolveInternal(IGH_DataAccess da) {
{
switch (item) {
case 0: {
foreach (int key in sortedIDs) {
ids.Add(key);
ConcurrentDictionary<int, GsaResultQuantity> res = vals[perm - 1].XyzResults[key];
GsaResultQuantity values = res[0]; // there is only one result per node
transX.Add(
new GH_UnitNumber(
values.X.ToUnit(_forceUnit))); // use ToUnit to capture changes in dropdown
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_forceUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_forceUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_forceUnit)));
foreach (int key in vals[perm - 1].Ids) {
ids.Add(key);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XyzResults[key][0];
// use ToUnit to capture changes in dropdown
transX.Add(new GH_UnitNumber(values.X.ToUnit(_forceUnit)));
transY.Add(new GH_UnitNumber(values.Y.ToUnit(_forceUnit)));
transZ.Add(new GH_UnitNumber(values.Z.ToUnit(_forceUnit)));
transXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_forceUnit)));
}

break;
}

break;
}
case 1: {
foreach (GsaResultQuantity values in sortedIDs
.Select(id => vals[perm - 1].XxyyzzResults[id]).Select(res => res[0])) {
rotX.Add(new GH_UnitNumber(
values.X.ToUnit(_momentUnit))); // use ToUnit to capture changes in dropdown
rotY.Add(new GH_UnitNumber(values.Y.ToUnit(_momentUnit)));
rotZ.Add(new GH_UnitNumber(values.Z.ToUnit(_momentUnit)));
rotXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_momentUnit)));
foreach (int key in vals[perm - 1].Ids) {
ids.Add(key);
// there is only one result per node
GsaResultQuantity values = vals[perm - 1].XxyyzzResults[key][0];
// use ToUnit to capture changes in dropdown
rotX.Add(new GH_UnitNumber(values.X.ToUnit(_momentUnit)));
rotY.Add(new GH_UnitNumber(values.Y.ToUnit(_momentUnit)));
rotZ.Add(new GH_UnitNumber(values.Z.ToUnit(_momentUnit)));
rotXyz.Add(new GH_UnitNumber(values.Xyz.ToUnit(_momentUnit)));
}

break;
}

break;
}
}
});

Expand Down
Loading