Добавлены сервисы CalculationService, PrimitiveService, Common-сборка с типами
Необходимо реализовать в дальнейшем GetInnerPoints в PrimitiveService
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Center : ICenter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public double X { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Y { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for point of center of some shape
|
||||
/// Интерфейс для точки центра некоторой формы
|
||||
/// </summary>
|
||||
public interface ICenter
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate of center of rectangle by local axis X, m
|
||||
/// Координата центра вдоль локальной оси X, м
|
||||
/// </summary>
|
||||
double X { get;}
|
||||
/// <summary>
|
||||
/// Coordinate of center of rectangle by local axis Y, m
|
||||
/// Координата центра вдоль локальной оси Y, м
|
||||
/// </summary>
|
||||
double Y { get;}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
public interface ICenterShape
|
||||
{
|
||||
ICenter Center {get;}
|
||||
IShape Shape { get;}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
public interface ICircle : IShape
|
||||
{
|
||||
double Diameter { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
public interface IPoint : IShape
|
||||
{
|
||||
double Area { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
public interface IRectangle : IShape
|
||||
{
|
||||
/// <summary>
|
||||
/// Width of rectangle, m
|
||||
/// </summary>
|
||||
double Width { get; }
|
||||
/// <summary>
|
||||
/// Height of rectangle, m
|
||||
/// </summary>
|
||||
double Height { get; }
|
||||
/// <summary>
|
||||
/// Angle of rotating rectangle, rad
|
||||
/// </summary>
|
||||
double Angle { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
public interface IShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
public class Point : IPoint
|
||||
{
|
||||
public double Area { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace StructureHelperLogics.Data.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Rectangle : IRectangle
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public double Width { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Height { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Angle { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Entities;
|
||||
|
||||
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||
{
|
||||
public interface IPrimitive : ICenterShape
|
||||
{
|
||||
INdmPrimitive GetNdmPrimitive();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Entities;
|
||||
using StructureHelperLogics.NdmCalculations.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||
{
|
||||
public class PointPrimitive : PrimitiveBase<IPoint>, IPoint
|
||||
{
|
||||
public double Area
|
||||
{
|
||||
get => _shape.Area;
|
||||
set => _shape.Area = value;
|
||||
}
|
||||
|
||||
public PointPrimitive(ICenter center, IPoint shape) : base(center, shape) { }
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
double strength = 400e6d;
|
||||
string materialName = "s400";
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
private MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
return MaterialTypes.Reinforcement;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Entities;
|
||||
|
||||
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||
{
|
||||
public abstract class PrimitiveBase<T> : IPrimitive where T : IShape
|
||||
{
|
||||
protected ICenter _center;
|
||||
protected T _shape;
|
||||
|
||||
public ICenter Center => _center;
|
||||
public IShape Shape => _shape;
|
||||
|
||||
public PrimitiveBase(ICenter center, T shape)
|
||||
{
|
||||
_center = center;
|
||||
_shape = shape;
|
||||
}
|
||||
|
||||
public abstract INdmPrimitive GetNdmPrimitive();
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Entities;
|
||||
using StructureHelperLogics.NdmCalculations.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.NdmPrimitives
|
||||
{
|
||||
public class RectanglePrimitive : PrimitiveBase<IRectangle>, IRectangle
|
||||
{
|
||||
public RectanglePrimitive(ICenter center, IRectangle shape) : base(center, shape) { }
|
||||
|
||||
public double Width => _shape.Width;
|
||||
|
||||
public double Height => _shape.Height;
|
||||
|
||||
public double Angle => _shape.Angle;
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
double strength = 40e6d;
|
||||
string materialName = "C40/45";
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
private MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
return MaterialTypes.Concrete;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Materials;
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Materials;
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace StructureHelperLogics.NdmCalculations.Materials
|
||||
{
|
||||
public interface IPrimitiveMaterial
|
||||
{
|
||||
string Id { get;}
|
||||
MaterialTypes MaterialType { get; }
|
||||
string ClassName { get; }
|
||||
double Strength { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace StructureHelperLogics.NdmCalculations.Materials
|
||||
{
|
||||
public enum MaterialTypes
|
||||
{
|
||||
Concrete,
|
||||
Reinforcement,
|
||||
//Steel,
|
||||
//CarbonFiber,
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using StructureHelperLogics.Data.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Entities;
|
||||
using System;
|
||||
using System;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
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;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
67
StructureHelperLogics/Services/CalculationService.cs
Normal file
67
StructureHelperLogics/Services/CalculationService.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Autofac;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using StructureHelper;
|
||||
using StructureHelper.Services;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.NdmPrimitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
|
||||
namespace StructureHelperLogics.Services
|
||||
{
|
||||
public class CalculationService
|
||||
{
|
||||
public IStrainMatrix GetPrimitiveStrainMatrix(double topArea, double bottomArea, RectanglePrimitive concreteRectangle, double mx, double my, double nz)
|
||||
{
|
||||
var ndmPrimitives = new List<INdmPrimitive>();
|
||||
//Добавляем прямоугольник бетонного сечения
|
||||
|
||||
ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive());
|
||||
|
||||
using (var scope = App.Container.BeginLifetimeScope())
|
||||
{
|
||||
var primitiveService = scope.Resolve<PrimitiveService>();
|
||||
//Добавляем точки внутри прямоугольника
|
||||
ndmPrimitives.AddRange(primitiveService.GetInnerPoints(concreteRectangle).Select(x=>x.GetNdmPrimitive()));
|
||||
}
|
||||
|
||||
//Коллекция для хранения элементарных участков
|
||||
var ndmCollection = new List<INdm>();
|
||||
//Настройки триангуляции, пока опции могут быть только такие
|
||||
ITriangulationOptions options = new TriangulationOptions
|
||||
{
|
||||
LimiteState = LimitStates.Collapse,
|
||||
CalcTerm = CalcTerms.ShortTerm
|
||||
};
|
||||
|
||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
|
||||
|
||||
var calculator = new Calculator();
|
||||
var calculationData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = 0.01,
|
||||
MaxIterationCount = 100,
|
||||
StartForceMatrix = new ForceMatrix
|
||||
{
|
||||
Mx = mx,
|
||||
My = my,
|
||||
Nz = nz
|
||||
}
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
calculator.Run(calculationData, new CancellationToken());
|
||||
var results = calculator.Result;
|
||||
return results.StrainMatrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,15 @@
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\StructureHelper.csproj" />
|
||||
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="LoaderCalculator">
|
||||
<HintPath>..\..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
||||
|
||||
Reference in New Issue
Block a user