From d07a4fa2a4ef65f6f095b79344ae2b338ce9aca8 Mon Sep 17 00:00:00 2001
From: Baptiste Mouginot <mouginot.baptiste@gmail.com>
Date: Thu, 19 Jun 2014 10:16:53 +0000
Subject: [PATCH] Improve inheritance in Facility;

Add a FuelDataBankCopy

git-svn-id: svn+ssh://svn.in2p3.fr/class@262 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 .../branches/CLASSV3/include/CLASSBackEnd.hxx |   3 +
 .../CLASSV3/include/CLASSFacility.hxx         |   6 +-
 .../branches/CLASSV3/include/CLASSObject.hxx  |   2 +
 .../CLASSV3/include/FuelDataBankCOpy.hxx      | 220 ++++++++++++
 source/branches/CLASSV3/include/IM_RK4.hxx    |  20 +-
 .../CLASSV3/include/IrradiationModel.hxx      |  32 +-
 source/branches/CLASSV3/include/Pool.hxx      |  17 +-
 source/branches/CLASSV3/src/CLASSBackEnd.cxx  |  11 +
 source/branches/CLASSV3/src/CLASSFacility.cxx |  38 +-
 source/branches/CLASSV3/src/CLASSObject.cxx   |   4 +
 source/branches/CLASSV3/src/EvolutionData.cxx |   5 +-
 .../branches/CLASSV3/src/FabricationPlant.cxx |  12 +-
 source/branches/CLASSV3/src/IM_RK4.cxx        |  66 ++--
 .../branches/CLASSV3/src/IrradiationModel.cxx | 332 ++++++++++++++++++
 source/branches/CLASSV3/src/Makefile          |   4 +-
 source/branches/CLASSV3/src/Pool.cxx          |  38 +-
 source/branches/CLASSV3/src/Reactor.cxx       |  43 +--
 source/branches/CLASSV3/src/Storage.cxx       |   6 +-
 18 files changed, 697 insertions(+), 162 deletions(-)
 create mode 100644 source/branches/CLASSV3/include/FuelDataBankCOpy.hxx

diff --git a/source/branches/CLASSV3/include/CLASSBackEnd.hxx b/source/branches/CLASSV3/include/CLASSBackEnd.hxx
index 6e6df7b83..7a84b0061 100644
--- a/source/branches/CLASSV3/include/CLASSBackEnd.hxx
+++ b/source/branches/CLASSV3/include/CLASSBackEnd.hxx
@@ -42,6 +42,8 @@ class CLASSBackEnd : public CLASSFacility
 	public :
 	///< Normal Constructor.
 	CLASSBackEnd();
