public static HexVolume CreateVolume(Vertex v1, Vertex v2, Vertex v3, Vertex v4, Vertex v5, Vertex v6, Vertex v7, Vertex v8) { HexVolume vol = new HexVolume(IDCounter.ClaimID()); return(vol); }
public static HexVolume CreateVolume(QuadFace f1, QuadFace f2, QuadFace f3, QuadFace f4, QuadFace f5, QuadFace f6) { HexVolume vol = new HexVolume(IDCounter.ClaimID()); List <Face> faces = new List <Face>() { f1, f2, f3, f4, f5, f6 }; List <Edge> edges = new List <Edge>(); List <Vertex> vertices = new List <Vertex>(); foreach (Face f in faces) { if (vol.Face1 == null && f is QuadFace) { vol.Face1 = f as QuadFace; } else if (vol.Face2 == null && f is QuadFace) { vol.Face2 = f as QuadFace; } else if (vol.Face3 == null && f is QuadFace) { vol.Face3 = f as QuadFace; } else if (vol.Face4 == null && f is QuadFace) { vol.Face4 = f as QuadFace; } else if (vol.Face5 == null && f is QuadFace) { vol.Face5 = f as QuadFace; } else if (vol.Face6 == null && f is QuadFace) { vol.Face6 = f as QuadFace; } else { Console.WriteLine("Error during volume #" + vol.ID + "creation: Not expected face type."); } if (f.Volume1 == null) { f.Volume1 = vol; } else if (f.Volume2 == null) { f.Volume2 = vol; } else { Console.WriteLine("Error during volume #" + vol.ID + "creation: Face #" + f.ID + " already has."); } if (f is TriFace) { if (!edges.Contains((f as TriFace).Edge1)) { edges.Add((f as TriFace).Edge1); } if (!edges.Contains((f as TriFace).Edge2)) { edges.Add((f as TriFace).Edge2); } if (!edges.Contains((f as TriFace).Edge3)) { edges.Add((f as TriFace).Edge3); } if (!vertices.Contains((f as TriFace).Vertex1)) { vertices.Add((f as TriFace).Vertex1); } if (!vertices.Contains((f as TriFace).Vertex2)) { vertices.Add((f as TriFace).Vertex2); } if (!vertices.Contains((f as TriFace).Vertex3)) { vertices.Add((f as TriFace).Vertex3); } } if (f is QuadFace) { if (!edges.Contains((f as QuadFace).Edge1)) { edges.Add((f as QuadFace).Edge1); } if (!edges.Contains((f as QuadFace).Edge2)) { edges.Add((f as QuadFace).Edge2); } if (!edges.Contains((f as QuadFace).Edge3)) { edges.Add((f as QuadFace).Edge3); } if (!edges.Contains((f as QuadFace).Edge4)) { edges.Add((f as QuadFace).Edge4); } if (!vertices.Contains((f as QuadFace).Vertex1)) { vertices.Add((f as QuadFace).Vertex1); } if (!vertices.Contains((f as QuadFace).Vertex2)) { vertices.Add((f as QuadFace).Vertex2); } if (!vertices.Contains((f as QuadFace).Vertex3)) { vertices.Add((f as QuadFace).Vertex3); } if (!vertices.Contains((f as QuadFace).Vertex4)) { vertices.Add((f as QuadFace).Vertex4); } } } vol.Vertex1 = vertices[0]; if (!vol.Vertex1.Volumes.Contains(vol)) { vol.Vertex1.Volumes.Add(vol); } vol.Vertex2 = vertices[1]; if (!vol.Vertex2.Volumes.Contains(vol)) { vol.Vertex2.Volumes.Add(vol); } vol.Vertex3 = vertices[2]; if (!vol.Vertex3.Volumes.Contains(vol)) { vol.Vertex3.Volumes.Add(vol); } vol.Vertex4 = vertices[3]; if (!vol.Vertex4.Volumes.Contains(vol)) { vol.Vertex4.Volumes.Add(vol); } vol.Vertex5 = vertices[4]; if (!vol.Vertex5.Volumes.Contains(vol)) { vol.Vertex5.Volumes.Add(vol); } vol.Vertex6 = vertices[5]; if (!vol.Vertex6.Volumes.Contains(vol)) { vol.Vertex6.Volumes.Add(vol); } vol.Vertex7 = vertices[6]; if (!vol.Vertex7.Volumes.Contains(vol)) { vol.Vertex7.Volumes.Add(vol); } vol.Vertex8 = vertices[7]; if (!vol.Vertex8.Volumes.Contains(vol)) { vol.Vertex8.Volumes.Add(vol); } vol.Edge1 = edges[0]; if (!vol.Edge1.Volumes.Contains(vol)) { vol.Edge1.Volumes.Add(vol); } vol.Edge2 = edges[1]; if (!vol.Edge2.Volumes.Contains(vol)) { vol.Edge2.Volumes.Add(vol); } vol.Edge3 = edges[2]; if (!vol.Edge3.Volumes.Contains(vol)) { vol.Edge3.Volumes.Add(vol); } vol.Edge4 = edges[3]; if (!vol.Edge4.Volumes.Contains(vol)) { vol.Edge4.Volumes.Add(vol); } vol.Edge5 = edges[4]; if (!vol.Edge5.Volumes.Contains(vol)) { vol.Edge5.Volumes.Add(vol); } vol.Edge6 = edges[5]; if (!vol.Edge6.Volumes.Contains(vol)) { vol.Edge6.Volumes.Add(vol); } vol.Edge7 = edges[6]; if (!vol.Edge7.Volumes.Contains(vol)) { vol.Edge7.Volumes.Add(vol); } vol.Edge8 = edges[7]; if (!vol.Edge8.Volumes.Contains(vol)) { vol.Edge8.Volumes.Add(vol); } vol.Edge9 = edges[8]; if (!vol.Edge9.Volumes.Contains(vol)) { vol.Edge9.Volumes.Add(vol); } vol.Edge10 = edges[9]; if (!vol.Edge10.Volumes.Contains(vol)) { vol.Edge10.Volumes.Add(vol); } vol.Edge11 = edges[10]; if (!vol.Edge11.Volumes.Contains(vol)) { vol.Edge11.Volumes.Add(vol); } vol.Edge12 = edges[11]; if (!vol.Edge12.Volumes.Contains(vol)) { vol.Edge12.Volumes.Add(vol); } vol.CalculateCenter(); vol.CalculateSurface(); vol.CalculateVolume(); return(vol); }