Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implementation of new functions.
[mapping.git] / src / and / Mapping / Grid.java
index 0370940..3501a2d 100644 (file)
@@ -325,8 +325,10 @@ public class Grid implements Serializable
        {
                if( _g != null )
                {
+                       /** Change in the cluster **/
                        getClusterOfNode( _g ).setGNodeStatus( _g, _status ) ;
                        
+                       /** Change in local list **/
                        for( int i = 0 ; i < gnodesList.size() ; i++ )
                        {
                                if( _g.getId() == gnodesList.get( i ).getId() )
@@ -399,15 +401,56 @@ public class Grid implements Serializable
                temp = temp / gnodesList.size() ;
                std = Math.sqrt( temp ) ;
                
-               /** Computation of the relative standard deviation
-                * plus modifications 
-                */
-               hd = 100 * std / average / 10 ;
+               /** Computation of the relative standard deviation **/
+               hd = 100 * std / average ;
                
                
                return hd ;
        }
        
+       /**
+        * Initialization of computing nodes in the grid. Set all
+        * of these nodes to be not mapped on, and do the same thing in each
+        * of its clusters.
+        */     
+       public void initGNodes()
+       {
+               /** Initialization of the local nodes **/
+               for( int i = 0 ; i < gnodesList.size() ; i++ )
+               {
+                       gnodesList.get( i ).setMapped( false ) ;
+               }
+               
+               /** Initialization in clusters **/
+               for( int i = 0 ; i < clusters.size() ; i++ )
+               {
+                       clusters.get( i ).initGNodes() ;
+               }
+       }
+       
+       
+       
+       /**
+        * Initialization of a set of computing nodes in the grid. Set all
+        * of these given nodes to be not mapped on, and propagates in each
+        * of its clusters.
+        * @param _ag The nodes' list to initialize
+        */     
+       public void initGNodes( ArrayList<GNode> _ag )
+       {
+               if( _ag != null && _ag.size() > 0 )
+               {
+                       /** Initialization of the local and clusters nodes **/
+                       for( int i = 0 ; i < _ag.size() ; i++ )
+                       {
+                               setMappedStatus( _ag.get( i ), false ) ;
+                               
+                               getClusterOfNode( _ag.get( i ) ).setGNodeStatus( _ag.get( i ), false ) ;
+                       }
+               }
+       }
+       
+       
        
        /**
         * Print a comprehensible text version of the grid.