+	CLASSBackEnd(LogFile* log);
+	CLASSBackEnd(LogFile* log, cSecond cycletime);
 
 	//********* Get Method *********//
 	/*!
@@ -79,6 +81,7 @@ class CLASSBackEnd : public CLASSFacility
 	void		ClearIVArray();					//!< Empty the IVArray removing all fuel stored
 
 	//@}
+	virtual void Evolution(cSecond t)	{}	//!< Performe the Evolution to the Time t
 
 
 	protected :
diff --git a/source/branches/CLASSV3/include/CLASSFacility.hxx b/source/branches/CLASSV3/include/CLASSFacility.hxx
index fb2043044..bb85aef4b 100644
--- a/source/branches/CLASSV3/include/CLASSFacility.hxx
+++ b/source/branches/CLASSV3/include/CLASSFacility.hxx
@@ -41,6 +41,10 @@ class CLASSFacility : public CLASSObject
 public :
 		///< Normal Constructor.
 	CLASSFacility();
+	CLASSFacility(LogFile* log);
+	CLASSFacility(LogFile* log, cSecond cycletime);
+	CLASSFacility(LogFile* log, cSecond creationtime, cSecond lifetime);
+	CLASSFacility(LogFile* log, cSecond startingtime, cSecond lifetime, cSecond cycletime);
 	
 		//********* Get Method *********//
 	/*!
@@ -96,7 +100,7 @@ public :
 
 	void AddCumulativeIVIn(IsotopicVector IV) { fCumulativeIVIn += IV;}		//!< Add the Input IsotopicVector the The cumulative IV IN
 	void AddCumulativeIVOut(IsotopicVector IV) { fCumulativeIVOut += IV;}		//!< Add the Input IsotopicVector the The cumulative IV OUT
-	virtual void Evolution(cSecond t)	{ }	//!< Performe the Evolution to the Time t
+	virtual void Evolution(cSecond t)	= 0;	//!< Performe the Evolution to the Time t
 	virtual void Dump()			{ }	//!< Write Modification (IV In/Out, filling the TF...)
 		
 	//@}
diff --git a/source/branches/CLASSV3/include/CLASSObject.hxx b/source/branches/CLASSV3/include/CLASSObject.hxx
index d9ad4f63d..90f2b039c 100644
--- a/source/branches/CLASSV3/include/CLASSObject.hxx
+++ b/source/branches/CLASSV3/include/CLASSObject.hxx
@@ -39,6 +39,8 @@ class CLASSObject : public TNamed
 public :
 	///< Normal Constructor.
 	CLASSObject();
+	CLASSObject(LogFile* log);
+	
 	virtual CLASSObject* Clone()	{ return new CLASSObject(*this); } //!< Correct way to copy a CLASSObject in case of derivation
 
 
diff --git a/source/branches/CLASSV3/include/FuelDataBankCOpy.hxx b/source/branches/CLASSV3/include/FuelDataBankCOpy.hxx
new file mode 100644
index 000000000..868d20cbd
--- /dev/null
+++ b/source/branches/CLASSV3/include/FuelDataBankCOpy.hxx
@@ -0,0 +1,220 @@
+#ifndef __FuelDataBank_HXX__
+#define __FuelDataBank_HXX__
+
+/*!
+ \file
+ \brief Header file for FuelDataBank class.
+ @version 2.0
+ */
+
+#include "CLASSObject.hxx"
+#include "TMatrix.h"
+#include "IsotopicVector.hxx"
+#include "DynamicalSystem.hxx"
+#include "EvolutionData.hxx"
+
+#include <map>
+#include <vector>
+
+
+using namespace std;
+typedef long long int cSecond;
+
+class ZAI;
+class LogFile;
+
+double ReactionRateWeightedDistance(IsotopicVector IV1, EvolutionData DB );
+double ReactionRateWeightedDistance(EvolutionData DB, IsotopicVector IV1  );
+
+//-----------------------------------------------------------------------------//
+/*!
+ Define a FuelDataBank.
+ The aim of these class is describe the evolution of fuel evolution in CLASS.
+
+ \li the fuel
+
+
+ For the Fuel the FuelDataBank take the form of the IsotopicVector template which mainly contain a map of <IsotopicVector,EvolutionData>. This map do the correspondance between a IsotopicVector and its evolution throw irradiation (containing all the nuclei produced by the reaction on the original IsotopicVector)
+
+ @author BaM
+ @author Marc
+ @author PTO for a part the Decay management -- steal from MURE (Even if he does not kown it!! :))
+ @version 2.0
+ */
+//________________________________________________________________________
+
+
+
+class FuelDataBank : public CLASSObject, DynamicalSystem
+{
+
+	public :
+
+
+	//********* Constructor/Desctructor *********//
+
+	/*!
+	 \name Constructor/Desctructor
+	 */
+	//@{
+	/// Normal Constructor.
+	FuelDataBank();
+
+	//{
+	/// Special Constructor.
+	/*!
+	 Use to load a LogFile
+	 \param LogFile LogFile used for the log...
+	 \param DB_index_file path to the index file
+	 \param setlog if the log are stored in the LogFile
+	 \param olfreadmethod true if the old format of EvolutionData are used (ie without the key word such as Inv, XSFiss...)
+	 */
+	FuelDataBank(LogFile* Log, string DB_index_file, bool setlog = true, bool olfreadmethod = true );
+	//}
+
+	//{
+	/// Normal Destructor.
+	/*!
+	 Delete de FuelDataBank and all associated EvolutionData...
+	 */
+	~FuelDataBank();
+	//}
+
+	//{
+	/// Reset the FuelDataBank.
+	/*!
+	 Use to reset the FuelDataBank to its default values  whihout deleting the EvolutionData (which contain pointer... ).
+	 it does just clear the different maps
+	 */
+	void Clear();
+	//}
+	//@}
+
+
+
+
+	//********* Get Method *********//
+	/*!
+	 \name Get Method
+	 */
+	//@{
+	map<IsotopicVector ,EvolutionData >	GetFuelDataBank()	const	{ return fFuelDataBank; }	//!< Return the FuelDataBank
+	string 				GetDataBaseIndex()	const	{ return fDataBaseIndex; }	//!< Return the index Name
+	string				GetFuelType()		const	{ return fFuelType; }		//!< Return the fuel type of the DB
+	vector<double>			GetFuelParameter()	const	{ return fFuelParameter; }	//!< Return the Fuel parameter of the DB
+	pair<double,double>		GetBurnUpRange()	const	{ return fBurnUpRange;}		//!< Return the BurnUp range of the DB
+	bool 				IsDefine(IsotopicVector IV)	const;					//!< True the key is define, false unstead
+
+	map<double, EvolutionData>	GetDistancesTo(IsotopicVector isotopicvector, double t = 0) const;	//! Return a map containing the distance of each EvolutionData in the DataBase to the set IV at the t time
+	EvolutionData	GetClosest(IsotopicVector isotopicvector, double t = 0) const;	//! Return the closest EvolutionData from the FuelDataBank.
+
+
+
+	//@}
+
+
+
+
+	//********* Set Method *********//
+
+	/*!
+	 \name Set Method
+	 */
+	//@{
+
+	void SetFuelDataBank(map< IsotopicVector ,EvolutionData > mymap)	{ fFuelDataBank = mymap; }	//!< Set the FuelDataBank map
+
+	void SetDataBaseIndex(string database) { fDataBaseIndex = database;; ReadDataBase(); }	//!< Set the Name of the database index
+
+	EvolutionData GenerateEvolutionData(IsotopicVector isotopicvector, double cycletime, double Power); //!< Generation of a New EvolutionData From the one already present
+
+	void SetOldReadMethod(bool val)			{ fOldReadMethod = val; ReadDataBase();}			///< use the old reading method
+
+
+
+	void SetWeightedDistanceCalculation(bool val = true) { fWeightedDistance = val;}		///< Set weighted Distance calculation
+	void SetEvolutionDataInterpolation(bool val = true) { fEvolutionDataInterpolation = val;}		///< Set weighted Distance calculation
+
+	void SetDistanceParameter(IsotopicVector DistanceParameter);		///< Define mannually the weight for each ZAI in the distance calculation
+
+
+	//{
+	/// Define the way to decide if two isotopic vectors are close.
+	/*!
+	 // The different algorythm are:
+	 // \li 0 is for the standard norme,
+	 // \li 1 for each ZAI weighted with its XS,
+	 // \li 2 for each ZAI weighted with coefficient given by the user.
+	 */
+	void SetDistanceType(int DistanceType);
+	//}
+
+
+
+
+	//********* Evolution Method *********//
+
+	//@}
+	/*!
+	 \name Evolution Method
+	 */
+	//@{
+
+
+	void	CalculateDistanceParameter();		///< Calcul of the weight for each ZAI in the distance calculation from the mean XS of the FuelDataBank
+
+
+
+
+
+
+
+
+	//********* Other Method *********//
+	/*!
+	 \name Other Method
+	 */
+	//@{
+	void	ReadDataBase();				///< read the index file and fill the evolutionData map
+
+	void Print() const;
+
+	//@}
+
+
+
+
+
+	protected :
+
+
+	map<IsotopicVector, EvolutionData>	fFuelDataBank;		///< DataBanck map
+	map<IsotopicVector, EvolutionData>	fFuelDataBankCalculated;	///< Map of the already calculated EvolutionData (to avoid recalculation...)
+
+ 	string			fDataBaseIndex;			///< Name of the index
+
+	bool			fUseRK4EvolutionMethod; ///< if true use RK4 calculation, mtriciel unstead
+	bool			fOldReadMethod;		///< use old DB format
+	bool			fWeightedDistance;	///< USe XS weighted distance calculation
+	bool			fEvolutionDataInterpolation;	///< USe XS weighted distance calculation
+
+
+ 	string 			fFuelType;		///< Type of fuel of the FuelDataBank
+ 	pair<double,double>	fBurnUpRange;		///< Range of the Burn-up range of the FuelDataBank
+ 	vector<double>		fFuelParameter;		///< Parameter needed by the equivalence model
+
+
+
+	int 	fDistanceType;		///< Set the distance calculation algorytm
+	/// \li 0 is for the standard norm (Default = 0),
+	/// \li 1 for each ZAI weighted with its XS,
+	/// \li 2 for each ZAI weighted with coefficient given by the user.
+
+	IsotopicVector		fDistanceParameter;	///< weight for each ZAI in the distance calculation
+
+
+};
+
+
+
+#endif
diff --git a/source/branches/CLASSV3/include/IM_RK4.hxx b/source/branches/CLASSV3/include/IM_RK4.hxx
index 875847bcd..d829105d3 100644
--- a/source/branches/CLASSV3/include/IM_RK4.hxx
+++ b/source/branches/CLASSV3/include/IM_RK4.hxx
@@ -10,10 +10,15 @@
  @author BaM
  @version 2.0
  */
+#include "DynamicalSystem.hxx"
+#include "IrradiationModel.hxx"
 
 
 using namespace std;
 
