Пример #1
0
        public static VertexResultCalculator FromFEMResult(FemResultProvider femResults, IDynamicBeamElement beam, double time)
        {
            var stressCalculator = femResults.GetStressCalculator(beam);
            var beamResult       = femResults.GetResult(beam, time);

            return(new VertexResultCalculator(beamResult, beam, stressCalculator));
        }
Пример #2
0
        public TrainLoadOutput Calculate(FemResultProvider femResults, IList <VertexInput> vertices)
        {
            InitializeBeamVerticesMap(femResults, vertices);

            var times = this.timeSettings.GetTimeRange().ToList();

            Parallel.ForEach(times, time =>
            {
                var meshStressResults = new List <MeshStressResult>();
                foreach (var beam in femResults.GetBeams())
                {
                    var vertexResultCalculator = VertexResultCalculator.FromFEMResult(femResults, beam, time);

                    var beamVertices             = this.beamVerticesMap[beam];
                    var vertexMeshRestresResults = GenerateMeshStressResult(beamVertices, vertexResultCalculator);
                    meshStressResults.AddRange(vertexMeshRestresResults);
                }

                var stresses = GetStresses(meshStressResults);

                var maxStress        = stresses.Max();
                var minStress        = stresses.Min();
                var meshColorResults = ConvertStressToColor(meshStressResults, maxStress, minStress);
                var maxAcceleration  = GetMaxAcceleration(meshStressResults);

                var timeResult = TimeResult.GenerateTimeResult(time, maxAcceleration, meshColorResults);
                timeResults.Add(timeResult);
            });
            var resultData = this.GenerateTimeResults();

            return(resultData);
        }
Пример #3
0
 private void InitializeBeamVerticesMap(FemResultProvider femResults, IList <VertexInput> vertices)
 {
     this.beamVerticesMap = femResults.beamElementBarIDMap.Select(e => e.Key)
                            .ToDictionary(e => e, f => vertices.Where(g => g.BarId == femResults.beamElementBarIDMap[f]).ToList());
 }