Exemplo n.º 1
0
        public Matrix <double> GetGlobalStiffnessMatrix()
        {
            int             of = SM_Vertex.dof;
            int             n  = mesh.vertexCount * of;
            Matrix <double> K  = Matrix <double> .Build.Sparse(n, n, 0);

            for (int i = 0; i < edges.Count; i++)
            {
                SM_Edge e = edges[i];
                double[,] local = e.GetLocalStiffnessMatrix();
                for (int j = 0; j < SM_Vertex.dof; j++)
                {
                    K[of * e.row + j, of *e.row + j] += local[j, j];
                    K[of * e.col + j, of *e.col + j] += local[of + j, of + j];
                    K[of * e.row + j, of *e.col + j] += local[j, of + j];
                    K[of * e.col + j, of *e.row + j] += local[of + j, j];
                }
            }

            return(K);
        }
Exemplo n.º 2
0
        public void SetEdges(List <SM_Edge> edges, SortedDictionary <int, SM_Vertex> lookup)
        {
            SM_Vertex pv = TryGetVertex(p, lookup);

            pv.AddParent(this);
            SM_Vertex qv = TryGetVertex(q, lookup);

            qv.AddParent(this);
            SM_Vertex rv = TryGetVertex(r, lookup);

            rv.AddParent(this);
            SM_Edge e0 = new SM_Edge(pv, qv, kc);

            edges.Add(e0);
            SM_Edge e1 = new SM_Edge(qv, rv, kc);

            edges.Add(e1);
            SM_Edge e2 = new SM_Edge(rv, pv, kc);

            edges.Add(e2);
        }