### Modified degenerate tetrahedron check to see if point lies less than 1e-4 from adjacent face

parent cbff08b3
 ... ... @@ -1220,30 +1220,66 @@ namespace Nektar // point. sort(m_vertex.begin(), m_vertex.end()); // Calculate a.(b x c) to determine tet volume; if negative, // reverse order of non-degenerate points to correctly orientate // the tet. double ax = m_vertex->m_x-m_vertex->m_x; double ay = m_vertex->m_y-m_vertex->m_y; double az = m_vertex->m_z-m_vertex->m_z; double bx = m_vertex->m_x-m_vertex->m_x; double by = m_vertex->m_y-m_vertex->m_y; double bz = m_vertex->m_z-m_vertex->m_z; double cx = m_vertex->m_x-m_vertex->m_x; double cy = m_vertex->m_y-m_vertex->m_y; double cz = m_vertex->m_z-m_vertex->m_z; double vol = cx*(ay*bz-az*by)+cy*(az*bx-ax*bz)+cz*(ax*by-ay*bx); vol /= 6.0; if (fabs(vol) <= 1e-10) // Calculate a.(b x c) if negative, reverse order of // non-degenerate points to correctly orientate the tet. NekDouble ax = m_vertex->m_x-m_vertex->m_x; NekDouble ay = m_vertex->m_y-m_vertex->m_y; NekDouble az = m_vertex->m_z-m_vertex->m_z; NekDouble bx = m_vertex->m_x-m_vertex->m_x; NekDouble by = m_vertex->m_y-m_vertex->m_y; NekDouble bz = m_vertex->m_z-m_vertex->m_z; NekDouble cx = m_vertex->m_x-m_vertex->m_x; NekDouble cy = m_vertex->m_y-m_vertex->m_y; NekDouble cz = m_vertex->m_z-m_vertex->m_z; NekDouble nx = (ay*bz-az*by); NekDouble ny = (az*bx-ax*bz); NekDouble nz = (ax*by-ay*bx); NekDouble nmag = sqrt(nx*nx+ny*ny+nz*nz); nx /= nmag; ny /= nmag; nz /= nmag; // distance of top vertex from base NekDouble dist = cx*nx+cy*ny+cz*nz; if (fabs(dist) <= 1e-4) { cerr << "Warning: degenerate tetrahedron, volume = " << vol << endl; cerr << "Warning: degenerate tetrahedron, 3rd vertex is = " << dist <<" from face" << endl; } if (vol < 0) if (dist < 0) { swap(m_vertex, m_vertex); } nx = (ay*cz-az*cy); ny = (az*cx-ax*cz); nz = (ax*cy-ay*cx); nmag = sqrt(nx*nx+ny*ny+nz*nz); nx /= nmag; ny /= nmag; nz /= nmag; // distance of top vertex from base dist = bx*nx+by*ny+bz*nz; if (fabs(dist) <= 1e-4) { cerr << "Warning: degenerate tetrahedron, 2nd vertex is = " << dist <<" from face" << endl; } nx = (by*cz-bz*cy); ny = (bz*cx-bx*cz); nz = (bx*cy-by*cx); nmag = sqrt(nx*nx+ny*ny+nz*nz); nx /= nmag; ny /= nmag; nz /= nmag; // distance of top vertex from base dist = ax*nx+ay*ny+az*nz; if (fabs(dist) <= 1e-4) { cerr << "Warning: degenerate tetrahedron, 1st vertex is = " << dist <<" from face" << endl; } TetOrientSet::iterator it; ... ... @@ -1499,16 +1535,24 @@ namespace Nektar faceVertices.push_back(m_vertex[face_ids[j][k]]); NodeSharedPtr a = m_vertex[face_ids[j][k]]; NodeSharedPtr b = m_vertex[face_ids[j][(k+1) % nEdge]]; for (unsigned int i = 0; i < m_edge.size(); ++i) unsigned int i; for (i = 0; i < m_edge.size(); ++i) { if ((m_edge[i]->m_n1 == a && m_edge[i]->m_n2 == b) || (m_edge[i]->m_n1 == b && m_edge[i]->m_n2 == a)) if ((m_edge[i]->m_n1->m_id == a->m_id && m_edge[i]->m_n2->m_id == b->m_id) || (m_edge[i]->m_n1->m_id == b->m_id && m_edge[i]->m_n2->m_id == a->m_id)) { faceEdges.push_back(m_edge[i]); face_edges[j][k] = i; break; } } if(i == m_edge.size()) { face_edges[j][k] = -1; } } if (m_conf.m_faceNodes) ... ... @@ -1544,14 +1588,23 @@ namespace Nektar // Re-order edge array to be consistent with Nektar++ ordering. vector tmp(9); ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; ASSERTL1(face_edges != -1,"face_edges == -1"); tmp = m_edge[face_edges]; m_edge = tmp; } ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!