Esempio n. 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            StructureType structure = new StructureType();
            double        maxFreq   = new double();
            int           nbFreq    = new int();

            if (!DA.GetData(0, ref structure))
            {
                return;
            }
            if (!DA.GetData(1, ref maxFreq))
            {
                return;
            }
            if (!DA.GetData(2, ref nbFreq))
            {
                return;
            }

            //MiStrAnEngine.StaticFunctions.InverseIterationMethod(structure.K, structure.M, structure.bc, iterations);
            double[] freqs = new double[] { };
            MiStrAnEngine.Vector[] eigenVecs = new MiStrAnEngine.Vector[] { };

            if (structure.K == null)
            {
                StaticFunctions.ForceloadMKLCORE();
                structure.AssembleKfbc();
            }

            string infoString;

            double[] residual;

            MiStrAnEngine.StaticFunctions.GetEigenFreqs(structure, maxFreq, nbFreq, out freqs, out eigenVecs, out residual, out infoString);

            structure.eigenVecs = eigenVecs;

            foreach (double d in freqs)
            {
                if (Double.IsNaN(d))
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Choose a smaller range");
                }
            }

            DA.SetDataList(0, freqs);
            DA.SetData(1, structure);
            DA.SetDataList(2, residual.ToList());
            DA.SetData(3, infoString);
        }