Skip to content

Commit 59f8333

Browse files
author
Fraser Greenroyd
authored
6.3 Deployment (#358)
2 parents 33dc242 + 2af772c commit 59f8333

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+951
-294
lines changed

MidasCivil_Adapter/CRUD/Create/Elements/RigidLink.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private bool CreateCollection(IEnumerable<RigidLink> links)
4242
{
4343
string midasBoundaryGroup = Adapters.MidasCivil.Convert.FromTag(link.Name);
4444
CompareGroup(midasBoundaryGroup, boundaryGroupPath);
45-
midasRigidLinks.Add(Adapters.MidasCivil.Convert.FromRigidLink(link));
45+
midasRigidLinks.Add(Adapters.MidasCivil.Convert.FromRigidLink(link, m_midasCivilVersion));
4646
}
4747

4848
File.AppendAllLines(path, midasRigidLinks);

MidasCivil_Adapter/CRUD/Create/Properties/SectionProperties.cs

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.IO;
2424
using System.Collections.Generic;
2525
using BH.oM.Structure.SectionProperties;
26+
using BH.oM.Spatial.ShapeProfiles;
2627

2728
namespace BH.Adapter.MidasCivil
2829
{
@@ -34,17 +35,61 @@ public partial class MidasCivilAdapter
3435

3536
private bool CreateCollection(IEnumerable<ISectionProperty> sectionProperties)
3637
{
37-
string path = CreateSectionFile("SECTION");
38+
string sectionPath = CreateSectionFile("SECTION");
39+
string pscSectionPath = CreateSectionFile("SECT-PSCVALUE");
3840
List<string> midasSectionProperties = new List<string>();
41+
List<string> midasPSCSectionProperties = new List<string>();
3942

4043
foreach (ISectionProperty sectionProperty in sectionProperties)
4144
{
4245
List<string> midasSectionProperty = Adapters.MidasCivil.Convert.FromSectionProperty(sectionProperty, m_lengthUnit, m_sectionPropertyCharacterLimit);
4346
if (midasSectionProperty != null)
44-
midasSectionProperties.AddRange(midasSectionProperty);
47+
{
48+
if (sectionProperty is SteelSection)
49+
{
50+
SteelSection steelSection = (SteelSection)sectionProperty;
51+
if (steelSection.SectionProfile is FreeFormProfile)
52+
midasPSCSectionProperties.AddRange(midasSectionProperty);
53+
else
54+
midasSectionProperties.AddRange(midasSectionProperty);
55+
}
56+
else if (sectionProperty is ConcreteSection)
57+
{
58+
ConcreteSection concreteSection = (ConcreteSection)sectionProperty;
59+
if (concreteSection.SectionProfile is FreeFormProfile)
60+
midasPSCSectionProperties.AddRange(midasSectionProperty);
61+
else
62+
midasSectionProperties.AddRange(midasSectionProperty);
63+
}
64+
else if (sectionProperty is TimberSection)
65+
{
66+
TimberSection timberSection = (TimberSection)sectionProperty;
67+
if (timberSection.SectionProfile is FreeFormProfile)
68+
midasPSCSectionProperties.AddRange(midasSectionProperty);
69+
else
70+
midasSectionProperties.AddRange(midasSectionProperty);
71+
}
72+
else if (sectionProperty is AluminiumSection)
73+
{
74+
AluminiumSection aluminiumSection = (AluminiumSection)sectionProperty;
75+
if (aluminiumSection.SectionProfile is FreeFormProfile)
76+
midasPSCSectionProperties.AddRange(midasSectionProperty);
77+
else
78+
midasSectionProperties.AddRange(midasSectionProperty);
79+
}
80+
else
81+
{
82+
GenericSection steelSection = (GenericSection)sectionProperty;
83+
if (steelSection.SectionProfile is FreeFormProfile)
84+
midasPSCSectionProperties.AddRange(midasSectionProperty);
85+
else
86+
midasSectionProperties.AddRange(midasSectionProperty);
87+
}
88+
}
4589
}
4690

47-
File.AppendAllLines(path, midasSectionProperties);
91+
File.AppendAllLines(sectionPath, midasSectionProperties);
92+
File.AppendAllLines(pscSectionPath, midasPSCSectionProperties);
4893

4994
return true;
5095
}

MidasCivil_Adapter/CRUD/Read/Elements/Bars.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,16 @@ private List<Bar> ReadBars(List<string> ids = null)
5555
}
5656
}
5757

