From 6ce99624e9d8a4dc489e25992160f0e8ad363e21 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <incardon@mpi-cbg.de>
Date: Sat, 4 Nov 2017 19:29:11 +0100
Subject: [PATCH] Improving documentation

---
 CHANGELOG.md                    |  11 +++
 src/Vector/se_class3_vector.hpp | 116 ++++++++++++++++++++++++++++----
 src/Vector/vector_dist.hpp      |  62 +++++++----------
 3 files changed, 139 insertions(+), 50 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d9c39333..de399263a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,17 @@
 # Change Log
 All notable changes to this project will be documented in this file.
 
+## [1.1.0]
+
+### Added
+
+- Interface for Multi-vector dynamic load balancing
+
+### Fixed
+
+- Installation/detection of PETSC
+- 2D Fixing IO in binary for vector
+
 ## [1.0.0] 13 September 2017
 
 ### Added
diff --git a/src/Vector/se_class3_vector.hpp b/src/Vector/se_class3_vector.hpp
index 85497c7cc..3611174f9 100644
--- a/src/Vector/se_class3_vector.hpp
+++ b/src/Vector/se_class3_vector.hpp
@@ -100,42 +100,75 @@ struct init_prop
 	}
 };
 
-// Unknown type
+//! Type check in case of unknown type
 template<typename tcheck, bool foundamental>
 struct typeCheck
 {
-	//! It check if the type is Nan, data type to check
+	/*! \brief It check if the type is Nan, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is Nan
+	 *
+	 */
 	static bool isNan(const tcheck & data)
 	{
 		return false;
 	}
 
-	//! It check is the type is infinity, data type to checl
+	/*! \brief It check if the type is Infinity, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return false if is infinity
+	 *
+	 */
 	static bool isInf(const tcheck & data)
 	{
 		return false;
 	}
 };
 
-// Unknown type
+//! Type check in case of supported type
 template<typename tcheck>
 struct typeCheck<tcheck,true>
 {
+	/*! \brief It check if the type is Nan, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is Nan
+	 *
+	 */
 	static bool isNan(const tcheck & data)
 	{
 		return std::isnan(data);
 	}
 
+	/*! \brief It check if the type is Infinity, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is infinity
+	 *
+	 */
 	static bool isInf(const tcheck & data)
 	{
 		return std::isinf(data);
 	}
 };
 
-// Array
+//! Type check in case of supported array type
 template<typename tcheck, bool foundamental, unsigned int N1>
 struct typeCheck<tcheck[N1], foundamental>
 {
+	/*! \brief It check if the type is Nan, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is Nan
+	 *
+	 */
 	static bool isNan(tcheck (& data)[N1])
 	{
 		bool nn = false;
@@ -149,6 +182,13 @@ struct typeCheck<tcheck[N1], foundamental>
 		return nn;
 	}
 
+	/*! \brief It check if the type is Infinity, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is infinity
+	 *
+	 */
 	static bool isInf(tcheck (& data)[N1])
 	{
 		bool nn = false;
@@ -163,10 +203,17 @@ struct typeCheck<tcheck[N1], foundamental>
 	}
 };
 
