Исправил ошибки триангуляции точки

This commit is contained in:
Evgeny Redikultsev
2022-06-23 21:52:26 +05:00
parent 2002975a2c
commit bc867d5db2
5 changed files with 38 additions and 27 deletions

View File

@@ -6,6 +6,6 @@ namespace StructureHelperLogics.Data.Shapes
{
public interface IPoint : IShape
{
double Area { get; set; }
double Area { get; }
}
}

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
interface IPointTiangulationLogic : ITriangulationLogic
interface IPointTriangulationLogic : ITriangulationLogic
{
}
}

View File

@@ -7,11 +7,11 @@ using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
public class PointTriangulationLogic : IPointTiangulationLogic
public class PointTriangulationLogic : IPointTriangulationLogic
{
public ITriangulationLogicOptions Options { get; }
public PointTriangulationLogic(IPointTriangulationLogicOptions options)
public PointTriangulationLogic(ITriangulationLogicOptions options)
{
Options = options;
}

View File

@@ -62,16 +62,22 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
IShape shape = primitive.Shape;
if (shape is IRectangle)
{
IRectangle rectangle = shape as IRectangle;
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));
}
else { throw new Exception("Primitive type is not valid"); }
return ndms;
}
public static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
{
IMaterial material;
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }

View File

@@ -30,8 +30,11 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
double width = 0.4;
double height = 0.6;
var ndmCollection = new List<INdm>();
ndmCollection.AddRange(GetConcreteNdms(width, height));
ndmCollection.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm };
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
{
Preconditions = new Preconditions
@@ -55,21 +58,19 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
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;
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 };
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 };
INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 };
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
primitives.Add(primitive);
var ndmCollection = Triangulation.GetNdms(primitives, options);
return ndmCollection;
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
return primitives;
}
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 strength = 4e8;
@@ -77,21 +78,25 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
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<INdm>();
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;
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
INdmPrimitive primitive;
//Right top bar
primitive = new NdmPrimitive() { Center = centerRT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial};
primitives.Add(primitive);
//Left top bar
primitive = new NdmPrimitive() { Center = centerLT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial };
primitives.Add(primitive);
//Right bottom bar
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;
}
}
}