Пример #1
0
        public Tuple <double[, ], Matrix <double> [, ]> CreateGlobalStiffnessMatrix(GH_Structure <GH_Integer> treeConnectivity, GH_Structure <GH_Point> treePoints, int sizeOfM)
        {
            double[,] K_i   = new double[sizeOfM, sizeOfM];
            double[,] K_tot = new double[sizeOfM, sizeOfM];
            //List<Matrix<Double>> B_e = new List<Matrix<Double>>();
            Matrix <double>[] B_e = new Matrix <double> [8];


            //List<List<Matrix<double>>> B_all = new List<List<Matrix<double>>>();
            Matrix <double>[,] B_all = new Matrix <double> [treeConnectivity.PathCount, 8];
            StiffnessMatrix          sm  = new StiffnessMatrix(E, nu);
            Assembly_StiffnessMatrix aSM = new Assembly_StiffnessMatrix();

            for (int i = 0; i < treeConnectivity.PathCount; i++)
            {
                List <GH_Integer> connectedNodes  = (List <GH_Integer>)treeConnectivity.get_Branch(i);
                List <GH_Point>   connectedPoints = (List <GH_Point>)treePoints.get_Branch(i);

                var             tuple = sm.CreateMatrix(connectedPoints);
                Matrix <double> K_e   = tuple.Item1;
                B_e = tuple.Item2;

                for (int j = 0; j < B_e.Length; j++)
                {
                    B_all[i, j] = B_e[j];
                }

                K_i = aSM.assemblyMatrix(K_e, connectedNodes, sizeOfM);

                for (int j = 0; j < sizeOfM; j++)
                {
                    for (int k = 0; k < sizeOfM; k++)
                    {
                        K_tot[j, k] = K_tot[j, k] + K_i[j, k];
                    }
                }
            }

            //Check if stiffness matrix is symmetric
            //if (!IsSymmetric(K_tot)) return null; // Some error thing.

            return(Tuple.Create(K_tot, B_all));
        }
Пример #2
0
        public Tuple <Matrix <double>, List <List <Matrix <Double> > > > CreateGlobalStiffnessMatrix(GH_Structure <GH_Integer> treeConnectivity, GH_Structure <GH_Point> treePoints, int sizeOfM, double E, double nu)
        {
            Matrix <double> K_i = Matrix <double> .Build.Dense(sizeOfM, sizeOfM);

            Matrix <double> K_tot = Matrix <double> .Build.Dense(sizeOfM, sizeOfM);

            List <Matrix <Double> >         B_e   = new List <Matrix <Double> >();
            List <List <Matrix <double> > > B_all = new List <List <Matrix <double> > >();
            StiffnessMatrix          sm           = new StiffnessMatrix(E, nu);
            Assembly_StiffnessMatrix aSM          = new Assembly_StiffnessMatrix();

            for (int i = 0; i < treeConnectivity.PathCount; i++)
            {
                List <GH_Integer> connectedNodes  = (List <GH_Integer>)treeConnectivity.get_Branch(i);
                List <GH_Point>   connectedPoints = (List <GH_Point>)treePoints.get_Branch(i);

                var             tuple = sm.CreateMatrix(connectedPoints);
                Matrix <double> K_e   = tuple.Item1;
                B_e = tuple.Item2;
                B_all.Add(B_e);
                K_tot = aSM.AssemblyMatrix(K_tot, K_e, connectedNodes, sizeOfM);
            }
            return(Tuple.Create(K_tot, B_all));
        }