58-
IEnumerable<Node> bhomNodesList = ReadNodes();
59-
Dictionary<string, Node> bhomNodes = bhomNodesList.ToDictionary(
60-
x => x.AdapterId<string>(typeof(MidasCivilId)));
58+
IEnumerable<Node> bhomNodesList = GetCachedOrRead<Node>();
59+
Dictionary<string, Node> bhomNodes = bhomNodesList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
6160

6261
IEnumerable<BarRelease> bhomBarReleaseList = ReadBarReleases();
6362
Dictionary<string, BarRelease> bhomBarReleases = bhomBarReleaseList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
6463

65-
IEnumerable<ISectionProperty> bhomSectionPropertyList = ReadSectionProperties();
66-
Dictionary<string, ISectionProperty> bhomSectionProperties = bhomSectionPropertyList.ToDictionary(
67-
x => x.AdapterId<string>(typeof(MidasCivilId)));
64+
IEnumerable<ISectionProperty> bhomSectionPropertyList = GetCachedOrRead<ISectionProperty>();
65+
Dictionary<string, ISectionProperty> bhomSectionProperties = bhomSectionPropertyList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
6866

69-
IEnumerable<IMaterialFragment> bhomMaterialList = ReadMaterials();
67+
IEnumerable<IMaterialFragment> bhomMaterialList = GetCachedOrRead<IMaterialFragment>();
7068
Dictionary<string, IMaterialFragment> bhomMaterials = bhomMaterialList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
7169

7270
Dictionary<string, List<int>> barReleaseAssignments = GetBarReleaseAssignments("FRAME-RLS", "barRelease");

MidasCivil_Adapter/CRUD/Read/Elements/FEMeshes.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,13 @@ private List<FEMesh> ReadFEMeshes(List<string> ids = null)
4444
List<string> meshText = elementsText.Where(x => x.Contains("PLATE")).ToList();
4545
Dictionary<string, List<int>> elementGroups = GetTags("GROUP", 2);
4646

47-
IEnumerable<Node> bhomNodesList = ReadNodes();
48-
Dictionary<string, Node> bhomNodes = bhomNodesList.ToDictionary(
49-
x => x.AdapterId<string>(typeof(MidasCivilId)));
47+
IEnumerable<Node> bhomNodesList = GetCachedOrRead<Node>();
48+
Dictionary<string, Node> bhomNodes = bhomNodesList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
5049

51-
IEnumerable<ISurfaceProperty> bhomSurfacePropertiesList = ReadSurfaceProperties();
52-
Dictionary<string, ISurfaceProperty> bhomSuraceProperties = bhomSurfacePropertiesList.ToDictionary(
53-
x => x.AdapterId<string>(typeof(MidasCivilId)));
50+
IEnumerable<ISurfaceProperty> bhomSurfacePropertiesList = GetCachedOrRead<ISurfaceProperty>();
51+
Dictionary<string, ISurfaceProperty> bhomSuraceProperties = bhomSurfacePropertiesList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
5452

55-
IEnumerable<IMaterialFragment> bhomMaterialList = ReadMaterials();
53+
IEnumerable<IMaterialFragment> bhomMaterialList = GetCachedOrRead<IMaterialFragment>();
5654
Dictionary<string, IMaterialFragment> bhomMaterials = bhomMaterialList.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
5755

5856
foreach (string mesh in meshText)

