From ba51926c42531ab83b97287f27c242c2baf9f134 Mon Sep 17 00:00:00 2001
From: Baptiste Mouginot <mouginot.baptiste@gmail.com>
Date: Sun, 8 Mar 2015 02:20:46 +0000
Subject: [PATCH] Add a ZAI threshold to remove all nuclei below

git-svn-id: svn+ssh://svn.in2p3.fr/class@624 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 source/trunk/include/CLASSBackEnd.hxx   |  2 ++
 source/trunk/include/CLASSFacility.hxx  |  2 +-
 source/trunk/include/IsotopicVector.hxx |  1 +
 source/trunk/include/Scenario.hxx       | 10 ++++++++-
 source/trunk/src/CLASSBackEnd.cxx       | 12 ++++++++++
 source/trunk/src/CLASSFacility.cxx      | 10 +++++++++
 source/trunk/src/IsotopicVector.cxx     | 25 +++++++++++++++++++++
 source/trunk/src/Scenario.cxx           | 30 +++++++++++++++++++++++++
 8 files changed, 90 insertions(+), 2 deletions(-)

diff --git a/source/trunk/include/CLASSBackEnd.hxx b/source/trunk/include/CLASSBackEnd.hxx
index 451866eca..334e95ecd 100644
--- a/source/trunk/include/CLASSBackEnd.hxx
+++ b/source/trunk/include/CLASSBackEnd.hxx
@@ -120,6 +120,8 @@ class CLASSBackEnd : public CLASSFacility
 	 \name BackEndFacility specific Method
 	 */
 	//@{
+	virtual void ApplyZAIThreshold(int z = 90);						//!< Put all nuclei below the threshold in -2 -2 -2 ZAI...
+
 	virtual void	AddIV(IsotopicVector isotopicvector);	//!< Add an Isotopicvector to the IVArray
 	void		ClearIVArray();					//!< Empty the IVArray removing all fuel stored
 	
diff --git a/source/trunk/include/CLASSFacility.hxx b/source/trunk/include/CLASSFacility.hxx
index 9897e97b2..8950b40a2 100644
--- a/source/trunk/include/CLASSFacility.hxx
+++ b/source/trunk/include/CLASSFacility.hxx
@@ -172,7 +172,7 @@ public :
 	 \name Evolution Method
 	 */
 	//@{
-
+	virtual void ApplyZAIThreshold(int z = 90);						//!< Put all nuclei below the threshold in -2 -2 -2 ZAI...
 	void AddCumulativeIVIn(IsotopicVector IV) { fCumulativeIVIn += IV;}		//!< Add the Input IsotopicVector in the cumulative IV IN
 	void AddCumulativeIVOut(IsotopicVector IV) { fCumulativeIVOut += IV;}		//!< Add the Input IsotopicVector in the cumulative IV OUT
 	virtual void Evolution(cSecond t)	= 0;	//!< Performs the Evolution to time t
diff --git a/source/trunk/include/IsotopicVector.hxx b/source/trunk/include/IsotopicVector.hxx
index 908bd9381..ca84b3f90 100755
--- a/source/trunk/include/IsotopicVector.hxx
+++ b/source/trunk/include/IsotopicVector.hxx
@@ -119,6 +119,7 @@ public :
 
 	void 	Multiply(double factor);			//!< Multiply the IV by a Factor
 
+	void	ApplyZAIThreshold(int z = 90);			//!< Put all nuclei below the threshold in -2 -2 -2 ZAI...
 
 	IsotopicVector& operator+=(IsotopicVector const& IVb);	//!< Operator += definition
 	IsotopicVector& operator-=(IsotopicVector const& IVb);	//!< Operator -= definition
diff --git a/source/trunk/include/Scenario.hxx b/source/trunk/include/Scenario.hxx
index c2d2603d6..42b15471c 100755
--- a/source/trunk/include/Scenario.hxx
+++ b/source/trunk/include/Scenario.hxx
@@ -159,7 +159,11 @@ class Scenario : public CLASSObject
 	//}
 	//@}
 	
