public Grid3D(EclipseProject ecl) { System.Diagnostics.Debug.WriteLine("Grid3D.cs / void Grid3D()"); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.ColorArray); VBO = GL.GenBuffer(); EBO = GL.GenBuffer(); EBOQuads = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, VBO); GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO); Cells = new Cell[ecl.INIT.NACTIV]; for (int Z = 0; Z < ecl.INIT.NZ; ++Z) { for (int Y = 0; Y < ecl.INIT.NY; ++Y) { for (int X = 0; X < ecl.INIT.NX; ++X) { long cell_index = ecl.INIT.GetActive(X, Y, Z); if (cell_index > 0) { Cells[cell_index - 1] = ecl.EGRID.GetCell(X, Y, Z); } } } } }
public TabMap2D(EclipseProject ecl) { System.Diagnostics.Debug.WriteLine("Initizalize"); InitializeComponent(); model = new ChartModel(ecl); Application.DoEvents(); suspendEvents = true; boxGroupMode.SelectedIndex = 0; boxChartsPositions.SelectedIndex = 1; glControl = new GLControl(new GraphicsMode(new ColorFormat(8, 8, 8, 0), 24, 8, 4), 3, 3, GraphicsContextFlags.Default); glControl.Paint += GLControl_Paint; glControl.Load += GLControl_Load; glControl.Resize += GLControl_Resize; glControl.Dock = DockStyle.Fill; panelOpenGL.Controls.Add(glControl); suspendEvents = false; }
public Form2DModel(EclipseProject ecl) { this.ecl = ecl; engine = new Engine2D(); ecl.ReadEGRID(); ecl.ReadINIT(); }
public Form3D(EclipseProject ecl) { InitializeComponent(); this.ecl = ecl; subGraphicFilter = new SubGraphicFilter(); subGraphicFilter.UpdateData += SubGraphicFilterOnUpdateData; }
public void ExportToExcel(EclipseProject ecl) { var XL = new Microsoft.Office.Interop.Excel.Application { Visible = false, Interactive = false, ScreenUpdating = false, SheetsInNewWorkbook = 1 }; Workbook wb = XL.Workbooks.Add(); Worksheet ws = XL.Worksheets[1]; ws.Name = "DATA"; var range = ws.get_Range( ((Range)ws.Cells[2, 1]).Address, ((Range)ws.Cells[2 + ecl.SUMMARY.KEYWORDS.Length - 1, 4]).Address); object[,] keys = new object[ecl.SUMMARY.KEYWORDS.Length, 4]; for (int iw = 0; iw < ecl.SUMMARY.KEYWORDS.Length; ++iw) { keys[iw, 0] = ecl.SUMMARY.KEYWORDS[iw]; keys[iw, 1] = ecl.SUMMARY.WGUNITS[iw]; keys[iw, 2] = ecl.SUMMARY.WGNAMES[iw]; keys[iw, 3] = ecl.SUMMARY.NUMS[iw]; } range.Value = keys; range = ws.get_Range( ((Range)ws.Cells[2, 5]).Address, ((Range)ws.Cells[2 + ecl.SUMMARY.KEYWORDS.Length - 1, 5 + ecl.SUMMARY.NTIME - 1]).Address); object[,] data = new object[ecl.SUMMARY.KEYWORDS.Length, ecl.SUMMARY.NTIME]; for (int it = 0; it < ecl.SUMMARY.NTIME; ++it) { for (int iw = 0; iw < ecl.SUMMARY.KEYWORDS.Length; ++iw) { data[iw, it] = ecl.SUMMARY.DATA[it][iw]; } } range.Value = data; XL.Visible = true; XL.Interactive = true; XL.ScreenUpdating = true; }
public void DeleteActiveProject() { projectList.RemoveAt(ActiveProjectIndex); if (projectList.Count > 0) { ActiveProject = projectList.Last().ecl; ActiveProjectIndex = projectList.Count - 1; } else // полное удаление { ActiveProjectIndex = -1; ActiveProject = null; } }
public Form2D(EclipseProject ecl) { InitializeComponent(); model = new Form2DModel(ecl); subOptions = new Sub2DOptions(model.style); subOptions.UpdateData += OnSubFormOptions; subFocusOn = new SubSetFocusOn(model.style); subFocusOn.UpdateData += OnSubFocusOn; subWellModel = new SubWellModel(model.style); subWellModel.UpdateData += OnSubWellModelUpdate; subWellModel.UpdateLumpingMethod += OnSubWellModelUpdateLumpingMethod; tabSliceControl.SelectedIndex = 2; }
public Form3DModel(EclipseProject ecl) { this.ecl = ecl; engine = new Engine3D(); if (ecl != null) { ecl.ReadEGRID(); } if (ecl != null && ecl.EGRID.FILEHEAD != null) { ecl.ReadINIT(); engine.grid = new Grid3D(ecl); } }
public TabWaterPlot(EclipseProject ecl) { InitializeComponent(); model = new ChartModel(ecl); plotModel = new PlotModel { Title = "Water Diagnostic Plot", DefaultFont = "Segoe UI", TitleFontSize = 10, DefaultFontSize = 10 }; plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, TitleFont = "Segoe UI Semilight", Title = "Oil Production Total", MajorGridlineStyle = LineStyle.Dash, MajorGridlineThickness = 1, }); plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, TitleFont = "Segoe UI Semilight", Title = "1 - WCUT", MajorGridlineStyle = LineStyle.Dash, MajorGridlineThickness = 1, Minimum = 0, Maximum = 1 }); plotModel.Legends.Add(new OxyPlot.Legends.Legend { LegendPosition = OxyPlot.Legends.LegendPosition.RightTop }); plotView.Model = plotModel; boxCriteriaType.SelectedIndex = 0; // }
public void OpenECLProject(EventHandler <BinaryReaderArg> eventHandler) { OpenFileDialog fd = new OpenFileDialog() { Filter = "Eclipse file|*.SMSPEC" }; if (fd.ShowDialog() == DialogResult.OK) { var item = new EclipseProject(); item.UpdateLoadingProgress += eventHandler; item.OpenData(fd.FileName); projects.Add(item); selectedIndex = projects.Count - 1; } }
public TabCharts(EclipseProject ecl) { InitializeComponent(); this.model = new ChartModel(ecl); stylesPanel = new StylesPanel(); stylesPanel.UpdateData += StylesPanelOnUpdateData; suspendEvents = true; boxGroupMode.SelectedIndex = 0; boxChartsPositions.SelectedIndex = 1; UpdateChartPositions(); suspendEvents = false; }
public void OpenECLProject() { OpenFileDialog fd = new OpenFileDialog() { Filter = "Eclipse file|*.SMSPEC" }; if (fd.ShowDialog() == DialogResult.OK) { var item = new ProjectManagerItem(); item.ecl.OpenData(fd.FileName); item.name = item.ecl.ROOT; item.selected = true; projectList.Add(item); // Set last project as active ActiveProject = projectList.Last().ecl; ActiveProjectIndex = projectList.Count - 1; } }
public Tab2DView(EclipseProject ecl) { InitializeComponent(); model = new MapModel(ecl); suspendEvents = true; boxGroupMode.SelectedIndex = 0; boxChartsPositions.SelectedIndex = 1; glControl = new GLControl(new GraphicsMode(new ColorFormat(8, 8, 8, 0), 24, 8, 4), 1, 5, GraphicsContextFlags.Default); glControl.Paint += GLControl_Paint; glControl.Load += GLControl_Load; glControl.Resize += GLControl_Resize; glControl.Dock = DockStyle.Fill; panelOpenGL.Controls.Add(glControl); suspendEvents = false; }
public void SetEclipseProject(EclipseProject ecl) { this.ecl = ecl; }
public void UpdateSelectedProjects(EclipseProject ecl) { model.UpdateECL(ecl); }
public TabCrossplots(EclipseProject ecl) { InitializeComponent(); typeof(Control).InvokeMember("DoubleBuffered", System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, gridData, new object[] { true }); model = new ChartModel(ecl); plotHisto = new PlotModel { DefaultFont = "Segoe UI", TitleFontSize = 10, DefaultFontSize = 10, }; var categoryAxes = new OxyPlot.Axes.CategoryAxis { Position = AxisPosition.Left, TitleFont = "Segoe UI Semilight", AxisTitleDistance = 8 }; categoryAxes.Title = "Relative Deviation"; categoryAxes.Labels.Add("<10%"); categoryAxes.Labels.Add("10-20%"); categoryAxes.Labels.Add(">20%"); plotHisto.Axes.Add(categoryAxes); plotHisto.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, TitleFont = "Segoe UI Semilight", Title = "Well Count" }); plotView1.Model = plotHisto; plotHistoTotal = new PlotModel { DefaultFont = "Segoe UI", TitleFontSize = 10, DefaultFontSize = 10, }; var categoryAxes2 = new OxyPlot.Axes.CategoryAxis { Position = AxisPosition.Left, TitleFont = "Segoe UI Semilight", AxisTitleDistance = 8 }; categoryAxes2.Title = "Relative Deviation"; categoryAxes2.Labels.Add("<10%"); categoryAxes2.Labels.Add("10-20%"); categoryAxes2.Labels.Add(">20%"); plotHistoTotal.Axes.Add(categoryAxes2); plotHistoTotal.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, TitleFont = "Segoe UI Semilight", Title = "Sum Hist Value" }); plotView2.Model = plotHistoTotal; plotModel = new PlotModel { Title = "(No keyword)", DefaultFont = "Segoe UI", TitleFontSize = 10, DefaultFontSize = 10 }; plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, TitleFont = "Segoe UI Semilight", Title = "Simulated", MajorGridlineStyle = LineStyle.Dash, MajorGridlineThickness = 1, }); plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, TitleFont = "Segoe UI Semilight", Title = "Historical", MajorGridlineStyle = LineStyle.Dash, MajorGridlineThickness = 1, }); plotView.Model = plotModel; boxKeywords.SelectedIndex = 0; boxCriteriaType.SelectedIndex = 0; // }
public void GenerateVertexAndColors(EclipseProject ecl, Func <long, float> GetValue) { System.Diagnostics.Debug.WriteLine("Grid3D.cs / void GenerateVertexAndColors"); int ActiveCellCount = ecl.INIT.NACTIV; int index = 0; Colorizer.SetMinimum(0); Colorizer.SetMaximum(1); // Без обнуления буфферов, работает но очень медленно GL.BufferData(BufferTarget.ArrayBuffer, IntPtr.Zero, IntPtr.Zero, BufferUsageHint.StaticDraw); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(ActiveCellCount * sizeof(float) * 3 * 8 + ActiveCellCount * sizeof(byte) * 3 * 8), // Три координаты по float, 8 вершин и 8 цветов IntPtr.Zero, BufferUsageHint.StaticDraw); GL.VertexPointer(3, VertexPointerType.Float, 0, 0); GL.ColorPointer(3, ColorPointerType.UnsignedByte, 0, ActiveCellCount * sizeof(float) * 3 * 8); VertexPointer = GL.MapBuffer(BufferTarget.ArrayBuffer, BufferAccess.WriteOnly); unsafe { float *vertex_mem = (float *)VertexPointer; byte * color_mem = (byte *)(VertexPointer + ActiveCellCount * sizeof(float) * 3 * 8); for (int Z = 0; Z < ecl.INIT.NZ; ++Z) { for (int Y = 0; Y < ecl.INIT.NY; ++Y) { for (int X = 0; X < ecl.INIT.NX; ++X) { long cell_index = ecl.INIT.GetActive(X, Y, Z); if (cell_index > 0) { var cell = Cells[cell_index - 1]; var value = GetValue(cell_index - 1); var color = Colorizer.ColorByValue(value); index = 8 * 3 * ((int)cell_index - 1); vertex_mem[index + 0] = cell.TNW.X; vertex_mem[index + 1] = cell.TNW.Y; vertex_mem[index + 2] = cell.TNW.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.TSW.X; vertex_mem[index + 1] = cell.TSW.Y; vertex_mem[index + 2] = cell.TSW.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.TSE.X; vertex_mem[index + 1] = cell.TSE.Y; vertex_mem[index + 2] = cell.TSE.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.TNE.X; vertex_mem[index + 1] = cell.TNE.Y; vertex_mem[index + 2] = cell.TNE.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.BNW.X; vertex_mem[index + 1] = cell.BNW.Y; vertex_mem[index + 2] = cell.BNW.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.BSW.X; vertex_mem[index + 1] = cell.BSW.Y; vertex_mem[index + 2] = cell.BSW.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.BSE.X; vertex_mem[index + 1] = cell.BSE.Y; vertex_mem[index + 2] = cell.BSE.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; index = index + 3; vertex_mem[index + 0] = cell.BNE.X; vertex_mem[index + 1] = cell.BNE.Y; vertex_mem[index + 2] = cell.BNE.Z; color_mem[index + 0] = color.R; color_mem[index + 1] = color.G; color_mem[index + 2] = color.B; } } } } } GL.UnmapBuffer(BufferTarget.ArrayBuffer); }
public void UpdateSelectedProjects(EclipseProject ecl) { throw new NotImplementedException(); }
public MapModel(EclipseProject ecl) { this.ecl = ecl; }
public void UpdateECL(EclipseProject ecl) { this.ecl = ecl; }
public FormDetails(EclipseProject ecl) { this.ecl = ecl; InitializeComponent(); bGetDataOnClick(null, null); }
public void SetActiveProject(int index) { ActiveProjectIndex = index; ActiveProject = projectList[index].ecl; }
public ChartModel(EclipseProject ecl) { UpdateECL(ecl); }
// // Формирует два буфера активных ячеек EBO с учетом примененного фильтра // Цвета и координаты вершин назначаются void GenerateVertexAndColors public void GenerateGraphics(EclipseProject ecl, GraphicFilterData filter) { // System.Diagnostics.Debug.WriteLine("Grid3D.cs / void GenerateGraphics"); int ActiveCellCount = ecl.INIT.NACTIV; int index = 0; int count = 0; int qcount = 0; long cell_index = 0; bool skip_right_face = false; bool skip_front_face = false; bool skip_bottom_face = false; bool skip_left_face = false; bool skip_top_face = false; bool skip_back_face = false; // Применить индексные фильтры List <int> XSet = new List <int>(); List <int> YSet = new List <int>(); List <int> ZSet = new List <int>(); for (int X = 0; X < ecl.INIT.NX; ++X) { XSet.Add(X); } for (int Y = 0; Y < ecl.INIT.NY; ++Y) { YSet.Add(Y); } for (int Z = 0; Z < ecl.INIT.NZ; ++Z) { ZSet.Add(Z); } if (filter.UseIndexFilter) { if (filter.IndexX != -1) { XSet = new List <int>() { filter.IndexX }; } ; if (filter.IndexY != -1) { YSet = new List <int>() { filter.IndexY }; } ; if (filter.IndexZ != -1) { ZSet = new List <int>() { filter.IndexZ }; } ; } int[] Indices = new int[ActiveCellCount * 3 * 16]; int[] Quades = new int[ActiveCellCount * 4 * 8]; for (int zindex = 0; zindex < ZSet.Count; ++zindex) { for (int yindex = 0; yindex < YSet.Count; ++yindex) { for (int xindex = 0; xindex < XSet.Count; ++xindex) { cell_index = ecl.INIT.GetActive(XSet[xindex], YSet[yindex], ZSet[zindex]); if (cell_index > 0) { var CELL = Cells[cell_index - 1]; index = 8 * ((int)cell_index - 1); // Проверка соседей по X справа skip_right_face = false; skip_left_face = false; skip_front_face = false; skip_back_face = false; skip_bottom_face = false; skip_top_face = false; if (filter == null) { // Проверка соседей по X справа if (xindex < XSet.Count - 1) // Только не для последнего элемента { cell_index = ecl.INIT.GetActive(XSet[xindex + 1], YSet[yindex], ZSet[zindex]); if (cell_index > 0) { var NCELL = Cells[cell_index - 1]; skip_right_face = ((CELL.TNE == NCELL.TNW) && (CELL.TSE == NCELL.TSW) && (CELL.BNE == NCELL.BNW) && (CELL.BSE == NCELL.BSW)); } } // Проверка соседей по X слева if (xindex > 0) { cell_index = ecl.INIT.GetActive(XSet[xindex - 1], YSet[yindex], ZSet[zindex]); if (cell_index > 0) { var NCELL = Cells[cell_index - 1]; skip_left_face = ((CELL.TNW == NCELL.TNE) && (CELL.TSW == NCELL.TSE) && (CELL.BNW == NCELL.BNE) && (CELL.BSW == NCELL.BSE)); } } // Проверка соседей по Y справа if (yindex < YSet.Count - 1) { cell_index = ecl.INIT.GetActive(XSet[xindex], YSet[yindex + 1], ZSet[zindex]); if (cell_index > 0) { var NCELL = Cells[cell_index - 1]; skip_front_face = ((CELL.TSW == NCELL.TNW) && (CELL.TSE == NCELL.TNE) && (CELL.BSW == NCELL.BNW) && (CELL.BSE == NCELL.BNE)); } } // Проверка соседей по Y слева if (yindex > 0) { cell_index = ecl.INIT.GetActive(XSet[xindex], YSet[yindex - 1], ZSet[zindex]); if (cell_index > 0) { var NCELL = Cells[cell_index - 1]; skip_back_face = ((CELL.TNW == NCELL.TSW) && (CELL.TNE == NCELL.TSE) && (CELL.BNW == NCELL.BSW) && (CELL.BNE == NCELL.BSE)); } } // Проверка соседей по Z снизу if (zindex < ZSet.Count - 1) { cell_index = ecl.INIT.GetActive(XSet[xindex], YSet[yindex], ZSet[zindex + 1]); if (cell_index > 0) { var NCELL = Cells[cell_index - 1]; skip_bottom_face = ((CELL.BNW == NCELL.TNW) && (CELL.BNE == NCELL.TNE) && (CELL.BSW == NCELL.TSW) && (CELL.BSE == NCELL.TSE)); } } // Проверка соседей по Z сверху if (zindex > 0) { cell_index = ecl.INIT.GetActive(XSet[xindex], YSet[yindex], ZSet[zindex - 1]); if (cell_index > 0) { var NCELL = Cells[cell_index - 1]; skip_top_face = ((CELL.TNW == NCELL.BNW) && (CELL.TNE == NCELL.BNE) && (CELL.TSW == NCELL.BSW) && (CELL.TSE == NCELL.BSE)); } } } // Схема наименования вершин // // TSE---- TSW // TNE---- TNW (передняя грань) // // BNE---- BNW (передняя грань) // // Порядок хранения вершин в буфере // // TNW(0) .. TSW(1) .. TSE(2) .. TNE(3) // BNW(4) .. BSW(5) .. BSE(6) .. BNE(7) if (skip_top_face == false) // Top face { Indices[count++] = index + 2; // TSE - TNE - TSW Indices[count++] = index + 3; Indices[count++] = index + 1; Indices[count++] = index + 1; // TSW - TNE - TNW Indices[count++] = index + 3; Indices[count++] = index + 0; Quades[qcount++] = index + 0; // TNW - TSW - TSE - TNE Quades[qcount++] = index + 1; Quades[qcount++] = index + 2; Quades[qcount++] = index + 3; } if (skip_back_face == false) // Front face { Indices[count++] = index + 3; // TNE - BNE - TNW Indices[count++] = index + 7; Indices[count++] = index + 0; Indices[count++] = index + 0; // TNW - BNE - BNW Indices[count++] = index + 7; Indices[count++] = index + 4; Quades[qcount++] = index + 3; // TNE - BNE - BNW - TNW Quades[qcount++] = index + 7; Quades[qcount++] = index + 4; Quades[qcount++] = index + 0; } if (skip_right_face == false) // Right face { Indices[count++] = index + 2; // TSE - BSE - TNE Indices[count++] = index + 6; Indices[count++] = index + 3; Indices[count++] = index + 3; // TNE - BSE - BNE Indices[count++] = index + 6; Indices[count++] = index + 7; Quades[qcount++] = index + 2; // TSE - BSE - BNE - TNE Quades[qcount++] = index + 6; Quades[qcount++] = index + 7; Quades[qcount++] = index + 3; } if (skip_left_face == false) // Left face { Indices[count++] = index + 0; // TNW - BNW - TSW Indices[count++] = index + 4; Indices[count++] = index + 1; Indices[count++] = index + 1; // TSW - BNW - BSW Indices[count++] = index + 4; Indices[count++] = index + 5; Quades[qcount++] = index + 0; // TNW - BNW - BSW - TSW Quades[qcount++] = index + 4; Quades[qcount++] = index + 5; Quades[qcount++] = index + 1; } if (skip_front_face == false) // Back face { Indices[count++] = index + 2; // TSE - TSW - BSE Indices[count++] = index + 1; Indices[count++] = index + 6; Indices[count++] = index + 6; // BSE - TSW - BSW Indices[count++] = index + 1; Indices[count++] = index + 5; Quades[qcount++] = index + 2; // TSE - TSW - BSW - BSE Quades[qcount++] = index + 1; Quades[qcount++] = index + 5; Quades[qcount++] = index + 6; } if (skip_bottom_face == false) // Bottom face { Indices[count++] = index + 7; // BNE - BSW - BSE Indices[count++] = index + 6; Indices[count++] = index + 5; Indices[count++] = index + 5; // BSW - BNW - BNE Indices[count++] = index + 4; Indices[count++] = index + 7; Quades[qcount++] = index + 4; // BNW - BNE - BSE - BSW Quades[qcount++] = index + 7; Quades[qcount++] = index + 6; Quades[qcount++] = index + 5; } index += 8; } } } } ElementCount = count; QuadCount = qcount; GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO); GL.BufferData(BufferTarget.ElementArrayBuffer, IntPtr.Zero, IntPtr.Zero, BufferUsageHint.StaticDraw); GL.BufferData( BufferTarget.ElementArrayBuffer, (IntPtr)(ElementCount * sizeof(int)), Indices, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBOQuads); GL.BufferData(BufferTarget.ElementArrayBuffer, IntPtr.Zero, IntPtr.Zero, BufferUsageHint.StaticDraw); GL.BufferData( BufferTarget.ElementArrayBuffer, (IntPtr)(qcount * sizeof(int)), // 16 треугольников Quades, BufferUsageHint.StaticDraw); System.Diagnostics.Debug.WriteLine(GL.GetError().ToString()); }