fix refactor

This commit is contained in:
Jay Robson 2024-02-16 18:36:27 +11:00
parent 106d9ce547
commit 97f7193f66
37 changed files with 108 additions and 108 deletions

View File

@ -19,8 +19,8 @@ using namespace Sim::Graphics;
static glm::vec<3, double> trigger_near;
static glm::vec<3, double> trigger_far;
static std::vector<std::unique_ptr<Focus::Focus>> stack;
static std::unique_ptr<Focus::Focus> state = nullptr;
static std::vector<std::unique_ptr<Focus::FocusType>> stack;
static std::unique_ptr<Focus::FocusType> state = nullptr;
static bool mouse_visible = false;
static bool mouse_locked = false;
static bool triggered = false;
@ -179,7 +179,7 @@ void Focus::clear_mouse_locked()
clear_focus();
}
void Focus::set(std::unique_ptr<Focus> f)
void Focus::set(std::unique_ptr<FocusType> f)
{
if(state != nullptr)
{

View File

@ -8,9 +8,9 @@
namespace Sim::Graphics::Focus
{
struct Focus
struct FocusType
{
virtual ~Focus() { }
virtual ~FocusType() { }
virtual bool cursor_is_visible() { return true; }
virtual void on_keypress(int key, int sc, int action, int mods) { }
virtual void on_mouse_button(int button, int action, int mods) { }
@ -28,7 +28,7 @@ bool is_mouse_locked();
void clear_mouse_locked();
glm::vec<3, double> get_trigger_near();
glm::vec<3, double> get_trigger_far();
void set(std::unique_ptr<Focus> f);
void set(std::unique_ptr<FocusType> f);
void on_keypress(int key, int sc, int action, int mods);
void on_mouse_button(int button, int action, int mods);
void on_cursor_pos(double x, double y);

View File

@ -19,7 +19,7 @@ static void* ptr_diff(void* a, void* b)
void Arrays::vertex_attrib_pointers()
{
vertex v;
Vertex v;
glVertexAttribLPointer(0, 1, GL_UNSIGNED_INT64_ARB, sizeof(v), ptr_diff(&v.texid, &v));
glEnableVertexAttribArray(0);

View File

@ -6,7 +6,7 @@
namespace Sim::Graphics::Arrays
{
struct vertex
struct Vertex
{
unsigned long texid = 0;
glm::vec2 texpos = {0, 0};

View File

@ -15,7 +15,7 @@
using namespace Sim::Graphics;
struct character
struct Character
{
unsigned long handle;
float advance;
@ -23,7 +23,7 @@ struct character
glm::vec2 bearing;
};
static character chars[128];
static Character chars[128];
void Font::init()
{
@ -63,7 +63,7 @@ void Font::init()
int offx = face->glyph->bitmap_left;
int offy = face->glyph->bitmap_top;
character& c = chars[i];
Character& c = chars[i];
c.advance = face->glyph->advance.x * m / 64.0;
c.size = {width * m, height * m};
c.bearing = {offx * m, offy * m};
@ -95,7 +95,7 @@ void Font::init()
void Mesh::load_text(const char* text, double size)
{
std::vector<Arrays::vertex> vertices;
std::vector<Arrays::Vertex> vertices;
std::vector<unsigned int> indices;
float x = 0, y = size;
@ -111,7 +111,7 @@ void Mesh::load_text(const char* text, double size)
for(unsigned int i = 0; text[i] != '\0'; i++)
{
char c = text[i];
character ch = chars[c];
Character ch = chars[c];
if(c == '\n')
{
@ -136,10 +136,10 @@ void Mesh::load_text(const char* text, double size)
float ex = sx + ch.size.x * size;
float ey = sy + ch.size.y * size;
vertices.push_back(Arrays::vertex(ch.handle, {0, 0}, {sx, sy, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::vertex(ch.handle, {0, 1}, {sx, ey, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::vertex(ch.handle, {1, 0}, {ex, sy, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::vertex(ch.handle, {1, 1}, {ex, ey, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::Vertex(ch.handle, {0, 0}, {sx, sy, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::Vertex(ch.handle, {0, 1}, {sx, ey, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::Vertex(ch.handle, {1, 0}, {ex, sy, 0, 1}, {0, 0, -1}));
vertices.push_back(Arrays::Vertex(ch.handle, {1, 1}, {ex, ey, 0, 1}, {0, 0, -1}));
indices.insert(indices.end(), &index[0], &index[6]);
at += 4;

View File

@ -20,7 +20,7 @@ void Mesh::add(const Mesh& o, glm::mat4 mat)
for(unsigned int i = 0; i < o.vertices.size(); i++)
{
Arrays::vertex v = o.vertices[i];
Arrays::Vertex v = o.vertices[i];
v.normal = mat3 * v.normal;
v.pos = mat * v.pos;
vertices.push_back(v);
@ -32,7 +32,7 @@ void Mesh::add(const Mesh& o, glm::mat4 mat)
}
}
void Mesh::set_vertices(const Arrays::vertex* data, size_t size)
void Mesh::set_vertices(const Arrays::Vertex* data, size_t size)
{
vertices.clear();
vertices.reserve(size);

View File

@ -15,12 +15,12 @@ namespace Sim::Graphics
struct Mesh
{
std::vector<Arrays::vertex> vertices;
std::vector<Arrays::Vertex> vertices;
std::vector<unsigned int> indices;
constexpr Mesh() { }
void set_vertices(const Arrays::vertex* data, size_t size);
void set_vertices(const Arrays::Vertex* data, size_t size);
void set_indices(const unsigned int* data, size_t size);
void load_model(std::string base, std::string path);
void load_model(std::string path) { load_model(".", path); }

View File

@ -17,17 +17,17 @@
using namespace Sim::Graphics;
struct proc_state
struct ProcState
{
unsigned int offset = 0;
std::string base;
std::vector<Arrays::vertex> vertices;
std::vector<Arrays::Vertex> vertices;
std::vector<unsigned int> indices;
std::unordered_map<const aiTexture*, unsigned int> handles;
};
static unsigned int proc_texture(const proc_state& state, aiMaterial* mat, const aiScene* scene)
static unsigned int proc_texture(const ProcState& state, aiMaterial* mat, const aiScene* scene)
{
for(int i = 0; i < 0x0d; i++)
{
@ -59,7 +59,7 @@ static unsigned int proc_texture(const proc_state& state, aiMaterial* mat, const
return Texture::handle_white;
}
static void proc_mesh(proc_state& state, glm::mat4 mat, aiMesh* mesh, const aiScene* scene)
static void proc_mesh(ProcState& state, glm::mat4 mat, aiMesh* mesh, const aiScene* scene)
{
aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];
unsigned int handle = proc_texture(state, material, scene);
@ -68,7 +68,7 @@ static void proc_mesh(proc_state& state, glm::mat4 mat, aiMesh* mesh, const aiSc
for(unsigned int i = 0; i < mesh->mNumVertices; i++)
{
Arrays::vertex vertex;
Arrays::Vertex vertex;
auto [x, y, z] = mesh->mVertices[i];
vertex.pos = glm::vec4(x, y, z, 1) * mat;
@ -102,7 +102,7 @@ static void proc_mesh(proc_state& state, glm::mat4 mat, aiMesh* mesh, const aiSc
state.offset += mesh->mNumVertices;
}
static void proc_node(proc_state& state, glm::mat4 mat, aiNode* node, const aiScene* scene)
static void proc_node(ProcState& state, glm::mat4 mat, aiNode* node, const aiScene* scene)
{
auto m = node->mTransformation;
mat = glm::mat4(
@ -145,7 +145,7 @@ static unsigned int proc_embedded_texture(aiTexture* tex)
void Mesh::load_model(std::string base, std::string filename)
{
proc_state state {.base = base};
ProcState state {.base = base};
std::string path = base + "/" + filename;
Assimp::Importer importer;

View File

@ -31,7 +31,7 @@ static void set_all(bool state)
}
}
struct core_monitor : public Focus::Focus
struct CoreMonitor : public Focus::FocusType
{
virtual void on_keypress(int key, int sc, int action, int mods)
{
@ -72,14 +72,14 @@ struct core_monitor : public Focus::Focus
}
};
struct core_joystick : public Focus::Focus
struct CoreJoystick : public Focus::FocusType
{
virtual void on_cursor_pos(double x, double y)
{
Sim::System::active.reactor->add_rod_speed(y * 1e-6);
}
virtual ~core_joystick()
virtual ~CoreJoystick()
{
Sim::System::active.reactor->reset_rod_speed();
}
@ -114,7 +114,7 @@ void Core::init()
mesh1.set(rmesh, GL_STATIC_DRAW);
unsigned int indices[] = {0, 1, 3, 0, 3, 2};
Arrays::vertex vertices[] = {
Arrays::Vertex vertices[] = {
{Texture::handle_white, {0, 0}, {-0.75, -0.75, 0, 1}, {0, 0, -1}},
{Texture::handle_white, {0, 1}, {-0.75, 0.75, 0, 1}, {0, 0, -1}},
{Texture::handle_white, {1, 0}, { 0.75, -0.75, 0, 1}, {0, 0, -1}},
@ -145,9 +145,9 @@ void Core::update(double dt)
Sim::System& sys = Sim::System::active;
if(m_monitor.check_focus())
Focus::set(std::make_unique<core_monitor>());
Focus::set(std::make_unique<CoreMonitor>());
if(m_joystick.check_focus())
Focus::set(std::make_unique<core_joystick>());
Focus::set(std::make_unique<CoreJoystick>());
if(m_scram.check_focus())
sys.reactor->scram();
if(m_buttons[0].check_focus())

View File

@ -3,7 +3,7 @@
#include "../mesh/glmesh.hpp"
namespace Sim::Graphics::monitor
namespace Sim::Graphics::Monitor
{
class Core

View File

@ -15,16 +15,16 @@
using namespace Sim::Graphics;
using namespace Sim::Graphics::Monitor;
struct valve_joystick : public Focus::Focus
struct ValveJoystick : public Focus::FocusType
{
Sim::Coolant::Valve* active;
valve_joystick(Sim::Coolant::Valve* v) : active(v)
ValveJoystick(Sim::Coolant::Valve* v) : active(v)
{
}
virtual ~valve_joystick()
virtual ~ValveJoystick()
{
active->clear_open_speed();
}
@ -159,9 +159,9 @@ void PrimaryLoop::update(double dt)
}
if(m_joystick_turbine_bypass.check_focus())
Focus::set(std::make_unique<valve_joystick>(sys.turbine_bypass_valve.get()));
Focus::set(std::make_unique<ValveJoystick>(sys.turbine_bypass_valve.get()));
if(m_joystick_turbine_inlet.check_focus())
Focus::set(std::make_unique<valve_joystick>(sys.turbine_inlet_valve.get()));
Focus::set(std::make_unique<ValveJoystick>(sys.turbine_inlet_valve.get()));
if(m_switch_pump.check_focus())
sys.primary_pump->powered = !sys.primary_pump->powered;
if(m_switch_inlet.check_focus())

View File

@ -3,7 +3,7 @@
#include "../mesh/glmesh.hpp"
namespace Sim::Graphics::monitor
namespace Sim::Graphics::Monitor
{
class PrimaryLoop

View File

@ -3,7 +3,7 @@
#include "../mesh/glmesh.hpp"
namespace Sim::Graphics::monitor
namespace Sim::Graphics::Monitor
{
class SecondaryLoop

View File

@ -3,7 +3,7 @@
#include "../mesh/glmesh.hpp"
namespace Sim::Graphics::monitor
namespace Sim::Graphics::Monitor
{
class Turbine

View File

@ -78,7 +78,7 @@ void Vessel::update(double dt)
continue;
}
auto br = (Sim::Reactor::control::BoronRod*)r;
auto br = (Sim::Reactor::Control::BoronRod*)r;
double v = br->get_inserted();
if(v > crod_max)

View File

@ -3,7 +3,7 @@
#include "../mesh/glmesh.hpp"
namespace Sim::Graphics::monitor
namespace Sim::Graphics::Monitor
{
class Vessel

View File

@ -18,8 +18,8 @@
using namespace Sim::Graphics;
static GLMesh StaticMeshData;
static widget::Clock WidgetClock;
static GLMesh s_mesh;
static Widget::Clock w_clock;
void UI::init()
{
@ -27,24 +27,24 @@ void UI::init()
unsigned int handle = Texture::handle_white;
const unsigned int indices[] = {0, 1, 3, 0, 3, 2};
const Arrays::vertex vertices[] = {
Arrays::vertex(handle, {0, 0}, {-1, -1, 0, 1}, {0, 0, -1}),
Arrays::vertex(handle, {0, 1}, {-1, 1, 0, 1}, {0, 0, -1}),
Arrays::vertex(handle, {1, 0}, { 1, -1, 0, 1}, {0, 0, -1}),
Arrays::vertex(handle, {1, 1}, { 1, 1, 0, 1}, {0, 0, -1}),
const Arrays::Vertex vertices[] = {
Arrays::Vertex(handle, {0, 0}, {-1, -1, 0, 1}, {0, 0, -1}),
Arrays::Vertex(handle, {0, 1}, {-1, 1, 0, 1}, {0, 0, -1}),
Arrays::Vertex(handle, {1, 0}, { 1, -1, 0, 1}, {0, 0, -1}),
Arrays::Vertex(handle, {1, 1}, { 1, 1, 0, 1}, {0, 0, -1}),
};
m.set_indices(indices, 6);
m.set_vertices(vertices, 4);
StaticMeshData.bind();
StaticMeshData.set(m, GL_STATIC_DRAW);
StaticMeshData.colour_matrix = glm::scale(glm::mat4(1), glm::vec3(1) * 0.75f);
s_mesh.bind();
s_mesh.set(m, GL_STATIC_DRAW);
s_mesh.colour_matrix = glm::scale(glm::mat4(1), glm::vec3(1) * 0.75f);
}
void UI::update(double dt)
{
WidgetClock.update(dt);
w_clock.update(dt);
}
void UI::render()
@ -58,10 +58,10 @@ void UI::render()
glUniformMatrix4fv(Shader::gl_projection, 1, false, &mat_projection[0][0]);
glUniformMatrix4fv(Shader::gl_camera, 1, false, &mat_camera[0][0]);
StaticMeshData.bind();
StaticMeshData.uniform();
StaticMeshData.render();
s_mesh.bind();
s_mesh.uniform();
s_mesh.render();
WidgetClock.render();
w_clock.render();
}

View File

@ -3,7 +3,7 @@
#include "../mesh/glmesh.hpp"
namespace Sim::Graphics::widget
namespace Sim::Graphics::Widget
{
struct Clock

View File

@ -33,11 +33,11 @@ static GLFWwindow* win;
static bool win_should_close = false;
static GLMesh mesh_scene;
static monitor::Vessel monitor_vessel;
static monitor::Core monitor_core;
static monitor::PrimaryLoop monitor_primary_loop;
static monitor::SecondaryLoop monitor_secondary_loop;
static monitor::Turbine monitor_turbine;
static Monitor::Vessel monitor_vessel;
static Monitor::Core monitor_core;
static Monitor::PrimaryLoop monitor_primary_loop;
static Monitor::SecondaryLoop monitor_secondary_loop;
static Monitor::Turbine monitor_turbine;
glm::mat4 Window::projection_matrix;

View File

@ -11,7 +11,7 @@
using namespace Sim::Reactor;
Sim::Reactor::Reactor Sim::Reactor::Builder(const int W, const int H, const double CW, const double CH, fuel::FuelRod fr, coolant::Vessel* v, const char** lines)
Sim::Reactor::Reactor Sim::Reactor::Builder(const int W, const int H, const double CW, const double CH, Fuel::FuelRod fr, Coolant::Vessel* v, const char** lines)
{
std::vector<std::unique_ptr<Rod>> arr(W * H);
@ -24,19 +24,19 @@ Sim::Reactor::Reactor Sim::Reactor::Builder(const int W, const int H, const doub
switch(c)
{
case 'F':
r = std::make_unique<fuel::FuelRod>(fr);
r = std::make_unique<Fuel::FuelRod>(fr);
break;
case 'C':
r = std::make_unique<control::BoronRod>(v);
r = std::make_unique<Control::BoronRod>(v);
break;
case 'G':
r = std::make_unique<control::GraphiteRod>();
r = std::make_unique<Control::GraphiteRod>();
break;
case 'H':
r = std::make_unique<coolant::Heater>();
r = std::make_unique<Coolant::Heater>();
break;
case 'P':
r = std::make_unique<coolant::Pipe>(v);
r = std::make_unique<Coolant::Pipe>(v);
break;
default:
r = std::make_unique<Rod>();
@ -49,22 +49,22 @@ Sim::Reactor::Reactor Sim::Reactor::Builder(const int W, const int H, const doub
return Reactor(&arr[0], W, H, CW, CH);
}
std::unique_ptr<Rod> Sim::Reactor::load_rod(const Json::Value& node, coolant::Vessel* v)
std::unique_ptr<Rod> Sim::Reactor::load_rod(const Json::Value& node, Coolant::Vessel* v)
{
int id = node["id"].asInt();
switch(id)
{
case 1:
return std::make_unique<fuel::FuelRod>(node);
return std::make_unique<Fuel::FuelRod>(node);
case 2:
return std::make_unique<coolant::Pipe>(node, v);
return std::make_unique<Coolant::Pipe>(node, v);
case 3:
return std::make_unique<coolant::Heater>(node);
return std::make_unique<Coolant::Heater>(node);
case 4:
return std::make_unique<control::GraphiteRod>(node);
return std::make_unique<Control::GraphiteRod>(node);
case 5:
return std::make_unique<control::BoronRod>(node, v);
return std::make_unique<Control::BoronRod>(node, v);
}
return std::make_unique<Rod>();

View File

@ -11,8 +11,8 @@
namespace Sim::Reactor
{
Reactor Builder(const int W, const int H, const double CW, const double CH, fuel::FuelRod fr, coolant::Vessel* v, const char** lines);
std::unique_ptr<Rod> load_rod(const Json::Value& node, coolant::Vessel* v);
Reactor Builder(const int W, const int H, const double CW, const double CH, Fuel::FuelRod fr, Coolant::Vessel* v, const char** lines);
std::unique_ptr<Rod> load_rod(const Json::Value& node, Coolant::Vessel* v);
};

View File

@ -9,7 +9,7 @@ constexpr double boron_density = 2340000; // g/m^3
constexpr double boron_molar_mass = 10; // g/mol
constexpr double boron_molar_density = boron_density / boron_molar_mass; // mol/m^3
BoronRod::BoronRod(const Json::Value& node, coolant::Vessel* v) : coolant::Pipe(node, v)
BoronRod::BoronRod(const Json::Value& node, Coolant::Vessel* v) : Coolant::Pipe(node, v)
{
inserted = node["inserted"].asDouble();
absorbed = node["absorbed"].asDouble();
@ -17,13 +17,13 @@ BoronRod::BoronRod(const Json::Value& node, coolant::Vessel* v) : coolant::Pipe(
Json::Value BoronRod::serialize() const
{
Json::Value node(coolant::Pipe::serialize());
Json::Value node(Coolant::Pipe::serialize());
node["inserted"] = inserted;
node["absorbed"] = absorbed;
return node;
}
BoronRod::BoronRod(coolant::Vessel* v) : coolant::Pipe(v)
BoronRod::BoronRod(Coolant::Vessel* v) : Coolant::Pipe(v)
{
}

View File

@ -3,10 +3,10 @@
#include "../coolant/pipe.hpp"
namespace Sim::Reactor::control
namespace Sim::Reactor::Control
{
class BoronRod : public coolant::Pipe
class BoronRod : public Coolant::Pipe
{
double inserted = 1;
double absorbed = 0;
@ -18,8 +18,8 @@ class BoronRod : public coolant::Pipe
public:
BoronRod(coolant::Vessel* v);
BoronRod(const Json::Value& node, coolant::Vessel* v);
BoronRod(Coolant::Vessel* v);
BoronRod(const Json::Value& node, Coolant::Vessel* v);
virtual Json::Value serialize() const;
virtual void update(double secs);

View File

@ -3,7 +3,7 @@
#include "../rod.hpp"
namespace Sim::Reactor::control
namespace Sim::Reactor::Control
{
class GraphiteRod : public Sim::Reactor::Rod

View File

@ -3,7 +3,7 @@
#include "../rod.hpp"
namespace Sim::Reactor::coolant
namespace Sim::Reactor::Coolant
{
class Heater : public Sim::Reactor::Rod

View File

@ -4,13 +4,13 @@
using namespace Sim::Reactor::Coolant;
Pipe::Pipe(coolant::Vessel* v)
Pipe::Pipe(Coolant::Vessel* v)
{
this->vessel = v;
this->steam = 0;
}
Pipe::Pipe(const Json::Value& node, coolant::Vessel* v) : vessel(v)
Pipe::Pipe(const Json::Value& node, Coolant::Vessel* v) : vessel(v)
{
steam = node["steam"].asDouble();
}

View File

@ -4,14 +4,14 @@
#include "vessel.hpp"
#include "../rod.hpp"
namespace Sim::Reactor::coolant
namespace Sim::Reactor::Coolant
{
class Pipe : public Sim::Reactor::Rod
{
protected:
coolant::Vessel* vessel;
Coolant::Vessel* vessel;
double steam;
virtual double get_k(Sim::Reactor::Rod::val_t type) const;
@ -22,8 +22,8 @@ protected:
public:
Pipe(coolant::Vessel* v);
Pipe(const Json::Value& node, coolant::Vessel* v);
Pipe(Coolant::Vessel* v);
Pipe(const Json::Value& node, Coolant::Vessel* v);
virtual Json::Value serialize() const;
virtual std::unique_ptr<Rod> clone() const { return std::make_unique<Pipe>(*this); }

View File

@ -67,7 +67,7 @@ void Vessel::update(double secs)
steam_last = steam;
steam_suspended += diff;
steam_suspended *= Reactor::fuel::half_life::get(secs, bubble_hl);
steam_suspended *= Reactor::Fuel::half_life::get(secs, bubble_hl);
if(steam_suspended < 0)
{

View File

@ -5,7 +5,7 @@
#include "../../coolant/fluid_holder.hpp"
namespace Sim::Reactor::coolant
namespace Sim::Reactor::Coolant
{
class Vessel : public Sim::Coolant::FluidHolder

View File

@ -4,7 +4,7 @@
#include "sample.hpp"
#include "../rod.hpp"
namespace Sim::Reactor::fuel
namespace Sim::Reactor::Fuel
{
class FuelRod : public Sim::Reactor::Rod

View File

@ -3,7 +3,7 @@
#include <cmath>
namespace Sim::Reactor::fuel::half_life
namespace Sim::Reactor::Fuel::half_life
{
const double Te_135 = 19;

View File

@ -5,14 +5,14 @@
#include <ostream>
namespace Sim::Reactor::fuel
namespace Sim::Reactor::Fuel
{
class Sample
{
constexpr static const double Xe_135_M = 1e6;
Sim::Reactor::fuel::Waste waste;
Sim::Reactor::Fuel::Waste waste;
// mol
double fuel = 0;

View File

@ -3,7 +3,7 @@
#include <json/json.h>
namespace Sim::Reactor::fuel
namespace Sim::Reactor::Fuel
{
class Waste

View File

@ -246,7 +246,7 @@ void Reactor::get_stats(Rod::val_t type, double& min, double& max)
}
}
Reactor::Reactor(const Json::Value& node, coolant::Vessel* v) :
Reactor::Reactor(const Json::Value& node, Coolant::Vessel* v) :
cell_width(node["cell_width"].asDouble()),
cell_height(node["cell_height"].asDouble()),
width(node["width"].asInt()),

View File

@ -27,7 +27,7 @@ struct Reactor
int cursor;
Reactor(std::unique_ptr<Rod>* rods, int width, int height, double cell_width, double cell_height);
Reactor(const Json::Value& node, coolant::Vessel* v);
Reactor(const Json::Value& node, Coolant::Vessel* v);
Reactor(const Reactor& r);
Reactor(Reactor&& r);

View File

@ -38,8 +38,8 @@ System::System()
" C C C C "
};
vessel = std::make_unique<Reactor::coolant::Vessel>(Sim::Coolant::WATER, 8, 10, 6e6, 5e5, 10);
reactor = std::make_unique<Reactor::Reactor>(Sim::Reactor::Builder(19, 19, 1.0 / 4.0, 4, Reactor::fuel::FuelRod(0.2), vessel.get(), layout));
vessel = std::make_unique<Reactor::Coolant::Vessel>(Sim::Coolant::WATER, 8, 10, 6e6, 5e5, 10);
reactor = std::make_unique<Reactor::Reactor>(Sim::Reactor::Builder(19, 19, 1.0 / 4.0, 4, Reactor::Fuel::FuelRod(0.2), vessel.get(), layout));
condenser = std::make_unique<Coolant::Condenser>(Sim::Coolant::WATER, 6, 4, 3e6, 30000);
turbine = std::make_unique<Electric::Turbine>(Sim::Coolant::WATER, condenser.get(), 6, 3, 2e6);
@ -59,7 +59,7 @@ System::System(const Json::Value& node)
{
clock = node["clock"].asDouble();
vessel = std::make_unique<Reactor::coolant::Vessel>(node["vessel"]);
vessel = std::make_unique<Reactor::Coolant::Vessel>(node["vessel"]);
reactor = std::make_unique<Reactor::Reactor>(node["reactor"], vessel.get());
condenser = std::make_unique<Coolant::Condenser>(node["condenser"]);
turbine = std::make_unique<Electric::Turbine>(node["turbine"], condenser.get());

View File

@ -22,7 +22,7 @@ struct System
static System active;
std::unique_ptr<Sim::Reactor::Reactor> reactor;
std::unique_ptr<Sim::Reactor::coolant::Vessel> vessel;
std::unique_ptr<Sim::Reactor::Coolant::Vessel> vessel;
std::unique_ptr<Sim::Coolant::Sink> sink;
std::unique_ptr<Sim::Coolant::Condenser> condenser;