Skip to content

Commit

Permalink
Merge branch 'main' into release/GsaGH-1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tlmnrnhrdt authored Oct 11, 2023
2 parents feb239e + 6fbc436 commit cff39c1
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 1 deletion.
2 changes: 2 additions & 0 deletions GsaGH/Components/3_Loads/CreateBeamThermalLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ protected override void SolveInternal(IGH_DataAccess da) {
case GsaElement1dGoo element1dGoo:
beamThermalLoad.RefObjectGuid = element1dGoo.Value.Guid;
beamThermalLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
beamThermalLoad.ReferenceType = ReferenceType.Element;
break;

case GsaMember1dGoo member1dGoo:
beamThermalLoad.RefObjectGuid = member1dGoo.Value.Guid;
beamThermalLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
beamThermalLoad.ReferenceType = ReferenceType.Member;
break;

case GsaMaterialGoo materialGoo:
Expand Down
8 changes: 8 additions & 0 deletions GsaGH/Components/3_Loads/CreateGravityLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,25 @@ protected override void SolveInstance(IGH_DataAccess da) {
case GsaElement2dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Element;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaMember1dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Member;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
break;
}
case GsaMember2dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Member;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
break;
}
case GsaMember3dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Member;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Member;
break;
}
case GsaMaterialGoo value: {
Expand All @@ -108,21 +112,25 @@ protected override void SolveInstance(IGH_DataAccess da) {
}
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaSectionGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaProperty2dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
case GsaProperty3dGoo value: {
gravityLoad.RefObjectGuid = value.Value.Guid;
gravityLoad.ReferenceType = ReferenceType.Property;
gravityLoad.ApiLoad.EntityType = GsaAPI.EntityType.Element;
break;
}
default: {
Expand Down
2 changes: 1 addition & 1 deletion GsaGH/Parameters/3_Loads/GsaFaceThermalLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public string Name {
set => ApiLoad.Name = value;
}
public GsaFaceThermalLoad() {
ApiLoad = new FaceThermalLoad ();
ApiLoad = new FaceThermalLoad();
}

public IGsaLoad Duplicate() {
Expand Down
1 change: 1 addition & 0 deletions GsaGH/Parameters/3_Loads/GsaGravityLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public IGsaLoad Duplicate() {
ApiLoad = {
Case = ApiLoad.Case,
EntityList = ApiLoad.EntityList.ToString(),
EntityType = ApiLoad.EntityType,
Nodes = ApiLoad.Nodes.ToString(),
Name = ApiLoad.Name.ToString(),
Factor = ApiLoad.Factor,
Expand Down
34 changes: 34 additions & 0 deletions GsaGHTests/3_Components/3_Loads/CreateBeamLoadTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using GsaGH.Components;
using GsaGH.Parameters;
using GsaGH.Parameters.Enums;
using GsaGHTests.Components.Geometry;
using GsaGHTests.Helpers;
using OasysGH.Components;
using Xunit;

namespace GsaGHTests.Components.Loads {
Expand Down Expand Up @@ -163,5 +165,37 @@ public void EntityListTypeErrorTest() {
comp.Params.Output[0].CollectData();
Assert.Single(comp.RuntimeMessages(Grasshopper.Kernel.GH_RuntimeMessageLevel.Error));
}

[Fact]
public void CreateElement1dLoadTest() {
var comp = new CreateBeamLoad();
GH_OasysComponent element1dComp = CreateElement1dTests.ComponentMother();
var element1dGoo = (GsaElement1dGoo)ComponentTestHelper.GetOutput(element1dComp);

ComponentTestHelper.SetInput(comp, element1dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 6);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaBeamLoad)output.Value;
Assert.Equal(-5000, load.ApiLoad.Value(0));
Assert.Equal(ReferenceType.Element, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Element, load.ApiLoad.EntityType);
}

[Fact]
public void CreateMember1dLoadTest() {
var comp = new CreateBeamLoad();
GH_OasysComponent member1dComp = CreateMember1dTests.ComponentMother();
var member1dGoo = (GsaMember1dGoo)ComponentTestHelper.GetOutput(member1dComp);

ComponentTestHelper.SetInput(comp, member1dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 6);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaBeamLoad)output.Value;
Assert.Equal(-5000, load.ApiLoad.Value(0));
Assert.Equal(ReferenceType.Member, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Member, load.ApiLoad.EntityType);
}
}
}
34 changes: 34 additions & 0 deletions GsaGHTests/3_Components/3_Loads/CreateBeamThermalLoadTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using GsaGH.Components;
using GsaGH.Parameters;
using GsaGH.Parameters.Enums;
using GsaGHTests.Components.Geometry;
using GsaGHTests.Helpers;
using OasysGH.Components;
using Xunit;

namespace GsaGHTests.Components.Loads {
Expand Down Expand Up @@ -35,5 +37,37 @@ public void EntityListTypeErrorTest() {
comp.Params.Output[0].CollectData();
Assert.Single(comp.RuntimeMessages(Grasshopper.Kernel.GH_RuntimeMessageLevel.Error));
}

[Fact]
public void CreateElement1dLoadTest() {
var comp = new CreateBeamThermalLoad();
GH_OasysComponent element1dComp = CreateElement1dTests.ComponentMother();
var element1dGoo = (GsaElement1dGoo)ComponentTestHelper.GetOutput(element1dComp);

ComponentTestHelper.SetInput(comp, element1dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 3);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaBeamThermalLoad)output.Value;
Assert.Equal(-5, load.ApiLoad.UniformTemperature);
Assert.Equal(ReferenceType.Element, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Element, load.ApiLoad.EntityType);
}

[Fact]
public void CreateMember1dLoadTest() {
var comp = new CreateBeamThermalLoad();
GH_OasysComponent member1dComp = CreateMember1dTests.ComponentMother();
var member1dGoo = (GsaMember1dGoo)ComponentTestHelper.GetOutput(member1dComp);

ComponentTestHelper.SetInput(comp, member1dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 3);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaBeamThermalLoad)output.Value;
Assert.Equal(-5, load.ApiLoad.UniformTemperature);
Assert.Equal(ReferenceType.Member, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Member, load.ApiLoad.EntityType);
}
}
}
34 changes: 34 additions & 0 deletions GsaGHTests/3_Components/3_Loads/CreateFaceLoadTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using GsaGH.Components;
using GsaGH.Parameters;
using GsaGH.Parameters.Enums;
using GsaGHTests.Components.Geometry;
using GsaGHTests.Helpers;
using OasysGH.Components;
using Xunit;

