diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index 8c2d4a7b8..6b955eb3e 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -769,18 +769,25 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, int num = aFace->NbNodes(); switch(num){ - - case 4:// quad face - BndBox.Add(facesHelper[i++].set(4, aFace, aFace->GetID(), 0, aFace->GetNode(0), aFace->GetNode(1), aFace->GetNode(2), aFace->GetNode(3))); - break; - case 3:// tria face + case 3: + //tria3 face = N1, N2, N3 BndBox.Add(facesHelper[i++].set(3, aFace, aFace->GetID(), 0, aFace->GetNode(0), aFace->GetNode(1), aFace->GetNode(2))); break; - case 6:// tria face with 6 nodes + case 4: + //quad4 face = N1, N2, N3, N4 + BndBox.Add(facesHelper[i++].set(4, aFace, aFace->GetID(), 0, aFace->GetNode(0), aFace->GetNode(1), aFace->GetNode(2), aFace->GetNode(3))); + break; + case 6: + //tria6 face = N1, N2, N3, N4, N5, N6 BndBox.Add(facesHelper[i++].set(6, aFace, aFace->GetID(), 0, aFace->GetNode(0), aFace->GetNode(1), aFace->GetNode(2), aFace->GetNode(3), aFace->GetNode(4), aFace->GetNode(5))); break; - default://unknown face type - throw std::runtime_error("Node count not supported by ViewProviderFemMesh, [3|4|6] are allowed"); + case 8: + //quad8 face = N1, N2, N3, N4, N5, N6, N7, N8 + BndBox.Add(facesHelper[i++].set(8, aFace, aFace->GetID(), 0, aFace->GetNode(0), aFace->GetNode(1), aFace->GetNode(2), aFace->GetNode(3), aFace->GetNode(4), aFace->GetNode(5), aFace->GetNode(6), aFace->GetNode(7))); + break; + default: + //unknown face type + throw std::runtime_error("Node count not supported by ViewProviderFemMesh, [3|4|6|8] are allowed"); } } } @@ -794,45 +801,114 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, int num = aVol->NbNodes(); switch (num){ - // tet 4 element + //tetra4 volume case 4: - // face 1 + // face 1 = N1, N2, N3 BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2))); - // face 2 + // face 2 = N1, N4, N2 BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 2, aVol->GetNode(0), aVol->GetNode(3), aVol->GetNode(1))); - // face 3 + // face 3 = N2, N4, N3 BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 3, aVol->GetNode(1), aVol->GetNode(3), aVol->GetNode(2))); - // face 4 + // face 4 = N3, N4, N1 BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 4, aVol->GetNode(2), aVol->GetNode(3), aVol->GetNode(0))); break; - //unknown case - case 8: - // face 1 + //pyra5 volume + case 5: + // face 1 = N1, N2, N3, N4 BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(3))); - // face 2 + // face 2 = N1, N5, N2 + BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 2, aVol->GetNode(0), aVol->GetNode(4), aVol->GetNode(1))); + // face 3 = N2, N5, N3 + BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 3, aVol->GetNode(1), aVol->GetNode(4), aVol->GetNode(2))); + // face 4 = N3, N5, N4 + BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 4, aVol->GetNode(2), aVol->GetNode(4), aVol->GetNode(3))); + // face 5 = N4, N5, N1 + BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 5, aVol->GetNode(3), aVol->GetNode(4), aVol->GetNode(0))); + break; + //penta6 volume + case 6: + // face 1 = N1, N2, N3 + BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2))); + // face 2 = N4, N6, N5 + BndBox.Add(facesHelper[i++].set(3, aVol, aVol->GetID(), 2, aVol->GetNode(3), aVol->GetNode(5), aVol->GetNode(4))); + // face 3 = N1, N4, N5, N2 + BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 3, aVol->GetNode(0), aVol->GetNode(3), aVol->GetNode(4), aVol->GetNode(1))); + // face 4 = N2, N5, N6, N3 + BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 4, aVol->GetNode(1), aVol->GetNode(4), aVol->GetNode(5), aVol->GetNode(2))); + // face 5 = N3, N6, N4, N1 + BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 5, aVol->GetNode(2), aVol->GetNode(5), aVol->GetNode(3), aVol->GetNode(0))); + break; + //hexa8 volume + //the nodes of hexa8 are not according the node numbers on the FreeCAD wiki Fem_Mesh + case 8: + // face 1 = N1, N2, N3, N4 + BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(3))); + // face 2 = N5, N6, N7, N8 BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 2, aVol->GetNode(4), aVol->GetNode(5), aVol->GetNode(6), aVol->GetNode(7))); - // face 3 + // face 3 = N1, N2, N5, N6 BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 3, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(4), aVol->GetNode(5))); - // face 4 + // face 4 = N2, N3, N6, N7 BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 4, aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(5), aVol->GetNode(6))); - // face 5 + // face 5 = N3, N4, N7, N8 BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 5, aVol->GetNode(2), aVol->GetNode(3), aVol->GetNode(6), aVol->GetNode(7))); - // face 6 + // face 6 = N1, N4, N5, N8 BndBox.Add(facesHelper[i++].set(4, aVol, aVol->GetID(), 6, aVol->GetNode(0), aVol->GetNode(3), aVol->GetNode(4), aVol->GetNode(7))); break; - //unknown case + //tetra10 volume case 10: - // face 1 + // face 1 = N1, N2, N3, N5, N6, N7 BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(4), aVol->GetNode(5), aVol->GetNode(6))); - // face 2 + // face 2 = N1, N4, N2, N8, N9, N5 BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 2, aVol->GetNode(0), aVol->GetNode(3), aVol->GetNode(1), aVol->GetNode(7), aVol->GetNode(8), aVol->GetNode(4))); - // face 3 + // face 3 = N2, N4, N3, N9, N10, N6 BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 3, aVol->GetNode(1), aVol->GetNode(3), aVol->GetNode(2), aVol->GetNode(8), aVol->GetNode(9), aVol->GetNode(5))); - // face 4 + // face 4 = N3, N4, N1, N10, N8, N7 BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 4, aVol->GetNode(2), aVol->GetNode(3), aVol->GetNode(0), aVol->GetNode(9), aVol->GetNode(7), aVol->GetNode(6))); break; - default://unknown volume type - throw std::runtime_error("Node count not supported by ViewProviderFemMesh, [4|8|10] are allowed"); // [4|5|6|8|10|13|15|20] + //pyra13 volume + case 13: + // face 1 = N1, N2, N3, N4, N6, N7, N8, N9 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(3), aVol->GetNode(5), aVol->GetNode(6), aVol->GetNode(7), aVol->GetNode(8))); + // face 2 = N1, N5, N2, N10, N11, N6 + BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 2, aVol->GetNode(0), aVol->GetNode(4), aVol->GetNode(1), aVol->GetNode(9), aVol->GetNode(10), aVol->GetNode(5))); + // face 3 = N2, N5, N3, N11, N12, N7 + BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 3, aVol->GetNode(1), aVol->GetNode(4), aVol->GetNode(2), aVol->GetNode(10), aVol->GetNode(11), aVol->GetNode(6))); + // face 4 = N3, N5, N4, N12, N13, N8 + BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 4, aVol->GetNode(2), aVol->GetNode(4), aVol->GetNode(3), aVol->GetNode(11), aVol->GetNode(12), aVol->GetNode(7))); + // face 5 = N4, N5, N1, N13, N10, N9 + BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 5, aVol->GetNode(3), aVol->GetNode(4), aVol->GetNode(0), aVol->GetNode(12), aVol->GetNode(9), aVol->GetNode(8))); + break; + //penta15 volume + case 15: + // face 1 = N1, N2, N3, N7, N8, N9 + BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(6), aVol->GetNode(7), aVol->GetNode(8))); + // face 2 = N4, N6, N5, N12, N11, N10 + BndBox.Add(facesHelper[i++].set(6, aVol, aVol->GetID(), 2, aVol->GetNode(3), aVol->GetNode(5), aVol->GetNode(4), aVol->GetNode(11), aVol->GetNode(10), aVol->GetNode(9))); + // face 3 = N1, N4, N5, N2, N13, N10, N14, N7 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 3, aVol->GetNode(0), aVol->GetNode(3), aVol->GetNode(4), aVol->GetNode(1), aVol->GetNode(12), aVol->GetNode(9), aVol->GetNode(13), aVol->GetNode(6))); + // face 4 = N2, N5, N6, N3, N14, N11, N15, N8 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 4, aVol->GetNode(1), aVol->GetNode(4), aVol->GetNode(5), aVol->GetNode(2), aVol->GetNode(13), aVol->GetNode(9), aVol->GetNode(14), aVol->GetNode(7))); + // face 5 = N3, N6, N4, N1, N15, N12, N13, N9 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 5, aVol->GetNode(2), aVol->GetNode(5), aVol->GetNode(3), aVol->GetNode(0), aVol->GetNode(14), aVol->GetNode(11), aVol->GetNode(12), aVol->GetNode(8))); + break; + //hexa20 volume + case 20: + // face 1 = N1, N2, N3, N4, N9, N10, N11, N12 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 1, aVol->GetNode(0), aVol->GetNode(1), aVol->GetNode(2), aVol->GetNode(3), aVol->GetNode(8), aVol->GetNode(9), aVol->GetNode(10), aVol->GetNode(11))); + // face 2 = N5, N8, N7, N6, N16, N15, N14, N13 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 2, aVol->GetNode(4), aVol->GetNode(7), aVol->GetNode(6), aVol->GetNode(5), aVol->GetNode(15), aVol->GetNode(14), aVol->GetNode(13), aVol->GetNode(12))); + // face 3 = N1, N5, N6, N2, N17, N13, N18, N9 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 3, aVol->GetNode(0), aVol->GetNode(4), aVol->GetNode(5), aVol->GetNode(1), aVol->GetNode(16), aVol->GetNode(12), aVol->GetNode(17), aVol->GetNode(8))); + // face 4 = N2, N6, N7, N3, N18, N14, N19, N10 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 4, aVol->GetNode(1), aVol->GetNode(5), aVol->GetNode(6), aVol->GetNode(2), aVol->GetNode(17), aVol->GetNode(13), aVol->GetNode(18), aVol->GetNode(9))); + // face 5 = N3, N7, N8, N4, N19, N15, N20, N11 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 5, aVol->GetNode(2), aVol->GetNode(6), aVol->GetNode(7), aVol->GetNode(3), aVol->GetNode(18), aVol->GetNode(14), aVol->GetNode(19), aVol->GetNode(10))); + // face 6 = N4, N8, N5, N1, N20, N16, N17, N12 + BndBox.Add(facesHelper[i++].set(8, aVol, aVol->GetID(), 6, aVol->GetNode(3), aVol->GetNode(7), aVol->GetNode(4), aVol->GetNode(0), aVol->GetNode(19), aVol->GetNode(15), aVol->GetNode(16), aVol->GetNode(11))); + break; + //unknown volume type + default: + throw std::runtime_error("Node count not supported by ViewProviderFemMesh, [4|5|6|8|10|13|15|20] are allowed"); } } } @@ -974,7 +1050,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, case 3:triangleCount++; break; case 4:triangleCount += 2; break; case 6:triangleCount += 4; break; - //case 8:triangleCount += 6; break; //quad8 face -> 6 triangle but no further implementation is done + // case 8:triangleCount += 6; break; //quad8 face -> 6 triangle but no further implementation is done default: throw std::runtime_error("only display mode nodes is supported for this element"); //default:assert(0); }