3d 시뮬레이션을 돌리면 속도/밀도만 계산할땐 멀쩡하다가 뭐 좀 보고 싶어서 하나 하나 추가하다보면


멀쩡한 프로그램이 에러나면서 꺼짐


데이터 저장하는 메소드는 이런 식


public void saveFiles() { StringBuilder post = new StringBuilder(); post.Append("# vtk DataFile Version 3.0"); post.AppendLine(); post.Append("fluid_state"); post.AppendLine(); post.Append("ASCII"); post.AppendLine(); post.Append("DATASET STRUCTURED_POINTS"); post.AppendLine(); post.Append("DIMENSIONS " + data.size[0].ToString() + " " + data.size[1].ToString() + " 1"); post.AppendLine(); post.Append("ORIGIN 0 0 0"); post.AppendLine(); post.Append("SPACING 1 1 1"); post.AppendLine(); post.Append("POINT_DATA " + (data.size[0] * data.size[1]).ToString()); post.AppendLine(); post.Append("SCALARS density double 1"); post.AppendLine(); post.Append("LOOKUP_TABLE default"); post.AppendLine(); for (int index = 0; index < data.size[0] * data.size[1]; index++) { post.Append(data.density[index].ToString()); post.AppendLine(); } post.Append("VECTORS velocity_vector double"); post.AppendLine(); for (int index = 0; index < data.size[0] * data.size[1]; index++) { post.Append(data.ux[index].ToString() + " " + data.uy[index].ToString() + " 0"); post.AppendLine(); } name = nameFiles("vtk"); System.IO.File.WriteAllText(name, post.ToString()); }