SkelGIS  3.0
/home/helene/Documents/These/SkelGIS/SkelGIS_Library/SkelGIS_V3/skelgis/data_structures/DDAG/dpmap_edges_impl.hpp
00001 /*! \file pmap_edges_impl.hpp
00002  *  \brief Definitions of the object PMap_Edges_impl used by the user to map data to the edges of a DDAG. Three template specializations are available.
00003  */
00004 #ifndef DPMAP_EDGES_IMPL_H
00005 #define DPMAP_EDGES_IMPL_H
00006 
00007 #include "ddag.hpp"
00008 #include "../../iterators/DDAG/iterator.hpp"
00009 #include "../../util/communications.hpp"
00010 
00011 namespace skelgis{
00012 
00013   //-------------------------------------------------------------------------------
00014   //!  base template class of Property map on edges
00015   /*!
00016     This template class defines the base PMap_Edges_impl
00017     \tparam DD is the type of the DDAG
00018     \tparam T is the type of data in the property map
00019     \tparam overlap is the overlap size needed to compute the data
00020     \tparam size is the number of elements at each edge
00021 
00022     for a standard type T (two first specializations) the overlap can be 0 or 1 and the size is the default one = 1
00023     for a pointer type T (two second specializations) the overlap can be any value and the size is > 1 because a table is gonna be mapped to each edge
00024   */
00025   //-------------------------------------------------------------------------------
00026   template<class DD, class T, int node_access> struct DPMap_Edges_impl;
00027   //-------------------------------------------------------------------------------
00028   //!  first specialization of DPMap_Edges_impl
00029   /*!
00030     \tparam DD is the type of the DDAG
00031     \tparam T is the type of data in the property map
00032 
00033     The type T is a simple type in this case as float, double, int etc.
00034     The overlap is specialized to the value 1
00035     The size is used with its default value 1
00036   */
00037   //-------------------------------------------------------------------------------
00038   template<class DD, class T> struct DPMap_Edges_impl<DD,T,1>
00039   //-------------------------------------------------------------------------------
00040   {
00041   protected :
00042     /*!< ddag is the pointer to the ddag data structure the property is mapped on */
00043     DDAG_impl<DD::nod,DD::edg> * ddag;
00044     /*!< object to make MPI communications */
00045     Communications<T> * comm;
00046 
00047     //-------------------------------------------------------------------------------
00048     //!  to read input initialize file
00049     /*!
00050       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00051     */
00052     //-------------------------------------------------------------------------------
00053     void read(const char * file)
00054     //-------------------------------------------------------------------------------
00055     {
00056       //parallel read to write CF DMatrix
00057       FILE *pmapfile=fopen(file,"r");
00058 
00059       T any=0;
00060       for(unsigned int i=0;i<dim_edge+dim_tor;i++)
00061         {
00062           for(unsigned int j=0;j<ddag->getIndexEdge(i);j++)
00063             int read = fscanf(pmapfile,"%lf", &any);
00064           int read = fscanf(pmapfile,"%lf", &data[i]);
00065           int seek = fseek(pmapfile,0,SEEK_SET);
00066         }
00067 
00068       fclose(pmapfile);
00069     }
00070     //-------------------------------------------------------------------------------
00071     //!  init function with values in file
00072     /*!
00073       \param file is the file of intial values for this property on edges (each line is the value of the node "number of this line" associated in the .dot file)
00074     */
00075     //-------------------------------------------------------------------------------
00076     void init(const char * file)
00077     //-------------------------------------------------------------------------------
00078     {
00079       dim_edge = ddag->getDimEdge();
00080       dim_tor = ddag->getDimTorIn()+ddag->getDimTorOut();
00081       data = new T[dim_edge+dim_tor];
00082       read(file);
00083     }
00084     //-------------------------------------------------------------------------------
00085     //!  init function with default value
00086     /*!
00087       \param val is the value to intiate edges to
00088     */
00089     //-------------------------------------------------------------------------------
00090     void init(T val)
00091     //-------------------------------------------------------------------------------
00092     {
00093       dim_edge = ddag->getDimEdge();
00094       dim_tor = ddag->getDimTorIn()+ddag->getDimTorOut();
00095       data = new T[dim_edge+dim_tor];
00096       for(unsigned int i=0;i<dim_edge+dim_tor;i++)
00097         {
00098           data[i] = val;
00099         }
00100     }
00101     //-------------------------------------------------------------------------------
00102     //!  init function for MPI communications
00103     /*!
00104     */
00105     //-------------------------------------------------------------------------------
00106     void init_comm()
00107     {
00108       //init the communication object
00109       comm = new Communications<T>();
00110     }
00111     //-------------------------------------------------------------------------------
00112     
00113   public:
00114     /*!< dim_edge is the number of local edges */
00115     unsigned int dim_edge;
00116     /*!< dim_tor is the number of additionnal nodes to receive */
00117     unsigned int dim_tor;
00118     /*!< data mapped on edges of the ddag */
00119     T * data;
00120 
00121     //-------------------------------------------------------------------------------
00122     //!  constructor
00123     /*!
00124       \param dag is the DDAG the property is going to mapped
00125       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00126     */
00127     //-------------------------------------------------------------------------------
00128     DPMap_Edges_impl(DD &dag, const char * file)
00129     //-------------------------------------------------------------------------------
00130     {
00131       ddag = dag.getDDAG_impl();
00132       //communication initialization
00133       init_comm();
00134       //construction of data and read the file
00135       init(file);
00136     }
00137     //-------------------------------------------------------------------------------
00138     //!  constructor of DPMap_Edges
00139     /*!
00140       \param dag is the DDAG object associated to this map
00141       \param val is the default value of edges for the map
00142     */
00143     //-------------------------------------------------------------------------------
00144     DPMap_Edges_impl(DD &dag, T val)
00145     //-------------------------------------------------------------------------------
00146     {
00147       ddag = dag.getDDAG_impl();
00148       //communication initialization
00149       init_comm();
00150       //construction of data and fill with val
00151       init(val);
00152     }
00153     //-------------------------------------------------------------------------------
00154     //!  destructor of DPMap_Edges
00155     /*!
00156     */
00157     //-------------------------------------------------------------------------------
00158     ~DPMap_Edges_impl()
00159     //-------------------------------------------------------------------------------
00160     {
00161       delete [] data;
00162       delete comm;
00163     }
00164     //-------------------------------------------------------------------------------
00165     //!  to get the begin iterator on edges
00166     /*!
00167       \return the begin iterator on edges
00168     */
00169     //-------------------------------------------------------------------------------
00170     inline iterator_dag begin(){return iterator_dag(0);}
00171     //-------------------------------------------------------------------------------
00172     //!  to get the end iterator on edges
00173     /*!
00174       \return the end iterator on edges
00175     */
00176     //-------------------------------------------------------------------------------
00177     inline iterator_dag end(){return iterator_dag(ddag->getDimEdge());}
00178     //-------------------------------------------------------------------------------
00179     //!  to get an iterator on the source node of the edge
00180     /*!
00181       \return the iterator on the source node
00182     */
00183     //-------------------------------------------------------------------------------
00184     inline iterator_dag getSrcNode(iterator_dag it){return iterator_dag(ddag->getSrcNode(it._rank));}
00185     //-------------------------------------------------------------------------------
00186     //!  to get an iterator on the destination node of the edge
00187     /*!
00188       \return the iterator on the destination node
00189     */
00190     //-------------------------------------------------------------------------------
00191     inline iterator_dag getDstNode(iterator_dag it){return iterator_dag(ddag->getDstNode(it._rank));}
00192     //-------------------------------------------------------------------------------
00193     //!  start the communication process for the dpmap_edges property
00194     /*!
00195       prepare data to send
00196       launch non blocking MPI communications
00197     */
00198     //-------------------------------------------------------------------------------
00199     void start_communications()
00200     //-------------------------------------------------------------------------------
00201     {
00202       for(int j=0;j<Mpi_::mpi_nb;j++)
00203         {
00204           //prepare data to send
00205           unsigned int nb_toSend = ddag->getNbEdgesToSend(j);
00206           if(nb_toSend>0)
00207             {
00208               T * toSend = (T*)calloc(nb_toSend,sizeof(T));
00209               unsigned int * indexes = ddag->getEdgesToSend(j);
00210               for(unsigned int i=0;i<nb_toSend;i++)
00211                 toSend[i] = data[indexes[i]];
00212 
00213               comm->ISend(toSend, nb_toSend, j);
00214 
00215               free(indexes);
00216               free(toSend);
00217             }
00218           //prepare data to receive
00219           unsigned int nb_toRecv = ddag->getNbEdgesToRecv(j);
00220           if(nb_toRecv>0)
00221             comm->IRecv(nb_toRecv, j);
00222          
00223         }
00224     }
00225     //-------------------------------------------------------------------------------
00226     //!  end the communication process for the dpmap_edges property
00227     /*!
00228       wait for the end of non-blocking communications
00229       put received values in the dpmap_edges property
00230     */
00231     //-------------------------------------------------------------------------------
00232     void end_communications()
00233     //-------------------------------------------------------------------------------
00234     {
00235       for(int j=0;j<Mpi_::mpi_nb;j++)
00236         {
00237           //prepare data to send
00238           unsigned int nb_toSend = ddag->getNbEdgesToSend(j);
00239           if(nb_toSend>0)
00240             comm->Wait_s(j);
00241           unsigned int nb_toRecv = ddag->getNbEdgesToRecv(j);
00242           if(nb_toRecv>0)
00243             {
00244               T * toRecv = (T*)calloc(nb_toRecv,sizeof(T));
00245               comm->Wait_r(toRecv,j,nb_toRecv);
00246               unsigned int * indexes = ddag->getEdgesToRecv(j);
00247               //change values in data
00248               for(int k=0;k<nb_toRecv;k++)
00249                 data[indexes[k]] = toRecv[k];
00250             
00251               free(indexes);
00252               free(toRecv);
00253             }
00254         }
00255     }
00256     //-------------------------------------------------------------------------------
00257 
00258   };
00259   //-------------------------------------------------------------------------------
00260   //!  second specialization of DPMap_Edges_impl
00261   /*!
00262     \tparam DD is the type of the DDAG
00263     \tparam T is the type of data in the property map
00264 
00265     The type T is a simple type in this case as float, double, int etc.
00266     The overlap is specialized to the value 0
00267   */
00268   //-------------------------------------------------------------------------------
00269   template<class DD, class T> struct DPMap_Edges_impl<DD,T,0>
00270   {
00271 
00272     protected :
00273     /*!< ddag is the pointer to the ddag data structure the property is mapped on */
00274     DDAG_impl<DD::nod,DD::edg> * ddag;
00275 
00276     //-------------------------------------------------------------------------------
00277     //!  to read input initialize file
00278     /*!
00279       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00280     */
00281     //-------------------------------------------------------------------------------
00282     void read(const char * file)
00283     //-------------------------------------------------------------------------------
00284     {
00285       //parallel read to write CF DMatrix
00286       FILE *pmapfile=fopen(file,"r");
00287 
00288       T any=0;
00289       for(unsigned int i=0;i<dim_edge;i++)
00290         {
00291           for(unsigned int j=0;j<ddag->getIndexEdge(i);j++)
00292             int read = fscanf(pmapfile,"%lf", &any);
00293           int read = fscanf(pmapfile,"%lf", &data[i]);
00294           int seek = fseek(pmapfile,0,SEEK_SET);
00295         }
00296 
00297       fclose(pmapfile);
00298     }
00299     //-------------------------------------------------------------------------------
00300     //!  init function with values in file
00301     /*!
00302       \param file is the file of intial values for this property on edges (each line is the value of the node "number of this line" associated in the .dot file)
00303     */
00304     //-------------------------------------------------------------------------------
00305     void init(const char * file)
00306     //-------------------------------------------------------------------------------
00307     {
00308       dim_edge = ddag->getDimEdge();
00309       data = new T[dim_edge];
00310       read(file);
00311     }
00312     //-------------------------------------------------------------------------------
00313     //!  init function with default value
00314     /*!
00315       \param val is the value to intiate edges to
00316     */
00317     //-------------------------------------------------------------------------------
00318     void init(T val)
00319     //-------------------------------------------------------------------------------
00320     {
00321       dim_edge = ddag->getDimEdge();
00322       data = new T[dim_edge];
00323       for(unsigned int i=0;i<dim_edge;i++)
00324         {
00325           data[i] = val;
00326         }
00327     }
00328     //-------------------------------------------------------------------------------
00329     
00330   public:
00331     /*!< dim_edge is the number of local edges */
00332     unsigned int dim_edge;
00333     /*!< data mapped on edges of the ddag */
00334     T * data;
00335 
00336     //-------------------------------------------------------------------------------
00337     //!  constructor
00338     /*!
00339       \param dag is the DDAG the property is going to mapped
00340       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00341     */
00342     //-------------------------------------------------------------------------------
00343     DPMap_Edges_impl(DD &dag, const char * file)
00344     //-------------------------------------------------------------------------------
00345     {
00346       ddag = dag.getDDAG_impl();
00347       //construction of data and read the file
00348       init(file);
00349     }
00350     //-------------------------------------------------------------------------------
00351     //!  constructor of DPMap_Edges
00352     /*!
00353       \param dag is the DDAG object associated to this map
00354       \param val is the default value of edges for the map
00355     */
00356     //-------------------------------------------------------------------------------
00357     DPMap_Edges_impl(DD &dag, T val)
00358     //-------------------------------------------------------------------------------
00359     {
00360       ddag = dag.getDDAG_impl();
00361       //construction of data and fill with val
00362       init(val);
00363     }
00364     //-------------------------------------------------------------------------------
00365     //!  destructor of DPMap_Edges
00366     /*!
00367     */
00368     //-------------------------------------------------------------------------------
00369     ~DPMap_Edges_impl()
00370     //-------------------------------------------------------------------------------
00371     {
00372       delete [] data;
00373     }
00374     //-------------------------------------------------------------------------------
00375     //!  to get the begin iterator on edges
00376     /*!
00377       \return the begin iterator on edges
00378     */
00379     //-------------------------------------------------------------------------------
00380     inline iterator_dag begin(){return iterator_dag(0);}
00381     //-------------------------------------------------------------------------------
00382     //!  to get the end iterator on edges
00383     /*!
00384       \return the end iterator on edges
00385     */
00386     //-------------------------------------------------------------------------------
00387     inline iterator_dag end(){return iterator_dag(ddag->getDimEdge());}
00388     //-------------------------------------------------------------------------------
00389     //!  to get an iterator on the source node of the edge
00390     /*!
00391       \return the iterator on the source node
00392     */
00393     //-------------------------------------------------------------------------------
00394     inline iterator_dag getSrcNode(iterator_dag it){return iterator_dag(ddag->getSrcNode(it._rank));}
00395     //-------------------------------------------------------------------------------
00396     //!  to get an iterator on the destination node of the edge
00397     /*!
00398       \return the iterator on the destination node
00399     */
00400     //-------------------------------------------------------------------------------
00401     inline iterator_dag getDstNode(iterator_dag it){return iterator_dag(ddag->getDstNode(it._rank));}
00402     //-------------------------------------------------------------------------------
00403     //!  start the communication process for the dpmap_edges property
00404     /*!
00405       prepare data to send
00406       launch non blocking MPI communications
00407     */
00408     //-------------------------------------------------------------------------------
00409     inline void start_communications(){}
00410     //-------------------------------------------------------------------------------
00411     //!  end the communication process for the dpmap_edges property
00412     /*!
00413       wait for the end of non-blocking communications
00414       put received values in the dpmap_edges property
00415     */
00416     //-------------------------------------------------------------------------------
00417     inline void end_communications(){}
00418     //-------------------------------------------------------------------------------
00419   };
00420   //-------------------------------------------------------------------------------
00421   //!  third specialization of DPMap_Edges_impl
00422   /*!
00423     \tparam DD is the type of the DDAG
00424     \tparam T is the type of data in the property map
00425     \tapram overlap is the overlap size needed to compute the data
00426     The type T is specialized with a specific pointer type in this case as float*, double*, int* etc.
00427     The overlap is not specialized and is [0,...,size]
00428     The size is not specialized, it is the number of elements in the pointer table to map
00429   */
00430   //-------------------------------------------------------------------------------
00431   template<class DD, class T,int node_access> struct DPMap_Edges_impl<DD,T*,node_access>
00432   {
00433   protected :
00434     /*!< ddag is the pointer to the ddag data structure the property is mapped on */
00435     DDAG_impl<DD::nod,DD::edg> * ddag;
00436     /*!< object to make MPI communications */
00437     CommunicationsInOut<T> * comm;
00438     /*!< size of the pointer mapped to edges */
00439     unsigned int size;
00440 
00441     //-------------------------------------------------------------------------------
00442     //!  to read input initialize file
00443     /*!
00444       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00445     */
00446     //-------------------------------------------------------------------------------
00447     void read(const char * file)
00448     //-------------------------------------------------------------------------------
00449     {
00450       std::ifstream entries(file,std::ios::in);
00451       if (!entries){
00452         std::cerr << "Impossible to open the " << file <<"\n";
00453         exit(EXIT_FAILURE);
00454       }
00455 
00456       unsigned int nb_line = 0;
00457       while (!entries.eof()){
00458         //read line
00459         std::string line;
00460         getline (entries, line);
00461         for(unsigned int j=0;j<dim_edge;j++)
00462           {
00463             if(ddag->getIndexEdge(j)==nb_line)
00464               {
00465                 //init data table for this edge
00466                 data[j] = (T*)calloc(size,sizeof(T));
00467                 int found1 = -1;
00468                 int found2 = -1;
00469                 for(unsigned int i=0;i<size;i++)
00470                   {
00471                     found1 = found2+1;
00472                     found2 = line.find(",",found1);
00473                     std::string val = line.substr(found1,found2-found1);
00474                     //memcpy(&data[j][i], value, sizeof(T));
00475                     data[j][i] = atof(val.data());
00476                   }
00477               }
00478           }
00479         nb_line++;
00480       }
00481       entries.close();
00482     }
00483     //-------------------------------------------------------------------------------
00484     //!  init function with values in file
00485     /*!
00486       \param file is the file of intial values for this property on edges (each line is the value of the node "number of this line" associated in the .dot file)
00487     */
00488     //-------------------------------------------------------------------------------
00489     void init(const char * file)
00490     //-------------------------------------------------------------------------------
00491     {
00492       dim_edge = ddag->getDimEdge();
00493       dim_tor = ddag->getDimTorIn()+ddag->getDimTorOut();
00494       data = (T**)calloc(dim_edge+dim_tor,sizeof(T*));
00495       for(unsigned int j=dim_edge;j<dim_edge+dim_tor;j++)
00496         data[j] = (T*)calloc(node_access,sizeof(T));
00497       read(file);
00498     }
00499     //-------------------------------------------------------------------------------
00500     //!  init function with default value
00501     /*!
00502       \param val is the value to intiate edges to
00503     */
00504     //-------------------------------------------------------------------------------
00505     void init(T val)
00506     //-------------------------------------------------------------------------------
00507     {
00508       dim_edge = ddag->getDimEdge();
00509       dim_tor = ddag->getDimTorIn()+ddag->getDimTorOut();
00510       data = (T**)calloc(dim_edge+dim_tor,sizeof(T*));
00511       for(unsigned int i=0;i<dim_edge+dim_tor;i++)
00512         {
00513           data[i] = (T*)calloc(size,sizeof(T));
00514           for(unsigned int j=0;j<size;j++)
00515             data[i][j] = val;
00516         }
00517     }
00518     //-------------------------------------------------------------------------------
00519     //!  init function for MPI communications
00520     /*!
00521     */
00522     //-------------------------------------------------------------------------------
00523     void init_comm()
00524     {
00525       //init the communication object
00526       comm = new CommunicationsInOut<T>();
00527     }
00528     //-------------------------------------------------------------------------------
00529     
00530   public:
00531     /*!< dim_edge is the number of local edges */
00532     unsigned int dim_edge;
00533     /*!< dim_tor is the number of additionnal nodes to receive */
00534     unsigned int dim_tor;
00535     /*!< data mapped on edges of the ddag */
00536     T ** data;
00537 
00538     //-------------------------------------------------------------------------------
00539     //!  constructor
00540     /*!
00541       \param dag is the DDAG the property is going to mapped
00542       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00543     */
00544     //-------------------------------------------------------------------------------
00545     DPMap_Edges_impl(DD &dag, const char * file, const unsigned int s)
00546     //-------------------------------------------------------------------------------
00547     {
00548       size = s;
00549       ddag = dag.getDDAG_impl();
00550       //communication initialization
00551       init_comm();
00552       //construction of data and read the file
00553       init(file);
00554     }
00555     //-------------------------------------------------------------------------------
00556     //!  constructor of DPMap_Edges
00557     /*!
00558       \param dag is the DDAG object associated to this map
00559       \param val is the default value of edges for the map
00560     */
00561     //-------------------------------------------------------------------------------
00562     DPMap_Edges_impl(DD &dag, T val, const unsigned int s)
00563     //-------------------------------------------------------------------------------
00564     {
00565       size = s;
00566       ddag = dag.getDDAG_impl();
00567       //init comm
00568       init_comm();
00569       //construction of data and fill with val
00570       init(val);
00571     }
00572     //-------------------------------------------------------------------------------
00573     //!  destructor of DPMap_Edges
00574     /*!
00575     */
00576     //-------------------------------------------------------------------------------
00577     ~DPMap_Edges_impl()
00578     //-------------------------------------------------------------------------------
00579     {
00580       for(unsigned int i=0;i<dim_edge+dim_tor;i++)
00581         free(data[i]);
00582       free(data);
00583       
00584       delete comm;
00585     }
00586     //-------------------------------------------------------------------------------
00587     //!  to get the begin iterator on edges
00588     /*!
00589       \return the begin iterator on edges
00590     */
00591     //-------------------------------------------------------------------------------
00592     inline iterator_dag begin(){return iterator_dag(0);}
00593     //-------------------------------------------------------------------------------
00594     //!  to get the end iterator on edges
00595     /*!
00596       \return the end iterator on edges
00597     */
00598     //-------------------------------------------------------------------------------
00599     inline iterator_dag end(){return iterator_dag(ddag->getDimEdge());}
00600     //-------------------------------------------------------------------------------
00601     //!  to get an iterator on the source node of the edge
00602     /*!
00603       \return the iterator on the source node
00604     */
00605     //-------------------------------------------------------------------------------
00606     inline iterator_dag getSrcNode(iterator_dag it){return iterator_dag(ddag->getSrcNode(it._rank));}
00607     //-------------------------------------------------------------------------------
00608     //!  to get an iterator on the destination node of the edge
00609     /*!
00610       \return the iterator on the destination node
00611     */
00612     //-------------------------------------------------------------------------------
00613     inline iterator_dag getDstNode(iterator_dag it){return iterator_dag(ddag->getDstNode(it._rank));}
00614     //-------------------------------------------------------------------------------
00615     //!  start the communication process for the dpmap_edges property
00616     /*!
00617       prepare data to send
00618       launch non blocking MPI communications
00619     */
00620     //-------------------------------------------------------------------------------
00621     void start_communications()
00622     //-------------------------------------------------------------------------------
00623     {
00624       for(int j=0;j<Mpi_::mpi_nb;j++)
00625         {
00626           //prepare data to send in
00627           unsigned int nb_toSend_in = ddag->getNbEdgesToSendIn(j);
00628           if(nb_toSend_in>0)
00629             {
00630               //the size of toSend_in is multiplied by node_access
00631               T * toSend_in = (T*)calloc(nb_toSend_in*node_access,sizeof(T));
00632               unsigned int * indexes_in = ddag->getEdgesToSendIn(j);
00633               for(unsigned int i=0;i<nb_toSend_in*node_access;i=i+node_access)
00634                 {
00635                   T * ptr = data[indexes_in[i/node_access]];
00636                   //as we send to another processor that receive in, we give the node_access last values of ptr
00637                   for(unsigned int k=0;k<node_access;k++)
00638                       toSend_in[i+k] = ptr[size-(node_access-k)];
00639                 }
00640 
00641               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" to send in to proc "<<j<<" = ";
00642               for(unsigned int i=0;i<nb_toSend_in*node_access;i++)
00643                 std::cout<<toSend_in[i]<<" ";
00644                 std::cout<<std::endl;*/
00645                 
00646               comm->ISendIn(toSend_in, nb_toSend_in*node_access, j);
00647 
00648               free(indexes_in);
00649               free(toSend_in);
00650             }
00651           //prepare data to receive out (correspond to send in)
00652           unsigned int nb_toRecv_out = ddag->getNbEdgesToRecvOut(j);
00653           if(nb_toRecv_out>0)
00654             comm->IRecvOut(nb_toRecv_out*node_access, j);
00655 
00656           //prepare data to send out
00657           unsigned int nb_toSend_out = ddag->getNbEdgesToSendOut(j);
00658           if(nb_toSend_out>0)
00659             {
00660               T * toSend_out = (T*)calloc(nb_toSend_out*node_access,sizeof(T));
00661               unsigned int * indexes_out = ddag->getEdgesToSendOut(j);
00662               for(unsigned int i=0;i<nb_toSend_out*node_access;i=i+node_access)
00663                 {
00664                   T * ptr = data[indexes_out[i/node_access]];
00665                   //as we send to another processor that receive out, we give the node_access first values of ptr
00666                   for(unsigned int k=0;k<node_access;k++)
00667                     toSend_out[i+k] = ptr[k];
00668                 }
00669 
00670               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" to send out to proc "<<j<<" = ";
00671               for(unsigned int i=0;i<nb_toSend_out*node_access;i++)
00672                 std::cout<<toSend_out[i]<<" ";
00673                 std::cout<<std::endl;*/
00674 
00675               comm->ISendOut(toSend_out, nb_toSend_out*node_access, j);
00676 
00677               free(indexes_out);
00678               free(toSend_out);
00679             }
00680 
00681           //prepare data to recv in
00682           unsigned int nb_toRecv_in = ddag->getNbEdgesToRecvIn(j);
00683           if(nb_toRecv_in>0)
00684             comm->IRecvIn(nb_toRecv_in*node_access, j);
00685         }
00686     }
00687     //-------------------------------------------------------------------------------
00688     //!  end the communication process for the dpmap_edges property
00689     /*!
00690       wait for the end of non-blocking communications
00691       put received values in the dpmap_edges property
00692     */
00693     //-------------------------------------------------------------------------------
00694     void end_communications()
00695     //-------------------------------------------------------------------------------
00696     {
00697       for(int j=0;j<Mpi_::mpi_nb;j++)
00698         {
00699           //end data to send in
00700           unsigned int nb_toSend_in = ddag->getNbEdgesToSendIn(j);
00701           if(nb_toSend_in>0)
00702             comm->Wait_sIn(j);
00703           
00704           //end data to receive out
00705           unsigned int nb_toRecv_out = ddag->getNbEdgesToRecvOut(j);
00706           if(nb_toRecv_out>0)
00707             {
00708               T * toRecv_out = (T*)calloc(nb_toRecv_out*node_access,sizeof(T));
00709               comm->Wait_rOut(toRecv_out,j,nb_toRecv_out*node_access);
00710               unsigned int * indexes_out = ddag->getEdgesToRecvOut(j);
00711               //change values in data
00712               for(unsigned int k=0;k<nb_toRecv_out;k++)
00713                 {
00714                   //pointer to modify
00715                   T * ptr = data[indexes_out[k]];
00716                   for(unsigned int i=0;i<node_access;i++)
00717                     ptr[i] = toRecv_out[k*node_access+i];
00718                 }
00719               
00720               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" received out from proc "<<j<<" = ";
00721               for(unsigned int i=0;i<nb_toRecv_out*node_access;i++)
00722                 std::cout<<toRecv_out[i]<<" ";
00723                 std::cout<<std::endl;*/
00724 
00725               free(indexes_out);
00726               free(toRecv_out);
00727             }
00728           //end data to send out
00729           unsigned int nb_toSend_out = ddag->getNbEdgesToSendOut(j);
00730           if(nb_toSend_out>0)
00731             comm->Wait_sOut(j);
00732           
00733           //end data to receive in
00734           unsigned int nb_toRecv_in = ddag->getNbEdgesToRecvIn(j);
00735           if(nb_toRecv_in>0)
00736             {
00737               T * toRecv_in = (T*)calloc(nb_toRecv_in*node_access,sizeof(T));
00738               comm->Wait_rIn(toRecv_in,j,nb_toRecv_in*node_access);
00739               unsigned int * indexes_in = ddag->getEdgesToRecvIn(j);
00740               //change values in data
00741               for(int k=0;k<nb_toRecv_in;k++)
00742                 {
00743                   //pointer to modify
00744                   T * ptr = data[indexes_in[k]];
00745                   for(unsigned int i=0;i<node_access;i++)
00746                     ptr[i] = toRecv_in[k*node_access+i];
00747                 }
00748 
00749               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" received in from proc "<<j<<" = ";
00750               for(unsigned int i=0;i<nb_toRecv_in*node_access;i++)
00751                 std::cout<<toRecv_in[i]<<" ";
00752                 std::cout<<std::endl;*/
00753 
00754               free(indexes_in);
00755               free(toRecv_in);
00756             }
00757         }
00758     }
00759     //-------------------------------------------------------------------------------
00760   };
00761 
00762   //-------------------------------------------------------------------------------
00763   //!  third specialization of DPMap_Edges_impl
00764   /*!
00765     \tparam DD is the type of the DDAG
00766     \tparam T is the type of data in the property map
00767     \tapram overlap is the overlap size needed to compute the data
00768     The type T is specialized with a specific pointer type in this case as float*, double*, int* etc.
00769     The overlap is not specialized and is [0,...,size]
00770     The size is not specialized, it is the number of elements in the pointer table to map
00771   */
00772   //-------------------------------------------------------------------------------
00773   template<class DD, class T> struct DPMap_Edges_impl<DD,T*,1>
00774   {
00775   protected :
00776     /*!< ddag is the pointer to the ddag data structure the property is mapped on */
00777     DDAG_impl<DD::nod,DD::edg> * ddag;
00778     /*!< object to make MPI communications */
00779     CommunicationsInOut<T> * comm;
00780     /*!< size of the pointer mapped to edges */
00781     unsigned int size;
00782 
00783     //-------------------------------------------------------------------------------
00784     //!  to read input initialize file
00785     /*!
00786       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00787     */
00788     //-------------------------------------------------------------------------------
00789     void read(const char * file)
00790     //-------------------------------------------------------------------------------
00791     {
00792       std::ifstream entries(file,std::ios::in);
00793       if (!entries){
00794         std::cerr << "Impossible to open the " << file <<"\n";
00795         exit(EXIT_FAILURE);
00796       }
00797 
00798       unsigned int nb_line = 0;
00799       while (!entries.eof()){
00800         //read line
00801         std::string line;
00802         getline (entries, line);
00803         for(unsigned int j=0;j<dim_edge;j++)
00804           {
00805             if(ddag->getIndexEdge(j)==nb_line)
00806               {
00807                 //init data table for this edge
00808                 data[j] = (T*)calloc(size,sizeof(T));
00809                 int found1 = -1;
00810                 int found2 = -1;
00811                 for(unsigned int i=0;i<size;i++)
00812                   {
00813                     found1 = found2+1;
00814                     found2 = line.find(",",found1);
00815                     std::string val = line.substr(found1,found2-found1);
00816                     data[j][i] = atof(val.data());
00817                     //const char * value = line.data();
00818                     //memcpy(&data[j][i], value, sizeof(T));
00819                   }
00820               }
00821           }
00822         nb_line++;
00823       }
00824       entries.close();
00825     }
00826     //-------------------------------------------------------------------------------
00827     //!  init function with values in file
00828     /*!
00829       \param file is the file of intial values for this property on edges (each line is the value of the node "number of this line" associated in the .dot file)
00830     */
00831     //-------------------------------------------------------------------------------
00832     void init(const char * file)
00833     //-------------------------------------------------------------------------------
00834     {
00835       dim_edge = ddag->getDimEdge();
00836       dim_tor = ddag->getDimTorIn()+ddag->getDimTorOut();
00837       data = (T**)calloc(dim_edge+dim_tor,sizeof(T*));
00838       for(unsigned int j=dim_edge;j<dim_edge+dim_tor;j++)
00839         data[j] = (T*)calloc(1,sizeof(T));
00840       read(file);
00841     }
00842     //-------------------------------------------------------------------------------
00843     //!  init function with default value
00844     /*!
00845       \param val is the value to intiate edges to
00846     */
00847     //-------------------------------------------------------------------------------
00848     void init(T val)
00849     //-------------------------------------------------------------------------------
00850     {
00851       dim_edge = ddag->getDimEdge();
00852       dim_tor = ddag->getDimTorIn()+ddag->getDimTorOut();
00853       data = (T**)calloc(dim_edge+dim_tor,sizeof(T*));
00854       for(unsigned int i=0;i<dim_edge+dim_tor;i++)
00855         {
00856           data[i] = (T*)calloc(size,sizeof(T));
00857           for(unsigned int j=0;j<size;j++)
00858             data[i][j] = val;
00859         }
00860     }
00861     //-------------------------------------------------------------------------------
00862     //!  init function for MPI communications
00863     /*!
00864     */
00865     //-------------------------------------------------------------------------------
00866     void init_comm()
00867     {
00868       //init the communication object
00869       comm = new CommunicationsInOut<T>();
00870     }
00871     //-------------------------------------------------------------------------------
00872     
00873   public:
00874     /*!< dim_edge is the number of local edges */
00875     unsigned int dim_edge;
00876     /*!< dim_tor is the number of additionnal nodes to receive */
00877     unsigned int dim_tor;
00878     /*!< data mapped on edges of the ddag */
00879     T ** data;
00880 
00881     //-------------------------------------------------------------------------------
00882     //!  constructor
00883     /*!
00884       \param dag is the DDAG the property is going to mapped
00885       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
00886     */
00887     //-------------------------------------------------------------------------------
00888     DPMap_Edges_impl(DD &dag, const char * file, const unsigned int s)
00889     //-------------------------------------------------------------------------------
00890     {
00891       size = s;
00892       ddag = dag.getDDAG_impl();
00893       //communication initialization
00894       init_comm();
00895       //construction of data and read the file
00896       init(file);
00897     }
00898     //-------------------------------------------------------------------------------
00899     //!  constructor of DPMap_Edges
00900     /*!
00901       \param dag is the DDAG object associated to this map
00902       \param val is the default value of edges for the map
00903     */
00904     //-------------------------------------------------------------------------------
00905     DPMap_Edges_impl(DD &dag, T val, const unsigned int s)
00906     //-------------------------------------------------------------------------------
00907     {
00908       size = s;
00909       ddag = dag.getDDAG_impl();
00910       //init comm
00911       init_comm();
00912       //construction of data and fill with val
00913       init(val);
00914     }
00915     //-------------------------------------------------------------------------------
00916     //!  destructor of DPMap_Edges
00917     /*!
00918     */
00919     //-------------------------------------------------------------------------------
00920     ~DPMap_Edges_impl()
00921     //-------------------------------------------------------------------------------
00922     {
00923       for(unsigned int i=0;i<dim_edge+dim_tor;i++)
00924         free(data[i]);
00925       free(data);
00926       
00927       delete comm;
00928     }
00929     //-------------------------------------------------------------------------------
00930     //!  to get the begin iterator on edges
00931     /*!
00932       \return the begin iterator on edges
00933     */
00934     //-------------------------------------------------------------------------------
00935     inline iterator_dag begin(){return iterator_dag(0);}
00936     //-------------------------------------------------------------------------------
00937     //!  to get the end iterator on edges
00938     /*!
00939       \return the end iterator on edges
00940     */
00941     //-------------------------------------------------------------------------------
00942     inline iterator_dag end(){return iterator_dag(ddag->getDimEdge());}
00943     //-------------------------------------------------------------------------------
00944     //!  to get an iterator on the source node of the edge
00945     /*!
00946       \return the iterator on the source node
00947     */
00948     //-------------------------------------------------------------------------------
00949     inline iterator_dag getSrcNode(iterator_dag it){return iterator_dag(ddag->getSrcNode(it._rank));}
00950     //-------------------------------------------------------------------------------
00951     //!  to get an iterator on the destination node of the edge
00952     /*!
00953       \return the iterator on the destination node
00954     */
00955     //-------------------------------------------------------------------------------
00956     inline iterator_dag getDstNode(iterator_dag it){return iterator_dag(ddag->getDstNode(it._rank));}
00957     //-------------------------------------------------------------------------------
00958     //!  start the communication process for the dpmap_edges property
00959     /*!
00960       prepare data to send
00961       launch non blocking MPI communications
00962     */
00963     //-------------------------------------------------------------------------------
00964     void start_communications()
00965     //-------------------------------------------------------------------------------
00966     {
00967       for(int j=0;j<Mpi_::mpi_nb;j++)
00968         {
00969           //prepare data to send in
00970           unsigned int nb_toSend_in = ddag->getNbEdgesToSendIn(j);
00971           if(nb_toSend_in>0)
00972             {
00973               //the size of toSend_in is multiplied by node_access
00974               T * toSend_in = (T*)calloc(nb_toSend_in,sizeof(T));
00975               unsigned int * indexes_in = ddag->getEdgesToSendIn(j);
00976               for(unsigned int i=0;i<nb_toSend_in;i++)
00977                 {
00978                   T * ptr = data[indexes_in[i]];
00979                   //as we send to another processor that receive in, we give the node_access last values of ptr
00980                   toSend_in[i] = ptr[size-1];
00981                 }
00982 
00983               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" to send in to proc "<<j<<" = ";
00984               for(unsigned int i=0;i<nb_toSend_in;i++)
00985                 std::cout<<toSend_in[i]<<" ";
00986                 std::cout<<std::endl;*/
00987                 
00988               comm->ISendIn(toSend_in, nb_toSend_in, j);
00989 
00990               free(indexes_in);
00991               free(toSend_in);
00992             }
00993           //prepare data to receive out (correspond to send in)
00994           unsigned int nb_toRecv_out = ddag->getNbEdgesToRecvOut(j);
00995           if(nb_toRecv_out>0)
00996             comm->IRecvOut(nb_toRecv_out, j);
00997 
00998           //prepare data to send out
00999           unsigned int nb_toSend_out = ddag->getNbEdgesToSendOut(j);
01000           if(nb_toSend_out>0)
01001             {
01002               T * toSend_out = (T*)calloc(nb_toSend_out,sizeof(T));
01003               unsigned int * indexes_out = ddag->getEdgesToSendOut(j);
01004               for(unsigned int i=0;i<nb_toSend_out;i++)
01005                 {
01006                   T * ptr = data[indexes_out[i]];
01007                   //as we send to another processor that receive out, we give the node_access first values of ptr
01008                   toSend_out[i] = ptr[0];
01009                 }
01010 
01011               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" to send out to proc "<<j<<" = ";
01012               for(unsigned int i=0;i<nb_toSend_out;i++)
01013                 std::cout<<toSend_out[i]<<" ";
01014                 std::cout<<std::endl;*/
01015 
01016               comm->ISendOut(toSend_out, nb_toSend_out, j);
01017 
01018               free(indexes_out);
01019               free(toSend_out);
01020             }
01021 
01022           //prepare data to recv in
01023           unsigned int nb_toRecv_in = ddag->getNbEdgesToRecvIn(j);
01024           if(nb_toRecv_in>0)
01025             comm->IRecvIn(nb_toRecv_in, j);
01026         }
01027     }
01028     //-------------------------------------------------------------------------------
01029     //!  end the communication process for the dpmap_edges property
01030     /*!
01031       wait for the end of non-blocking communications
01032       put received values in the dpmap_edges property
01033     */
01034     //-------------------------------------------------------------------------------
01035     void end_communications()
01036     //-------------------------------------------------------------------------------
01037     {
01038       for(int j=0;j<Mpi_::mpi_nb;j++)
01039         {
01040           //end data to send in
01041           unsigned int nb_toSend_in = ddag->getNbEdgesToSendIn(j);
01042           if(nb_toSend_in>0)
01043             comm->Wait_sIn(j);
01044           
01045           //end data to receive out
01046           unsigned int nb_toRecv_out = ddag->getNbEdgesToRecvOut(j);
01047           if(nb_toRecv_out>0)
01048             {
01049               T * toRecv_out = (T*)calloc(nb_toRecv_out,sizeof(T));
01050               comm->Wait_rOut(toRecv_out,j,nb_toRecv_out);
01051               unsigned int * indexes_out = ddag->getEdgesToRecvOut(j);
01052               //change values in data
01053               for(unsigned int k=0;k<nb_toRecv_out;k++)
01054                 {
01055                   //pointer to modify
01056                   T * ptr = data[indexes_out[k]];
01057                   ptr[0] = toRecv_out[k];
01058                 }
01059 
01060               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" received out from proc "<<j<<" = ";
01061               for(unsigned int i=0;i<nb_toRecv_out;i++)
01062                 std::cout<<toRecv_out[i]<<" ";
01063                 std::cout<<std::endl;*/
01064 
01065               free(indexes_out);
01066               free(toRecv_out);
01067             }
01068           //end data to send out
01069           unsigned int nb_toSend_out = ddag->getNbEdgesToSendOut(j);
01070           if(nb_toSend_out>0)
01071             comm->Wait_sOut(j);
01072           
01073           //end data to receive in
01074           unsigned int nb_toRecv_in = ddag->getNbEdgesToRecvIn(j);
01075           if(nb_toRecv_in>0)
01076             {
01077               T * toRecv_in = (T*)calloc(nb_toRecv_in,sizeof(T));
01078               comm->Wait_rIn(toRecv_in,j,nb_toRecv_in);
01079               unsigned int * indexes_in = ddag->getEdgesToRecvIn(j);
01080               //change values in data
01081               for(int k=0;k<nb_toRecv_in;k++)
01082                 {
01083                   //pointer to modify
01084                   T * ptr = data[indexes_in[k]];
01085                   ptr[0] = toRecv_in[k];
01086                 }
01087 
01088               /*std::cout<<"Proc "<<Mpi_::mpi_rank<<" received in from proc "<<j<<" = ";
01089               for(unsigned int i=0;i<nb_toRecv_in;i++)
01090                 std::cout<<toRecv_in[i]<<" ";
01091                 std::cout<<std::endl;*/
01092 
01093               free(indexes_in);
01094               free(toRecv_in);
01095             }
01096         }
01097     }
01098     //-------------------------------------------------------------------------------
01099   };
01100 
01101   //-------------------------------------------------------------------------------
01102   //!  fourth specialization of DPMap_Edges_impl
01103   /*!
01104     \tparam DD is the type of the DDAG
01105     \tparam T is the type of data in the property map
01106     \tapram overlap is the overlap size needed to compute the data
01107     \tparam size is the number of elements at each edge
01108 
01109     The type T is specialized with a specific pointer type in this case as float*, double*, int* etc.
01110     The overlap is specialized to the value 0
01111     The size is not specialized, it is the number of elements in the pointer table to map
01112   */
01113   //-------------------------------------------------------------------------------
01114   template<class DD, class T> struct DPMap_Edges_impl<DD,T*,0>
01115   {
01116   protected :
01117     /*!< ddag is the pointer to the ddag data structure the property is mapped on */
01118     DDAG_impl<DD::nod,DD::edg> * ddag;
01119     /*!< size of the pointer mapped to edges */
01120     unsigned int size;
01121 
01122     //-------------------------------------------------------------------------------
01123     //!  to read input initialize file
01124     /*!
01125       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
01126     */
01127     //-------------------------------------------------------------------------------
01128     void read(const char * file)
01129     //-------------------------------------------------------------------------------
01130     {
01131       std::ifstream entries(file,std::ios::in);
01132       if (!entries){
01133         std::cerr << "Impossible to open the " << file <<"\n";
01134         exit(EXIT_FAILURE);
01135       }
01136 
01137       unsigned int nb_line = 0;
01138       while (!entries.eof()){
01139         //read line
01140         std::string line;
01141         getline (entries, line);
01142         for(unsigned int j=0;j<dim_edge;j++)
01143           {
01144             if(ddag->getIndexEdge(j)==nb_line)
01145               {
01146                 //init data table for this edge
01147                 data[j] = (T*)calloc(size,sizeof(T));
01148                 int found1 = -1;
01149                 int found2 = -1;
01150                 for(unsigned int i=0;i<size;i++)
01151                   {
01152                     found1 = found2+1;
01153                     found2 = line.find(",",found1);
01154                     std::string val = line.substr(found1,found2-found1);
01155                     data[j][i] = atof(val.data());
01156                     //const char * value = line.data();
01157                     //memcpy(&data[j][i], value, sizeof(T));
01158                   }
01159               }
01160           }
01161         nb_line++;
01162       }
01163       entries.close();
01164     }
01165     //-------------------------------------------------------------------------------
01166     //!  init function with values in file
01167     /*!
01168       \param file is the file of intial values for this property on edges (each line is the value of the node "number of this line" associated in the .dot file)
01169     */
01170     //-------------------------------------------------------------------------------
01171     void init(const char * file)
01172     //-------------------------------------------------------------------------------
01173     {
01174       dim_edge = ddag->getDimEdge();
01175       data = (T**)calloc(dim_edge,sizeof(T*));
01176       read(file);
01177     }
01178     //-------------------------------------------------------------------------------
01179     //!  init function with default value
01180     /*!
01181       \param val is the value to intiate edges to
01182     */
01183     //-------------------------------------------------------------------------------
01184     void init(T val)
01185     //-------------------------------------------------------------------------------
01186     {
01187       dim_edge = ddag->getDimEdge();
01188       data = (T**)calloc(dim_edge,sizeof(T*));
01189       for(unsigned int i=0;i<dim_edge;i++)
01190         {
01191           data[i] = (T*)calloc(size,sizeof(T));
01192           for(unsigned int j=0;j<size;j++)
01193             data[i][j] = val;
01194         }
01195       
01196     }
01197     //-------------------------------------------------------------------------------
01198     
01199   public:
01200     /*!< dim_edge is the number of local edges */
01201     unsigned int dim_edge;
01202     /*!< data mapped on edges of the ddag */
01203     T ** data;
01204 
01205     //-------------------------------------------------------------------------------
01206     //!  constructor
01207     /*!
01208       \param dag is the DDAG the property is going to mapped
01209       \param file is the file of intial values for this property on edges (each line is the value of the edge "number of this line" associated in the .dot file)
01210     */
01211     //-------------------------------------------------------------------------------
01212     DPMap_Edges_impl(DD &dag, const char * file, const unsigned int s)
01213     //-------------------------------------------------------------------------------
01214     {
01215       size = s;
01216       ddag = dag.getDDAG_impl();
01217       //construction of data and read the file
01218       init(file);
01219     }
01220     //-------------------------------------------------------------------------------
01221     //!  constructor of DPMap_Edges
01222     /*!
01223       \param dag is the DDAG object associated to this map
01224       \param val is the default value of edges for the map
01225     */
01226     //-------------------------------------------------------------------------------
01227     DPMap_Edges_impl(DD &dag, T val, const unsigned int s)
01228     //-------------------------------------------------------------------------------
01229     {
01230       size = s;
01231       ddag = dag.getDDAG_impl();
01232       //construction of data and fill with val
01233       init(val);
01234     }
01235     //-------------------------------------------------------------------------------
01236     //!  destructor of DPMap_Edges
01237     /*!
01238     */
01239     //-------------------------------------------------------------------------------
01240     ~DPMap_Edges_impl()
01241     //-------------------------------------------------------------------------------
01242     {
01243       for(unsigned int i=0;i<dim_edge;i++)
01244         free(data[i]);
01245       free(data);
01246     }
01247     //-------------------------------------------------------------------------------
01248     //!  to get the begin iterator on edges
01249     /*!
01250       \return the begin iterator on edges
01251     */
01252     //-------------------------------------------------------------------------------
01253     inline iterator_dag begin(){return iterator_dag(0);}
01254     //-------------------------------------------------------------------------------
01255     //!  to get the end iterator on edges
01256     /*!
01257       \return the end iterator on edges
01258     */
01259     //-------------------------------------------------------------------------------
01260     inline iterator_dag end(){return iterator_dag(ddag->getDimEdge());}
01261     //-------------------------------------------------------------------------------
01262     //!  to get an iterator on the source node of the edge
01263     /*!
01264       \return the iterator on the source node
01265     */
01266     //-------------------------------------------------------------------------------
01267     inline iterator_dag getSrcNode(iterator_dag it){return iterator_dag(ddag->getSrcNode(it._rank));}
01268     //-------------------------------------------------------------------------------
01269     //!  to get an iterator on the destination node of the edge
01270     /*!
01271       \return the iterator on the destination node
01272     */
01273     //-------------------------------------------------------------------------------
01274     inline iterator_dag getDstNode(iterator_dag it){return iterator_dag(ddag->getDstNode(it._rank));}
01275     //-------------------------------------------------------------------------------
01276     //!  start the communication process for the dpmap_edges property
01277     /*!
01278       prepare data to send
01279       launch non blocking MPI communications
01280     */
01281     //-------------------------------------------------------------------------------
01282     inline void start_communications(){}
01283     //-------------------------------------------------------------------------------
01284     //!  end the communication process for the dpmap_edges property
01285     /*!
01286       wait for the end of non-blocking communications
01287       put received values in the dpmap_edges property
01288     */
01289     //-------------------------------------------------------------------------------
01290     inline void end_communications(){}
01291     //-------------------------------------------------------------------------------
01292   };
01293   
01294 };
01295 
01296 
01297 #endif
 All Classes Files Functions Variables Defines