namespace GsaGHTests.Components.Loads {
Expand Down Expand Up @@ -131,5 +133,37 @@ public void EntityListTypeErrorTest() {
comp.Params.Output[0].CollectData();
Assert.Single(comp.RuntimeMessages(Grasshopper.Kernel.GH_RuntimeMessageLevel.Error));
}

[Fact]
public void CreateElement2dLoadTest() {
var comp = new CreateFaceLoad();
GH_OasysComponent element2dComp = CreateElement2dTests.ComponentMother();
var element2dGoo = (GsaElement2dGoo)ComponentTestHelper.GetOutput(element2dComp);

ComponentTestHelper.SetInput(comp, element2dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 6);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaFaceLoad)output.Value;
Assert.Equal(-5000, load.ApiLoad.Value(0));
Assert.Equal(ReferenceType.Element, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Element, load.ApiLoad.EntityType);
}

[Fact]
public void CreateMember2dLoadTest() {
var comp = new CreateFaceLoad();
GH_OasysComponent member2dComp = CreateMember2dTests.ComponentMother();
var member2dGoo = (GsaMember2dGoo)ComponentTestHelper.GetOutput(member2dComp);

ComponentTestHelper.SetInput(comp, member2dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 6);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaFaceLoad)output.Value;
Assert.Equal(-5000, load.ApiLoad.Value(0));
Assert.Equal(ReferenceType.Member, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Member, load.ApiLoad.EntityType);
}
}
}
35 changes: 35 additions & 0 deletions GsaGHTests/3_Components/3_Loads/CreateFaceThermalLoadTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using GsaGH.Components;
using GsaGH.Parameters;
using GsaGH.Parameters.Enums;
using GsaGHTests.Components.Geometry;
using GsaGHTests.Helpers;
using OasysGH.Components;
using Xunit;