+
+class LogFile;
+
 //-----------------------------------------------------------------------------//
 /*!
  Define a IM_RK4.
@@ -27,18 +32,23 @@ using namespace std;
 
 class EvolutionData;
 
-class IM_RK4 : public TObject, DynamicalSystem
+class IM_RK4 : public DynamicalSystem, IrradiationModel
 {
 	
 	public :
-	
+
+	IM_RK4();
+	IM_RK4(LogFile* Log);
+
+
+
 	/// virtueal method called to perform the irradiation calculation using a set of cross section.
 	/*!
 	 Perform the Irradiation Calcultion using the XSSet data
 	 \param IsotopicVector IV isotopic vector to irradiate
 	 \param EvolutionData XSSet set of corss section to use to perform the evolution calculation
 	 */
-	EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power);
+	EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power, double cycletime);
 	//}
 	
 	//********* RK4 Method *********//
@@ -49,9 +59,7 @@ class IM_RK4 : public TObject, DynamicalSystem
 	 */
 	//@{
 	
-	void	UseRK4EvolutionMethod(bool usemethod = true)	{fUseRK4EvolutionMethod = usemethod;}
-	
-	
+
 	using	DynamicalSystem::RungeKutta;
 	//!	Pre-treatment Runge-Kutta method.
 	/*!
diff --git a/source/branches/CLASSV3/include/IrradiationModel.hxx b/source/branches/CLASSV3/include/IrradiationModel.hxx
index 138b83950..295000784 100644
--- a/source/branches/CLASSV3/include/IrradiationModel.hxx
+++ b/source/branches/CLASSV3/include/IrradiationModel.hxx
@@ -12,8 +12,20 @@
  */
 
 
+#include "CLASSObject.hxx"
+#include "TMatrix.h"
+#include "IsotopicVector.hxx"
+#include "EvolutionData.hxx"
+
+#include <map>
+#include <vector>
+
+
 using namespace std;
+typedef long long int cSecond;
 
+class ZAI;
+class LogFile;
 //-----------------------------------------------------------------------------//
 /*!
  Define a IrradiationModel.
@@ -27,10 +39,11 @@ using namespace std;
 
 class EvolutionData;
 
-class IrradiationModel : public TObject
+class IrradiationModel : public CLASSObject
 {
 	
 	public :
+	IrradiationModel();
 	
 	/// virtueal method called to perform the irradiation calculation using a set of cross section.
 	/*!
@@ -40,7 +53,7 @@ class IrradiationModel : public TObject
 	 \param double Power, constant power to use for irradation
 	 \param double irradiationtime, time of the irradiation
 	 */
-	virtual	 EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power);
+	virtual	 EvolutionData GenerateEvolutionData(IsotopicVector IV, EvolutionData XSSet, double Power, double cycletime) { return 0;}
 	//}
 
 	
@@ -51,7 +64,9 @@ class IrradiationModel : public TObject
 	 \name Get Method
 	 */
 	//@{
-	
+	string	GetDataFileName()	const { return fDataFileName; }
+	string	GetDataDirectoryName()  const { return fDataDirectoryName; }
+
 	double  GetShorstestHalflife()	const { return fShorstestHalflife; }
 	
 	//@}
@@ -66,12 +81,7 @@ class IrradiationModel : public TObject
 	 */
 	//@{
 	
-	void SetFuelDataBank(map< IsotopicVector ,EvolutionData > mymap)	{ fFuelDataBank = mymap; }	//!< Set the FuelDataBank map
-	
-	void SetDataBaseIndex(string database) { fDataBaseIndex = database;; ReadDataBase(); }	//!< Set the Name of the database index
-	
 
-	
 	//{
 	/// set Fission Energy using a file
 	/*!
@@ -142,7 +152,9 @@ class IrradiationModel : public TObject
 	
 	double  fShorstestHalflife;
 	int	 fZAIThreshold;	//!< Lowest Mass deal by the evolution (default 90)
-	
+	string			fDataFileName;		///< Name of the decay list
+	string			fDataDirectoryName;	///< Path to the decay list file
+
 	
 	TMatrixT<double>		fDecayMatrix;	///< Matrix with half life of each nuclei
 	map<ZAI, double >		fFissionEnergy;	///< Store the Energy per fission use for the flux normalisation.
@@ -151,8 +163,6 @@ class IrradiationModel : public TObject
 	map<ZAI, IsotopicVector>	fReactionYield;		///< Store the reaction fission yield
 	
 
-	int	fNVar;		 //!< The size of the composition vector and /or number of ZAIs involved.
-	
 	
 	map<ZAI, int> findex_inver;	///< correspondance matrix from ZAI to the column (or line) of the different Reaction/Decay matrix
 	map<int, ZAI> findex;		///< correspondance matrix from the column (or line) of the different Reaction/Decay matrix to the ZAI
diff --git a/source/branches/CLASSV3/include/Pool.hxx b/source/branches/CLASSV3/include/Pool.hxx
index c497f6ab2..3198f6bee 100755
--- a/source/branches/CLASSV3/include/Pool.hxx
+++ b/source/branches/CLASSV3/include/Pool.hxx
@@ -46,17 +46,6 @@ public :
 	
 	Pool();				///< Normal Constructor.
 
-
-	//{
-	/// LogFile Constructor.
-	/*!
-	 Use create an empty Pool loading a LogFile
-	 \param LogFile LogFile used for the log...
-	 */
- 	Pool(LogFile* log);
-	//}
-
-
 	//{
 	/// Special Constructor.
 	/*!
@@ -65,8 +54,7 @@ public :
 	 \param abstime time to start the Pool
 	 \param coolingtime duration of the cooling.
 	 */
-	Pool(LogFile* Log, double abstime,
-			 double coolingtime = 5*3600.*24.*365.25); //!<
+	Pool(LogFile* Log, cSecond coolingtime = 5*3600.*24.*365.25); //!<
 	//}
 
 
@@ -80,8 +68,7 @@ public :
 	 \param coolingtime duration of the cooling.
 	 */
 	Pool(LogFile* log, CLASSBackEnd* Storage,
-			 double abstime = 0,
-			 double coolingtime = 5*3600.*24.*365.25); //!<
+			 cSecond coolingtime = 5*3600.*24.*365.25); //!<
 	//}
 
 
diff --git a/source/branches/CLASSV3/src/CLASSBackEnd.cxx b/source/branches/CLASSV3/src/CLASSBackEnd.cxx
index ae7dcad88..b49185071 100644
--- a/source/branches/CLASSV3/src/CLASSBackEnd.cxx
+++ b/source/branches/CLASSV3/src/CLASSBackEnd.cxx
@@ -26,6 +26,17 @@ CLASSBackEnd::CLASSBackEnd():CLASSFacility()
 	fDecayDataBase = 0;
 }
 
+CLASSBackEnd::CLASSBackEnd(LogFile* log):CLASSFacility(log)
+{
+	fDecayDataBase = 0;
+}
+
+
+CLASSBackEnd::CLASSBackEnd(LogFile* log, cSecond cycletime):CLASSFacility(log, cycletime)
+{
+	fDecayDataBase = 0;
+}
+
 //________________________________________________________________________
 void CLASSBackEnd::ClearIVArray()
 {
diff --git a/source/branches/CLASSV3/src/CLASSFacility.cxx b/source/branches/CLASSV3/src/CLASSFacility.cxx
index dbb18cdd2..fb047f02e 100644
--- a/source/branches/CLASSV3/src/CLASSFacility.cxx
+++ b/source/branches/CLASSV3/src/CLASSFacility.cxx
@@ -20,7 +20,43 @@ CLASSFacility::CLASSFacility():CLASSObject()
 	fParc = 0;
 	fInternalTime = 0;
 	fInCycleTime = 0;
-	fCycleTime = 0;
+	fCycleTime = -1;
 }
 
