protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Indata
            bool         go        = false;
            WR_Structure structure = null;
            List <int>   modes     = new List <int>();

            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();


            if (!DA.GetData(0, ref structure))
            {
                return;
            }
            if (!DA.GetDataList(1, modes))
            {
                return;
            }
            if (!DA.GetData(2, ref go))
            {
                return;
            }

            if (go)
            {
                _resElems = new List <ResultElement>();
                _log.Clear();
                watch.Restart();

                // Solve
                _solver = new WR_EigenSolver(structure);
                _solver.Solve();

                watch.Stop();

                _log.Add(String.Format("Solve system: {0}ms", watch.ElapsedMilliseconds));

                watch.Restart();


                if (_solver != null && structure != null)
                {
                    _eigVals = new List <double>();
                    foreach (int mode in modes)
                    {
                        _eigVals.Add(_solver.SetResultsToMode(mode));
                    }

                    watch.Stop();

                    _log.Add(String.Format("Analyse modes: {0}ms", watch.ElapsedMilliseconds));

                    watch.Restart();


                    // Extract results
                    List <WR_IElement> elems = structure.GetAllElements();
                    _resElems.Clear();

                    for (int i = 0; i < elems.Count; i++)
                    {
                        if (elems[i] is WR_Element3d)
                        {
                            WR_Element3d  el3d = (WR_Element3d)elems[i];
                            ResultElement re   = new ResultElement(el3d);
                            _resElems.Add(re);
                        }
                    }

                    watch.Stop();

                    _log.Add(String.Format("Extract results: {0}ms", watch.ElapsedMilliseconds));
                }
            }



            DA.SetDataList(0, _log);
            DA.SetDataList(1, _resElems);
            DA.SetDataList(2, _eigVals);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Indata
            bool go = false;
            WR_Structure structure = null;
            List<int> modes = new List<int>();
            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();

            if (!DA.GetData(0, ref structure)) { return; }
            if (!DA.GetDataList(1, modes)) { return; }
            if (!DA.GetData(2, ref go)) { return; }

            if (go)
            {
                _resElems = new List<ResultElement>();
                _log.Clear();
                watch.Restart();

                // Solve
                _solver = new WR_EigenSolver(structure);
                _solver.Solve();

                watch.Stop();

                _log.Add(String.Format("Solve system: {0}ms", watch.ElapsedMilliseconds));

                watch.Restart();

                if (_solver != null && structure != null)
                {

                    _eigVals = new List<double>();
                    foreach (int mode in modes)
                    {
                        _eigVals.Add(_solver.SetResultsToMode(mode));
                    }

                    watch.Stop();

                    _log.Add(String.Format("Analyse modes: {0}ms", watch.ElapsedMilliseconds));

                    watch.Restart();

                    // Extract results
                    List<WR_IElement> elems = structure.GetAllElements();
                    _resElems.Clear();

                    for (int i = 0; i < elems.Count; i++)
                    {

                        if (elems[i] is WR_Element3d)
                        {
                            WR_Element3d el3d = (WR_Element3d)elems[i];
                            ResultElement re = new ResultElement(el3d);
                            _resElems.Add(re);
                        }
                    }

                    watch.Stop();

                    _log.Add(String.Format("Extract results: {0}ms", watch.ElapsedMilliseconds));

                }
            }

            DA.SetDataList(0, _log);
            DA.SetDataList(1, _resElems);
            DA.SetDataList(2, _eigVals);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Indata
            bool go = false;
            List<WR_Node3d> nodes = new List<WR_Node3d>();
            List<WR_IElemRcp> beams = new List<WR_IElemRcp>();
            int mode = 0;

            if (!DA.GetDataList(0, nodes)) { return; }
            if (!DA.GetDataList(1, beams)) { return; }
            if (!DA.GetData(2, ref mode)) { return; }
            if (!DA.GetData(3, ref go)) { return; }

            if (go)
            {
                resElems = new List<ResultElement>();

                log.Clear();
                log.Add("Structure invokation started");

                // Create structure wrapper
                _structure = new WR_Structure();

                // Add restraint nodes
                foreach (WR_Node3d n in nodes)
                    _structure.AddNode(n);
                log.Add("" + nodes.Count + " nodes added to structure");

                // Add elements
                foreach (WR_Elem3dRcp e in beams)
                    _structure.AddElementRcp(e);
                log.Add("" + beams.Count + " elements added to structure");

                // Add forces

                // Solve
                _solver = new WR_EigenSolver(_structure);
                _solver.Solve();
                //structure.EigenSolve(mode);

            }

            if (_solver != null && _structure != null)
            {
                _eigVal =_solver.SetResultsToMode(mode);

                // Extract results
                List<WR_IElement> elems = _structure.GetAllElements();
                resElems.Clear();

                for (int i = 0; i < elems.Count; i++)
                {

                    if (elems[i] is WR_Element3d)
                    {
                        WR_Element3d el3d = (WR_Element3d)elems[i];
                        ResultElement re = new ResultElement(el3d);
                        resElems.Add(re);
                    }
                }
            }

            DA.SetData(0, log);
            DA.SetDataList(1, resElems);
            DA.SetData(2, _eigVal);
        }
示例#4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Indata
            bool               go    = false;
            List <WR_Node3d>   nodes = new List <WR_Node3d>();
            List <WR_IElemRcp> beams = new List <WR_IElemRcp>();
            int mode = 0;

            if (!DA.GetDataList(0, nodes))
            {
                return;
            }
            if (!DA.GetDataList(1, beams))
            {
                return;
            }
            if (!DA.GetData(2, ref mode))
            {
                return;
            }
            if (!DA.GetData(3, ref go))
            {
                return;
            }

            if (go)
            {
                resElems = new List <ResultElement>();

                log.Clear();
                log.Add("Structure invokation started");

                // Create structure wrapper
                _structure = new WR_Structure();

                // Add restraint nodes
                foreach (WR_Node3d n in nodes)
                {
                    _structure.AddNode(n);
                }
                log.Add("" + nodes.Count + " nodes added to structure");

                // Add elements
                foreach (WR_Elem3dRcp e in beams)
                {
                    _structure.AddElementRcp(e);
                }
                log.Add("" + beams.Count + " elements added to structure");

                // Add forces

                // Solve
                _solver = new WR_EigenSolver(_structure);
                _solver.Solve();
                //structure.EigenSolve(mode);
            }

            if (_solver != null && _structure != null)
            {
                _eigVal = _solver.SetResultsToMode(mode);

                // Extract results
                List <WR_IElement> elems = _structure.GetAllElements();
                resElems.Clear();

                for (int i = 0; i < elems.Count; i++)
                {
                    if (elems[i] is WR_Element3d)
                    {
                        WR_Element3d  el3d = (WR_Element3d)elems[i];
                        ResultElement re   = new ResultElement(el3d);
                        resElems.Add(re);
                    }
                }
            }



            DA.SetData(0, log);
            DA.SetDataList(1, resElems);
            DA.SetData(2, _eigVal);
        }