Files
StructureHelper/StructureHelperLogics/NdmCalculations/Cracking/CheckLogics/PrimitivesForCrackMaterialCheckLogic.cs
Evgeny Redikultsev ac34a26c15 Add lib material tests
2025-12-21 10:54:30 +05:00

41 lines
1.2 KiB
C#

using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Cracking.CheckLogics
{
/// <summary>
/// Checks whether a collection of NDM primitives contains
/// at least one material that supports crack appearance.
/// </summary>
public class PrimitivesForCrackMaterialCheckLogic
: CheckEntityLogic<IEnumerable<INdmPrimitive>>
{
public override bool Check()
{
if (Entity is null)
{
TraceMessage("Collection of primitives is null");
return false;
}
CheckResult = string.Empty;
bool hasCrackMaterial = Entity.Any(primitive =>
primitive?.NdmElement?.HeadMaterial?
.GetLoaderMaterial(LimitStates.SLS, CalcTerms.ShortTerm)
is ICrackMaterial);
if (!hasCrackMaterial)
{
TraceMessage(
"Collection of primitives does not have material which supports cracking");
}
return hasCrackMaterial;
}
}
}