+CLASSFacility::CLASSFacility(LogFile* log):CLASSObject(log)
+{
+	fParc = 0;
+	fInternalTime = 0;
+	fInCycleTime = 0;
+	fCycleTime = -1;
+}
+
+
+CLASSFacility::CLASSFacility(LogFile* log, cSecond cycletime):CLASSObject(log)
+{
+	fParc = 0;
+	fInternalTime = 0;
+	fInCycleTime = 0;
+	fCycleTime = cycletime;
+}
 
+CLASSFacility::CLASSFacility(LogFile* log, cSecond creationtime, cSecond lifetime):CLASSObject(log)
+{
+	fParc = 0;
+	fInternalTime = 0;
+	fInCycleTime = 0;
+	fCycleTime = -1;
+	fCreationTime = creationtime;
+	fLifeTime = lifetime;
+}
+
+CLASSFacility::CLASSFacility(LogFile* log, cSecond creationtime, cSecond lifetime, cSecond cycletime):CLASSObject(log)
+{
+	fParc = 0;
+	fInternalTime = 0;
+	fInCycleTime = 0;
+	fCycleTime = cycletime;
+	fCreationTime = creationtime;
+	fInternalTime = fCreationTime;
+	fLifeTime = lifetime;
+}
\ No newline at end of file
diff --git a/source/branches/CLASSV3/src/CLASSObject.cxx b/source/branches/CLASSV3/src/CLASSObject.cxx
index 904d2d90e..6e3781a03 100644
--- a/source/branches/CLASSV3/src/CLASSObject.cxx
+++ b/source/branches/CLASSV3/src/CLASSObject.cxx
@@ -21,3 +21,7 @@ CLASSObject::CLASSObject()
 	fIsLog = false;
 }
 
+CLASSObject::CLASSObject(LogFile* log)
+{
+	SetLog(log);
+}
\ No newline at end of file
diff --git a/source/branches/CLASSV3/src/EvolutionData.cxx b/source/branches/CLASSV3/src/EvolutionData.cxx
index dfce0182b..7cd5fa137 100755
--- a/source/branches/CLASSV3/src/EvolutionData.cxx
+++ b/source/branches/CLASSV3/src/EvolutionData.cxx
@@ -1,5 +1,7 @@
 #include "EvolutionData.hxx"
 
+#include "CLASSHeaders.hxx"
+
 #include "LogFile.hxx"
 #include "StringLine.hxx"
 
@@ -660,6 +662,7 @@ void EvolutionData::ReadDB(string DBfile, bool oldread)
 		
 	}while ( !DecayDB.eof() );
 
+	double Na = 6.02214129e23;	//N Avogadro
 	double M = 0;
 	{
 		map<ZAI, double >::iterator it ;
@@ -670,7 +673,7 @@ void EvolutionData::ReadDB(string DBfile, bool oldread)
 
 		for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++ )
 		{
-			M += isotopicvector.GetActinidesComposition().GetZAIIsotopicQuantity( (*it).first )*cZAIMass.fZAIMass.find( (*it).first )->second/Na*1e-6;
+			M += (*it).second*cZAIMass.fZAIMass.find( (*it).first )->second/Na*1e-6;
 		}
 		isotopicquantity.clear();
 
diff --git a/source/branches/CLASSV3/src/FabricationPlant.cxx b/source/branches/CLASSV3/src/FabricationPlant.cxx
index a2b9bdc12..35fe364b9 100644
--- a/source/branches/CLASSV3/src/FabricationPlant.cxx
+++ b/source/branches/CLASSV3/src/FabricationPlant.cxx
@@ -43,7 +43,7 @@ ClassImp(FabricationPlant)
 
 
 
-FabricationPlant::FabricationPlant()
+FabricationPlant::FabricationPlant():CLASSFacility()
 {
 	SetFacilityType(16);
 	SetName("F_FabricationPLant.");
@@ -52,14 +52,12 @@ FabricationPlant::FabricationPlant()
 	fReUsable = 0;
 }
 
-FabricationPlant::FabricationPlant(LogFile* log)
+FabricationPlant::FabricationPlant(LogFile* log):CLASSFacility(log)
 {
 	SetFacilityType(16);
 	SetName("F_FabricationPLant.");
 
-	SetLog(log);
 	fChronologicalTimePriority = false;
-	SetCycleTime(-1);
 	fUpdateReferenceDBatEachStep = false;
 	fSubstitutionFuel = false;
 	fStorage = 0;
@@ -76,19 +74,15 @@ FabricationPlant::FabricationPlant(LogFile* log)
 
 }
 