-	void SetLogTimeStep(bool val = true)	{fLogTimeStep = true;}
+	void SetLogTimeStep(bool val = true)	{ fLogTimeStep = true; }
+	
+	
+	void SetZAIThreshold(int z = 90)		{ fZAIThreshold = z;}
+
 	
 	//********* Add Method *********//
 	/*!
@@ -225,6 +229,8 @@ class Scenario : public CLASSObject
 	void AddWaste(IsotopicVector isotopicvector)	{ fWaste.Add(isotopicvector); }		//!< Add a isotopicVector to Waste
 	void AddToPower(double power)			{ fParcPower += power;}			//!< Add power to the installed power in the Parc
 	
+	
+	void ApplyZAIThreshold();
 	//@}
 	
 	
@@ -269,6 +275,8 @@ class Scenario : public CLASSObject
 	/// \li 16 fuel Fabrication
 	
 	
+	int			fZAIThreshold;		///<
+	
 	vector<Storage*>		fStorage;		///< Vector of Storages
 	vector<Pool*>			fPool;			///< Vector of Pool
 	vector<Reactor*>		fReactor;		///< Vector of Reactor
diff --git a/source/trunk/src/CLASSBackEnd.cxx b/source/trunk/src/CLASSBackEnd.cxx
index faf588e85..37c5659f2 100644
--- a/source/trunk/src/CLASSBackEnd.cxx
+++ b/source/trunk/src/CLASSBackEnd.cxx
@@ -94,6 +94,18 @@ IsotopicVector CLASSBackEnd::GetDecay(IsotopicVector isotopicvector, cSecond t)
 }
 
 
+void CLASSBackEnd::ApplyZAIThreshold(int z)
+{
+	fInsideIV.ApplyZAIThreshold(z);
+	fCumulativeIVIn.ApplyZAIThreshold(z);
+	fCumulativeIVOut.ApplyZAIThreshold(z);
+	
+	for(int i = 0; i < (int)fIVArray.size(); i++)
+		fIVArray[i].ApplyZAIThreshold(z);
+
+}
+
+
 map<cSecond,int> CLASSBackEnd::GetTheBackEndTimePath()
 {
 	DBGL
diff --git a/source/trunk/src/CLASSFacility.cxx b/source/trunk/src/CLASSFacility.cxx
index 8ced5b7da..eca60a50e 100644
--- a/source/trunk/src/CLASSFacility.cxx
+++ b/source/trunk/src/CLASSFacility.cxx
@@ -78,4 +78,14 @@ CLASSFacility::CLASSFacility(CLASSLogger* log, cSecond creationtime, cSecond lif
 	
 	fCreationTime = creationtime;
 	fLifeTime = lifetime;
+}
+
+
+
+void CLASSFacility::ApplyZAIThreshold(int z)
+{
+	fInsideIV.ApplyZAIThreshold(z);
+	fCumulativeIVIn.ApplyZAIThreshold(z);
+	fCumulativeIVOut.ApplyZAIThreshold(z);
+
 }
\ No newline at end of file
diff --git a/source/trunk/src/IsotopicVector.cxx b/source/trunk/src/IsotopicVector.cxx
index 0dd045e76..cbf0cb568 100755
--- a/source/trunk/src/IsotopicVector.cxx
+++ b/source/trunk/src/IsotopicVector.cxx
@@ -432,6 +432,31 @@ void IsotopicVector::Remove(const IsotopicVector& isotopicvector)
 
 }
 
+//________________________________________________________________________
+
+void IsotopicVector::ApplyZAIThreshold(int z)
+{
+	map<ZAI ,double> cleanedIsotopicQuantity;
+	cleanedIsotopicQuantity.insert( pair<ZAI ,double>(ZAI(-2,-2,-2), 0));
+	
+	map<ZAI ,double> isotopicquantity = (*this).GetIsotopicQuantity();
+	map<ZAI ,double >::iterator it;
+	for( it = isotopicquantity.begin(); it != isotopicquantity.end(); it++)
+	{
+		if( (*it).first.Z() < z)
+			cleanedIsotopicQuantity[ZAI(-2,-2,-2)] += (*it).second;
+		else
+			cleanedIsotopicQuantity.insert(*it);
+			
+	}
+
+	fIsotopicQuantity = cleanedIsotopicQuantity;
+	
+}
+
+
+
+
 //________________________________________________________________________
 void IsotopicVector::Need(const ZAI& zai, double quantity)
 {
diff --git a/source/trunk/src/Scenario.cxx b/source/trunk/src/Scenario.cxx
index 7c6b1c327..42449cc84 100755
--- a/source/trunk/src/Scenario.cxx
+++ b/source/trunk/src/Scenario.cxx
@@ -64,6 +64,7 @@ Scenario::Scenario(CLASSLogger* log, cSecond abstime):CLASSObject(log)
 
 	fParcPower = 0;
 
+	fZAIThreshold = -1;
 
 	// Warning
 
@@ -99,6 +100,7 @@ Scenario::Scenario( cSecond abstime, CLASSLogger* log):CLASSObject(log)
 	
 	fParcPower = 0;
 	
+	fZAIThreshold = -1;
 	
 	// Warning
 	
@@ -133,6 +135,7 @@ Scenario::Scenario( cSecond abstime ):CLASSObject(new CLASSLogger("CLASS_OUTPUT.
 	
 	fParcPower = 0;
 	
+	fZAIThreshold = -1;
 	
 	// Warning
 	
@@ -670,6 +673,9 @@ void Scenario::Evolution(cSecond t)
 		{
 #pragma omp single
 			{
+				if(fZAIThreshold != -1)
+					ApplyZAIThreshold();
+				
 				UpdateParc();
 				fOutT->Fill();
 				ProgressPrintout( (cSecond)t);
@@ -715,6 +721,30 @@ void Scenario::ProgressPrintout(cSecond t)
 //________________________________________________________________________
 //______________________________ Out Method ______________________________
 //________________________________________________________________________
+
+void Scenario::ApplyZAIThreshold()
+{
+	for(int i =0; i < (int)fFabricationPlant.size(); i++)
+		fFabricationPlant[i]->ApplyZAIThreshold(fZAIThreshold);
+	
+	for(int i = 0; i < (int) fPool.size();i++)
+		fPool[i]->ApplyZAIThreshold(fZAIThreshold);
+	
+	for(int i = 0; i < (int)fStorage.size(); i++)
+		fStorage[i]->ApplyZAIThreshold(fZAIThreshold);
+	
+	for(int i = 0; i < (int)fReactor.size(); i++)
+		fReactor[i]->ApplyZAIThreshold(fZAIThreshold);
+	
+	
+	fWaste.ApplyZAIThreshold(fZAIThreshold);
+	
+	
+}
+
+
+
+
 void Scenario::UpdateParc()
 {
 
-- 
GitLab