Пример #1
0
        public override CompressedColumnStorage GetExtraEquations()
        {
            var buf = new CSparse.Storage.CoordinateStorage <double>(GetExtraEquationsCount(), parent.Nodes.Count * 6 + 1, 1);

            for (var i = 0; i < Nodes.Count; i++)
            {
                var nde = Nodes[i];

                if (_constraint.DX == DofConstraint.Fixed)
                {
                    buf.At(6 * i + 0, nde.Index * 6 + 0, _settlement.DX);
                }

                if (_constraint.DY == DofConstraint.Fixed)
                {
                    buf.At(6 * i + 1, nde.Index * 6 + 1, _settlement.DY);
                }

                if (_constraint.DZ == DofConstraint.Fixed)
                {
                    buf.At(6 * i + 2, nde.Index * 6 + 2, _settlement.DZ);
                }


                if (_constraint.RX == DofConstraint.Fixed)
                {
                    buf.At(6 * i + 3, nde.Index * 6 + 3, _settlement.RX);
                }

                if (_constraint.RY == DofConstraint.Fixed)
                {
                    buf.At(6 * i + 4, nde.Index * 6 + 4, _settlement.RY);
                }

                if (_constraint.RZ == DofConstraint.Fixed)
                {
                    buf.At(6 * i + 5, nde.Index * 6 + 5, _settlement.RZ);
                }
            }

            return(buf.ToCCs());
        }
Пример #2
0
        public override CompressedColumnStorage GetExtraEquations()
        {
            var n = parent.Nodes.Count;

            var buf = new CSparse.Storage.CoordinateStorage <double>(GetExtraEquationsCount(), parent.Nodes.Count * 6 + 1, 1);

            var cnt = 0;

            for (var i = 0; i < Nodes.Count; i++)
            {
                var nde = Nodes[i];

                var stIdx = nde.Index * 6;


                if (_constraint.DX == DofConstraint.Fixed)
                {
                    buf.At(cnt, stIdx + 0, 1);
                    buf.At(cnt, 6 * n, _settlement.DX);
                    cnt++;
                }

                if (_constraint.DY == DofConstraint.Fixed)
                {
                    buf.At(cnt, stIdx + 1, 1);
                    buf.At(cnt, 6 * n, _settlement.DY);
                    cnt++;
                }

                if (_constraint.DZ == DofConstraint.Fixed)
                {
                    buf.At(cnt, stIdx + 2, 1);
                    buf.At(cnt, 6 * n, _settlement.DZ);
                    cnt++;
                }


                if (_constraint.RX == DofConstraint.Fixed)
                {
                    buf.At(cnt, stIdx + 3, 1);
                    buf.At(cnt, 6 * n, _settlement.DX);
                    cnt++;
                }

                if (_constraint.RY == DofConstraint.Fixed)
                {
                    buf.At(cnt, stIdx + 4, 1);
                    buf.At(cnt, 6 * n, _settlement.DX);
                    cnt++;
                }

                if (_constraint.RZ == DofConstraint.Fixed)
                {
                    buf.At(cnt, stIdx + 5, 1);
                    buf.At(cnt, 6 * n, _settlement.DX);
                    cnt++;
                }
            }

            return(buf.ToCCs());
        }
        public override SparseMatrix GetExtraEquations()
        {
            var n = parent.Nodes.Count;

            var buf = new CSparse.Storage.CoordinateStorage <double>(GetExtraEquationsCount(), parent.Nodes.Count * 6 + 1, 10);


            var cnt = 0;

            //for (var i = 0; i < Nodes.Count; i++)
            {
                var ndei   = Nodes[0];
                var stiIdx = ndei.Index * 6;

                for (var j = 1; j < Nodes.Count; j++)
                {
                    var ndej   = Nodes[j];
                    var stjIdx = ndej.Index * 6;

                    if (_connectDx)
                    {
                        buf.At(cnt, stiIdx, 1);
                        buf.At(cnt, stjIdx, -1);
                        cnt++;
                    }

                    if (_connectDy)
                    {
                        buf.At(cnt, stiIdx + 1, 1);
                        buf.At(cnt, stjIdx + 1, -1);
                        cnt++;
                    }

                    if (_connectDz)
                    {
                        buf.At(cnt, stiIdx + 2, 1);
                        buf.At(cnt, stjIdx + 2, -1);
                        cnt++;
                    }


                    if (_connectRx)
                    {
                        buf.At(cnt, stiIdx + 3, 1);
                        buf.At(cnt, stjIdx + 3, -1);
                        cnt++;
                    }

                    if (_connectRy)
                    {
                        buf.At(cnt, stiIdx + 4, 1);
                        buf.At(cnt, stjIdx + 4, -1);
                        cnt++;
                    }

                    if (_connectRz)
                    {
                        buf.At(cnt, stiIdx + 5, 1);
                        buf.At(cnt, stjIdx + 5, -1);
                        cnt++;
                    }
                }
            }

            var buf2 = buf.ToCCs();


            return(buf2);
        }