-FabricationPlant::FabricationPlant(LogFile* log, Storage* storage, Storage* reusable, double fabircationtime)
+FabricationPlant::FabricationPlant(LogFile* log, Storage* storage, Storage* reusable, double fabricationtime):CLASSFacility(log, fabricationtime)
 {
 	SetFacilityType(16);
 	SetName("F_FabricationPLant.");
 
-	SetLog(log);
-	
 	fChronologicalTimePriority = false;
 	fUpdateReferenceDBatEachStep = false;
 	fSubstitutionFuel = false;
 
-
-	SetCycleTime((cSecond)fabircationtime );
 	fStorage = storage;
 	fReUsable = reusable;
 	
diff --git a/source/branches/CLASSV3/src/IM_RK4.cxx b/source/branches/CLASSV3/src/IM_RK4.cxx
index f40faa5a9..47f935d53 100644
--- a/source/branches/CLASSV3/src/IM_RK4.cxx
+++ b/source/branches/CLASSV3/src/IM_RK4.cxx
@@ -26,22 +26,15 @@
 
 
 
+using namespace std;
 
 
 //________________________________________________________________________
-IM_RK4::IM_RK4(): CLASSObject(), DynamicalSystem()
+IM_RK4::IM_RK4():DynamicalSystem()
 {
 	fTheNucleiVector = 0;
 	fTheMatrix = 0;
 
-	fWeightedDistance = false;
-	fEvolutionDataInterpolation = false;
-
-
-
-	fOldReadMethod = true;
-	fUseRK4EvolutionMethod = true;
-	fDistanceType = 0;
 	fShorstestHalflife = 3600.*24*2.;
 	fZAIThreshold = 90;
 
@@ -58,8 +51,6 @@ IM_RK4::IM_RK4(): CLASSObject(), DynamicalSystem()
 IM_RK4::IM_RK4(LogFile* Log):DynamicalSystem()
 {
 	SetLog(Log);
-	fWeightedDistance = false;
-	fEvolutionDataInterpolation = false;
 
 
 	fTheNucleiVector = 0;
@@ -89,7 +80,7 @@ IM_RK4::IM_RK4(LogFile* Log):DynamicalSystem()
 //________________________________________________________________________
 /*			Evolution Calculation			*/
 //________________________________________________________________________
-EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, EvolutionData XSSet, double Power);
+EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, EvolutionData XSSet, double Power, double cycletime)
 {
 
 	if(fFastDecay.size() == 0)
@@ -163,7 +154,7 @@ EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, Evolu
 
 	}
 
-	int NStep = = XSSet.GetFissionXS().begin()->second->GetN();
+	int NStep = XSSet.GetFissionXS().begin()->second->GetN();
 	double* DBTimeStep = XSSet.GetFissionXS().begin()->second->GetX();
 
 	int InsideStep = 10;
@@ -221,37 +212,34 @@ EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, Evolu
 		BatemanReactionMatrix += CaptureXSMatrix[i];
 		BatemanReactionMatrix += n2nXSMatrix[i];
 
-		if(fUseRK4EvolutionMethod)
+		for(int k=0; k < InsideStep; k++)
 		{
-			for(int k=0; k < InsideStep; k++)
-			{
-				double ESigmaN = 0;
-				for (int j = 0; j < (int)findex.size() ; j++)
-					ESigmaN -= FissionXSMatrix[i][j][j]*NEvolutionMatrix[j][0]*1.6e-19*FissionEnergy[j][0];
-				// Update Flux
-				double Flux_k = Power/ESigmaN;
+			double ESigmaN = 0;
+			for (int j = 0; j < (int)findex.size() ; j++)
+				ESigmaN -= FissionXSMatrix[i][j][j]*NEvolutionMatrix[j][0]*1.6e-19*FissionEnergy[j][0];
+			// Update Flux
+			double Flux_k = Power/ESigmaN;
 
-				if(k==0)
-					Flux[i]=Flux_k;
+			if(k==0)
+				Flux[i]=Flux_k;
 
-				BatemanMatrix = BatemanReactionMatrix;
-				BatemanMatrix *= Flux_k;
-				BatemanMatrix += fDecayMatrix ;
+			BatemanMatrix = BatemanReactionMatrix;
+			BatemanMatrix *= Flux_k;
+			BatemanMatrix += fDecayMatrix ;
 
-				SetTheMatrixToZero();
-				SetTheNucleiVectorToZero();
+			SetTheMatrixToZero();
+			SetTheNucleiVectorToZero();
 
-				SetTheMatrix(BatemanMatrix);
-				SetTheNucleiVector(NEvolutionMatrix);
+			SetTheMatrix(BatemanMatrix);
+			SetTheNucleiVector(NEvolutionMatrix);
 
 
-				RungeKutta(fTheNucleiVector, timevector[i]+TStepMax/InsideStep*k, timevector[i]+TStepMax/InsideStep*(k+1),  fNVar);
-				NEvolutionMatrix = GetTheNucleiVector();
-
-			}
+			RungeKutta(fTheNucleiVector, timevector[i]+TStepMax/InsideStep*k, timevector[i]+TStepMax/InsideStep*(k+1),  fNVar);
 			NEvolutionMatrix = GetTheNucleiVector();
-			NMatrix.push_back(NEvolutionMatrix);
+
 		}
+		NEvolutionMatrix = GetTheNucleiVector();
+		NMatrix.push_back(NEvolutionMatrix);
 
 		timevector[i+1] = timevector[i] + TStepMax;
 
@@ -299,7 +287,7 @@ EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, Evolu
 	}
 
 	GeneratedDB.SetPower(Power );
-	GeneratedDB.SetFuelType(fFuelType );
+//	GeneratedDB.SetFuelType(fFuelType );
 	GeneratedDB.SetReactorType(ReactorType );
 	GeneratedDB.SetCycleTime(cycletime);
 
@@ -315,9 +303,9 @@ EvolutionData IM_RK4::GenerateEvolutionData(IsotopicVector isotopicvector, Evolu
 	FissionXSMatrix.clear();
 	CaptureXSMatrix.clear();
 	n2nXSMatrix.clear();
-	
+
 	return GeneratedDB;
-	
+
 }
 
 
@@ -420,7 +408,7 @@ TMatrixT<double> IM_RK4::GetTheNucleiVector()
 	TMatrixT<double> NEvolutionMatrix = TMatrixT<double>(findex.size(),1);
 	for (int k = 0; k < (int)fNVar; k++)
 		NEvolutionMatrix[k][0] = fTheNucleiVector[k];
-
+	
 	return NEvolutionMatrix;
 }
 
diff --git a/source/branches/CLASSV3/src/IrradiationModel.cxx b/source/branches/CLASSV3/src/IrradiationModel.cxx
index a9acb3e9b..f3d4f8ccd 100644
--- a/source/branches/CLASSV3/src/IrradiationModel.cxx
+++ b/source/branches/CLASSV3/src/IrradiationModel.cxx
@@ -32,7 +32,18 @@
 
 
 
+using namespace std;
 
+IrradiationModel::IrradiationModel(): CLASSObject()
+{
+	fShorstestHalflife = 3600.*24*2.;
+	fZAIThreshold = 90;
+
+
+	fDataDirectoryName = getenv("CLASS_PATH");
+	fDataDirectoryName += "/source/data/";
+	fDataFileName = "chart.JEF3T";
+}
 
 
 
@@ -510,3 +521,324 @@ void IrradiationModel::LoadFPYield(string SponfaneusYield, string ReactionYield)
 	fReactionYield = ReadFPYield(ReactionYield);
 	fZAIThreshold = 0;
 }
