Пример #1
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);
        }
Пример #2
0
        private static IEnumerable <MeshStressResult> GenerateMeshStressResult(IEnumerable <VertexInput> beamVertices, VertexResultCalculator vertexResultCalculator)
        {
            var result = new List <MeshStressResult>();

            foreach (var beamVertex in beamVertices)
            {
                var vertexResults = vertexResultCalculator.GetVertexStressResult(beamVertex.Vertices).ToList();
                var meshResult    = MeshStressResult.GenerateMeshResult(beamVertex, vertexResults);
                result.Add(meshResult);
            }
            return(result);
        }