Исправил ошибки триангуляции точки
This commit is contained in:
@@ -6,6 +6,6 @@ namespace StructureHelperLogics.Data.Shapes
|
|||||||
{
|
{
|
||||||
public interface IPoint : IShape
|
public interface IPoint : IShape
|
||||||
{
|
{
|
||||||
double Area { get; set; }
|
double Area { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
interface IPointTiangulationLogic : ITriangulationLogic
|
interface IPointTriangulationLogic : ITriangulationLogic
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,11 +7,11 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
public class PointTriangulationLogic : IPointTiangulationLogic
|
public class PointTriangulationLogic : IPointTriangulationLogic
|
||||||
{
|
{
|
||||||
public ITriangulationLogicOptions Options { get; }
|
public ITriangulationLogicOptions Options { get; }
|
||||||
|
|
||||||
public PointTriangulationLogic(IPointTriangulationLogicOptions options)
|
public PointTriangulationLogic(ITriangulationLogicOptions options)
|
||||||
{
|
{
|
||||||
Options = options;
|
Options = options;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,16 +62,22 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
IShape shape = primitive.Shape;
|
IShape shape = primitive.Shape;
|
||||||
if (shape is IRectangle)
|
if (shape is IRectangle)
|
||||||
{
|
{
|
||||||
IRectangle rectangle = shape as IRectangle;
|
|
||||||
options = new RectangleTriangulationLogicOptions(primitive);
|
options = new RectangleTriangulationLogicOptions(primitive);
|
||||||
IRectangleTriangulationLogic logic = new RectangleTriangulationLogic(options);
|
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||||
|
ndms.AddRange(logic.GetNdmCollection(material));
|
||||||
|
}
|
||||||
|
else if (shape is IPoint)
|
||||||
|
{
|
||||||
|
IPoint point = shape as IPoint;
|
||||||
|
options = new PointTriangulationLogicOptions(primitive.Center, point.Area);
|
||||||
|
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||||
ndms.AddRange(logic.GetNdmCollection(material));
|
ndms.AddRange(logic.GetNdmCollection(material));
|
||||||
}
|
}
|
||||||
else { throw new Exception("Primitive type is not valid"); }
|
else { throw new Exception("Primitive type is not valid"); }
|
||||||
return ndms;
|
return ndms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
|
private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
|
||||||
{
|
{
|
||||||
IMaterial material;
|
IMaterial material;
|
||||||
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
|
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
|
||||||
|
|||||||
@@ -30,8 +30,11 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
double width = 0.4;
|
double width = 0.4;
|
||||||
double height = 0.6;
|
double height = 0.6;
|
||||||
var ndmCollection = new List<INdm>();
|
var ndmCollection = new List<INdm>();
|
||||||
ndmCollection.AddRange(GetConcreteNdms(width, height));
|
ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
||||||
ndmCollection.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
var primitives = new List<INdmPrimitive>();
|
||||||
|
primitives.AddRange(GetConcreteNdms(width, height));
|
||||||
|
primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
||||||
|
ndmCollection.AddRange(Triangulation.GetNdms(primitives, options));
|
||||||
var loaderData = new LoaderOptions
|
var loaderData = new LoaderOptions
|
||||||
{
|
{
|
||||||
Preconditions = new Preconditions
|
Preconditions = new Preconditions
|
||||||
@@ -55,21 +58,19 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
|
Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<INdm> GetConcreteNdms(double width, double height)
|
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
||||||
{
|
{
|
||||||
double strength = 40e6;
|
double strength = 40e6;
|
||||||
ICenter center = new Center() { X = 0, Y = 0 };
|
ICenter center = new Center() { X = 0, Y = 0 };
|
||||||
IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 };
|
IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 };
|
||||||
IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С20", Strength = strength };
|
IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength };
|
||||||
ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
|
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 };
|
INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
||||||
primitives.Add(primitive);
|
return primitives;
|
||||||
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
|
||||||
return ndmCollection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<INdm> GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
|
private IEnumerable<INdmPrimitive> GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
|
||||||
{
|
{
|
||||||
double gap = 0.05d;
|
double gap = 0.05d;
|
||||||
double strength = 4e8;
|
double strength = 4e8;
|
||||||
@@ -77,21 +78,25 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
|||||||
IShape bottomReinforcement = new Point() { Area = bottomArea };
|
IShape bottomReinforcement = new Point() { Area = bottomArea };
|
||||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength };
|
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 };
|
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 centerRT = new Center() { X = width / 2 - gap, Y = height / 2 - gap };
|
||||||
ICenter centerLT = 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 centerRB = new Center() { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
||||||
ICenter centerLB = 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);
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
IPointTriangulationLogicOptions optionsLT = new PointTriangulationLogicOptions(centerLT, topArea);
|
INdmPrimitive primitive;
|
||||||
IPointTriangulationLogicOptions optionsRB = new PointTriangulationLogicOptions(centerRB, bottomArea);
|
//Right top bar
|
||||||
IPointTriangulationLogicOptions optionsLB = new PointTriangulationLogicOptions(centerLB, bottomArea);
|
primitive = new NdmPrimitive() { Center = centerRT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial};
|
||||||
var ndmCollection = new List<INdm>();
|
primitives.Add(primitive);
|
||||||
ndmCollection.AddRange((new PointTriangulationLogic(optionsRT)).GetNdmCollection(material));
|
//Left top bar
|
||||||
ndmCollection.AddRange((new PointTriangulationLogic(optionsLT)).GetNdmCollection(material));
|
primitive = new NdmPrimitive() { Center = centerLT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial };
|
||||||
ndmCollection.AddRange((new PointTriangulationLogic(optionsRB)).GetNdmCollection(material));
|
primitives.Add(primitive);
|
||||||
ndmCollection.AddRange((new PointTriangulationLogic(optionsLB)).GetNdmCollection(material));
|
//Right bottom bar
|
||||||
return ndmCollection;
|
primitive = new NdmPrimitive() { Center = centerRB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
||||||
|
primitives.Add(primitive);
|
||||||
|
//Left bottom bar
|
||||||
|
primitive = new NdmPrimitive() { Center = centerLB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial };
|
||||||
|
primitives.Add(primitive);
|
||||||
|
return primitives;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user