+
+
+
+
+
+//________________________________________________________________________
+/*				Reaction Stuff			*/
+//________________________________________________________________________
+TMatrixT<double> IrradiationModel::GetFissionXsMatrix(EvolutionData EvolutionDataStep,double TStep)
+{
+
+	map<ZAI ,TGraph* >::iterator it;
+	TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size());
+	for(int i = 0; i < (int)findex.size(); i++)
+		for(int j = 0; j < (int)findex.size(); j++)
+			BatemanMatrix[i][j] = 0;
+
+	// ----------------  A(n,.) X+Y
+
+	map<ZAI ,TGraph* > FissionXS = EvolutionDataStep.GetFissionXS();
+
+	for(it = FissionXS.begin() ; it != FissionXS.end(); it++)
+	{
+		map<ZAI, int>::iterator findex_inver_it = findex_inver.find( (*it).first );
+		if( findex_inver_it != findex_inver.end() )
+		{
+			double y = (*it).second->Eval(TStep);
+			BatemanMatrix[ findex_inver_it->second ][ findex_inver_it->second ] += -y* 1e-24;
+
+			if(fSpontaneusYield.size() == 0 || fReactionYield.size() == 0)
+				BatemanMatrix[1][ findex_inver_it->second ] += 2*y* 1e-24;
+			else
+			{
+				map<ZAI, IsotopicVector>::iterator it_yield = fReactionYield.find( (*it).first );
+
+				if( it_yield != fReactionYield.end())
+				{
+					map<ZAI ,double>::iterator it_IVQ;
+					map<ZAI ,double> IVQ = (*it_yield).second.GetIsotopicQuantity();
+
+					for( it_IVQ = IVQ.begin(); it_IVQ != IVQ.end(); it_IVQ++ )
+					{
+						map<ZAI, int>::iterator findex_it_PF = findex_inver.find( (*it_IVQ).first );
+
+						if(findex_it_PF != findex_inver.end() )
+							BatemanMatrix[(*findex_it_PF).second][ (*findex_inver_it).second ] += (*it_IVQ).second*y* 1e-24;
+						else
+						{
+							map<ZAI, map<ZAI, double> >::iterator it_FD = fFastDecay.find( (*it_IVQ).first);
+
+							if( it_FD == fFastDecay.end() )
+							{
+								BatemanMatrix[1][ (*findex_inver_it).second ] += (*it_IVQ).second * y * 1e-24  ;
+							}
+							else
+							{
+
+								map< ZAI, double >::iterator it5;
+								map< ZAI, double > decaylist2 = (*it_FD).second;
+								for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++)
+								{
+									findex_it_PF = findex_inver.find( (*it5).first );
+									if( findex_it_PF == findex_inver.end() )
+										BatemanMatrix[0][findex_inver_it->second] +=
+										(*it_IVQ).second * y * 1e-24 * (*it5).second;
+									else
+										BatemanMatrix[(*findex_it_PF).second][findex_inver_it->second]+=
+										(*it_IVQ).second * y * 1e-24 * (*it5).second;
+								}
+							}
+
+						}
+
+					}
+				}
+				else
+					BatemanMatrix[1][ findex_inver_it->second ] += 2*y* 1e-24;
+
+			}
+		}
+
+	}
+
+	return BatemanMatrix;
+
+}
+
+//________________________________________________________________________
+TMatrixT<double> IrradiationModel::GetCaptureXsMatrix(EvolutionData EvolutionDataStep,double TStep)
+{
+
+
+	map<ZAI ,TGraph* >::iterator it;
+	TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size());
+	for(int i = 0; i < (int)findex.size(); i++)
+		for(int j = 0; j < (int)findex.size(); j++)
+			BatemanMatrix[i][j] = 0;
+
+	map<ZAI, map<ZAI, double> > Capture;
+	{	// 241Am
+		map<ZAI, double> toAdd ;
+		toAdd.insert(pair<ZAI, double> ( ZAI(96,242,0) , 0.8733*0.827) ); //directly cut the Am242 as in MURE
+		toAdd.insert(pair<ZAI, double> ( ZAI(94,242,0) , 0.8733*0.173) ); //directly cut the Am242 as in MURE
+		toAdd.insert(pair<ZAI, double> ( ZAI(95,242,1) , 0.1267) );
+		Capture.insert( pair< ZAI, map<ZAI, double> > ( ZAI(95,241,0), toAdd ) );
+	}
+	{	// 242Am*
+		map<ZAI, double> toAdd ;
+		toAdd.insert(pair<ZAI, double> ( ZAI(95,243,0) , 1) );
+		Capture.insert( pair< ZAI, map<ZAI, double> > ( ZAI(95,242,1), toAdd ) );
+	}
+
+
+	// ----------------  A(n,.)A+1
+	map<ZAI ,TGraph* > CaptureXS = EvolutionDataStep.GetCaptureXS();
+	for(it = CaptureXS.begin(); it != CaptureXS.end(); it++)
+	{
+		map<ZAI, int>::iterator Index_it = findex_inver.find( (*it).first );
+		if( Index_it != findex_inver.end() )
+		{
+			double y;
+			y = (*it).second->Eval(TStep);
+
+			BatemanMatrix[Index_it->second][ Index_it->second ] += -y* 1e-24 ;
+
+			map<ZAI, map<ZAI, double> >::iterator it3 = Capture.find( (*it).first );
+
+			if( it3 == Capture.end() )
+			{
+				map<ZAI, int >::iterator it6 = findex_inver.find( ZAI( (*it).first.Z(), (*it).first.A()+1, (*it).first.I()) );
+
+				if( it6 != findex_inver.end() )
+				{
+					BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24  ;
+				}
+				else
+				{
+					map<ZAI, map<ZAI, double> >::iterator it4 = fFastDecay.find(  ZAI( (*it).first.Z(), (*it).first.A()+1, (*it).first.I()) );
+
+					if( it4 == fFastDecay.end() )
+					{
+						BatemanMatrix[0][Index_it->second] += y* 1e-24  ;
+					}
+					else
+					{
+
+						map< ZAI, double >::iterator it5;
+						map< ZAI, double > decaylist2 = (*it4).second;
+						for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++)
+						{
+							it6 = findex_inver.find( (*it5).first );
+							if( it6 == findex_inver.end() )
+								BatemanMatrix[0][Index_it->second] += y* 1e-24 * (*it5).second;
+							else
+								BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it5).second;
+						}
+					}
+				}
+			}
+			else
+			{
+				map<ZAI, double>::iterator it4;
+				map<ZAI, double> CaptureList = (*it3).second;
+				for(it4 = CaptureList.begin(); it4 != CaptureList.end() ; it4++)
+				{
+
+					map<ZAI, int >::iterator it6 = findex_inver.find( (*it4).first );
+					if( it6 != findex_inver.end() )
+						BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it4).second ;
+					else
+					{
+						map<ZAI, map<ZAI, double> >::iterator it7 = fFastDecay.find( (*it4).first );
+
+						if( it7 == fFastDecay.end() )
+						{
+							cout << "CaptureList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl;
+							exit(1);
+						}
+
+						map< ZAI, double >::iterator it5;
+						map< ZAI, double > decaylist2 = (*it7).second;
+						for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++)
+						{
+
+							it6 = findex_inver.find( (*it5).first );
+							if( it6 == findex_inver.end() )
+							{
+								cout << "CaptureList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl;
+								exit(1);
+							}
+
+							BatemanMatrix[(*it6).second][Index_it->second] += y * 1e-24 * (*it5).second * (*it4).second;
+						}
+					}
+
+				}
+			}
+
+
+		}
+	}
+	return BatemanMatrix;
+
+}
+
+
+//________________________________________________________________________
+TMatrixT<double> IrradiationModel::Getn2nXsMatrix(EvolutionData EvolutionDataStep,double TStep)
+{
+
+
+	map<ZAI ,TGraph* >::iterator it;
+	TMatrixT<double> BatemanMatrix = TMatrixT<double>(findex.size(),findex.size());
+	for(int i = 0; i < (int)findex.size(); i++)
+		for(int j = 0; j < (int)findex.size(); j++)
+			BatemanMatrix[i][j] = 0;
+
+	map<ZAI, map<ZAI, double> > n2n;
+	{	// 237Np
+		map<ZAI, double> toAdd ;
+		toAdd.insert(pair<ZAI, double> ( ZAI(93,236,0) , 0.2) );
+		toAdd.insert(pair<ZAI, double> ( ZAI(93,236,1) , 0.8) );
+		n2n.insert( pair< ZAI, map<ZAI, double> > ( ZAI(93,237,0), toAdd ) );
+	}
+	{	// 242Am*
+		map<ZAI, double> toAdd ;
+		toAdd.insert(pair<ZAI, double> ( ZAI(95,241,0) , 1) );
+		n2n.insert( pair< ZAI, map<ZAI, double> > ( ZAI(95,242,1), toAdd ) );
+	}
+
+	// ----------------  A(n,2n)A-1
+	map<ZAI ,TGraph* > n2nXS = EvolutionDataStep.Getn2nXS();
+	for(it = n2nXS.begin(); it != n2nXS.end(); it++)
+	{
+		map<ZAI, int>::iterator Index_it = findex_inver.find( (*it).first );
+		if( Index_it != findex_inver.end() )
+		{
+			double y;
+			y = (*it).second->Eval(TStep);
+
+			BatemanMatrix[Index_it->second][ Index_it->second ] += -y* 1e-24 ;
+
+			map<ZAI, map<ZAI, double> >::iterator it3 = n2n.find( (*it).first );
+
+			if( it3 == n2n.end() )
+			{
+				map<ZAI, int >::iterator it6 = findex_inver.find( ZAI( (*it).first.Z(), (*it).first.A()-1, (*it).first.I()) );
+
+				if( it6 != findex_inver.end() )
+				{
+					BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24  ;
+				}
+				else
+				{
+					map<ZAI, map<ZAI, double> >::iterator it4 = fFastDecay.find(  ZAI( (*it).first.Z(), (*it).first.A()-1, (*it).first.I()) );
+
+					if( it4 == fFastDecay.end() )
+					{
+						BatemanMatrix[0][Index_it->second] += y* 1e-24  ;
+					}
+					else
+					{
+
+						map< ZAI, double >::iterator it5;
+						map< ZAI, double > decaylist2 = (*it4).second;
+						for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++)
+						{
+							it6 = findex_inver.find( (*it5).first );
+							if( it6 == findex_inver.end() )
+								BatemanMatrix[0][Index_it->second] += y* 1e-24 * (*it5).second;
+							else
+								BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it5).second;
+						}
+					}
+				}
+			}
+			else
+			{
+				map<ZAI, double>::iterator it4;
+				map<ZAI, double> n2nList = (*it3).second;
+				for(it4 = n2nList.begin(); it4 != n2nList.end() ; it4++)
+				{
+
+					map<ZAI, int >::iterator it6 = findex_inver.find( (*it4).first );
+					if( it6 != findex_inver.end() )
+						BatemanMatrix[(*it6).second][Index_it->second] += y* 1e-24 * (*it4).second ;
+					else
+					{
+						map<ZAI, map<ZAI, double> >::iterator it7 = fFastDecay.find( (*it4).first );
+
+						if( it7 == fFastDecay.end() )
+						{
+							cout << "n2nList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl;
+							exit(1);
+						}
+
+						map< ZAI, double >::iterator it5;
+						map< ZAI, double > decaylist2 = (*it7).second;
+						for(it5 = decaylist2.begin(); it5!= decaylist2.end(); it5++)
+						{
+
+							it6 = findex_inver.find( (*it5).first );
+							if( it6 == findex_inver.end() )
+							{
+								cout << "n2nList Problem in FastDecay for nuclei " << (*it7).first.Z() << " " << (*it7).first.A() << " " << (*it7).first.I() << endl;
+								exit(1);
+							}
+
+							BatemanMatrix[(*it6).second][Index_it->second] += y * 1e-24 * (*it5).second * (*it4).second;
+						}
+					}
+
+				}
+			}
+
+
+		}
+	}
+	return BatemanMatrix;
+}
+
diff --git a/source/branches/CLASSV3/src/Makefile b/source/branches/CLASSV3/src/Makefile
index 651df1500..d48ee6245 100755
--- a/source/branches/CLASSV3/src/Makefile
+++ b/source/branches/CLASSV3/src/Makefile
@@ -29,8 +29,8 @@ OBJS		= 	CLASS.o \
 			FuelDataBank.o DecayDataBank.o \
 			DynamicalSystem.o\
 			EvolutionData.o EvolutionDataDict.o \
