move code
This commit is contained in:
parent
eb1dabfe82
commit
d45bfe310a
16
src/main.cpp
16
src/main.cpp
|
@ -1,8 +1,8 @@
|
|||
|
||||
#include "reactor.hpp"
|
||||
#include "control/control_rod.hpp"
|
||||
#include "fuel/fuel_rod.hpp"
|
||||
#include "coolant/pipe.hpp"
|
||||
#include "reactor/reactor.hpp"
|
||||
#include "reactor/control/control_rod.hpp"
|
||||
#include "reactor/fuel/fuel_rod.hpp"
|
||||
#include "reactor/coolant/pipe.hpp"
|
||||
#include "display.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
@ -18,12 +18,12 @@ int main()
|
|||
nodelay(stdscr, TRUE);
|
||||
curs_set(0);
|
||||
|
||||
sim::reactor<2, 2> reactor({
|
||||
new sim::fuel::fuel_rod(100, 400), new sim::fuel::fuel_rod(100, 400),
|
||||
new sim::control::control_rod(1000), new sim::coolant::pipe()
|
||||
sim::reactor::reactor<2, 2> reactor({
|
||||
new sim::reactor::fuel::fuel_rod(100, 400), new sim::reactor::fuel::fuel_rod(100, 400),
|
||||
new sim::reactor::control::control_rod(1000), new sim::reactor::coolant::pipe()
|
||||
});
|
||||
|
||||
((sim::control::control_rod*)reactor.rods[0][1])->set_reactivity(0.99);
|
||||
((sim::reactor::control::control_rod*)reactor.rods[0][1])->set_reactivity(0.99);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "control_rod.hpp"
|
||||
|
||||
using namespace sim::control;
|
||||
using namespace sim::reactor::control;
|
||||
|
||||
control_rod::control_rod(double limit)
|
||||
{
|
|
@ -3,17 +3,17 @@
|
|||
|
||||
#include "../rod.hpp"
|
||||
|
||||
namespace sim::control
|
||||
namespace sim::reactor::control
|
||||
{
|
||||
|
||||
class control_rod : public sim::rod
|
||||
class control_rod : public sim::reactor::rod
|
||||
{
|
||||
double inserted = 1;
|
||||
double absorbed = 0;
|
||||
double limit;
|
||||
|
||||
virtual const char* get_name() const;
|
||||
virtual double get_k(sim::rod::val_t type) const;
|
||||
virtual double get_k(sim::reactor::rod::val_t type) const;
|
||||
virtual void display(std::ostream& o) const;
|
||||
|
||||
public:
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
#include "pipe.hpp"
|
||||
|
||||
using namespace sim::coolant;
|
||||
using namespace sim::reactor::coolant;
|
||||
|
||||
const char* pipe::get_name() const
|
||||
{
|
||||
return "Coolant Pipe";
|
||||
}
|
||||
|
||||
double pipe::get_k(sim::rod::val_t type) const
|
||||
double pipe::get_k(val_t type) const
|
||||
{
|
||||
switch(type)
|
||||
{
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
#include "../rod.hpp"
|
||||
|
||||
namespace sim::coolant
|
||||
namespace sim::reactor::coolant
|
||||
{
|
||||
|
||||
class pipe : public sim::rod
|
||||
class pipe : public sim::reactor::rod
|
||||
{
|
||||
virtual const char* get_name() const;
|
||||
virtual double get_k(sim::rod::val_t type) const;
|
||||
virtual double get_k(sim::reactor::rod::val_t type) const;
|
||||
|
||||
public:
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "fuel_rod.hpp"
|
||||
|
||||
using namespace sim::fuel;
|
||||
using namespace sim::reactor::fuel;
|
||||
|
||||
fuel_rod::fuel_rod(double fuel, double mass) : s(fuel, mass)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ const char* fuel_rod::get_name() const
|
|||
return "Fuel";
|
||||
}
|
||||
|
||||
double fuel_rod::get_k(sim::rod::val_t type) const
|
||||
double fuel_rod::get_k(val_t type) const
|
||||
{
|
||||
switch(type)
|
||||
{
|
|
@ -4,15 +4,15 @@
|
|||
#include "sample.hpp"
|
||||
#include "../rod.hpp"
|
||||
|
||||
namespace sim::fuel
|
||||
namespace sim::reactor::fuel
|
||||
{
|
||||
|
||||
class fuel_rod : public sim::rod
|
||||
class fuel_rod : public sim::reactor::rod
|
||||
{
|
||||
sample s;
|
||||
|
||||
virtual const char* get_name() const;
|
||||
virtual double get_k(sim::rod::val_t type) const;
|
||||
virtual double get_k(sim::reactor::rod::val_t type) const;
|
||||
virtual void display(std::ostream& o) const;
|
||||
|
||||
public:
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <cmath>
|
||||
|
||||
namespace sim::fuel::half_life
|
||||
namespace sim::reactor::fuel::half_life
|
||||
{
|
||||
|
||||
const double Te_135 = 19;
|
|
@ -2,7 +2,7 @@
|
|||
#include "sample.hpp"
|
||||
#include "half_life.hpp"
|
||||
|
||||
using namespace sim::fuel;
|
||||
using namespace sim::reactor::fuel;
|
||||
|
||||
static const double Xe_135_M = 1e4;
|
||||
static const double NEUTRON_BG = 1e-10;
|
||||
|
@ -17,7 +17,7 @@ void sample::update(double secs)
|
|||
{
|
||||
double m;
|
||||
|
||||
// sim::fuelulate waste and extract products
|
||||
// sim::reactor::fuelulate waste and extract products
|
||||
waste.update(secs);
|
||||
fast_neutrons += waste.extract_neutrons();
|
||||
energy += waste.extract_energy();
|
||||
|
@ -49,7 +49,7 @@ void sample::update(double secs)
|
|||
if(neutrons_xenon > xe_135) neutrons_xenon = xe_135;
|
||||
if(neutrons_iodine > i_135) neutrons_iodine = i_135;
|
||||
|
||||
// sim::fuelulate fuel use
|
||||
// sim::reactor::fuelulate fuel use
|
||||
fuel -= neutrons_fuel;
|
||||
energy += neutrons_fuel;
|
||||
fast_neutrons += neutrons_fuel * 3;
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
#include <ostream>
|
||||
|
||||
namespace sim::fuel
|
||||
namespace sim::reactor::fuel
|
||||
{
|
||||
|
||||
class sample
|
||||
{
|
||||
sim::fuel::waste waste;
|
||||
sim::reactor::fuel::waste waste;
|
||||
|
||||
double fuel = 0;
|
||||
double i_135 = 0;
|
|
@ -2,7 +2,7 @@
|
|||
#include "waste.hpp"
|
||||
#include "half_life.hpp"
|
||||
|
||||
using namespace sim::fuel;
|
||||
using namespace sim::reactor::fuel;
|
||||
|
||||
void waste::update(double secs)
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
namespace sim::fuel
|
||||
namespace sim::reactor::fuel
|
||||
{
|
||||
|
||||
class waste
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <array>
|
||||
|
||||
namespace sim
|
||||
namespace sim::reactor
|
||||
{
|
||||
|
||||
template <int W, int H>
|
||||
|
@ -14,9 +14,9 @@ struct reactor
|
|||
const static int width = W;
|
||||
const static int height = H;
|
||||
|
||||
std::array<std::array<sim::rod*, H>, W> rods;
|
||||
std::array<std::array<rod*, H>, W> rods;
|
||||
|
||||
reactor(std::array<sim::rod*, W * H> rods)
|
||||
reactor(std::array<rod*, W * H> rods)
|
||||
{
|
||||
for(int y = 0; y < H; y++)
|
||||
for(int x = 0; x < W; x++)
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "rod.hpp"
|
||||
|
||||
using namespace sim;
|
||||
using namespace sim::reactor;
|
||||
|
||||
double rod::get(val_t type) const
|
||||
{
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <ostream>
|
||||
|
||||
namespace sim
|
||||
namespace sim::reactor
|
||||
{
|
||||
|
||||
class rod
|
Loading…
Reference in New Issue