diff --git a/Libraries/LoaderCalculator.dll b/Libraries/LoaderCalculator.dll
new file mode 100644
index 0000000..d2054c8
Binary files /dev/null and b/Libraries/LoaderCalculator.dll differ
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 73e59fd..ccb845b 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -128,6 +128,8 @@
Designer
-
+
+
+
\ No newline at end of file
diff --git a/StructureHelper.sln b/StructureHelper.sln
index 587bc98..9807f81 100644
--- a/StructureHelper.sln
+++ b/StructureHelper.sln
@@ -5,7 +5,12 @@ VisualStudioVersion = 16.0.32002.261
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelper", "StructureHelper.csproj", "{BAD27E27-4444-4300-ADF8-E21042C0781D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", ".\StructureHelperTests\StructureHelperTests.csproj", "{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "StructureHelperTests\StructureHelperTests.csproj", "{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}"
+ ProjectSection(ProjectDependencies) = postProject
+ {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3} = {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +26,10 @@ Global
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Release|Any CPU.Build.0 = Release|Any CPU
+ {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/StructureHelperLogics/Data/Shapes/Center.cs b/StructureHelperLogics/Data/Shapes/Center.cs
new file mode 100644
index 0000000..15a0a06
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/Center.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ ///
+ public class Center : ICenter
+ {
+ ///
+ public double X { get; set; }
+ ///
+ public double Y { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/ICenter.cs b/StructureHelperLogics/Data/Shapes/ICenter.cs
new file mode 100644
index 0000000..0bb3cff
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/ICenter.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ ///
+ /// Interface for point of center of some shape
+ /// Интерфейс для точки центра некоторой формы
+ ///
+ public interface ICenter
+ {
+ ///
+ /// Coordinate of center of rectangle by local axis X, m
+ /// Координата центра вдоль локальной оси X, м
+ ///
+ double X { get;}
+ ///
+ /// Coordinate of center of rectangle by local axis Y, m
+ /// Координата центра вдоль локальной оси Y, м
+ ///
+ double Y { get;}
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/ICenterShape.cs b/StructureHelperLogics/Data/Shapes/ICenterShape.cs
new file mode 100644
index 0000000..d855f45
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/ICenterShape.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ public interface ICenterShape
+ {
+ ICenter Center {get;}
+ IShape Shape { get;}
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/ICircle.cs b/StructureHelperLogics/Data/Shapes/ICircle.cs
new file mode 100644
index 0000000..7adf5ee
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/ICircle.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ public interface ICircle : IShape
+ {
+ double Diameter { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperLogics/Data/Shapes/IPoint.cs
new file mode 100644
index 0000000..fe39f04
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/IPoint.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ public interface IPoint : IShape
+ {
+ double Area { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/IRectangle.cs b/StructureHelperLogics/Data/Shapes/IRectangle.cs
new file mode 100644
index 0000000..c035e1c
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/IRectangle.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ public interface IRectangle : IShape
+ {
+ ///
+ /// Width of rectangle, m
+ ///
+ double Width { get; }
+ ///
+ /// Height of rectangle, m
+ ///
+ double Height { get; }
+ ///
+ /// Angle of rotating rectangle, rad
+ ///
+ double Angle { get; }
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/IShape.cs b/StructureHelperLogics/Data/Shapes/IShape.cs
new file mode 100644
index 0000000..71f6a08
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/IShape.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ public interface IShape
+ {
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/Point.cs b/StructureHelperLogics/Data/Shapes/Point.cs
new file mode 100644
index 0000000..a53ce97
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/Point.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ public class Point : IPoint
+ {
+ public double Area { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Data/Shapes/Rectangle.cs b/StructureHelperLogics/Data/Shapes/Rectangle.cs
new file mode 100644
index 0000000..05a9663
--- /dev/null
+++ b/StructureHelperLogics/Data/Shapes/Rectangle.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Data.Shapes
+{
+ ///
+ public class Rectangle : IRectangle
+ {
+ ///
+ public double Width { get; set; }
+ ///
+ public double Height { get; set; }
+ ///
+ public double Angle { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs b/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs
new file mode 100644
index 0000000..2046c9d
--- /dev/null
+++ b/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Infrastructures.CommonEnums
+{
+ public enum CalcTerms
+ {
+ ShortTerm,
+ LongTerm,
+ }
+}
diff --git a/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs b/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs
new file mode 100644
index 0000000..3ded8d5
--- /dev/null
+++ b/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.Infrastructures.CommonEnums
+{
+ public enum LimitStates
+ {
+ Collapse = 1,
+ ServiceAbility = 2,
+ Special = 3,
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs
new file mode 100644
index 0000000..520ae44
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs
@@ -0,0 +1,17 @@
+using StructureHelperLogics.Data.Shapes;
+using StructureHelperLogics.NdmCalculations.Materials;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Entities
+{
+ public interface INdmPrimitive
+ {
+ ICenter Center { get; set; }
+ IShape Shape { get; set; }
+ IPrimitiveMaterial PrimitiveMaterial {get;set;}
+ double NdmMaxSize { get; set; }
+ int NdmMinDivision { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs
new file mode 100644
index 0000000..6cd643b
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs
@@ -0,0 +1,17 @@
+using StructureHelperLogics.Data.Shapes;
+using StructureHelperLogics.NdmCalculations.Materials;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Entities
+{
+ public class NdmPrimitive : INdmPrimitive
+ {
+ public ICenter Center { get; set; }
+ public IShape Shape { get; set; }
+ public IPrimitiveMaterial PrimitiveMaterial { get; set; }
+ public double NdmMaxSize { get; set; }
+ public int NdmMinDivision { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs b/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs
new file mode 100644
index 0000000..9b37530
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Materials
+{
+ public interface IPrimitiveMaterial
+ {
+ string Id { get;}
+ MaterialTypes MaterialType { get; }
+ string ClassName { get; }
+ double Strength { get; }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs b/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs
new file mode 100644
index 0000000..6b76a13
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Materials
+{
+ public enum MaterialTypes
+ {
+ Concrete,
+ Reinforcement,
+ //Steel,
+ //CarbonFiber,
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs b/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs
new file mode 100644
index 0000000..70864e6
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Materials
+{
+ public class PrimitiveMaterial : IPrimitiveMaterial
+ {
+ public string Id { get; }
+ public MaterialTypes MaterialType { get; set; }
+ public string ClassName { get; set; }
+ public double Strength { get; set; }
+
+ public PrimitiveMaterial()
+ {
+ Id = Convert.ToString(Guid.NewGuid());
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs
new file mode 100644
index 0000000..bd9217b
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ interface IPointTiangulationLogic : ITriangulationLogic
+ {
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs
new file mode 100644
index 0000000..10fe244
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs
@@ -0,0 +1,13 @@
+using StructureHelperLogics.Data.Shapes;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public interface IPointTriangulationLogicOptions : ITriangulationLogicOptions
+ {
+ ICenter Center { get; }
+ double Area { get; }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs
new file mode 100644
index 0000000..e0dd3bd
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public interface IRectangleTriangulationLogic : ITriangulationLogic
+ {
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs
new file mode 100644
index 0000000..24f2555
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs
@@ -0,0 +1,31 @@
+using StructureHelperLogics.Data.Shapes;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ ///
+ /// Parameter of triangulation of rectangle part of section
+ /// Параметры триангуляции прямоугольного участка сечения
+ ///
+ public interface IRectangleTriangulationLogicOptions : ITriangulationLogicOptions
+ {
+ ///
+ ///
+ ///
+ ICenter Center { get; }
+ ///
+ ///
+ ///
+ IRectangle Rectangle { get; }
+ ///
+ /// Maximum size (width or height) of ndm part after triangulation
+ ///
+ double NdmMaxSize { get; }
+ ///
+ /// Minimum quantity of division of side of rectangle after triangulation
+ ///
+ int NdmMinDivision { get; }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs
new file mode 100644
index 0000000..15bba04
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using LoaderCalculator.Data.Ndms;
+using LoaderCalculator.Data.Materials;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public interface ITriangulationLogic
+ {
+ ITriangulationLogicOptions Options { get; }
+ IEnumerable GetNdmCollection(IMaterial material);
+ void ValidateOptions(ITriangulationLogicOptions options);
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs
new file mode 100644
index 0000000..e759866
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public interface ITriangulationLogicOptions
+ {
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs
new file mode 100644
index 0000000..384e40b
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs
@@ -0,0 +1,13 @@
+using StructureHelperLogics.Infrastructures.CommonEnums;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public interface ITriangulationOptions
+ {
+ LimitStates LimiteState { get; }
+ CalcTerms CalcTerm { get; }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
new file mode 100644
index 0000000..a7660d7
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs
@@ -0,0 +1,35 @@
+using LoaderCalculator.Data.Materials;
+using LoaderCalculator.Data.Ndms;
+using StructureHelperLogics.Data.Shapes;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public class PointTriangulationLogic : IPointTiangulationLogic
+ {
+ public ITriangulationLogicOptions Options { get; }
+
+ public PointTriangulationLogic(IPointTriangulationLogicOptions options)
+ {
+ Options = options;
+ }
+
+ public IEnumerable GetNdmCollection(IMaterial material)
+ {
+ IPointTriangulationLogicOptions options = Options as IPointTriangulationLogicOptions;
+ ICenter center = options.Center;
+ double area = options.Area;
+ List ndmCollection = new List();
+ INdm ndm = new Ndm() { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };
+ ndmCollection.Add(ndm);
+ return ndmCollection;
+ }
+
+ public void ValidateOptions(ITriangulationLogicOptions options)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
new file mode 100644
index 0000000..c2d7c5e
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs
@@ -0,0 +1,26 @@
+using StructureHelperLogics.Data.Shapes;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ ///
+ ///
+ ///
+ public class PointTriangulationLogicOptions : IPointTriangulationLogicOptions
+ {
+ ///
+ ///
+ ///
+ public ICenter Center { get; }
+
+ public double Area { get; }
+
+ public PointTriangulationLogicOptions(ICenter center, double area)
+ {
+ Center = center;
+ Area = area;
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs
new file mode 100644
index 0000000..f732d76
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs
@@ -0,0 +1,42 @@
+using LoaderCalculator.Data.Materials;
+using LoaderCalculator.Data.Ndms;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using LoaderCalculator.Data.Ndms.Transformations;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public class RectangleTriangulationLogic : IRectangleTriangulationLogic
+ {
+ public ITriangulationLogicOptions Options { get; }
+
+ public IEnumerable GetNdmCollection(IMaterial material)
+ {
+ IRectangleTriangulationLogicOptions rectangleOptions = Options as IRectangleTriangulationLogicOptions;
+ double width = rectangleOptions.Rectangle.Width;
+ double height = rectangleOptions.Rectangle.Height;
+ double ndmMaxSize = rectangleOptions.NdmMaxSize;
+ int ndmMinDivision = rectangleOptions.NdmMinDivision;
+ LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions logicOptions = new LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions(width, height, ndmMaxSize, ndmMinDivision);
+ var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
+ var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.RectangularPlane { Material = material });
+ double dX = rectangleOptions.Center.X;
+ double dY = rectangleOptions.Center.Y;
+ NdmTransform.Move(ndmCollection, dX, dY);
+ double angle = rectangleOptions.Rectangle.Angle;
+ NdmTransform.Rotate(ndmCollection, angle);
+ return ndmCollection;
+ }
+
+ public void ValidateOptions(ITriangulationLogicOptions options)
+ {
+ throw new NotImplementedException();
+ }
+
+ public RectangleTriangulationLogic(ITriangulationLogicOptions options)
+ {
+ Options = options;
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
new file mode 100644
index 0000000..59455e1
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs
@@ -0,0 +1,38 @@
+using StructureHelperLogics.Data.Shapes;
+using StructureHelperLogics.NdmCalculations.Entities;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ ///
+ public class RectangleTriangulationLogicOptions : IRectangleTriangulationLogicOptions
+ {
+ ///
+ public ICenter Center { get; }
+ ///
+ public IRectangle Rectangle { get; }
+ ///
+ public double NdmMaxSize { get; }
+ ///
+ public int NdmMinDivision { get; }
+
+ public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
+ {
+ Center = center;
+ Rectangle = rectangle;
+ NdmMaxSize = ndmMaxSize;
+ NdmMinDivision = ndmMinDivision;
+ }
+
+ public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
+ {
+ if (! (primitive.Shape is IRectangle)) { throw new Exception("Shape type is not valid"); }
+ Center = primitive.Center;
+ Rectangle = primitive.Shape as IRectangle;
+ NdmMaxSize = primitive.NdmMaxSize;
+ NdmMinDivision = primitive.NdmMinDivision;
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
new file mode 100644
index 0000000..e04eebf
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using LoaderCalculator.Data.Materials;
+using LoaderCalculator.Data.Materials.MaterialBuilders;
+using LoaderCalculator.Data.Ndms;
+using StructureHelperLogics.Data.Shapes;
+using StructureHelperLogics.NdmCalculations.Entities;
+using StructureHelperLogics.NdmCalculations.Materials;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public static class Triangulation
+ {
+ public static IEnumerable GetNdms(IEnumerable ndmPrimitives, ITriangulationOptions options)
+ {
+ List ndms = new List();
+ Dictionary primitiveMaterials = GetPrimitiveMaterials(ndmPrimitives);
+ Dictionary materials = GetMaterials(primitiveMaterials, options);
+ foreach (var ndmPrimitive in ndmPrimitives)
+ {
+ IPrimitiveMaterial primitiveMaterial = ndmPrimitive.PrimitiveMaterial;
+ IMaterial material;
+ if (materials.TryGetValue(primitiveMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); }
+ IEnumerable localNdms = GetNdmsByPrimitive(ndmPrimitive, material);
+ ndms.AddRange(localNdms);
+ }
+ return ndms;
+ }
+
+ private static Dictionary GetPrimitiveMaterials(IEnumerable ndmPrimitives)
+ {
+ Dictionary primitiveMaterials = new Dictionary();
+ foreach (var ndmPrimitive in ndmPrimitives)
+ {
+ IPrimitiveMaterial material = ndmPrimitive.PrimitiveMaterial;
+ if (!primitiveMaterials.ContainsKey(material.Id)) { primitiveMaterials.Add(material.Id, material); }
+ }
+ return primitiveMaterials;
+ }
+
+ private static Dictionary GetMaterials(Dictionary PrimitiveMaterials, ITriangulationOptions options)
+ {
+ Dictionary materials = new Dictionary();
+ IEnumerable keyCollection = PrimitiveMaterials.Keys;
+ IMaterial material;
+ foreach (string id in keyCollection)
+ {
+ IPrimitiveMaterial primitiveMaterial;
+ if (PrimitiveMaterials.TryGetValue(id, out primitiveMaterial) == false) { throw new Exception("Material dictionary is not valid"); }
+ material = GetMaterial(primitiveMaterial, options);
+ materials.Add(id, material);
+ }
+ return materials;
+ }
+
+ private static IEnumerable GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material)
+ {
+ List ndms = new List();
+ ITriangulationLogicOptions options;
+ ICenter center = primitive.Center;
+ IShape shape = primitive.Shape;
+ if (shape is IRectangle)
+ {
+ IRectangle rectangle = shape as IRectangle;
+ options = new RectangleTriangulationLogicOptions(primitive);
+ IRectangleTriangulationLogic logic = new RectangleTriangulationLogic(options);
+ ndms.AddRange(logic.GetNdmCollection(material));
+ }
+ else { throw new Exception("Primitive type is not valid"); }
+ return ndms;
+ }
+
+ public static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
+ {
+ IMaterial material;
+ if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
+ else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); }
+ else { throw new Exception("Material type is invalid"); }
+ return material;
+ }
+
+ private static IMaterial GetConcreteMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
+ {
+ IMaterialOptions materialOptions = new ConcreteOptions();
+ SetMaterialOptions(materialOptions, primitiveMaterial, options);
+ IMaterialBuilder builder = new ConcreteBuilder(materialOptions);
+ IBuilderDirector director = new BuilderDirector(builder);
+ return director.BuildMaterial();
+ }
+
+ private static IMaterial GetReinforcementMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
+ {
+ IMaterialOptions materialOptions = new ReinforcementOptions();
+ SetMaterialOptions(materialOptions, primitiveMaterial, options);
+ IMaterialBuilder builder = new ReinforcementBuilder(materialOptions);
+ IBuilderDirector director = new BuilderDirector(builder);
+ return director.BuildMaterial();
+ }
+
+ private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
+ {
+ materialOptions.Strength = primitiveMaterial.Strength;
+ materialOptions.CodesType = CodesType.EC2_1990;
+ if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; }
+ else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; }
+ else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; }
+ else { throw new Exception("LimitStateType is not valid"); }
+ if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
+ else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
+ else { throw new Exception("Calculation term is not valid"); }
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs
new file mode 100644
index 0000000..d13b47b
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs
@@ -0,0 +1,13 @@
+using StructureHelperLogics.Infrastructures.CommonEnums;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace StructureHelperLogics.NdmCalculations.Triangulations
+{
+ public class TriangulationOptions : ITriangulationOptions
+ {
+ public LimitStates LimiteState { get; set; }
+ public CalcTerms CalcTerm { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/StructureHelperLogics.csproj b/StructureHelperLogics/StructureHelperLogics.csproj
new file mode 100644
index 0000000..325d167
--- /dev/null
+++ b/StructureHelperLogics/StructureHelperLogics.csproj
@@ -0,0 +1,13 @@
+
+
+
+ netstandard2.0
+
+
+
+
+ ..\..\StructureHelper\Libraries\LoaderCalculator.dll
+
+
+
+
diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs
new file mode 100644
index 0000000..dd13903
--- /dev/null
+++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs
@@ -0,0 +1,97 @@
+using LoaderCalculator;
+using LoaderCalculator.Data.Materials;
+using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.Ndms;
+using LoaderCalculator.Data.SourceData;
+using LoaderCalculator.Tests.Infrastructures.Logics;
+using NUnit.Framework;
+using StructureHelperLogics.Data.Shapes;
+using StructureHelperLogics.NdmCalculations.Entities;
+using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
+{
+ public class RCSectionTest
+ {
+ //Theoretical limit momemt Mx = 43kN*m
+ [TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)]
+ [TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)]
+ [TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)]
+ //Theoretical limit momemt Mx = -187kN*m
+ [TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)]
+ [TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)]
+ [TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)]
+ public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
+ {
+ //Arrange
+ double width = 0.4;
+ double height = 0.6;
+ var ndmCollection = new List();
+ ndmCollection.AddRange(GetConcreteNdms(width, height));
+ ndmCollection.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
+ var loaderData = new LoaderOptions
+ {
+ Preconditions = new Preconditions
+ {
+ ConditionRate = 0.01,
+ MaxIterationCount = 100,
+ StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
+ },
+ NdmCollection = ndmCollection
+ };
+ var calculator = new Calculator();
+ //Act
+ calculator.Run(loaderData, new CancellationToken());
+ var results = calculator.Result;
+ //Assert
+ Assert.NotNull(results);
+ var strainMatrix = results.StrainMatrix;
+ Assert.NotNull(strainMatrix);
+ Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
+ Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
+ Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
+ }
+
+ private IEnumerable GetConcreteNdms(double width, double height)
+ {
+ double strength = 40e6;
+ ICenter center = new Center() { X = 0, Y = 0 };
+ IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 };
+ IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С20", Strength = strength };
+ ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
+ INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
+ List primitives = new List();
+ primitives.Add(primitive);
+ var ndmCollection = Triangulation.GetNdms(primitives, options);
+ return ndmCollection;
+ }
+
+ private IEnumerable GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
+ {
+ double gap = 0.05d;
+ double strength = 4e8;
+ IShape topReinforcement = new Point() { Area = topArea };
+ IShape bottomReinforcement = new Point() { Area = bottomArea };
+ IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
+ ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
+ IMaterial material = Triangulation.GetMaterial(primitiveMaterial, options);
+ ICenter centerRT = new Center() { X = width / 2 - gap, Y = height / 2 - gap };
+ ICenter centerLT = new Center() { X = - (width / 2 - gap), Y = height / 2 - gap };
+ ICenter centerRB = new Center() { X = width / 2 - gap, Y = - (height / 2 - gap) };
+ ICenter centerLB = new Center() { X = -(width / 2 - gap), Y = - (height / 2 - gap) };
+ IPointTriangulationLogicOptions optionsRT = new PointTriangulationLogicOptions(centerRT, topArea);
+ IPointTriangulationLogicOptions optionsLT = new PointTriangulationLogicOptions(centerLT, topArea);
+ IPointTriangulationLogicOptions optionsRB = new PointTriangulationLogicOptions(centerRB, bottomArea);
+ IPointTriangulationLogicOptions optionsLB = new PointTriangulationLogicOptions(centerLB, bottomArea);
+ var ndmCollection = new List();
+ ndmCollection.AddRange((new PointTriangulationLogic(optionsRT)).GetNdmCollection(material));
+ ndmCollection.AddRange((new PointTriangulationLogic(optionsLT)).GetNdmCollection(material));
+ ndmCollection.AddRange((new PointTriangulationLogic(optionsRB)).GetNdmCollection(material));
+ ndmCollection.AddRange((new PointTriangulationLogic(optionsLB)).GetNdmCollection(material));
+ return ndmCollection;
+ }
+ }
+}
diff --git a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs
new file mode 100644
index 0000000..230ba3f
--- /dev/null
+++ b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs
@@ -0,0 +1,55 @@
+using LoaderCalculator;
+using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.SourceData;
+using LoaderCalculator.Tests.Infrastructures.Logics;
+using NUnit.Framework;
+using StructureHelperLogics.Data.Shapes;
+using StructureHelperLogics.NdmCalculations.Entities;
+using StructureHelperLogics.NdmCalculations.Materials;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
+{
+ public class ReinforcementTest
+ {
+ [TestCase(0.3, 0.6, 4e8, 0, 0, 1800000, 0d, 0d, 5e-5d)]
+ [TestCase(0.3, 0.6, 4e8, 0, 0, -1800000, 0d, 0d, -5e-5d)]
+ [TestCase(0.3, 0.6, 4e8, 7000000, 0, 0, 0.0065882684745345067d, 0d, 0d)]
+ [TestCase(0.3, 0.6, 6e8, 10000000, 0, 0, 0.010485801788961743d, 0d, -0.00011114996218404612d)]
+ public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
+ {
+ //Arrange
+ ICenter center = new Center() { X = 0, Y = 0 };
+ IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 };
+ IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
+ ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
+ INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 };
+ List primitives = new List();
+ primitives.Add(primitive);
+ var ndmCollection = Triangulation.GetNdms(primitives, options);
+ var loaderData = new LoaderOptions
+ {
+ Preconditions = new Preconditions
+ {
+ ConditionRate = 0.01,
+ MaxIterationCount = 100,
+ StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
+ },
+ NdmCollection = ndmCollection
+ };
+ var calculator = new Calculator();
+ //Act
+ calculator.Run(loaderData, new CancellationToken());
+ var results = calculator.Result;
+ //Assert
+ Assert.NotNull(results);
+ var strainMatrix = results.StrainMatrix;
+ Assert.NotNull(strainMatrix);
+ Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
+ Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
+ Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
+ }
+ }
+}
diff --git a/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs b/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs
new file mode 100644
index 0000000..f729eac
--- /dev/null
+++ b/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace LoaderCalculator.Tests.Infrastructures.Logics
+{
+ internal static class ExpectedProcessor
+ {
+ internal static double GetAccuracyForExpectedValue(double expectedValue, double accuracy = 0.001d)
+ {
+ if (expectedValue == 0d) { return 1.0e-15d; }
+ else return Math.Abs(expectedValue) * accuracy;
+ }
+ }
+}
diff --git a/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs
new file mode 100644
index 0000000..f50917f
--- /dev/null
+++ b/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs
@@ -0,0 +1,184 @@
+using LoaderCalculator.Data.Materials;
+using LoaderCalculator.Data.Materials.MaterialBuilders;
+using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.Ndms;
+using LoaderCalculator.Data.Ndms.Transformations;
+using LoaderCalculator.Data.Planes;
+using LoaderCalculator.Data.SourceData;
+using LoaderCalculator.Infrastructure;
+using LoaderCalculator.Tests.Infrastructures.Logics;
+using LoaderCalculator.Triangulations;
+using Moq;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+namespace LoaderCalculator.Tests.FunctionalTests.SectionTests
+{
+ public class RCSectionTest
+ {
+ private IMaterialOptions _reinforcementOptions;
+ private IMaterialBuilder _reinforcementBuilder;
+ private IBuilderDirector _reinforcementDirector;
+ private IMaterialOptions _concreteOptions;
+ private IMaterialBuilder _concreteBuilder;
+ private IBuilderDirector _concreteDirector;
+ [SetUp]
+ public void Setup()
+ {
+ _reinforcementOptions = new ReinforcementOptions();
+ _reinforcementBuilder = new ReinforcementBuilder(_reinforcementOptions);
+ _reinforcementDirector = new BuilderDirector(_reinforcementBuilder);
+ _concreteOptions = new ConcreteOptions();
+ _concreteBuilder = new ConcreteBuilder(_concreteOptions);
+ _concreteDirector = new BuilderDirector(_concreteBuilder);
+ }
+ //Theoretical limit momemt Mx = 43kN*m
+ [TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)]
+ [TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)]
+ [TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)]
+ //Theoretical limit momemt Mx = -187kN*m
+ [TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)]
+ [TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)]
+ [TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)]
+ public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
+ {
+ //Arrange
+ double width = 0.4;
+ double height = 0.6;
+ ArrangeMaterial(LimitStates.Collapse, true);
+ List ndmList = new List();
+ ndmList.AddRange(GetConcreteNdms(width, height));
+ ndmList.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
+ var loaderData = new LoaderOptions
+ {
+ Preconditions = new Preconditions
+ {
+ ConditionRate = 0.01,
+ MaxIterationCount = 100,
+ StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
+ },
+ NdmCollection = ndmList
+ };
+ var calculator = new Calculator();
+ //Act
+ calculator.Run(loaderData, new CancellationToken());
+ var results = calculator.Result;
+ //Assert
+ Assert.NotNull(results);
+ var strainMatrix = results.StrainMatrix;
+ Assert.NotNull(strainMatrix);
+ Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
+ Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
+ Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
+ }
+ //Longitudenal prestrain only
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0.0d, 0d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.001d, 0d, 0.0d, -4.410e-05d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.0015d, 0d, 0.0d, -6.666e-05d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.002d, 0d, 0.0d, -8.131e-05d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.003d, 0d, 0.0d, -8.131e-05d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, -0.001d, 0d, 0.0d, 0.001d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, -0.002d, 0d, 0.0d, 0.002d)]
+ //Curvature prestrain only
+ [TestCase(0.000494, 0.000494, 0d, 0d, 0d, -1e-5d, 0d, 0d, 5.4638e-6d, 0.0d, 1.069e-06d)]
+ //Test shows that prestrain and external forces are neglegiate one by another
+ [TestCase(0.000494, 0.000494, 0d, 0d, 3.952e5d, 0d, 0d, 0.001d, 0d, 0.0d, 0d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 6.873e5d, 0d, 0d, 0.002d, 0d, 0.0d, -1.703e-8d)]
+ [TestCase(0.000494, 0.000494, 0d, 0d, 6.873e5d, 0d, 0d, 0.003d, 0d, 0.0d, -3.796e-8d)]
+ public void Run_ShouldPassPrestrain(double topArea, double bottomArea, double mx, double my, double nz, double prestrainKx, double prestrainKy, double prestrainEpsZ, double expectedKx, double expectedKy, double expectedEpsilonZ)
+ {
+ //Arrange
+ double width = 0.4;
+ double height = 0.6;
+ ArrangeMaterial(LimitStates.Collapse, true);
+ List ndmList = new List();
+ IStrainMatrix prestrainMatrix = new StrainMatrix() { Kx = prestrainKx, Ky = prestrainKy, EpsZ = prestrainEpsZ };
+ ndmList.AddRange(GetConcreteNdms(width, height));
+ var reinforcement = GetReinforcementNdms(width, height, topArea, bottomArea);
+ NdmTransform.SetPrestrain(reinforcement, prestrainMatrix);
+ ndmList.AddRange(reinforcement);
+ var loaderData = new LoaderOptions
+ {
+ Preconditions = new Preconditions
+ {
+ ConditionRate = 0.001,
+ MaxIterationCount = 100,
+ StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
+ },
+ NdmCollection = ndmList
+ };
+ var calculator = new Calculator();
+ //Act
+ calculator.Run(loaderData, new CancellationToken());
+ var results = calculator.Result;
+ //Assert
+ Assert.NotNull(results);
+ var strainMatrix = results.StrainMatrix;
+ Assert.NotNull(strainMatrix);
+ Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
+ Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
+ Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
+ }
+
+ private void ArrangeMaterial(LimitStates limitStates, bool isShortTerm)
+ {
+ _reinforcementOptions.InitModulus = 2.0e11;
+ _reinforcementOptions.LimitState = limitStates;
+ _reinforcementOptions.IsShortTerm = isShortTerm;
+ _reinforcementOptions.Strength = 400.0e6;
+
+ _concreteOptions.LimitState = limitStates;
+ _concreteOptions.IsShortTerm = isShortTerm;
+ _concreteOptions.Strength = 40.0e6;
+ }
+
+ private IEnumerable GetConcreteNdms(double width, double heigth)
+ {
+ IMaterial _material = _concreteDirector.BuildMaterial();
+ RectangleTriangulationLogicOptions logicOptions = new RectangleTriangulationLogicOptions(width, heigth, 1, 20);
+ var logic = Triangulation.GetLogicInstance(logicOptions);
+ var ndmCollection = logic.GetNdmCollection(new RectangularPlane { Material = _material });
+ return ndmCollection;
+ }
+
+ private IEnumerable GetReinforcementNdms(double width, double heigth, double topArea, double bottomArea)
+ {
+ IMaterial _material = _reinforcementDirector.BuildMaterial();
+ double gap = 0.05;
+ var ndmCollection = new INdm[]
+ {
+ new Ndm
+ {
+ Area = topArea,
+ CenterX = width / 2 - gap,
+ CenterY = heigth / 2 - gap,
+ Material = _material
+ },
+ new Ndm
+ {
+ Area = topArea,
+ CenterX = -(width / 2 - gap),
+ CenterY = heigth / 2 - gap,
+ Material = _material
+ },
+ new Ndm
+ {
+ Area = bottomArea,
+ CenterX = width / 2 - gap,
+ CenterY = -(heigth / 2 - gap),
+ Material = _material
+ },
+ new Ndm
+ {
+ Area = bottomArea,
+ CenterX = -(width / 2 - gap),
+ CenterY = -(heigth / 2 - gap),
+ Material = _material
+ }
+ };
+ return ndmCollection;
+ }
+ }
+}
diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj
index 5576498..d41ee1e 100644
--- a/StructureHelperTests/StructureHelperTests.csproj
+++ b/StructureHelperTests/StructureHelperTests.csproj
@@ -1,7 +1,7 @@
-
-
+
+
Debug
AnyCPU
@@ -39,30 +39,51 @@
4
-
- ..\StructureHelper\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
-
-
- ..\StructureHelper\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
-
-
-
-
-
-
+
+
+
+
+
+
+
+ ..\packages\Castle.Core.5.0.0\lib\net462\Castle.Core.dll
+
+
+ ..\Libraries\LoaderCalculator.dll
+ True
+
+
+ ..\packages\Moq.4.18.1\lib\net462\Moq.dll
+
+
+ ..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll
+
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
+
+
+
+ {330bef5b-15be-4d2c-a750-b1ae50fb2be3}
+ StructureHelperLogics
+
+
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
+
+
-
\ No newline at end of file
diff --git a/StructureHelperTests/StructureHelperTests.csproj.bak b/StructureHelperTests/StructureHelperTests.csproj.bak
new file mode 100644
index 0000000..8bbe88a
--- /dev/null
+++ b/StructureHelperTests/StructureHelperTests.csproj.bak
@@ -0,0 +1,64 @@
+
+
+
+ Debug
+ AnyCPU
+ {7AC480BB-8A34-4913-B7AA-C6A5D7F35509}
+ Library
+ Properties
+ StructureHelperTests
+ StructureHelperTests
+ v4.7.2
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 15.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelperTests/TestExampleClass.cs b/StructureHelperTests/TestExampleClass.cs
deleted file mode 100644
index 6c778ba..0000000
--- a/StructureHelperTests/TestExampleClass.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-
-namespace StructureHelperTests
-{
- [TestClass]
- public class TestExampleClass
- {
- [TestMethod]
- public void TestMethod()
- {
- }
- }
-}
diff --git a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs
new file mode 100644
index 0000000..152ae97
--- /dev/null
+++ b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs
@@ -0,0 +1,51 @@
+using LoaderCalculator.Data.Materials;
+using LoaderCalculator.Data.Materials.MaterialBuilders;
+using LoaderCalculator.Data.Matrix;
+using LoaderCalculator.Data.Ndms;
+using LoaderCalculator.Data.Ndms.Transformations;
+using LoaderCalculator.Data.Planes;
+using LoaderCalculator.Data.SourceData;
+using LoaderCalculator.Infrastructure;
+using LoaderCalculator.Tests.Infrastructures.Logics;
+using LoaderCalculator.Triangulations;
+using Moq;
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using StructureHelperLogics.Data.Shapes;
+
+namespace StructureHelperTests.UnitTests.Ndms.Triangulations
+{
+ public class RectangleTriangulationTest
+ {
+ //Участок по центру
+ [TestCase(0d, 0d, 1.0d, 1.0d, 0d, 0.02d, 1, 50 * 50, -0.49d, -0.49d)]
+ //Участок со смещением от центра
+ [TestCase(2d, 2d, 1.0d, 1.0d, 0d, 0.02d, 1, 50 * 50, 1.51d, 1.51d)]
+ [TestCase(2d, 1d, 1.0d, 1.0d, 0d, 0.02d, 1, 50 * 50, 1.51d, 0.51d)]
+ //Участок с поворотом на 1 радиан
+ [TestCase(0d, 0d, 1.0d, 1.0d, 1d, 0.02d, 1, 50 * 50, 0.14757265268048089d, -0.67706891243125777d)]
+ //Участок со смещением и поворотом на 1 радиан
+ [TestCase(2d, 2d, 1.0d, 1.0d, 1d, 0.02d, 1, 50 * 50, -0.45476470519903267d, 2.0864776689208147d)]
+ public void Run_ShouldPass (double centerX, double centerY, double width, double height, double angle, double ndmMaxSize, int ndmMinDivision, int expectedCount, double expectedFirstCenterX, double expectedFirstCenterY)
+ {
+ //Arrange
+ IMaterial material = new Material();
+ ICenter center = new Center() { X = centerX, Y = centerY };
+ IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = angle };
+ IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision);
+ IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options);
+ //Act
+ var result = logic.GetNdmCollection(material);
+ //Assert
+ Assert.NotNull(result);
+ Assert.AreEqual(expectedCount, result.Count());
+ var firstNdm = result.First();
+ Assert.AreEqual(expectedFirstCenterX, firstNdm.CenterX);
+ Assert.AreEqual(expectedFirstCenterY, firstNdm.CenterY);
+ }
+ }
+}
diff --git a/StructureHelperTests/packages.config b/StructureHelperTests/packages.config
index f84cb10..e3e465e 100644
--- a/StructureHelperTests/packages.config
+++ b/StructureHelperTests/packages.config
@@ -1,5 +1,9 @@
-
-
+
+
+
+
+
+
\ No newline at end of file