-			IrradiationModel.o\
-			EquivalenceModel.o\
+			IrradiationModel.o IM_RK4.o \
+			EquivalenceModel.o \
 			LogFile.o
 
 ROOTOBJS	= 	CLASSObject.o CLASSObjectDict.o\
diff --git a/source/branches/CLASSV3/src/Pool.cxx b/source/branches/CLASSV3/src/Pool.cxx
index 3fbcfa303..b72e984d0 100755
--- a/source/branches/CLASSV3/src/Pool.cxx
+++ b/source/branches/CLASSV3/src/Pool.cxx
@@ -29,44 +29,13 @@ Pool::Pool():CLASSBackEnd()
 	SetName("P_Pool.");
 }
 
-Pool::Pool(LogFile* log)
-{
-
-	SetFacilityType(8);
-
-	SetLog(log);
-	fCycleTime = 5*3600.*24.*365.25;
-	
-	fIsStarted = false;
-	fPutToWaste = true;
-	SetCreationTime( 0 );
-	fCoolingLastIndex = 0;
-
-	fOutBackEndFacility = 0;
-	SetName("P_Pool.");
-
-	
-	cout	<< "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl;
-	cout	<< "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl;
-	cout	<< "\t The Cooling Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl;
-	cout	<< "!!WARNING!! !!!Pool!!! All Cooled Fuel goes directly to WASTE after cooling !! " << endl;
-	
-	GetLog()->fLog	<< "!!INFO!! !!!Pool!!! A new Pool has been define :" << endl;
-	GetLog()->fLog	<< "\t Creation time set at \t " << (double)(GetCreationTime()/3600/24/365.25) << " year" << endl;
-	GetLog()->fLog	<< "\t The Cooling Time set at\t " << (double)(fCycleTime/3600/24/365.25) << " year" << endl;
-	GetLog()->fLog	<< "!!WARNING!! !!!Pool!!! All Cooled Fuel goes directly to WASTE after cooling !! " << endl;
-	
-	
-}
 	//________________________________________________________________________
-Pool::Pool(LogFile* log, double creation, double coolingtime)
+Pool::Pool(LogFile* log, cSecond coolingtime):CLASSBackEnd(log, coolingtime)
 {
 
 	SetFacilityType(8);
 
-	SetLog(log);
 	fCycleTime = (cSecond)coolingtime;
-	SetCreationTime( (cSecond)creation );
 	fIsStarted = false;
 	fPutToWaste = true;
 	fCoolingLastIndex = 0;
@@ -89,17 +58,14 @@ Pool::Pool(LogFile* log, double creation, double coolingtime)
 }
 
 //________________________________________________________________________