namespace GsaGHTests.Components.Loads {
Expand Down Expand Up @@ -35,5 +37,38 @@ public void EntityListTypeErrorTest() {
comp.Params.Output[0].CollectData();
Assert.Single(comp.RuntimeMessages(Grasshopper.Kernel.GH_RuntimeMessageLevel.Error));
}


[Fact]
public void CreateElement2dLoadTest() {
var comp = new CreateFaceThermalLoad();
GH_OasysComponent element2dComp = CreateElement2dTests.ComponentMother();
var element2dGoo = (GsaElement2dGoo)ComponentTestHelper.GetOutput(element2dComp);

ComponentTestHelper.SetInput(comp, element2dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 3);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaFaceThermalLoad)output.Value;
Assert.Equal(-5, load.ApiLoad.UniformTemperature);
Assert.Equal(ReferenceType.Element, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Element, load.ApiLoad.EntityType);
}

[Fact]
public void CreateMember2dLoadTest() {
var comp = new CreateFaceThermalLoad();
GH_OasysComponent member2dComp = CreateMember2dTests.ComponentMother();
var member2dGoo = (GsaMember2dGoo)ComponentTestHelper.GetOutput(member2dComp);

ComponentTestHelper.SetInput(comp, member2dGoo, 1);
ComponentTestHelper.SetInput(comp, -5, 3);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaFaceThermalLoad)output.Value;
Assert.Equal(-5, load.ApiLoad.UniformTemperature);
Assert.Equal(ReferenceType.Member, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Member, load.ApiLoad.EntityType);
}
}
}
33 changes: 33 additions & 0 deletions GsaGHTests/3_Components/3_Loads/CreateGravityLoadTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using GsaGH.Components;
using GsaGH.Parameters;
using GsaGH.Parameters.Enums;
using GsaGHTests.Components.Geometry;
using GsaGHTests.Helpers;
using OasysGH.Components;
using Rhino.Geometry;
using Xunit;

Expand All @@ -26,6 +28,37 @@ public void CreateLoadTest() {
Assert.Equal(ReferenceType.None, load.ReferenceType);
}

[Fact]
public void CreateMember1dLoadTest() {
var comp = new CreateGravityLoad();
GH_OasysComponent member1dComp = CreateMember1dTests.ComponentMother();
var member1dGoo = (GsaMember1dGoo)ComponentTestHelper.GetOutput(member1dComp);

ComponentTestHelper.SetInput(comp, 7, 0);
ComponentTestHelper.SetInput(comp, member1dGoo, 1);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaGravityLoad)output.Value;
Assert.Equal(ReferenceType.Member, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Member, load.ApiLoad.EntityType);
}

[Fact]
public void CreateMember2dLoadTest() {
var comp = new CreateGravityLoad();
GH_OasysComponent member2dComp = CreateMember2dTests.ComponentMother();
var member2dGoo = (GsaMember2dGoo)ComponentTestHelper.GetOutput(member2dComp);

ComponentTestHelper.SetInput(comp, 7, 0);
ComponentTestHelper.SetInput(comp, member2dGoo, 1);

var output = (GsaLoadGoo)ComponentTestHelper.GetOutput(comp);
var load = (GsaGravityLoad)output.Value;
Assert.Equal(7, load.LoadCase.Id);
Assert.Equal(ReferenceType.Member, load.ReferenceType);
Assert.Equal(GsaAPI.EntityType.Member, load.ApiLoad.EntityType);
}

[Fact]
public void EntityListTypeErrorTest() {
var comp = new CreateGravityLoad();
Expand Down

0 comments on commit cff39c1

Please sign in to comment.