mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-23 02:38:52 -05:00
Added descriptive comments to rest of code
This commit is contained in:
parent
887f025b3b
commit
34b448f850
|
@ -1,8 +1,16 @@
|
||||||
|
/*
|
||||||
|
MassMap.h
|
||||||
|
A represnetation of the AMDC mass table. We provide capability to retrieve the mass of an isotope
|
||||||
|
as well as the isotopic symbol. This sort of code is pretty ubiquitous in flexible nuclear physics
|
||||||
|
analysis.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#include "MassMap.h"
|
#include "MassMap.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read in AMDC mass file, preformated to remove excess info. Here assumes that by default
|
Read in AMDC mass file, preformated to remove excess info. Here assumes that by default
|
||||||
the file is in a local directory etc/
|
the file is in a local directory Resources. Navigator build process handles this.
|
||||||
*/
|
*/
|
||||||
MassMap::MassMap()
|
MassMap::MassMap()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
MassMap.h
|
||||||
|
A represnetation of the AMDC mass table. We provide capability to retrieve the mass of an isotope
|
||||||
|
as well as the isotopic symbol. This sort of code is pretty ubiquitous in flexible nuclear physics
|
||||||
|
analysis.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#ifndef MASS_MAP_H
|
#ifndef MASS_MAP_H
|
||||||
#define MASS_MAP_H
|
#define MASS_MAP_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
/*
|
||||||
|
SPSInputLayer.cpp
|
||||||
|
An example of what a user created layer might look like. This is how one would extend the base editor to have more
|
||||||
|
functionality, specific to their experiment/setup. In this case, we provide inputs for reaction information so that
|
||||||
|
the kinematic shift of the SE-SPS focal plane can be calculated, and weights for tracing particle trajectories are
|
||||||
|
produced for use in analysis (as NavVariables).
|
||||||
|
|
||||||
|
A reminder that these layers should not be that intense. The more work that is shoved into the UI, the less responsive
|
||||||
|
and more sluggish overall the UI will become. The vast bulk of the analysis work should be left to the PhysicsLayer which has its own
|
||||||
|
thread to work upon.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#include "SPSInputLayer.h"
|
#include "SPSInputLayer.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
|
||||||
|
@ -32,9 +45,9 @@ namespace Navigator {
|
||||||
|
|
||||||
void SPSInputLayer::OnImGuiRender()
|
void SPSInputLayer::OnImGuiRender()
|
||||||
{
|
{
|
||||||
ImGui::SetCurrentContext(ImGui::GetCurrentContext());
|
|
||||||
if (ImGui::Begin("SPS Input"))
|
if (ImGui::Begin("SPS Input"))
|
||||||
{
|
{
|
||||||
|
//Create widgets for all of our inputs
|
||||||
ImGui::InputDouble("Bfield(kG)", &m_bfield, 0.01, 0.1);
|
ImGui::InputDouble("Bfield(kG)", &m_bfield, 0.01, 0.1);
|
||||||
ImGui::InputDouble("Theta(deg)", &m_theta, 0.1, 1.0);
|
ImGui::InputDouble("Theta(deg)", &m_theta, 0.1, 1.0);
|
||||||
ImGui::InputDouble("BeamKE(MeV)", &m_beamKE, 0.1, 1.0);
|
ImGui::InputDouble("BeamKE(MeV)", &m_beamKE, 0.1, 1.0);
|
||||||
|
@ -43,8 +56,11 @@ namespace Navigator {
|
||||||
ImGui::InputInt2("Ejectile Z,A", m_ejectNums);
|
ImGui::InputInt2("Ejectile Z,A", m_ejectNums);
|
||||||
if (ImGui::Button("Set"))
|
if (ImGui::Button("Set"))
|
||||||
{
|
{
|
||||||
|
//We dont want to calculate the weights every frame, so
|
||||||
|
//we lock that calculation behind a button.
|
||||||
UpdateWeights();
|
UpdateWeights();
|
||||||
}
|
}
|
||||||
|
//Display some info about the internal state
|
||||||
ImGui::Text("-------Current Settings-------");
|
ImGui::Text("-------Current Settings-------");
|
||||||
ImGui::Text("Reaction Equation: ");
|
ImGui::Text("Reaction Equation: ");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -57,7 +73,9 @@ namespace Navigator {
|
||||||
|
|
||||||
void SPSInputLayer::UpdateWeights()
|
void SPSInputLayer::UpdateWeights()
|
||||||
{
|
{
|
||||||
m_rxnEqn = "";
|
m_rxnEqn = ""; //reset
|
||||||
|
|
||||||
|
//Calculate residual nucleus from reaction
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
m_residNums[i] = m_targNums[i] + m_projNums[i] - m_ejectNums[i];
|
m_residNums[i] = m_targNums[i] + m_projNums[i] - m_ejectNums[i];
|
||||||
if (m_residNums[0] < 0 || m_residNums[1] <= 0)
|
if (m_residNums[0] < 0 || m_residNums[1] <= 0)
|
||||||
|
@ -72,6 +90,7 @@ namespace Navigator {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Obtain masses from the AMDC table
|
||||||
double targMass = m_masses.FindMass(m_targNums[0], m_targNums[1]);
|
double targMass = m_masses.FindMass(m_targNums[0], m_targNums[1]);
|
||||||
double projMass = m_masses.FindMass(m_projNums[0], m_projNums[1]);
|
double projMass = m_masses.FindMass(m_projNums[0], m_projNums[1]);
|
||||||
double ejectMass = m_masses.FindMass(m_ejectNums[0], m_ejectNums[1]);
|
double ejectMass = m_masses.FindMass(m_ejectNums[0], m_ejectNums[1]);
|
||||||
|
@ -89,7 +108,7 @@ namespace Navigator {
|
||||||
temp = m_masses.FindSymbol(m_residNums[0], m_residNums[1]);
|
temp = m_masses.FindSymbol(m_residNums[0], m_residNums[1]);
|
||||||
m_rxnEqn += temp;
|
m_rxnEqn += temp;
|
||||||
|
|
||||||
double theta_rad = m_theta * c_deg2rad;
|
double theta_rad = m_theta * c_deg2rad; //convert to radians
|
||||||
double bfield_t = m_bfield * 0.1; //convert to tesla
|
double bfield_t = m_bfield * 0.1; //convert to tesla
|
||||||
double Q = targMass + projMass - ejectMass - residMass;
|
double Q = targMass + projMass - ejectMass - residMass;
|
||||||
//kinematics a la Iliadis p.590
|
//kinematics a la Iliadis p.590
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
/*
|
||||||
|
SPSInputLayer.h
|
||||||
|
An example of what a user created layer might look like. This is how one would extend the base editor to have more
|
||||||
|
functionality, specific to their experiment/setup. In this case, we provide inputs for reaction information so that
|
||||||
|
the kinematic shift of the SE-SPS focal plane can be calculated, and weights for tracing particle trajectories are
|
||||||
|
produced for use in analysis (as NavVariables).
|
||||||
|
|
||||||
|
A reminder that these layers should not be that intense. The more work that is shoved into the UI, the less responsive
|
||||||
|
and more sluggish overall the UI will become. The vast bulk of the analysis work should be left to the PhysicsLayer which has its own
|
||||||
|
thread to work upon.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#ifndef SPS_INPUT_LAYER_H
|
#ifndef SPS_INPUT_LAYER_H
|
||||||
#define SPS_INPUT_LAYER_H
|
#define SPS_INPUT_LAYER_H
|
||||||
|
|
||||||
|
@ -15,8 +28,8 @@ namespace Navigator {
|
||||||
virtual void OnAttach() override;
|
virtual void OnAttach() override;
|
||||||
virtual void OnDetach() override;
|
virtual void OnDetach() override;
|
||||||
virtual void OnUpdate() override;
|
virtual void OnUpdate() override;
|
||||||
virtual void OnEvent(Event& event) override;
|
virtual void OnEvent(Event& event) override; //If you want to respond to events
|
||||||
virtual void OnImGuiRender() override;
|
virtual void OnImGuiRender() override; //"Main" function
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateWeights();
|
void UpdateWeights();
|
||||||
|
@ -29,6 +42,7 @@ namespace Navigator {
|
||||||
double m_bfield; //kG
|
double m_bfield; //kG
|
||||||
double m_theta; //deg
|
double m_theta; //deg
|
||||||
double m_beamKE; //MeV
|
double m_beamKE; //MeV
|
||||||
|
//Z, A inputs for reaction nuclei
|
||||||
int m_targNums[2];
|
int m_targNums[2];
|
||||||
int m_projNums[2];
|
int m_projNums[2];
|
||||||
int m_ejectNums[2];
|
int m_ejectNums[2];
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
OpenGLContext.h
|
||||||
|
Implementation of OpenGL rendering context. Entirely based upon the work done by @TheCherno in his game engine series. See his content for more details.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#include "OpenGLContext.h"
|
#include "OpenGLContext.h"
|
||||||
|
|
||||||
#include "GLFW/glfw3.h"
|
#include "GLFW/glfw3.h"
|
||||||
|
@ -18,6 +24,7 @@ namespace Navigator {
|
||||||
|
|
||||||
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
||||||
|
|
||||||
|
//Report graphics status
|
||||||
NAV_TRACE("Loaded OpenGL with glad Init status {0}", status);
|
NAV_TRACE("Loaded OpenGL with glad Init status {0}", status);
|
||||||
|
|
||||||
NAV_INFO("Loaded OpenGL renderer");
|
NAV_INFO("Loaded OpenGL renderer");
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
OpenGLContext.h
|
||||||
|
Implementation of OpenGL rendering context. Entirely based upon the work done by @TheCherno in his game engine series. See his content for more details.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#ifndef OPEGL_CONTEXT_H
|
#ifndef OPEGL_CONTEXT_H
|
||||||
#define OPEGL_CONTEXT_H
|
#define OPEGL_CONTEXT_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
OpenGLRendererAPI.h
|
||||||
|
Implementation of OpenGL API in Navigator context. Note here only a few things exist. We don't need to implement much ourselves,
|
||||||
|
ImGui handles a lot of the heavy lifting for us. Based entirely upon @TheCherno's work in his game engine series.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#include "OpenGLRendererAPI.h"
|
#include "OpenGLRendererAPI.h"
|
||||||
|
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
OpenGLRendererAPI.h
|
||||||
|
Implementation of OpenGL API in Navigator context. Note here only a few things exist. We don't need to implement much ourselves,
|
||||||
|
ImGui handles a lot of the heavy lifting for us. Based entirely upon @TheCherno's work in his game engine series.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#ifndef OPENGL_RENDERER_API_H
|
#ifndef OPENGL_RENDERER_API_H
|
||||||
#define OPENGL_RENDERER_API_H
|
#define OPENGL_RENDERER_API_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
OpenGLWindow.h
|
||||||
|
Implementation of a window with OpenGL context. Not really OpenGL specific, other than in creation of GraphicsContext.
|
||||||
|
Bulk of creation can be used in any api/context (glfw compatible with Cocoa, X11, or Windows). Based entirely upon the
|
||||||
|
work of @TheCherno in his game engine series.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#include "OpenGLWindow.h"
|
#include "OpenGLWindow.h"
|
||||||
#include "OpenGLContext.h"
|
#include "OpenGLContext.h"
|
||||||
#include "Navigator/NavCore.h"
|
#include "Navigator/NavCore.h"
|
||||||
|
@ -40,6 +48,7 @@ namespace Navigator {
|
||||||
glfwSetErrorCallback(GLFWErrorCallback);
|
glfwSetErrorCallback(GLFWErrorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Apple specific. OpenGL is technically deprecated, so a little extra work to force the correct version
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||||
|
@ -49,12 +58,13 @@ namespace Navigator {
|
||||||
|
|
||||||
m_window = glfwCreateWindow((int)m_data.width, (int)m_data.height, m_data.name.c_str(), nullptr, nullptr);
|
m_window = glfwCreateWindow((int)m_data.width, (int)m_data.height, m_data.name.c_str(), nullptr, nullptr);
|
||||||
|
|
||||||
m_context = new OpenGLContext(m_window);
|
m_context = new OpenGLContext(m_window); //This is the only seriously OpenGL specific code
|
||||||
m_context->Init();
|
m_context->Init();
|
||||||
|
|
||||||
glfwSetWindowUserPointer(m_window, &m_data);
|
glfwSetWindowUserPointer(m_window, &m_data);
|
||||||
SetVSync(true);
|
SetVSync(true);
|
||||||
|
|
||||||
|
//Set all of the callback functions for the window.
|
||||||
glfwSetWindowSizeCallback(m_window, [](GLFWwindow* window, int width, int height)
|
glfwSetWindowSizeCallback(m_window, [](GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
Data& data = *(Data*) glfwGetWindowUserPointer(window);
|
Data& data = *(Data*) glfwGetWindowUserPointer(window);
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
OpenGLWindow.h
|
||||||
|
Implementation of a window with OpenGL context. Not really OpenGL specific, other than in creation of GraphicsContext.
|
||||||
|
Bulk of creation can be used in any api/context (glfw compatible with Cocoa, X11, or Windows). Based entirely upon the
|
||||||
|
work of @TheCherno in his game engine series.
|
||||||
|
|
||||||
|
GWM -- Feb 2022
|
||||||
|
*/
|
||||||
#ifndef OPENGL_WINDOW_H
|
#ifndef OPENGL_WINDOW_H
|
||||||
#define OPENGL_WINDOW_H
|
#define OPENGL_WINDOW_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user