Beispiel #1
0
        /***************************************************/
        /**** Public method - Read override             ****/
        /***************************************************/

        public IEnumerable <IResult> ReadResults(GlobalResultRequest request, ActionConfig actionConfig = null)
        {
            CheckAndSetUpCases(request);

            switch (request.ResultType)
            {
            case GlobalResultType.Reactions:
                return(GetGlobalReactions());

            case GlobalResultType.ModalDynamics:
            default:
                Engine.Base.Compute.RecordError("Result extraction of type " + request.ResultType + " is not yet supported");
                return(new List <IResult>());
            }
        }
Beispiel #2
0
        public static IResultRequest IResultRequest(Type type, IEnumerable <object> ids = null, IEnumerable <object> cases = null, int divisions = 5)
        {
            IResultRequest request = null;

            if (typeof(BarResult).IsAssignableFrom(type))
            {
                BarResultType resType = BarResultType.BarForce;

                if (type == typeof(BarForce))
                {
                    resType = BarResultType.BarForce;
                }
                else if (type == typeof(BarDeformation))
                {
                    resType = BarResultType.BarDeformation;
                }
                else if (type == typeof(BarStress))
                {
                    resType = BarResultType.BarStress;
                }
                else if (type == typeof(BarStrain))
                {
                    resType = BarResultType.BarStrain;
                }
                else if (type == typeof(BarDisplacement))
                {
                    resType = BarResultType.BarDisplacement;
                }
                else if (type == typeof(BarModeShape))
                {
                    resType = BarResultType.BarModeShape;
                }
                else
                {
                    Reflection.Compute.RecordWarning("Did not find exact type. Assuming " + resType);
                }

                request = new BarResultRequest {
                    Divisions = divisions, DivisionType = DivisionType.EvenlyDistributed, ResultType = resType
                };
            }
            else if (typeof(MeshResult).IsAssignableFrom(type) || typeof(MeshElementResult).IsAssignableFrom(type))
            {
                MeshResultType resType = MeshResultType.Forces;

                if (type == typeof(MeshForce))
                {
                    resType = MeshResultType.Forces;
                }
                else if (type == typeof(MeshStress))
                {
                    resType = MeshResultType.Stresses;
                }
                else if (type == typeof(MeshVonMises))
                {
                    resType = MeshResultType.VonMises;
                }
                else if (type == typeof(MeshDisplacement))
                {
                    resType = MeshResultType.Displacements;
                }
                else if (type == typeof(MeshModeShape))
                {
                    resType = MeshResultType.MeshModeShape;
                }
                else
                {
                    Reflection.Compute.RecordWarning("Did not find exact type. Assuming " + resType);
                }

                request = new MeshResultRequest {
                    ResultType = resType
                };
            }
            else if (typeof(StructuralGlobalResult).IsAssignableFrom(type))
            {
                GlobalResultType resType = GlobalResultType.Reactions;

                if (type == typeof(GlobalReactions))
                {
                    resType = GlobalResultType.Reactions;
                }
                else if (type == typeof(ModalDynamics))
                {
                    resType = GlobalResultType.ModalDynamics;
                }
                else
                {
                    Reflection.Compute.RecordWarning("Did not find exact type. Assuming " + resType);
                }

                request = new GlobalResultRequest {
                    ResultType = resType
                };
            }
            else if (typeof(NodeResult).IsAssignableFrom(type))
            {
                NodeResultType resType = NodeResultType.NodeReaction;

                if (type == typeof(NodeReaction))
                {
                    resType = NodeResultType.NodeReaction;
                }
                else if (type == typeof(NodeDisplacement))
                {
                    resType = NodeResultType.NodeDisplacement;
                }
                else if (type == typeof(NodeAcceleration))
                {
                    resType = NodeResultType.NodeAcceleration;
                }
                else if (type == typeof(NodeVelocity))
                {
                    resType = NodeResultType.NodeVelocity;
                }
                else if (type == typeof(NodeModalMass))
                {
                    resType = NodeResultType.NodeModalMass;
                }
                else if (type == typeof(NodeModeShape))
                {
                    resType = NodeResultType.NodeModeShape;
                }
                else
                {
                    Reflection.Compute.RecordWarning("Did not find exact type. Assuming " + resType);
                }

                request = new NodeResultRequest {
                    ResultType = resType
                };
            }
            else
            {
                return(null);
            }


            if (ids != null)
            {
                request.ObjectIds = ids.ToList();
            }

            if (cases != null)
            {
                request.Cases = cases.ToList();
            }

            return(request);
        }