diff --git a/include/VtkOutputter.hpp b/include/VtkOutputter.hpp index 7a451fc4..043255c6 100644 --- a/include/VtkOutputter.hpp +++ b/include/VtkOutputter.hpp @@ -131,10 +131,11 @@ namespace blitzdg { ++nodeId; } - if (cellTypes[Np] == VTK_QUAD) { - std::swap(nodes[1], nodes[3]); - std::swap(nodes[1], nodes[2]); - } + // This seems to make a mess of things in paraview (for N==1?). Probably don't want it. + //if (cellTypes[Np] == VTK_QUAD) { + // std::swap(nodes[1], nodes[3]); + // std::swap(nodes[1], nodes[2]); + //} unstructuredGrid->InsertNextCell(cellTypes[Np], Np, nodes.data()); } diff --git a/src/MeshManager.cpp b/src/MeshManager.cpp index 4d4638b6..fa8af095 100644 --- a/src/MeshManager.cpp +++ b/src/MeshManager.cpp @@ -101,7 +101,6 @@ namespace blitzdg { for (index_type k=0; k < NumElements; ++k) { - std::cout << k << ", " << E2V(NumFaces*k) << "\n"; // Enforce counter-clockwise ordering of vertices in EToV table. real_type ax = Vref(E2V(NumFaces*k)*Dim), ay = Vref(E2V(NumFaces*k)*Dim+1); real_type bx = Vref(E2V(NumFaces*k+1)*Dim), by = Vref(E2V(NumFaces*k+1)*Dim+1); @@ -110,8 +109,16 @@ namespace blitzdg { real_type det = (ax-cx)*(by-cy) - (bx-cx)*(ay-cy); if (det < 0) { - using std::swap; - swap(E2V(NumFaces*k+1), E2V(NumFaces*k+2)); + // Flip the ordering. + index_type tmp = E2V(NumFaces*k+1); + if (NumFaces == 3) { + E2V(NumFaces*k+1) = E2V(NumFaces*k+2); + E2V(NumFaces*k+2) = tmp; + } else if (NumFaces == 4) { + E2V(NumFaces*k+1) = E2V(NumFaces*k+2); + E2V(NumFaces*k+2) = E2V(NumFaces*k+3); + E2V(NumFaces*k+3) = tmp; + } } } @@ -300,12 +307,16 @@ namespace blitzdg { if (det < 0) { // Flip the ordering. index_type tmp = E2V(NumFaces*k+1); - E2V(NumFaces*k+1) = E2V(NumFaces*k+2); - E2V(NumFaces*k+2) = tmp; + if (NumFaces == 3) { + E2V(NumFaces*k+1) = E2V(NumFaces*k+2); + E2V(NumFaces*k+2) = tmp; + } else if (NumFaces == 4) { + E2V(NumFaces*k+1) = E2V(NumFaces*k+3); + E2V(NumFaces*k+3) = tmp; + } } } - buildConnectivity(); // calling this with 'lines' seems to be broken. diff --git a/src/QuadNodesProvisioner.cpp b/src/QuadNodesProvisioner.cpp index e4bd7fc7..df8c6d8d 100644 --- a/src/QuadNodesProvisioner.cpp +++ b/src/QuadNodesProvisioner.cpp @@ -730,7 +730,7 @@ namespace blitzdg { index_type count = 0; - index_matrix_type counter(N+1,N+1); + index_matrix_type counter(N+1, N+1); counter = -1; // -1 == 'No Value' for (index_type n=0; n < N+1; ++n) { @@ -754,7 +754,7 @@ namespace blitzdg { for (index_type n=0; n < N; ++n) { for (index_type m=0; m < N; ++m) { index_type v1 = counter(n,m), v2 = counter(n,m+1), - v3 = counter(n+1, m), v4 = counter(n+1,m+1); + v3 = counter(n+1, m+1), v4 = counter(n+1,m); index_vector_type quad1234(4); quad1234 = v1,v2,v3,v4;