bug fix on test.html

This commit is contained in:
Ryan@fsunuc 2023-07-26 20:24:54 -04:00
parent e3b06b39c8
commit 014a13340c
2 changed files with 41 additions and 24 deletions

View File

@ -42,6 +42,7 @@
float: none;
padding: 0px;
margin-left: var(--navWidth);
height: 1000px;
height : 100vh;
/* background: #1363A7; */
background: #6DB33E;
@ -123,10 +124,10 @@
<td style="text-align:right"><a href="instruction.html" target="uploaded">Intructions & Credits</a></td>
</tr>
<tr>
<td style="text-align:right"><a href="WoodsSaxon.html" target="uploaded">Woods-Saxon (const.)</a></td>
<td style="text-align:right"><a href="test.html" target="_blank">Woods-Saxon (const.)</a></td>
</tr>
<tr>
<td style="text-align:right"><a href="nuclearChart.html" target="uploaded">Nuclides Chart (const.)</a></td>
<td style="text-align:right"><a href="nuclearChart.html" target="_blank">Nuclides Chart (const.)</a></td>
</tr>
<table>

View File

@ -20,9 +20,6 @@
#include <iostream>
#include <vector>
//======= Woods-Saxon Library
#include "RK4.h"
#include "WS.h"
const int nPt = 300;
@ -45,7 +42,6 @@ GLFWwindow* g_window;
ImVec4 clear_color = ImVec4(0.427, 0.702f, 0.243f, 1.00f);
int g_width;
int g_height;
// Function used by c++ to get the size of the html canvas
EM_JS(int, canvas_get_width, (), {
return Module.canvas.width;
@ -99,6 +95,7 @@ void loop(){
// Woods-Saxon window
{
ImGui::SetNextWindowSize(ImVec2(600, 1000), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowPos(ImVec2(50, 50), ImGuiCond_FirstUseEver);
static float V0 = -45, r0 = 1.25, R0 = 3.5, a0 = 0.6;
static float VSO = 28, rSO = 1.25, RSO = 3.5, aSO = 0.6;
static int Z = 0, nStep = 300;
@ -109,8 +106,27 @@ void loop(){
ImGui::Begin("Woods-Saxon Calculation");
static int e = 0;
ImGui::RadioButton("Arbitary", &e, 0); ImGui::SameLine();
ImGui::RadioButton("Isotope", &e, 1);
if( ImGui::RadioButton("Arbitary", &e, 0) ){
A = 1;
}
ImGui::SameLine();
if( ImGui::RadioButton("Isotope", &e, 1) ){
rc = 1.25;
r0 = 1.25;
rSO = 1.25;
}
if( e == 0){
rc = Rc / pow(A, 1./3);
r0 = R0 / pow(A, 1./3);
rSO = RSO / pow(A, 1./3);
}
if( e == 1){
Rc = rc * pow(A, 1./3);
R0 = r0 * pow(A, 1./3);
RSO = rSO * pow(A, 1./3);
}
ImGui::Separator();
ImGui::PushItemWidth(100);
@ -128,14 +144,6 @@ void loop(){
ImGui::DragFloat("rc [fm] ", &rc, 0.01, 1, 10);
ImGui::EndDisabled();
if( e == 0 ) {A = 1; rc = Rc / pow(A, 1./3);}
if( e == 1 ) {
rc = 1.25;
r0 = 1.25;
rSO = 1.25;
Rc = rc * pow(A, 1./3);
}
ImGui::Text("Eff. mass : %.3f ", mass);
ImGui::Separator();
@ -145,16 +153,12 @@ void loop(){
ImGui::BeginDisabled(e==1); ImGui::DragFloat("R0 [fm] ", &R0, 0.01, 1, 10); ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(e==0); ImGui::DragFloat("r0 [fm] ", &r0, 0.01, 1, 10); ImGui::EndDisabled();
if( e == 0 ) {A = 1; r0 = R0 / pow(A, 1./3);}
if( e == 1 ) R0 = r0 * pow(A, 1./3);
ImGui::DragFloat("a0 [fm]", &a0, 0.01, 0.1, 2);
ImGui::DragFloat("VSO [MeV]", &VSO, 0.1, 0, 40);
ImGui::BeginDisabled(e==1); ImGui::DragFloat("RSO [fm] ", &RSO, 0.01, 1, 10); ImGui::EndDisabled();
ImGui::SameLine();
ImGui::BeginDisabled(e==0); ImGui::DragFloat("rSO [fm] ", &rSO, 0.01, 1, 10); ImGui::EndDisabled();
if( e == 0 ) {A = 1; rSO = RSO / pow(A, 1./3);}
if( e == 1 ) RSO = rSO * pow(A, 1./3);
ImGui::DragFloat("aSO [fm]", &aSO, 0.01, 0.1, 2);
ImGui::Separator();
@ -258,7 +262,7 @@ void loop(){
//*============= WS Trend
{
ImGui::SetNextWindowSize(ImVec2(600, 800), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowPos(ImVec2(100, 200), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowPos(ImVec2(680, 50), ImGuiCond_FirstUseEver);
static float V0 = -45, r0 = 1.25, a0 = 0.6;
static float VSO = 28, rSO = 1.25, aSO = 0.6;
static int Z = 0, N = 1, nStep = 300;
@ -479,8 +483,20 @@ void loop(){
ImPlot::EndPlot();
}
static bool saveDataClicked = false;
if( ImGui::Button("Download data") ){
// FILE * file_out;
// file_out = fopen("", "w+");
saveDataClicked = true;
}
if( saveDataClicked ) {
ImGui::Text("to be impletmented....");
}
}
ImGui::End();
}
@ -509,7 +525,7 @@ int init_gl(){
// Open a window and create its OpenGL context
int canvasWidth = g_width;
int canvasHeight = g_height;
g_window = glfwCreateWindow(canvasWidth, canvasHeight, "WebGui Demo", NULL, NULL);
g_window = glfwCreateWindow(canvasWidth, canvasHeight, "Woods-Saxon Calculation Demo", NULL, NULL);
if( g_window == NULL ){
fprintf( stderr, "Failed to open GLFW window.\n" );
glfwTerminate();