-// Array2d
+//! Type check in case of supported 2D array type
 template<typename tcheck, bool foundamental, unsigned int N1, unsigned int N2>
 struct typeCheck<tcheck[N1][N2], foundamental>
 {
+	/*! \brief It check if the type is Nan, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is Nan
+	 *
+	 */
 	static bool isNan(tcheck (& data)[N1][N2])
 	{
 		bool nn = false;
@@ -183,6 +230,13 @@ struct typeCheck<tcheck[N1][N2], foundamental>
 		return nn;
 	}
 
+	/*! \brief It check if the type is Infinity, data type to check
+	 *
+	 * \param data to check
+	 *
+	 * \return true if is infinity
+	 *
+	 */
 	static bool isInf(tcheck (& data)[N1][N2])
 	{
 		bool nn = false;
@@ -219,7 +273,8 @@ struct propCheckNAN
 
 	/*! \brief constructor
 	 *
-	 * \param
+	 * \param data vector to check for Nan properties
+	 * \param id element to check
 	 *
 	 */
 	inline propCheckNAN(const vector & data, size_t id)
@@ -252,7 +307,7 @@ struct propCheckNAN
 /*! \brief this class is a functor for "for_each" algorithm
  *
  * This class is a functor for "for_each" algorithm. For each
- * property it check that there are not NAN properties
+ * property it check that there are not infinity properties
  *
  * \param T boost::fusion::vector
  *
@@ -269,7 +324,7 @@ struct propCheckINF
 
 	/*! \brief constructor
 	 *
-	 * \param check the the property is infinity
+	 * \param data vector to check
 	 * \param id element
 	 *
 	 */
@@ -389,6 +444,13 @@ class se_class3_vector
 		//! last write
 		size_t l_wrt;
 
+		/*! \brief It check if the particle is in the internal ghost area
+		 *
+		 * \param p particle to check
+		 *
+		 * \return true if the particle is in that area
+		 *
+		 */
 		bool isLocalHalo(const Point<dim,T> & p)
 		{
 			for (size_t i = 0; i < dec.getNLocalSub(); i++)
@@ -448,7 +510,13 @@ class se_class3_vector
 			return type;
 		}
 
-		template<unsigned int ... prp> void create_NNP( const size_t (& gg)[sizeof...(prp)+1] )
+		/*! \brief Fill non_NP with the properties that are not synchronized
+		 *
+		 * \param gg vector of properties synchronized
+		 *
+		 */
+		template<unsigned int ... prp>
+		void create_NNP( const size_t (& gg)[sizeof...(prp)+1] )
 		{
 			non_NP.clear();
 
@@ -470,6 +538,13 @@ class se_class3_vector
 		}
 
 
+		/*! \brief Get property name
+		 *
+		 * \param i property
+		 *
+		 * \return the property name
+		 *
+		 */
 		std::string getPrpName(size_t i) const
 		{
 			if (i == Np_real)
@@ -480,17 +555,30 @@ class se_class3_vector
 
 	public:
 
-		//! Constructor all properties are uninitialized
+		/*! Constructor all properties are uninitialized
+		 *
+		 * \param dec decomposition
+		 * \param vd vector we are cheking with SE_CLASS3 checks
+		 *
+		 */
 		se_class3_vector(Decomposition & dec, vector & vd)
-		:dec(dec),vd(vd)
+		:dec(dec),vd(vd),l_wrt(-1)
 		{
 		}
 
+		/*! \brief return the status of the ghosts
+		 *
+		 * \return the status of the ghosts
+		 *
+		 */
 		template<unsigned int prp> size_t isGhostSync()
 		{
 			return sync[GHOST][prp];
 		}
 
+		/*! \brief Initialize the se_class2 structure
+		 *
+		 */
 		void Initialize()
 		{
 			auto it = vd.getDomainIterator_no_se3();
@@ -702,6 +790,10 @@ class se_class3_vector
 			}
 		}
 
+		/*! \brief Operation to do after map
+		 *
+		 *
+		 */
 		void map_post()
 		{
 			for (size_t j = 0 ; j < Np_real + 1 ; j++)
diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp
index 979760c7a..77e6c99db 100644
--- a/src/Vector/vector_dist.hpp
+++ b/src/Vector/vector_dist.hpp
@@ -913,11 +913,13 @@ public:
 	 * \tparam CellL CellList type to construct
 	 *
 	 * \param r_cut interation radius, or size of each cell
+	 * \param no_se3 avoid SE_CLASS3 checking
 	 *
 	 * \return the Cell list
 	 *
 	 */
-	template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut, bool no_se3 = false)
+	template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > >
+	CellL getCellList(St r_cut, bool no_se3 = false)
 	{
 #ifdef SE_CLASS3
 		if (no_se3 == false)
@@ -943,7 +945,8 @@ public:
 	 * \return the Cell list
 	 *
 	 */
-	template<typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast, shift<dim, St> > > CellL getCellList_hilb(St r_cut)
+	template<typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast, shift<dim, St> > >
+	CellL getCellList_hilb(St r_cut)
 	{
 #ifdef SE_CLASS3
 		se3.getNN();
@@ -964,6 +967,7 @@ public:
 	 * \tparam CellL CellList type to construct
 	 *
 	 * \param cell_list Cell list to update
+	 * \param no_se3 avoid se class 3 checking
 	 *
 	 */
 	template<typename CellL> void updateCellList(CellL & cell_list, bool no_se3 = false)
@@ -1045,11 +1049,13 @@ public:
 	 *
 	 * \param r_cut interation radius, or size of each cell
 	 * \param enlarge In case of padding particles the cell list must be enlarged, like a ghost this parameter say how much must be enlarged
+	 * \param no_se3 avoid se_class3 cheking default false
 	 *
 	 * \return the CellList
 	 *
 	 */
-	template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut, const Ghost<dim, St> & enlarge, bool no_se3 = false)
+	template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > >
+	CellL getCellList(St r_cut, const Ghost<dim, St> & enlarge, bool no_se3 = false)
 	{
 #ifdef SE_CLASS3
 		if (no_se3 == false)
@@ -1525,11 +1531,15 @@ public:
 	}
 
 	/*! \brief Get an iterator that traverse the particles in the domain
+	 *         using a cell list
 	 *
-	 * \return an iterator
+	 * \param NN Cell-list
+	 *
+	 * \return an iterator over the particles
 	 *
 	 */
-	template<typename CellList> ParticleIt_Cells<dim,CellList> getDomainIteratorCells(CellList & NN)
+	template<typename CellList> ParticleIt_Cells<dim,CellList>
+	getDomainIteratorCells(CellList & NN)
 	{
 #ifdef SE_CLASS3
 		se3.getIterator();
@@ -1741,9 +1751,7 @@ public:
 	 * from the particles
 	 *
 	 * \param md Model to use
-	 * \param vd vector to add for the computational cost
-	 * \param ts It is an optional parameter approximately should be the number of ghost get between two
-	 *           rebalancing at first decomposition this number can be ignored (default = 1) because not used
+	 * \param vd external vector to add for the computational cost
 	 *
 	 */
 	template <typename Model=ModelLin>inline void addComputationCosts(const self & vd, Model md=Model())
@@ -1766,6 +1774,14 @@ public:
 		}
 	}
 
+	/*! \brief Add the computation cost on the decomposition coming
+	 * from the particles
+	 *
+	 * \param md Model to use
+	 * \param ts It is an optional parameter approximately should be the number of ghost get between two
+	 *           rebalancing at first decomposition this number can be ignored (default = 1) because not used
+	 *
+	 */
 	template <typename Model=ModelLin> void finalizeComputationCosts(Model md=Model(), size_t ts = 1)
 	{
 		Decomposition & dec = getDecomposition();
@@ -1808,36 +1824,6 @@ public:
 		addComputationCosts(*this,md);
 
 		finalizeComputationCosts(md,ts);
-
-/*		CellDecomposer_sm<dim, St, shift<dim,St>> cdsm;
-
-		Decomposition & dec = getDecomposition();
-		auto & dist = getDecomposition().getDistribution();
-
-		cdsm.setDimensions(dec.getDomain(), dec.getDistGrid().getSize(), 0);
-
-		for (size_t i = 0; i < dist.getNOwnerSubSubDomains() ; i++)
-			dec.setSubSubDomainComputationCost(dist.getOwnerSubSubDomain(i) , 1);
-
-		auto it = getDomainIterator();
-
-		while (it.isNext())
-		{
-			size_t v = cdsm.getCell(this->getPos(it.get()));
-
-			md.addComputation(dec,*this,v,it.get().getKey());
-
-			++it;
-		}
-
-		dec.computeCommunicationAndMigrationCosts(ts);
-
-		// Go throught all the sub-sub-domains and apply the model
-
-		for (size_t i = 0 ; i < dist.getNOwnerSubSubDomains(); i++)
-			md.applyModel(dec,dist.getOwnerSubSubDomain(i));
-
-		dist.setDistTol(md.distributionTol());*/
 	}
 
 	/*! \brief Save the distributed vector on HDF5 file
-- 
GitLab