/** * Assign degree of freedom to element * * @param e */ @Override public void assignTo(Element e) { // Asign degree of freedom to element VertexList vertices = e.vertices(); for (int j = 1; j <= vertices.size(); j++) { Vertex v = vertices.at(j); // Assign shape function to DOF DOF dof = new DOF( j, // Local DOF index v.globalNode().getIndex(), // Global DOF index, take global node index shapeFun[j - 1] // Shape function ); e.addNodeDOF(j, dof); } }
@Override public void assignElement(Element e) { this.e = e; // 由node改为vertex,因为Element.adjustVerticeToCounterClockwise()结点顺序只调整了vertex VertexList vList = e.vertices(); double x1 = vList.at(1).coord(1), y1 = vList.at(1).coord(2); double x2 = vList.at(2).coord(1), y2 = vList.at(2).coord(2); double x3 = vList.at(3).coord(1), y3 = vList.at(3).coord(2); area = ((x2 * y3 - x3 * y2) - (x1 * y3 - x3 * y1) + (x1 * y2 - x2 * y1)) / 2.0; a[0] = x2 * y3 - x3 * y2; b[0] = y2 - y3; c[0] = x3 - x2; a[1] = x3 * y1 - x1 * y3; b[1] = y3 - y1; c[1] = x1 - x3; a[2] = x1 * y2 - x2 * y1; b[2] = y1 - y2; c[2] = x2 - x1; }