public static int permutation(this elementMirror em, int i) { switch (em) { case elementMirror.quad8: { int[] p = { 1, 8, 7, 6, 5, 4, 3, 2 }; return(p[i] - 1); } case elementMirror.hex20: { int[] p = { 1, 8, 7, 6, 5, 4, 3, 2, 9, 12, 11, 10, 13, 20, 19, 18, 17, 16, 15, 14 }; return(p[i] - 1); } default: return(0); } }
private void doMirror() { if (m.nDim == 2 && axis == 'z') { return; } int iax = getIntAxis(axis); // Mirror nodal coordinates for (int i = 0; i < m.nNod; i++) { m.setNodeCoord(i, iax, -m.getNodeCoord(i, iax) + 2 * value); } // Change order of element connectivities for (int e = 0; e < m.nEl; e++) { elementMirror em = elementMirror.Null; try { //em = elementMirror.valueOf(m.elems[e].name); em = (elementMirror)System.Enum.Parse(typeof(elementMirror), m.elems[e].name); } catch (Exception el) { UTIL.errorMsg("Mirror: element not supported " + m.elems[e].name); } int nind = m.elems[e].ind.Length; int[] ind = new int[nind]; for (int i = 0; i < nind; i++) { ind[em.permutation(i)] = m.elems[e].ind[i]; } m.elems[e].setElemConnectivities(ind); } }