• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

connorivy / beamOS / 14882999397

07 May 2025 12:10PM UTC coverage: 70.971%. First build
14882999397

Pull #85

github

web-flow
Merge 16abd45d8 into e6bb4b15c
Pull Request #85: Add load combos

867 of 1830 branches covered (47.38%)

Branch coverage included in aggregate %.

1474 of 1639 new or added lines in 74 files covered. (89.93%)

7536 of 10010 relevant lines covered (75.28%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/StructuralAnalysis/BeamOs.StructuralAnalysis.Application/OpenSees/RunOpenSeesCommandHandler.cs
1
using System.Reflection;
2
using BeamOs.Common.Application;
3
using BeamOs.Common.Contracts;
4
using BeamOs.StructuralAnalysis.Application.AnalyticalResults.ResultSets;
5
using BeamOs.StructuralAnalysis.Application.Common;
6
using BeamOs.StructuralAnalysis.Application.DirectStiffnessMethod;
7
using BeamOs.StructuralAnalysis.Application.PhysicalModel.Models;
8
using BeamOs.StructuralAnalysis.Contracts.AnalyticalResults.Diagrams;
9
using BeamOs.StructuralAnalysis.Domain.DirectStiffnessMethod;
10
using BeamOs.StructuralAnalysis.Domain.OpenSees;
11
using Microsoft.EntityFrameworkCore;
12
using Microsoft.Extensions.Logging;
13

14
namespace BeamOs.StructuralAnalysis.Application.OpenSees;
15

16
public sealed class RunOpenSeesCommandHandler(
×
17
    IModelRepository modelRepository,
×
18
    IResultSetRepository resultSetRepository,
×
19
    IStructuralAnalysisUnitOfWork unitOfWork,
×
20
    ILogger<RunOpenSeesCommandHandler> logger
×
21
) : ICommandHandler<RunDsmCommand, AnalyticalResultsResponse>
×
22
{
23
    public async Task<Result<AnalyticalResultsResponse>> ExecuteAsync(
24
        RunDsmCommand command,
25
        CancellationToken ct = default
26
    )
27
    {
×
28
        var model = await modelRepository.GetSingle(
×
29
            command.ModelId,
×
30
            static queryable =>
×
31
                queryable
×
32
                    .Include(m => m.PointLoads)
×
33
                    .Include(m => m.MomentLoads)
×
NEW
34
                    .Include(m => m.LoadCombinations)
×
35
                    .Include(m => m.Element1ds)
×
36
                    .ThenInclude(el => el.StartNode)
×
37
                    .Include(m => m.Element1ds)
×
38
                    .ThenInclude(el => el.EndNode)
×
39
                    .Include(m => m.Element1ds)
×
40
                    .ThenInclude(el => el.SectionProfile)
×
41
                    .Include(m => m.Element1ds)
×
42
                    .ThenInclude(el => el.Material),
×
43
            ct
×
44
        );
×
45

46
        if (model is null)
×
47
        {
×
48
            return BeamOsError.NotFound(
×
49
                description: $"Could not find model with id {command.ModelId}"
×
50
            );
×
51
        }
NEW
52
        if (model.LoadCombinations is null || model.LoadCombinations.Count == 0)
×
NEW
53
        {
×
NEW
54
            return BeamOsError.NotFound(
×
NEW
55
                description: $"Model with id {command.ModelId} has no load combinations"
×
NEW
56
            );
×
57
        }
58

59
        UnitSettings unitSettings = model.Settings.UnitSettings;
×
60
        if (command.UnitsOverride is not null)
×
61
        {
×
62
            unitSettings = RunDirectStiffnessMethodCommandHandler.GetUnitSettings(
×
63
                command.UnitsOverride
×
64
            );
×
65
        }
×
66

67
        using OpenSeesAnalysisModel analysisMode = new(model, unitSettings, logger);
×
NEW
68
        AnalysisResults? result = null;
×
NEW
69
        foreach (var loadCombination in model.LoadCombinations)
×
NEW
70
        {
×
NEW
71
            if (
×
NEW
72
                command.LoadCombinationIds is not null
×
NEW
73
                && !command.LoadCombinationIds.Contains(loadCombination.Id)
×
NEW
74
            )
×
NEW
75
            {
×
NEW
76
                continue;
×
77
            }
78

NEW
79
            result = await analysisMode.RunAnalysis(loadCombination);
×
NEW
80
            resultSetRepository.Add(result.ResultSet);
×
NEW
81
        }
×
82

NEW
83
        if (result is null)
×
NEW
84
        {
×
NEW
85
            return BeamOsError.NotFound(
×
NEW
86
                description: $"Could not find any load combinations with provided load combination ids"
×
NEW
87
            );
×
88
        }
89

90
        await unitOfWork.SaveChangesAsync(ct);
×
91

92
        // todo: aggregate results instead of just taking the last one
NEW
93
        return result.OtherAnalyticalResults.Map();
×
94
    }
×
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc