CYCLUS
facility.h
Go to the documentation of this file.
1 #ifndef CYCLUS_SRC_FACILITY_H_
2 #define CYCLUS_SRC_FACILITY_H_
3 
4 #include <string>
5 #include <vector>
6 #include <set>
7 
8 #include "agent.h"
9 #include "time_listener.h"
10 #include "trader.h"
11 
12 namespace cyclus {
13 
14 // forward declare Material class to avoid full inclusion and dependency
15 class Material;
16 class Institution;
17 
18 /// @class Facility
19 /// The Facility class is the abstract class/interface used by all
20 /// facility agents
21 ///
22 /// This is all that is known externally about facilities
23 ///
24 /// @section intro Introduction
25 ///
26 /// The Facility type plays a primary role in Cyclus. A Facility
27 /// facility is where offers and requests are generated and transmitted to a
28 /// ResourceExchange and where shipments of material, issued by the exchange, are
29 /// executed. The algorithms to determine what offers and requests are issued and
30 /// how material shipments are handled are the primary differentiators between
31 /// different Facility implementations.
32 ///
33 /// Like all agent implementations, there are a number of implementations that
34 /// are distributed as part of the core Cyclus application as well as
35 /// implementations contributed by third-party developers. The links below
36 /// describe additional parameters necessary for the complete definition of a
37 /// facility of that implementation.
38 ///
39 /// @section available Available Core Implementations
40 ///
41 /// - SourceFacility: A facility that can produce a constant (or
42 /// infinite) amount of some commodity
43 /// - SinkFacility: A facility that can consume a constant (or infinite)
44 /// amount of some commodity
45 /// - NullFacility: A facility that consumes a constant amount of one
46 /// commodity and produces a constant amount of another
47 ///
48 ///
49 /// @section anticipated Anticipated Core Implementations
50 ///
51 /// Developers are encouraged to add to this list and create pages that
52 /// describe the detailed behavior of these agents.
53 ///
54 /// - RecipeReactor: A facility that consumes a fixed fresh fuel recipe
55 /// one a time scale governed by reactor cycle lengths and batch sizes,
56 /// and produced a fixed/corresponding spent fuel recipe at the same
57 /// frequency - SeparationsMatrixFacility: A facility that consumes a
58 /// fixed quantity of material of one commodity and produces many
59 /// different output streams with the input nuclides distributed across
60 /// those output streams according to a fixed matrix
61 /// - EnrichmentFacility: A facility that offers a fixed quantity of SWUs
62 /// to accomplish enrichment of material
63 ///
64 /// @section thirdparty Third-party Implementations
65 ///
66 /// Collaborators are encouraged to add to this list and link to external
67 /// pages that describe how to get the agents and the detailed behavior
68 class Facility : public TimeListener, public Agent, public Trader {
69  public:
70  Facility(Context* ctx);
71 
72  virtual ~Facility();
73 
74  // DO NOT call Agent class implementation of this method
75  virtual void InfileToDb(InfileTree* qe, DbInit di) {}
76 
77  // DO NOT call Agent class implementation of this method
78  virtual void InitFrom(QueryableBackend* b) {}
79 
80  // DO NOT call Agent class implementation of this method
81  virtual void Snapshot(DbInit di) {}
82 
83  /// Copy module members from a source agent
84  /// Any facility subclassing facility agent should invoke their own InitFrom
85  /// method, calling Facility's first!
86  /// @param m the agent to copy from
87  void InitFrom(Facility* m);
88 
89  /// @brief builds the facility in the simulation
90  /// @param parent the parent of this facility
91  virtual void Build(Agent* parent);
92 
93  virtual void EnterNotify();
94 
95  /// decommissions the facility, default behavior is for the facility
96  /// to delete itself
97  virtual void Decommission();
98 
99  /// facilities over write this method if a condition must be met
100  /// before their destructors can be called
101  virtual bool CheckDecommissionCondition();
102 
103  /// every agent should be able to print a verbose description
104  virtual std::string str();
105 };
106 
107 } // namespace cyclus
108 
109 #endif // CYCLUS_SRC_FACILITY_H_
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition: pyne.cc:11180
virtual std::string str()
every agent should be able to print a verbose description
Definition: facility.cc:37
A class for extracting information from a given XML parser.
Definition: infile_tree.h:22
virtual void Decommission()
decommissions the facility, default behavior is for the facility to delete itself ...
Definition: facility.cc:45
virtual ~Facility()
Definition: facility.cc:20
A simple API for agents that wish to exchange resources in the simulation.
Definition: trader.h:24
virtual bool CheckDecommissionCondition()
facilities over write this method if a condition must be met before their destructors can be called ...
Definition: facility.cc:55
virtual void EnterNotify()
Called to give the agent an opportunity to register for services (e.g.
Definition: facility.cc:31
The Facility class is the abstract class/interface used by all facility agents.
Definition: facility.h:68
DbInit provides an interface for agents to record data to the output db that automatically injects th...
Definition: db_init.h:14
virtual void InfileToDb(InfileTree *qe, DbInit di)
Translates info for the agent from an input file to the database by reading parameters from the passe...
Definition: facility.h:75
The TimeListener class is an inheritable class for any Agent that requires knowlege of ticks and tock...
Definition: time_listener.h:23
Facility(Context *ctx)
Definition: facility.cc:16
A simulation context provides access to necessary simulation-global functions and state...
Definition: context.h:128
The abstract base class used by all types of agents that live and interact in a simulation.
Definition: agent.h:51
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Definition: agent.cc:14
Agent * parent() const
Returns parent of this agent. Returns NULL if the agent has no parent.
Definition: agent.h:375
virtual void InitFrom(QueryableBackend *b)
Intializes an agent&#39;s internal state from the database.
Definition: facility.h:78
Interface implemented by backends that support rudimentary querying.
virtual void Build(Agent *parent)
builds the facility in the simulation
Definition: facility.cc:27
virtual void Snapshot(DbInit di)
Snapshots agent-internal state to the database via the DbInit var di.
Definition: facility.h:81