feat(v3.6.0): 1D ODE, ODE Sistemi, 1D PDE ve Baglasimli PDE modullerinin simulasyon ve gorsellestirme modernizasyonu
This commit is contained in:
parent
0cafe8fccb
commit
c884abe3dc
13 changed files with 3558 additions and 1014 deletions
42
README.md
42
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
# 📐 ttCalculator v3.5.0
|
# 📐 ttCalculator v3.6.0
|
||||||
|
|
||||||
[](https://github.com/LilDosto/ttCalculator/releases)
|
[](https://github.com/LilDosto/ttCalculator/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
@ -13,11 +13,11 @@ Tüm matematiksel çekirdek, otomatik test paketinden **%100 başarıyla (0 hata
|
||||||
|
|
||||||
## 🚀 Hızlı Başlangıç & Kurulum
|
## 🚀 Hızlı Başlangıç & Kurulum
|
||||||
|
|
||||||
1. **[Releases](https://github.com/LilDosto/ttCalculator/releases/tag/v3.5.0)** sayfasına gidin.
|
1. **[Releases](https://github.com/LilDosto/ttCalculator/releases/tag/v3.6.0)** sayfasına gidin.
|
||||||
2. İhtiyacınıza göre indirin:
|
2. İhtiyacınıza göre indirin:
|
||||||
- **`ttCalculator-v3.5.0-Setup.exe` (Önerilen)**: Standart Windows kurulum sihirbazı. Masaüstüne ve Başlat Menüsüne kısayol oluşturur, Denetim Masası / Program Ekle-Kaldır entegrasyonu sağlar.
|
- **`ttCalculator-v3.6.0-Setup.exe` (Önerilen)**: Standart Windows kurulum sihirbazı. Masaüstüne ve Başlat Menüsüne kısayol oluşturur, Denetim Masası / Program Ekle-Kaldır entegrasyonu sağlar.
|
||||||
- **`ttCalculator.exe`**: Kurulumsuz doğrudan çalıştırılabilen tek dosya taşınabilir (portable) sürüm.
|
- **`ttCalculator.exe`**: Kurulumsuz doğrudan çalıştırılabilen tek dosya taşınabilir (portable) sürüm.
|
||||||
- **`ttCalculator-v3.5.0-win-x64.zip`**: Taşınabilir arşiv paketi.
|
- **`ttCalculator-v3.6.0-win-x64.zip`**: Taşınabilir arşiv paketi.
|
||||||
3. Çift tıklayarak doğrudan çalıştırın — ek bağımlılık gerektirmez!
|
3. Çift tıklayarak doğrudan çalıştırın — ek bağımlılık gerektirmez!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -87,27 +87,33 @@ Uygulama modern koyu tema (Dark Theme) arayüzü ile 13 ana modülden oluşmakta
|
||||||
* **Noktadan Teğet Çizici:** Dışarıdaki bir noktadan seçilen fonksiyona çizilen teğet doğru denklemi ve grafiği.
|
* **Noktadan Teğet Çizici:** Dışarıdaki bir noktadan seçilen fonksiyona çizilen teğet doğru denklemi ve grafiği.
|
||||||
* **Hazır Parametrik Şekiller:** Daire, Kare, Dikdörtgen, Eşkenar Üçgen, Elips ve Düzgün Altıgen şekillerini parametrik olarak fonksiyon listesine ekleyip çizdirme.
|
* **Hazır Parametrik Şekiller:** Daire, Kare, Dikdörtgen, Eşkenar Üçgen, Elips ve Düzgün Altıgen şekillerini parametrik olarak fonksiyon listesine ekleyip çizdirme.
|
||||||
|
|
||||||
### 2. ∫ Diferansiyel Denklem Çözücü (1 Değişkenli ODE)
|
### 2. ∫ Diferansiyel Denklem Çözücü (1 Değişkenli ODE - v3.6)
|
||||||
* **Desteklenen Algoritmalar:** Euler (1. Derece), Heun (RK2 Predictor-Corrector), Runge-Kutta 4 (RK4) ve 8. Derece Yüksek Hassasiyetli Runge-Kutta (RK8).
|
* **Desteklenen Algoritmalar:** Euler (1. Derece), Heun (RK2 Predictor-Corrector), Runge-Kutta 4 (RK4) ve 8. Derece Yüksek Hassasiyetli Runge-Kutta (RK8).
|
||||||
* Başlangıç değer problemi ($y' = f(x, y)$, $y(x_0) = y_0$) için adım büyüklüğü, eğimler ve adım adım çözüm tablosu.
|
* **İnteraktif Çözüm Eğrisi Tuvali:** $y(x)$ çözüm eğrisini çizdiren, farenin üzerinde gezdiği koordinatları (X, Y) takip eden artı imleci (crosshair) ve koordinat ipucu (tooltip).
|
||||||
|
* **Görsel Durum & KPI Kartı:** $y(x_{son})$ nihai değer kartı, adım sayısı ($N$), adım büyüklüğü ($h$), yürütme süresi (ms) ve kullanılan yöntem bilgisi.
|
||||||
|
* **Adım Adım Çözüm Tablosu:** Zebra desenli `DataGridView` tablosu ($i, x_i, y_i, \Delta y$), TSV formatında panoya kopyalama ve yüksek çözünürlüklü PNG grafik dışa aktarma.
|
||||||
|
|
||||||
### 3. ∭ Diferansiyel Denklem Sistemi Çözücü (System of ODEs)
|
### 3. ∭ Diferansiyel Denklem Sistemi Çözücü (System of ODEs - v3.6)
|
||||||
* Vektörel diferansiyel denklem sistemleri: $\frac{d\vec{Y}}{dt} = \vec{F}(t, \vec{Y})$.
|
* **Vektörel Diferansiyel Sistemler:** $\frac{d\vec{Y}}{dt} = \vec{F}(t, \vec{Y})$ ($n \in [1, 6]$ dinamik değişken desteği).
|
||||||
* **Yüksek Dereceli ODE Dönüşümü:** $n$. derece diferansiyel denklemleri durum-uzayı (state-space) vektör sistemine dönüştürerek çözebilme.
|
|
||||||
* **Hazır Modeller:** Harmonik Osilatör, Av-Avcı (Lotka-Volterra), Sönümlü Sarkaç, Lorenz Kaotik Çekicisi.
|
* **Hazır Modeller:** Harmonik Osilatör, Av-Avcı (Lotka-Volterra), Sönümlü Sarkaç, Lorenz Kaotik Çekicisi.
|
||||||
* Vektörel Euler, RK4 ve RK8 çözücüleri ile zaman adımları tablosu.
|
* **Faz Portresi Tuvali (Phase Portrait):** Seçilen iki eksen ($y_1$ vs $y_2$) arasında yörünge eğrisi, hareket yönünü gösteren vektör okları, renk geçişli degrade çizgi ve fareyle koordinat inceleme.
|
||||||
|
* **Zaman Serisi Tuvali (Time Series):** $t$ parametresine bağlı $y_1(t), y_2(t), \dots$ eğrilerinin renk kodlu çizimi ve grafik lejantı.
|
||||||
|
* **Sistem Veri Tablosu:** Tüm adımları listeleyen DataGridView tablosu ve CSV/PNG dışa aktarım desteği.
|
||||||
|
|
||||||
### 4. 🌊 Kısmi Diferansiyel Denklem Çözücü (1D PDE)
|
### 4. 🌊 Kısmi Diferansiyel Denklem Çözücü (1D PDE Solver - v3.6)
|
||||||
* **1 Boyutlu Isı Denklemi:** $u_t = \alpha \cdot u_{xx}$ (FTCS sonlu farklar yöntemi, kararlılık koşulu $r \le 0.5$ denetimi).
|
* **Desteklenen Modeller:** 1B Isı Denklemi (FTCS ve Crank-Nicolson), 1B Dalga Denklemi (Leapfrog), 1B Taşınım / Advection (Upwind).
|
||||||
* **1 Boyutlu Dalga Denklemi:** $u_{tt} = c^2 \cdot u_{xx}$ (Leapfrog merkezi farklar, Courant-Friedrichs-Lewy / CFL denetimi).
|
* **Dinamik CFL Kararlılık Analiz Rozeti:** $r = \alpha \frac{\Delta t}{\Delta x^2}$ veya $CFL = c \frac{\Delta t}{\Delta x}$ değerlerini canlı hesaplayan, kararlı/kararsız durumu bildiren renkli rozet.
|
||||||
* **1 Boyutlu Taşınım (Advection) Denklemi:** $u_t + v \cdot u_x = 0$ (Upwind stabil şeması).
|
* **2B Uzay-Zaman Isı Haritası (Heatmap):** $x \in [0, L]$ (X ekseni) ve $t \in [0, T]$ (Y ekseni) üzerinde renk gradyanı (Turbo/Thermal colormap) ile sıcaklık/dalga yoğunluğu dağılımı.
|
||||||
* Farklı zaman dilimlerinde ($t=0, T/4, T/2, 3T/4, T$) mekan profili tablosu.
|
* **Canlı Zaman Animasyonu:** 30 FPS hızında dalga/ısı profilinin zamana bağlı salınımını canlandıran oynat/durdur denetleyicisi, hız çarpanı ($1\times, 2\times, 5\times$) ve interaktif zaman kaydırıcısı (time scrubber).
|
||||||
|
* **Zaman Dilimleri Tablosu:** $t = 0, T/4, T/2, 3T/4, T$ anlarındaki uzaysal profili özetleyen tablo.
|
||||||
|
|
||||||
### 5. 🌀 Kısmi Diferansiyel Denklem Sistemi Çözücü (Coupled PDE System)
|
### 5. 🌀 Kısmi Diferansiyel Denklem Sistemi Çözücü (Coupled PDE System - v3.6)
|
||||||
* 1 Boyutlu Bağlaşımlı Reaksiyon-Difüzyon Sistemleri:
|
* **1B Bağlaşımlı Reaksiyon-Difüzyon Sistemleri:**
|
||||||
$$u_t = D_u \cdot u_{xx} + F(u, v)$$
|
$$u_t = D_u \cdot u_{xx} + F(u, v)$$
|
||||||
$$v_t = D_v \cdot v_{xx} + G(u, v)$$
|
$$v_t = D_v \cdot v_{xx} + G(u, v)$$
|
||||||
* Sıfır-akı (Neumann) sınır koşulları, Turing deseni oluşumu (Gray-Scott, Schnakenberg, FitzHugh-Nagumo modelleri).
|
* **Hazır Biyokimyasal & Fiziksel Modeller:** Turing Desenleri (Gray-Scott), Schnakenberg Sistemi, FitzHugh-Nagumo Sinir Modeli, Çift Difüzyon.
|
||||||
|
* **Çift Konsantrasyon Canlı Dalga Çizimi:** $u(x)$ (gök mavisi) ve $v(x)$ (mercan kırmızısı) yarı saydam alan dolgulu konsantrasyon eğrileri ve canlı animasyon.
|
||||||
|
* **2B Turing Deseni Haritası & Faz Uzayı Trajektorisi:** Uzay-zaman morfolojik desen haritası ve $(u, v)$ durum faz portresi.
|
||||||
|
|
||||||
### 6. 🔍 Denklem Kökü Bulucu (Root Finder v3.4)
|
### 6. 🔍 Denklem Kökü Bulucu (Root Finder v3.4)
|
||||||
* **Dinamik Parametre Girişi:** Seçilen yönteme göre (Newton-Raphson, Bisection, Secant, Regula Falsi, Çoklu Kök Taraması) dinamik parametre alanları.
|
* **Dinamik Parametre Girişi:** Seçilen yönteme göre (Newton-Raphson, Bisection, Secant, Regula Falsi, Çoklu Kök Taraması) dinamik parametre alanları.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
; Script generated by Antigravity for ttCalculator
|
; Script generated by Antigravity for ttCalculator
|
||||||
#define MyAppName "ttCalculator"
|
#define MyAppName "ttCalculator"
|
||||||
#define MyAppVersion "3.5.0"
|
#define MyAppVersion "3.6.0"
|
||||||
#define MyAppPublisher "LilDosto"
|
#define MyAppPublisher "LilDosto"
|
||||||
#define MyAppURL "https://github.com/LilDosto/ttCalculator"
|
#define MyAppURL "https://github.com/LilDosto/ttCalculator"
|
||||||
#define MyAppExeName "ttCalculator.exe"
|
#define MyAppExeName "ttCalculator.exe"
|
||||||
|
|
@ -25,7 +25,7 @@ DefaultGroupName={#MyAppName}
|
||||||
AllowNoIcons=yes
|
AllowNoIcons=yes
|
||||||
LicenseFile=..\LICENSE
|
LicenseFile=..\LICENSE
|
||||||
OutputDir=..\Release
|
OutputDir=..\Release
|
||||||
OutputBaseFilename=ttCalculator-v3.5.0-Setup
|
OutputBaseFilename=ttCalculator-v3.6.0-Setup
|
||||||
SetupIconFile=..\Release\logo.ico
|
SetupIconFile=..\Release\logo.ico
|
||||||
Compression=lzma2/ultra64
|
Compression=lzma2/ultra64
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
|
|
|
||||||
384
src/ttCalculator/Controls/OdeSolverControl.Designer.cs
generated
384
src/ttCalculator/Controls/OdeSolverControl.Designer.cs
generated
|
|
@ -18,7 +18,7 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
||||||
"Diferansiyel Denklem Çözücü (1 Değişkenli ODE / Başlangıç Değer Problemi)",
|
"Diferansiyel Denklem Çözücü (1 Değişkenli ODE / Başlangıç Değer Problemi)",
|
||||||
"dy/dx = f(x, y) başlangıç değer problemini Euler, Heun (RK2), RK4 ve RK8 (Dormand-Prince) ile çözer.");
|
"dy/dx = f(x, y) başlangıç değer problemini Runge-Kutta (RK4, RK8), Heun (RK2) ve Euler ile çözer; dinamik çözüm eğrisi ve adım tablosu sunar.");
|
||||||
|
|
||||||
this.pnlControls = new Panel();
|
this.pnlControls = new Panel();
|
||||||
this.pnlPresets = new FlowLayoutPanel();
|
this.pnlPresets = new FlowLayoutPanel();
|
||||||
|
|
@ -42,33 +42,68 @@ namespace MathApp.Controls
|
||||||
this.lblSteps = new Label();
|
this.lblSteps = new Label();
|
||||||
this.numSteps = new NumericUpDown();
|
this.numSteps = new NumericUpDown();
|
||||||
|
|
||||||
this.btnSolve = ThemeHelper.CreateActionButton("🚀 Denklemi Çöz", 140, 32, true);
|
this.btnSolve = ThemeHelper.CreateActionButton("🚀 Denklemi Çöz", 150, 32, true);
|
||||||
this.btnCopy = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala");
|
|
||||||
|
|
||||||
this.pnlCardResult = new Panel();
|
// Split Container for Interactive Canvas (Left) + Results/Table (Right)
|
||||||
this.lblFinalValue = new Label();
|
this.splitOde = new SplitContainer();
|
||||||
this.lblFinalDetails = new Label();
|
|
||||||
|
|
||||||
|
// Left: Canvas Area
|
||||||
|
this.pnlCanvasHeader = new Panel();
|
||||||
|
this.lblCanvasTitle = new Label();
|
||||||
|
this.btnExportPng = new Button();
|
||||||
|
this.btnNavToGraph = new Button();
|
||||||
|
this.pnlOdeCanvas = new Panel();
|
||||||
|
|
||||||
|
// Right: Tabbed Output
|
||||||
|
this.tabOdeResults = new TabControl();
|
||||||
|
this.tabSummary = new TabPage();
|
||||||
|
this.pnlKpiCard = new Panel();
|
||||||
|
this.lblKpiFinalVal = new Label();
|
||||||
|
this.lblKpiSub = new Label();
|
||||||
|
this.pnlMetricsContainer = new Panel();
|
||||||
|
this.lblMetricSteps = new Label();
|
||||||
|
this.lblMetricH = new Label();
|
||||||
|
this.lblMetricElapsed = new Label();
|
||||||
|
this.lblMetricMethod = new Label();
|
||||||
|
|
||||||
|
this.tabStepsTable = new TabPage();
|
||||||
|
this.pnlTableToolbar = new Panel();
|
||||||
|
this.btnCopyTsv = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala (TSV)");
|
||||||
|
this.dgvSteps = new DataGridView();
|
||||||
|
|
||||||
|
this.tabTextReport = new TabPage();
|
||||||
this.txtOutput = new RichTextBox();
|
this.txtOutput = new RichTextBox();
|
||||||
|
|
||||||
this.pnlControls.SuspendLayout();
|
this.pnlControls.SuspendLayout();
|
||||||
this.pnlCardResult.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)(this.numSteps)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitOde)).BeginInit();
|
||||||
|
this.splitOde.Panel1.SuspendLayout();
|
||||||
|
this.splitOde.Panel2.SuspendLayout();
|
||||||
|
this.splitOde.SuspendLayout();
|
||||||
|
this.pnlCanvasHeader.SuspendLayout();
|
||||||
|
this.tabOdeResults.SuspendLayout();
|
||||||
|
this.tabSummary.SuspendLayout();
|
||||||
|
this.pnlKpiCard.SuspendLayout();
|
||||||
|
this.pnlMetricsContainer.SuspendLayout();
|
||||||
|
this.tabStepsTable.SuspendLayout();
|
||||||
|
this.pnlTableToolbar.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvSteps)).BeginInit();
|
||||||
|
this.tabTextReport.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
|
||||||
// pnlControls
|
// pnlControls
|
||||||
this.pnlControls.Dock = DockStyle.Top;
|
this.pnlControls.Dock = DockStyle.Top;
|
||||||
this.pnlControls.Height = 165;
|
this.pnlControls.Height = 125;
|
||||||
this.pnlControls.BackColor = ThemeHelper.DarkBackground;
|
this.pnlControls.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
this.pnlControls.Padding = new Padding(24, 8, 24, 8);
|
this.pnlControls.Padding = new Padding(20, 8, 20, 8);
|
||||||
|
|
||||||
// Presets
|
this.lblPresets.Text = "⚡ Hızlı Şablonlar:";
|
||||||
this.lblPresets.Text = "Hazır Şablonlar:";
|
|
||||||
this.lblPresets.AutoSize = true;
|
this.lblPresets.AutoSize = true;
|
||||||
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
||||||
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
||||||
|
|
||||||
this.pnlPresets.Location = new Point(24, 8);
|
this.pnlPresets.Location = new Point(20, 6);
|
||||||
this.pnlPresets.Size = new Size(880, 32);
|
this.pnlPresets.Size = new Size(880, 32);
|
||||||
this.pnlPresets.Controls.Add(this.lblPresets);
|
this.pnlPresets.Controls.Add(this.lblPresets);
|
||||||
this.pnlPresets.Controls.Add(this.btnEx1);
|
this.pnlPresets.Controls.Add(this.btnEx1);
|
||||||
|
|
@ -76,99 +111,102 @@ namespace MathApp.Controls
|
||||||
this.pnlPresets.Controls.Add(this.btnEx3);
|
this.pnlPresets.Controls.Add(this.btnEx3);
|
||||||
this.pnlPresets.Controls.Add(this.btnEx4);
|
this.pnlPresets.Controls.Add(this.btnEx4);
|
||||||
|
|
||||||
int yRow1 = 48;
|
int yRow1 = 44;
|
||||||
this.lblEquation.Text = "dy/dx = f(x, y):";
|
this.lblEquation.Text = "dy/dx = f(x, y):";
|
||||||
this.lblEquation.Location = new Point(24, yRow1 + 3);
|
this.lblEquation.Location = new Point(20, yRow1 + 3);
|
||||||
this.lblEquation.AutoSize = true;
|
this.lblEquation.AutoSize = true;
|
||||||
this.lblEquation.ForeColor = ThemeHelper.LightText;
|
this.lblEquation.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
this.lblEquation.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
|
this.lblEquation.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
|
||||||
this.txtEquation.Location = new Point(135, yRow1);
|
this.txtEquation.Location = new Point(125, yRow1);
|
||||||
this.txtEquation.Size = new Size(240, 26);
|
this.txtEquation.Size = new Size(240, 25);
|
||||||
this.txtEquation.Text = "x + y";
|
this.txtEquation.Text = "x + y";
|
||||||
this.txtEquation.Font = new Font("Consolas", 10.5F);
|
this.txtEquation.Font = new Font("Consolas", 10.5F);
|
||||||
this.txtEquation.BackColor = ThemeHelper.CardBackground;
|
this.txtEquation.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtEquation.ForeColor = Color.White;
|
this.txtEquation.ForeColor = Color.White;
|
||||||
this.txtEquation.BorderStyle = BorderStyle.FixedSingle;
|
this.txtEquation.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
this.lblMethod.Text = "Nümerik Yöntem:";
|
this.lblMethod.Text = "Yöntem:";
|
||||||
this.lblMethod.Location = new Point(390, yRow1 + 3);
|
this.lblMethod.Location = new Point(380, yRow1 + 3);
|
||||||
this.lblMethod.AutoSize = true;
|
this.lblMethod.AutoSize = true;
|
||||||
this.lblMethod.ForeColor = ThemeHelper.LightText;
|
this.lblMethod.ForeColor = ThemeHelper.LightText;
|
||||||
this.lblMethod.Font = new Font("Segoe UI", 9.5F);
|
this.lblMethod.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
|
||||||
this.cmbMethod.Location = new Point(505, yRow1);
|
this.cmbMethod.Location = new Point(445, yRow1);
|
||||||
this.cmbMethod.Size = new Size(250, 25);
|
this.cmbMethod.Size = new Size(230, 25);
|
||||||
this.cmbMethod.DropDownStyle = ComboBoxStyle.DropDownList;
|
this.cmbMethod.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
this.cmbMethod.BackColor = ThemeHelper.CardBackground;
|
this.cmbMethod.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.cmbMethod.ForeColor = Color.White;
|
this.cmbMethod.ForeColor = Color.White;
|
||||||
this.cmbMethod.Font = new Font("Segoe UI", 9.5F);
|
this.cmbMethod.Font = new Font("Segoe UI", 9F);
|
||||||
this.cmbMethod.Items.AddRange(new object[] {
|
this.cmbMethod.Items.AddRange(new object[] {
|
||||||
"Runge-Kutta 4 (RK4 - Önerilen)",
|
"Runge-Kutta 4 (RK4 - Standart)",
|
||||||
"Runge-Kutta 8 (RK8 - Ultra Hassas)",
|
"Runge-Kutta 8 (RK8 - Ultra Hassas)",
|
||||||
"Heun / Geliştirilmiş Euler (RK2)",
|
"Heun / Geliştirilmiş Euler (RK2)",
|
||||||
"Euler Yöntemi (1. Derece Standart)"
|
"Euler Yöntemi (1. Derece)"
|
||||||
});
|
});
|
||||||
this.cmbMethod.SelectedIndex = 0;
|
this.cmbMethod.SelectedIndex = 0;
|
||||||
|
|
||||||
this.btnSolve.Location = new Point(765, yRow1 - 2);
|
this.btnSolve.Location = new Point(690, yRow1 - 3);
|
||||||
|
|
||||||
int yRow2 = 88;
|
int yRow2 = 82;
|
||||||
this.lblX0.Text = "x₀ (Başlangıç):";
|
this.lblX0.Text = "x₀ (Başlangıç):";
|
||||||
this.lblX0.Location = new Point(24, yRow2 + 4);
|
this.lblX0.Location = new Point(20, yRow2 + 4);
|
||||||
this.lblX0.AutoSize = true;
|
this.lblX0.AutoSize = true;
|
||||||
this.lblX0.ForeColor = ThemeHelper.LightText;
|
this.lblX0.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblX0.Font = new Font("Segoe UI", 9F);
|
||||||
|
|
||||||
this.txtX0.Location = new Point(115, yRow2);
|
this.txtX0.Location = new Point(110, yRow2);
|
||||||
this.txtX0.Size = new Size(55, 25);
|
this.txtX0.Size = new Size(55, 24);
|
||||||
this.txtX0.Text = "0";
|
this.txtX0.Text = "0";
|
||||||
this.txtX0.Font = new Font("Consolas", 10F);
|
this.txtX0.Font = new Font("Consolas", 10F);
|
||||||
this.txtX0.BackColor = ThemeHelper.CardBackground;
|
this.txtX0.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtX0.ForeColor = Color.White;
|
this.txtX0.ForeColor = Color.White;
|
||||||
this.txtX0.BorderStyle = BorderStyle.FixedSingle;
|
this.txtX0.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtX0.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblY0.Text = "y(x₀):";
|
this.lblY0.Text = "y(x₀):";
|
||||||
this.lblY0.Location = new Point(185, yRow2 + 4);
|
this.lblY0.Location = new Point(180, yRow2 + 4);
|
||||||
this.lblY0.AutoSize = true;
|
this.lblY0.AutoSize = true;
|
||||||
this.lblY0.ForeColor = ThemeHelper.LightText;
|
this.lblY0.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblY0.Font = new Font("Segoe UI", 9F);
|
||||||
|
|
||||||
this.txtY0.Location = new Point(225, yRow2);
|
this.txtY0.Location = new Point(220, yRow2);
|
||||||
this.txtY0.Size = new Size(55, 25);
|
this.txtY0.Size = new Size(55, 24);
|
||||||
this.txtY0.Text = "1";
|
this.txtY0.Text = "1";
|
||||||
this.txtY0.Font = new Font("Consolas", 10F);
|
this.txtY0.Font = new Font("Consolas", 10F);
|
||||||
this.txtY0.BackColor = ThemeHelper.CardBackground;
|
this.txtY0.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtY0.ForeColor = Color.White;
|
this.txtY0.ForeColor = Color.White;
|
||||||
this.txtY0.BorderStyle = BorderStyle.FixedSingle;
|
this.txtY0.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtY0.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblXEnd.Text = "x_son (Hedef):";
|
this.lblXEnd.Text = "x_son (Hedef):";
|
||||||
this.lblXEnd.Location = new Point(295, yRow2 + 4);
|
this.lblXEnd.Location = new Point(290, yRow2 + 4);
|
||||||
this.lblXEnd.AutoSize = true;
|
this.lblXEnd.AutoSize = true;
|
||||||
this.lblXEnd.ForeColor = ThemeHelper.LightText;
|
this.lblXEnd.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblXEnd.Font = new Font("Segoe UI", 9F);
|
||||||
|
|
||||||
this.txtXEnd.Location = new Point(385, yRow2);
|
this.txtXEnd.Location = new Point(380, yRow2);
|
||||||
this.txtXEnd.Size = new Size(60, 25);
|
this.txtXEnd.Size = new Size(60, 24);
|
||||||
this.txtXEnd.Text = "2";
|
this.txtXEnd.Text = "2";
|
||||||
this.txtXEnd.Font = new Font("Consolas", 10F);
|
this.txtXEnd.Font = new Font("Consolas", 10F);
|
||||||
this.txtXEnd.BackColor = ThemeHelper.CardBackground;
|
this.txtXEnd.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtXEnd.ForeColor = Color.White;
|
this.txtXEnd.ForeColor = Color.White;
|
||||||
this.txtXEnd.BorderStyle = BorderStyle.FixedSingle;
|
this.txtXEnd.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtXEnd.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblSteps.Text = "Adım Sayısı (N):";
|
this.lblSteps.Text = "Adım Sayısı (N):";
|
||||||
this.lblSteps.Location = new Point(460, yRow2 + 4);
|
this.lblSteps.Location = new Point(455, yRow2 + 4);
|
||||||
this.lblSteps.AutoSize = true;
|
this.lblSteps.AutoSize = true;
|
||||||
this.lblSteps.ForeColor = ThemeHelper.LightText;
|
this.lblSteps.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblSteps.Font = new Font("Segoe UI", 9F);
|
||||||
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numSteps)).BeginInit();
|
this.numSteps.Location = new Point(555, yRow2);
|
||||||
this.numSteps.Location = new Point(560, yRow2);
|
this.numSteps.Size = new Size(65, 24);
|
||||||
this.numSteps.Size = new Size(70, 25);
|
|
||||||
this.numSteps.Minimum = 2;
|
this.numSteps.Minimum = 2;
|
||||||
this.numSteps.Maximum = 5000;
|
this.numSteps.Maximum = 5000;
|
||||||
this.numSteps.Value = 50;
|
this.numSteps.Value = 50;
|
||||||
this.numSteps.BackColor = ThemeHelper.CardBackground;
|
this.numSteps.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numSteps.ForeColor = Color.White;
|
this.numSteps.ForeColor = Color.White;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numSteps)).EndInit();
|
|
||||||
|
|
||||||
this.btnCopy.Location = new Point(650, yRow2 - 1);
|
|
||||||
|
|
||||||
this.pnlControls.Controls.Add(this.pnlPresets);
|
this.pnlControls.Controls.Add(this.pnlPresets);
|
||||||
this.pnlControls.Controls.Add(this.lblEquation);
|
this.pnlControls.Controls.Add(this.lblEquation);
|
||||||
|
|
@ -184,54 +222,221 @@ namespace MathApp.Controls
|
||||||
this.pnlControls.Controls.Add(this.txtXEnd);
|
this.pnlControls.Controls.Add(this.txtXEnd);
|
||||||
this.pnlControls.Controls.Add(this.lblSteps);
|
this.pnlControls.Controls.Add(this.lblSteps);
|
||||||
this.pnlControls.Controls.Add(this.numSteps);
|
this.pnlControls.Controls.Add(this.numSteps);
|
||||||
this.pnlControls.Controls.Add(this.btnCopy);
|
|
||||||
|
|
||||||
// pnlCardResult (Hero card)
|
// ================== SPLIT ODE CONTAINER ==================
|
||||||
this.pnlCardResult.Dock = DockStyle.Top;
|
this.splitOde.Dock = DockStyle.Fill;
|
||||||
this.pnlCardResult.Height = 70;
|
this.splitOde.Orientation = Orientation.Vertical;
|
||||||
this.pnlCardResult.BackColor = ThemeHelper.CardBackground;
|
this.splitOde.SplitterDistance = 490;
|
||||||
this.pnlCardResult.Padding = new Padding(20, 10, 20, 10);
|
this.splitOde.SplitterWidth = 8;
|
||||||
|
this.splitOde.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.splitOde.Padding = new Padding(12);
|
||||||
|
|
||||||
this.lblFinalValue.Dock = DockStyle.Top;
|
// Left: Canvas
|
||||||
this.lblFinalValue.Height = 28;
|
this.splitOde.Panel1.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
this.lblFinalValue.Font = new Font("Segoe UI Semibold", 14F, FontStyle.Bold);
|
this.splitOde.Panel1.Padding = new Padding(8);
|
||||||
this.lblFinalValue.ForeColor = Color.FromArgb(52, 211, 153);
|
|
||||||
this.lblFinalValue.Text = "y(x_son) ≈ —";
|
|
||||||
|
|
||||||
this.lblFinalDetails.Dock = DockStyle.Bottom;
|
this.pnlCanvasHeader.Dock = DockStyle.Top;
|
||||||
this.lblFinalDetails.Height = 22;
|
this.pnlCanvasHeader.Height = 32;
|
||||||
this.lblFinalDetails.Font = new Font("Segoe UI", 9F);
|
this.pnlCanvasHeader.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
this.lblFinalDetails.ForeColor = ThemeHelper.MutedText;
|
|
||||||
this.lblFinalDetails.Text = "Hesaplama bekleniyor.";
|
|
||||||
|
|
||||||
this.pnlCardResult.Controls.Add(this.lblFinalDetails);
|
this.lblCanvasTitle.Text = "📈 İnteraktif Çözüm Eğrisi y(x)";
|
||||||
this.pnlCardResult.Controls.Add(this.lblFinalValue);
|
this.lblCanvasTitle.Dock = DockStyle.Left;
|
||||||
|
this.lblCanvasTitle.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
this.lblCanvasTitle.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblCanvasTitle.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
this.lblCanvasTitle.Padding = new Padding(8, 0, 0, 0);
|
||||||
|
|
||||||
|
this.btnNavToGraph.Text = "📈 Grafik Çiziciye Aktar";
|
||||||
|
this.btnNavToGraph.Dock = DockStyle.Right;
|
||||||
|
this.btnNavToGraph.Width = 145;
|
||||||
|
this.btnNavToGraph.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnNavToGraph.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
this.btnNavToGraph.ForeColor = Color.White;
|
||||||
|
this.btnNavToGraph.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.btnNavToGraph.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnNavToGraph.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.btnExportPng.Text = "📷 PNG Kaydet";
|
||||||
|
this.btnExportPng.Dock = DockStyle.Right;
|
||||||
|
this.btnExportPng.Width = 95;
|
||||||
|
this.btnExportPng.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnExportPng.BackColor = Color.FromArgb(33, 44, 70);
|
||||||
|
this.btnExportPng.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
|
this.btnExportPng.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.btnExportPng.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnExportPng.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.pnlCanvasHeader.Controls.Add(this.lblCanvasTitle);
|
||||||
|
this.pnlCanvasHeader.Controls.Add(this.btnExportPng);
|
||||||
|
this.pnlCanvasHeader.Controls.Add(this.btnNavToGraph);
|
||||||
|
|
||||||
|
this.pnlOdeCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlOdeCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlOdeCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.splitOde.Panel1.Controls.Add(this.pnlOdeCanvas);
|
||||||
|
this.splitOde.Panel1.Controls.Add(this.pnlCanvasHeader);
|
||||||
|
|
||||||
|
// Right: Tabbed Output
|
||||||
|
this.splitOde.Panel2.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
|
this.splitOde.Panel2.Padding = new Padding(4);
|
||||||
|
|
||||||
|
this.tabOdeResults.Dock = DockStyle.Fill;
|
||||||
|
this.tabOdeResults.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
|
||||||
|
// Tab 1: Summary KPI
|
||||||
|
this.tabSummary.Text = "Çözüm Özeti";
|
||||||
|
this.tabSummary.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabSummary.Padding = new Padding(12);
|
||||||
|
|
||||||
|
this.pnlKpiCard.Dock = DockStyle.Top;
|
||||||
|
this.pnlKpiCard.Height = 90;
|
||||||
|
this.pnlKpiCard.BackColor = Color.FromArgb(18, 26, 44);
|
||||||
|
this.pnlKpiCard.Padding = new Padding(14);
|
||||||
|
|
||||||
|
this.lblKpiFinalVal.Dock = DockStyle.Top;
|
||||||
|
this.lblKpiFinalVal.Height = 36;
|
||||||
|
this.lblKpiFinalVal.Font = new Font("Consolas", 15F, FontStyle.Bold);
|
||||||
|
this.lblKpiFinalVal.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblKpiFinalVal.Text = "y(x_son) ≈ —";
|
||||||
|
|
||||||
|
this.lblKpiSub.Dock = DockStyle.Bottom;
|
||||||
|
this.lblKpiSub.Height = 22;
|
||||||
|
this.lblKpiSub.Font = new Font("Segoe UI", 8.5F);
|
||||||
|
this.lblKpiSub.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblKpiSub.Text = "Hesaplama bekleniyor.";
|
||||||
|
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiFinalVal);
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiSub);
|
||||||
|
|
||||||
|
this.pnlMetricsContainer.Dock = DockStyle.Fill;
|
||||||
|
this.pnlMetricsContainer.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.pnlMetricsContainer.Padding = new Padding(12);
|
||||||
|
|
||||||
|
this.lblMetricSteps.Text = "• Toplam Adım (N) : —";
|
||||||
|
this.lblMetricSteps.Location = new Point(14, 20);
|
||||||
|
this.lblMetricSteps.AutoSize = true;
|
||||||
|
this.lblMetricSteps.Font = new Font("Consolas", 10F);
|
||||||
|
this.lblMetricSteps.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
|
||||||
|
this.lblMetricH.Text = "• Adım Boyutu (h) : —";
|
||||||
|
this.lblMetricH.Location = new Point(14, 52);
|
||||||
|
this.lblMetricH.AutoSize = true;
|
||||||
|
this.lblMetricH.Font = new Font("Consolas", 10F);
|
||||||
|
this.lblMetricH.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
|
||||||
|
this.lblMetricElapsed.Text = "• Çözüm Süresi : —";
|
||||||
|
this.lblMetricElapsed.Location = new Point(14, 84);
|
||||||
|
this.lblMetricElapsed.AutoSize = true;
|
||||||
|
this.lblMetricElapsed.Font = new Font("Consolas", 10F);
|
||||||
|
this.lblMetricElapsed.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
|
||||||
|
this.lblMetricMethod.Text = "• Yöntem : —";
|
||||||
|
this.lblMetricMethod.Location = new Point(14, 116);
|
||||||
|
this.lblMetricMethod.AutoSize = true;
|
||||||
|
this.lblMetricMethod.Font = new Font("Consolas", 10F);
|
||||||
|
this.lblMetricMethod.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
|
||||||
|
this.pnlMetricsContainer.Controls.Add(this.lblMetricSteps);
|
||||||
|
this.pnlMetricsContainer.Controls.Add(this.lblMetricH);
|
||||||
|
this.pnlMetricsContainer.Controls.Add(this.lblMetricElapsed);
|
||||||
|
this.pnlMetricsContainer.Controls.Add(this.lblMetricMethod);
|
||||||
|
|
||||||
|
this.tabSummary.Controls.Add(this.pnlMetricsContainer);
|
||||||
|
this.tabSummary.Controls.Add(this.pnlKpiCard);
|
||||||
|
|
||||||
|
// Tab 2: Steps Table
|
||||||
|
this.tabStepsTable.Text = "Adım Tablosu";
|
||||||
|
this.tabStepsTable.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabStepsTable.Padding = new Padding(6);
|
||||||
|
|
||||||
|
this.pnlTableToolbar.Dock = DockStyle.Top;
|
||||||
|
this.pnlTableToolbar.Height = 32;
|
||||||
|
this.pnlTableToolbar.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
|
||||||
|
this.btnCopyTsv.Dock = DockStyle.Right;
|
||||||
|
this.btnCopyTsv.Height = 28;
|
||||||
|
this.pnlTableToolbar.Controls.Add(this.btnCopyTsv);
|
||||||
|
|
||||||
|
SetupGrid(this.dgvSteps);
|
||||||
|
this.tabStepsTable.Controls.Add(this.dgvSteps);
|
||||||
|
this.tabStepsTable.Controls.Add(this.pnlTableToolbar);
|
||||||
|
|
||||||
|
// Tab 3: Text Report
|
||||||
|
this.tabTextReport.Text = "Metin Raporu";
|
||||||
|
this.tabTextReport.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabTextReport.Padding = new Padding(6);
|
||||||
|
|
||||||
// txtOutput
|
|
||||||
this.txtOutput.Dock = DockStyle.Fill;
|
this.txtOutput.Dock = DockStyle.Fill;
|
||||||
this.txtOutput.BackColor = Color.FromArgb(11, 17, 32);
|
this.txtOutput.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtOutput.BorderStyle = BorderStyle.None;
|
this.txtOutput.BorderStyle = BorderStyle.None;
|
||||||
this.txtOutput.ReadOnly = true;
|
this.txtOutput.ReadOnly = true;
|
||||||
|
|
||||||
|
this.tabTextReport.Controls.Add(this.txtOutput);
|
||||||
|
|
||||||
|
this.tabOdeResults.TabPages.Add(this.tabSummary);
|
||||||
|
this.tabOdeResults.TabPages.Add(this.tabStepsTable);
|
||||||
|
this.tabOdeResults.TabPages.Add(this.tabTextReport);
|
||||||
|
|
||||||
|
this.splitOde.Panel2.Controls.Add(this.tabOdeResults);
|
||||||
|
|
||||||
// Assemble OdeSolverControl
|
// Assemble OdeSolverControl
|
||||||
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = AutoScaleMode.Font;
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.BackColor = ThemeHelper.DarkBackground;
|
this.BackColor = ThemeHelper.DarkBackground;
|
||||||
this.Controls.Add(this.txtOutput);
|
this.Controls.Add(this.splitOde);
|
||||||
this.Controls.Add(this.pnlCardResult);
|
|
||||||
this.Controls.Add(this.pnlControls);
|
this.Controls.Add(this.pnlControls);
|
||||||
this.Controls.Add(this.pnlHeader);
|
this.Controls.Add(this.pnlHeader);
|
||||||
this.Name = "OdeSolverControl";
|
this.Name = "OdeSolverControl";
|
||||||
this.Size = new Size(920, 660);
|
this.Size = new Size(940, 680);
|
||||||
|
|
||||||
this.pnlControls.ResumeLayout(false);
|
this.pnlControls.ResumeLayout(false);
|
||||||
this.pnlControls.PerformLayout();
|
this.pnlControls.PerformLayout();
|
||||||
this.pnlCardResult.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)(this.numSteps)).EndInit();
|
||||||
|
this.splitOde.Panel1.ResumeLayout(false);
|
||||||
|
this.splitOde.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitOde)).EndInit();
|
||||||
|
this.splitOde.ResumeLayout(false);
|
||||||
|
this.pnlCanvasHeader.ResumeLayout(false);
|
||||||
|
this.tabOdeResults.ResumeLayout(false);
|
||||||
|
this.tabSummary.ResumeLayout(false);
|
||||||
|
this.pnlKpiCard.ResumeLayout(false);
|
||||||
|
this.pnlMetricsContainer.ResumeLayout(false);
|
||||||
|
this.pnlMetricsContainer.PerformLayout();
|
||||||
|
this.tabStepsTable.ResumeLayout(false);
|
||||||
|
this.pnlTableToolbar.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvSteps)).EndInit();
|
||||||
|
this.tabTextReport.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupGrid(DataGridView dgv)
|
||||||
|
{
|
||||||
|
dgv.Dock = DockStyle.Fill;
|
||||||
|
dgv.BackgroundColor = Color.FromArgb(15, 23, 42);
|
||||||
|
dgv.BorderStyle = BorderStyle.None;
|
||||||
|
dgv.EnableHeadersVisualStyles = false;
|
||||||
|
dgv.AllowUserToAddRows = false;
|
||||||
|
dgv.AllowUserToDeleteRows = false;
|
||||||
|
dgv.AllowUserToResizeRows = false;
|
||||||
|
dgv.RowHeadersVisible = false;
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
dgv.ColumnHeadersHeight = 24;
|
||||||
|
dgv.DefaultCellStyle.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
|
dgv.DefaultCellStyle.ForeColor = Color.White;
|
||||||
|
dgv.DefaultCellStyle.Font = new Font("Consolas", 9.5F);
|
||||||
|
dgv.DefaultCellStyle.SelectionBackColor = Color.FromArgb(37, 99, 235);
|
||||||
|
dgv.DefaultCellStyle.SelectionForeColor = Color.White;
|
||||||
|
dgv.GridColor = Color.FromArgb(40, 50, 75);
|
||||||
|
dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dgv.ReadOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
private Panel pnlHeader;
|
private Panel pnlHeader;
|
||||||
private Panel pnlControls;
|
private Panel pnlControls;
|
||||||
private FlowLayoutPanel pnlPresets;
|
private FlowLayoutPanel pnlPresets;
|
||||||
|
|
@ -253,10 +458,31 @@ namespace MathApp.Controls
|
||||||
private TextBox txtXEnd;
|
private TextBox txtXEnd;
|
||||||
private Label lblSteps;
|
private Label lblSteps;
|
||||||
private NumericUpDown numSteps;
|
private NumericUpDown numSteps;
|
||||||
private Button btnCopy;
|
|
||||||
private Panel pnlCardResult;
|
private SplitContainer splitOde;
|
||||||
private Label lblFinalValue;
|
private Panel pnlCanvasHeader;
|
||||||
private Label lblFinalDetails;
|
private Label lblCanvasTitle;
|
||||||
|
private Button btnExportPng;
|
||||||
|
private Button btnNavToGraph;
|
||||||
|
private Panel pnlOdeCanvas;
|
||||||
|
|
||||||
|
private TabControl tabOdeResults;
|
||||||
|
private TabPage tabSummary;
|
||||||
|
private Panel pnlKpiCard;
|
||||||
|
private Label lblKpiFinalVal;
|
||||||
|
private Label lblKpiSub;
|
||||||
|
private Panel pnlMetricsContainer;
|
||||||
|
private Label lblMetricSteps;
|
||||||
|
private Label lblMetricH;
|
||||||
|
private Label lblMetricElapsed;
|
||||||
|
private Label lblMetricMethod;
|
||||||
|
|
||||||
|
private TabPage tabStepsTable;
|
||||||
|
private Panel pnlTableToolbar;
|
||||||
|
private Button btnCopyTsv;
|
||||||
|
private DataGridView dgvSteps;
|
||||||
|
|
||||||
|
private TabPage tabTextReport;
|
||||||
private RichTextBox txtOutput;
|
private RichTextBox txtOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -10,17 +12,26 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
public partial class OdeSolverControl : UserControl
|
public partial class OdeSolverControl : UserControl
|
||||||
{
|
{
|
||||||
|
private List<DifferentialEquations.OdeStepResult> _currentResults = new List<DifferentialEquations.OdeStepResult>();
|
||||||
|
private string _lastEquation = "x + y";
|
||||||
|
private decimal _lastX0 = 0m, _lastY0 = 1m, _lastXEnd = 2m;
|
||||||
|
private PointF? _hoverPoint = null;
|
||||||
|
private (decimal X, decimal Y, decimal Slope)? _hoverData = null;
|
||||||
|
|
||||||
public OdeSolverControl()
|
public OdeSolverControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
InitializeStepsGrid();
|
||||||
|
|
||||||
btnSolve.Click += BtnSolve_Click;
|
btnSolve.Click += BtnSolve_Click;
|
||||||
btnCopy.Click += (s, e) =>
|
btnCopyTsv.Click += (s, e) => CopyGridAsTsv();
|
||||||
|
btnExportPng.Click += (s, e) => ExportCanvasAsPng();
|
||||||
|
|
||||||
|
btnNavToGraph.Click += (s, e) =>
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(txtOutput.Text))
|
if (!string.IsNullOrWhiteSpace(_lastEquation))
|
||||||
{
|
{
|
||||||
Clipboard.SetText(txtOutput.Text);
|
MainForm.Instance?.NavigateToGraph(_lastEquation, (float)_lastX0, (float)_lastY0);
|
||||||
MessageBox.Show("Çözüm tablosu panoya kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -33,6 +44,28 @@ namespace MathApp.Controls
|
||||||
txtX0.KeyDown += Input_KeyDown;
|
txtX0.KeyDown += Input_KeyDown;
|
||||||
txtY0.KeyDown += Input_KeyDown;
|
txtY0.KeyDown += Input_KeyDown;
|
||||||
txtXEnd.KeyDown += Input_KeyDown;
|
txtXEnd.KeyDown += Input_KeyDown;
|
||||||
|
|
||||||
|
pnlOdeCanvas.Paint += PnlOdeCanvas_Paint;
|
||||||
|
pnlOdeCanvas.MouseMove += PnlOdeCanvas_MouseMove;
|
||||||
|
pnlOdeCanvas.MouseLeave += (s, e) => { _hoverPoint = null; _hoverData = null; pnlOdeCanvas.Invalidate(); };
|
||||||
|
pnlOdeCanvas.Resize += (s, e) => pnlOdeCanvas.Invalidate();
|
||||||
|
|
||||||
|
// Load initial preset
|
||||||
|
LoadPreset("x + y", "0", "1", "2", 50, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeStepsGrid()
|
||||||
|
{
|
||||||
|
dgvSteps.Columns.Clear();
|
||||||
|
dgvSteps.Columns.Add("step", "Adım (i)");
|
||||||
|
dgvSteps.Columns.Add("x", "x_i");
|
||||||
|
dgvSteps.Columns.Add("y", "y_i (Hesaplanan)");
|
||||||
|
dgvSteps.Columns.Add("slope", "Eğim (dy/dx)");
|
||||||
|
|
||||||
|
dgvSteps.Columns["step"].Width = 65;
|
||||||
|
dgvSteps.Columns["x"].Width = 90;
|
||||||
|
dgvSteps.Columns["y"].Width = 140;
|
||||||
|
dgvSteps.Columns["slope"].Width = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Input_KeyDown(object sender, KeyEventArgs e)
|
private void Input_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
@ -103,19 +136,44 @@ namespace MathApp.Controls
|
||||||
|
|
||||||
if (results != null && results.Count > 0)
|
if (results != null && results.Count > 0)
|
||||||
{
|
{
|
||||||
|
_currentResults = results;
|
||||||
|
_lastEquation = eq;
|
||||||
|
_lastX0 = x0;
|
||||||
|
_lastY0 = y0;
|
||||||
|
_lastXEnd = xEnd;
|
||||||
|
|
||||||
var last = results[results.Count - 1];
|
var last = results[results.Count - 1];
|
||||||
string lastYStr = last.Y.ToString("0.########", CultureInfo.InvariantCulture);
|
string lastYStr = last.Y.ToString("0.########", CultureInfo.InvariantCulture);
|
||||||
string lastXStr = last.X.ToString("0.####", CultureInfo.InvariantCulture);
|
string lastXStr = last.X.ToString("0.####", CultureInfo.InvariantCulture);
|
||||||
|
decimal stepSize = (xEnd - x0) / steps;
|
||||||
|
|
||||||
lblFinalValue.Text = $"y({lastXStr}) ≈ {lastYStr}";
|
lblKpiFinalVal.Text = $"y({lastXStr}) ≈ {lastYStr}";
|
||||||
lblFinalValue.ForeColor = Color.FromArgb(52, 211, 153);
|
lblKpiFinalVal.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
lblFinalDetails.Text = $"✅ {method} ile {steps} adımda (h = {((xEnd - x0) / steps).ToString("0.######", CultureInfo.InvariantCulture)}) | ⏱️ {sw.ElapsedMilliseconds} ms";
|
lblKpiSub.Text = $"✅ {method} başarıyla tamamlandı.";
|
||||||
|
|
||||||
|
lblMetricSteps.Text = $"• Toplam Adım (N) : {steps}";
|
||||||
|
lblMetricH.Text = $"• Adım Boyutu (h) : {stepSize.ToString("0.######", CultureInfo.InvariantCulture)}";
|
||||||
|
lblMetricElapsed.Text = $"• Çözüm Süresi : {sw.ElapsedMilliseconds} ms ({sw.ElapsedTicks} ticks)";
|
||||||
|
lblMetricMethod.Text = $"• Yöntem : {method}";
|
||||||
|
|
||||||
|
// Populate DataGridView
|
||||||
|
dgvSteps.Rows.Clear();
|
||||||
|
foreach (var r in results)
|
||||||
|
{
|
||||||
|
dgvSteps.Rows.Add(
|
||||||
|
dgvSteps.Rows.Count,
|
||||||
|
r.X.ToString("0.######", CultureInfo.InvariantCulture),
|
||||||
|
r.Y.ToString("0.########", CultureInfo.InvariantCulture),
|
||||||
|
r.Slope.ToString("0.######", CultureInfo.InvariantCulture)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Populate RichTextBox Report
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.AppendLine("=== DİFERANSİYEL DENKLEM NÜMERİK ÇÖZÜM TABLOSU ===");
|
sb.AppendLine("=== DİFERANSİYEL DENKLEM NÜMERİK ÇÖZÜM TABLOSU ===");
|
||||||
sb.AppendLine($" Denklem : dy/dx = {eq}");
|
sb.AppendLine($" Denklem : dy/dx = {eq}");
|
||||||
sb.AppendLine($" Başlangıç : y({x0}) = {y0}");
|
sb.AppendLine($" Başlangıç : y({x0}) = {y0}");
|
||||||
sb.AppendLine($" Hedef Aralık : [{x0}, {xEnd}] (N = {steps} adım, h = {((xEnd - x0) / steps).ToString("0.######", CultureInfo.InvariantCulture)})");
|
sb.AppendLine($" Hedef Aralık : [{x0}, {xEnd}] (N = {steps} adım, h = {stepSize.ToString("0.######", CultureInfo.InvariantCulture)})");
|
||||||
sb.AppendLine($" Yöntem : {method}");
|
sb.AppendLine($" Yöntem : {method}");
|
||||||
sb.AppendLine(new string('=', 70));
|
sb.AppendLine(new string('=', 70));
|
||||||
sb.AppendLine($"{"Adım",-6} | {"x",-16} | {"y (Hesaplanan)",-20} | {"Eğim (dy/dx)",-18}");
|
sb.AppendLine($"{"Adım",-6} | {"x",-16} | {"y (Hesaplanan)",-20} | {"Eğim (dy/dx)",-18}");
|
||||||
|
|
@ -126,16 +184,17 @@ namespace MathApp.Controls
|
||||||
var r = results[i];
|
var r = results[i];
|
||||||
sb.AppendLine($"[{i,4}] | {r.X.ToString("0.######", CultureInfo.InvariantCulture),-16} | {r.Y.ToString("0.########", CultureInfo.InvariantCulture),-20} | {r.Slope.ToString("0.######", CultureInfo.InvariantCulture),-18}");
|
sb.AppendLine($"[{i,4}] | {r.X.ToString("0.######", CultureInfo.InvariantCulture),-16} | {r.Y.ToString("0.########", CultureInfo.InvariantCulture),-20} | {r.Slope.ToString("0.######", CultureInfo.InvariantCulture),-18}");
|
||||||
}
|
}
|
||||||
|
|
||||||
txtOutput.Text = sb.ToString();
|
txtOutput.Text = sb.ToString();
|
||||||
|
|
||||||
|
pnlOdeCanvas.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "❌ Hata: " + ex.Message;
|
txtOutput.Text = "❌ Hata: " + ex.Message;
|
||||||
lblFinalValue.Text = "Hata Oluştu";
|
lblKpiFinalVal.Text = "Hata Oluştu";
|
||||||
lblFinalValue.ForeColor = Color.FromArgb(239, 68, 68);
|
lblKpiFinalVal.ForeColor = Color.FromArgb(239, 68, 68);
|
||||||
lblFinalDetails.Text = ex.Message;
|
lblKpiSub.Text = ex.Message;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -144,5 +203,266 @@ namespace MathApp.Controls
|
||||||
Cursor = Cursors.Default;
|
Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PnlOdeCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
RenderCanvas(e.Graphics, pnlOdeCanvas.Width, pnlOdeCanvas.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RenderCanvas(Graphics g, int w, int h)
|
||||||
|
{
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("Diferansiyel denklem çözüldüğünde y(x) çözüm eğrisi burada çizilir.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find bounds
|
||||||
|
decimal minX = _currentResults[0].X;
|
||||||
|
decimal maxX = _currentResults[_currentResults.Count - 1].X;
|
||||||
|
decimal minY = _currentResults[0].Y;
|
||||||
|
decimal maxY = _currentResults[0].Y;
|
||||||
|
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
if (r.Y < minY) minY = r.Y;
|
||||||
|
if (r.Y > maxY) maxY = r.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add margin
|
||||||
|
decimal spanX = maxX - minX;
|
||||||
|
if (spanX == 0m) spanX = 1m;
|
||||||
|
decimal spanY = maxY - minY;
|
||||||
|
if (spanY == 0m) spanY = 1m;
|
||||||
|
|
||||||
|
minX -= spanX * 0.05m;
|
||||||
|
maxX += spanX * 0.05m;
|
||||||
|
minY -= spanY * 0.1m;
|
||||||
|
maxY += spanY * 0.1m;
|
||||||
|
|
||||||
|
int padLeft = 45;
|
||||||
|
int padBottom = 30;
|
||||||
|
int padTop = 20;
|
||||||
|
int padRight = 20;
|
||||||
|
|
||||||
|
float plotW = w - padLeft - padRight;
|
||||||
|
float plotH = h - padTop - padBottom;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
float ToScreenX(decimal x) => padLeft + (float)((x - minX) / (maxX - minX) * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal y) => padTop + (float)((maxY - y) / (maxY - minY) * (decimal)plotH);
|
||||||
|
|
||||||
|
// Draw subtle grid lines
|
||||||
|
using (Pen gridPen = new Pen(Color.FromArgb(24, 33, 52), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(100, 116, 139)))
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
decimal gx = minX + (spanX * i / 5m);
|
||||||
|
float sx = ToScreenX(gx);
|
||||||
|
g.DrawLine(gridPen, sx, padTop, sx, h - padBottom);
|
||||||
|
g.DrawString(Math.Round(gx, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 12, h - padBottom + 4);
|
||||||
|
|
||||||
|
decimal gy = minY + (spanY * i / 5m);
|
||||||
|
float sy = ToScreenY(gy);
|
||||||
|
g.DrawLine(gridPen, padLeft, sy, w - padRight, sy);
|
||||||
|
g.DrawString(Math.Round(gy, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw coordinate axis box
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padLeft, padTop, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw Solution Curve
|
||||||
|
List<PointF> pts = new List<PointF>(_currentResults.Count);
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
pts.Add(new PointF(ToScreenX(r.X), ToScreenY(r.Y)));
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Pen curvePen = new Pen(Color.FromArgb(16, 185, 129), 2.5f))
|
||||||
|
{
|
||||||
|
curvePen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < pts.Count - 1; i++)
|
||||||
|
{
|
||||||
|
g.DrawLine(curvePen, pts[i], pts[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlight Start Point (x0, y0) in Amber
|
||||||
|
PointF startPt = pts[0];
|
||||||
|
using (Brush amberBrush = new SolidBrush(Color.FromArgb(245, 158, 11)))
|
||||||
|
{
|
||||||
|
g.FillEllipse(amberBrush, startPt.X - 4.5f, startPt.Y - 4.5f, 9f, 9f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlight End Point in Emerald
|
||||||
|
PointF endPt = pts[pts.Count - 1];
|
||||||
|
using (Brush greenBrush = new SolidBrush(Color.FromArgb(52, 211, 153)))
|
||||||
|
{
|
||||||
|
g.FillEllipse(greenBrush, endPt.X - 5.5f, endPt.Y - 5.5f, 11f, 11f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crosshair & Tooltip
|
||||||
|
if (_hoverPoint.HasValue && _hoverData.HasValue)
|
||||||
|
{
|
||||||
|
PointF hp = _hoverPoint.Value;
|
||||||
|
using (Pen crossPen = new Pen(Color.FromArgb(14, 165, 233), 1f) { DashStyle = DashStyle.Dot })
|
||||||
|
{
|
||||||
|
g.DrawLine(crossPen, hp.X, padTop, hp.X, h - padBottom);
|
||||||
|
g.DrawLine(crossPen, padLeft, hp.Y, w - padRight, hp.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Brush hoverDot = new SolidBrush(Color.FromArgb(56, 189, 248)))
|
||||||
|
{
|
||||||
|
g.FillEllipse(hoverDot, hp.X - 4f, hp.Y - 4f, 8f, 8f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tooltip pill
|
||||||
|
var d = _hoverData.Value;
|
||||||
|
string tip = $"x = {Math.Round(d.X, 4)}\ny = {Math.Round(d.Y, 5)}\ndy/dx = {Math.Round(d.Slope, 4)}";
|
||||||
|
using (Font tipFont = new Font("Consolas", 8.5F, FontStyle.Bold))
|
||||||
|
{
|
||||||
|
SizeF sz = g.MeasureString(tip, tipFont);
|
||||||
|
float tipX = hp.X + 12;
|
||||||
|
float tipY = hp.Y - sz.Height - 6;
|
||||||
|
if (tipX + sz.Width + 8 > w) tipX = hp.X - sz.Width - 14;
|
||||||
|
if (tipY < padTop) tipY = hp.Y + 12;
|
||||||
|
|
||||||
|
RectangleF tipRect = new RectangleF(tipX, tipY, sz.Width + 10, sz.Height + 6);
|
||||||
|
using (Brush bgBrush = new SolidBrush(Color.FromArgb(240, 24, 33, 52)))
|
||||||
|
using (Pen borderPen = new Pen(Color.FromArgb(56, 189, 248), 1.2f))
|
||||||
|
using (Brush textBrush = new SolidBrush(Color.White))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bgBrush, tipRect);
|
||||||
|
g.DrawRectangle(borderPen, tipRect.X, tipRect.Y, tipRect.Width, tipRect.Height);
|
||||||
|
g.DrawString(tip, tipFont, textBrush, tipX + 5, tipY + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Top legend
|
||||||
|
using (Font legFont = new Font("Segoe UI Semibold", 8F, FontStyle.Bold))
|
||||||
|
using (Brush bCyan = new SolidBrush(Color.FromArgb(52, 211, 153)))
|
||||||
|
using (Brush bAmber = new SolidBrush(Color.FromArgb(245, 158, 11)))
|
||||||
|
{
|
||||||
|
g.DrawString("— y(x) Çözüm Eğrisi", legFont, bCyan, padLeft + 6, padTop + 6);
|
||||||
|
g.DrawString("● Başlangıç (x₀, y₀)", legFont, bAmber, padLeft + 140, padTop + 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlOdeCanvas_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2) return;
|
||||||
|
|
||||||
|
int w = pnlOdeCanvas.Width;
|
||||||
|
int h = pnlOdeCanvas.Height;
|
||||||
|
int padLeft = 45, padBottom = 30, padTop = 20, padRight = 20;
|
||||||
|
float plotW = w - padLeft - padRight;
|
||||||
|
float plotH = h - padTop - padBottom;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
decimal minX = _currentResults[0].X;
|
||||||
|
decimal maxX = _currentResults[_currentResults.Count - 1].X;
|
||||||
|
decimal minY = _currentResults[0].Y;
|
||||||
|
decimal maxY = _currentResults[0].Y;
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
if (r.Y < minY) minY = r.Y;
|
||||||
|
if (r.Y > maxY) maxY = r.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal spanX = maxX - minX;
|
||||||
|
if (spanX == 0m) spanX = 1m;
|
||||||
|
decimal spanY = maxY - minY;
|
||||||
|
if (spanY == 0m) spanY = 1m;
|
||||||
|
minX -= spanX * 0.05m;
|
||||||
|
maxX += spanX * 0.05m;
|
||||||
|
minY -= spanY * 0.1m;
|
||||||
|
maxY += spanY * 0.1m;
|
||||||
|
|
||||||
|
float ToScreenX(decimal x) => padLeft + (float)((x - minX) / (maxX - minX) * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal y) => padTop + (float)((maxY - y) / (maxY - minY) * (decimal)plotH);
|
||||||
|
|
||||||
|
// Find closest result point to mouse X
|
||||||
|
DifferentialEquations.OdeStepResult closest = null;
|
||||||
|
float closestDist = float.MaxValue;
|
||||||
|
PointF closestScreen = PointF.Empty;
|
||||||
|
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
PointF sp = new PointF(ToScreenX(r.X), ToScreenY(r.Y));
|
||||||
|
float dx = sp.X - e.X;
|
||||||
|
float dy = sp.Y - e.Y;
|
||||||
|
float dist = (float)Math.Sqrt(dx * dx + dy * dy);
|
||||||
|
if (dist < closestDist)
|
||||||
|
{
|
||||||
|
closestDist = dist;
|
||||||
|
closest = r;
|
||||||
|
closestScreen = sp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closest != null && closestDist < 50f)
|
||||||
|
{
|
||||||
|
_hoverPoint = closestScreen;
|
||||||
|
_hoverData = (closest.X, closest.Y, closest.Slope);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_hoverPoint = null;
|
||||||
|
_hoverData = null;
|
||||||
|
}
|
||||||
|
pnlOdeCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyGridAsTsv()
|
||||||
|
{
|
||||||
|
if (dgvSteps.Rows.Count == 0) return;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("Adım\tx\ty\tEğim");
|
||||||
|
foreach (DataGridViewRow r in dgvSteps.Rows)
|
||||||
|
{
|
||||||
|
sb.AppendLine($"{r.Cells[0].Value}\t{r.Cells[1].Value}\t{r.Cells[2].Value}\t{r.Cells[3].Value}");
|
||||||
|
}
|
||||||
|
Clipboard.SetText(sb.ToString());
|
||||||
|
MessageBox.Show("Adım tablosu panoya (TSV formatında) kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExportCanvasAsPng()
|
||||||
|
{
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Önce diferansiyel denklemi çözünüz.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
sfd.Filter = "PNG Resmi (*.png)|*.png";
|
||||||
|
sfd.FileName = "ODE_Cozum_Egrisi.png";
|
||||||
|
if (sfd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
using (Bitmap bmp = new Bitmap(1200, 800))
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
RenderCanvas(g, 1200, 800);
|
||||||
|
bmp.Save(sfd.FileName, ImageFormat.Png);
|
||||||
|
}
|
||||||
|
MessageBox.Show("Grafik yüksek çözünürlükte (1200x800) başarıyla kaydedildi!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,16 @@ namespace MathApp.Controls
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
||||||
"Diferansiyel Denklem Sistemi Çözücü (System of ODEs / Yüksek Dereceli ODE)",
|
"Diferansiyel Denklem Sistemi Çözücü (System of ODEs / Faz Portresi & Zaman Serisi)",
|
||||||
"dY/dt = F(t, Y) vektörel diferansiyel denklem sistemlerini ve n. derece denklemleri RK4, RK8 ve Euler ile çözer.");
|
"dY/dt = F(t, Y) vektörel diferansiyel denklem sistemlerini RK4, RK8 ve Euler ile çözer; 2B Faz Uzayı (Phase Portrait) ve Zaman Serisi grafikleri sunar.");
|
||||||
|
|
||||||
this.pnlControls = new Panel();
|
this.pnlControls = new Panel();
|
||||||
this.pnlPresets = new FlowLayoutPanel();
|
this.pnlPresets = new FlowLayoutPanel();
|
||||||
this.lblPresets = new Label();
|
this.lblPresets = new Label();
|
||||||
this.btnEx1 = ThemeHelper.CreateExampleChip("Harmonik Osilatör [y₁'=y₂, y₂'=-y₁]");
|
this.btnEx1 = ThemeHelper.CreateExampleChip("Harmonik Osilatör [y₁'=y₂, y₂'=-y₁]");
|
||||||
this.btnEx2 = ThemeHelper.CreateExampleChip("Av-Avcı [Lotka-Volterra]");
|
this.btnEx2 = ThemeHelper.CreateExampleChip("Av-Avcı [Lotka-Volterra]");
|
||||||
this.btnEx3 = ThemeHelper.CreateExampleChip("Sönümlü Sarkaç [x'=v, v'=-0.3v-sin(x)]");
|
this.btnEx3 = ThemeHelper.CreateExampleChip("Lorenz Kaotik Çekicisi [3D]");
|
||||||
this.btnEx4 = ThemeHelper.CreateExampleChip("Lorenz Kaotik Çekicisi [3D]");
|
this.btnEx4 = ThemeHelper.CreateExampleChip("Sönümlü Sarkaç");
|
||||||
|
|
||||||
this.lblEqCount = new Label();
|
this.lblEqCount = new Label();
|
||||||
this.numEqCount = new NumericUpDown();
|
this.numEqCount = new NumericUpDown();
|
||||||
|
|
@ -40,36 +40,81 @@ namespace MathApp.Controls
|
||||||
this.lblSteps = new Label();
|
this.lblSteps = new Label();
|
||||||
this.numSteps = new NumericUpDown();
|
this.numSteps = new NumericUpDown();
|
||||||
|
|
||||||
this.btnSolve = ThemeHelper.CreateActionButton("🚀 Sistemi Çöz", 140, 32, true);
|
this.btnSolve = ThemeHelper.CreateActionButton("🚀 Sistemi Çöz", 150, 32, true);
|
||||||
this.btnCopy = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala");
|
|
||||||
|
|
||||||
this.pnlEquations = new Panel();
|
this.pnlEquations = new Panel();
|
||||||
|
|
||||||
this.pnlCardResult = new Panel();
|
// Split Container: Visual Graphs (Left) + Stats & Vector Inspector (Right)
|
||||||
this.lblFinalValue = new Label();
|
this.splitSystem = new SplitContainer();
|
||||||
this.lblFinalDetails = new Label();
|
|
||||||
|
|
||||||
|
// Left: Tabbed Visualizations
|
||||||
|
this.tabSystemVisual = new TabControl();
|
||||||
|
this.tabPhase = new TabPage();
|
||||||
|
this.pnlPhaseHeader = new Panel();
|
||||||
|
this.lblPhaseTitle = new Label();
|
||||||
|
this.lblAxisX = new Label();
|
||||||
|
this.cmbAxisX = new ComboBox();
|
||||||
|
this.lblAxisY = new Label();
|
||||||
|
this.cmbAxisY = new ComboBox();
|
||||||
|
this.btnExportPhasePng = new Button();
|
||||||
|
this.pnlPhaseCanvas = new Panel();
|
||||||
|
|
||||||
|
this.tabTimeSeries = new TabPage();
|
||||||
|
this.pnlTimeHeader = new Panel();
|
||||||
|
this.lblTimeTitle = new Label();
|
||||||
|
this.btnExportTimePng = new Button();
|
||||||
|
this.pnlTimeCanvas = new Panel();
|
||||||
|
|
||||||
|
this.tabTable = new TabPage();
|
||||||
|
this.pnlTableToolbar = new Panel();
|
||||||
|
this.btnCopySystemTsv = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala (TSV)");
|
||||||
|
this.dgvSystemSteps = new DataGridView();
|
||||||
|
|
||||||
|
// Right: Vector & Stats Panel
|
||||||
|
this.pnlRightSidebar = new Panel();
|
||||||
|
this.pnlVectorCard = new Panel();
|
||||||
|
this.lblVectorTitle = new Label();
|
||||||
|
this.lblVectorValue = new Label();
|
||||||
|
this.pnlSystemMetrics = new Panel();
|
||||||
|
this.lblSysMetricSteps = new Label();
|
||||||
|
this.lblSysMetricH = new Label();
|
||||||
|
this.lblSysMetricTime = new Label();
|
||||||
|
this.lblSysMetricMethod = new Label();
|
||||||
this.txtOutput = new RichTextBox();
|
this.txtOutput = new RichTextBox();
|
||||||
|
|
||||||
this.pnlControls.SuspendLayout();
|
this.pnlControls.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numEqCount)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numEqCount)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numSteps)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numSteps)).BeginInit();
|
||||||
this.pnlCardResult.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)(this.splitSystem)).BeginInit();
|
||||||
|
this.splitSystem.Panel1.SuspendLayout();
|
||||||
|
this.splitSystem.Panel2.SuspendLayout();
|
||||||
|
this.splitSystem.SuspendLayout();
|
||||||
|
this.tabSystemVisual.SuspendLayout();
|
||||||
|
this.tabPhase.SuspendLayout();
|
||||||
|
this.pnlPhaseHeader.SuspendLayout();
|
||||||
|
this.tabTimeSeries.SuspendLayout();
|
||||||
|
this.pnlTimeHeader.SuspendLayout();
|
||||||
|
this.tabTable.SuspendLayout();
|
||||||
|
this.pnlTableToolbar.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvSystemSteps)).BeginInit();
|
||||||
|
this.pnlRightSidebar.SuspendLayout();
|
||||||
|
this.pnlVectorCard.SuspendLayout();
|
||||||
|
this.pnlSystemMetrics.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
|
||||||
// pnlControls
|
// pnlControls
|
||||||
this.pnlControls.Dock = DockStyle.Top;
|
this.pnlControls.Dock = DockStyle.Top;
|
||||||
this.pnlControls.Height = 110;
|
this.pnlControls.Height = 175;
|
||||||
this.pnlControls.BackColor = ThemeHelper.DarkBackground;
|
this.pnlControls.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
this.pnlControls.Padding = new Padding(24, 8, 24, 8);
|
this.pnlControls.Padding = new Padding(20, 6, 20, 6);
|
||||||
|
|
||||||
this.lblPresets.Text = "Hazır Sistemler:";
|
this.lblPresets.Text = "⚡ Hazır Sistemler:";
|
||||||
this.lblPresets.AutoSize = true;
|
this.lblPresets.AutoSize = true;
|
||||||
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
||||||
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
||||||
|
|
||||||
this.pnlPresets.Location = new Point(24, 8);
|
this.pnlPresets.Location = new Point(20, 6);
|
||||||
this.pnlPresets.Size = new Size(880, 32);
|
this.pnlPresets.Size = new Size(880, 32);
|
||||||
this.pnlPresets.Controls.Add(this.lblPresets);
|
this.pnlPresets.Controls.Add(this.lblPresets);
|
||||||
this.pnlPresets.Controls.Add(this.btnEx1);
|
this.pnlPresets.Controls.Add(this.btnEx1);
|
||||||
|
|
@ -77,79 +122,88 @@ namespace MathApp.Controls
|
||||||
this.pnlPresets.Controls.Add(this.btnEx3);
|
this.pnlPresets.Controls.Add(this.btnEx3);
|
||||||
this.pnlPresets.Controls.Add(this.btnEx4);
|
this.pnlPresets.Controls.Add(this.btnEx4);
|
||||||
|
|
||||||
int yRow = 48;
|
int yRow = 42;
|
||||||
this.lblEqCount.Text = "Denklem Sayısı:";
|
this.lblEqCount.Text = "Denklem Sayısı (n):";
|
||||||
this.lblEqCount.Location = new Point(24, yRow + 4);
|
this.lblEqCount.Location = new Point(20, yRow + 3);
|
||||||
this.lblEqCount.AutoSize = true;
|
this.lblEqCount.AutoSize = true;
|
||||||
this.lblEqCount.ForeColor = ThemeHelper.LightText;
|
this.lblEqCount.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblEqCount.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
|
||||||
this.numEqCount.Location = new Point(125, yRow);
|
this.numEqCount.Location = new Point(140, yRow);
|
||||||
this.numEqCount.Size = new Size(50, 25);
|
this.numEqCount.Size = new Size(42, 24);
|
||||||
this.numEqCount.Minimum = 1;
|
this.numEqCount.Minimum = 1;
|
||||||
this.numEqCount.Maximum = 6;
|
this.numEqCount.Maximum = 6;
|
||||||
this.numEqCount.Value = 2;
|
this.numEqCount.Value = 2;
|
||||||
this.numEqCount.BackColor = ThemeHelper.CardBackground;
|
this.numEqCount.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numEqCount.ForeColor = Color.White;
|
this.numEqCount.ForeColor = Color.White;
|
||||||
|
|
||||||
this.lblMethod.Text = "Yöntem:";
|
this.lblMethod.Text = "Yöntem:";
|
||||||
this.lblMethod.Location = new Point(190, yRow + 4);
|
this.lblMethod.Location = new Point(195, yRow + 3);
|
||||||
this.lblMethod.AutoSize = true;
|
this.lblMethod.AutoSize = true;
|
||||||
this.lblMethod.ForeColor = ThemeHelper.LightText;
|
this.lblMethod.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblMethod.Font = new Font("Segoe UI", 9F);
|
||||||
|
|
||||||
this.cmbMethod.Location = new Point(250, yRow);
|
this.cmbMethod.Location = new Point(250, yRow);
|
||||||
this.cmbMethod.Size = new Size(220, 25);
|
this.cmbMethod.Size = new Size(180, 24);
|
||||||
this.cmbMethod.DropDownStyle = ComboBoxStyle.DropDownList;
|
this.cmbMethod.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
this.cmbMethod.BackColor = ThemeHelper.CardBackground;
|
this.cmbMethod.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.cmbMethod.ForeColor = Color.White;
|
this.cmbMethod.ForeColor = Color.White;
|
||||||
this.cmbMethod.Font = new Font("Segoe UI", 9.5F);
|
this.cmbMethod.Font = new Font("Segoe UI", 9F);
|
||||||
this.cmbMethod.Items.AddRange(new object[] {
|
this.cmbMethod.Items.AddRange(new object[] {
|
||||||
"Runge-Kutta 4 (RK4 - Önerilen)",
|
"Runge-Kutta 4 (RK4)",
|
||||||
"Runge-Kutta 8 (RK8 - Yüksek Hassasiyet)",
|
"Runge-Kutta 8 (RK8 - Ultra)",
|
||||||
"Euler Yöntemi (1. Derece)"
|
"Euler Yöntemi"
|
||||||
});
|
});
|
||||||
this.cmbMethod.SelectedIndex = 0;
|
this.cmbMethod.SelectedIndex = 0;
|
||||||
|
|
||||||
this.lblT0.Text = "t₀:";
|
this.lblT0.Text = "t₀:";
|
||||||
this.lblT0.Location = new Point(485, yRow + 4);
|
this.lblT0.Location = new Point(440, yRow + 3);
|
||||||
this.lblT0.AutoSize = true;
|
this.lblT0.AutoSize = true;
|
||||||
this.lblT0.ForeColor = ThemeHelper.LightText;
|
this.lblT0.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtT0.Location = new Point(510, yRow);
|
this.txtT0.Location = new Point(465, yRow);
|
||||||
this.txtT0.Size = new Size(50, 25);
|
this.txtT0.Size = new Size(45, 24);
|
||||||
this.txtT0.Text = "0";
|
this.txtT0.Text = "0";
|
||||||
this.txtT0.Font = new Font("Consolas", 10F);
|
this.txtT0.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtT0.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtT0.ForeColor = Color.White;
|
this.txtT0.ForeColor = Color.White;
|
||||||
this.txtT0.BorderStyle = BorderStyle.FixedSingle;
|
this.txtT0.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtT0.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblTEnd.Text = "t_son:";
|
this.lblTEnd.Text = "t_son:";
|
||||||
this.lblTEnd.Location = new Point(570, yRow + 4);
|
this.lblTEnd.Location = new Point(518, yRow + 3);
|
||||||
this.lblTEnd.AutoSize = true;
|
this.lblTEnd.AutoSize = true;
|
||||||
this.lblTEnd.ForeColor = ThemeHelper.LightText;
|
this.lblTEnd.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtTEnd.Location = new Point(615, yRow);
|
this.txtTEnd.Location = new Point(560, yRow);
|
||||||
this.txtTEnd.Size = new Size(50, 25);
|
this.txtTEnd.Size = new Size(50, 24);
|
||||||
this.txtTEnd.Text = "10";
|
this.txtTEnd.Text = "15";
|
||||||
this.txtTEnd.Font = new Font("Consolas", 10F);
|
this.txtTEnd.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtTEnd.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtTEnd.ForeColor = Color.White;
|
this.txtTEnd.ForeColor = Color.White;
|
||||||
this.txtTEnd.BorderStyle = BorderStyle.FixedSingle;
|
this.txtTEnd.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtTEnd.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblSteps.Text = "Adım (N):";
|
this.lblSteps.Text = "Adım (N):";
|
||||||
this.lblSteps.Location = new Point(675, yRow + 4);
|
this.lblSteps.Location = new Point(620, yRow + 3);
|
||||||
this.lblSteps.AutoSize = true;
|
this.lblSteps.AutoSize = true;
|
||||||
this.lblSteps.ForeColor = ThemeHelper.LightText;
|
this.lblSteps.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.numSteps.Location = new Point(740, yRow);
|
this.numSteps.Location = new Point(685, yRow);
|
||||||
this.numSteps.Size = new Size(65, 25);
|
this.numSteps.Size = new Size(60, 24);
|
||||||
this.numSteps.Minimum = 2;
|
this.numSteps.Minimum = 10;
|
||||||
this.numSteps.Maximum = 5000;
|
this.numSteps.Maximum = 10000;
|
||||||
this.numSteps.Value = 100;
|
this.numSteps.Value = 300;
|
||||||
this.numSteps.BackColor = ThemeHelper.CardBackground;
|
this.numSteps.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numSteps.ForeColor = Color.White;
|
this.numSteps.ForeColor = Color.White;
|
||||||
|
|
||||||
this.btnSolve.Location = new Point(24, 78);
|
this.btnSolve.Location = new Point(760, yRow - 3);
|
||||||
this.btnCopy.Location = new Point(175, 78);
|
|
||||||
|
// Dynamic Equations Panel
|
||||||
|
this.pnlEquations.Location = new Point(20, 72);
|
||||||
|
this.pnlEquations.Size = new Size(880, 95);
|
||||||
|
this.pnlEquations.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
this.pnlEquations.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.pnlEquations.AutoScroll = true;
|
||||||
|
this.pnlEquations.Padding = new Padding(6);
|
||||||
|
|
||||||
this.pnlControls.Controls.Add(this.pnlPresets);
|
this.pnlControls.Controls.Add(this.pnlPresets);
|
||||||
this.pnlControls.Controls.Add(this.lblEqCount);
|
this.pnlControls.Controls.Add(this.lblEqCount);
|
||||||
|
|
@ -163,64 +217,268 @@ namespace MathApp.Controls
|
||||||
this.pnlControls.Controls.Add(this.lblSteps);
|
this.pnlControls.Controls.Add(this.lblSteps);
|
||||||
this.pnlControls.Controls.Add(this.numSteps);
|
this.pnlControls.Controls.Add(this.numSteps);
|
||||||
this.pnlControls.Controls.Add(this.btnSolve);
|
this.pnlControls.Controls.Add(this.btnSolve);
|
||||||
this.pnlControls.Controls.Add(this.btnCopy);
|
this.pnlControls.Controls.Add(this.pnlEquations);
|
||||||
|
|
||||||
// pnlEquations (Dynamic rows for ODEs)
|
// ================== SPLIT SYSTEM CONTAINER ==================
|
||||||
this.pnlEquations.Dock = DockStyle.Top;
|
this.splitSystem.Dock = DockStyle.Fill;
|
||||||
this.pnlEquations.Height = 115;
|
this.splitSystem.Orientation = Orientation.Vertical;
|
||||||
this.pnlEquations.AutoScroll = true;
|
this.splitSystem.SplitterDistance = 600;
|
||||||
this.pnlEquations.BackColor = Color.FromArgb(20, 28, 45);
|
this.splitSystem.SplitterWidth = 8;
|
||||||
this.pnlEquations.Padding = new Padding(24, 6, 24, 6);
|
this.splitSystem.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.splitSystem.Padding = new Padding(12);
|
||||||
|
|
||||||
// pnlCardResult
|
// Left: Tabbed Visualizations
|
||||||
this.pnlCardResult.Dock = DockStyle.Top;
|
this.splitSystem.Panel1.Controls.Add(this.tabSystemVisual);
|
||||||
this.pnlCardResult.Height = 65;
|
this.tabSystemVisual.Dock = DockStyle.Fill;
|
||||||
this.pnlCardResult.BackColor = ThemeHelper.CardBackground;
|
this.tabSystemVisual.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.pnlCardResult.Padding = new Padding(20, 8, 20, 8);
|
|
||||||
|
|
||||||
this.lblFinalValue.Dock = DockStyle.Top;
|
// Tab 1: Faz Portresi
|
||||||
this.lblFinalValue.Height = 26;
|
this.tabPhase.Text = "Faz Portresi (Phase Portrait)";
|
||||||
this.lblFinalValue.Font = new Font("Segoe UI Semibold", 13F, FontStyle.Bold);
|
this.tabPhase.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
this.lblFinalValue.ForeColor = Color.FromArgb(52, 211, 153);
|
this.tabPhase.Padding = new Padding(4);
|
||||||
this.lblFinalValue.Text = "Y(t_son) = —";
|
|
||||||
|
|
||||||
this.lblFinalDetails.Dock = DockStyle.Bottom;
|
this.pnlPhaseHeader.Dock = DockStyle.Top;
|
||||||
this.lblFinalDetails.Height = 20;
|
this.pnlPhaseHeader.Height = 32;
|
||||||
this.lblFinalDetails.Font = new Font("Segoe UI", 9F);
|
this.pnlPhaseHeader.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
this.lblFinalDetails.ForeColor = ThemeHelper.MutedText;
|
|
||||||
this.lblFinalDetails.Text = "Sistem çözümü bekleniyor.";
|
|
||||||
|
|
||||||
this.pnlCardResult.Controls.Add(this.lblFinalDetails);
|
this.lblPhaseTitle.Text = "🌀 Faz Uzayı:";
|
||||||
this.pnlCardResult.Controls.Add(this.lblFinalValue);
|
this.lblPhaseTitle.Location = new Point(6, 6);
|
||||||
|
this.lblPhaseTitle.AutoSize = true;
|
||||||
|
this.lblPhaseTitle.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
|
||||||
|
this.lblAxisX.Text = "X:";
|
||||||
|
this.lblAxisX.Location = new Point(90, 6);
|
||||||
|
this.lblAxisX.AutoSize = true;
|
||||||
|
this.lblAxisX.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
|
this.cmbAxisX.Location = new Point(110, 4);
|
||||||
|
this.cmbAxisX.Size = new Size(55, 23);
|
||||||
|
this.cmbAxisX.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
this.cmbAxisX.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.cmbAxisX.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.lblAxisY.Text = "Y:";
|
||||||
|
this.lblAxisY.Location = new Point(175, 6);
|
||||||
|
this.lblAxisY.AutoSize = true;
|
||||||
|
this.lblAxisY.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
|
this.cmbAxisY.Location = new Point(195, 4);
|
||||||
|
this.cmbAxisY.Size = new Size(55, 23);
|
||||||
|
this.cmbAxisY.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
this.cmbAxisY.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.cmbAxisY.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.btnExportPhasePng.Text = "📷 PNG Kaydet";
|
||||||
|
this.btnExportPhasePng.Dock = DockStyle.Right;
|
||||||
|
this.btnExportPhasePng.Width = 100;
|
||||||
|
this.btnExportPhasePng.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnExportPhasePng.BackColor = Color.FromArgb(33, 44, 70);
|
||||||
|
this.btnExportPhasePng.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
|
this.btnExportPhasePng.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.btnExportPhasePng.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnExportPhasePng.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.pnlPhaseHeader.Controls.Add(this.lblPhaseTitle);
|
||||||
|
this.pnlPhaseHeader.Controls.Add(this.lblAxisX);
|
||||||
|
this.pnlPhaseHeader.Controls.Add(this.cmbAxisX);
|
||||||
|
this.pnlPhaseHeader.Controls.Add(this.lblAxisY);
|
||||||
|
this.pnlPhaseHeader.Controls.Add(this.cmbAxisY);
|
||||||
|
this.pnlPhaseHeader.Controls.Add(this.btnExportPhasePng);
|
||||||
|
|
||||||
|
this.pnlPhaseCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlPhaseCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlPhaseCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabPhase.Controls.Add(this.pnlPhaseCanvas);
|
||||||
|
this.tabPhase.Controls.Add(this.pnlPhaseHeader);
|
||||||
|
|
||||||
|
// Tab 2: Zaman Serisi
|
||||||
|
this.tabTimeSeries.Text = "Zaman Serisi (Time Series)";
|
||||||
|
this.tabTimeSeries.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
|
this.tabTimeSeries.Padding = new Padding(4);
|
||||||
|
|
||||||
|
this.pnlTimeHeader.Dock = DockStyle.Top;
|
||||||
|
this.pnlTimeHeader.Height = 32;
|
||||||
|
this.pnlTimeHeader.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
|
||||||
|
this.lblTimeTitle.Text = "⏱️ Zaman Boyutu (t vs y₁, y₂, ...)";
|
||||||
|
this.lblTimeTitle.Dock = DockStyle.Left;
|
||||||
|
this.lblTimeTitle.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblTimeTitle.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
this.lblTimeTitle.Padding = new Padding(8, 0, 0, 0);
|
||||||
|
|
||||||
|
this.btnExportTimePng.Text = "📷 PNG Kaydet";
|
||||||
|
this.btnExportTimePng.Dock = DockStyle.Right;
|
||||||
|
this.btnExportTimePng.Width = 100;
|
||||||
|
this.btnExportTimePng.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnExportTimePng.BackColor = Color.FromArgb(33, 44, 70);
|
||||||
|
this.btnExportTimePng.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
|
this.btnExportTimePng.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.btnExportTimePng.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnExportTimePng.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.pnlTimeHeader.Controls.Add(this.lblTimeTitle);
|
||||||
|
this.pnlTimeHeader.Controls.Add(this.btnExportTimePng);
|
||||||
|
|
||||||
|
this.pnlTimeCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlTimeCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlTimeCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabTimeSeries.Controls.Add(this.pnlTimeCanvas);
|
||||||
|
this.tabTimeSeries.Controls.Add(this.pnlTimeHeader);
|
||||||
|
|
||||||
|
// Tab 3: Table
|
||||||
|
this.tabTable.Text = "Sayısal Veri Tablosu";
|
||||||
|
this.tabTable.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabTable.Padding = new Padding(6);
|
||||||
|
|
||||||
|
this.pnlTableToolbar.Dock = DockStyle.Top;
|
||||||
|
this.pnlTableToolbar.Height = 32;
|
||||||
|
this.pnlTableToolbar.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
|
||||||
|
this.btnCopySystemTsv.Dock = DockStyle.Right;
|
||||||
|
this.btnCopySystemTsv.Height = 28;
|
||||||
|
this.pnlTableToolbar.Controls.Add(this.btnCopySystemTsv);
|
||||||
|
|
||||||
|
SetupGrid(this.dgvSystemSteps);
|
||||||
|
this.tabTable.Controls.Add(this.dgvSystemSteps);
|
||||||
|
this.tabTable.Controls.Add(this.pnlTableToolbar);
|
||||||
|
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabPhase);
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabTimeSeries);
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabTable);
|
||||||
|
|
||||||
|
// Right: Sidebar Panel
|
||||||
|
this.splitSystem.Panel2.Controls.Add(this.pnlRightSidebar);
|
||||||
|
this.pnlRightSidebar.Dock = DockStyle.Fill;
|
||||||
|
this.pnlRightSidebar.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
|
this.pnlRightSidebar.Padding = new Padding(6);
|
||||||
|
|
||||||
|
// Vector Result Card
|
||||||
|
this.pnlVectorCard.Dock = DockStyle.Top;
|
||||||
|
this.pnlVectorCard.Height = 90;
|
||||||
|
this.pnlVectorCard.BackColor = Color.FromArgb(18, 26, 44);
|
||||||
|
this.pnlVectorCard.Padding = new Padding(10);
|
||||||
|
|
||||||
|
this.lblVectorTitle.Text = "SONUÇ VEKTÖRÜ Y(t_son):";
|
||||||
|
this.lblVectorTitle.Dock = DockStyle.Top;
|
||||||
|
this.lblVectorTitle.Height = 18;
|
||||||
|
this.lblVectorTitle.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.lblVectorTitle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
|
||||||
|
this.lblVectorValue.Dock = DockStyle.Fill;
|
||||||
|
this.lblVectorValue.Font = new Font("Consolas", 11.5F, FontStyle.Bold);
|
||||||
|
this.lblVectorValue.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblVectorValue.Text = "Y = [ — ]";
|
||||||
|
|
||||||
|
this.pnlVectorCard.Controls.Add(this.lblVectorValue);
|
||||||
|
this.pnlVectorCard.Controls.Add(this.lblVectorTitle);
|
||||||
|
|
||||||
|
// Metrics Container
|
||||||
|
this.pnlSystemMetrics.Dock = DockStyle.Top;
|
||||||
|
this.pnlSystemMetrics.Height = 110;
|
||||||
|
this.pnlSystemMetrics.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.pnlSystemMetrics.Padding = new Padding(10);
|
||||||
|
|
||||||
|
this.lblSysMetricSteps.Text = "• Adım Sayısı (N) : —";
|
||||||
|
this.lblSysMetricSteps.Location = new Point(10, 10);
|
||||||
|
this.lblSysMetricSteps.AutoSize = true;
|
||||||
|
this.lblSysMetricSteps.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.lblSysMetricSteps.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
|
||||||
|
this.lblSysMetricH.Text = "• Adım Boyutu (h) : —";
|
||||||
|
this.lblSysMetricH.Location = new Point(10, 34);
|
||||||
|
this.lblSysMetricH.AutoSize = true;
|
||||||
|
this.lblSysMetricH.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.lblSysMetricH.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
|
||||||
|
this.lblSysMetricTime.Text = "• Süre : —";
|
||||||
|
this.lblSysMetricTime.Location = new Point(10, 58);
|
||||||
|
this.lblSysMetricTime.AutoSize = true;
|
||||||
|
this.lblSysMetricTime.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.lblSysMetricTime.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
|
||||||
|
this.lblSysMetricMethod.Text = "• Yöntem : —";
|
||||||
|
this.lblSysMetricMethod.Location = new Point(10, 82);
|
||||||
|
this.lblSysMetricMethod.AutoSize = true;
|
||||||
|
this.lblSysMetricMethod.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.lblSysMetricMethod.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
|
||||||
|
this.pnlSystemMetrics.Controls.Add(this.lblSysMetricSteps);
|
||||||
|
this.pnlSystemMetrics.Controls.Add(this.lblSysMetricH);
|
||||||
|
this.pnlSystemMetrics.Controls.Add(this.lblSysMetricTime);
|
||||||
|
this.pnlSystemMetrics.Controls.Add(this.lblSysMetricMethod);
|
||||||
|
|
||||||
// txtOutput
|
|
||||||
this.txtOutput.Dock = DockStyle.Fill;
|
this.txtOutput.Dock = DockStyle.Fill;
|
||||||
this.txtOutput.BackColor = Color.FromArgb(11, 17, 32);
|
this.txtOutput.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
this.txtOutput.Font = new Font("Consolas", 9F);
|
||||||
this.txtOutput.BorderStyle = BorderStyle.None;
|
this.txtOutput.BorderStyle = BorderStyle.None;
|
||||||
this.txtOutput.ReadOnly = true;
|
this.txtOutput.ReadOnly = true;
|
||||||
|
|
||||||
// Assemble OdeSystemSolverControl
|
this.pnlRightSidebar.Controls.Add(this.txtOutput);
|
||||||
|
this.pnlRightSidebar.Controls.Add(this.pnlSystemMetrics);
|
||||||
|
this.pnlRightSidebar.Controls.Add(this.pnlVectorCard);
|
||||||
|
|
||||||
|
// Assemble
|
||||||
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = AutoScaleMode.Font;
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.BackColor = ThemeHelper.DarkBackground;
|
this.BackColor = ThemeHelper.DarkBackground;
|
||||||
this.Controls.Add(this.txtOutput);
|
this.Controls.Add(this.splitSystem);
|
||||||
this.Controls.Add(this.pnlCardResult);
|
|
||||||
this.Controls.Add(this.pnlEquations);
|
|
||||||
this.Controls.Add(this.pnlControls);
|
this.Controls.Add(this.pnlControls);
|
||||||
this.Controls.Add(this.pnlHeader);
|
this.Controls.Add(this.pnlHeader);
|
||||||
this.Name = "OdeSystemSolverControl";
|
this.Name = "OdeSystemSolverControl";
|
||||||
this.Size = new Size(920, 680);
|
this.Size = new Size(950, 700);
|
||||||
|
|
||||||
this.pnlControls.ResumeLayout(false);
|
this.pnlControls.ResumeLayout(false);
|
||||||
this.pnlControls.PerformLayout();
|
this.pnlControls.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numEqCount)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numEqCount)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numSteps)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numSteps)).EndInit();
|
||||||
this.pnlCardResult.ResumeLayout(false);
|
this.splitSystem.Panel1.ResumeLayout(false);
|
||||||
|
this.splitSystem.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitSystem)).EndInit();
|
||||||
|
this.splitSystem.ResumeLayout(false);
|
||||||
|
this.tabSystemVisual.ResumeLayout(false);
|
||||||
|
this.tabPhase.ResumeLayout(false);
|
||||||
|
this.pnlPhaseHeader.ResumeLayout(false);
|
||||||
|
this.pnlPhaseHeader.PerformLayout();
|
||||||
|
this.tabTimeSeries.ResumeLayout(false);
|
||||||
|
this.pnlTimeHeader.ResumeLayout(false);
|
||||||
|
this.tabTable.ResumeLayout(false);
|
||||||
|
this.pnlTableToolbar.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvSystemSteps)).EndInit();
|
||||||
|
this.pnlRightSidebar.ResumeLayout(false);
|
||||||
|
this.pnlVectorCard.ResumeLayout(false);
|
||||||
|
this.pnlSystemMetrics.ResumeLayout(false);
|
||||||
|
this.pnlSystemMetrics.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupGrid(DataGridView dgv)
|
||||||
|
{
|
||||||
|
dgv.Dock = DockStyle.Fill;
|
||||||
|
dgv.BackgroundColor = Color.FromArgb(15, 23, 42);
|
||||||
|
dgv.BorderStyle = BorderStyle.None;
|
||||||
|
dgv.EnableHeadersVisualStyles = false;
|
||||||
|
dgv.AllowUserToAddRows = false;
|
||||||
|
dgv.AllowUserToDeleteRows = false;
|
||||||
|
dgv.AllowUserToResizeRows = false;
|
||||||
|
dgv.RowHeadersVisible = false;
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
dgv.ColumnHeadersHeight = 24;
|
||||||
|
dgv.DefaultCellStyle.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
|
dgv.DefaultCellStyle.ForeColor = Color.White;
|
||||||
|
dgv.DefaultCellStyle.Font = new Font("Consolas", 9.5F);
|
||||||
|
dgv.DefaultCellStyle.SelectionBackColor = Color.FromArgb(37, 99, 235);
|
||||||
|
dgv.DefaultCellStyle.SelectionForeColor = Color.White;
|
||||||
|
dgv.GridColor = Color.FromArgb(40, 50, 75);
|
||||||
|
dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dgv.ReadOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
private Panel pnlHeader;
|
private Panel pnlHeader;
|
||||||
private Panel pnlControls;
|
private Panel pnlControls;
|
||||||
private FlowLayoutPanel pnlPresets;
|
private FlowLayoutPanel pnlPresets;
|
||||||
|
|
@ -229,6 +487,7 @@ namespace MathApp.Controls
|
||||||
private Button btnEx2;
|
private Button btnEx2;
|
||||||
private Button btnEx3;
|
private Button btnEx3;
|
||||||
private Button btnEx4;
|
private Button btnEx4;
|
||||||
|
|
||||||
private Label lblEqCount;
|
private Label lblEqCount;
|
||||||
private NumericUpDown numEqCount;
|
private NumericUpDown numEqCount;
|
||||||
private Label lblMethod;
|
private Label lblMethod;
|
||||||
|
|
@ -240,11 +499,41 @@ namespace MathApp.Controls
|
||||||
private Label lblSteps;
|
private Label lblSteps;
|
||||||
private NumericUpDown numSteps;
|
private NumericUpDown numSteps;
|
||||||
private Button btnSolve;
|
private Button btnSolve;
|
||||||
private Button btnCopy;
|
|
||||||
private Panel pnlEquations;
|
private Panel pnlEquations;
|
||||||
private Panel pnlCardResult;
|
|
||||||
private Label lblFinalValue;
|
private SplitContainer splitSystem;
|
||||||
private Label lblFinalDetails;
|
private TabControl tabSystemVisual;
|
||||||
|
private TabPage tabPhase;
|
||||||
|
private Panel pnlPhaseHeader;
|
||||||
|
private Label lblPhaseTitle;
|
||||||
|
private Label lblAxisX;
|
||||||
|
private ComboBox cmbAxisX;
|
||||||
|
private Label lblAxisY;
|
||||||
|
private ComboBox cmbAxisY;
|
||||||
|
private Button btnExportPhasePng;
|
||||||
|
private Panel pnlPhaseCanvas;
|
||||||
|
|
||||||
|
private TabPage tabTimeSeries;
|
||||||
|
private Panel pnlTimeHeader;
|
||||||
|
private Label lblTimeTitle;
|
||||||
|
private Button btnExportTimePng;
|
||||||
|
private Panel pnlTimeCanvas;
|
||||||
|
|
||||||
|
private TabPage tabTable;
|
||||||
|
private Panel pnlTableToolbar;
|
||||||
|
private Button btnCopySystemTsv;
|
||||||
|
private DataGridView dgvSystemSteps;
|
||||||
|
|
||||||
|
private Panel pnlRightSidebar;
|
||||||
|
private Panel pnlVectorCard;
|
||||||
|
private Label lblVectorTitle;
|
||||||
|
private Label lblVectorValue;
|
||||||
|
private Panel pnlSystemMetrics;
|
||||||
|
private Label lblSysMetricSteps;
|
||||||
|
private Label lblSysMetricH;
|
||||||
|
private Label lblSysMetricTime;
|
||||||
|
private Label lblSysMetricMethod;
|
||||||
private RichTextBox txtOutput;
|
private RichTextBox txtOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -11,312 +13,723 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
public partial class OdeSystemSolverControl : UserControl
|
public partial class OdeSystemSolverControl : UserControl
|
||||||
{
|
{
|
||||||
private class EqRow
|
private List<TextBox> txtEqList = new List<TextBox>();
|
||||||
{
|
private List<TextBox> txtInitList = new List<TextBox>();
|
||||||
public Panel Container;
|
private List<DifferentialEquations.OdeSystemStepResult> _currentResults = new List<DifferentialEquations.OdeSystemStepResult>();
|
||||||
public Label LblDeriv;
|
private List<string> _currentVarNames = new List<string>();
|
||||||
public TextBox TxtEquation;
|
|
||||||
public Label LblInit;
|
|
||||||
public TextBox TxtInitVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly List<EqRow> _rows = new List<EqRow>();
|
private PointF? _phaseHoverPoint = null;
|
||||||
|
private (decimal X, decimal Y)? _phaseHoverData = null;
|
||||||
|
|
||||||
|
private static readonly Color[] ComponentColors = new Color[]
|
||||||
|
{
|
||||||
|
Color.FromArgb(56, 189, 248), // Sky Blue (y1)
|
||||||
|
Color.FromArgb(52, 211, 153), // Emerald (y2)
|
||||||
|
Color.FromArgb(251, 191, 36), // Amber (y3)
|
||||||
|
Color.FromArgb(168, 85, 247), // Purple (y4)
|
||||||
|
Color.FromArgb(244, 63, 94), // Rose (y5)
|
||||||
|
Color.FromArgb(6, 182, 212) // Cyan (y6)
|
||||||
|
};
|
||||||
|
|
||||||
public OdeSystemSolverControl()
|
public OdeSystemSolverControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SetupEvents();
|
|
||||||
BuildRows(2);
|
numEqCount.ValueChanged += (s, e) => RebuildEquationRows((int)numEqCount.Value);
|
||||||
SetPresetHarmonic();
|
btnSolve.Click += BtnSolve_Click;
|
||||||
|
btnCopySystemTsv.Click += (s, e) => CopyGridAsTsv();
|
||||||
|
|
||||||
|
btnExportPhasePng.Click += (s, e) => ExportCanvasAsPng(pnlPhaseCanvas, "Faz_Portresi.png", RenderPhasePortrait);
|
||||||
|
btnExportTimePng.Click += (s, e) => ExportCanvasAsPng(pnlTimeCanvas, "Zaman_Serisi.png", RenderTimeSeries);
|
||||||
|
|
||||||
|
btnEx1.Click += (s, e) => LoadPresetHarmonic();
|
||||||
|
btnEx2.Click += (s, e) => LoadPresetLotkaVolterra();
|
||||||
|
btnEx3.Click += (s, e) => LoadPresetLorenz();
|
||||||
|
btnEx4.Click += (s, e) => LoadPresetPendulum();
|
||||||
|
|
||||||
|
cmbAxisX.SelectedIndexChanged += (s, e) => pnlPhaseCanvas.Invalidate();
|
||||||
|
cmbAxisY.SelectedIndexChanged += (s, e) => pnlPhaseCanvas.Invalidate();
|
||||||
|
|
||||||
|
pnlPhaseCanvas.Paint += (s, e) => RenderPhasePortrait(e.Graphics, pnlPhaseCanvas.Width, pnlPhaseCanvas.Height);
|
||||||
|
pnlPhaseCanvas.MouseMove += PnlPhaseCanvas_MouseMove;
|
||||||
|
pnlPhaseCanvas.MouseLeave += (s, e) => { _phaseHoverPoint = null; _phaseHoverData = null; pnlPhaseCanvas.Invalidate(); };
|
||||||
|
pnlPhaseCanvas.Resize += (s, e) => pnlPhaseCanvas.Invalidate();
|
||||||
|
|
||||||
|
pnlTimeCanvas.Paint += (s, e) => RenderTimeSeries(e.Graphics, pnlTimeCanvas.Width, pnlTimeCanvas.Height);
|
||||||
|
pnlTimeCanvas.Resize += (s, e) => pnlTimeCanvas.Invalidate();
|
||||||
|
|
||||||
|
// Default setup
|
||||||
|
RebuildEquationRows(2);
|
||||||
|
LoadPresetHarmonic();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupEvents()
|
private void RebuildEquationRows(int count)
|
||||||
{
|
|
||||||
numEqCount.ValueChanged += (s, e) => BuildRows((int)numEqCount.Value);
|
|
||||||
btnSolve.Click += async (s, e) => await SolveAsync();
|
|
||||||
btnCopy.Click += (s, e) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(txtOutput.Text))
|
|
||||||
{
|
|
||||||
Clipboard.SetText(txtOutput.Text);
|
|
||||||
MessageBox.Show("Sonuç tablosu panoya kopyalandı.", "Kopyalandı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
btnEx1.Click += (s, e) => SetPresetHarmonic();
|
|
||||||
btnEx2.Click += (s, e) => SetPresetLotkaVolterra();
|
|
||||||
btnEx3.Click += (s, e) => SetPresetDampedPendulum();
|
|
||||||
btnEx4.Click += (s, e) => SetPresetLorenz();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BuildRows(int count)
|
|
||||||
{
|
{
|
||||||
pnlEquations.SuspendLayout();
|
pnlEquations.SuspendLayout();
|
||||||
pnlEquations.Controls.Clear();
|
pnlEquations.Controls.Clear();
|
||||||
_rows.Clear();
|
txtEqList.Clear();
|
||||||
|
txtInitList.Clear();
|
||||||
|
|
||||||
int yOffset = 4;
|
int rowH = 28;
|
||||||
for (int i = 1; i <= count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
Panel pnlRow = new Panel
|
int idx = i + 1;
|
||||||
{
|
int yPos = i * (rowH + 4);
|
||||||
Location = new Point(10, yOffset),
|
|
||||||
Size = new Size(860, 32),
|
|
||||||
BackColor = Color.Transparent
|
|
||||||
};
|
|
||||||
|
|
||||||
Label lblD = new Label
|
Label lblEq = new Label
|
||||||
{
|
{
|
||||||
Text = $"dy{i}/dt =",
|
Text = $"dy{idx}/dt =",
|
||||||
Location = new Point(0, 5),
|
Location = new Point(8, yPos + 4),
|
||||||
Size = new Size(70, 22),
|
Size = new Size(65, 20),
|
||||||
ForeColor = Color.FromArgb(147, 197, 253),
|
ForeColor = Color.FromArgb(56, 189, 248),
|
||||||
Font = new Font("Consolas", 10.5F, FontStyle.Bold),
|
Font = new Font("Consolas", 9.5F, FontStyle.Bold)
|
||||||
TextAlign = ContentAlignment.MiddleRight
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBox txtEq = new TextBox
|
TextBox txtEq = new TextBox
|
||||||
{
|
{
|
||||||
Location = new Point(78, 4),
|
Location = new Point(78, yPos + 1),
|
||||||
Size = new Size(380, 24),
|
Size = new Size(240, 24),
|
||||||
Font = new Font("Consolas", 10F),
|
BackColor = Color.FromArgb(24, 33, 52),
|
||||||
BackColor = ThemeHelper.CardBackground,
|
|
||||||
ForeColor = Color.White,
|
ForeColor = Color.White,
|
||||||
BorderStyle = BorderStyle.FixedSingle,
|
BorderStyle = BorderStyle.FixedSingle,
|
||||||
Text = i == 1 ? "y2" : "-y1"
|
Font = new Font("Consolas", 10F),
|
||||||
|
Text = idx == 1 ? "y2" : "-y1"
|
||||||
};
|
};
|
||||||
|
|
||||||
Label lblInit = new Label
|
Label lblInit = new Label
|
||||||
{
|
{
|
||||||
Text = $"y{i}(t₀) =",
|
Text = $"y{idx}(t₀) =",
|
||||||
Location = new Point(475, 5),
|
Location = new Point(330, yPos + 4),
|
||||||
Size = new Size(75, 22),
|
Size = new Size(65, 20),
|
||||||
ForeColor = ThemeHelper.LightText,
|
ForeColor = ThemeHelper.LightText,
|
||||||
Font = new Font("Consolas", 9.5F),
|
Font = new Font("Consolas", 9F)
|
||||||
TextAlign = ContentAlignment.MiddleRight
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBox txtInit = new TextBox
|
TextBox txtInit = new TextBox
|
||||||
{
|
{
|
||||||
Location = new Point(555, 4),
|
Location = new Point(400, yPos + 1),
|
||||||
Size = new Size(90, 24),
|
Size = new Size(70, 24),
|
||||||
Font = new Font("Consolas", 10F),
|
BackColor = Color.FromArgb(24, 33, 52),
|
||||||
BackColor = ThemeHelper.CardBackground,
|
|
||||||
ForeColor = Color.White,
|
ForeColor = Color.White,
|
||||||
BorderStyle = BorderStyle.FixedSingle,
|
BorderStyle = BorderStyle.FixedSingle,
|
||||||
Text = i == 1 ? "1" : "0"
|
Font = new Font("Consolas", 10F),
|
||||||
|
Text = idx == 1 ? "1" : "0",
|
||||||
|
TextAlign = HorizontalAlignment.Center
|
||||||
};
|
};
|
||||||
|
|
||||||
pnlRow.Controls.Add(lblD);
|
pnlEquations.Controls.Add(lblEq);
|
||||||
pnlRow.Controls.Add(txtEq);
|
pnlEquations.Controls.Add(txtEq);
|
||||||
pnlRow.Controls.Add(lblInit);
|
pnlEquations.Controls.Add(lblInit);
|
||||||
pnlRow.Controls.Add(txtInit);
|
pnlEquations.Controls.Add(txtInit);
|
||||||
|
|
||||||
pnlEquations.Controls.Add(pnlRow);
|
txtEqList.Add(txtEq);
|
||||||
_rows.Add(new EqRow
|
txtInitList.Add(txtInit);
|
||||||
|
}
|
||||||
|
pnlEquations.ResumeLayout();
|
||||||
|
|
||||||
|
UpdateAxisSelectors(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAxisSelectors(int count)
|
||||||
{
|
{
|
||||||
Container = pnlRow,
|
cmbAxisX.Items.Clear();
|
||||||
LblDeriv = lblD,
|
cmbAxisY.Items.Clear();
|
||||||
TxtEquation = txtEq,
|
for (int i = 1; i <= count; i++)
|
||||||
LblInit = lblInit,
|
{
|
||||||
TxtInitVal = txtInit
|
cmbAxisX.Items.Add("y" + i);
|
||||||
});
|
cmbAxisY.Items.Add("y" + i);
|
||||||
|
}
|
||||||
yOffset += 34;
|
if (cmbAxisX.Items.Count > 0) cmbAxisX.SelectedIndex = 0;
|
||||||
|
if (cmbAxisY.Items.Count > 1) cmbAxisY.SelectedIndex = 1;
|
||||||
|
else if (cmbAxisY.Items.Count > 0) cmbAxisY.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pnlEquations.Height = Math.Max(75, yOffset + 8);
|
private void LoadPresetHarmonic()
|
||||||
pnlEquations.ResumeLayout(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetHarmonic()
|
|
||||||
{
|
|
||||||
numEqCount.Value = 2;
|
|
||||||
txtT0.Text = "0";
|
|
||||||
txtTEnd.Text = "6.28318";
|
|
||||||
numSteps.Value = 100;
|
|
||||||
cmbMethod.SelectedIndex = 0; // RK4
|
|
||||||
|
|
||||||
if (_rows.Count >= 2)
|
|
||||||
{
|
|
||||||
_rows[0].TxtEquation.Text = "y2";
|
|
||||||
_rows[0].TxtInitVal.Text = "1";
|
|
||||||
_rows[1].TxtEquation.Text = "-y1";
|
|
||||||
_rows[1].TxtInitVal.Text = "0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetLotkaVolterra()
|
|
||||||
{
|
{
|
||||||
numEqCount.Value = 2;
|
numEqCount.Value = 2;
|
||||||
|
txtEqList[0].Text = "y2";
|
||||||
|
txtInitList[0].Text = "1";
|
||||||
|
txtEqList[1].Text = "-y1";
|
||||||
|
txtInitList[1].Text = "0";
|
||||||
txtT0.Text = "0";
|
txtT0.Text = "0";
|
||||||
txtTEnd.Text = "15";
|
txtTEnd.Text = "15";
|
||||||
numSteps.Value = 200;
|
numSteps.Value = 300;
|
||||||
cmbMethod.SelectedIndex = 0;
|
cmbMethod.SelectedIndex = 0;
|
||||||
|
BtnSolve_Click(this, EventArgs.Empty);
|
||||||
if (_rows.Count >= 2)
|
|
||||||
{
|
|
||||||
_rows[0].TxtEquation.Text = "0.667 * y1 - 1.333 * y1 * y2";
|
|
||||||
_rows[0].TxtInitVal.Text = "1";
|
|
||||||
_rows[1].TxtEquation.Text = "-1.0 * y2 + 1.0 * y1 * y2";
|
|
||||||
_rows[1].TxtInitVal.Text = "1";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPresetDampedPendulum()
|
private void LoadPresetLotkaVolterra()
|
||||||
{
|
{
|
||||||
numEqCount.Value = 2;
|
numEqCount.Value = 2;
|
||||||
|
txtEqList[0].Text = "1.5*y1 - y1*y2";
|
||||||
|
txtInitList[0].Text = "10";
|
||||||
|
txtEqList[1].Text = "-3*y2 + y1*y2";
|
||||||
|
txtInitList[1].Text = "5";
|
||||||
txtT0.Text = "0";
|
txtT0.Text = "0";
|
||||||
txtTEnd.Text = "20";
|
txtTEnd.Text = "15";
|
||||||
numSteps.Value = 200;
|
numSteps.Value = 600;
|
||||||
cmbMethod.SelectedIndex = 0;
|
cmbMethod.SelectedIndex = 0;
|
||||||
|
BtnSolve_Click(this, EventArgs.Empty);
|
||||||
if (_rows.Count >= 2)
|
|
||||||
{
|
|
||||||
_rows[0].TxtEquation.Text = "y2";
|
|
||||||
_rows[0].TxtInitVal.Text = "1.57";
|
|
||||||
_rows[1].TxtEquation.Text = "-0.25 * y2 - sin(y1)";
|
|
||||||
_rows[1].TxtInitVal.Text = "0";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPresetLorenz()
|
private void LoadPresetLorenz()
|
||||||
{
|
{
|
||||||
numEqCount.Value = 3;
|
numEqCount.Value = 3;
|
||||||
|
txtEqList[0].Text = "10*(y2 - y1)";
|
||||||
|
txtInitList[0].Text = "1";
|
||||||
|
txtEqList[1].Text = "y1*(28 - y3) - y2";
|
||||||
|
txtInitList[1].Text = "1";
|
||||||
|
txtEqList[2].Text = "y1*y2 - 2.6667*y3";
|
||||||
|
txtInitList[2].Text = "1";
|
||||||
txtT0.Text = "0";
|
txtT0.Text = "0";
|
||||||
txtTEnd.Text = "10";
|
txtTEnd.Text = "25";
|
||||||
|
numSteps.Value = 1500;
|
||||||
|
cmbMethod.SelectedIndex = 0;
|
||||||
|
BtnSolve_Click(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadPresetPendulum()
|
||||||
|
{
|
||||||
|
numEqCount.Value = 2;
|
||||||
|
txtEqList[0].Text = "y2";
|
||||||
|
txtInitList[0].Text = "3";
|
||||||
|
txtEqList[1].Text = "-sin(y1) - 0.2*y2";
|
||||||
|
txtInitList[1].Text = "0";
|
||||||
|
txtT0.Text = "0";
|
||||||
|
txtTEnd.Text = "25";
|
||||||
numSteps.Value = 500;
|
numSteps.Value = 500;
|
||||||
cmbMethod.SelectedIndex = 0;
|
cmbMethod.SelectedIndex = 0;
|
||||||
|
BtnSolve_Click(this, EventArgs.Empty);
|
||||||
if (_rows.Count >= 3)
|
|
||||||
{
|
|
||||||
_rows[0].TxtEquation.Text = "10 * (y2 - y1)";
|
|
||||||
_rows[0].TxtInitVal.Text = "1";
|
|
||||||
_rows[1].TxtEquation.Text = "y1 * (28 - y3) - y2";
|
|
||||||
_rows[1].TxtInitVal.Text = "1";
|
|
||||||
_rows[2].TxtEquation.Text = "y1 * y2 - (8/3) * y3";
|
|
||||||
_rows[2].TxtInitVal.Text = "1";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SolveAsync()
|
private decimal ParseDec(string s, string field)
|
||||||
{
|
{
|
||||||
|
string norm = (s ?? "").Trim().Replace(',', '.');
|
||||||
|
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal v))
|
||||||
|
return v;
|
||||||
|
throw new ArgumentException($"'{field}' için geçerli bir sayı giriniz.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void BtnSolve_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string origBtnText = btnSolve.Text;
|
||||||
|
btnSolve.Enabled = false;
|
||||||
|
btnSolve.Text = "⏳ Çözülüyor...";
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
btnSolve.Enabled = false;
|
int count = (int)numEqCount.Value;
|
||||||
btnSolve.Text = "⏳ Hesaplanıyor...";
|
List<string> equations = new List<string>();
|
||||||
|
List<string> varNames = new List<string>();
|
||||||
int n = _rows.Count;
|
|
||||||
List<string> eqList = new List<string>(n);
|
|
||||||
List<string> varNames = new List<string>(n);
|
|
||||||
Dictionary<string, decimal> inits = new Dictionary<string, decimal>();
|
Dictionary<string, decimal> inits = new Dictionary<string, decimal>();
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
string vName = $"y{i + 1}";
|
string v = "y" + (i + 1);
|
||||||
varNames.Add(vName);
|
varNames.Add(v);
|
||||||
|
string eq = txtEqList[i].Text.Trim();
|
||||||
string eqText = _rows[i].TxtEquation.Text.Trim();
|
if (string.IsNullOrWhiteSpace(eq))
|
||||||
if (string.IsNullOrWhiteSpace(eqText))
|
{
|
||||||
throw new ArgumentException($"{vName} türev denklemi boş bırakılamaz.");
|
txtOutput.Text = $"Lütfen d{v}/dt denklemini giriniz.";
|
||||||
eqList.Add(eqText);
|
return;
|
||||||
|
}
|
||||||
if (!decimal.TryParse(_rows[i].TxtInitVal.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal iv))
|
equations.Add(eq);
|
||||||
iv = 0m;
|
decimal iv = ParseDec(txtInitList[i].Text, $"{v}(t₀)");
|
||||||
inits[vName] = iv;
|
inits[v] = iv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!decimal.TryParse(txtT0.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal t0))
|
decimal t0 = ParseDec(txtT0.Text, "t₀");
|
||||||
t0 = 0m;
|
decimal tEnd = ParseDec(txtTEnd.Text, "t_son");
|
||||||
if (!decimal.TryParse(txtTEnd.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal tEnd))
|
|
||||||
tEnd = 10m;
|
|
||||||
|
|
||||||
int steps = (int)numSteps.Value;
|
int steps = (int)numSteps.Value;
|
||||||
string method = cmbMethod.SelectedItem?.ToString() ?? "RK4";
|
string method = cmbMethod.SelectedItem?.ToString() ?? "RK4";
|
||||||
|
|
||||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||||
var results = await Task.Run(() =>
|
var results = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
return DifferentialEquations.SolveOdeSystem(
|
bool prevRad = Function.UseRadians;
|
||||||
eqList,
|
Function.UseRadians = true;
|
||||||
varNames,
|
try
|
||||||
inits,
|
{
|
||||||
t0,
|
return DifferentialEquations.SolveOdeSystem(equations, varNames, inits, t0, tEnd, steps, method);
|
||||||
tEnd,
|
}
|
||||||
steps,
|
finally
|
||||||
method,
|
{
|
||||||
"t"
|
Function.UseRadians = prevRad;
|
||||||
);
|
}
|
||||||
});
|
});
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
|
|
||||||
if (results.Count == 0)
|
if (results != null && results.Count > 0)
|
||||||
{
|
{
|
||||||
lblFinalValue.Text = "Çözüm üretilemedi.";
|
_currentResults = results;
|
||||||
return;
|
_currentVarNames = varNames;
|
||||||
|
|
||||||
|
decimal stepH = (tEnd - t0) / steps;
|
||||||
|
var last = results[results.Count - 1];
|
||||||
|
|
||||||
|
// Format result vector
|
||||||
|
List<string> lastVals = new List<string>();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
string vn = varNames[i];
|
||||||
|
decimal val = last.YValues.ContainsKey(vn) ? last.YValues[vn] : 0m;
|
||||||
|
lastVals.Add($"{vn} = {Math.Round(val, 6).ToString(CultureInfo.InvariantCulture)}");
|
||||||
|
}
|
||||||
|
lblVectorValue.Text = "Y = [\n " + string.Join("\n ", lastVals) + "\n]";
|
||||||
|
|
||||||
|
lblSysMetricSteps.Text = $"• Adım Sayısı (N) : {steps}";
|
||||||
|
lblSysMetricH.Text = $"• Adım Boyutu (h) : {stepH.ToString("0.######", CultureInfo.InvariantCulture)}";
|
||||||
|
lblSysMetricTime.Text = $"• Çözüm Süresi : {sw.ElapsedMilliseconds} ms";
|
||||||
|
lblSysMetricMethod.Text = $"• Yöntem : {method}";
|
||||||
|
|
||||||
|
// Populate DataGridView
|
||||||
|
dgvSystemSteps.Columns.Clear();
|
||||||
|
dgvSystemSteps.Columns.Add("step", "Adım");
|
||||||
|
dgvSystemSteps.Columns.Add("t", "Zaman (t)");
|
||||||
|
dgvSystemSteps.Columns["step"].Width = 55;
|
||||||
|
dgvSystemSteps.Columns["t"].Width = 85;
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
dgvSystemSteps.Columns.Add(varNames[i], varNames[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var last = results.Last();
|
dgvSystemSteps.Rows.Clear();
|
||||||
StringBuilder sbFinal = new StringBuilder();
|
for (int step = 0; step < results.Count; step++)
|
||||||
sbFinal.Append($"Y({last.T:F4}) = [ ");
|
|
||||||
for (int i = 0; i < varNames.Count; i++)
|
|
||||||
{
|
{
|
||||||
string v = varNames[i];
|
var r = results[step];
|
||||||
decimal val = last.YValues.ContainsKey(v) ? last.YValues[v] : 0m;
|
object[] row = new object[2 + count];
|
||||||
sbFinal.Append($"{v}={val:F6}");
|
row[0] = step;
|
||||||
if (i < varNames.Count - 1) sbFinal.Append(", ");
|
row[1] = Math.Round(r.T, 4).ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
for (int i = 0; i < count; i++)
|
||||||
sbFinal.Append(" ]");
|
{
|
||||||
lblFinalValue.Text = sbFinal.ToString();
|
string vn = varNames[i];
|
||||||
|
decimal v = r.YValues.ContainsKey(vn) ? r.YValues[vn] : 0m;
|
||||||
decimal dt = (tEnd - t0) / steps;
|
row[2 + i] = Math.Round(v, 6).ToString(CultureInfo.InvariantCulture);
|
||||||
lblFinalDetails.Text = $"Yöntem: {method} | Adım Aralığı (h): {dt:F6} | Toplam Nokta: {results.Count} | ⏱️ {sw.ElapsedMilliseconds} ms";
|
|
||||||
|
|
||||||
// Build Table
|
|
||||||
StringBuilder sbOut = new StringBuilder();
|
|
||||||
sbOut.AppendLine("==========================================================================================");
|
|
||||||
sbOut.AppendLine($"DİFERANSİYEL DENKLEM SİSTEMİ NÜMERİK ÇÖZÜM TABLOSU ({method})");
|
|
||||||
sbOut.AppendLine($"Aralık: [{t0}, {tEnd}], Adım Sayısı (N): {steps}, Adım Büyüklüğü (h): {dt:F6}");
|
|
||||||
sbOut.AppendLine("==========================================================================================");
|
|
||||||
|
|
||||||
// Header
|
|
||||||
sbOut.Append(string.Format("{0,-8} | {1,-12}", "Adım", "t"));
|
|
||||||
foreach (var v in varNames)
|
|
||||||
{
|
|
||||||
sbOut.Append(string.Format(" | {0,-14}", v));
|
|
||||||
}
|
|
||||||
sbOut.AppendLine();
|
|
||||||
sbOut.AppendLine(new string('-', 24 + varNames.Count * 17));
|
|
||||||
|
|
||||||
int printInterval = Math.Max(1, results.Count / 100);
|
|
||||||
for (int i = 0; i < results.Count; i++)
|
|
||||||
{
|
|
||||||
if (i % printInterval == 0 || i == results.Count - 1)
|
|
||||||
{
|
|
||||||
var row = results[i];
|
|
||||||
sbOut.Append(string.Format("{0,-8} | {1,-12:F6}", i, row.T));
|
|
||||||
foreach (var v in varNames)
|
|
||||||
{
|
|
||||||
decimal val = row.YValues.ContainsKey(v) ? row.YValues[v] : 0m;
|
|
||||||
sbOut.Append(string.Format(" | {0,-14:F8}", val));
|
|
||||||
}
|
|
||||||
sbOut.AppendLine();
|
|
||||||
}
|
}
|
||||||
|
dgvSystemSteps.Rows.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
sbOut.AppendLine("==========================================================================================");
|
// Report text
|
||||||
txtOutput.Text = sbOut.ToString();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=== DİFERANSİYEL SİSTEM NÜMERİK ÇÖZÜM RAPORU ===");
|
||||||
|
sb.AppendLine($" Denklem Sayısı : {count}");
|
||||||
|
sb.AppendLine($" Zaman Aralığı : [{t0}, {tEnd}] (N = {steps}, h = {stepH.ToString("0.######", CultureInfo.InvariantCulture)})");
|
||||||
|
sb.AppendLine($" Yöntem : {method}");
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
sb.AppendLine($" d{varNames[i]}/dt = {equations[i]} [{varNames[i]}(t₀) = {inits[varNames[i]]}]");
|
||||||
|
}
|
||||||
|
sb.AppendLine(new string('=', 65));
|
||||||
|
sb.AppendLine("SON ÇÖZÜM VEKTÖRÜ Y(t_son):");
|
||||||
|
foreach (var lv in lastVals) sb.AppendLine(" • " + lv);
|
||||||
|
|
||||||
|
txtOutput.Text = sb.ToString();
|
||||||
|
|
||||||
|
pnlPhaseCanvas.Invalidate();
|
||||||
|
pnlTimeCanvas.Invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"Çözüm sırasında hata oluştu:\n{ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
txtOutput.Text = "❌ Hata: " + ex.Message;
|
||||||
lblFinalValue.Text = "Hata oluştu!";
|
lblVectorValue.Text = "Hata Oluştu: " + ex.Message;
|
||||||
lblFinalDetails.Text = ex.Message;
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
btnSolve.Enabled = true;
|
btnSolve.Enabled = true;
|
||||||
btnSolve.Text = "🚀 Sistemi Çöz";
|
btnSolve.Text = origBtnText;
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RenderPhasePortrait(Graphics g, int w, int h)
|
||||||
|
{
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2 || _currentVarNames.Count < 1)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("Sistem çözüldüğünde 2B Faz Uzayı Portresi (Phase Portrait) burada çizilir.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string xVar = cmbAxisX.SelectedItem?.ToString() ?? "y1";
|
||||||
|
string yVar = cmbAxisY.SelectedItem?.ToString() ?? (_currentVarNames.Count > 1 ? "y2" : "y1");
|
||||||
|
|
||||||
|
decimal minX = decimal.MaxValue, maxX = decimal.MinValue;
|
||||||
|
decimal minY = decimal.MaxValue, maxY = decimal.MinValue;
|
||||||
|
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
decimal vx = r.YValues.ContainsKey(xVar) ? r.YValues[xVar] : 0m;
|
||||||
|
decimal vy = r.YValues.ContainsKey(yVar) ? r.YValues[yVar] : 0m;
|
||||||
|
if (vx < minX) minX = vx;
|
||||||
|
if (vx > maxX) maxX = vx;
|
||||||
|
if (vy < minY) minY = vy;
|
||||||
|
if (vy > maxY) maxY = vy;
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal spanX = maxX - minX;
|
||||||
|
if (spanX == 0m) spanX = 1m;
|
||||||
|
decimal spanY = maxY - minY;
|
||||||
|
if (spanY == 0m) spanY = 1m;
|
||||||
|
minX -= spanX * 0.08m;
|
||||||
|
maxX += spanX * 0.08m;
|
||||||
|
minY -= spanY * 0.08m;
|
||||||
|
maxY += spanY * 0.08m;
|
||||||
|
|
||||||
|
int padL = 48, padB = 30, padT = 20, padR = 20;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
float ToScreenX(decimal x) => padL + (float)((x - minX) / (maxX - minX) * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal y) => padT + (float)((maxY - y) / (maxY - minY) * (decimal)plotH);
|
||||||
|
|
||||||
|
// Draw grid lines
|
||||||
|
using (Pen gridPen = new Pen(Color.FromArgb(24, 33, 52), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(100, 116, 139)))
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
decimal gx = minX + (spanX * i / 5m);
|
||||||
|
float sx = ToScreenX(gx);
|
||||||
|
g.DrawLine(gridPen, sx, padT, sx, h - padB);
|
||||||
|
g.DrawString(Math.Round(gx, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 10, h - padB + 4);
|
||||||
|
|
||||||
|
decimal gy = minY + (spanY * i / 5m);
|
||||||
|
float sy = ToScreenY(gy);
|
||||||
|
g.DrawLine(gridPen, padL, sy, w - padR, sy);
|
||||||
|
g.DrawString(Math.Round(gy, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Axis box
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw Phase Trajectory with Directional Arrows
|
||||||
|
List<PointF> pts = new List<PointF>(_currentResults.Count);
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
decimal vx = r.YValues.ContainsKey(xVar) ? r.YValues[xVar] : 0m;
|
||||||
|
decimal vy = r.YValues.ContainsKey(yVar) ? r.YValues[yVar] : 0m;
|
||||||
|
pts.Add(new PointF(ToScreenX(vx), ToScreenY(vy)));
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Pen trajPen = new Pen(Color.FromArgb(56, 189, 248), 2f))
|
||||||
|
{
|
||||||
|
trajPen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < pts.Count - 1; i++)
|
||||||
|
{
|
||||||
|
g.DrawLine(trajPen, pts[i], pts[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw motion direction arrows every N steps
|
||||||
|
int arrowInterval = Math.Max(15, pts.Count / 12);
|
||||||
|
using (Pen arrowPen = new Pen(Color.FromArgb(52, 211, 153), 1.8f))
|
||||||
|
{
|
||||||
|
arrowPen.CustomEndCap = new AdjustableArrowCap(3.5f, 5f);
|
||||||
|
for (int i = arrowInterval; i < pts.Count - 2; i += arrowInterval)
|
||||||
|
{
|
||||||
|
PointF p1 = pts[i];
|
||||||
|
PointF p2 = pts[i + 1];
|
||||||
|
float dx = p2.X - p1.X;
|
||||||
|
float dy = p2.Y - p1.Y;
|
||||||
|
if (Math.Abs(dx) > 1 || Math.Abs(dy) > 1)
|
||||||
|
{
|
||||||
|
g.DrawLine(arrowPen, p1.X, p1.Y, p1.X + dx * 1.5f, p1.Y + dy * 1.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlight start point (Amber) & end point (Emerald)
|
||||||
|
PointF pStart = pts[0];
|
||||||
|
using (Brush bStart = new SolidBrush(Color.FromArgb(245, 158, 11)))
|
||||||
|
{
|
||||||
|
g.FillEllipse(bStart, pStart.X - 4f, pStart.Y - 4f, 8f, 8f);
|
||||||
|
}
|
||||||
|
|
||||||
|
PointF pEnd = pts[pts.Count - 1];
|
||||||
|
using (Brush bEnd = new SolidBrush(Color.FromArgb(52, 211, 153)))
|
||||||
|
{
|
||||||
|
g.FillEllipse(bEnd, pEnd.X - 5f, pEnd.Y - 5f, 10f, 10f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hover tooltip
|
||||||
|
if (_phaseHoverPoint.HasValue && _phaseHoverData.HasValue)
|
||||||
|
{
|
||||||
|
PointF hp = _phaseHoverPoint.Value;
|
||||||
|
using (Pen crossPen = new Pen(Color.FromArgb(52, 211, 153), 1f) { DashStyle = DashStyle.Dot })
|
||||||
|
{
|
||||||
|
g.DrawLine(crossPen, hp.X, padT, hp.X, h - padB);
|
||||||
|
g.DrawLine(crossPen, padL, hp.Y, w - padR, hp.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
string tip = $"{xVar} = {Math.Round(_phaseHoverData.Value.X, 4)}\n{yVar} = {Math.Round(_phaseHoverData.Value.Y, 4)}";
|
||||||
|
using (Font tipFont = new Font("Consolas", 8.5F, FontStyle.Bold))
|
||||||
|
{
|
||||||
|
SizeF sz = g.MeasureString(tip, tipFont);
|
||||||
|
float tx = hp.X + 10;
|
||||||
|
float ty = hp.Y - sz.Height - 6;
|
||||||
|
if (tx + sz.Width + 8 > w) tx = hp.X - sz.Width - 14;
|
||||||
|
if (ty < padT) ty = hp.Y + 12;
|
||||||
|
|
||||||
|
RectangleF tr = new RectangleF(tx, ty, sz.Width + 8, sz.Height + 6);
|
||||||
|
using (Brush bg = new SolidBrush(Color.FromArgb(240, 24, 33, 52)))
|
||||||
|
using (Pen bp = new Pen(Color.FromArgb(52, 211, 153), 1.2f))
|
||||||
|
using (Brush txtB = new SolidBrush(Color.White))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bg, tr);
|
||||||
|
g.DrawRectangle(bp, tr.X, tr.Y, tr.Width, tr.Height);
|
||||||
|
g.DrawString(tip, tipFont, txtB, tx + 4, ty + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Axis labels
|
||||||
|
using (Font titleF = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold))
|
||||||
|
using (Brush txtB = new SolidBrush(Color.FromArgb(186, 230, 253)))
|
||||||
|
{
|
||||||
|
g.DrawString($"Yörünge: {yVar} vs {xVar}", titleF, txtB, padL + 8, padT + 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlPhaseCanvas_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2 || _currentVarNames.Count < 1) return;
|
||||||
|
|
||||||
|
string xVar = cmbAxisX.SelectedItem?.ToString() ?? "y1";
|
||||||
|
string yVar = cmbAxisY.SelectedItem?.ToString() ?? (_currentVarNames.Count > 1 ? "y2" : "y1");
|
||||||
|
|
||||||
|
int w = pnlPhaseCanvas.Width;
|
||||||
|
int h = pnlPhaseCanvas.Height;
|
||||||
|
int padL = 48, padB = 30, padT = 20, padR = 20;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
decimal minX = decimal.MaxValue, maxX = decimal.MinValue;
|
||||||
|
decimal minY = decimal.MaxValue, maxY = decimal.MinValue;
|
||||||
|
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
decimal vx = r.YValues.ContainsKey(xVar) ? r.YValues[xVar] : 0m;
|
||||||
|
decimal vy = r.YValues.ContainsKey(yVar) ? r.YValues[yVar] : 0m;
|
||||||
|
if (vx < minX) minX = vx;
|
||||||
|
if (vx > maxX) maxX = vx;
|
||||||
|
if (vy < minY) minY = vy;
|
||||||
|
if (vy > maxY) maxY = vy;
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal spanX = maxX - minX;
|
||||||
|
if (spanX == 0m) spanX = 1m;
|
||||||
|
decimal spanY = maxY - minY;
|
||||||
|
if (spanY == 0m) spanY = 1m;
|
||||||
|
minX -= spanX * 0.08m;
|
||||||
|
maxX += spanX * 0.08m;
|
||||||
|
minY -= spanY * 0.08m;
|
||||||
|
maxY += spanY * 0.08m;
|
||||||
|
|
||||||
|
float ToScreenX(decimal x) => padL + (float)((x - minX) / (maxX - minX) * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal y) => padT + (float)((maxY - y) / (maxY - minY) * (decimal)plotH);
|
||||||
|
|
||||||
|
float closestDist = float.MaxValue;
|
||||||
|
PointF closestScreen = PointF.Empty;
|
||||||
|
(decimal X, decimal Y)? closestData = null;
|
||||||
|
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
decimal vx = r.YValues.ContainsKey(xVar) ? r.YValues[xVar] : 0m;
|
||||||
|
decimal vy = r.YValues.ContainsKey(yVar) ? r.YValues[yVar] : 0m;
|
||||||
|
PointF sp = new PointF(ToScreenX(vx), ToScreenY(vy));
|
||||||
|
float dx = sp.X - e.X;
|
||||||
|
float dy = sp.Y - e.Y;
|
||||||
|
float d = (float)Math.Sqrt(dx * dx + dy * dy);
|
||||||
|
if (d < closestDist)
|
||||||
|
{
|
||||||
|
closestDist = d;
|
||||||
|
closestScreen = sp;
|
||||||
|
closestData = (vx, vy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closestData != null && closestDist < 50f)
|
||||||
|
{
|
||||||
|
_phaseHoverPoint = closestScreen;
|
||||||
|
_phaseHoverData = closestData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_phaseHoverPoint = null;
|
||||||
|
_phaseHoverData = null;
|
||||||
|
}
|
||||||
|
pnlPhaseCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RenderTimeSeries(Graphics g, int w, int h)
|
||||||
|
{
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2 || _currentVarNames.Count < 1)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("Sistem çözüldüğünde zaman serisi (t vs y₁, y₂, ...) grafiği burada çizilir.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal minT = _currentResults[0].T;
|
||||||
|
decimal maxT = _currentResults[_currentResults.Count - 1].T;
|
||||||
|
decimal minY = decimal.MaxValue, maxY = decimal.MinValue;
|
||||||
|
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
foreach (var vn in _currentVarNames)
|
||||||
|
{
|
||||||
|
if (r.YValues.ContainsKey(vn))
|
||||||
|
{
|
||||||
|
decimal val = r.YValues[vn];
|
||||||
|
if (val < minY) minY = val;
|
||||||
|
if (val > maxY) maxY = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal spanT = maxT - minT;
|
||||||
|
if (spanT == 0m) spanT = 1m;
|
||||||
|
decimal spanY = maxY - minY;
|
||||||
|
if (spanY == 0m) spanY = 1m;
|
||||||
|
minY -= spanY * 0.08m;
|
||||||
|
maxY += spanY * 0.08m;
|
||||||
|
|
||||||
|
int padL = 48, padB = 30, padT = 32, padR = 20;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
float ToScreenX(decimal t) => padL + (float)((t - minT) / (spanT) * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal y) => padT + (float)((maxY - y) / (maxY - minY) * (decimal)plotH);
|
||||||
|
|
||||||
|
// Grid lines
|
||||||
|
using (Pen gridPen = new Pen(Color.FromArgb(24, 33, 52), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(100, 116, 139)))
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
decimal gt = minT + (spanT * i / 5m);
|
||||||
|
float sx = ToScreenX(gt);
|
||||||
|
g.DrawLine(gridPen, sx, padT, sx, h - padB);
|
||||||
|
g.DrawString(Math.Round(gt, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 10, h - padB + 4);
|
||||||
|
|
||||||
|
decimal gy = minY + (spanY * i / 5m);
|
||||||
|
float sy = ToScreenY(gy);
|
||||||
|
g.DrawLine(gridPen, padL, sy, w - padR, sy);
|
||||||
|
g.DrawString(Math.Round(gy, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Box
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw each component curve
|
||||||
|
for (int vIdx = 0; vIdx < _currentVarNames.Count; vIdx++)
|
||||||
|
{
|
||||||
|
string vn = _currentVarNames[vIdx];
|
||||||
|
Color c = ComponentColors[vIdx % ComponentColors.Length];
|
||||||
|
|
||||||
|
List<PointF> linePts = new List<PointF>(_currentResults.Count);
|
||||||
|
foreach (var r in _currentResults)
|
||||||
|
{
|
||||||
|
decimal val = r.YValues.ContainsKey(vn) ? r.YValues[vn] : 0m;
|
||||||
|
linePts.Add(new PointF(ToScreenX(r.T), ToScreenY(val)));
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Pen curvePen = new Pen(c, 2.2f))
|
||||||
|
{
|
||||||
|
curvePen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < linePts.Count - 1; i++)
|
||||||
|
{
|
||||||
|
g.DrawLine(curvePen, linePts[i], linePts[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Top Legend
|
||||||
|
float legX = padL + 8;
|
||||||
|
using (Font legFont = new Font("Segoe UI Semibold", 8F, FontStyle.Bold))
|
||||||
|
{
|
||||||
|
for (int vIdx = 0; vIdx < _currentVarNames.Count; vIdx++)
|
||||||
|
{
|
||||||
|
string vn = _currentVarNames[vIdx];
|
||||||
|
Color c = ComponentColors[vIdx % ComponentColors.Length];
|
||||||
|
using (Brush cb = new SolidBrush(c))
|
||||||
|
{
|
||||||
|
g.FillEllipse(cb, legX, 10, 8, 8);
|
||||||
|
g.DrawString(vn + "(t)", legFont, cb, legX + 12, 7);
|
||||||
|
}
|
||||||
|
legX += 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyGridAsTsv()
|
||||||
|
{
|
||||||
|
if (dgvSystemSteps.Rows.Count == 0) return;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
List<string> headers = new List<string>();
|
||||||
|
foreach (DataGridViewColumn col in dgvSystemSteps.Columns) headers.Add(col.HeaderText);
|
||||||
|
sb.AppendLine(string.Join("\t", headers));
|
||||||
|
|
||||||
|
foreach (DataGridViewRow r in dgvSystemSteps.Rows)
|
||||||
|
{
|
||||||
|
List<string> vals = new List<string>();
|
||||||
|
for (int i = 0; i < dgvSystemSteps.Columns.Count; i++) vals.Add(r.Cells[i].Value?.ToString() ?? "");
|
||||||
|
sb.AppendLine(string.Join("\t", vals));
|
||||||
|
}
|
||||||
|
Clipboard.SetText(sb.ToString());
|
||||||
|
MessageBox.Show("Veri tablosu panoya (TSV formatında) kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExportCanvasAsPng(Panel canvas, string defName, Action<Graphics, int, int> renderFn)
|
||||||
|
{
|
||||||
|
if (_currentResults == null || _currentResults.Count < 2)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Önce diferansiyel sistemini çözünüz.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
sfd.Filter = "PNG Resmi (*.png)|*.png";
|
||||||
|
sfd.FileName = defName;
|
||||||
|
if (sfd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
using (Bitmap bmp = new Bitmap(1200, 800))
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
renderFn(g, 1200, 800);
|
||||||
|
bmp.Save(sfd.FileName, ImageFormat.Png);
|
||||||
|
}
|
||||||
|
MessageBox.Show("Grafik yüksek çözünürlükte (1200x800) başarıyla kaydedildi!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
462
src/ttCalculator/Controls/PdeSolverControl.Designer.cs
generated
462
src/ttCalculator/Controls/PdeSolverControl.Designer.cs
generated
|
|
@ -17,8 +17,8 @@ namespace MathApp.Controls
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
||||||
"Kısmi Diferansiyel Denklem Çözücü (1D PDE Solver)",
|
"Kısmi Diferansiyel Denklem Çözücü (1D PDE Solver / Isı Haritası & Animasyon)",
|
||||||
"1 Boyutlu Isı (FTCS), Dalga (Leapfrog) ve Taşınım (Upwind) denklemlerini sonlu farklar yöntemi ile çözer.");
|
"1 Boyutlu Isı (FTCS / Crank-Nicolson), Dalga (Leapfrog) ve Taşınım (Upwind) denklemlerini sonlu farklar ile çözer; 2B Mekan-Zaman Isı Haritası ve canlı dalga animasyonu sunar.");
|
||||||
|
|
||||||
this.pnlControls = new Panel();
|
this.pnlControls = new Panel();
|
||||||
this.pnlPresets = new FlowLayoutPanel();
|
this.pnlPresets = new FlowLayoutPanel();
|
||||||
|
|
@ -56,178 +56,231 @@ namespace MathApp.Controls
|
||||||
this.txtBcLeft = new TextBox();
|
this.txtBcLeft = new TextBox();
|
||||||
this.txtBcRight = new TextBox();
|
this.txtBcRight = new TextBox();
|
||||||
|
|
||||||
this.btnSolve = ThemeHelper.CreateActionButton("🚀 PDE'yi Çöz", 140, 32, true);
|
this.btnSolve = ThemeHelper.CreateActionButton("🚀 PDE'yi Çöz & Simüle Et", 200, 32, true);
|
||||||
this.btnCopy = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala");
|
|
||||||
|
|
||||||
this.pnlCardResult = new Panel();
|
// Live CFL Stability Indicator Bar
|
||||||
this.lblStability = new Label();
|
this.pnlCflBar = new Panel();
|
||||||
this.lblDetails = new Label();
|
this.lblCflIcon = new Label();
|
||||||
|
this.lblCflText = new Label();
|
||||||
|
|
||||||
|
// TabControl for Visualizations
|
||||||
|
this.tabPdeVisual = new TabControl();
|
||||||
|
this.tabHeatmap = new TabPage();
|
||||||
|
this.pnlHeatmapHeader = new Panel();
|
||||||
|
this.lblHeatmapTitle = new Label();
|
||||||
|
this.lblColorbarLegend = new Label();
|
||||||
|
this.btnExportHeatmapPng = new Button();
|
||||||
|
this.pnlHeatmapCanvas = new Panel();
|
||||||
|
|
||||||
|
this.tabAnimation = new TabPage();
|
||||||
|
this.pnlAnimToolbar = new Panel();
|
||||||
|
this.btnPlayPause = new Button();
|
||||||
|
this.lblCurrentTime = new Label();
|
||||||
|
this.trkTimeStep = new TrackBar();
|
||||||
|
this.lblAnimSpeed = new Label();
|
||||||
|
this.cmbAnimSpeed = new ComboBox();
|
||||||
|
this.pnlAnimCanvas = new Panel();
|
||||||
|
|
||||||
|
this.tabSnapshots = new TabPage();
|
||||||
|
this.pnlSnapToolbar = new Panel();
|
||||||
|
this.btnCopyPdeTsv = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala (TSV)");
|
||||||
|
this.dgvSnapshots = new DataGridView();
|
||||||
|
|
||||||
|
this.tabTextReport = new TabPage();
|
||||||
this.txtOutput = new RichTextBox();
|
this.txtOutput = new RichTextBox();
|
||||||
|
|
||||||
this.pnlControls.SuspendLayout();
|
this.pnlControls.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNx)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNx)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNt)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNt)).BeginInit();
|
||||||
this.pnlCardResult.SuspendLayout();
|
this.pnlCflBar.SuspendLayout();
|
||||||
|
this.tabPdeVisual.SuspendLayout();
|
||||||
|
this.tabHeatmap.SuspendLayout();
|
||||||
|
this.pnlHeatmapHeader.SuspendLayout();
|
||||||
|
this.tabAnimation.SuspendLayout();
|
||||||
|
this.pnlAnimToolbar.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trkTimeStep)).BeginInit();
|
||||||
|
this.tabSnapshots.SuspendLayout();
|
||||||
|
this.pnlSnapToolbar.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvSnapshots)).BeginInit();
|
||||||
|
this.tabTextReport.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
|
||||||
// pnlControls
|
// pnlControls
|
||||||
this.pnlControls.Dock = DockStyle.Top;
|
this.pnlControls.Dock = DockStyle.Top;
|
||||||
this.pnlControls.Height = 168;
|
this.pnlControls.Height = 158;
|
||||||
this.pnlControls.BackColor = ThemeHelper.DarkBackground;
|
this.pnlControls.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
this.pnlControls.Padding = new Padding(24, 8, 24, 8);
|
this.pnlControls.Padding = new Padding(20, 6, 20, 6);
|
||||||
|
|
||||||
this.lblPresets.Text = "Örnek Senaryolar:";
|
this.lblPresets.Text = "⚡ Senaryolar:";
|
||||||
this.lblPresets.AutoSize = true;
|
this.lblPresets.AutoSize = true;
|
||||||
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
||||||
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
||||||
|
|
||||||
this.pnlPresets.Location = new Point(24, 8);
|
this.pnlPresets.Location = new Point(20, 6);
|
||||||
this.pnlPresets.Size = new Size(880, 32);
|
this.pnlPresets.Size = new Size(900, 32);
|
||||||
this.pnlPresets.Controls.Add(this.lblPresets);
|
this.pnlPresets.Controls.Add(this.lblPresets);
|
||||||
this.pnlPresets.Controls.Add(this.btnExHeat);
|
this.pnlPresets.Controls.Add(this.btnExHeat);
|
||||||
this.pnlPresets.Controls.Add(this.btnExWave);
|
this.pnlPresets.Controls.Add(this.btnExWave);
|
||||||
this.pnlPresets.Controls.Add(this.btnExAdvect);
|
this.pnlPresets.Controls.Add(this.btnExAdvect);
|
||||||
this.pnlPresets.Controls.Add(this.btnExGauss);
|
this.pnlPresets.Controls.Add(this.btnExGauss);
|
||||||
|
|
||||||
int y1 = 46;
|
int yRow1 = 42;
|
||||||
this.lblPdeType.Text = "PDE Türü:";
|
this.lblPdeType.Text = "PDE Tipi:";
|
||||||
this.lblPdeType.Location = new Point(24, y1 + 4);
|
this.lblPdeType.Location = new Point(20, yRow1 + 3);
|
||||||
this.lblPdeType.AutoSize = true;
|
this.lblPdeType.AutoSize = true;
|
||||||
this.lblPdeType.ForeColor = ThemeHelper.LightText;
|
this.lblPdeType.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblPdeType.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
|
||||||
this.cmbPdeType.Location = new Point(90, y1);
|
this.cmbPdeType.Location = new Point(85, yRow1);
|
||||||
this.cmbPdeType.Size = new Size(240, 25);
|
this.cmbPdeType.Size = new Size(230, 24);
|
||||||
this.cmbPdeType.DropDownStyle = ComboBoxStyle.DropDownList;
|
this.cmbPdeType.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
this.cmbPdeType.BackColor = ThemeHelper.CardBackground;
|
this.cmbPdeType.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.cmbPdeType.ForeColor = Color.White;
|
this.cmbPdeType.ForeColor = Color.White;
|
||||||
this.cmbPdeType.Font = new Font("Segoe UI", 9.5F);
|
this.cmbPdeType.Font = new Font("Segoe UI", 9F);
|
||||||
this.cmbPdeType.Items.AddRange(new object[] {
|
this.cmbPdeType.Items.AddRange(new object[] {
|
||||||
"Isı Denklemi [FTCS Açık - u_t = α·u_xx]",
|
"Isı Denklemi (FTCS Açık Şema)",
|
||||||
"Isı Denklemi [Crank-Nicolson Koşulsuz Kararlı]",
|
"Isı Denklemi (Crank-Nicolson)",
|
||||||
"Dalga Denklemi [Leapfrog - u_tt = c²·u_xx]",
|
"Dalga Denklemi (Leapfrog)",
|
||||||
"Taşınım Denklemi [Upwind - u_t + v·u_x = 0]",
|
"Taşınım Denklemi (Upwind)"
|
||||||
"2B Laplace Denklemi [SOR - ∇²u = 0]"
|
|
||||||
});
|
});
|
||||||
this.cmbPdeType.SelectedIndex = 0;
|
this.cmbPdeType.SelectedIndex = 0;
|
||||||
|
|
||||||
this.lblInitU.Text = "u(x, 0) =";
|
this.lblInitU.Text = "u(x, 0):";
|
||||||
this.lblInitU.Location = new Point(345, y1 + 4);
|
this.lblInitU.Location = new Point(325, yRow1 + 3);
|
||||||
this.lblInitU.AutoSize = true;
|
this.lblInitU.AutoSize = true;
|
||||||
this.lblInitU.ForeColor = ThemeHelper.LightText;
|
this.lblInitU.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtInitU.Location = new Point(410, y1);
|
this.txtInitU.Location = new Point(375, yRow1);
|
||||||
this.txtInitU.Size = new Size(220, 25);
|
this.txtInitU.Size = new Size(130, 24);
|
||||||
this.txtInitU.Text = "sin(pi * x)";
|
this.txtInitU.Text = "sin(pi*x)";
|
||||||
this.txtInitU.Font = new Font("Consolas", 10F);
|
this.txtInitU.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtInitU.BackColor = ThemeHelper.CardBackground;
|
this.txtInitU.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtInitU.ForeColor = Color.White;
|
this.txtInitU.ForeColor = Color.White;
|
||||||
this.txtInitU.BorderStyle = BorderStyle.FixedSingle;
|
this.txtInitU.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
this.lblInitVel.Text = "u_t(x, 0) =";
|
this.lblInitVel.Text = "u_t(x, 0):";
|
||||||
this.lblInitVel.Location = new Point(640, y1 + 4);
|
this.lblInitVel.Location = new Point(515, yRow1 + 3);
|
||||||
this.lblInitVel.AutoSize = true;
|
this.lblInitVel.AutoSize = true;
|
||||||
this.lblInitVel.ForeColor = ThemeHelper.LightText;
|
this.lblInitVel.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtInitVel.Location = new Point(710, y1);
|
this.txtInitVel.Location = new Point(570, yRow1);
|
||||||
this.txtInitVel.Size = new Size(160, 25);
|
this.txtInitVel.Size = new Size(70, 24);
|
||||||
this.txtInitVel.Text = "0";
|
this.txtInitVel.Text = "0";
|
||||||
this.txtInitVel.Font = new Font("Consolas", 10F);
|
this.txtInitVel.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtInitVel.BackColor = ThemeHelper.CardBackground;
|
this.txtInitVel.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtInitVel.ForeColor = Color.White;
|
this.txtInitVel.ForeColor = Color.White;
|
||||||
this.txtInitVel.BorderStyle = BorderStyle.FixedSingle;
|
this.txtInitVel.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
int y2 = 82;
|
this.lblParam.Text = "α / c / v:";
|
||||||
this.lblParam.Text = "Parametre (α / c / v):";
|
this.lblParam.Location = new Point(650, yRow1 + 3);
|
||||||
this.lblParam.Location = new Point(24, y2 + 4);
|
|
||||||
this.lblParam.AutoSize = true;
|
this.lblParam.AutoSize = true;
|
||||||
this.lblParam.ForeColor = ThemeHelper.LightText;
|
this.lblParam.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtParam.Location = new Point(155, y2);
|
this.txtParam.Location = new Point(705, yRow1);
|
||||||
this.txtParam.Size = new Size(60, 25);
|
this.txtParam.Size = new Size(45, 24);
|
||||||
this.txtParam.Text = "0.1";
|
this.txtParam.Text = "1";
|
||||||
this.txtParam.Font = new Font("Consolas", 10F);
|
this.txtParam.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtParam.BackColor = ThemeHelper.CardBackground;
|
this.txtParam.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtParam.ForeColor = Color.White;
|
this.txtParam.ForeColor = Color.White;
|
||||||
this.txtParam.BorderStyle = BorderStyle.FixedSingle;
|
this.txtParam.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtParam.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
|
int yRow2 = 78;
|
||||||
this.lblL.Text = "Uzunluk L:";
|
this.lblL.Text = "Uzunluk L:";
|
||||||
this.lblL.Location = new Point(225, y2 + 4);
|
this.lblL.Location = new Point(20, yRow2 + 3);
|
||||||
this.lblL.AutoSize = true;
|
this.lblL.AutoSize = true;
|
||||||
this.lblL.ForeColor = ThemeHelper.LightText;
|
this.lblL.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtL.Location = new Point(295, y2);
|
this.txtL.Location = new Point(85, yRow2);
|
||||||
this.txtL.Size = new Size(50, 25);
|
this.txtL.Size = new Size(45, 24);
|
||||||
this.txtL.Text = "1";
|
this.txtL.Text = "1";
|
||||||
this.txtL.Font = new Font("Consolas", 10F);
|
this.txtL.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtL.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtL.ForeColor = Color.White;
|
this.txtL.ForeColor = Color.White;
|
||||||
this.txtL.BorderStyle = BorderStyle.FixedSingle;
|
this.txtL.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtL.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblT.Text = "Süre T:";
|
this.lblT.Text = "Süre T:";
|
||||||
this.lblT.Location = new Point(355, y2 + 4);
|
this.lblT.Location = new Point(140, yRow2 + 3);
|
||||||
this.lblT.AutoSize = true;
|
this.lblT.AutoSize = true;
|
||||||
this.lblT.ForeColor = ThemeHelper.LightText;
|
this.lblT.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtT.Location = new Point(405, y2);
|
this.txtT.Location = new Point(185, yRow2);
|
||||||
this.txtT.Size = new Size(50, 25);
|
this.txtT.Size = new Size(45, 24);
|
||||||
this.txtT.Text = "0.5";
|
this.txtT.Text = "0.2";
|
||||||
this.txtT.Font = new Font("Consolas", 10F);
|
this.txtT.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtT.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtT.ForeColor = Color.White;
|
this.txtT.ForeColor = Color.White;
|
||||||
this.txtT.BorderStyle = BorderStyle.FixedSingle;
|
this.txtT.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtT.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblNx.Text = "Nx (Mekan):";
|
this.lblNx.Text = "Nx:";
|
||||||
this.lblNx.Location = new Point(465, y2 + 4);
|
this.lblNx.Location = new Point(240, yRow2 + 3);
|
||||||
this.lblNx.AutoSize = true;
|
this.lblNx.AutoSize = true;
|
||||||
this.lblNx.ForeColor = ThemeHelper.LightText;
|
this.lblNx.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.numNx.Location = new Point(545, y2);
|
this.numNx.Location = new Point(268, yRow2);
|
||||||
this.numNx.Size = new Size(55, 25);
|
this.numNx.Size = new Size(50, 24);
|
||||||
this.numNx.Minimum = 5;
|
this.numNx.Minimum = 10;
|
||||||
this.numNx.Maximum = 200;
|
this.numNx.Maximum = 500;
|
||||||
this.numNx.Value = 25;
|
this.numNx.Value = 50;
|
||||||
this.numNx.BackColor = ThemeHelper.CardBackground;
|
this.numNx.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numNx.ForeColor = Color.White;
|
this.numNx.ForeColor = Color.White;
|
||||||
|
|
||||||
this.lblNt.Text = "Nt (Zaman):";
|
this.lblNt.Text = "Nt:";
|
||||||
this.lblNt.Location = new Point(610, y2 + 4);
|
this.lblNt.Location = new Point(328, yRow2 + 3);
|
||||||
this.lblNt.AutoSize = true;
|
this.lblNt.AutoSize = true;
|
||||||
this.lblNt.ForeColor = ThemeHelper.LightText;
|
this.lblNt.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.numNt.Location = new Point(690, y2);
|
this.numNt.Location = new Point(355, yRow2);
|
||||||
this.numNt.Size = new Size(60, 25);
|
this.numNt.Size = new Size(55, 24);
|
||||||
this.numNt.Minimum = 5;
|
this.numNt.Minimum = 10;
|
||||||
this.numNt.Maximum = 2000;
|
this.numNt.Maximum = 2000;
|
||||||
this.numNt.Value = 150;
|
this.numNt.Value = 200;
|
||||||
this.numNt.BackColor = ThemeHelper.CardBackground;
|
this.numNt.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numNt.ForeColor = Color.White;
|
this.numNt.ForeColor = Color.White;
|
||||||
|
|
||||||
this.lblBc.Text = "Sınırlar [u(0), u(L)]:";
|
this.lblBc.Text = "Sınırlar [Sol, Sağ]:";
|
||||||
this.lblBc.Location = new Point(760, y2 + 4);
|
this.lblBc.Location = new Point(420, yRow2 + 3);
|
||||||
this.lblBc.AutoSize = true;
|
this.lblBc.AutoSize = true;
|
||||||
this.lblBc.ForeColor = ThemeHelper.LightText;
|
this.lblBc.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtBcLeft.Location = new Point(870, y2);
|
this.txtBcLeft.Location = new Point(520, yRow2);
|
||||||
this.txtBcLeft.Size = new Size(35, 25);
|
this.txtBcLeft.Size = new Size(40, 24);
|
||||||
this.txtBcLeft.Text = "0";
|
this.txtBcLeft.Text = "0";
|
||||||
this.txtBcLeft.Font = new Font("Consolas", 9F);
|
this.txtBcLeft.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtBcLeft.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtBcLeft.ForeColor = Color.White;
|
this.txtBcLeft.ForeColor = Color.White;
|
||||||
this.txtBcLeft.BorderStyle = BorderStyle.FixedSingle;
|
this.txtBcLeft.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtBcLeft.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.txtBcRight.Location = new Point(910, y2);
|
this.txtBcRight.Location = new Point(568, yRow2);
|
||||||
this.txtBcRight.Size = new Size(35, 25);
|
this.txtBcRight.Size = new Size(40, 24);
|
||||||
this.txtBcRight.Text = "0";
|
this.txtBcRight.Text = "0";
|
||||||
this.txtBcRight.Font = new Font("Consolas", 9F);
|
this.txtBcRight.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtBcRight.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtBcRight.ForeColor = Color.White;
|
this.txtBcRight.ForeColor = Color.White;
|
||||||
this.txtBcRight.BorderStyle = BorderStyle.FixedSingle;
|
this.txtBcRight.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtBcRight.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
int y3 = 120;
|
this.btnSolve.Location = new Point(640, yRow2 - 2);
|
||||||
this.btnSolve.Location = new Point(24, y3);
|
|
||||||
this.btnCopy.Location = new Point(175, y3);
|
// CFL Indicator Bar
|
||||||
|
this.pnlCflBar.Location = new Point(20, 114);
|
||||||
|
this.pnlCflBar.Size = new Size(900, 34);
|
||||||
|
this.pnlCflBar.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.pnlCflBar.Padding = new Padding(10, 6, 10, 6);
|
||||||
|
|
||||||
|
this.lblCflIcon.Text = "⚖️";
|
||||||
|
this.lblCflIcon.Dock = DockStyle.Left;
|
||||||
|
this.lblCflIcon.Width = 26;
|
||||||
|
this.lblCflIcon.Font = new Font("Segoe UI", 10F);
|
||||||
|
|
||||||
|
this.lblCflText.Text = "CFL Kararlılık Durumu Hesaplanıyor...";
|
||||||
|
this.lblCflText.Dock = DockStyle.Fill;
|
||||||
|
this.lblCflText.Font = new Font("Consolas", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCflText.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblCflText.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
|
||||||
|
this.pnlCflBar.Controls.Add(this.lblCflText);
|
||||||
|
this.pnlCflBar.Controls.Add(this.lblCflIcon);
|
||||||
|
|
||||||
this.pnlControls.Controls.Add(this.pnlPresets);
|
this.pnlControls.Controls.Add(this.pnlPresets);
|
||||||
this.pnlControls.Controls.Add(this.lblPdeType);
|
this.pnlControls.Controls.Add(this.lblPdeType);
|
||||||
|
|
@ -250,56 +303,208 @@ namespace MathApp.Controls
|
||||||
this.pnlControls.Controls.Add(this.txtBcLeft);
|
this.pnlControls.Controls.Add(this.txtBcLeft);
|
||||||
this.pnlControls.Controls.Add(this.txtBcRight);
|
this.pnlControls.Controls.Add(this.txtBcRight);
|
||||||
this.pnlControls.Controls.Add(this.btnSolve);
|
this.pnlControls.Controls.Add(this.btnSolve);
|
||||||
this.pnlControls.Controls.Add(this.btnCopy);
|
this.pnlControls.Controls.Add(this.pnlCflBar);
|
||||||
|
|
||||||
// pnlCardResult
|
// ================== TABBED VISUALS ==================
|
||||||
this.pnlCardResult.Dock = DockStyle.Top;
|
this.tabPdeVisual.Dock = DockStyle.Fill;
|
||||||
this.pnlCardResult.Height = 65;
|
this.tabPdeVisual.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.pnlCardResult.BackColor = ThemeHelper.CardBackground;
|
this.tabPdeVisual.Padding = new Point(12, 4);
|
||||||
this.pnlCardResult.Padding = new Padding(20, 8, 20, 8);
|
|
||||||
|
|
||||||
this.lblStability.Dock = DockStyle.Top;
|
// Tab 1: Heatmap
|
||||||
this.lblStability.Height = 26;
|
this.tabHeatmap.Text = "Mekan-Zaman Isı Haritası (Heatmap)";
|
||||||
this.lblStability.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
|
this.tabHeatmap.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.lblStability.ForeColor = Color.FromArgb(52, 211, 153);
|
this.tabHeatmap.Padding = new Padding(8);
|
||||||
this.lblStability.Text = "Kararlılık & Yöntem: Bekleniyor";
|
|
||||||
|
|
||||||
this.lblDetails.Dock = DockStyle.Bottom;
|
this.pnlHeatmapHeader.Dock = DockStyle.Top;
|
||||||
this.lblDetails.Height = 20;
|
this.pnlHeatmapHeader.Height = 32;
|
||||||
this.lblDetails.Font = new Font("Segoe UI", 9F);
|
this.pnlHeatmapHeader.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
this.lblDetails.ForeColor = ThemeHelper.MutedText;
|
|
||||||
this.lblDetails.Text = "PDE çözümü bekleniyor.";
|
|
||||||
|
|
||||||
this.pnlCardResult.Controls.Add(this.lblDetails);
|
this.lblHeatmapTitle.Text = "🗺️ 2B Mekan-Zaman Dağılımı u(x, t):";
|
||||||
this.pnlCardResult.Controls.Add(this.lblStability);
|
this.lblHeatmapTitle.Dock = DockStyle.Left;
|
||||||
|
this.lblHeatmapTitle.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
this.lblHeatmapTitle.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblHeatmapTitle.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
this.lblHeatmapTitle.Padding = new Padding(8, 0, 0, 0);
|
||||||
|
|
||||||
|
this.lblColorbarLegend.Text = "Mavi (Min) ── Yeşil ── Sarı ── Kırmızı (Maks)";
|
||||||
|
this.lblColorbarLegend.Dock = DockStyle.Left;
|
||||||
|
this.lblColorbarLegend.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.lblColorbarLegend.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblColorbarLegend.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
this.lblColorbarLegend.Padding = new Padding(20, 0, 0, 0);
|
||||||
|
|
||||||
|
this.btnExportHeatmapPng.Text = "📷 PNG Kaydet";
|
||||||
|
this.btnExportHeatmapPng.Dock = DockStyle.Right;
|
||||||
|
this.btnExportHeatmapPng.Width = 100;
|
||||||
|
this.btnExportHeatmapPng.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnExportHeatmapPng.BackColor = Color.FromArgb(33, 44, 70);
|
||||||
|
this.btnExportHeatmapPng.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
|
this.btnExportHeatmapPng.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.btnExportHeatmapPng.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnExportHeatmapPng.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.pnlHeatmapHeader.Controls.Add(this.lblColorbarLegend);
|
||||||
|
this.pnlHeatmapHeader.Controls.Add(this.lblHeatmapTitle);
|
||||||
|
this.pnlHeatmapHeader.Controls.Add(this.btnExportHeatmapPng);
|
||||||
|
|
||||||
|
this.pnlHeatmapCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlHeatmapCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlHeatmapCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabHeatmap.Controls.Add(this.pnlHeatmapCanvas);
|
||||||
|
this.tabHeatmap.Controls.Add(this.pnlHeatmapHeader);
|
||||||
|
|
||||||
|
// Tab 2: Animation & Time Slider
|
||||||
|
this.tabAnimation.Text = "Canlı Dalga & Isı Animasyonu";
|
||||||
|
this.tabAnimation.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabAnimation.Padding = new Padding(8);
|
||||||
|
|
||||||
|
this.pnlAnimToolbar.Dock = DockStyle.Top;
|
||||||
|
this.pnlAnimToolbar.Height = 44;
|
||||||
|
this.pnlAnimToolbar.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.pnlAnimToolbar.Padding = new Padding(8, 6, 8, 6);
|
||||||
|
|
||||||
|
this.btnPlayPause.Text = "▶ Oynat";
|
||||||
|
this.btnPlayPause.Dock = DockStyle.Left;
|
||||||
|
this.btnPlayPause.Width = 80;
|
||||||
|
this.btnPlayPause.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnPlayPause.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
this.btnPlayPause.ForeColor = Color.White;
|
||||||
|
this.btnPlayPause.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnPlayPause.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnPlayPause.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.lblCurrentTime.Text = "t = 0.000 s (Adım: 0 / 0)";
|
||||||
|
this.lblCurrentTime.Dock = DockStyle.Left;
|
||||||
|
this.lblCurrentTime.Width = 190;
|
||||||
|
this.lblCurrentTime.Font = new Font("Consolas", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCurrentTime.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblCurrentTime.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
|
||||||
|
this.lblAnimSpeed.Text = "Hız:";
|
||||||
|
this.lblAnimSpeed.Dock = DockStyle.Right;
|
||||||
|
this.lblAnimSpeed.Width = 32;
|
||||||
|
this.lblAnimSpeed.Font = new Font("Segoe UI", 8.5F);
|
||||||
|
this.lblAnimSpeed.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblAnimSpeed.TextAlign = ContentAlignment.MiddleRight;
|
||||||
|
|
||||||
|
this.cmbAnimSpeed.Dock = DockStyle.Right;
|
||||||
|
this.cmbAnimSpeed.Width = 65;
|
||||||
|
this.cmbAnimSpeed.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
this.cmbAnimSpeed.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.cmbAnimSpeed.ForeColor = Color.White;
|
||||||
|
this.cmbAnimSpeed.Items.AddRange(new object[] { "1x", "2x", "5x" });
|
||||||
|
this.cmbAnimSpeed.SelectedIndex = 0;
|
||||||
|
|
||||||
|
this.trkTimeStep.Dock = DockStyle.Fill;
|
||||||
|
this.trkTimeStep.Minimum = 0;
|
||||||
|
this.trkTimeStep.Maximum = 100;
|
||||||
|
this.trkTimeStep.Value = 0;
|
||||||
|
this.trkTimeStep.TickStyle = TickStyle.None;
|
||||||
|
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.trkTimeStep);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.lblAnimSpeed);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.cmbAnimSpeed);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.lblCurrentTime);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.btnPlayPause);
|
||||||
|
|
||||||
|
this.pnlAnimCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlAnimCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlAnimCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabAnimation.Controls.Add(this.pnlAnimCanvas);
|
||||||
|
this.tabAnimation.Controls.Add(this.pnlAnimToolbar);
|
||||||
|
|
||||||
|
// Tab 3: Snapshots
|
||||||
|
this.tabSnapshots.Text = "Zaman Kesitleri Tablosu";
|
||||||
|
this.tabSnapshots.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabSnapshots.Padding = new Padding(6);
|
||||||
|
|
||||||
|
this.pnlSnapToolbar.Dock = DockStyle.Top;
|
||||||
|
this.pnlSnapToolbar.Height = 32;
|
||||||
|
this.pnlSnapToolbar.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
|
||||||
|
this.btnCopyPdeTsv.Dock = DockStyle.Right;
|
||||||
|
this.btnCopyPdeTsv.Height = 28;
|
||||||
|
this.pnlSnapToolbar.Controls.Add(this.btnCopyPdeTsv);
|
||||||
|
|
||||||
|
SetupGrid(this.dgvSnapshots);
|
||||||
|
this.tabSnapshots.Controls.Add(this.dgvSnapshots);
|
||||||
|
this.tabSnapshots.Controls.Add(this.pnlSnapToolbar);
|
||||||
|
|
||||||
|
// Tab 4: Text Report
|
||||||
|
this.tabTextReport.Text = "Rapor & Konsol";
|
||||||
|
this.tabTextReport.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabTextReport.Padding = new Padding(6);
|
||||||
|
|
||||||
// txtOutput
|
|
||||||
this.txtOutput.Dock = DockStyle.Fill;
|
this.txtOutput.Dock = DockStyle.Fill;
|
||||||
this.txtOutput.BackColor = Color.FromArgb(11, 17, 32);
|
this.txtOutput.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtOutput.BorderStyle = BorderStyle.None;
|
this.txtOutput.BorderStyle = BorderStyle.None;
|
||||||
this.txtOutput.ReadOnly = true;
|
this.txtOutput.ReadOnly = true;
|
||||||
|
|
||||||
// Assemble PdeSolverControl
|
this.tabTextReport.Controls.Add(this.txtOutput);
|
||||||
|
|
||||||
|
this.tabPdeVisual.TabPages.Add(this.tabHeatmap);
|
||||||
|
this.tabPdeVisual.TabPages.Add(this.tabAnimation);
|
||||||
|
this.tabPdeVisual.TabPages.Add(this.tabSnapshots);
|
||||||
|
this.tabPdeVisual.TabPages.Add(this.tabTextReport);
|
||||||
|
|
||||||
|
// Assemble
|
||||||
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = AutoScaleMode.Font;
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.BackColor = ThemeHelper.DarkBackground;
|
this.BackColor = ThemeHelper.DarkBackground;
|
||||||
this.Controls.Add(this.txtOutput);
|
this.Controls.Add(this.tabPdeVisual);
|
||||||
this.Controls.Add(this.pnlCardResult);
|
|
||||||
this.Controls.Add(this.pnlControls);
|
this.Controls.Add(this.pnlControls);
|
||||||
this.Controls.Add(this.pnlHeader);
|
this.Controls.Add(this.pnlHeader);
|
||||||
this.Name = "PdeSolverControl";
|
this.Name = "PdeSolverControl";
|
||||||
this.Size = new Size(960, 680);
|
this.Size = new Size(950, 700);
|
||||||
|
|
||||||
this.pnlControls.ResumeLayout(false);
|
this.pnlControls.ResumeLayout(false);
|
||||||
this.pnlControls.PerformLayout();
|
this.pnlControls.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNx)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNx)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNt)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNt)).EndInit();
|
||||||
this.pnlCardResult.ResumeLayout(false);
|
this.pnlCflBar.ResumeLayout(false);
|
||||||
|
this.tabPdeVisual.ResumeLayout(false);
|
||||||
|
this.tabHeatmap.ResumeLayout(false);
|
||||||
|
this.pnlHeatmapHeader.ResumeLayout(false);
|
||||||
|
this.tabAnimation.ResumeLayout(false);
|
||||||
|
this.pnlAnimToolbar.ResumeLayout(false);
|
||||||
|
this.pnlAnimToolbar.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trkTimeStep)).EndInit();
|
||||||
|
this.tabSnapshots.ResumeLayout(false);
|
||||||
|
this.pnlSnapToolbar.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvSnapshots)).EndInit();
|
||||||
|
this.tabTextReport.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupGrid(DataGridView dgv)
|
||||||
|
{
|
||||||
|
dgv.Dock = DockStyle.Fill;
|
||||||
|
dgv.BackgroundColor = Color.FromArgb(15, 23, 42);
|
||||||
|
dgv.BorderStyle = BorderStyle.None;
|
||||||
|
dgv.EnableHeadersVisualStyles = false;
|
||||||
|
dgv.AllowUserToAddRows = false;
|
||||||
|
dgv.AllowUserToDeleteRows = false;
|
||||||
|
dgv.AllowUserToResizeRows = false;
|
||||||
|
dgv.RowHeadersVisible = false;
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
dgv.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
dgv.ColumnHeadersHeight = 24;
|
||||||
|
dgv.DefaultCellStyle.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
|
dgv.DefaultCellStyle.ForeColor = Color.White;
|
||||||
|
dgv.DefaultCellStyle.Font = new Font("Consolas", 9.5F);
|
||||||
|
dgv.DefaultCellStyle.SelectionBackColor = Color.FromArgb(37, 99, 235);
|
||||||
|
dgv.DefaultCellStyle.SelectionForeColor = Color.White;
|
||||||
|
dgv.GridColor = Color.FromArgb(40, 50, 75);
|
||||||
|
dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dgv.ReadOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
private Panel pnlHeader;
|
private Panel pnlHeader;
|
||||||
private Panel pnlControls;
|
private Panel pnlControls;
|
||||||
private FlowLayoutPanel pnlPresets;
|
private FlowLayoutPanel pnlPresets;
|
||||||
|
|
@ -308,6 +513,7 @@ namespace MathApp.Controls
|
||||||
private Button btnExWave;
|
private Button btnExWave;
|
||||||
private Button btnExAdvect;
|
private Button btnExAdvect;
|
||||||
private Button btnExGauss;
|
private Button btnExGauss;
|
||||||
|
|
||||||
private Label lblPdeType;
|
private Label lblPdeType;
|
||||||
private ComboBox cmbPdeType;
|
private ComboBox cmbPdeType;
|
||||||
private Label lblInitU;
|
private Label lblInitU;
|
||||||
|
|
@ -328,10 +534,34 @@ namespace MathApp.Controls
|
||||||
private TextBox txtBcLeft;
|
private TextBox txtBcLeft;
|
||||||
private TextBox txtBcRight;
|
private TextBox txtBcRight;
|
||||||
private Button btnSolve;
|
private Button btnSolve;
|
||||||
private Button btnCopy;
|
|
||||||
private Panel pnlCardResult;
|
private Panel pnlCflBar;
|
||||||
private Label lblStability;
|
private Label lblCflIcon;
|
||||||
private Label lblDetails;
|
private Label lblCflText;
|
||||||
|
|
||||||
|
private TabControl tabPdeVisual;
|
||||||
|
private TabPage tabHeatmap;
|
||||||
|
private Panel pnlHeatmapHeader;
|
||||||
|
private Label lblHeatmapTitle;
|
||||||
|
private Label lblColorbarLegend;
|
||||||
|
private Button btnExportHeatmapPng;
|
||||||
|
private Panel pnlHeatmapCanvas;
|
||||||
|
|
||||||
|
private TabPage tabAnimation;
|
||||||
|
private Panel pnlAnimToolbar;
|
||||||
|
private Button btnPlayPause;
|
||||||
|
private Label lblCurrentTime;
|
||||||
|
private TrackBar trkTimeStep;
|
||||||
|
private Label lblAnimSpeed;
|
||||||
|
private ComboBox cmbAnimSpeed;
|
||||||
|
private Panel pnlAnimCanvas;
|
||||||
|
|
||||||
|
private TabPage tabSnapshots;
|
||||||
|
private Panel pnlSnapToolbar;
|
||||||
|
private Button btnCopyPdeTsv;
|
||||||
|
private DataGridView dgvSnapshots;
|
||||||
|
|
||||||
|
private TabPage tabTextReport;
|
||||||
private RichTextBox txtOutput;
|
private RichTextBox txtOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -9,263 +12,688 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
public partial class PdeSolverControl : UserControl
|
public partial class PdeSolverControl : UserControl
|
||||||
{
|
{
|
||||||
|
private DifferentialEquations.PdeSolutionGrid _currentGrid = null;
|
||||||
|
private Bitmap _heatmapCache = null;
|
||||||
|
private Timer _animTimer = new Timer();
|
||||||
|
private decimal _minU = 0m, _maxU = 1m;
|
||||||
|
|
||||||
|
private PointF? _heatmapHoverPoint = null;
|
||||||
|
private (decimal X, decimal T, decimal U)? _heatmapHoverData = null;
|
||||||
|
|
||||||
public PdeSolverControl()
|
public PdeSolverControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SetupEvents();
|
|
||||||
SetPresetHeat();
|
btnSolve.Click += BtnSolve_Click;
|
||||||
|
btnCopyPdeTsv.Click += (s, e) => CopyGridAsTsv();
|
||||||
|
btnExportHeatmapPng.Click += (s, e) => ExportHeatmapAsPng();
|
||||||
|
|
||||||
|
btnExHeat.Click += (s, e) => LoadPreset(0, "sin(pi*x)", "0", "1", "1", "0.2", 50, 200, "0", "0");
|
||||||
|
btnExWave.Click += (s, e) => LoadPreset(2, "sin(pi*x)", "0", "2", "1", "1", 80, 300, "0", "0");
|
||||||
|
btnExAdvect.Click += (s, e) => LoadPreset(3, "exp(-50*(x-0.2)^2)", "0", "1.5", "1", "0.5", 100, 250, "0", "0");
|
||||||
|
btnExGauss.Click += (s, e) => LoadPreset(0, "exp(-100*(x-0.5)^2)", "0", "0.5", "1", "0.1", 60, 200, "0", "0");
|
||||||
|
|
||||||
|
cmbPdeType.SelectedIndexChanged += (s, e) => UpdateLiveCflStatus();
|
||||||
|
txtL.TextChanged += (s, e) => UpdateLiveCflStatus();
|
||||||
|
txtT.TextChanged += (s, e) => UpdateLiveCflStatus();
|
||||||
|
txtParam.TextChanged += (s, e) => UpdateLiveCflStatus();
|
||||||
|
numNx.ValueChanged += (s, e) => UpdateLiveCflStatus();
|
||||||
|
numNt.ValueChanged += (s, e) => UpdateLiveCflStatus();
|
||||||
|
|
||||||
|
btnPlayPause.Click += (s, e) => ToggleAnimation();
|
||||||
|
trkTimeStep.Scroll += (s, e) => UpdateAnimationDisplay();
|
||||||
|
cmbAnimSpeed.SelectedIndexChanged += (s, e) => UpdateAnimSpeed();
|
||||||
|
|
||||||
|
_animTimer.Interval = 33; // ~30 fps
|
||||||
|
_animTimer.Tick += (s, e) => AdvanceAnimation();
|
||||||
|
|
||||||
|
pnlHeatmapCanvas.Paint += PnlHeatmapCanvas_Paint;
|
||||||
|
pnlHeatmapCanvas.MouseMove += PnlHeatmapCanvas_MouseMove;
|
||||||
|
pnlHeatmapCanvas.MouseLeave += (s, e) => { _heatmapHoverPoint = null; _heatmapHoverData = null; pnlHeatmapCanvas.Invalidate(); };
|
||||||
|
pnlHeatmapCanvas.Resize += (s, e) => pnlHeatmapCanvas.Invalidate();
|
||||||
|
|
||||||
|
pnlAnimCanvas.Paint += PnlAnimCanvas_Paint;
|
||||||
|
pnlAnimCanvas.Resize += (s, e) => pnlAnimCanvas.Invalidate();
|
||||||
|
|
||||||
|
// Default
|
||||||
|
UpdateLiveCflStatus();
|
||||||
|
LoadPreset(0, "sin(pi*x)", "0", "1", "1", "0.2", 50, 200, "0", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupEvents()
|
private void LoadPreset(int pdeIdx, string initU, string initVel, string param, string L, string T, int Nx, int Nt, string bcL, string bcR)
|
||||||
{
|
{
|
||||||
btnSolve.Click += async (s, e) => await SolveAsync();
|
cmbPdeType.SelectedIndex = pdeIdx;
|
||||||
btnCopy.Click += (s, e) =>
|
txtInitU.Text = initU;
|
||||||
{
|
txtInitVel.Text = initVel;
|
||||||
if (!string.IsNullOrWhiteSpace(txtOutput.Text))
|
txtParam.Text = param;
|
||||||
{
|
txtL.Text = L;
|
||||||
Clipboard.SetText(txtOutput.Text);
|
txtT.Text = T;
|
||||||
MessageBox.Show("Sonuç tablosu panoya kopyalandı.", "Kopyalandı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
numNx.Value = Nx;
|
||||||
}
|
numNt.Value = Nt;
|
||||||
};
|
txtBcLeft.Text = bcL;
|
||||||
|
txtBcRight.Text = bcR;
|
||||||
|
|
||||||
btnExHeat.Click += (s, e) => SetPresetHeat();
|
UpdateLiveCflStatus();
|
||||||
btnExWave.Click += (s, e) => SetPresetWave();
|
BtnSolve_Click(this, EventArgs.Empty);
|
||||||
btnExAdvect.Click += (s, e) => SetPresetAdvection();
|
|
||||||
btnExGauss.Click += (s, e) => SetPresetGauss();
|
|
||||||
|
|
||||||
cmbPdeType.SelectedIndexChanged += (s, e) =>
|
|
||||||
{
|
|
||||||
int sel = cmbPdeType.SelectedIndex;
|
|
||||||
bool isWave = sel == 2;
|
|
||||||
bool isLaplace = sel == 4;
|
|
||||||
|
|
||||||
lblInitVel.Visible = isWave;
|
|
||||||
txtInitVel.Visible = isWave;
|
|
||||||
|
|
||||||
lblInitU.Visible = !isLaplace;
|
|
||||||
txtInitU.Visible = !isLaplace;
|
|
||||||
lblT.Visible = !isLaplace;
|
|
||||||
txtT.Visible = !isLaplace;
|
|
||||||
lblNt.Visible = !isLaplace;
|
|
||||||
numNt.Visible = !isLaplace;
|
|
||||||
|
|
||||||
if (sel == 0 || sel == 1) lblParam.Text = "Difüzyon Katsayısı (α):";
|
|
||||||
else if (sel == 2) lblParam.Text = "Dalga Hızı (c):";
|
|
||||||
else if (sel == 3) lblParam.Text = "Taşınım Hızı (v):";
|
|
||||||
else lblParam.Text = "Boşta (Laplace):";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPresetHeat()
|
private void UpdateLiveCflStatus()
|
||||||
{
|
|
||||||
cmbPdeType.SelectedIndex = 0;
|
|
||||||
txtInitU.Text = "sin(pi * x)";
|
|
||||||
txtInitVel.Text = "0";
|
|
||||||
txtParam.Text = "0.1";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "0.5";
|
|
||||||
numNx.Value = 25;
|
|
||||||
numNt.Value = 150;
|
|
||||||
txtBcLeft.Text = "0";
|
|
||||||
txtBcRight.Text = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetWave()
|
|
||||||
{
|
|
||||||
cmbPdeType.SelectedIndex = 2;
|
|
||||||
txtInitU.Text = "sin(pi * x)";
|
|
||||||
txtInitVel.Text = "0";
|
|
||||||
txtParam.Text = "2";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "1.0";
|
|
||||||
numNx.Value = 25;
|
|
||||||
numNt.Value = 200;
|
|
||||||
txtBcLeft.Text = "0";
|
|
||||||
txtBcRight.Text = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetAdvection()
|
|
||||||
{
|
|
||||||
cmbPdeType.SelectedIndex = 3;
|
|
||||||
txtInitU.Text = "exp(-40 * (x - 0.3)^2)";
|
|
||||||
txtInitVel.Text = "0";
|
|
||||||
txtParam.Text = "1";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "0.5";
|
|
||||||
numNx.Value = 40;
|
|
||||||
numNt.Value = 150;
|
|
||||||
txtBcLeft.Text = "0";
|
|
||||||
txtBcRight.Text = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetGauss()
|
|
||||||
{
|
|
||||||
cmbPdeType.SelectedIndex = 1; // Crank-Nicolson
|
|
||||||
txtInitU.Text = "exp(-100 * (x - 0.5)^2)";
|
|
||||||
txtInitVel.Text = "0";
|
|
||||||
txtParam.Text = "0.2";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "0.3";
|
|
||||||
numNx.Value = 31;
|
|
||||||
numNt.Value = 200;
|
|
||||||
txtBcLeft.Text = "0";
|
|
||||||
txtBcRight.Text = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SolveAsync()
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
decimal L = ParseDecSilent(txtL.Text, 1m);
|
||||||
|
decimal T = ParseDecSilent(txtT.Text, 0.2m);
|
||||||
|
decimal param = ParseDecSilent(txtParam.Text, 1m);
|
||||||
|
int Nx = (int)numNx.Value;
|
||||||
|
int Nt = (int)numNt.Value;
|
||||||
|
|
||||||
|
if (L <= 0 || T <= 0 || Nx < 2 || Nt < 2) return;
|
||||||
|
|
||||||
|
decimal dx = L / (Nx - 1);
|
||||||
|
decimal dt = T / (Nt - 1);
|
||||||
|
int pdeIdx = cmbPdeType.SelectedIndex;
|
||||||
|
|
||||||
|
if (pdeIdx == 0) // Heat FTCS
|
||||||
|
{
|
||||||
|
decimal r = (param * dt) / (dx * dx);
|
||||||
|
if (r <= 0.5m)
|
||||||
|
{
|
||||||
|
lblCflText.Text = $"✓ Kararlı (FTCS): r = α·Δt / Δx² = {r:F4} ≤ 0.5 (Açık Şema Güvenli)";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblCflText.Text = $"⚠️ KARARSIZLIK RİSKİ! r = {r:F4} > 0.5 (Çözüm patlayabilir; Nt artırılmalı veya Crank-Nicolson seçilmeli)";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(239, 68, 68);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pdeIdx == 1) // Heat Crank-Nicolson
|
||||||
|
{
|
||||||
|
decimal r = (param * dt) / (dx * dx);
|
||||||
|
lblCflText.Text = $"✓ Koşulsuz Kararlı (Crank-Nicolson): r = {r:F4} (Tüm r değerleri için mutlak kararlı)";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
}
|
||||||
|
else if (pdeIdx == 2) // Wave Leapfrog
|
||||||
|
{
|
||||||
|
decimal cfl = (param * dt) / dx;
|
||||||
|
if (cfl <= 1.0m)
|
||||||
|
{
|
||||||
|
lblCflText.Text = $"✓ Kararlı (Leapfrog Dalga): CFL = c·Δt / Δx = {cfl:F4} ≤ 1.0 (Courant Koşulu Sağlandı)";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblCflText.Text = $"⚠️ KARARSIZLIK UYARISI! CFL = {cfl:F4} > 1.0 (Courant aşıldı; Nt artırılmalı veya c küçültülmeli)";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(239, 68, 68);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Advection
|
||||||
|
{
|
||||||
|
decimal cfl = (param * dt) / dx;
|
||||||
|
if (DecimalMath.Abs(cfl) <= 1.0m)
|
||||||
|
{
|
||||||
|
lblCflText.Text = $"✓ Kararlı (Upwind Taşınım): CFL = v·Δt / Δx = {cfl:F4} ≤ 1.0";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblCflText.Text = $"⚠️ KARARSIZ! CFL = {cfl:F4} > 1.0 (Taşınım profili bozulabilir)";
|
||||||
|
lblCflText.ForeColor = Color.FromArgb(239, 68, 68);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private decimal ParseDecSilent(string s, decimal def)
|
||||||
|
{
|
||||||
|
string norm = (s ?? "").Trim().Replace(',', '.');
|
||||||
|
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal v))
|
||||||
|
return v;
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
private decimal ParseDec(string s, string field)
|
||||||
|
{
|
||||||
|
string norm = (s ?? "").Trim().Replace(',', '.');
|
||||||
|
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal v))
|
||||||
|
return v;
|
||||||
|
throw new ArgumentException($"'{field}' için geçerli bir sayı giriniz.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void BtnSolve_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string origBtnText = btnSolve.Text;
|
||||||
btnSolve.Enabled = false;
|
btnSolve.Enabled = false;
|
||||||
btnSolve.Text = "⏳ Hesaplanıyor...";
|
btnSolve.Text = "⏳ Simüle Ediliyor...";
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
|
|
||||||
int sel = cmbPdeType.SelectedIndex;
|
try
|
||||||
|
|
||||||
if (!decimal.TryParse(txtParam.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal paramVal))
|
|
||||||
paramVal = 0.1m;
|
|
||||||
if (!decimal.TryParse(txtL.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal lengthL))
|
|
||||||
lengthL = 1m;
|
|
||||||
if (!decimal.TryParse(txtT.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal totalTimeT))
|
|
||||||
totalTimeT = 0.5m;
|
|
||||||
|
|
||||||
int nx = (int)numNx.Value;
|
|
||||||
int nt = (int)numNt.Value;
|
|
||||||
|
|
||||||
if (!decimal.TryParse(txtBcLeft.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal bcLeft))
|
|
||||||
bcLeft = 0m;
|
|
||||||
if (!decimal.TryParse(txtBcRight.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal bcRight))
|
|
||||||
bcRight = 0m;
|
|
||||||
|
|
||||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
|
||||||
if (sel == 4)
|
|
||||||
{
|
{
|
||||||
// 2D Laplace
|
int pdeIdx = cmbPdeType.SelectedIndex;
|
||||||
decimal topBc = 100m;
|
DifferentialEquations.PdeType pdeType = DifferentialEquations.PdeType.HeatEquation;
|
||||||
decimal bottomBc = 0m;
|
if (pdeIdx == 1) pdeType = DifferentialEquations.PdeType.HeatEquationCrankNicolson;
|
||||||
var laplace = await Task.Run(() =>
|
else if (pdeIdx == 2) pdeType = DifferentialEquations.PdeType.WaveEquation;
|
||||||
{
|
else if (pdeIdx == 3) pdeType = DifferentialEquations.PdeType.AdvectionEquation;
|
||||||
return DifferentialEquations.Solve2DLaplace(nx, nx, bcLeft, bcRight, topBc, bottomBc);
|
|
||||||
});
|
|
||||||
sw.Stop();
|
|
||||||
|
|
||||||
lblStability.Text = $"2B Laplace Denklemi (SOR): {laplace.Iterations} iterasyonda yakınsadı (Kalıntı: {laplace.FinalResidual:G4})";
|
|
||||||
lblDetails.Text = $"Izgara: {nx} × {nx} düğüm | Sınırlar: Sol={bcLeft}, Sağ={bcRight}, Üst={topBc}, Alt={bottomBc} | ⏱️ {sw.ElapsedMilliseconds} ms";
|
|
||||||
|
|
||||||
StringBuilder sbL = new StringBuilder();
|
|
||||||
sbL.AppendLine("==========================================================================================");
|
|
||||||
sbL.AppendLine("2 BOYUTLU ELLİPTİK LAPLACE DENKLEMİ (∇²u = u_xx + u_yy = 0) POTANSİYEL DAĞILIMI");
|
|
||||||
sbL.AppendLine($"Izgara: {nx} x {nx} | İterasyon: {laplace.Iterations} | Yakınsama Residual: {laplace.FinalResidual:G4}");
|
|
||||||
sbL.AppendLine("==========================================================================================");
|
|
||||||
|
|
||||||
int stepX = Math.Max(1, nx / 10);
|
|
||||||
int stepY = Math.Max(1, nx / 10);
|
|
||||||
|
|
||||||
sbL.Append(string.Format("{0,-8}", "y \\ x"));
|
|
||||||
for (int i = 0; i < nx; i += stepX)
|
|
||||||
{
|
|
||||||
decimal xPos = (decimal)i / (nx - 1);
|
|
||||||
sbL.Append(string.Format(" | {0,-8:F2}", xPos));
|
|
||||||
}
|
|
||||||
sbL.AppendLine();
|
|
||||||
sbL.AppendLine(new string('-', 100));
|
|
||||||
|
|
||||||
for (int j = nx - 1; j >= 0; j -= stepY)
|
|
||||||
{
|
|
||||||
decimal yPos = (decimal)j / (nx - 1);
|
|
||||||
sbL.Append(string.Format("{0,-8:F2}", yPos));
|
|
||||||
for (int i = 0; i < nx; i += stepX)
|
|
||||||
{
|
|
||||||
sbL.Append(string.Format(" | {0,-8:F2}", laplace.Grid[i, j]));
|
|
||||||
}
|
|
||||||
sbL.AppendLine();
|
|
||||||
}
|
|
||||||
sbL.AppendLine("==========================================================================================");
|
|
||||||
txtOutput.Text = sbL.ToString();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DifferentialEquations.PdeType pdeType;
|
|
||||||
if (sel == 0) pdeType = DifferentialEquations.PdeType.HeatEquation;
|
|
||||||
else if (sel == 1) pdeType = DifferentialEquations.PdeType.HeatEquationCrankNicolson;
|
|
||||||
else if (sel == 2) pdeType = DifferentialEquations.PdeType.WaveEquation;
|
|
||||||
else pdeType = DifferentialEquations.PdeType.AdvectionEquation;
|
|
||||||
|
|
||||||
string initU = txtInitU.Text.Trim();
|
string initU = txtInitU.Text.Trim();
|
||||||
string initVel = txtInitVel.Text.Trim();
|
string initVel = txtInitVel.Text.Trim();
|
||||||
|
decimal param = ParseDec(txtParam.Text, "α / c / v");
|
||||||
|
decimal L = ParseDec(txtL.Text, "Uzunluk L");
|
||||||
|
decimal T = ParseDec(txtT.Text, "Süre T");
|
||||||
|
int Nx = (int)numNx.Value;
|
||||||
|
int Nt = (int)numNt.Value;
|
||||||
|
decimal bcL = ParseDec(txtBcLeft.Text, "Sol Sınır u(0)");
|
||||||
|
decimal bcR = ParseDec(txtBcRight.Text, "Sağ Sınır u(L)");
|
||||||
|
|
||||||
|
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||||
var grid = await Task.Run(() =>
|
var grid = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
return DifferentialEquations.Solve1DPde(
|
bool prevRad = Function.UseRadians;
|
||||||
pdeType,
|
Function.UseRadians = true;
|
||||||
initU,
|
try
|
||||||
lengthL,
|
{
|
||||||
totalTimeT,
|
return DifferentialEquations.Solve1DPde(pdeType, initU, L, T, Nx, Nt, param, bcL, bcR, initVel);
|
||||||
nx,
|
}
|
||||||
nt,
|
finally
|
||||||
paramVal,
|
{
|
||||||
bcLeft,
|
Function.UseRadians = prevRad;
|
||||||
bcRight,
|
}
|
||||||
initVel
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
|
|
||||||
lblStability.Text = grid.StabilityNote;
|
if (grid != null && grid.U != null)
|
||||||
decimal dx = lengthL / (nx - 1);
|
|
||||||
decimal dt = totalTimeT / (nt - 1);
|
|
||||||
lblDetails.Text = $"Izgara: {nx} mekan × {nt} zaman noktası | Δx = {dx:F4}, Δt = {dt:F6} | x ∈ [0, {lengthL}], t ∈ [0, {totalTimeT}] | ⏱️ {sw.ElapsedMilliseconds} ms";
|
|
||||||
|
|
||||||
// Format Table of Time Slices
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.AppendLine("==========================================================================================");
|
|
||||||
sb.AppendLine($"1 BOYUTLU KISMİ DİFERANSİYEL DENKLEM (PDE) ÇÖZÜM TABLOSU");
|
|
||||||
sb.AppendLine(grid.StabilityNote);
|
|
||||||
sb.AppendLine($"Izgara: {nx} mekan noktası, {nt} zaman adımı | dx = {dx:F5}, dt = {dt:F5}");
|
|
||||||
sb.AppendLine("==========================================================================================");
|
|
||||||
|
|
||||||
int[] timeIndices = new int[]
|
|
||||||
{
|
{
|
||||||
0,
|
_currentGrid = grid;
|
||||||
nt / 4,
|
|
||||||
nt / 2,
|
|
||||||
(3 * nt) / 4,
|
|
||||||
nt - 1
|
|
||||||
};
|
|
||||||
|
|
||||||
sb.Append(string.Format("{0,-8} | {1,-10}", "Nokta i", "x"));
|
// Min and Max values for colormap
|
||||||
foreach (int tIdx in timeIndices)
|
_minU = decimal.MaxValue;
|
||||||
{
|
_maxU = decimal.MinValue;
|
||||||
decimal tVal = grid.TGrid[tIdx];
|
int nx = grid.XGrid.Length;
|
||||||
sb.Append(string.Format(" | {0,-14}", $"u(x, t={tVal:F3})"));
|
int nt = grid.TGrid.Length;
|
||||||
}
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine(new string('-', 22 + timeIndices.Length * 17));
|
|
||||||
|
|
||||||
for (int i = 0; i < nx; i++)
|
for (int i = 0; i < nx; i++)
|
||||||
{
|
{
|
||||||
decimal xVal = grid.XGrid[i];
|
for (int n = 0; n < nt; n++)
|
||||||
sb.Append(string.Format("{0,-8} | {1,-10:F4}", i, xVal));
|
|
||||||
foreach (int tIdx in timeIndices)
|
|
||||||
{
|
{
|
||||||
decimal uVal = grid.U[i, tIdx];
|
decimal val = grid.U[i, n];
|
||||||
sb.Append(string.Format(" | {0,-14:F6}", uVal));
|
if (val < _minU) _minU = val;
|
||||||
|
if (val > _maxU) _maxU = val;
|
||||||
}
|
}
|
||||||
sb.AppendLine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.AppendLine("==========================================================================================");
|
if (_maxU - _minU < 0.0001m) _maxU = _minU + 1m;
|
||||||
|
|
||||||
|
// Generate Heatmap Bitmap
|
||||||
|
GenerateHeatmapBitmap(grid, nx, nt);
|
||||||
|
|
||||||
|
// Setup animation controls
|
||||||
|
trkTimeStep.Maximum = nt - 1;
|
||||||
|
trkTimeStep.Value = 0;
|
||||||
|
UpdateAnimationDisplay();
|
||||||
|
|
||||||
|
// Populate Snapshot Table
|
||||||
|
PopulateSnapshotTable(grid, nx, nt);
|
||||||
|
|
||||||
|
// Report text
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=== KISMİ DİFERANSİYEL DENKLEM (1D PDE) ÇÖZÜM RAPORU ===");
|
||||||
|
sb.AppendLine($" Tip : {cmbPdeType.SelectedItem}");
|
||||||
|
sb.AppendLine($" Başlangıç Koşulu : u(x, 0) = {initU}");
|
||||||
|
sb.AppendLine($" Mekan & Zaman Ağı : x ∈ [0, {L}] ({Nx} nokta), t ∈ [0, {T}] ({Nt} adım)");
|
||||||
|
sb.AppendLine($" Parametre (α/c/v) : {param}");
|
||||||
|
sb.AppendLine($" Sınırlar [u(0),u(L)]: [{bcL}, {bcR}]");
|
||||||
|
sb.AppendLine($" Kararlılık Analizi : {grid.StabilityNote}");
|
||||||
|
sb.AppendLine($" Çözüm Süresi : {sw.ElapsedMilliseconds} ms");
|
||||||
|
sb.AppendLine($" Değer Aralığı [Min, Maks]: [{Math.Round(_minU, 5)}, {Math.Round(_maxU, 5)}]");
|
||||||
|
sb.AppendLine(new string('=', 65));
|
||||||
|
|
||||||
txtOutput.Text = sb.ToString();
|
txtOutput.Text = sb.ToString();
|
||||||
|
|
||||||
|
pnlHeatmapCanvas.Invalidate();
|
||||||
|
pnlAnimCanvas.Invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"PDE çözümü sırasında hata oluştu:\n{ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
txtOutput.Text = "❌ Hata: " + ex.Message;
|
||||||
lblStability.Text = "Hata oluştu!";
|
MessageBox.Show("PDE Çözüm Hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
lblDetails.Text = ex.Message;
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
btnSolve.Enabled = true;
|
btnSolve.Enabled = true;
|
||||||
btnSolve.Text = "🚀 PDE'yi Çöz";
|
btnSolve.Text = origBtnText;
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GenerateHeatmapBitmap(DifferentialEquations.PdeSolutionGrid grid, int nx, int nt)
|
||||||
|
{
|
||||||
|
_heatmapCache?.Dispose();
|
||||||
|
_heatmapCache = new Bitmap(nx, nt, PixelFormat.Format32bppArgb);
|
||||||
|
|
||||||
|
decimal span = _maxU - _minU;
|
||||||
|
if (span == 0m) span = 1m;
|
||||||
|
|
||||||
|
for (int t = 0; t < nt; t++)
|
||||||
|
{
|
||||||
|
// In image coordinates, y=0 is top (t=T), y=nt-1 is bottom (t=0)
|
||||||
|
int imgY = nt - 1 - t;
|
||||||
|
for (int x = 0; x < nx; x++)
|
||||||
|
{
|
||||||
|
decimal val = grid.U[x, t];
|
||||||
|
float norm = (float)((val - _minU) / span);
|
||||||
|
if (norm < 0f) norm = 0f;
|
||||||
|
if (norm > 1f) norm = 1f;
|
||||||
|
|
||||||
|
Color c = ValueToColormap(norm);
|
||||||
|
_heatmapCache.SetPixel(x, imgY, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color ValueToColormap(float v)
|
||||||
|
{
|
||||||
|
// Turbo / Thermal spectrum: 0 = Dark Navy, 0.25 = Cyan, 0.5 = Emerald, 0.75 = Amber/Yellow, 1 = Red
|
||||||
|
if (v <= 0.25f)
|
||||||
|
{
|
||||||
|
float t = v / 0.25f;
|
||||||
|
return Color.FromArgb(
|
||||||
|
(int)(15 + t * (6 - 15)),
|
||||||
|
(int)(23 + t * (182 - 23)),
|
||||||
|
(int)(70 + t * (212 - 70)));
|
||||||
|
}
|
||||||
|
else if (v <= 0.5f)
|
||||||
|
{
|
||||||
|
float t = (v - 0.25f) / 0.25f;
|
||||||
|
return Color.FromArgb(
|
||||||
|
(int)(6 + t * (16 - 6)),
|
||||||
|
(int)(182 + t * (185 - 182)),
|
||||||
|
(int)(212 + t * (129 - 212)));
|
||||||
|
}
|
||||||
|
else if (v <= 0.75f)
|
||||||
|
{
|
||||||
|
float t = (v - 0.5f) / 0.25f;
|
||||||
|
return Color.FromArgb(
|
||||||
|
(int)(16 + t * (245 - 16)),
|
||||||
|
(int)(185 + t * (158 - 185)),
|
||||||
|
(int)(129 + t * (11 - 129)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float t = (v - 0.75f) / 0.25f;
|
||||||
|
return Color.FromArgb(
|
||||||
|
(int)(245 + t * (239 - 245)),
|
||||||
|
(int)(158 + t * (68 - 158)),
|
||||||
|
(int)(11 + t * (68 - 11)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlHeatmapCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
int w = pnlHeatmapCanvas.Width;
|
||||||
|
int h = pnlHeatmapCanvas.Height;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentGrid == null || _heatmapCache == null)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("PDE çözüldüğünde 2B Mekan-Zaman Isı Haritası (Heatmap) burada çizilir.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int padL = 48, padB = 30, padT = 20, padR = 75;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
// Draw heatmap bitmap
|
||||||
|
g.InterpolationMode = InterpolationMode.Bilinear;
|
||||||
|
g.DrawImage(_heatmapCache, new RectangleF(padL, padT, plotW, plotH));
|
||||||
|
|
||||||
|
// Axis box
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grid tick labels
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
decimal L = _currentGrid.XGrid[_currentGrid.XGrid.Length - 1];
|
||||||
|
decimal T = _currentGrid.TGrid[_currentGrid.TGrid.Length - 1];
|
||||||
|
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
float sx = padL + (i / 5f) * plotW;
|
||||||
|
decimal gx = (i / 5m) * L;
|
||||||
|
g.DrawString(Math.Round(gx, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 10, h - padB + 4);
|
||||||
|
|
||||||
|
float sy = padT + (1f - (i / 5f)) * plotH;
|
||||||
|
decimal gt = (i / 5m) * T;
|
||||||
|
g.DrawString(Math.Round(gt, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
g.DrawString("x (Mekan) →", lblFont, lblBrush, padL + plotW * 0.45f, h - padB + 16);
|
||||||
|
g.DrawString("t (Zaman) ↑", lblFont, lblBrush, 4, padT - 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw color bar legend on the right side
|
||||||
|
float cbX = w - padR + 15;
|
||||||
|
float cbW = 16;
|
||||||
|
float cbH = plotH;
|
||||||
|
for (int y = 0; y < (int)cbH; y++)
|
||||||
|
{
|
||||||
|
float norm = 1f - (y / cbH);
|
||||||
|
using (Pen cPen = new Pen(ValueToColormap(norm)))
|
||||||
|
{
|
||||||
|
g.DrawLine(cPen, cbX, padT + y, cbX + cbW, padT + y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using (Pen cbBorder = new Pen(Color.FromArgb(51, 65, 85), 1f))
|
||||||
|
using (Font fMini = new Font("Consolas", 7F))
|
||||||
|
using (Brush bMini = new SolidBrush(Color.FromArgb(226, 232, 240)))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(cbBorder, cbX, padT, cbW, cbH);
|
||||||
|
g.DrawString(Math.Round(_maxU, 2).ToString(CultureInfo.InvariantCulture), fMini, bMini, cbX + cbW + 4, padT - 4);
|
||||||
|
g.DrawString(Math.Round((_maxU + _minU) / 2m, 2).ToString(CultureInfo.InvariantCulture), fMini, bMini, cbX + cbW + 4, padT + cbH * 0.5f - 4);
|
||||||
|
g.DrawString(Math.Round(_minU, 2).ToString(CultureInfo.InvariantCulture), fMini, bMini, cbX + cbW + 4, padT + cbH - 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crosshair & Tooltip
|
||||||
|
if (_heatmapHoverPoint.HasValue && _heatmapHoverData.HasValue)
|
||||||
|
{
|
||||||
|
PointF hp = _heatmapHoverPoint.Value;
|
||||||
|
using (Pen crossPen = new Pen(Color.FromArgb(255, 255, 255), 1f) { DashStyle = DashStyle.Dot })
|
||||||
|
{
|
||||||
|
g.DrawLine(crossPen, hp.X, padT, hp.X, h - padB);
|
||||||
|
g.DrawLine(crossPen, padL, hp.Y, padL + plotW, hp.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
var d = _heatmapHoverData.Value;
|
||||||
|
string tip = $"x = {Math.Round(d.X, 3)}\nt = {Math.Round(d.T, 3)}s\nu = {Math.Round(d.U, 4)}";
|
||||||
|
using (Font tipFont = new Font("Consolas", 8F, FontStyle.Bold))
|
||||||
|
{
|
||||||
|
SizeF sz = g.MeasureString(tip, tipFont);
|
||||||
|
float tx = hp.X + 10;
|
||||||
|
float ty = hp.Y - sz.Height - 6;
|
||||||
|
if (tx + sz.Width + 8 > w) tx = hp.X - sz.Width - 12;
|
||||||
|
if (ty < padT) ty = hp.Y + 12;
|
||||||
|
|
||||||
|
RectangleF tr = new RectangleF(tx, ty, sz.Width + 8, sz.Height + 6);
|
||||||
|
using (Brush bg = new SolidBrush(Color.FromArgb(240, 24, 33, 52)))
|
||||||
|
using (Pen bp = new Pen(Color.FromArgb(56, 189, 248), 1.2f))
|
||||||
|
using (Brush txtB = new SolidBrush(Color.White))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bg, tr);
|
||||||
|
g.DrawRectangle(bp, tr.X, tr.Y, tr.Width, tr.Height);
|
||||||
|
g.DrawString(tip, tipFont, txtB, tx + 4, ty + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlHeatmapCanvas_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
int w = pnlHeatmapCanvas.Width;
|
||||||
|
int h = pnlHeatmapCanvas.Height;
|
||||||
|
int padL = 48, padB = 30, padT = 20, padR = 75;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
if (e.X >= padL && e.X <= padL + plotW && e.Y >= padT && e.Y <= padT + plotH)
|
||||||
|
{
|
||||||
|
float relX = (e.X - padL) / plotW;
|
||||||
|
float relY = 1f - ((e.Y - padT) / plotH); // 0 at bottom, 1 at top
|
||||||
|
|
||||||
|
int nx = _currentGrid.XGrid.Length;
|
||||||
|
int nt = _currentGrid.TGrid.Length;
|
||||||
|
|
||||||
|
int xi = Math.Max(0, Math.Min(nx - 1, (int)(relX * (nx - 1))));
|
||||||
|
int ti = Math.Max(0, Math.Min(nt - 1, (int)(relY * (nt - 1))));
|
||||||
|
|
||||||
|
decimal xVal = _currentGrid.XGrid[xi];
|
||||||
|
decimal tVal = _currentGrid.TGrid[ti];
|
||||||
|
decimal uVal = _currentGrid.U[xi, ti];
|
||||||
|
|
||||||
|
_heatmapHoverPoint = new PointF(e.X, e.Y);
|
||||||
|
_heatmapHoverData = (xVal, tVal, uVal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_heatmapHoverPoint = null;
|
||||||
|
_heatmapHoverData = null;
|
||||||
|
}
|
||||||
|
pnlHeatmapCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleAnimation()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
if (_animTimer.Enabled)
|
||||||
|
{
|
||||||
|
_animTimer.Stop();
|
||||||
|
btnPlayPause.Text = "▶ Oynat";
|
||||||
|
btnPlayPause.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_animTimer.Start();
|
||||||
|
btnPlayPause.Text = "⏸ Durdur";
|
||||||
|
btnPlayPause.BackColor = Color.FromArgb(239, 68, 68);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AdvanceAnimation()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
int nt = _currentGrid.TGrid.Length;
|
||||||
|
int speed = cmbAnimSpeed.SelectedIndex == 1 ? 2 : (cmbAnimSpeed.SelectedIndex == 2 ? 5 : 1);
|
||||||
|
int next = (trkTimeStep.Value + speed) % nt;
|
||||||
|
trkTimeStep.Value = next;
|
||||||
|
UpdateAnimationDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAnimSpeed()
|
||||||
|
{
|
||||||
|
// Speed adjusted in AdvanceAnimation
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAnimationDisplay()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
int curStep = trkTimeStep.Value;
|
||||||
|
decimal curT = _currentGrid.TGrid[curStep];
|
||||||
|
lblCurrentTime.Text = $"t = {curT:F3}s ({curStep}/{_currentGrid.TGrid.Length - 1})";
|
||||||
|
pnlAnimCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlAnimCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
int w = pnlAnimCanvas.Width;
|
||||||
|
int h = pnlAnimCanvas.Height;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentGrid == null)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("PDE çözüldükten sonra canlı dalga/ısı animasyonu burada oynatılır.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int curStep = Math.Min(trkTimeStep.Value, _currentGrid.TGrid.Length - 1);
|
||||||
|
int nx = _currentGrid.XGrid.Length;
|
||||||
|
decimal L = _currentGrid.XGrid[nx - 1];
|
||||||
|
|
||||||
|
int padL = 45, padB = 30, padT = 30, padR = 25;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
decimal spanU = _maxU - _minU;
|
||||||
|
if (spanU == 0m) spanU = 1m;
|
||||||
|
decimal yMin = _minU - spanU * 0.1m;
|
||||||
|
decimal yMax = _maxU + spanU * 0.1m;
|
||||||
|
decimal ySpan = yMax - yMin;
|
||||||
|
|
||||||
|
float ToScreenX(decimal x) => padL + (float)(x / L * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal u) => padT + (float)((yMax - u) / ySpan * (decimal)plotH);
|
||||||
|
|
||||||
|
// Grid & Ticks
|
||||||
|
using (Pen gridPen = new Pen(Color.FromArgb(24, 33, 52), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(100, 116, 139)))
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
decimal gx = (i / 5m) * L;
|
||||||
|
float sx = ToScreenX(gx);
|
||||||
|
g.DrawLine(gridPen, sx, padT, sx, h - padB);
|
||||||
|
g.DrawString(Math.Round(gx, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 10, h - padB + 4);
|
||||||
|
|
||||||
|
decimal gy = yMin + (ySpan * i / 5m);
|
||||||
|
float sy = ToScreenY(gy);
|
||||||
|
g.DrawLine(gridPen, padL, sy, w - padR, sy);
|
||||||
|
g.DrawString(Math.Round(gy, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zero line
|
||||||
|
float zeroY = ToScreenY(0m);
|
||||||
|
if (zeroY >= padT && zeroY <= h - padB)
|
||||||
|
{
|
||||||
|
using (Pen zeroPen = new Pen(Color.FromArgb(71, 85, 105), 1.2f))
|
||||||
|
{
|
||||||
|
g.DrawLine(zeroPen, padL, zeroY, w - padR, zeroY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Box
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build polygon for area fill under the curve
|
||||||
|
List<PointF> curvePts = new List<PointF>(nx);
|
||||||
|
for (int i = 0; i < nx; i++)
|
||||||
|
{
|
||||||
|
decimal x = _currentGrid.XGrid[i];
|
||||||
|
decimal u = _currentGrid.U[i, curStep];
|
||||||
|
curvePts.Add(new PointF(ToScreenX(x), ToScreenY(u)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Area fill
|
||||||
|
List<PointF> polyPts = new List<PointF>(curvePts);
|
||||||
|
polyPts.Add(new PointF(padL + plotW, ToScreenY(0m)));
|
||||||
|
polyPts.Add(new PointF(padL, ToScreenY(0m)));
|
||||||
|
|
||||||
|
using (Brush fillBrush = new SolidBrush(Color.FromArgb(40, 56, 189, 248)))
|
||||||
|
{
|
||||||
|
g.FillPolygon(fillBrush, polyPts.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Curve line
|
||||||
|
using (Pen linePen = new Pen(Color.FromArgb(56, 189, 248), 2.5f))
|
||||||
|
{
|
||||||
|
linePen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < curvePts.Count - 1; i++)
|
||||||
|
{
|
||||||
|
g.DrawLine(linePen, curvePts[i], curvePts[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title
|
||||||
|
decimal curT = _currentGrid.TGrid[curStep];
|
||||||
|
using (Font titleF = new Font("Segoe UI Semibold", 9F, FontStyle.Bold))
|
||||||
|
using (Brush txtB = new SolidBrush(Color.FromArgb(52, 211, 153)))
|
||||||
|
{
|
||||||
|
g.DrawString($"u(x) Mekansal Dalga Profili ── t = {curT:F3} sn (Adım: {curStep})", titleF, txtB, padL + 6, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulateSnapshotTable(DifferentialEquations.PdeSolutionGrid grid, int nx, int nt)
|
||||||
|
{
|
||||||
|
dgvSnapshots.Columns.Clear();
|
||||||
|
dgvSnapshots.Columns.Add("x", "Mekan (x)");
|
||||||
|
dgvSnapshots.Columns["x"].Width = 85;
|
||||||
|
|
||||||
|
int[] snapSteps = { 0, nt / 4, nt / 2, (3 * nt) / 4, nt - 1 };
|
||||||
|
for (int s = 0; s < snapSteps.Length; s++)
|
||||||
|
{
|
||||||
|
int stepIdx = snapSteps[s];
|
||||||
|
decimal tVal = grid.TGrid[stepIdx];
|
||||||
|
dgvSnapshots.Columns.Add("t" + s, $"u(x, t={tVal:F2})");
|
||||||
|
}
|
||||||
|
|
||||||
|
dgvSnapshots.Rows.Clear();
|
||||||
|
for (int i = 0; i < nx; i++)
|
||||||
|
{
|
||||||
|
object[] row = new object[1 + snapSteps.Length];
|
||||||
|
row[0] = Math.Round(grid.XGrid[i], 3).ToString(CultureInfo.InvariantCulture);
|
||||||
|
for (int s = 0; s < snapSteps.Length; s++)
|
||||||
|
{
|
||||||
|
decimal u = grid.U[i, snapSteps[s]];
|
||||||
|
row[1 + s] = Math.Round(u, 5).ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
dgvSnapshots.Rows.Add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyGridAsTsv()
|
||||||
|
{
|
||||||
|
if (dgvSnapshots.Rows.Count == 0) return;
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
List<string> headers = new List<string>();
|
||||||
|
foreach (DataGridViewColumn col in dgvSnapshots.Columns) headers.Add(col.HeaderText);
|
||||||
|
sb.AppendLine(string.Join("\t", headers));
|
||||||
|
|
||||||
|
foreach (DataGridViewRow r in dgvSnapshots.Rows)
|
||||||
|
{
|
||||||
|
List<string> vals = new List<string>();
|
||||||
|
for (int i = 0; i < dgvSnapshots.Columns.Count; i++) vals.Add(r.Cells[i].Value?.ToString() ?? "");
|
||||||
|
sb.AppendLine(string.Join("\t", vals));
|
||||||
|
}
|
||||||
|
Clipboard.SetText(sb.ToString());
|
||||||
|
MessageBox.Show("Zaman kesitleri tablosu panoya (TSV formatında) kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExportHeatmapAsPng()
|
||||||
|
{
|
||||||
|
if (_heatmapCache == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Önce PDE simülasyonunu çözünüz.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
sfd.Filter = "PNG Resmi (*.png)|*.png";
|
||||||
|
sfd.FileName = "1D_PDE_Isi_Haritasi.png";
|
||||||
|
if (sfd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
using (Bitmap bmp = new Bitmap(1200, 800))
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
// Render into 1200x800 bitmap
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
g.DrawImage(_heatmapCache, new Rectangle(60, 40, 1050, 700));
|
||||||
|
bmp.Save(sfd.FileName, ImageFormat.Png);
|
||||||
|
}
|
||||||
|
MessageBox.Show("Isı haritası yüksek çözünürlükte (1200x800) başarıyla kaydedildi!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ namespace MathApp.Controls
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
||||||
"Kısmi Diferansiyel Denklem Sistemi Çözücü (Coupled PDE System)",
|
"Kısmi Diferansiyel Denklem Sistemi Çözücü (Coupled PDE System / Reaksiyon-Difüzyon)",
|
||||||
"Bağlaşımlı Reaksiyon-Difüzyon Kısmi Diferansiyel Denklem Sistemlerini (u_t = Du·u_xx + F(u,v), v_t = Dv·v_xx + G(u,v)) çözer.");
|
"Bağlaşımlı Reaksiyon-Difüzyon sistemlerini (Gray-Scott, Schnakenberg, FitzHugh-Nagumo) çözer; canlı çift konsantrasyon dalgaları ve 2B Turing deseni haritası sunar.");
|
||||||
|
|
||||||
this.pnlControls = new Panel();
|
this.pnlControls = new Panel();
|
||||||
this.pnlPresets = new FlowLayoutPanel();
|
this.pnlPresets = new FlowLayoutPanel();
|
||||||
|
|
@ -58,190 +58,222 @@ namespace MathApp.Controls
|
||||||
this.lblNt = new Label();
|
this.lblNt = new Label();
|
||||||
this.numNt = new NumericUpDown();
|
this.numNt = new NumericUpDown();
|
||||||
|
|
||||||
this.btnSolve = ThemeHelper.CreateActionButton("🚀 PDE Sistemini Çöz", 160, 32, true);
|
this.btnSolve = ThemeHelper.CreateActionButton("🌀 Sistemi Çöz & Deseni Çiz", 200, 32, true);
|
||||||
this.btnCopy = ThemeHelper.CreateCopyButton("📋 Tabloyu Kopyala");
|
|
||||||
|
|
||||||
this.pnlCardResult = new Panel();
|
// TabControl for Visualizations
|
||||||
this.lblSummary = new Label();
|
this.tabSystemVisual = new TabControl();
|
||||||
this.lblDetails = new Label();
|
|
||||||
|
|
||||||
|
// Tab 1: Dual Concentration Profile & Animation
|
||||||
|
this.tabDualProfile = new TabPage();
|
||||||
|
this.pnlAnimToolbar = new Panel();
|
||||||
|
this.btnPlayPause = new Button();
|
||||||
|
this.lblCurrentTime = new Label();
|
||||||
|
this.trkTimeStep = new TrackBar();
|
||||||
|
this.lblAnimSpeed = new Label();
|
||||||
|
this.cmbAnimSpeed = new ComboBox();
|
||||||
|
this.pnlDualCanvas = new Panel();
|
||||||
|
|
||||||
|
// Tab 2: Turing Pattern Heatmap
|
||||||
|
this.tabTuringHeatmap = new TabPage();
|
||||||
|
this.pnlHeatmapHeader = new Panel();
|
||||||
|
this.lblHeatmapTitle = new Label();
|
||||||
|
this.lblHeatmapLegend = new Label();
|
||||||
|
this.btnExportHeatmapPng = new Button();
|
||||||
|
this.pnlTuringCanvas = new Panel();
|
||||||
|
|
||||||
|
// Tab 3: Phase Space (u vs v)
|
||||||
|
this.tabPhaseSpace = new TabPage();
|
||||||
|
this.pnlPhaseCanvas = new Panel();
|
||||||
|
|
||||||
|
// Tab 4: Text Report
|
||||||
|
this.tabReport = new TabPage();
|
||||||
|
this.pnlReportToolbar = new Panel();
|
||||||
|
this.btnExportCsv = ThemeHelper.CreateCopyButton("💾 CSV Olarak Kaydet");
|
||||||
this.txtOutput = new RichTextBox();
|
this.txtOutput = new RichTextBox();
|
||||||
|
|
||||||
this.pnlControls.SuspendLayout();
|
this.pnlControls.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNx)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNx)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNt)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNt)).BeginInit();
|
||||||
this.pnlCardResult.SuspendLayout();
|
this.tabSystemVisual.SuspendLayout();
|
||||||
|
this.tabDualProfile.SuspendLayout();
|
||||||
|
this.pnlAnimToolbar.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trkTimeStep)).BeginInit();
|
||||||
|
this.tabTuringHeatmap.SuspendLayout();
|
||||||
|
this.pnlHeatmapHeader.SuspendLayout();
|
||||||
|
this.tabPhaseSpace.SuspendLayout();
|
||||||
|
this.tabReport.SuspendLayout();
|
||||||
|
this.pnlReportToolbar.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
|
||||||
// pnlControls
|
// pnlControls
|
||||||
this.pnlControls.Dock = DockStyle.Top;
|
this.pnlControls.Dock = DockStyle.Top;
|
||||||
this.pnlControls.Height = 175;
|
this.pnlControls.Height = 168;
|
||||||
this.pnlControls.BackColor = ThemeHelper.DarkBackground;
|
this.pnlControls.BackColor = Color.FromArgb(20, 28, 48);
|
||||||
this.pnlControls.Padding = new Padding(24, 8, 24, 8);
|
this.pnlControls.Padding = new Padding(20, 6, 20, 6);
|
||||||
|
|
||||||
this.lblPresets.Text = "Hazır Modeller:";
|
this.lblPresets.Text = "⚡ Reaksiyon Modelleri:";
|
||||||
this.lblPresets.AutoSize = true;
|
this.lblPresets.AutoSize = true;
|
||||||
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
||||||
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
||||||
|
|
||||||
this.pnlPresets.Location = new Point(24, 8);
|
this.pnlPresets.Location = new Point(20, 6);
|
||||||
this.pnlPresets.Size = new Size(880, 32);
|
this.pnlPresets.Size = new Size(900, 32);
|
||||||
this.pnlPresets.Controls.Add(this.lblPresets);
|
this.pnlPresets.Controls.Add(this.lblPresets);
|
||||||
this.pnlPresets.Controls.Add(this.btnExGrayScott);
|
this.pnlPresets.Controls.Add(this.btnExGrayScott);
|
||||||
this.pnlPresets.Controls.Add(this.btnExSchnakenberg);
|
this.pnlPresets.Controls.Add(this.btnExSchnakenberg);
|
||||||
this.pnlPresets.Controls.Add(this.btnExFitzHugh);
|
this.pnlPresets.Controls.Add(this.btnExFitzHugh);
|
||||||
this.pnlPresets.Controls.Add(this.btnExDiffusion);
|
this.pnlPresets.Controls.Add(this.btnExDiffusion);
|
||||||
|
|
||||||
int y1 = 44;
|
int yRow1 = 44;
|
||||||
this.lblReactionF.Text = "F(u, v) [u reaksiyonu]:";
|
this.lblReactionF.Text = "F(u, v):";
|
||||||
this.lblReactionF.Location = new Point(24, y1 + 4);
|
this.lblReactionF.Location = new Point(20, yRow1 + 3);
|
||||||
this.lblReactionF.AutoSize = true;
|
this.lblReactionF.AutoSize = true;
|
||||||
this.lblReactionF.ForeColor = Color.FromArgb(147, 197, 253);
|
this.lblReactionF.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblReactionF.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
|
||||||
this.txtReactionF.Location = new Point(160, y1);
|
this.txtReactionF.Location = new Point(70, yRow1);
|
||||||
this.txtReactionF.Size = new Size(270, 25);
|
this.txtReactionF.Size = new Size(220, 24);
|
||||||
this.txtReactionF.Text = "-u * v^2 + 0.04 * (1 - u)";
|
this.txtReactionF.Text = "-u*v^2 + 0.03*(1 - u)";
|
||||||
this.txtReactionF.Font = new Font("Consolas", 10F);
|
this.txtReactionF.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtReactionF.BackColor = ThemeHelper.CardBackground;
|
this.txtReactionF.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtReactionF.ForeColor = Color.White;
|
this.txtReactionF.ForeColor = Color.White;
|
||||||
this.txtReactionF.BorderStyle = BorderStyle.FixedSingle;
|
this.txtReactionF.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
this.lblReactionG.Text = "G(u, v) [v reaksiyonu]:";
|
this.lblReactionG.Text = "G(u, v):";
|
||||||
this.lblReactionG.Location = new Point(450, y1 + 4);
|
this.lblReactionG.Location = new Point(300, yRow1 + 3);
|
||||||
this.lblReactionG.AutoSize = true;
|
this.lblReactionG.AutoSize = true;
|
||||||
this.lblReactionG.ForeColor = Color.FromArgb(249, 168, 212);
|
this.lblReactionG.ForeColor = Color.FromArgb(244, 63, 94);
|
||||||
|
this.lblReactionG.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
|
||||||
this.txtReactionG.Location = new Point(590, y1);
|
this.txtReactionG.Location = new Point(355, yRow1);
|
||||||
this.txtReactionG.Size = new Size(270, 25);
|
this.txtReactionG.Size = new Size(220, 24);
|
||||||
this.txtReactionG.Text = "u * v^2 - 0.09 * v";
|
this.txtReactionG.Text = "u*v^2 - (0.03 + 0.062)*v";
|
||||||
this.txtReactionG.Font = new Font("Consolas", 10F);
|
this.txtReactionG.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtReactionG.BackColor = ThemeHelper.CardBackground;
|
this.txtReactionG.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtReactionG.ForeColor = Color.White;
|
this.txtReactionG.ForeColor = Color.White;
|
||||||
this.txtReactionG.BorderStyle = BorderStyle.FixedSingle;
|
this.txtReactionG.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
int y2 = 78;
|
|
||||||
this.lblInitU.Text = "u(x, 0) =";
|
|
||||||
this.lblInitU.Location = new Point(24, y2 + 4);
|
|
||||||
this.lblInitU.AutoSize = true;
|
|
||||||
this.lblInitU.ForeColor = ThemeHelper.LightText;
|
|
||||||
|
|
||||||
this.txtInitU.Location = new Point(80, y2);
|
|
||||||
this.txtInitU.Size = new Size(160, 25);
|
|
||||||
this.txtInitU.Text = "1 - 0.5 * exp(-100*(x-0.5)^2)";
|
|
||||||
this.txtInitU.Font = new Font("Consolas", 9.5F);
|
|
||||||
this.txtInitU.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtInitU.ForeColor = Color.White;
|
|
||||||
this.txtInitU.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblInitV.Text = "v(x, 0) =";
|
|
||||||
this.lblInitV.Location = new Point(255, y2 + 4);
|
|
||||||
this.lblInitV.AutoSize = true;
|
|
||||||
this.lblInitV.ForeColor = ThemeHelper.LightText;
|
|
||||||
|
|
||||||
this.txtInitV.Location = new Point(310, y2);
|
|
||||||
this.txtInitV.Size = new Size(160, 25);
|
|
||||||
this.txtInitV.Text = "0.25 * exp(-100*(x-0.5)^2)";
|
|
||||||
this.txtInitV.Font = new Font("Consolas", 9.5F);
|
|
||||||
this.txtInitV.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtInitV.ForeColor = Color.White;
|
|
||||||
this.txtInitV.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblDu.Text = "Du:";
|
this.lblDu.Text = "Du:";
|
||||||
this.lblDu.Location = new Point(485, y2 + 4);
|
this.lblDu.Location = new Point(590, yRow1 + 3);
|
||||||
this.lblDu.AutoSize = true;
|
this.lblDu.AutoSize = true;
|
||||||
this.lblDu.ForeColor = ThemeHelper.LightText;
|
this.lblDu.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtDu.Location = new Point(515, y2);
|
this.txtDu.Location = new Point(620, yRow1);
|
||||||
this.txtDu.Size = new Size(55, 25);
|
this.txtDu.Size = new Size(60, 24);
|
||||||
this.txtDu.Text = "0.001";
|
this.txtDu.Text = "0.00002";
|
||||||
this.txtDu.Font = new Font("Consolas", 9.5F);
|
this.txtDu.Font = new Font("Consolas", 9F);
|
||||||
this.txtDu.BackColor = ThemeHelper.CardBackground;
|
this.txtDu.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtDu.ForeColor = Color.White;
|
this.txtDu.ForeColor = Color.White;
|
||||||
this.txtDu.BorderStyle = BorderStyle.FixedSingle;
|
this.txtDu.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
this.lblDv.Text = "Dv:";
|
this.lblDv.Text = "Dv:";
|
||||||
this.lblDv.Location = new Point(585, y2 + 4);
|
this.lblDv.Location = new Point(690, yRow1 + 3);
|
||||||
this.lblDv.AutoSize = true;
|
this.lblDv.AutoSize = true;
|
||||||
this.lblDv.ForeColor = ThemeHelper.LightText;
|
this.lblDv.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtDv.Location = new Point(615, y2);
|
this.txtDv.Location = new Point(720, yRow1);
|
||||||
this.txtDv.Size = new Size(55, 25);
|
this.txtDv.Size = new Size(60, 24);
|
||||||
this.txtDv.Text = "0.0005";
|
this.txtDv.Text = "0.00001";
|
||||||
this.txtDv.Font = new Font("Consolas", 9.5F);
|
this.txtDv.Font = new Font("Consolas", 9F);
|
||||||
this.txtDv.BackColor = ThemeHelper.CardBackground;
|
this.txtDv.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtDv.ForeColor = Color.White;
|
this.txtDv.ForeColor = Color.White;
|
||||||
this.txtDv.BorderStyle = BorderStyle.FixedSingle;
|
this.txtDv.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
int yRow2 = 80;
|
||||||
|
this.lblInitU.Text = "u(x, 0):";
|
||||||
|
this.lblInitU.Location = new Point(20, yRow2 + 3);
|
||||||
|
this.lblInitU.AutoSize = true;
|
||||||
|
this.lblInitU.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
|
this.txtInitU.Location = new Point(70, yRow2);
|
||||||
|
this.txtInitU.Size = new Size(130, 24);
|
||||||
|
this.txtInitU.Text = "1 - exp(-100*(x-0.5)^2)";
|
||||||
|
this.txtInitU.Font = new Font("Consolas", 9F);
|
||||||
|
this.txtInitU.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtInitU.ForeColor = Color.White;
|
||||||
|
this.txtInitU.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
this.lblInitV.Text = "v(x, 0):";
|
||||||
|
this.lblInitV.Location = new Point(210, yRow2 + 3);
|
||||||
|
this.lblInitV.AutoSize = true;
|
||||||
|
this.lblInitV.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
|
this.txtInitV.Location = new Point(260, yRow2);
|
||||||
|
this.txtInitV.Size = new Size(130, 24);
|
||||||
|
this.txtInitV.Text = "exp(-100*(x-0.5)^2)";
|
||||||
|
this.txtInitV.Font = new Font("Consolas", 9F);
|
||||||
|
this.txtInitV.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtInitV.ForeColor = Color.White;
|
||||||
|
this.txtInitV.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
this.lblL.Text = "L:";
|
this.lblL.Text = "L:";
|
||||||
this.lblL.Location = new Point(685, y2 + 4);
|
this.lblL.Location = new Point(400, yRow2 + 3);
|
||||||
this.lblL.AutoSize = true;
|
this.lblL.AutoSize = true;
|
||||||
this.lblL.ForeColor = ThemeHelper.LightText;
|
this.lblL.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtL.Location = new Point(705, y2);
|
this.txtL.Location = new Point(420, yRow2);
|
||||||
this.txtL.Size = new Size(40, 25);
|
this.txtL.Size = new Size(40, 24);
|
||||||
this.txtL.Text = "1";
|
this.txtL.Text = "1";
|
||||||
this.txtL.Font = new Font("Consolas", 9.5F);
|
this.txtL.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtL.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtL.ForeColor = Color.White;
|
this.txtL.ForeColor = Color.White;
|
||||||
this.txtL.BorderStyle = BorderStyle.FixedSingle;
|
this.txtL.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtL.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblT.Text = "T:";
|
this.lblT.Text = "T:";
|
||||||
this.lblT.Location = new Point(755, y2 + 4);
|
this.lblT.Location = new Point(468, yRow2 + 3);
|
||||||
this.lblT.AutoSize = true;
|
this.lblT.AutoSize = true;
|
||||||
this.lblT.ForeColor = ThemeHelper.LightText;
|
this.lblT.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.txtT.Location = new Point(775, y2);
|
this.txtT.Location = new Point(488, yRow2);
|
||||||
this.txtT.Size = new Size(40, 25);
|
this.txtT.Size = new Size(45, 24);
|
||||||
this.txtT.Text = "1.0";
|
this.txtT.Text = "50";
|
||||||
this.txtT.Font = new Font("Consolas", 9.5F);
|
this.txtT.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtT.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtT.ForeColor = Color.White;
|
this.txtT.ForeColor = Color.White;
|
||||||
this.txtT.BorderStyle = BorderStyle.FixedSingle;
|
this.txtT.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtT.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
this.lblNx.Text = "Nx:";
|
this.lblNx.Text = "Nx:";
|
||||||
this.lblNx.Location = new Point(825, y2 + 4);
|
this.lblNx.Location = new Point(540, yRow2 + 3);
|
||||||
this.lblNx.AutoSize = true;
|
this.lblNx.AutoSize = true;
|
||||||
this.lblNx.ForeColor = ThemeHelper.LightText;
|
this.lblNx.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.numNx.Location = new Point(855, y2);
|
this.numNx.Location = new Point(568, yRow2);
|
||||||
this.numNx.Size = new Size(45, 25);
|
this.numNx.Size = new Size(48, 24);
|
||||||
this.numNx.Minimum = 5;
|
this.numNx.Minimum = 10;
|
||||||
this.numNx.Maximum = 200;
|
this.numNx.Maximum = 300;
|
||||||
this.numNx.Value = 25;
|
this.numNx.Value = 60;
|
||||||
this.numNx.BackColor = ThemeHelper.CardBackground;
|
this.numNx.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numNx.ForeColor = Color.White;
|
this.numNx.ForeColor = Color.White;
|
||||||
|
|
||||||
int y3 = 120;
|
this.lblNt.Text = "Nt:";
|
||||||
this.lblNt.Text = "Zaman Adımı (Nt):";
|
this.lblNt.Location = new Point(622, yRow2 + 3);
|
||||||
this.lblNt.Location = new Point(24, y3 + 6);
|
|
||||||
this.lblNt.AutoSize = true;
|
this.lblNt.AutoSize = true;
|
||||||
this.lblNt.ForeColor = ThemeHelper.LightText;
|
this.lblNt.ForeColor = ThemeHelper.LightText;
|
||||||
|
|
||||||
this.numNt.Location = new Point(135, y3 + 2);
|
this.numNt.Location = new Point(650, yRow2);
|
||||||
this.numNt.Size = new Size(60, 25);
|
this.numNt.Size = new Size(52, 24);
|
||||||
this.numNt.Minimum = 10;
|
this.numNt.Minimum = 10;
|
||||||
this.numNt.Maximum = 2000;
|
this.numNt.Maximum = 2000;
|
||||||
this.numNt.Value = 150;
|
this.numNt.Value = 250;
|
||||||
this.numNt.BackColor = ThemeHelper.CardBackground;
|
this.numNt.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.numNt.ForeColor = Color.White;
|
this.numNt.ForeColor = Color.White;
|
||||||
|
|
||||||
this.btnSolve.Location = new Point(220, y3);
|
this.btnSolve.Location = new Point(715, yRow2 - 2);
|
||||||
this.btnCopy.Location = new Point(390, y3);
|
|
||||||
|
|
||||||
this.pnlControls.Controls.Add(this.pnlPresets);
|
this.pnlControls.Controls.Add(this.pnlPresets);
|
||||||
this.pnlControls.Controls.Add(this.lblReactionF);
|
this.pnlControls.Controls.Add(this.lblReactionF);
|
||||||
this.pnlControls.Controls.Add(this.txtReactionF);
|
this.pnlControls.Controls.Add(this.txtReactionF);
|
||||||
this.pnlControls.Controls.Add(this.lblReactionG);
|
this.pnlControls.Controls.Add(this.lblReactionG);
|
||||||
this.pnlControls.Controls.Add(this.txtReactionG);
|
this.pnlControls.Controls.Add(this.txtReactionG);
|
||||||
this.pnlControls.Controls.Add(this.lblInitU);
|
|
||||||
this.pnlControls.Controls.Add(this.txtInitU);
|
|
||||||
this.pnlControls.Controls.Add(this.lblInitV);
|
|
||||||
this.pnlControls.Controls.Add(this.txtInitV);
|
|
||||||
this.pnlControls.Controls.Add(this.lblDu);
|
this.pnlControls.Controls.Add(this.lblDu);
|
||||||
this.pnlControls.Controls.Add(this.txtDu);
|
this.pnlControls.Controls.Add(this.txtDu);
|
||||||
this.pnlControls.Controls.Add(this.lblDv);
|
this.pnlControls.Controls.Add(this.lblDv);
|
||||||
this.pnlControls.Controls.Add(this.txtDv);
|
this.pnlControls.Controls.Add(this.txtDv);
|
||||||
|
this.pnlControls.Controls.Add(this.lblInitU);
|
||||||
|
this.pnlControls.Controls.Add(this.txtInitU);
|
||||||
|
this.pnlControls.Controls.Add(this.lblInitV);
|
||||||
|
this.pnlControls.Controls.Add(this.txtInitV);
|
||||||
this.pnlControls.Controls.Add(this.lblL);
|
this.pnlControls.Controls.Add(this.lblL);
|
||||||
this.pnlControls.Controls.Add(this.txtL);
|
this.pnlControls.Controls.Add(this.txtL);
|
||||||
this.pnlControls.Controls.Add(this.lblT);
|
this.pnlControls.Controls.Add(this.lblT);
|
||||||
|
|
@ -251,53 +283,180 @@ namespace MathApp.Controls
|
||||||
this.pnlControls.Controls.Add(this.lblNt);
|
this.pnlControls.Controls.Add(this.lblNt);
|
||||||
this.pnlControls.Controls.Add(this.numNt);
|
this.pnlControls.Controls.Add(this.numNt);
|
||||||
this.pnlControls.Controls.Add(this.btnSolve);
|
this.pnlControls.Controls.Add(this.btnSolve);
|
||||||
this.pnlControls.Controls.Add(this.btnCopy);
|
|
||||||
|
|
||||||
// pnlCardResult
|
// ================== TABBED VISUALS ==================
|
||||||
this.pnlCardResult.Dock = DockStyle.Top;
|
this.tabSystemVisual.Dock = DockStyle.Fill;
|
||||||
this.pnlCardResult.Height = 65;
|
this.tabSystemVisual.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.pnlCardResult.BackColor = ThemeHelper.CardBackground;
|
this.tabSystemVisual.Padding = new Point(12, 4);
|
||||||
this.pnlCardResult.Padding = new Padding(20, 8, 20, 8);
|
|
||||||
|
|
||||||
this.lblSummary.Dock = DockStyle.Top;
|
// Tab 1: Dual Concentration Profile
|
||||||
this.lblSummary.Height = 26;
|
this.tabDualProfile.Text = "Çift Konsantrasyon Profili u(x) & v(x)";
|
||||||
this.lblSummary.Font = new Font("Segoe UI Semibold", 12F, FontStyle.Bold);
|
this.tabDualProfile.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.lblSummary.ForeColor = Color.FromArgb(52, 211, 153);
|
this.tabDualProfile.Padding = new Padding(8);
|
||||||
this.lblSummary.Text = "PDE Sistemi: Çözüm Bekleniyor";
|
|
||||||
|
|
||||||
this.lblDetails.Dock = DockStyle.Bottom;
|
this.pnlAnimToolbar.Dock = DockStyle.Top;
|
||||||
this.lblDetails.Height = 20;
|
this.pnlAnimToolbar.Height = 44;
|
||||||
this.lblDetails.Font = new Font("Segoe UI", 9F);
|
this.pnlAnimToolbar.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
this.lblDetails.ForeColor = ThemeHelper.MutedText;
|
this.pnlAnimToolbar.Padding = new Padding(8, 6, 8, 6);
|
||||||
this.lblDetails.Text = "Hazır modelleri seçebilir veya kendi reaksiyon denklemlerinizi yazabilirsiniz.";
|
|
||||||
|
|
||||||
this.pnlCardResult.Controls.Add(this.lblDetails);
|
this.btnPlayPause.Text = "▶ Oynat";
|
||||||
this.pnlCardResult.Controls.Add(this.lblSummary);
|
this.btnPlayPause.Dock = DockStyle.Left;
|
||||||
|
this.btnPlayPause.Width = 80;
|
||||||
|
this.btnPlayPause.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnPlayPause.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
this.btnPlayPause.ForeColor = Color.White;
|
||||||
|
this.btnPlayPause.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnPlayPause.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnPlayPause.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.lblCurrentTime.Text = "t = 0.000 s (Adım: 0 / 0)";
|
||||||
|
this.lblCurrentTime.Dock = DockStyle.Left;
|
||||||
|
this.lblCurrentTime.Width = 190;
|
||||||
|
this.lblCurrentTime.Font = new Font("Consolas", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCurrentTime.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblCurrentTime.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
|
||||||
|
this.lblAnimSpeed.Text = "Hız:";
|
||||||
|
this.lblAnimSpeed.Dock = DockStyle.Right;
|
||||||
|
this.lblAnimSpeed.Width = 32;
|
||||||
|
this.lblAnimSpeed.Font = new Font("Segoe UI", 8.5F);
|
||||||
|
this.lblAnimSpeed.ForeColor = ThemeHelper.LightText;
|
||||||
|
this.lblAnimSpeed.TextAlign = ContentAlignment.MiddleRight;
|
||||||
|
|
||||||
|
this.cmbAnimSpeed.Dock = DockStyle.Right;
|
||||||
|
this.cmbAnimSpeed.Width = 65;
|
||||||
|
this.cmbAnimSpeed.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
this.cmbAnimSpeed.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.cmbAnimSpeed.ForeColor = Color.White;
|
||||||
|
this.cmbAnimSpeed.Items.AddRange(new object[] { "1x", "2x", "5x" });
|
||||||
|
this.cmbAnimSpeed.SelectedIndex = 0;
|
||||||
|
|
||||||
|
this.trkTimeStep.Dock = DockStyle.Fill;
|
||||||
|
this.trkTimeStep.Minimum = 0;
|
||||||
|
this.trkTimeStep.Maximum = 100;
|
||||||
|
this.trkTimeStep.Value = 0;
|
||||||
|
this.trkTimeStep.TickStyle = TickStyle.None;
|
||||||
|
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.trkTimeStep);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.lblAnimSpeed);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.cmbAnimSpeed);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.lblCurrentTime);
|
||||||
|
this.pnlAnimToolbar.Controls.Add(this.btnPlayPause);
|
||||||
|
|
||||||
|
this.pnlDualCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlDualCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlDualCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabDualProfile.Controls.Add(this.pnlDualCanvas);
|
||||||
|
this.tabDualProfile.Controls.Add(this.pnlAnimToolbar);
|
||||||
|
|
||||||
|
// Tab 2: Turing Pattern Heatmap
|
||||||
|
this.tabTuringHeatmap.Text = "Mekan-Zaman Turing Deseni";
|
||||||
|
this.tabTuringHeatmap.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabTuringHeatmap.Padding = new Padding(8);
|
||||||
|
|
||||||
|
this.pnlHeatmapHeader.Dock = DockStyle.Top;
|
||||||
|
this.pnlHeatmapHeader.Height = 32;
|
||||||
|
this.pnlHeatmapHeader.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
|
||||||
|
this.lblHeatmapTitle.Text = "🗺️ Desen Morfolojisi u(x, t):";
|
||||||
|
this.lblHeatmapTitle.Dock = DockStyle.Left;
|
||||||
|
this.lblHeatmapTitle.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
this.lblHeatmapTitle.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblHeatmapTitle.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
this.lblHeatmapTitle.Padding = new Padding(8, 0, 0, 0);
|
||||||
|
|
||||||
|
this.lblHeatmapLegend.Text = "Düşük (Mavi) ── Orta (Yeşil/Sarı) ── Yüksek (Kırmızı)";
|
||||||
|
this.lblHeatmapLegend.Dock = DockStyle.Left;
|
||||||
|
this.lblHeatmapLegend.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.lblHeatmapLegend.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblHeatmapLegend.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
this.lblHeatmapLegend.Padding = new Padding(20, 0, 0, 0);
|
||||||
|
|
||||||
|
this.btnExportHeatmapPng.Text = "📷 PNG Kaydet";
|
||||||
|
this.btnExportHeatmapPng.Dock = DockStyle.Right;
|
||||||
|
this.btnExportHeatmapPng.Width = 100;
|
||||||
|
this.btnExportHeatmapPng.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnExportHeatmapPng.BackColor = Color.FromArgb(33, 44, 70);
|
||||||
|
this.btnExportHeatmapPng.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
|
this.btnExportHeatmapPng.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.btnExportHeatmapPng.FlatAppearance.BorderSize = 0;
|
||||||
|
this.btnExportHeatmapPng.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
|
this.pnlHeatmapHeader.Controls.Add(this.lblHeatmapLegend);
|
||||||
|
this.pnlHeatmapHeader.Controls.Add(this.lblHeatmapTitle);
|
||||||
|
this.pnlHeatmapHeader.Controls.Add(this.btnExportHeatmapPng);
|
||||||
|
|
||||||
|
this.pnlTuringCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlTuringCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlTuringCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabTuringHeatmap.Controls.Add(this.pnlTuringCanvas);
|
||||||
|
this.tabTuringHeatmap.Controls.Add(this.pnlHeatmapHeader);
|
||||||
|
|
||||||
|
// Tab 3: Phase Space (u vs v)
|
||||||
|
this.tabPhaseSpace.Text = "Faz Uzayı (u vs v)";
|
||||||
|
this.tabPhaseSpace.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabPhaseSpace.Padding = new Padding(8);
|
||||||
|
|
||||||
|
this.pnlPhaseCanvas.Dock = DockStyle.Fill;
|
||||||
|
this.pnlPhaseCanvas.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
|
this.pnlPhaseCanvas.DoubleBuffered(true);
|
||||||
|
|
||||||
|
this.tabPhaseSpace.Controls.Add(this.pnlPhaseCanvas);
|
||||||
|
|
||||||
|
// Tab 4: Report
|
||||||
|
this.tabReport.Text = "Rapor & Dışa Aktar";
|
||||||
|
this.tabReport.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
this.tabReport.Padding = new Padding(6);
|
||||||
|
|
||||||
|
this.pnlReportToolbar.Dock = DockStyle.Top;
|
||||||
|
this.pnlReportToolbar.Height = 32;
|
||||||
|
this.pnlReportToolbar.BackColor = Color.FromArgb(24, 33, 52);
|
||||||
|
|
||||||
|
this.btnExportCsv.Dock = DockStyle.Right;
|
||||||
|
this.btnExportCsv.Height = 28;
|
||||||
|
this.pnlReportToolbar.Controls.Add(this.btnExportCsv);
|
||||||
|
|
||||||
// txtOutput
|
|
||||||
this.txtOutput.Dock = DockStyle.Fill;
|
this.txtOutput.Dock = DockStyle.Fill;
|
||||||
this.txtOutput.BackColor = Color.FromArgb(11, 17, 32);
|
this.txtOutput.BackColor = Color.FromArgb(11, 15, 28);
|
||||||
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
this.txtOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
this.txtOutput.Font = new Font("Consolas", 9.5F);
|
||||||
this.txtOutput.BorderStyle = BorderStyle.None;
|
this.txtOutput.BorderStyle = BorderStyle.None;
|
||||||
this.txtOutput.ReadOnly = true;
|
this.txtOutput.ReadOnly = true;
|
||||||
|
|
||||||
// Assemble PdeSystemSolverControl
|
this.tabReport.Controls.Add(this.txtOutput);
|
||||||
|
this.tabReport.Controls.Add(this.pnlReportToolbar);
|
||||||
|
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabDualProfile);
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabTuringHeatmap);
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabPhaseSpace);
|
||||||
|
this.tabSystemVisual.TabPages.Add(this.tabReport);
|
||||||
|
|
||||||
|
// Assemble
|
||||||
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = AutoScaleMode.Font;
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.BackColor = ThemeHelper.DarkBackground;
|
this.BackColor = ThemeHelper.DarkBackground;
|
||||||
this.Controls.Add(this.txtOutput);
|
this.Controls.Add(this.tabSystemVisual);
|
||||||
this.Controls.Add(this.pnlCardResult);
|
|
||||||
this.Controls.Add(this.pnlControls);
|
this.Controls.Add(this.pnlControls);
|
||||||
this.Controls.Add(this.pnlHeader);
|
this.Controls.Add(this.pnlHeader);
|
||||||
this.Name = "PdeSystemSolverControl";
|
this.Name = "PdeSystemSolverControl";
|
||||||
this.Size = new Size(960, 680);
|
this.Size = new Size(950, 700);
|
||||||
|
|
||||||
this.pnlControls.ResumeLayout(false);
|
this.pnlControls.ResumeLayout(false);
|
||||||
this.pnlControls.PerformLayout();
|
this.pnlControls.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNx)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNx)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numNt)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numNt)).EndInit();
|
||||||
this.pnlCardResult.ResumeLayout(false);
|
this.tabSystemVisual.ResumeLayout(false);
|
||||||
|
this.tabDualProfile.ResumeLayout(false);
|
||||||
|
this.pnlAnimToolbar.ResumeLayout(false);
|
||||||
|
this.pnlAnimToolbar.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trkTimeStep)).EndInit();
|
||||||
|
this.tabTuringHeatmap.ResumeLayout(false);
|
||||||
|
this.pnlHeatmapHeader.ResumeLayout(false);
|
||||||
|
this.tabPhaseSpace.ResumeLayout(false);
|
||||||
|
this.tabReport.ResumeLayout(false);
|
||||||
|
this.pnlReportToolbar.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,6 +468,7 @@ namespace MathApp.Controls
|
||||||
private Button btnExSchnakenberg;
|
private Button btnExSchnakenberg;
|
||||||
private Button btnExFitzHugh;
|
private Button btnExFitzHugh;
|
||||||
private Button btnExDiffusion;
|
private Button btnExDiffusion;
|
||||||
|
|
||||||
private Label lblReactionF;
|
private Label lblReactionF;
|
||||||
private TextBox txtReactionF;
|
private TextBox txtReactionF;
|
||||||
private Label lblReactionG;
|
private Label lblReactionG;
|
||||||
|
|
@ -330,10 +490,30 @@ namespace MathApp.Controls
|
||||||
private Label lblNt;
|
private Label lblNt;
|
||||||
private NumericUpDown numNt;
|
private NumericUpDown numNt;
|
||||||
private Button btnSolve;
|
private Button btnSolve;
|
||||||
private Button btnCopy;
|
|
||||||
private Panel pnlCardResult;
|
private TabControl tabSystemVisual;
|
||||||
private Label lblSummary;
|
private TabPage tabDualProfile;
|
||||||
private Label lblDetails;
|
private Panel pnlAnimToolbar;
|
||||||
|
private Button btnPlayPause;
|
||||||
|
private Label lblCurrentTime;
|
||||||
|
private TrackBar trkTimeStep;
|
||||||
|
private Label lblAnimSpeed;
|
||||||
|
private ComboBox cmbAnimSpeed;
|
||||||
|
private Panel pnlDualCanvas;
|
||||||
|
|
||||||
|
private TabPage tabTuringHeatmap;
|
||||||
|
private Panel pnlHeatmapHeader;
|
||||||
|
private Label lblHeatmapTitle;
|
||||||
|
private Label lblHeatmapLegend;
|
||||||
|
private Button btnExportHeatmapPng;
|
||||||
|
private Panel pnlTuringCanvas;
|
||||||
|
|
||||||
|
private TabPage tabPhaseSpace;
|
||||||
|
private Panel pnlPhaseCanvas;
|
||||||
|
|
||||||
|
private TabPage tabReport;
|
||||||
|
private Panel pnlReportToolbar;
|
||||||
|
private Button btnExportCsv;
|
||||||
private RichTextBox txtOutput;
|
private RichTextBox txtOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
@ -9,181 +13,629 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
public partial class PdeSystemSolverControl : UserControl
|
public partial class PdeSystemSolverControl : UserControl
|
||||||
{
|
{
|
||||||
|
private DifferentialEquations.PdeSystemSolutionGrid _currentGrid = null;
|
||||||
|
private Bitmap _turingCache = null;
|
||||||
|
private Timer _animTimer = new Timer();
|
||||||
|
private decimal _minU = 0m, _maxU = 1m;
|
||||||
|
private decimal _minV = 0m, _maxV = 1m;
|
||||||
|
|
||||||
|
private PointF? _turingHoverPoint = null;
|
||||||
|
private (decimal X, decimal T, decimal U, decimal V)? _turingHoverData = null;
|
||||||
|
|
||||||
public PdeSystemSolverControl()
|
public PdeSystemSolverControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SetupEvents();
|
|
||||||
SetPresetGrayScott();
|
btnSolve.Click += BtnSolve_Click;
|
||||||
|
btnExportCsv.Click += (s, e) => ExportDataAsCsv();
|
||||||
|
btnExportHeatmapPng.Click += (s, e) => ExportTuringAsPng();
|
||||||
|
|
||||||
|
btnExGrayScott.Click += (s, e) => LoadPreset(
|
||||||
|
"-u*v^2 + 0.03*(1 - u)",
|
||||||
|
"u*v^2 - (0.03 + 0.062)*v",
|
||||||
|
"1 - exp(-120*(x-0.5)^2)",
|
||||||
|
"exp(-120*(x-0.5)^2)",
|
||||||
|
"0.00002", "0.00001", "1", "50", 60, 250);
|
||||||
|
|
||||||
|
btnExSchnakenberg.Click += (s, e) => LoadPreset(
|
||||||
|
"0.1 - u + u^2*v",
|
||||||
|
"0.9 - u^2*v",
|
||||||
|
"1 + 0.1*cos(pi*x)",
|
||||||
|
"0.9 + 0.1*sin(pi*x)",
|
||||||
|
"1", "10", "20", "2", 60, 200);
|
||||||
|
|
||||||
|
btnExFitzHugh.Click += (s, e) => LoadPreset(
|
||||||
|
"u*(u - 0.1)*(1 - u) - v",
|
||||||
|
"0.01*(u - 0.5*v)",
|
||||||
|
"exp(-50*(x-0.2)^2)",
|
||||||
|
"0",
|
||||||
|
"1", "0", "1", "20", 60, 200);
|
||||||
|
|
||||||
|
btnExDiffusion.Click += (s, e) => LoadPreset(
|
||||||
|
"-0.5*u + 0.2*v",
|
||||||
|
"0.2*u - 0.5*v",
|
||||||
|
"exp(-40*(x-0.3)^2)",
|
||||||
|
"exp(-40*(x-0.7)^2)",
|
||||||
|
"0.5", "1", "1", "1", 50, 150);
|
||||||
|
|
||||||
|
btnPlayPause.Click += (s, e) => ToggleAnimation();
|
||||||
|
trkTimeStep.Scroll += (s, e) => UpdateAnimationDisplay();
|
||||||
|
|
||||||
|
_animTimer.Interval = 33;
|
||||||
|
_animTimer.Tick += (s, e) => AdvanceAnimation();
|
||||||
|
|
||||||
|
pnlDualCanvas.Paint += PnlDualCanvas_Paint;
|
||||||
|
pnlDualCanvas.Resize += (s, e) => pnlDualCanvas.Invalidate();
|
||||||
|
|
||||||
|
pnlTuringCanvas.Paint += PnlTuringCanvas_Paint;
|
||||||
|
pnlTuringCanvas.MouseMove += PnlTuringCanvas_MouseMove;
|
||||||
|
pnlTuringCanvas.MouseLeave += (s, e) => { _turingHoverPoint = null; _turingHoverData = null; pnlTuringCanvas.Invalidate(); };
|
||||||
|
pnlTuringCanvas.Resize += (s, e) => pnlTuringCanvas.Invalidate();
|
||||||
|
|
||||||
|
pnlPhaseCanvas.Paint += PnlPhaseCanvas_Paint;
|
||||||
|
pnlPhaseCanvas.Resize += (s, e) => pnlPhaseCanvas.Invalidate();
|
||||||
|
|
||||||
|
// Default
|
||||||
|
LoadPreset(
|
||||||
|
"-u*v^2 + 0.03*(1 - u)",
|
||||||
|
"u*v^2 - (0.03 + 0.062)*v",
|
||||||
|
"1 - exp(-120*(x-0.5)^2)",
|
||||||
|
"exp(-120*(x-0.5)^2)",
|
||||||
|
"0.00002", "0.00001", "1", "50", 60, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupEvents()
|
private void LoadPreset(string f, string g, string u0, string v0, string du, string dv, string L, string T, int Nx, int Nt)
|
||||||
{
|
{
|
||||||
btnSolve.Click += async (s, e) => await SolveAsync();
|
txtReactionF.Text = f;
|
||||||
btnCopy.Click += (s, e) =>
|
txtReactionG.Text = g;
|
||||||
{
|
txtInitU.Text = u0;
|
||||||
if (!string.IsNullOrWhiteSpace(txtOutput.Text))
|
txtInitV.Text = v0;
|
||||||
{
|
txtDu.Text = du;
|
||||||
Clipboard.SetText(txtOutput.Text);
|
txtDv.Text = dv;
|
||||||
MessageBox.Show("Sonuç tablosu panoya kopyalandı.", "Kopyalandı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
txtL.Text = L;
|
||||||
}
|
txtT.Text = T;
|
||||||
};
|
numNx.Value = Nx;
|
||||||
|
numNt.Value = Nt;
|
||||||
|
|
||||||
btnExGrayScott.Click += (s, e) => SetPresetGrayScott();
|
BtnSolve_Click(this, EventArgs.Empty);
|
||||||
btnExSchnakenberg.Click += (s, e) => SetPresetSchnakenberg();
|
|
||||||
btnExFitzHugh.Click += (s, e) => SetPresetFitzHugh();
|
|
||||||
btnExDiffusion.Click += (s, e) => SetPresetDiffusion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPresetGrayScott()
|
private decimal ParseDec(string s, string field)
|
||||||
{
|
{
|
||||||
txtReactionF.Text = "-u * v^2 + 0.04 * (1 - u)";
|
string norm = (s ?? "").Trim().Replace(',', '.');
|
||||||
txtReactionG.Text = "u * v^2 - 0.09 * v";
|
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal v))
|
||||||
txtInitU.Text = "1 - 0.5 * exp(-100 * (x - 0.5)^2)";
|
return v;
|
||||||
txtInitV.Text = "0.25 * exp(-100 * (x - 0.5)^2)";
|
throw new ArgumentException($"'{field}' için geçerli bir sayı giriniz.");
|
||||||
txtDu.Text = "0.001";
|
|
||||||
txtDv.Text = "0.0005";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "1.0";
|
|
||||||
numNx.Value = 25;
|
|
||||||
numNt.Value = 150;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetPresetSchnakenberg()
|
private async void BtnSolve_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
txtReactionF.Text = "0.1 - u + u^2 * v";
|
string origBtnText = btnSolve.Text;
|
||||||
txtReactionG.Text = "0.9 - u^2 * v";
|
btnSolve.Enabled = false;
|
||||||
txtInitU.Text = "1 + 0.1 * cos(2 * pi * x)";
|
btnSolve.Text = "⏳ Desen Simüle Ediliyor...";
|
||||||
txtInitV.Text = "0.9 + 0.1 * cos(2 * pi * x)";
|
Cursor = Cursors.WaitCursor;
|
||||||
txtDu.Text = "0.001";
|
|
||||||
txtDv.Text = "0.01";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "1.0";
|
|
||||||
numNx.Value = 25;
|
|
||||||
numNt.Value = 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetFitzHugh()
|
|
||||||
{
|
|
||||||
txtReactionF.Text = "u - (u^3) / 3 - v";
|
|
||||||
txtReactionG.Text = "0.08 * (u + 0.7 - 0.8 * v)";
|
|
||||||
txtInitU.Text = "exp(-50 * (x - 0.5)^2)";
|
|
||||||
txtInitV.Text = "0";
|
|
||||||
txtDu.Text = "0.005";
|
|
||||||
txtDv.Text = "0.0001";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "2.0";
|
|
||||||
numNx.Value = 25;
|
|
||||||
numNt.Value = 200;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetPresetDiffusion()
|
|
||||||
{
|
|
||||||
txtReactionF.Text = "0";
|
|
||||||
txtReactionG.Text = "0";
|
|
||||||
txtInitU.Text = "sin(pi * x)";
|
|
||||||
txtInitV.Text = "cos(pi * x)";
|
|
||||||
txtDu.Text = "0.05";
|
|
||||||
txtDv.Text = "0.01";
|
|
||||||
txtL.Text = "1";
|
|
||||||
txtT.Text = "0.5";
|
|
||||||
numNx.Value = 25;
|
|
||||||
numNt.Value = 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SolveAsync()
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
btnSolve.Enabled = false;
|
string f = txtReactionF.Text.Trim();
|
||||||
btnSolve.Text = "⏳ Hesaplanıyor...";
|
string g = txtReactionG.Text.Trim();
|
||||||
|
|
||||||
string fU = txtReactionF.Text.Trim();
|
|
||||||
string gV = txtReactionG.Text.Trim();
|
|
||||||
string initU = txtInitU.Text.Trim();
|
string initU = txtInitU.Text.Trim();
|
||||||
string initV = txtInitV.Text.Trim();
|
string initV = txtInitV.Text.Trim();
|
||||||
|
decimal du = ParseDec(txtDu.Text, "Du");
|
||||||
if (!decimal.TryParse(txtDu.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal du))
|
decimal dv = ParseDec(txtDv.Text, "Dv");
|
||||||
du = 0.001m;
|
decimal L = ParseDec(txtL.Text, "Uzunluk L");
|
||||||
if (!decimal.TryParse(txtDv.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal dv))
|
decimal T = ParseDec(txtT.Text, "Süre T");
|
||||||
dv = 0.0005m;
|
int Nx = (int)numNx.Value;
|
||||||
if (!decimal.TryParse(txtL.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal lengthL))
|
int Nt = (int)numNt.Value;
|
||||||
lengthL = 1m;
|
|
||||||
if (!decimal.TryParse(txtT.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal totalTimeT))
|
|
||||||
totalTimeT = 1.0m;
|
|
||||||
|
|
||||||
int nx = (int)numNx.Value;
|
|
||||||
int nt = (int)numNt.Value;
|
|
||||||
|
|
||||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||||
var grid = await Task.Run(() =>
|
var grid = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
return DifferentialEquations.SolveCoupledPdeSystem(
|
bool prevRad = Function.UseRadians;
|
||||||
fU,
|
Function.UseRadians = true;
|
||||||
gV,
|
try
|
||||||
initU,
|
{
|
||||||
initV,
|
return DifferentialEquations.SolveCoupledPdeSystem(f, g, initU, initV, L, T, Nx, Nt, du, dv);
|
||||||
lengthL,
|
}
|
||||||
totalTimeT,
|
finally
|
||||||
nx,
|
{
|
||||||
nt,
|
Function.UseRadians = prevRad;
|
||||||
du,
|
}
|
||||||
dv
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
|
|
||||||
lblSummary.Text = grid.SystemInfo;
|
if (grid != null && grid.U != null && grid.V != null)
|
||||||
decimal dx = lengthL / (nx - 1);
|
{
|
||||||
decimal dt = totalTimeT / (nt - 1);
|
_currentGrid = grid;
|
||||||
lblDetails.Text = $"Izgara: {nx} mekan × {nt} zaman | Boyut: x ∈ [0, {lengthL}], t ∈ [0, {totalTimeT}] | Sıfır-Akı (Neumann) | ⏱️ {sw.ElapsedMilliseconds} ms";
|
|
||||||
|
|
||||||
// Format Table
|
int nx = grid.XGrid.Length;
|
||||||
StringBuilder sb = new StringBuilder();
|
int nt = grid.TGrid.Length;
|
||||||
sb.AppendLine("==========================================================================================");
|
|
||||||
sb.AppendLine("BAĞLAŞIMLI KISMİ DİFERANSİYEL DENKLEM SİSTEMİ (1B REAKSİYON-DİFÜZYON) ÇÖZÜMÜ");
|
|
||||||
sb.AppendLine($"F(u,v) = {fU} | G(u,v) = {gV}");
|
|
||||||
sb.AppendLine($"Du = {du:G4}, Dv = {dv:G4}, L = {lengthL}, T = {totalTimeT}, dx = {dx:F5}, dt = {dt:F5}");
|
|
||||||
sb.AppendLine("==========================================================================================");
|
|
||||||
|
|
||||||
// Time slices: t = 0, t = T/2, t = T
|
_minU = decimal.MaxValue; _maxU = decimal.MinValue;
|
||||||
int t0Idx = 0;
|
_minV = decimal.MaxValue; _maxV = decimal.MinValue;
|
||||||
int tMidIdx = nt / 2;
|
|
||||||
int tEndIdx = nt - 1;
|
|
||||||
|
|
||||||
decimal t0Val = grid.TGrid[t0Idx];
|
|
||||||
decimal tMidVal = grid.TGrid[tMidIdx];
|
|
||||||
decimal tEndVal = grid.TGrid[tEndIdx];
|
|
||||||
|
|
||||||
sb.Append(string.Format("{0,-6} | {1,-8}", "Nokta", "x"));
|
|
||||||
sb.Append(string.Format(" | {0,-12} | {1,-12}", $"u(t={t0Val:F2})", $"v(t={t0Val:F2})"));
|
|
||||||
sb.Append(string.Format(" | {0,-12} | {1,-12}", $"u(t={tMidVal:F2})", $"v(t={tMidVal:F2})"));
|
|
||||||
sb.Append(string.Format(" | {0,-12} | {1,-12}", $"u(t={tEndVal:F2})", $"v(t={tEndVal:F2})"));
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine(new string('-', 92));
|
|
||||||
|
|
||||||
for (int i = 0; i < nx; i++)
|
for (int i = 0; i < nx; i++)
|
||||||
{
|
{
|
||||||
decimal xVal = grid.XGrid[i];
|
for (int n = 0; n < nt; n++)
|
||||||
sb.Append(string.Format("{0,-6} | {1,-8:F3}", i, xVal));
|
{
|
||||||
sb.Append(string.Format(" | {0,-12:F5} | {1,-12:F5}", grid.U[i, t0Idx], grid.V[i, t0Idx]));
|
decimal u = grid.U[i, n];
|
||||||
sb.Append(string.Format(" | {0,-12:F5} | {1,-12:F5}", grid.U[i, tMidIdx], grid.V[i, tMidIdx]));
|
if (u < _minU) _minU = u;
|
||||||
sb.Append(string.Format(" | {0,-12:F5} | {1,-12:F5}", grid.U[i, tEndIdx], grid.V[i, tEndIdx]));
|
if (u > _maxU) _maxU = u;
|
||||||
sb.AppendLine();
|
|
||||||
|
decimal v = grid.V[i, n];
|
||||||
|
if (v < _minV) _minV = v;
|
||||||
|
if (v > _maxV) _maxV = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.AppendLine("==========================================================================================");
|
if (_maxU - _minU < 0.0001m) _maxU = _minU + 1m;
|
||||||
|
if (_maxV - _minV < 0.0001m) _maxV = _minV + 1m;
|
||||||
|
|
||||||
|
// Generate Turing Heatmap Bitmap
|
||||||
|
GenerateTuringBitmap(grid, nx, nt);
|
||||||
|
|
||||||
|
// Setup animation controls
|
||||||
|
trkTimeStep.Maximum = nt - 1;
|
||||||
|
trkTimeStep.Value = 0;
|
||||||
|
UpdateAnimationDisplay();
|
||||||
|
|
||||||
|
// Report text
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=== BAĞLAŞIMLI PDE (REAKSİYON-DİFÜZYON) ÇÖZÜM RAPORU ===");
|
||||||
|
sb.AppendLine($" Reaksiyon F(u, v) : {f}");
|
||||||
|
sb.AppendLine($" Reaksiyon G(u, v) : {g}");
|
||||||
|
sb.AppendLine($" Difüzyon Du, Dv : {du}, {dv}");
|
||||||
|
sb.AppendLine($" Uzay & Zaman : x ∈ [0, {L}] ({Nx} nokta), t ∈ [0, {T}] ({Nt} adım)");
|
||||||
|
sb.AppendLine($" Çözüm Süresi : {sw.ElapsedMilliseconds} ms");
|
||||||
|
sb.AppendLine($" u Değer Aralığı : [{Math.Round(_minU, 5)}, {Math.Round(_maxU, 5)}]");
|
||||||
|
sb.AppendLine($" v Değer Aralığı : [{Math.Round(_minV, 5)}, {Math.Round(_maxV, 5)}]");
|
||||||
|
sb.AppendLine(new string('=', 65));
|
||||||
|
|
||||||
txtOutput.Text = sb.ToString();
|
txtOutput.Text = sb.ToString();
|
||||||
|
|
||||||
|
pnlDualCanvas.Invalidate();
|
||||||
|
pnlTuringCanvas.Invalidate();
|
||||||
|
pnlPhaseCanvas.Invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"PDE Sistemi çözümü sırasında hata oluştu:\n{ex.Message}", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
txtOutput.Text = "❌ Hata: " + ex.Message;
|
||||||
lblSummary.Text = "Hata oluştu!";
|
MessageBox.Show("Sistem Çözüm Hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
lblDetails.Text = ex.Message;
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
btnSolve.Enabled = true;
|
btnSolve.Enabled = true;
|
||||||
btnSolve.Text = "🚀 PDE Sistemini Çöz";
|
btnSolve.Text = origBtnText;
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GenerateTuringBitmap(DifferentialEquations.PdeSystemSolutionGrid grid, int nx, int nt)
|
||||||
|
{
|
||||||
|
_turingCache?.Dispose();
|
||||||
|
_turingCache = new Bitmap(nx, nt, PixelFormat.Format32bppArgb);
|
||||||
|
|
||||||
|
decimal span = _maxU - _minU;
|
||||||
|
if (span == 0m) span = 1m;
|
||||||
|
|
||||||
|
for (int t = 0; t < nt; t++)
|
||||||
|
{
|
||||||
|
int imgY = nt - 1 - t;
|
||||||
|
for (int x = 0; x < nx; x++)
|
||||||
|
{
|
||||||
|
decimal val = grid.U[x, t];
|
||||||
|
float norm = (float)((val - _minU) / span);
|
||||||
|
if (norm < 0f) norm = 0f;
|
||||||
|
if (norm > 1f) norm = 1f;
|
||||||
|
|
||||||
|
Color c = ValueToColormap(norm);
|
||||||
|
_turingCache.SetPixel(x, imgY, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color ValueToColormap(float v)
|
||||||
|
{
|
||||||
|
if (v <= 0.25f)
|
||||||
|
{
|
||||||
|
float t = v / 0.25f;
|
||||||
|
return Color.FromArgb((int)(15 + t * (6 - 15)), (int)(23 + t * (182 - 23)), (int)(70 + t * (212 - 70)));
|
||||||
|
}
|
||||||
|
else if (v <= 0.5f)
|
||||||
|
{
|
||||||
|
float t = (v - 0.25f) / 0.25f;
|
||||||
|
return Color.FromArgb((int)(6 + t * (16 - 6)), (int)(182 + t * (185 - 182)), (int)(212 + t * (129 - 212)));
|
||||||
|
}
|
||||||
|
else if (v <= 0.75f)
|
||||||
|
{
|
||||||
|
float t = (v - 0.5f) / 0.25f;
|
||||||
|
return Color.FromArgb((int)(16 + t * (245 - 16)), (int)(185 + t * (158 - 185)), (int)(129 + t * (11 - 129)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float t = (v - 0.75f) / 0.25f;
|
||||||
|
return Color.FromArgb((int)(245 + t * (239 - 245)), (int)(158 + t * (68 - 158)), (int)(11 + t * (68 - 11)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleAnimation()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
if (_animTimer.Enabled)
|
||||||
|
{
|
||||||
|
_animTimer.Stop();
|
||||||
|
btnPlayPause.Text = "▶ Oynat";
|
||||||
|
btnPlayPause.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_animTimer.Start();
|
||||||
|
btnPlayPause.Text = "⏸ Durdur";
|
||||||
|
btnPlayPause.BackColor = Color.FromArgb(239, 68, 68);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AdvanceAnimation()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
int nt = _currentGrid.TGrid.Length;
|
||||||
|
int speed = cmbAnimSpeed.SelectedIndex == 1 ? 2 : (cmbAnimSpeed.SelectedIndex == 2 ? 5 : 1);
|
||||||
|
int next = (trkTimeStep.Value + speed) % nt;
|
||||||
|
trkTimeStep.Value = next;
|
||||||
|
UpdateAnimationDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAnimationDisplay()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
int curStep = trkTimeStep.Value;
|
||||||
|
decimal curT = _currentGrid.TGrid[curStep];
|
||||||
|
lblCurrentTime.Text = $"t = {curT:F3}s ({curStep}/{_currentGrid.TGrid.Length - 1})";
|
||||||
|
pnlDualCanvas.Invalidate();
|
||||||
|
pnlPhaseCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlDualCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
int w = pnlDualCanvas.Width;
|
||||||
|
int h = pnlDualCanvas.Height;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentGrid == null)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("PDE sistemi çözüldükten sonra canlı çift konsantrasyon dalgası u(x) & v(x) burada oynatılır.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int curStep = Math.Min(trkTimeStep.Value, _currentGrid.TGrid.Length - 1);
|
||||||
|
int nx = _currentGrid.XGrid.Length;
|
||||||
|
decimal L = _currentGrid.XGrid[nx - 1];
|
||||||
|
|
||||||
|
int padL = 45, padB = 30, padT = 32, padR = 25;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
decimal globalMin = Math.Min(_minU, _minV);
|
||||||
|
decimal globalMax = Math.Max(_maxU, _maxV);
|
||||||
|
decimal span = globalMax - globalMin;
|
||||||
|
if (span == 0m) span = 1m;
|
||||||
|
decimal yMin = globalMin - span * 0.08m;
|
||||||
|
decimal yMax = globalMax + span * 0.08m;
|
||||||
|
decimal ySpan = yMax - yMin;
|
||||||
|
|
||||||
|
float ToScreenX(decimal x) => padL + (float)(x / L * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal val) => padT + (float)((yMax - val) / ySpan * (decimal)plotH);
|
||||||
|
|
||||||
|
// Grid lines
|
||||||
|
using (Pen gridPen = new Pen(Color.FromArgb(24, 33, 52), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(100, 116, 139)))
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
decimal gx = (i / 5m) * L;
|
||||||
|
float sx = ToScreenX(gx);
|
||||||
|
g.DrawLine(gridPen, sx, padT, sx, h - padB);
|
||||||
|
g.DrawString(Math.Round(gx, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 10, h - padB + 4);
|
||||||
|
|
||||||
|
decimal gy = yMin + (ySpan * i / 5m);
|
||||||
|
float sy = ToScreenY(gy);
|
||||||
|
g.DrawLine(gridPen, padL, sy, w - padR, sy);
|
||||||
|
g.DrawString(Math.Round(gy, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zero line
|
||||||
|
float zeroY = ToScreenY(0m);
|
||||||
|
if (zeroY >= padT && zeroY <= h - padB)
|
||||||
|
{
|
||||||
|
using (Pen zeroPen = new Pen(Color.FromArgb(71, 85, 105), 1.2f))
|
||||||
|
{
|
||||||
|
g.DrawLine(zeroPen, padL, zeroY, w - padR, zeroY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Box
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Points for u(x) and v(x)
|
||||||
|
List<PointF> uPts = new List<PointF>(nx);
|
||||||
|
List<PointF> vPts = new List<PointF>(nx);
|
||||||
|
|
||||||
|
for (int i = 0; i < nx; i++)
|
||||||
|
{
|
||||||
|
decimal x = _currentGrid.XGrid[i];
|
||||||
|
uPts.Add(new PointF(ToScreenX(x), ToScreenY(_currentGrid.U[i, curStep])));
|
||||||
|
vPts.Add(new PointF(ToScreenX(x), ToScreenY(_currentGrid.V[i, curStep])));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Area fill for u (translucent blue)
|
||||||
|
List<PointF> uPoly = new List<PointF>(uPts);
|
||||||
|
uPoly.Add(new PointF(padL + plotW, ToScreenY(0m)));
|
||||||
|
uPoly.Add(new PointF(padL, ToScreenY(0m)));
|
||||||
|
using (Brush uFill = new SolidBrush(Color.FromArgb(35, 56, 189, 248)))
|
||||||
|
{
|
||||||
|
g.FillPolygon(uFill, uPoly.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Curve for u
|
||||||
|
using (Pen uPen = new Pen(Color.FromArgb(56, 189, 248), 2.2f))
|
||||||
|
{
|
||||||
|
uPen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < uPts.Count - 1; i++) g.DrawLine(uPen, uPts[i], uPts[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Curve for v (rose)
|
||||||
|
using (Pen vPen = new Pen(Color.FromArgb(244, 63, 94), 2.2f))
|
||||||
|
{
|
||||||
|
vPen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < vPts.Count - 1; i++) g.DrawLine(vPen, vPts[i], vPts[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legend
|
||||||
|
decimal curT = _currentGrid.TGrid[curStep];
|
||||||
|
using (Font fLeg = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold))
|
||||||
|
using (Brush bU = new SolidBrush(Color.FromArgb(56, 189, 248)))
|
||||||
|
using (Brush bV = new SolidBrush(Color.FromArgb(244, 63, 94)))
|
||||||
|
{
|
||||||
|
g.DrawString("— u(x) Aktivatör / Bileşen 1", fLeg, bU, padL + 8, 8);
|
||||||
|
g.DrawString("— v(x) İnhibitör / Bileşen 2", fLeg, bV, padL + 210, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlTuringCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
int w = pnlTuringCanvas.Width;
|
||||||
|
int h = pnlTuringCanvas.Height;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentGrid == null || _turingCache == null)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9.5F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("Sistem çözüldüğünde Mekan-Zaman Turing Deseni Haritası burada çizilir.", f, b, new RectangleF(20, 20, w - 40, 60));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int padL = 48, padB = 30, padT = 20, padR = 20;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
g.InterpolationMode = InterpolationMode.Bilinear;
|
||||||
|
g.DrawImage(_turingCache, new RectangleF(padL, padT, plotW, plotH));
|
||||||
|
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Font lblFont = new Font("Consolas", 7.5F))
|
||||||
|
using (Brush lblBrush = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
decimal L = _currentGrid.XGrid[_currentGrid.XGrid.Length - 1];
|
||||||
|
decimal T = _currentGrid.TGrid[_currentGrid.TGrid.Length - 1];
|
||||||
|
|
||||||
|
for (int i = 0; i <= 5; i++)
|
||||||
|
{
|
||||||
|
float sx = padL + (i / 5f) * plotW;
|
||||||
|
decimal gx = (i / 5m) * L;
|
||||||
|
g.DrawString(Math.Round(gx, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, sx - 10, h - padB + 4);
|
||||||
|
|
||||||
|
float sy = padT + (1f - (i / 5f)) * plotH;
|
||||||
|
decimal gt = (i / 5m) * T;
|
||||||
|
g.DrawString(Math.Round(gt, 2).ToString(CultureInfo.InvariantCulture), lblFont, lblBrush, 4, sy - 6);
|
||||||
|
}
|
||||||
|
g.DrawString("Mekan (x) →", lblFont, lblBrush, padL + plotW * 0.45f, h - padB + 16);
|
||||||
|
g.DrawString("Zaman (t) ↑", lblFont, lblBrush, 4, padT - 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crosshair
|
||||||
|
if (_turingHoverPoint.HasValue && _turingHoverData.HasValue)
|
||||||
|
{
|
||||||
|
PointF hp = _turingHoverPoint.Value;
|
||||||
|
using (Pen crossPen = new Pen(Color.FromArgb(255, 255, 255), 1f) { DashStyle = DashStyle.Dot })
|
||||||
|
{
|
||||||
|
g.DrawLine(crossPen, hp.X, padT, hp.X, h - padB);
|
||||||
|
g.DrawLine(crossPen, padL, hp.Y, padL + plotW, hp.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
var d = _turingHoverData.Value;
|
||||||
|
string tip = $"x = {Math.Round(d.X, 3)}\nt = {Math.Round(d.T, 3)}s\nu = {Math.Round(d.U, 4)}\nv = {Math.Round(d.V, 4)}";
|
||||||
|
using (Font tipFont = new Font("Consolas", 8F, FontStyle.Bold))
|
||||||
|
{
|
||||||
|
SizeF sz = g.MeasureString(tip, tipFont);
|
||||||
|
float tx = hp.X + 10;
|
||||||
|
float ty = hp.Y - sz.Height - 6;
|
||||||
|
if (tx + sz.Width + 8 > w) tx = hp.X - sz.Width - 12;
|
||||||
|
if (ty < padT) ty = hp.Y + 12;
|
||||||
|
|
||||||
|
RectangleF tr = new RectangleF(tx, ty, sz.Width + 8, sz.Height + 6);
|
||||||
|
using (Brush bg = new SolidBrush(Color.FromArgb(240, 24, 33, 52)))
|
||||||
|
using (Pen bp = new Pen(Color.FromArgb(56, 189, 248), 1.2f))
|
||||||
|
using (Brush txtB = new SolidBrush(Color.White))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bg, tr);
|
||||||
|
g.DrawRectangle(bp, tr.X, tr.Y, tr.Width, tr.Height);
|
||||||
|
g.DrawString(tip, tipFont, txtB, tx + 4, ty + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlTuringCanvas_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
int w = pnlTuringCanvas.Width;
|
||||||
|
int h = pnlTuringCanvas.Height;
|
||||||
|
int padL = 48, padB = 30, padT = 20, padR = 20;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
if (e.X >= padL && e.X <= padL + plotW && e.Y >= padT && e.Y <= padT + plotH)
|
||||||
|
{
|
||||||
|
float relX = (e.X - padL) / plotW;
|
||||||
|
float relY = 1f - ((e.Y - padT) / plotH);
|
||||||
|
|
||||||
|
int nx = _currentGrid.XGrid.Length;
|
||||||
|
int nt = _currentGrid.TGrid.Length;
|
||||||
|
|
||||||
|
int xi = Math.Max(0, Math.Min(nx - 1, (int)(relX * (nx - 1))));
|
||||||
|
int ti = Math.Max(0, Math.Min(nt - 1, (int)(relY * (nt - 1))));
|
||||||
|
|
||||||
|
decimal xVal = _currentGrid.XGrid[xi];
|
||||||
|
decimal tVal = _currentGrid.TGrid[ti];
|
||||||
|
decimal uVal = _currentGrid.U[xi, ti];
|
||||||
|
decimal vVal = _currentGrid.V[xi, ti];
|
||||||
|
|
||||||
|
_turingHoverPoint = new PointF(e.X, e.Y);
|
||||||
|
_turingHoverData = (xVal, tVal, uVal, vVal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_turingHoverPoint = null;
|
||||||
|
_turingHoverData = null;
|
||||||
|
}
|
||||||
|
pnlTuringCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PnlPhaseCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
int w = pnlPhaseCanvas.Width;
|
||||||
|
int h = pnlPhaseCanvas.Height;
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
|
||||||
|
if (_currentGrid == null) return;
|
||||||
|
|
||||||
|
int curStep = Math.Min(trkTimeStep.Value, _currentGrid.TGrid.Length - 1);
|
||||||
|
int nx = _currentGrid.XGrid.Length;
|
||||||
|
|
||||||
|
int padL = 48, padB = 30, padT = 25, padR = 20;
|
||||||
|
float plotW = w - padL - padR;
|
||||||
|
float plotH = h - padT - padB;
|
||||||
|
if (plotW < 10 || plotH < 10) return;
|
||||||
|
|
||||||
|
decimal spanU = _maxU - _minU; if (spanU == 0m) spanU = 1m;
|
||||||
|
decimal spanV = _maxV - _minV; if (spanV == 0m) spanV = 1m;
|
||||||
|
|
||||||
|
float ToScreenX(decimal u) => padL + (float)((u - _minU) / spanU * (decimal)plotW);
|
||||||
|
float ToScreenY(decimal v) => padT + (float)((_maxV - v) / spanV * (decimal)plotH);
|
||||||
|
|
||||||
|
using (Pen boxPen = new Pen(Color.FromArgb(51, 65, 85), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawRectangle(boxPen, padL, padT, plotW, plotH);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PointF> phasePts = new List<PointF>(nx);
|
||||||
|
for (int i = 0; i < nx; i++)
|
||||||
|
{
|
||||||
|
phasePts.Add(new PointF(ToScreenX(_currentGrid.U[i, curStep]), ToScreenY(_currentGrid.V[i, curStep])));
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Pen phasePen = new Pen(Color.FromArgb(251, 191, 36), 2f))
|
||||||
|
{
|
||||||
|
phasePen.LineJoin = LineJoin.Round;
|
||||||
|
for (int i = 0; i < phasePts.Count - 1; i++)
|
||||||
|
{
|
||||||
|
g.DrawLine(phasePen, phasePts[i], phasePts[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Font titleF = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold))
|
||||||
|
using (Brush txtB = new SolidBrush(Color.FromArgb(251, 191, 36)))
|
||||||
|
{
|
||||||
|
decimal curT = _currentGrid.TGrid[curStep];
|
||||||
|
g.DrawString($"Faz Portresi: v(x) vs u(x) ── t = {curT:F3} sn", titleF, txtB, padL + 8, 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExportDataAsCsv()
|
||||||
|
{
|
||||||
|
if (_currentGrid == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Önce PDE sistemini çözünüz.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
sfd.Filter = "CSV Dosyası (*.csv)|*.csv";
|
||||||
|
sfd.FileName = "Reaksiyon_Difuzyon_Cozum.csv";
|
||||||
|
if (sfd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("x,t,u,v");
|
||||||
|
int nx = _currentGrid.XGrid.Length;
|
||||||
|
int nt = _currentGrid.TGrid.Length;
|
||||||
|
for (int n = 0; n < nt; n++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < nx; i++)
|
||||||
|
{
|
||||||
|
sb.AppendLine($"{_currentGrid.XGrid[i]},{_currentGrid.TGrid[n]},{_currentGrid.U[i, n]},{_currentGrid.V[i, n]}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File.WriteAllText(sfd.FileName, sb.ToString(), Encoding.UTF8);
|
||||||
|
MessageBox.Show("Veriler CSV olarak başarıyla kaydedildi!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExportTuringAsPng()
|
||||||
|
{
|
||||||
|
if (_turingCache == null) return;
|
||||||
|
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
sfd.Filter = "PNG Resmi (*.png)|*.png";
|
||||||
|
sfd.FileName = "Turing_Deseni_Haritasi.png";
|
||||||
|
if (sfd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
using (Bitmap bmp = new Bitmap(1200, 800))
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
g.Clear(Color.FromArgb(11, 15, 28));
|
||||||
|
g.DrawImage(_turingCache, new Rectangle(60, 40, 1080, 720));
|
||||||
|
bmp.Save(sfd.FileName, ImageFormat.Png);
|
||||||
|
}
|
||||||
|
MessageBox.Show("Turing deseni haritası yüksek çözünürlükte kaydedildi!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
src/ttCalculator/MainForm.Designer.cs
generated
2
src/ttCalculator/MainForm.Designer.cs
generated
|
|
@ -156,7 +156,7 @@ namespace MathApp
|
||||||
// Footer version label
|
// Footer version label
|
||||||
this.lblVersion.Dock = DockStyle.Bottom;
|
this.lblVersion.Dock = DockStyle.Bottom;
|
||||||
this.lblVersion.Height = 28;
|
this.lblVersion.Height = 28;
|
||||||
this.lblVersion.Text = "v3.5 • 128-bit Decimal Motoru • 60 FPS";
|
this.lblVersion.Text = "v3.6 • 128-bit Decimal Motoru • 60 FPS";
|
||||||
this.lblVersion.Font = new Font("Segoe UI", 8F);
|
this.lblVersion.Font = new Font("Segoe UI", 8F);
|
||||||
this.lblVersion.ForeColor = Color.FromArgb(100, 116, 139);
|
this.lblVersion.ForeColor = Color.FromArgb(100, 116, 139);
|
||||||
this.lblVersion.TextAlign = ContentAlignment.MiddleCenter;
|
this.lblVersion.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||||
<AssemblyName>ttCalculator</AssemblyName>
|
<AssemblyName>ttCalculator</AssemblyName>
|
||||||
<Product>ttCalculator - Gelişmiş Matematik & Nümerik Analiz Stüdyosu</Product>
|
<Product>ttCalculator - Gelişmiş Matematik & Nümerik Analiz Stüdyosu</Product>
|
||||||
<Version>3.5.0</Version>
|
<Version>3.6.0</Version>
|
||||||
<Company>ttCalculator</Company>
|
<Company>ttCalculator</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MathApp.Tests
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("=================================================");
|
Console.WriteLine("=================================================");
|
||||||
Console.WriteLine("ttCalculator v3.5 Numerical Studios Verification");
|
Console.WriteLine("ttCalculator v3.6 Numerical Studios Verification");
|
||||||
Console.WriteLine("=================================================");
|
Console.WriteLine("=================================================");
|
||||||
|
|
||||||
int passed = 0;
|
int passed = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue