// ============================= DATA COMPRESSION =================================== public vtkUnstructuredGrid ExportGrid(Database DB, List <string> Result, int step) { vtkUnstructuredGrid Output = vtkUnstructuredGrid.New(); // Update Node Coordinates UpdateNode(DB, step); // Create Deep Copy of Gird Output.SetPoints(Points); // Recreate Mesh for Output Grid foreach (Element E in DB.ElemLib.Values) { // ============= HEXA ================= if (E.Type.Contains("HEX") && E.PID == ID) { // Create Hexahedron vtkHexahedron Hex = vtkHexahedron.New(); Hex.GetPointIds().SetNumberOfIds(8); // Set Hexa nodes for (int i = 0; i < 8; i++) { Hex.GetPointIds().SetId(i, Nodes[E.NList[i]]); } // Save Element index Output.InsertNextCell(Hex.GetCellType(), Hex.GetPointIds()); } // ============= PENTA ================= if (E.Type.Contains("PENTA") && E.PID == ID) { // Create Wedge vtkWedge Penta = vtkWedge.New(); Penta.GetPointIds().SetNumberOfIds(6); // Set Penta nodes for (int i = 0; i < 6; i++) { Penta.GetPointIds().SetId(i, Nodes[E.NList[i]]); } // Save Element index Output.InsertNextCell(Penta.GetCellType(), Penta.GetPointIds()); } // ============= TETRA ================= if (E.Type.Contains("TET") && E.PID == ID) { // Create Tetra vtkTetra Tetra = vtkTetra.New(); Tetra.GetPointIds().SetNumberOfIds(4); // Set Tetra nodes for (int i = 0; i < 4; i++) { Tetra.GetPointIds().SetId(i, Nodes[E.NList[i]]); } // Save Element index Output.InsertNextCell(Tetra.GetCellType(), Tetra.GetPointIds()); } } foreach (string res in Result) { foreach (vtkFloatArray array in PointScalar) { if (array.GetName() == res + " INC " + step.ToString()) { vtkFloatArray ArrayCopy = vtkFloatArray.New(); ArrayCopy.DeepCopy(array); ArrayCopy.SetName(res); Output.GetPointData().AddArray(ArrayCopy); } } } Output.Update(); return(Output); }