-Pool::Pool(LogFile* log, CLASSBackEnd* storage, double creation, double coolingtime)
+Pool::Pool(LogFile* log, CLASSBackEnd* storage, cSecond coolingtime):CLASSBackEnd(log, coolingtime)
 {
 
 	SetFacilityType(8);
 
-	SetLog(log);
-	fCycleTime = (cSecond)coolingtime;
 	fOutBackEndFacility = storage;
 	SetIsStorageType(false);
 
-	SetCreationTime( (cSecond)creation );
 	fIsStarted = false;
 	fPutToWaste = false;
 	fCoolingLastIndex = 0;
diff --git a/source/branches/CLASSV3/src/Reactor.cxx b/source/branches/CLASSV3/src/Reactor.cxx
index 8b0056e39..3243fd51c 100755
--- a/source/branches/CLASSV3/src/Reactor.cxx
+++ b/source/branches/CLASSV3/src/Reactor.cxx
@@ -27,7 +27,7 @@
 
 ClassImp(Reactor)
 
-Reactor::Reactor()
+Reactor::Reactor():CLASSFacility()
 {
 
 	SetFacilityType(4);
@@ -43,10 +43,9 @@ Reactor::Reactor()
 	fNextPlan = fLoadingPlan.begin();
 }
 
-Reactor::Reactor(LogFile* log)
+Reactor::Reactor(LogFile* log):CLASSFacility(log)
 {
 
-	SetLog(log);
 	fOutBackEndFacility = 0;
 	fStorage = 0;
 	fFuelTypeDB = 0;
@@ -60,9 +59,8 @@ Reactor::Reactor(LogFile* log)
 Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB,
 		 FabricationPlant* fabricationplant,
  		 CLASSBackEnd* Pool,
- 		 cSecond creationtime, cSecond lifetime)
+ 		 cSecond creationtime, cSecond lifetime):CLASSFacility(log, creationtime, lifetime)
 {
-	SetLog(log);
 
 	SetFacilityType(4);
 	SetName("R_Reactor.");
@@ -83,13 +81,6 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB,
 	fFuelTypeDB = fueltypeDB;
 
 	fPower = -1.;
-	fCycleTime = -1.;	 //BU in GWd/t
-
-	SetCreationTime( (cSecond)creationtime );
-	fInternalTime = creationtime;
-	SetLifeTime( (cSecond)lifetime );
-	fInCycleTime = 0;
-
 
 	fNextPlan = fLoadingPlan.begin();
 
@@ -112,10 +103,8 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB,
 
 Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabricationplant, CLASSBackEnd* Pool,
  		 cSecond creationtime, cSecond lifetime,
- 		 double Power, double HMMass, double BurnUp, double ChargeFactor)
+ 		 double Power, double HMMass, double BurnUp, double ChargeFactor):CLASSFacility(log, creationtime, lifetime)
 {
-	SetLog(log);
-
 	SetFacilityType(4);
 	SetName("R_Reactor.");
 
@@ -138,11 +127,6 @@ Reactor::Reactor(LogFile* log, FuelDataBank* fueltypeDB, FabricationPlant* fabri
 	fPower = Power*ChargeFactor;
 	fCycleTime = (cSecond) (fBurnUp*1e9 / (fPower)  * fHeavyMetalMass  *3600*24);	 //BU in GWd/t
 
-	SetCreationTime( (cSecond)creationtime );
-	fInternalTime = creationtime;
-	SetLifeTime( (cSecond)lifetime );
-	fInCycleTime = 0;
-
 	fNextPlan = fLoadingPlan.begin();
 
 
@@ -174,10 +158,8 @@ Reactor::Reactor(LogFile* log, FuelDataBank* 	fueltypeDB,
 		 FabricationPlant* fabricationplant,
  		 CLASSBackEnd* Pool,
  		 cSecond creationtime, cSecond lifetime, cSecond cycletime,
- 		 double HMMass, double BurnUp)
+ 		 double HMMass, double BurnUp):CLASSFacility(log, creationtime, lifetime, cycletime)
 {
-	SetLog(log);
-
 	SetFacilityType(4);
 	SetName("R_Reactor.");
 
@@ -197,12 +179,6 @@ Reactor::Reactor(LogFile* log, FuelDataBank* 	fueltypeDB,
 
 	fFuelTypeDB = fueltypeDB;
 
-	fCycleTime = (cSecond)cycletime;
-	SetCreationTime( (cSecond)creationtime );
-	fInternalTime = creationtime;
-	SetLifeTime( (cSecond)lifetime );
-	fInCycleTime = 0;
-
 	fPower = BurnUp*3600.*24. / (fCycleTime) * HMMass *1e9; //BU in GWd/t
 
 	fNextPlan = fLoadingPlan.begin();
@@ -236,10 +212,8 @@ Reactor::Reactor(LogFile* log, EvolutionData evolutivedb,
  		 CLASSBackEnd* Pool,
  		 cSecond creationtime,
  		 cSecond lifetime,
- 		 double power, double HMMass, double BurnUp, double ChargeFactor )
+ 		 double power, double HMMass, double BurnUp, double ChargeFactor ):CLASSFacility(log, creationtime, lifetime)
 {
-	SetLog(log);
-
 	SetFacilityType(4);
 	SetName("R_Reactor.");
 
@@ -257,11 +231,6 @@ Reactor::Reactor(LogFile* log, EvolutionData evolutivedb,
 
 	fOutBackEndFacility = Pool;
 
-	SetCreationTime( (cSecond)creationtime );
-	fInternalTime = creationtime;
-	SetLifeTime( (cSecond)lifetime );
-	fInCycleTime = 0;
-
 	fPower = power * ChargeFactor;
 
 	fHeavyMetalMass = HMMass;
diff --git a/source/branches/CLASSV3/src/Storage.cxx b/source/branches/CLASSV3/src/Storage.cxx
index 4222b2121..413265b62 100644
--- a/source/branches/CLASSV3/src/Storage.cxx
+++ b/source/branches/CLASSV3/src/Storage.cxx
@@ -29,26 +29,24 @@ Storage::Storage():CLASSBackEnd()
 
 }
 
-Storage::Storage(LogFile* log)
+Storage::Storage(LogFile* log):CLASSBackEnd(log)
 {
 	SetFacilityType(-1);
 	SetIsStorageType();
 
 	SetName("S_Storage.");
 
-	SetLog(log);
 	cout	<< "!!INFO!! !!!Storage!!! A new Storage has been define." << endl;
 	
 	GetLog()->fLog	<< "!!INFO!! !!!Storage!!! A new Storage has been define." << endl;
 	
 }
 //________________________________________________________________________
-Storage::Storage(LogFile* log, DecayDataBank* evolutivedb)
+Storage::Storage(LogFile* log, DecayDataBank* evolutivedb):CLASSBackEnd(log)
 {
 	SetFacilityType(-1);
 	SetIsStorageType();
 
-	SetLog(log);
 	SetDecayDataBank(evolutivedb);
 	
 	SetName("S_Storage.");
-- 
GitLab