Crack Calculator was added

This commit is contained in:
Evgeny Redikultsev
2023-07-16 17:21:28 +05:00
parent 3e0e51d0c9
commit d7a4b1f0a7
108 changed files with 1523 additions and 565 deletions

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IDecoratorOption : IMaterialOption
{
}
}

View File

@@ -0,0 +1,57 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Services;
using StructureHelperLogics.MaterialBuilders.Decorators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal class RestrictStrainDecorator : IMaterialBuilder
{
IMaterialBuilder builder;
public IMaterialOption MaterialOption { get; set; }
public RestrictStrainDecorator(IMaterialBuilder builder)
{
this.builder = builder;
}
public IMaterial GetMaterial()
{
CheckOptions();
var option = (RestrictStrainOption)MaterialOption;
var material = new Material();
material.InitModulus = builder.GetMaterial().InitModulus;
material.DiagramParameters = new List<double>()
{
option.MaxTensileStrain,
option.MaxCompessionStrain
};
material.Diagram = GetStressDiagram;
return material;
}
private void CheckOptions()
{
CheckObject.CompareTypes(typeof(RestrictStrainOption), MaterialOption.GetType());
}
private double GetStressDiagram(IEnumerable<double> parameters, double strain)
{
var maxTensileStrain = parameters.ToList()[0];
var maxCompressionStrain = parameters.ToList()[1];
if (strain > maxTensileStrain || strain < maxCompressionStrain)
{
return 0d;
}
else
{
var material = builder.GetMaterial();
return material.Diagram.Invoke(parameters, strain);
}
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders.Decorators
{
internal class RestrictStrainOption : IDecoratorOption
{
private double maxTensileStrain;
private double maxCompessionStrain;
public double MaxTensileStrain
{
get => maxTensileStrain;
set
{
if (value < 0d)
{
//to do exception
}
maxTensileStrain = value;
}
}
public double MaxCompessionStrain { get => maxCompessionStrain; set => maxCompessionStrain = value; }
}
}

View File

@@ -0,0 +1,19 @@
using LoaderCalculator.Data.Materials.MaterialBuilders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IBearingOption : IMaterialOption
{
double InitModulus { get; set; }
double Strength { get; set; }
LimitStates LimitState { get; set; }
bool IsShortTerm { get; set; }
CodesType CodesType { get; set; }
IPartialFactor ExternalFactor { get; }
}
}

View File

@@ -0,0 +1,15 @@
using LoaderCalculator.Data.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IMaterialBuilder
{
IMaterialOption MaterialOption { get; set; }
IMaterial GetMaterial();
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IMaterialOption
{
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.MaterialBuilders
{
internal interface IPartialFactor
{
double YoungsModulus { get; set; }
double Compressive { get; set; }
double Tensile { get; set; }
}
}