MidasCivil_Adapter/CRUD/Read/Elements/Nodes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private List<Node> ReadNodes(List<string> ids = null)
4646

4747
Dictionary<string, List<int>> nodeGroups = GetTags("GROUP", 1);
4848

49-
List<Constraint6DOF> supportsList = Read6DOFConstraints();
49+
List<Constraint6DOF> supportsList = GetCachedOrRead<Constraint6DOF>();
5050
Dictionary<string, Constraint6DOF> supports = supportsList.ToDictionary(x => x.Name.ToString());
5151

5252
Dictionary<string, List<int>> supportAssignments = GetPropertyAssignments("CONSTRAINT", "Support");

MidasCivil_Adapter/CRUD/Read/Elements/RigidLinks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ private List<RigidLink> ReadRigidLinks(List<string> ids = null)
4040
List<RigidLink> bhomRigidLinks = new List<RigidLink>();
4141

4242
List<string> linkText = GetSectionText("RIGIDLINK");
43-
List<Node> nodes = ReadNodes();
43+
List<Node> nodes = GetCachedOrRead<Node>();
4444
Dictionary<string, Node> nodeDictionary = nodes.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
4545

4646
int count = 0;
4747

4848
foreach (string link in linkText)
4949
{
50-
RigidLink bhomRigidLink = Adapters.MidasCivil.Convert.ToRigidLink(link, nodeDictionary, count);
50+
RigidLink bhomRigidLink = Adapters.MidasCivil.Convert.ToRigidLink(link, nodeDictionary, count, m_midasCivilVersion);
5151
bhomRigidLinks.Add(bhomRigidLink);
5252

5353
if (string.IsNullOrWhiteSpace(link.Split(',')[3].Trim()))

MidasCivil_Adapter/CRUD/Read/Loads/AreaDifferentialTemperatureLoad.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ private List<ILoad> ReadAreaDifferentialTemperatureLoads(List<string> ids = null
3838
{
3939
List<ILoad> bhomAreaDifferentialTemperatureLoads = new List<ILoad>();
4040

41-
List<Loadcase> bhomLoadcases = ReadLoadcases();
42-
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(
43-
x => x.Name);
41+
List<Loadcase> bhomLoadcases = GetCachedOrRead<Loadcase>();
42+
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(x => x.Name);
4443

4544
string[] loadcaseFolders = Directory.GetDirectories(m_directory + "\\TextFiles");
4645

@@ -81,9 +80,9 @@ private List<ILoad> ReadAreaDifferentialTemperatureLoads(List<string> ids = null
8180
}
8281
else
8382
{
84-
Compute.RecordWarning("No Area Uniform Temperature Load is detected at Element number "
85-
+ areaDifferentialTempatureElements[i].Trim().ToString()+
86-
". \n Area Differential Temperature load will be applied at the centroid of the cross section at Element number"
83+
Compute.RecordWarning("No Area Uniform Temperature Load is detected at Element number "
84+
+ areaDifferentialTempatureElements[i].Trim().ToString() +
85+
". \n Area Differential Temperature load will be applied at the centroid of the cross section at Element number"
8786
+ areaDifferentialTempatureElements[i].Trim().ToString());
8887
differentialDelimitted.Add(string.Format("0"));
8988
}

MidasCivil_Adapter/CRUD/Read/Loads/AreaUniformTemperatureLoad.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ private List<ILoad> ReadAreaUniformTemperatureLoads(List<string> ids = null)
3737
{
3838
List<ILoad> bhomAreaUniformTemperatureLoads = new List<ILoad>();
3939

40-
List<Loadcase> bhomLoadcases = ReadLoadcases();
41-
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(
42-
x => x.Name);
40+
List<Loadcase> bhomLoadcases = GetCachedOrRead<Loadcase>();
41+
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(x => x.Name);
4342

4443
string[] loadcaseFolders = Directory.GetDirectories(m_directory + "\\TextFiles");
4544

@@ -65,9 +64,8 @@ private List<ILoad> ReadAreaUniformTemperatureLoads(List<string> ids = null)
6564

6665
if (feMeshComparison.Count != 0)
6766
{
68-
List<FEMesh> bhomMeshes = ReadFEMeshes();
69-
Dictionary<string, FEMesh> FEMeshDictionary = bhomMeshes.ToDictionary(
70-
x => x.AdapterId<string>(typeof(MidasCivilId)));
67+
List<FEMesh> bhomMeshes = GetCachedOrRead<FEMesh>();
68+
Dictionary<string, FEMesh> FEMeshDictionary = bhomMeshes.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
7169
List<string> distinctFEMeshLoads = feMeshComparison.Distinct().ToList();
7270

7371
foreach (string distinctFEMeshLoad in distinctFEMeshLoads)

MidasCivil_Adapter/CRUD/Read/Loads/AreaUniformlyDistributedLoad.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ private List<ILoad> ReadAreaUniformlyDistributedLoads(List<string> ids = null)
3737
{
3838
List<ILoad> bhomAreaUniformlyDistributedLoads = new List<ILoad>();
3939

40-
List<Loadcase> bhomLoadcases = ReadLoadcases();
41-
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(
42-
x => x.Name);
40+
List<Loadcase> bhomLoadcases = GetCachedOrRead<Loadcase>();
41+
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(x => x.Name);
4342

4443
string[] loadcaseFolders = Directory.GetDirectories(m_directory + "\\TextFiles");
4544

@@ -65,9 +64,8 @@ private List<ILoad> ReadAreaUniformlyDistributedLoads(List<string> ids = null)
6564

6665
if (feMeshComparison.Count != 0)
6766
{
68-
List<FEMesh> bhomMeshes = ReadFEMeshes();
69-
Dictionary<string, FEMesh> FEMeshDictionary = bhomMeshes.ToDictionary(
70-
x => x.AdapterId<string>(typeof(MidasCivilId)));
67+
List<FEMesh> bhomMeshes = GetCachedOrRead<FEMesh>();
68+
Dictionary<string, FEMesh> FEMeshDictionary = bhomMeshes.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
7169
List<string> distinctFEMeshLoads = feMeshComparison.Distinct().ToList();
7270

7371
foreach (string distinctFEMeshLoad in distinctFEMeshLoads)

MidasCivil_Adapter/CRUD/Read/Loads/BarDifferentialTemperatureLoad.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ private List<ILoad> ReadBarDifferentialTemperatureLoads(List<string> ids = null)
4141
{
4242
List<ILoad> bhomBarDifferentialTemperatureLoads = new List<ILoad>();
4343

44-
List<Loadcase> bhomLoadcases = ReadLoadcases();
45-
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(
46-
x => x.Name);
44+
List<Loadcase> bhomLoadcases = GetCachedOrRead<Loadcase>();
45+
Dictionary<string, Loadcase> loadcaseDictionary = bhomLoadcases.ToDictionary(x => x.Name);
4746
string[] loadcaseFolders = Directory.GetDirectories(m_directory + "\\TextFiles");
4847
int i = 1;
4948
foreach (string loadcaseFolder in loadcaseFolders)
@@ -77,7 +76,7 @@ private List<ILoad> ReadBarDifferentialTemperatureLoads(List<string> ids = null)
7776
}
7877
if (barDifferntialTemperatureSets.Count != 0)
7978
{
80-
List<Bar> bhomBars = ReadBars();
79+
List<Bar> bhomBars = GetCachedOrRead<Bar>();
8180
Dictionary<string, Bar> barDictionary = bhomBars.ToDictionary(x => x.AdapterId<string>(typeof(MidasCivilId)));
8281
for (int j = 0; j < barDifferntialTemperatureSets.Count; j++)
8382
{

0 commit comments

Comments
 (0)