SkelGIS  3.0
/home/helene/Documents/These/SkelGIS/SkelGIS_Library/SkelGIS_V3/skelgis/data_structures/DMatrix/dmatrix.hpp
Go to the documentation of this file.
00001 /*! \file dmatrix.hpp
00002  *  \brief Definitions of the object DMatrix used by the user. Four template specializations are available
00003  */
00004 #ifndef DMATRIX_H
00005 #define DMATRIX_H
00006 
00007 #include "dmatrix_impl.hpp"
00008 
00009 namespace skelgis{
00010 
00011   //================================================================================
00012   //! DMatrix class
00013   /*!
00014     template of the distributed matrix of SkelGIS. This is the first specialization of the DMatrix.
00015     \tparam T is the type of data to store in the DMatrix
00016     \tparam R is the overlap distance needed by the calculation, in other words, the size of the physical border needed
00017     \tparam line is the parallel distribution wanted, the default value is true, then the parallel distribution will be divided along height but not along width
00018   */
00019   //-------------------------------------------------------------------------------
00020   template<class T,int R,bool line=true> struct DMatrix
00021   //-------------------------------------------------------------------------------
00022   {
00023   protected:
00024     //! Pointer to DMatrix_impl object
00025     /*!
00026       The pointer to Dmatrix_impl object is the real distributed matrix object. DMatrix class is the user interface to this object.
00027     */
00028     DMatrix_impl<T,R,line> * m;
00029 
00030     //-------------------------------------------------------------------------------
00031     //! Get all neighbor right values for the element to a precise rank
00032     /*!
00033       \param rank is the rank at which the neighbor values are wanted
00034       \return table of neighbor values
00035     */
00036     //-------------------------------------------------------------------------------
00037     T * allRight(unsigned int rank)
00038     //-------------------------------------------------------------------------------
00039     {
00040       T * res = new T[R];
00041       unsigned int r = rank+1;
00042       for(int i=0;i<R;i++)
00043         {
00044           res[i] = m->data[r];
00045           r++;
00046         }
00047       return res;
00048     }
00049     //-------------------------------------------------------------------------------
00050     //! Get all neighbor left values for the element to a precise rank
00051     /*!
00052       \param rank is the rank at which the neighbor values are wanted
00053       \return table of neighbor values
00054     */
00055     //-------------------------------------------------------------------------------
00056     T * allLeft(unsigned int rank)
00057     //-------------------------------------------------------------------------------
00058     {
00059       T * res = new T[R];
00060       unsigned int r = rank-1;
00061       for(int i=0;i<R;i++)
00062         {
00063           res[i] = m->data[r];
00064           r--;
00065         }
00066       return res;
00067     }
00068     //-------------------------------------------------------------------------------
00069     //! Get all neighbor up values for the element to a precise rank
00070     /*!
00071       \param rank is the rank at which the neighbor values are wanted
00072       \return table of neighbor values
00073     */
00074     //-------------------------------------------------------------------------------
00075     T * allUp(unsigned int rank,unsigned int width)
00076     //-------------------------------------------------------------------------------
00077     {
00078       T * res = new T[R];
00079       unsigned int r = rank - width;
00080       for(int i=0;i<R;i++)
00081         {
00082           res[i] = m->data[r];
00083           r = r - width;
00084         }
00085       return res;
00086     }
00087     //-------------------------------------------------------------------------------
00088     //! Get all neighbor down values for the element to a precise rank
00089     /*!
00090       \param rank is the rank at which the neighbor values are wanted
00091       \return table of neighbor values
00092     */
00093     //-------------------------------------------------------------------------------
00094     T * allDown(unsigned int rank,unsigned int width)
00095     //-------------------------------------------------------------------------------
00096     {
00097       T * res = new T[R];
00098       unsigned int r = rank + width;
00099       for(int i=0;i<R;i++)
00100         {
00101           res[i] = m->data[r];
00102           r = r + width;
00103         }
00104       return res;
00105     }
00106     //-------------------------------------------------------------------------------
00107     //! Get all neighbor right down values for the element to a precise rank
00108     /*!
00109       \param rank is the rank at which the neighbor values are wanted
00110       \return table of neighbor values
00111     */
00112     //-------------------------------------------------------------------------------
00113     T * allRightDown(unsigned int rank,unsigned int width)
00114     //-------------------------------------------------------------------------------
00115     {
00116       T * res = new T[R];
00117       unsigned int r = rank + width + 1;
00118       for(int i=0;i<R;i++)
00119         {
00120           res[i] = m->data[r];
00121           r = r + width + 1;
00122         }
00123       return res;
00124     }
00125     //-------------------------------------------------------------------------------
00126     //! Get all neighbor left down values for the element to a precise rank
00127     /*!
00128       \param rank is the rank at which the neighbor values are wanted
00129       \return table of neighbor values
00130     */
00131     //-------------------------------------------------------------------------------
00132     T * allLeftDown(unsigned int rank,unsigned int width)
00133     //-------------------------------------------------------------------------------
00134     {
00135       T * res = new T[R];
00136       unsigned int r = rank + width -1 ;
00137       for(int i=0;i<R;i++)
00138         {
00139           res[i] = m->data[r];
00140           r = r + width -1 ;
00141         }
00142       return res;
00143     }
00144     //-------------------------------------------------------------------------------
00145     //! Get all neighbor right up values for the element to a precise rank
00146     /*!
00147       \param rank is the rank at which the neighbor values are wanted
00148       \return table of neighbor values
00149     */
00150     //-------------------------------------------------------------------------------
00151     T * allRightUp(unsigned int rank,unsigned int width)
00152     //-------------------------------------------------------------------------------
00153     {
00154       T * res = new T[R];
00155       unsigned int r = rank - width + 1;
00156       for(int i=0;i<R;i++)
00157         {
00158           res[i] = m->data[r];
00159           r = r - width + 1;
00160         }
00161       return res;
00162     }
00163     //-------------------------------------------------------------------------------
00164     //! Get all neighbor left up values for the element to a precise rank
00165     /*!
00166       \param rank is the rank at which the neighbor values are wanted
00167       \return table of neighbor values
00168     */
00169     //-------------------------------------------------------------------------------
00170     T * allLeftUp(unsigned int rank,unsigned int width)
00171     //-------------------------------------------------------------------------------
00172     {
00173       T * res = new T[R];
00174       unsigned int r = rank - width - 1;
00175       for(int i=0;i<R;i++)
00176         {
00177           res[i] = m->data[r];
00178           r = r - width - 1;
00179         }
00180       return res;
00181     }
00182     //-------------------------------------------------------------------------------
00183     //! Get the nearest neighbor right value for the element to a precise rank
00184     /*!
00185       \param rank is the rank at which the neighbor value is wanted
00186       \return the neighbor value
00187     */
00188     //-------------------------------------------------------------------------------
00189     T right(unsigned int rank)
00190     //-------------------------------------------------------------------------------
00191     {
00192       unsigned int r = rank + 1;
00193       return m->data[r];
00194     }
00195     //-------------------------------------------------------------------------------
00196     //! Get the nearest neighbor left value for the element to a precise rank
00197     /*!
00198       \param rank is the rank at which the neighbor value is wanted
00199       \return the neighbor value
00200     */
00201     //-------------------------------------------------------------------------------
00202     inline T left(unsigned int rank)
00203     //-------------------------------------------------------------------------------
00204     {
00205       unsigned int r = rank - 1;
00206       return m->data[r];
00207     }
00208     //-------------------------------------------------------------------------------
00209     //! Get the nearest neighbor up value for the element to a precise rank
00210     /*!
00211       \param rank is the rank at which the neighbor value is wanted
00212       \return the neighbor value
00213     */
00214     //-------------------------------------------------------------------------------
00215     inline T up(unsigned int rank,unsigned int width)
00216     //-------------------------------------------------------------------------------
00217     {
00218       unsigned int r = rank - width;
00219       return m->data[r];
00220     }
00221     //-------------------------------------------------------------------------------
00222     //! Get the nearest neighbor down value for the element to a precise rank
00223     /*!
00224       \param rank is the rank at which the neighbor value is wanted
00225       \return the neighbor value
00226     */
00227     //-------------------------------------------------------------------------------
00228     inline T down(unsigned int rank,unsigned int width)
00229     //-------------------------------------------------------------------------------
00230     {
00231       unsigned int r = rank + width;
00232       return m->data[r];
00233     }
00234     //-------------------------------------------------------------------------------
00235     //! Get the nearest neighbor right down value for the element to a precise rank
00236     /*!
00237       \param rank is the rank at which the neighbor value is wanted
00238       \return the neighbor value
00239     */
00240     //-------------------------------------------------------------------------------
00241     inline T rightDown(unsigned int rank,unsigned int width)
00242     //-------------------------------------------------------------------------------
00243     {
00244       unsigned int r = rank + width +1;
00245       return m->data[r];
00246     }
00247     //-------------------------------------------------------------------------------
00248     //! Get the nearest neighbor left down value for the element to a precise rank
00249     /*!
00250       \param rank is the rank at which the neighbor value is wanted
00251       \return the neighbor value
00252     */
00253     //-------------------------------------------------------------------------------
00254     inline T leftDown(unsigned int rank,unsigned int width)
00255     //-------------------------------------------------------------------------------
00256     {
00257       unsigned int r = rank + width -1;
00258       return m->data[r];
00259     }
00260     //-------------------------------------------------------------------------------
00261     //! Get the nearest neighbor right up value for the element to a precise rank
00262     /*!
00263       \param rank is the rank at which the neighbor value is wanted
00264       \return the neighbor value
00265     */
00266     //-------------------------------------------------------------------------------
00267     inline T rightUp(unsigned int rank,unsigned int width)
00268     //-------------------------------------------------------------------------------
00269     {
00270       unsigned int r = rank - width +1;
00271       return m->data[r];
00272     }
00273     //-------------------------------------------------------------------------------
00274     //! Get the nearest neighbor left up value for the element to a precise rank
00275     /*!
00276       \param rank is the rank at which the neighbor value is wanted
00277       \return the neighbor value
00278     */
00279     //-------------------------------------------------------------------------------
00280     inline T leftUp(unsigned int rank,unsigned int width)
00281     //-------------------------------------------------------------------------------
00282     {
00283       unsigned int r = rank - width -1;
00284       return m->data[r];
00285     }
00286     //-------------------------------------------------------------------------------
00287     //! Get all values along X axe for the element to a precise rank
00288     /*!
00289       Equivalent to allLeft and allRight with a single call.
00290       \param rank is the rank at which the neighbor value is wanted
00291       \return a table of all neighbor values along X
00292     */
00293     //-------------------------------------------------------------------------------
00294     T * allX(unsigned int rank)
00295     //-------------------------------------------------------------------------------
00296     {
00297       T * res = new T[R*2];
00298       unsigned int b = rank - R;
00299       for(int i=0;i<R;i++)
00300         {
00301           res[i] = m->data[b];
00302           b++;
00303         }
00304       b++;
00305       for(int i=R;i<2*R;i++)
00306         {
00307           res[i] = m->data[b];
00308           b++;
00309         }
00310       return res;
00311     }
00312     //-------------------------------------------------------------------------------
00313     //! Get all values along X axe for the element to a precise rank
00314     /*!
00315       Equivalent to allLeft and allRight with a single call.
00316       \param rank is the rank at which the neighbor value is wanted
00317       \param result table of all neighbor values along X
00318     */
00319     //-------------------------------------------------------------------------------
00320     void allX(unsigned int rank, T * t)
00321     //-------------------------------------------------------------------------------
00322     {
00323       unsigned int b = rank - R;
00324       for(int i=0;i<R;i++)
00325         {
00326           t[i] = m->data[b];
00327           b++;
00328         }
00329       b++;
00330       for(int i=R;i<2*R;i++)
00331         {
00332           t[i] = m->data[b];
00333           b++;
00334         }
00335     }
00336     //-------------------------------------------------------------------------------
00337     //! Get all values along Y axe for the element to a precise rank
00338     /*!
00339       Equivalent to allDown and allUp with a single call.
00340       \param rank is the rank at which the neighbor value is wanted
00341       \return a table of all neighbor values along X
00342     */
00343     //-------------------------------------------------------------------------------
00344     T * allY(unsigned int rank,unsigned int width)
00345     //-------------------------------------------------------------------------------
00346     {
00347       T * res = new T[R*2];
00348       unsigned int b = rank - R*width;
00349 
00350       for(int i=0;i<R;i++)
00351         {
00352           res[i] = m->data[b];
00353           b = b + width;
00354         }
00355       b = b + width;
00356       for(int i=R;i<2*R;i++)
00357         {
00358           res[i] = m->data[b];
00359           b = b + width;
00360         }
00361       return res;
00362     }
00363     //-------------------------------------------------------------------------------
00364     //! Get all values along Y axe for the element to a precise rank
00365     /*!
00366       Equivalent to allDown and allUp with a single call.
00367       \param rank is the rank at which the neighbor value is wanted
00368       \param result table of all neighbor values along X
00369     */
00370     //-------------------------------------------------------------------------------
00371     void allY(unsigned int rank,unsigned int width, T * t)
00372     //-------------------------------------------------------------------------------
00373     {
00374       unsigned int b = rank - R*width;
00375 
00376       for(int i=0;i<R;i++)
00377         {
00378           t[i] = m->data[b];
00379           b = b + width;
00380         }
00381       b = b + width;
00382       for(int i=R;i<2*R;i++)
00383         {
00384           t[i] = m->data[b];
00385           b = b + width;
00386         }
00387     }
00388     //-------------------------------------------------------------------------------
00389     //! Get all 8 directions neighbor values for the element to a precise rank
00390     /*!
00391       Equivalent to leftUp, up, rightUp, right, rightDown, down, leftDown and left with a single call.
00392       \param rank is the rank at which the neighbor value is wanted
00393       \return a table of all 8 directions neighbor values
00394     */
00395     //-------------------------------------------------------------------------------
00396     T * eight(unsigned int rank,unsigned int width)
00397     //-------------------------------------------------------------------------------
00398     {
00399       T * res = new T[8];
00400       res[0] = leftUp(rank,width);
00401       res[1] = up(rank,width);
00402       res[2] = rightUp(rank,width);
00403       res[3] = right(rank);
00404       res[4] = rightDown(rank,width);
00405       res[5] = down(rank,width);
00406       res[6] = leftDown(rank,width);
00407       res[7] = left(rank);
00408       return res;
00409     }
00410     //-------------------------------------------------------------------------------
00411     //! Get all 4 directions neighbor values for the element to a precise rank
00412     /*!
00413       Equivalent to up, right, down and left with a single call.
00414       \param rank is the rank at which the neighbor value is wanted
00415       \return a table of all 8 directions neighbor values
00416     */
00417     //-------------------------------------------------------------------------------
00418     T * four(unsigned int rank,unsigned int width)
00419     //-------------------------------------------------------------------------------
00420     {
00421       T * res = new T[8];
00422       res[0] = up(rank,width);
00423       res[1] = right(rank);
00424       res[2] = down(rank,width);
00425       res[3] = left(rank);
00426       return res;
00427     }
00428     //-------------------------------------------------------------------------------
00429     //! Get the nearest right neighbor value inside the domain to a precise rank
00430     /*!
00431       This work for every size of R and will always give the nearest right inside-domain value.
00432       \param rank is the rank at which the neighbor value is wanted
00433       \return the neighbor value
00434     */
00435     //-------------------------------------------------------------------------------
00436     inline T inright(unsigned int rank)
00437     //-------------------------------------------------------------------------------
00438     {
00439       unsigned int r = rank + R;
00440       return m->data[r];
00441     }
00442     //-------------------------------------------------------------------------------
00443     //! Get the nearest left neighbor value inside the domain to a precise rank
00444     /*!
00445       This work for every size of R and will always give the nearest left inside-domain value.
00446       \param rank is the rank at which the neighbor value is wanted
00447       \return the neighbor value
00448     */
00449     //-------------------------------------------------------------------------------
00450     inline T inleft(unsigned int rank)
00451     //-------------------------------------------------------------------------------
00452     {
00453       unsigned int r = rank - R;
00454       return m->data[r];
00455     }
00456     //-------------------------------------------------------------------------------
00457     //! Get the nearest up neighbor value inside the domain to a precise rank
00458     /*!
00459       This work for every size of R and will always give the nearest up inside-domain value.
00460       \param rank is the rank at which the neighbor value is wanted
00461       \return the neighbor value
00462     */
00463     //-------------------------------------------------------------------------------
00464     inline T inup(unsigned int rank,unsigned int width)
00465     //-------------------------------------------------------------------------------
00466     {
00467       unsigned int r = rank - R*width;
00468       return m->data[r];
00469     }
00470     //-------------------------------------------------------------------------------
00471     //! Get the nearest down neighbor value inside the domain to a precise rank
00472     /*!
00473       This work for every size of R and will always give the nearest down inside-domain value.
00474       \param rank is the rank at which the neighbor value is wanted
00475       \return the neighbor value
00476     */
00477     //-------------------------------------------------------------------------------
00478     inline T indown(unsigned int rank,unsigned int width)
00479     //-------------------------------------------------------------------------------
00480     {
00481       unsigned int r = rank + R*width;
00482       return m->data[r];
00483     }
00484     //-------------------------------------------------------------------------------
00485 
00486   public:
00487     //! default constructor of the distributed matrix interface
00488     //-------------------------------------------------------------------------------
00489     DMatrix(){}
00490     //-------------------------------------------------------------------------------
00491     //! constructor of the distributed matrix interface from pointer
00492     /*!
00493       This Constructor is used in the user function when a skeleton ApplyList is called.
00494       \param _m is a DMatrix_impl pointer
00495     */
00496     //-------------------------------------------------------------------------------
00497     DMatrix(DMatrix_impl<T,R,line> * _m){m=_m;}
00498     //-------------------------------------------------------------------------------
00499     //! constructor of the distributed matrix interface with another DMatrix
00500     /*!
00501       It is possible to construct a DMatrix instance from another DMatrix instance
00502       \param _m is a DMatrix object
00503     */
00504     //-------------------------------------------------------------------------------
00505     DMatrix(DMatrix<T,R,line>& _m){m=_m.getDMatrix();}
00506     //-------------------------------------------------------------------------------
00507     //! constructor of the distributed matrix interface from a HEADER and a default value
00508     /*!
00509       The HEADER essentially define the size of the DMatrix, while the default value is given to each element of the DMatrix.
00510       \param h is the header to construct the object (see skelgis/util/utility.hpp)
00511       \param value is the default value to put in the matrix
00512       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
00513     */
00514     //-------------------------------------------------------------------------------
00515     DMatrix(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,R,line>(h,value,loc);}
00516     //-------------------------------------------------------------------------------
00517     //! constructor of the distributed matrix interface from a binary file
00518     /*!
00519       A specific binary file format is read by SkelGIS. A Dmatrix instance can be constructed from a binary file.
00520       \param binFile is a binary input file to construct the DMatrix with
00521       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
00522     */
00523     //-------------------------------------------------------------------------------
00524     DMatrix(const char * binFile, bool loc=false){m = new DMatrix_impl<T,R,line>(binFile,loc);}
00525     //-------------------------------------------------------------------------------
00526     //! destructor of the distributed matrix
00527     //-------------------------------------------------------------------------------
00528     ~DMatrix(){}
00529     //-------------------------------------------------------------------------------
00530     //! initialization of the distributed matrix interface from pointer
00531     /*!
00532       The equivalent to the constructor from a pointer
00533       \param _m is a DMatrix_impl object
00534     */
00535     //-------------------------------------------------------------------------------
00536     inline void init(DMatrix_impl<T,R,line> * _m){m=_m;}
00537     //-------------------------------------------------------------------------------
00538     //! initialization of the distributed matrix interface from another DMatrix
00539     /*!
00540       The equivalent to the constructor from another DMatrix
00541       \param _m is a DMatrix object
00542     */
00543     //-------------------------------------------------------------------------------
00544     inline void init(DMatrix<T,R,line>& _m){m=_m.getDMatrix();}
00545     //-------------------------------------------------------------------------------
00546     //! initialization of the distributed matrix interface from a HEADER and a default value
00547     /*!
00548       The equivalent to the constructor from a HEADER and a default value
00549       \param h is the header to construct the object (see skelgis/util/utility.hpp)
00550       \param value is the default value to put in the matrix
00551       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
00552     */
00553     //-------------------------------------------------------------------------------
00554     inline void init(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,R,line>(h,value,loc);}
00555     //-------------------------------------------------------------------------------
00556     //! initialization of the distributed matrix interface from a binary file
00557     /*!
00558       The equivalent to the constructor from a binary file
00559       \param binFile is a binary input file to construct the DMatrix with
00560       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
00561     */
00562     //-------------------------------------------------------------------------------
00563     inline void init(const char * binFile, bool loc=false){m = new DMatrix_impl<T,R,line>(binFile,loc);}
00564     //-------------------------------------------------------------------------------
00565     //! to erase and clear the DMatrix
00566     /*!
00567       The equivalent to the erase of a std::vector in the STL.
00568       The erase will empty the DMatrix and will deallocate the memory space associated.
00569       This has to be done when the DMatrix is not usefull anymore.
00570     */
00571     //-------------------------------------------------------------------------------
00572     inline void erase(){delete m;}
00573     //-------------------------------------------------------------------------------
00574     //! Methods to get the value of the matrix at the iterator it (alternative to [it])
00575     /*!
00576       This method exists for each type of iterator in SkelGIS. This method is const as the value returned could not be modified.
00577       \param it is the iterator position
00578       \return the value at the iterator it
00579     */
00580     //-------------------------------------------------------------------------------
00581     inline T getValue(iterator<T,R> it) const {return m->data[it._rank];}
00582     inline T getValue(iterator_cont<T,R> it) const {return m->data[it._rank];}
00583     inline T getValue(iterator_step<T,R> it) const {return m->data[it._rank];}
00584     inline T getValue(iterator_rev<T,R> it) const {return m->data[it._rank];}
00585     inline T getValue(iterator_phb_left<T,R> it) const {return m->data[it._rank];}
00586     inline T getValue(iterator_phb_right<T,R> it) const {return m->data[it._rank];}
00587     inline T getValue(iterator_phb_up<T,R> it) const {return m->data[it._rank];}
00588     inline T getValue(iterator_phb_down<T,R> it) const {return m->data[it._rank];}
00589     //-------------------------------------------------------------------------------
00590     //! Methods to set the value of the matrix at the iterator it (alternative to [it]=)
00591     /*!
00592       This method exists for each type of iterator in SkelGIS.
00593       \param it is the iterator position
00594       \param value is the value to set
00595     */
00596     //-------------------------------------------------------------------------------
00597     inline void setValue(iterator<T,R> it,T value){m->data[it._rank] = value;}
00598     inline void setValue(iterator_cont<T,R> it,T value){m->data[it._rank] = value;}
00599     inline void setValue(iterator_step<T,R> it,T value){m->data[it._rank] = value;}
00600     inline void setValue(iterator_rev<T,R> it,T value){m->data[it._rank] = value;}
00601     inline void setValue(iterator_phb_left<T,R> it,T value){m->data[it._rank] = value;}
00602     inline void setValue(iterator_phb_right<T,R> it,T value){m->data[it._rank] = value;}
00603     inline void setValue(iterator_phb_up<T,R> it,T value){m->data[it._rank] = value;}
00604     inline void setValue(iterator_phb_down<T,R> it,T value){m->data[it._rank] = value;}
00605     //-------------------------------------------------------------------------------
00606     //! Set value in the middle of the global matrix
00607     /*!
00608       \param val is the value to affect
00609     */
00610     //-------------------------------------------------------------------------------
00611     inline void setGlobalMiddleValue(T val){m->setGlobalMiddleValue(val);}
00612     //-------------------------------------------------------------------------------
00613     //! Set all the values of the physical border of the matrix
00614     /*!
00615       \param val is the value to set
00616     */
00617     //-------------------------------------------------------------------------------
00618     inline void setPhysicalBorder(T val){m->setPhysicalBorder(val);}
00619     //-------------------------------------------------------------------------------
00620     //! Set all the values on the right of physical border of the matrix
00621     /*!
00622       \param val is the value to set
00623     */
00624     //-------------------------------------------------------------------------------
00625     inline void setRightPhysicalBorder(T val){m->setRightPhysicalBorder(val);}
00626     //-------------------------------------------------------------------------------
00627     //! Set all the values on the left of physical border of the matrix
00628     /*!
00629       \param val is the value to set
00630     */
00631     //-------------------------------------------------------------------------------
00632     inline void setLeftPhysicalBorder(T val){m->setLeftPhysicalBorder(val);}
00633     //-------------------------------------------------------------------------------
00634     //! Set all the values on the up of physical border of the matrix
00635     /*!
00636       \param val is the value to set
00637     */
00638     //-------------------------------------------------------------------------------
00639     inline void setUpPhysicalBorder(T val){m->setUpPhysicalBorder(val);}
00640     //-------------------------------------------------------------------------------
00641     //! Set all the values on the down of physical border of the matrix
00642     /*!
00643       \param val is the value to set
00644     */
00645     //-------------------------------------------------------------------------------
00646     inline void setDownPhysicalBorder(T val){m->setDownPhysicalBorder(val);}
00647     //-------------------------------------------------------------------------------
00648     //! Get the beginning iterator of the DMatrix (on the first element of the DMatrix)
00649     /*!
00650       This method exists for each type of iterator in SkelGIS.
00651       \return the iterator of the first element
00652     */
00653     //-------------------------------------------------------------------------------
00654     inline iterator<T,R> begin(){return m->begin();}
00655     inline iterator_cont<T,R> begin_cont(){return m->begin_cont();}
00656     inline iterator_rev<T,R> begin_rev(){return m->begin_rev();}
00657     inline iterator_step<T,R> begin_step(int step,int nb){return m->begin_step(step,nb);}
00658     inline iterator_phb_left<T,R> begin_phb_left(){return m->begin_phb_left();}
00659     inline iterator_phb_right<T,R> begin_phb_right(){return m->begin_phb_right();}
00660     inline iterator_phb_up<T,R> begin_phb_up(){return m->begin_phb_up();}
00661     inline iterator_phb_down<T,R> begin_phb_down(){return m->begin_phb_down();}
00662     inline iterator_line<T,R> begin_line(){return m->begin_line();}
00663     //-------------------------------------------------------------------------------
00664     //! Get the ending iterator of the DMatrix (on the last element of the DMatrix)
00665     /*!
00666       This method exists for each type of iterator in SkelGIS.
00667       \return the iterator of the last element
00668     */
00669     //-------------------------------------------------------------------------------
00670     inline iterator<T,R> end(){return m->end();}
00671     inline iterator_cont<T,R> end_cont(){return m->end_cont();}
00672     inline iterator_rev<T,R> end_rev(){return m->end_rev();}
00673     inline iterator_step<T,R> end_step(){return m->end_step();}
00674     inline iterator_phb_left<T,R> end_phb_left(){return m->end_phb_left();}
00675     inline iterator_phb_right<T,R> end_phb_right(){return m->end_phb_right();}
00676     inline iterator_phb_up<T,R> end_phb_up(){return m->end_phb_up();}
00677     inline iterator_phb_down<T,R> end_phb_down(){return m->end_phb_down();}
00678     inline iterator_line<T,R> end_line(){return m->end_line();}
00679     //-------------------------------------------------------------------------------
00680     //! Operator [] to get and set an element of the matrix at iterator it
00681     /*!
00682       This method exists for each type of iterator in SkelGIS.
00683       \param it is the iterator position
00684       \return the reference to the value at it
00685     */
00686     //-------------------------------------------------------------------------------
00687     inline T& operator[](iterator<T,R> it) { return m->data[it._rank]; }
00688     inline T& operator[](iterator_cont<T,R> it) { return m->data[it._rank]; }
00689     inline T& operator[](iterator_rev<T,R> it) { return m->data[it._rank]; }
00690     inline T& operator[](iterator_step<T,R> it) { return m->data[it._rank]; }
00691     inline T& operator[](iterator_phb_left<T,R> it) { return m->data[it._rank]; }
00692     inline T& operator[](iterator_phb_right<T,R> it) { return m->data[it._rank]; }
00693     inline T& operator[](iterator_phb_up<T,R> it) { return m->data[it._rank]; }
00694     inline T& operator[](iterator_phb_down<T,R> it) { return m->data[it._rank]; }
00695     //-------------------------------------------------------------------------------
00696     //! Operator = to assign the current DMatrix interface object to another one
00697     /*!
00698       \param right is the other DMatrix object
00699       \return the reference to the new current DMatrix object
00700     */
00701     //-------------------------------------------------------------------------------
00702     inline DMatrix<T,R,line>& operator=(DMatrix<T,R,line> & right){m = right.getDMatrix();}
00703     //-------------------------------------------------------------------------------
00704     //! Print the matrix by block
00705     /*!
00706       This method will print the DMatrix by processors in the directory "outputs".
00707      */
00708     //-------------------------------------------------------------------------------
00709     inline void print(){m->print();}
00710     //-------------------------------------------------------------------------------
00711     //! Print all the matrix by block
00712     /*!
00713       This method will print the DMatrix by processors in the directory "outputs". 
00714       It will also print the physical border of the DMatrix and the parallel overlap of the DMatrix.
00715      */
00716     //-------------------------------------------------------------------------------
00717     inline void printAll(){m->printAll();}
00718     //-------------------------------------------------------------------------------
00719     //! Saving in a bin file the distributed matrix interface
00720     /*!
00721       This method writes the DMatrix in a single binary output file.
00722       \param binFile is a binary output file to save the DMatrix in
00723     */
00724     //-------------------------------------------------------------------------------
00725     inline void write(char * binFile){m->write(binFile);}
00726     //-------------------------------------------------------------------------------
00727     //! get borders
00728     /*!
00729       To get the needed parallel overlap from other processors.
00730       MPI exchanges done.
00731     */
00732     //-------------------------------------------------------------------------------
00733     inline void getBorders(){m->getBorders();}
00734     //-------------------------------------------------------------------------------
00735     //-------------------------------------------------------------------------------
00736     //! Get all neighbor right values for the element at iterator it
00737     /*!
00738       The returned table will contain R elements. 
00739       These elements are the R values on the right of the current it.
00740       This method exists for each type of iterator with right values in SkelGIS.
00741       \param it is the iterator position
00742       \return a table of right values
00743     */
00744     //-------------------------------------------------------------------------------
00745     inline T * getAllRight(iterator<T,R> it){return allRight(it._rank);}
00746     inline T * getAllRight(iterator_cont<T,R> it){return allRight(it._rank);}
00747     inline T * getAllRight(iterator_step<T,R> it){return allRight(it._rank);}
00748     inline T * getAllRight(iterator_rev<T,R> it){return allRight(it._rank);}
00749     inline T * getAllRight(iterator_phb_left<T,R> it){return allRight(it._rank);}
00750     //-------------------------------------------------------------------------------
00751     //! Get all neighbor left values for the element at iterator it
00752     /*!
00753       The returned table will contain R elements. 
00754       These elements are the R values on the left of the current it.
00755       This method exists for each type of iterator with left values in SkelGIS.
00756       \param it is the iterator position
00757       \return a table of left values
00758     */
00759     //-------------------------------------------------------------------------------
00760     inline T * getAllLeft(iterator<T,R> it){return allLeft(it._rank);}
00761     inline T * getAllLeft(iterator_cont<T,R> it){return allLeft(it._rank);}
00762     inline T * getAllLeft(iterator_step<T,R> it){return allLeft(it._rank);}
00763     inline T * getAllLeft(iterator_rev<T,R> it){return allLeft(it._rank);}
00764     inline T * getAllLeft(iterator_phb_right<T,R> it){return allLeft(it._rank);}
00765     //-------------------------------------------------------------------------------
00766     //! Get all neighbor up values for the element at iterator it
00767     /*!
00768       The returned table will contain R elements. 
00769       These elements are the R values on the up of the current it.
00770       This method exists for each type of iterator with up values in SkelGIS.
00771       \param it is the iterator position
00772       \return a table of up values
00773     */
00774     //-------------------------------------------------------------------------------
00775     inline T * getAllUp(iterator<T,R> it){return allUp(it._rank,it._width);}
00776     inline T * getAllUp(iterator_cont<T,R> it){return allUp(it._rank,it._width);}
00777     inline T * getAllUp(iterator_step<T,R> it){return allUp(it._rank,it._width);}
00778     inline T * getAllUp(iterator_rev<T,R> it){return allUp(it._rank,it._width);}
00779     inline T * getAllUp(iterator_phb_down<T,R> it){return allUp(it._rank,it._width);}
00780     //-------------------------------------------------------------------------------
00781     //! Get all neighbor down values for the element at iterator it
00782     /*!
00783       The returned table will contain R elements. 
00784       These elements are the R values on the down of the current it.
00785       This method exists for each type of iterator with down values in SkelGIS.
00786       \param it is the iterator position
00787       \return a table of down values
00788     */
00789     //-------------------------------------------------------------------------------
00790     inline T * getAllDown(iterator<T,R> it){return allDown(it._rank,it._width);}
00791     inline T * getAllDown(iterator_cont<T,R> it){return allDown(it._rank,it._width);}
00792     inline T * getAllDown(iterator_step<T,R> it){return allDown(it._rank,it._width);}
00793     inline T * getAllDown(iterator_rev<T,R> it){return allDown(it._rank,it._width);}
00794     inline T * getAllDown(iterator_phb_up<T,R> it){return allDown(it._rank,it._width);}
00795     //-------------------------------------------------------------------------------
00796     //! Get all neighbor right down values for the element at iterator it
00797     /*!
00798       The returned table will contain R elements. 
00799       These elements are the R values on the right down of the current it.
00800       This method exists for each type of iterator with right down values in SkelGIS.
00801       \param it is the iterator position
00802       \return a table of right down values
00803     */
00804     //-------------------------------------------------------------------------------
00805     inline T * getAllRightDown(iterator<T,R> it){return allRightDown(it._rank,it._width);}
00806     inline T * getAllRightDown(iterator_cont<T,R> it){return allRightDown(it._rank,it._width);}
00807     inline T * getAllRightDown(iterator_step<T,R> it){return allRightDown(it._rank,it._width);}
00808     inline T * getAllRightDown(iterator_rev<T,R> it){return allRightDown(it._rank,it._width);}
00809     //-------------------------------------------------------------------------------
00810     //! Get all neighbor left down values for the element at iterator it
00811     /*!
00812       The returned table will contain R elements. 
00813       These elements are the R values on the left down of the current it.
00814       This method exists for each type of iterator with left down values in SkelGIS.
00815       \param it is the iterator position
00816       \return a table of left down values
00817     */
00818     //-------------------------------------------------------------------------------
00819     inline T * getAllLeftDown(iterator<T,R> it){return allLeftDown(it._rank,it._width);}
00820     inline T * getAllLeftDown(iterator_cont<T,R> it){return allLeftDown(it._rank,it._width);}
00821     inline T * getAllLeftDown(iterator_step<T,R> it){return allLeftDown(it._rank,it._width);}
00822     inline T * getAllLeftDown(iterator_rev<T,R> it){return allLeftDown(it._rank,it._width);}
00823     //-------------------------------------------------------------------------------
00824     //! Get all neighbor right up values for the element at iterator it
00825     /*!
00826       The returned table will contain R elements. 
00827       These elements are the R values on the right up of the current it.
00828       This method exists for each type of iterator with right up values in SkelGIS.
00829       \param it is the iterator position
00830       \return a table of right up values
00831     */
00832     //-------------------------------------------------------------------------------
00833     inline T * getAllRightUp(iterator<T,R> it){return allRightUp(it._rank,it._width);}
00834     inline T * getAllRightUp(iterator_cont<T,R> it){return allRightUp(it._rank,it._width);}
00835     inline T * getAllRightUp(iterator_step<T,R> it){return allRightUp(it._rank,it._width);}
00836     inline T * getAllRightUp(iterator_rev<T,R> it){return allRightUp(it._rank,it._width);}
00837     //-------------------------------------------------------------------------------
00838     //! Get all neighbor left up values for the element at iterator it
00839     /*!
00840       The returned table will contain R elements. 
00841       These elements are the R values on the left up of the current it.
00842       This method exists for each type of iterator with left up values in SkelGIS.
00843       \param it is the iterator position
00844       \return a table of left up values
00845     */
00846     //-------------------------------------------------------------------------------
00847     inline T * getAllLeftUp(iterator<T,R> it){return allLeftUp(it._rank,it._width);}
00848     inline T * getAllLeftUp(iterator_cont<T,R> it){return allLeftUp(it._rank,it._width);}
00849     inline T * getAllLeftUp(iterator_step<T,R> it){return allLeftUp(it._rank,it._width);}
00850     inline T * getAllLeftUp(iterator_rev<T,R> it){return allLeftUp(it._rank,it._width);}
00851     //-------------------------------------------------------------------------------
00852     //! Get the nearest right neighbor value for the element at iterator it
00853     /*!
00854       This method exists for each type of iterator with right value in SkelGIS.
00855       \param it is the iterator position
00856       \return the right neighbor element value
00857     */
00858     //-------------------------------------------------------------------------------
00859     inline T getRight(iterator<T,R> it){return right(it._rank);}
00860     inline T getRight(iterator_cont<T,R> it){return right(it._rank);}
00861     inline T getRight(iterator_step<T,R> it){return right(it._rank);}
00862     inline T getRight(iterator_rev<T,R> it){return right(it._rank);}
00863     inline T getRight(iterator_phb_left<T,R> it){return right(it._rank);}
00864     //-------------------------------------------------------------------------------
00865     //! Get the nearest left neighbor value for the element at iterator it
00866     /*!
00867       This method exists for each type of iterator with left value in SkelGIS.
00868       \param it is the iterator position
00869       \return the left neighbor element value
00870     */
00871     //-------------------------------------------------------------------------------
00872     inline T getLeft(iterator<T,R> it){return left(it._rank);}
00873     inline T getLeft(iterator_cont<T,R> it){return left(it._rank);}
00874     inline T getLeft(iterator_step<T,R> it){return left(it._rank);}
00875     inline T getLeft(iterator_rev<T,R> it){return left(it._rank);}
00876     inline T getLeft(iterator_phb_right<T,R> it){return left(it._rank);}
00877     //-------------------------------------------------------------------------------
00878     //! Get the nearest up neighbor value for the element at iterator it
00879     /*!
00880       This method exists for each type of iterator with up value in SkelGIS.
00881       \param it is the iterator position
00882       \return the up neighbor element value
00883     */
00884     //-------------------------------------------------------------------------------
00885     inline T getUp(iterator<T,R> it){return up(it._rank,it._width);}
00886     inline T getUp(iterator_cont<T,R> it){return up(it._rank,it._width);}
00887     inline T getUp(iterator_step<T,R> it){return up(it._rank,it._width);}
00888     inline T getUp(iterator_rev<T,R> it){return up(it._rank,it._width);}
00889     inline T getUp(iterator_phb_down<T,R> it){return up(it._rank,it._width);}
00890     //-------------------------------------------------------------------------------
00891     //! Get the nearest down neighbor value for the element at iterator it
00892     /*!
00893       This method exists for each type of iterator with down value in SkelGIS.
00894       \param it is the iterator position
00895       \return the down neighbor element value
00896     */
00897     //-------------------------------------------------------------------------------
00898     inline T getDown(iterator<T,R> it){return down(it._rank,it._width);}
00899     inline T getDown(iterator_cont<T,R> it){return down(it._rank,it._width);}
00900     inline T getDown(iterator_step<T,R> it){return down(it._rank,it._width);}
00901     inline T getDown(iterator_rev<T,R> it){return down(it._rank,it._width);}
00902     inline T getDown(iterator_phb_up<T,R> it){return down(it._rank,it._width);}
00903     //-------------------------------------------------------------------------------
00904     //! Get the nearest right down neighbor value for the element at iterator it
00905     /*!
00906       This method exists for each type of iterator with right down value in SkelGIS.
00907       \param it is the iterator position
00908       \return the right down neighbor element value
00909     */
00910     //-------------------------------------------------------------------------------
00911     inline T getRightDown(iterator<T,R> it){return rightDown(it._rank,it._width);}
00912     inline T getRightDown(iterator_cont<T,R> it){return rightDown(it._rank,it._width);}
00913     inline T getRightDown(iterator_step<T,R> it){return rightDown(it._rank,it._width);}
00914     inline T getRightDown(iterator_rev<T,R> it){return rightDown(it._rank,it._width);}
00915     //-------------------------------------------------------------------------------
00916     //! Get the nearest left down neighbor value for the element at iterator it
00917     /*!
00918       This method exists for each type of iterator with left down value in SkelGIS.
00919       \param it is the iterator position
00920       \return the left down neighbor element value
00921     */
00922     //-------------------------------------------------------------------------------
00923     inline T getLeftDown(iterator<T,R> it){return leftDown(it._rank,it._width);}
00924     inline T getLeftDown(iterator_cont<T,R> it){return leftDown(it._rank,it._width);}
00925     inline T getLeftDown(iterator_step<T,R> it){return leftDown(it._rank,it._width);}
00926     inline T getLeftDown(iterator_rev<T,R> it){return leftDown(it._rank,it._width);}
00927     //-------------------------------------------------------------------------------
00928     //! Get the nearest right up neighbor value for the element at iterator it
00929     /*!
00930       This method exists for each type of iterator with right up value in SkelGIS.
00931       \param it is the iterator position
00932       \return the right up neighbor element value
00933     */
00934     //-------------------------------------------------------------------------------
00935     inline T getRightUp(iterator<T,R> it){return rightUp(it._rank,it._width);}
00936     inline T getRightUp(iterator_cont<T,R> it){return rightUp(it._rank,it._width);}
00937     inline T getRightUp(iterator_step<T,R> it){return rightUp(it._rank,it._width);}
00938     inline T getRightUp(iterator_rev<T,R> it){return rightUp(it._rank,it._width);}
00939     //-------------------------------------------------------------------------------
00940     //! Get the nearest left up neighbor value for the element at iterator it
00941     /*!
00942       This method exists for each type of iterator with left up value in SkelGIS.
00943       \param it is the iterator position
00944       \return the left up neighbor element value
00945     */
00946     //-------------------------------------------------------------------------------
00947     inline T getLeftUp(iterator<T,R> it){return leftUp(it._rank,it._width);}
00948     inline T getLeftUp(iterator_cont<T,R> it){return leftUp(it._rank,it._width);}
00949     inline T getLeftUp(iterator_step<T,R> it){return leftUp(it._rank,it._width);}
00950     inline T getLeftUp(iterator_rev<T,R> it){return leftUp(it._rank,it._width);}
00951     //-------------------------------------------------------------------------------
00952     //! Get all values along X axe for the element at iterator it
00953     /*!
00954       Equivalent to getAllLeft and getAllRight with a single call.
00955       This method exists for each type of iterator with left and right values in SkelGIS.
00956       \param it is the iterator position
00957       \return a table of all neighbor values along X
00958     */
00959     //-------------------------------------------------------------------------------
00960     inline T * getAllX(iterator<T,R> it){return allX(it._rank);}
00961     inline T * getAllX(iterator_cont<T,R> it){return allX(it._rank);}
00962     inline T * getAllX(iterator_step<T,R> it){return allX(it._rank);}
00963     inline T * getAllX(iterator_rev<T,R> it){return allX(it._rank);}
00964     //-------------------------------------------------------------------------------
00965     //! Get all values along X axe for the element at iterator it
00966     /*!
00967       Equivalent to getAllLeft and getAllRight with a single call.
00968       This method exists for each type of iterator with left and right values in SkelGIS.
00969       \param it is the iterator position
00970       \param result table of all neighbor values along X
00971     */
00972     //-------------------------------------------------------------------------------
00973     inline void getAllX(iterator<T,R> it, T * t){allX(it._rank,t);}
00974     inline void getAllX(iterator_cont<T,R> it, T * t){allX(it._rank,t);}
00975     inline void getAllX(iterator_rev<T,R> it, T * t){allX(it._rank,t);}
00976     inline void getAllX(iterator_step<T,R> it, T * t){allX(it._rank,t);}
00977     //-------------------------------------------------------------------------------
00978     //! Get all values along Y axe for the element at iterator it
00979     /*!
00980       Equivalent to getAllUp and getAllDown with a single call.
00981       This method exists for each type of iterator with left and right values in SkelGIS.
00982       \param it is the iterator position
00983       \return a table of all neighbor values along Y
00984     */
00985     //-------------------------------------------------------------------------------
00986     inline T * getAllY(iterator<T,R> it){return allY(it._rank,it._width);}
00987     inline T * getAllY(iterator_cont<T,R> it){return allY(it._rank,it._width);}
00988     inline T * getAllY(iterator_step<T,R> it){return allY(it._rank,it._width);}
00989     inline T * getAllY(iterator_rev<T,R> it){return allY(it._rank,it._width);}
00990     //-------------------------------------------------------------------------------
00991     //! Get all values along Y axe for the element at iterator it
00992     /*!
00993       Equivalent to getAllUp and getAllDown with a single call.
00994       This method exists for each type of iterator with left and right values in SkelGIS.
00995       \param it is the iterator position
00996       \param result table of all neighbor values along Y
00997     */
00998     //-------------------------------------------------------------------------------
00999     inline void getAllY(iterator<T,R> it, T * t){allY(it._rank,it._width,t);}
01000     inline void getAllY(iterator_cont<T,R> it, T * t){allY(it._rank,it._width,t);}
01001     inline void getAllY(iterator_rev<T,R> it, T * t){allY(it._rank,it._width,t);}
01002     inline void getAllY(iterator_step<T,R> it, T * t){allY(it._rank,it._width,t);}
01003     //-------------------------------------------------------------------------------
01004     //! Get all 8 directions neighbor values for the element at iterator it
01005     /*!
01006       Equivalent to getLeftUp, getUp, getRightUp, getRight, getRightDown, getDown, getLeftDown and getLeft with a single call.
01007       \param it is the iterator position
01008       \return a table of all 8 directions neighbor values
01009     */
01010     //-------------------------------------------------------------------------------
01011     inline T * get8(iterator<T,R> it){return eight(it._rank,it._width);}
01012     inline T * get8(iterator_cont<T,R> it){return eight(it._rank,it._width);}
01013     inline T * get8(iterator_step<T,R> it){return eight(it._rank,it._width);}
01014     inline T * get8(iterator_rev<T,R> it){return eight(it._rank,it._width);}
01015     //-------------------------------------------------------------------------------
01016     //! Get all 4 directions neighbor values for the element at iterator it
01017     /*!
01018       Equivalent to getUp, getRight, getDown and getLeft with a single call.
01019       \param it is the iterator position
01020       \return a table of all 4 directions neighbor values
01021     */
01022     //-------------------------------------------------------------------------------
01023     inline T * get4(iterator<T,R> it){return four(it._rank,it._width);}
01024     inline T * get4(iterator_cont<T,R> it){return four(it._rank,it._width);}
01025      inline T * get4(iterator_step<T,R> it){return four(it._rank,it._width);}
01026     inline T * get4(iterator_rev<T,R> it){return four(it._rank,it._width);}
01027     //-------------------------------------------------------------------------------
01028     //! Get the nearest right neighbor value inside the domain, for physical left border iterators
01029     /*!
01030       This work for every size of R and will always give the nearest right inside-domain value.
01031       \param it is the physical border iterator position
01032       \return the neighbor value
01033     */
01034     //-------------------------------------------------------------------------------
01035     inline T getInRight(iterator_phb_left<T,R> it){return inright(it._rank);}
01036     //-------------------------------------------------------------------------------
01037     //! Get the nearest left neighbor value inside the domain, for physical right border iterators
01038     /*!
01039       This work for every size of R and will always give the nearest left inside-domain value.
01040       \param it is the physical border iterator position
01041       \return the neighbor value
01042     */
01043     //-------------------------------------------------------------------------------
01044     inline T getInLeft(iterator_phb_right<T,R> it){return inleft(it._rank);}
01045     //-------------------------------------------------------------------------------
01046     //! Get the nearest up neighbor value inside the domain, for physical down border iterators
01047     /*!
01048       This work for every size of R and will always give the nearest up inside-domain value.
01049       \param it is the physical border iterator position
01050       \return the neighbor value
01051     */
01052     //-------------------------------------------------------------------------------
01053     inline T getInUp(iterator_phb_down<T,R> it){return inup(it._rank,it._width);}
01054     //-------------------------------------------------------------------------------
01055     //! Get the nearest down neighbor value inside the domain, for physical up border iterators
01056     /*!
01057       This work for every size of R and will always give the nearest down inside-domain value.
01058       \param it is the physical border iterator position
01059       \return the neighbor value
01060     */
01061     //-------------------------------------------------------------------------------
01062     inline T getInDown(iterator_phb_up<T,R> it){return indown(it._rank,it._width);}
01063     //-------------------------------------------------------------------------------
01064     //! Get all neighbor right values for the element at iterator it
01065     /*!
01066       The returned table will contain R elements. 
01067       These elements are the R values on the right of the current it.
01068       This method exists for each type of iterator with right values in SkelGIS.
01069       \param it is the iterator position
01070       \return a table of right values
01071     */
01072     //-------------------------------------------------------------------------------
01073     /*inline T * getAllRight(iterator<T,R> it){return m->getAllRight(it);}
01074     inline T * getAllRight(iterator_cont<T,R> it){return m->getAllRight(it);}
01075     inline T * getAllRight(iterator_rev<T,R> it){return m->getAllRight(it);}
01076     inline T * getAllRight(iterator_step<T,R> it){return m->getAllRight(it);}
01077     inline T * getAllRight(iterator_phb_left<T,R> it){return m->getAllRight(it);}*/
01078     //-------------------------------------------------------------------------------
01079     //! Get all neighbor left values for the element at iterator it
01080     /*!
01081       The returned table will contain R elements. 
01082       These elements are the R values on the left of the current it.
01083       This method exists for each type of iterator with left values in SkelGIS.
01084       \param it is the iterator position
01085       \return a table of left values
01086     */
01087     //-------------------------------------------------------------------------------
01088     /*inline T * getAllLeft(iterator<T,R> it){return m->getAllLeft(it);}
01089     inline T * getAllLeft(iterator_cont<T,R> it){return m->getAllLeft(it);}
01090     inline T * getAllLeft(iterator_rev<T,R> it){return m->getAllLeft(it);}
01091     inline T * getAllLeft(iterator_step<T,R> it){return m->getAllLeft(it);}
01092     inline T * getAllLeft(iterator_phb_right<T,R> it){return m->getAllLeft(it);}*/
01093     //-------------------------------------------------------------------------------
01094     //! Get all neighbor up values for the element at iterator it
01095     /*!
01096       The returned table will contain R elements. 
01097       These elements are the R values on the up of the current it.
01098       This method exists for each type of iterator with up values in SkelGIS.
01099       \param it is the iterator position
01100       \return a table of up values
01101     */
01102     //-------------------------------------------------------------------------------
01103     /*inline T * getAllUp(iterator<T,R> it){return m->getAllUp(it);}
01104     inline T * getAllUp(iterator_cont<T,R> it){return m->getAllUp(it);}
01105     inline T * getAllUp(iterator_rev<T,R> it){return m->getAllUp(it);}
01106     inline T * getAllUp(iterator_step<T,R> it){return m->getAllUp(it);}
01107     inline T * getAllUp(iterator_phb_down<T,R> it){return m->getAllUp(it);}*/
01108     //-------------------------------------------------------------------------------
01109     //! Get all neighbor down values for the element at iterator it
01110     /*!
01111       The returned table will contain R elements. 
01112       These elements are the R values on the down of the current it.
01113       This method exists for each type of iterator with down values in SkelGIS.
01114       \param it is the iterator position
01115       \return a table of down values
01116     */
01117     //-------------------------------------------------------------------------------
01118     /*inline T * getAllDown(iterator<T,R> it){return m->getAllDown(it);}
01119     inline T * getAllDown(iterator_cont<T,R> it){return m->getAllDown(it);}
01120     inline T * getAllDown(iterator_rev<T,R> it){return m->getAllDown(it);}
01121     inline T * getAllDown(iterator_step<T,R> it){return m->getAllDown(it);}
01122     inline T * getAllDown(iterator_phb_up<T,R> it){return m->getAllDown(it);}*/
01123     //-------------------------------------------------------------------------------
01124     //! Get all neighbor right down values for the element at iterator it
01125     /*!
01126       The returned table will contain R elements. 
01127       These elements are the R values on the right down of the current it.
01128       This method exists for each type of iterator with right down values in SkelGIS.
01129       \param it is the iterator position
01130       \return a table of right down values
01131     */
01132     //-------------------------------------------------------------------------------
01133     /*inline T * getAllRightDown(iterator<T,R> it){return m->getAllRightDown(it);}
01134     inline T * getAllRightDown(iterator_cont<T,R> it){return m->getAllRightDown(it);}
01135     inline T * getAllRightDown(iterator_rev<T,R> it){return m->getAllRightDown(it);}
01136     inline T * getAllRightDown(iterator_step<T,R> it){return m->getAllRightDown(it);}*/
01137     //-------------------------------------------------------------------------------
01138     //! Get all neighbor left down values for the element at iterator it
01139     /*!
01140       The returned table will contain R elements. 
01141       These elements are the R values on the left down of the current it.
01142       This method exists for each type of iterator with left down values in SkelGIS.
01143       \param it is the iterator position
01144       \return a table of left down values
01145     */
01146     //-------------------------------------------------------------------------------
01147     /*inline T * getAllLeftDown(iterator<T,R> it){return m->getAllLeftDown(it);}
01148     inline T * getAllLeftDown(iterator_cont<T,R> it){return m->getAllLeftDown(it);}
01149     inline T * getAllLeftDown(iterator_rev<T,R> it){return m->getAllLeftDown(it);}
01150     inline T * getAllLeftDown(iterator_step<T,R> it){return m->getAllLeftDown(it);}*/
01151     //-------------------------------------------------------------------------------
01152     //! Get all neighbor right up values for the element at iterator it
01153     /*!
01154       The returned table will contain R elements. 
01155       These elements are the R values on the right up of the current it.
01156       This method exists for each type of iterator with right up values in SkelGIS.
01157       \param it is the iterator position
01158       \return a table of right up values
01159     */
01160     //-------------------------------------------------------------------------------
01161     /*inline T * getAllRightUp(iterator<T,R> it){return m->getAllRightUp(it);}
01162     inline T * getAllRightUp(iterator_cont<T,R> it){return m->getAllRightUp(it);}
01163     inline T * getAllRightUp(iterator_rev<T,R> it){return m->getAllRightUp(it);}
01164     inline T * getAllRightUp(iterator_step<T,R> it){return m->getAllRightUp(it);}*/
01165     //-------------------------------------------------------------------------------
01166     //! Get all neighbor left up values for the element at iterator it
01167     /*!
01168       The returned table will contain R elements. 
01169       These elements are the R values on the left up of the current it.
01170       This method exists for each type of iterator with left up values in SkelGIS.
01171       \param it is the iterator position
01172       \return a table of left up values
01173     */
01174     //-------------------------------------------------------------------------------
01175     /*inline T * getAllLeftUp(iterator<T,R> it){return m->getAllLeftUp(it);}
01176     inline T * getAllLeftUp(iterator_cont<T,R> it){return m->getAllLeftUp(it);}
01177     inline T * getAllLeftUp(iterator_rev<T,R> it){return m->getAllLeftUp(it);}
01178     inline T * getAllLeftUp(iterator_step<T,R> it){return m->getAllLeftUp(it);}*/
01179     //-------------------------------------------------------------------------------
01180     //! Get the nearest right neighbor value for the element at iterator it
01181     /*!
01182       This method exists for each type of iterator with right value in SkelGIS.
01183       \param it is the iterator position
01184       \return the right neighbor element value
01185     */
01186     //-------------------------------------------------------------------------------
01187     /*inline T getRight(iterator<T,R> it){return m->getRight(it);}
01188     inline T getRight(iterator_cont<T,R> it){return m->getRight(it);}
01189     inline T getRight(iterator_rev<T,R> it){return m->getRight(it);}
01190     inline T getRight(iterator_step<T,R> it){return m->getRight(it);}
01191     inline T getRight(iterator_phb_left<T,R> it){return m->getRight(it);}*/
01192     //-------------------------------------------------------------------------------
01193     //! Get the nearest left neighbor value for the element at iterator it
01194     /*!
01195       This method exists for each type of iterator with left value in SkelGIS.
01196       \param it is the iterator position
01197       \return the left neighbor element value
01198     */
01199     //-------------------------------------------------------------------------------
01200     /*inline T getLeft(iterator<T,R> it){return m->getLeft(it);}
01201     inline T getLeft(iterator_cont<T,R> it){return m->getLeft(it);}
01202     inline T getLeft(iterator_rev<T,R> it){return m->getLeft(it);}
01203     inline T getLeft(iterator_step<T,R> it){return m->getLeft(it);}
01204     inline T getLeft(iterator_phb_right<T,R> it){return m->getLeft(it);}*/
01205     //-------------------------------------------------------------------------------
01206     //! Get the nearest up neighbor value for the element at iterator it
01207     /*!
01208       This method exists for each type of iterator with up value in SkelGIS.
01209       \param it is the iterator position
01210       \return the up neighbor element value
01211     */
01212     //-------------------------------------------------------------------------------
01213     /*inline T getUp(iterator<T,R> it){return m->getUp(it);}
01214     inline T getUp(iterator_cont<T,R> it){return m->getUp(it);}
01215     inline T getUp(iterator_rev<T,R> it){return m->getUp(it);}
01216     inline T getUp(iterator_step<T,R> it){return m->getUp(it);}
01217     inline T getUp(iterator_phb_down<T,R> it){return m->getUp(it);}*/
01218     //-------------------------------------------------------------------------------
01219     //! Get the nearest down neighbor value for the element at iterator it
01220     /*!
01221       This method exists for each type of iterator with down value in SkelGIS.
01222       \param it is the iterator position
01223       \return the down neighbor element value
01224     */
01225     //-------------------------------------------------------------------------------
01226     /*inline T getDown(iterator<T,R> it){return m->getDown(it);}
01227     inline T getDown(iterator_cont<T,R> it){return m->getDown(it);}
01228     inline T getDown(iterator_rev<T,R> it){return m->getDown(it);}
01229     inline T getDown(iterator_step<T,R> it){return m->getDown(it);}
01230     inline T getDown(iterator_phb_up<T,R> it){return m->getDown(it);}*/
01231     //-------------------------------------------------------------------------------
01232     //! Get the nearest right down neighbor value for the element at iterator it
01233     /*!
01234       This method exists for each type of iterator with right down value in SkelGIS.
01235       \param it is the iterator position
01236       \return the right down neighbor element value
01237     */
01238     //-------------------------------------------------------------------------------
01239     /*inline T getRightDown(iterator<T,R> it){return m->getRightDown(it);}
01240     inline T getRightDown(iterator_cont<T,R> it){return m->getRightDown(it);}
01241     inline T getRightDown(iterator_rev<T,R> it){return m->getRightDown(it);}
01242     inline T getRightDown(iterator_step<T,R> it){return m->getRightDown(it);}*/
01243     //-------------------------------------------------------------------------------
01244     //! Get the nearest left down neighbor value for the element at iterator it
01245     /*!
01246       This method exists for each type of iterator with left down value in SkelGIS.
01247       \param it is the iterator position
01248       \return the left down neighbor element value
01249     */
01250     //-------------------------------------------------------------------------------
01251     /*inline T getLeftDown(iterator<T,R> it){return m->getLeftDown(it);}
01252     inline T getLeftDown(iterator_cont<T,R> it){return m->getLeftDown(it);}
01253     inline T getLeftDown(iterator_rev<T,R> it){return m->getLeftDown(it);}
01254     inline T getLeftDown(iterator_step<T,R> it){return m->getLeftDown(it);}*/
01255     //-------------------------------------------------------------------------------
01256     //! Get the nearest right up neighbor value for the element at iterator it
01257     /*!
01258       This method exists for each type of iterator with right up value in SkelGIS.
01259       \param it is the iterator position
01260       \return the right up neighbor element value
01261     */
01262     //-------------------------------------------------------------------------------
01263     /*inline T getRightUp(iterator<T,R> it){return m->getRightUp(it);}
01264     inline T getRightUp(iterator_cont<T,R> it){return m->getRightUp(it);}
01265     inline T getRightUp(iterator_rev<T,R> it){return m->getRightUp(it);}
01266     inline T getRightUp(iterator_step<T,R> it){return m->getRightUp(it);}*/
01267     //-------------------------------------------------------------------------------
01268     //! Get the nearest left up neighbor value for the element at iterator it
01269     /*!
01270       This method exists for each type of iterator with left up value in SkelGIS.
01271       \param it is the iterator position
01272       \return the left up neighbor element value
01273     */
01274     //-------------------------------------------------------------------------------
01275     /*inline T getLeftUp(iterator<T,R> it){return m->getLeftUp(it);}
01276     inline T getLeftUp(iterator_cont<T,R> it){return m->getLeftUp(it);}
01277     inline T getLeftUp(iterator_rev<T,R> it){return m->getLeftUp(it);}
01278     inline T getLeftUp(iterator_step<T,R> it){return m->getLeftUp(it);}*/
01279     //-------------------------------------------------------------------------------
01280     //! Get all values along X axe for the element at iterator it
01281     /*!
01282       Equivalent to getAllLeft and getAllRight with a single call.
01283       This method exists for each type of iterator with left and right values in SkelGIS.
01284       \param it is the iterator position
01285       \return a table of all neighbor values along X
01286     */
01287     //-------------------------------------------------------------------------------
01288     /*inline T * getAllX(iterator<T,R> it){return m->getAllX(it);}
01289     inline T * getAllX(iterator_cont<T,R> it){return m->getAllX(it);}
01290     inline T * getAllX(iterator_rev<T,R> it){return m->getAllX(it);}
01291     inline T * getAllX(iterator_step<T,R> it){return m->getAllX(it);}*/
01292     //-------------------------------------------------------------------------------
01293     //! Get all values along X axe for the element at iterator it
01294     /*!
01295       Equivalent to getAllLeft and getAllRight with a single call.
01296       This method exists for each type of iterator with left and right values in SkelGIS.
01297       \param it is the iterator position
01298       \param result table of all neighbor values along X
01299     */
01300     //-------------------------------------------------------------------------------
01301     /*inline void getAllX(iterator<T,R> it, T * t){return m->getAllX(it,t);}
01302     inline void getAllX(iterator_cont<T,R> it, T * t){return m->getAllX(it,t);}
01303     inline void getAllX(iterator_rev<T,R> it, T * t){return m->getAllX(it,t);}
01304     inline void getAllX(iterator_step<T,R> it, T * t){return m->getAllX(it,t);}*/
01305     //-------------------------------------------------------------------------------
01306     //! Get all values along Y axe for the element at iterator it
01307     /*!
01308       Equivalent to getAllUp and getAllDown with a single call.
01309       This method exists for each type of iterator with left and right values in SkelGIS.
01310       \param it is the iterator position
01311       \return a table of all neighbor values along Y
01312     */
01313     //-------------------------------------------------------------------------------
01314     /*inline T * getAllY(iterator<T,R> it){return m->getAllY(it);}
01315     inline T * getAllY(iterator_cont<T,R> it){return m->getAllY(it);}
01316     inline T * getAllY(iterator_rev<T,R> it){return m->getAllY(it);}
01317     inline T * getAllY(iterator_step<T,R> it){return m->getAllY(it);}*/
01318     //-------------------------------------------------------------------------------
01319     //! Get all values along Y axe for the element at iterator it
01320     /*!
01321       Equivalent to getAllUp and getAllDown with a single call.
01322       This method exists for each type of iterator with left and right values in SkelGIS.
01323       \param it is the iterator position
01324       \param result table of all neighbor values along Y
01325     */
01326     //-------------------------------------------------------------------------------
01327     /*inline void getAllY(iterator<T,R> it, T * t){return m->getAllY(it,t);}
01328     inline void getAllY(iterator_cont<T,R> it, T * t){return m->getAllY(it,t);}
01329     inline void getAllY(iterator_rev<T,R> it, T * t){return m->getAllY(it,t);}
01330     inline void getAllY(iterator_step<T,R> it, T * t){return m->getAllY(it,t);}*/
01331     //-------------------------------------------------------------------------------
01332     //! Get all 8 directions neighbor values for the element at iterator it
01333     /*!
01334       Equivalent to getLeftUp, getUp, getRightUp, getRight, getRightDown, getDown, getLeftDown and getLeft with a single call.
01335       \param it is the iterator position
01336       \return a table of all 8 directions neighbor values
01337     */
01338     //-------------------------------------------------------------------------------
01339     /*inline T * get8(iterator<T,R> it){return m->get8(it);}
01340     inline T * get8(iterator_cont<T,R> it){return m->get8(it);}
01341     inline T * get8(iterator_rev<T,R> it){return m->get8(it);}
01342     inline T * get8(iterator_step<T,R> it){return m->get8(it);}*/
01343     //-------------------------------------------------------------------------------
01344     //! Get all 4 directions neighbor values for the element at iterator it
01345     /*!
01346       Equivalent to getUp, getRight, getDown and getLeft with a single call.
01347       \param it is the iterator position
01348       \return a table of all 4 directions neighbor values
01349     */
01350     //-------------------------------------------------------------------------------
01351     /*inline T * get4(iterator<T,R> it){return m->get4(it);}
01352     inline T * get4(iterator_cont<T,R> it){return m->get4(it);}
01353     inline T * get4(iterator_rev<T,R> it){return m->get4(it);}
01354     inline T * get4(iterator_step<T,R> it){return m->get4(it);}*/
01355     //-------------------------------------------------------------------------------
01356     //! Get the nearest right neighbor value inside the domain, for physical left border iterators
01357     /*!
01358       This work for every size of R and will always give the nearest right inside-domain value.
01359       \param it is the physical border iterator position
01360       \return the neighbor value
01361     */
01362     //-------------------------------------------------------------------------------
01363     //inline T getInRight(iterator_phb_left<T,R> it){return m->getInRight(it);}
01364     //-------------------------------------------------------------------------------
01365     //! Get the nearest left neighbor value inside the domain, for physical right border iterators
01366     /*!
01367       This work for every size of R and will always give the nearest left inside-domain value.
01368       \param it is the physical border iterator position
01369       \return the neighbor value
01370     */
01371     //-------------------------------------------------------------------------------
01372     //inline T getInLeft(iterator_phb_right<T,R> it){return m->getInLeft(it);}
01373     //-------------------------------------------------------------------------------
01374     //! Get the nearest up neighbor value inside the domain, for physical down border iterators
01375     /*!
01376       This work for every size of R and will always give the nearest up inside-domain value.
01377       \param it is the physical border iterator position
01378       \return the neighbor value
01379     */
01380     //-------------------------------------------------------------------------------
01381     //inline T getInUp(iterator_phb_down<T,R> it){return m->getInUp(it);}
01382     //-------------------------------------------------------------------------------
01383     //! Get the nearest down neighbor value inside the domain, for physical up border iterators
01384     /*!
01385       This work for every size of R and will always give the nearest down inside-domain value.
01386       \param it is the physical border iterator position
01387       \return the neighbor value
01388     */
01389     //-------------------------------------------------------------------------------
01390     //inline T getInDown(iterator_phb_up<T,R> it){return m->getInDown(it);}
01391     //-------------------------------------------------------------------------------
01392     //! Get the iterator on the matrix at position (x,y)
01393     /*!
01394       This method exists for the three basic types of iterators.
01395       \param x is row index
01396       \pram y is column index
01397       \return returns the iterator at position (x,y)
01398     */
01399     //-------------------------------------------------------------------------------
01400     inline iterator<T,R> getIterator(int x,int y){return m->getIterator(x,y);}
01401     inline iterator<T,R> getIterator_cont(int x,int y){return m->getIterator_cont(x,y);}
01402     inline iterator<T,R> getIterator_rev(int x,int y){return m->getIterator_rev(x,y);}
01403     //-------------------------------------------------------------------------------
01404     //! Get the indexes of the iterator on the matrix
01405     /*!
01406       This method exists for the three basic types of iterators.
01407       \param it is the iterator from which the indexes will be taken
01408       \param x is the iterator position x returned
01409       \param y is the iterator position y returned
01410     */
01411     //-------------------------------------------------------------------------------
01412     inline void getIndexes(iterator<T,R> it,int &col,int &li){m->getIndexes(it,col,li);}
01413     inline void getIndexes(iterator_cont<T,R> it,int &col,int &li){m->getIndexes(it,col,li);}
01414     inline void getIndexes(iterator_rev<T,R> it,int &col,int &li){m->getIndexes(it,col,li);}
01415     //-------------------------------------------------------------------------------
01416     //! Get the global header of the DMatrix
01417     /*!
01418       \return the global header
01419     */
01420     //-------------------------------------------------------------------------------
01421     inline HEADER getGlobalHeader(){return m->head;}
01422     //-------------------------------------------------------------------------------
01423     //! Get the header of the DMatrix
01424     /*!
01425       \return the header
01426     */
01427     //-------------------------------------------------------------------------------
01428     inline HEADER getHeader(){return m->loc_head;}
01429     //-------------------------------------------------------------------------------
01430     //! Get the border header of the DMatrix
01431     /*!
01432       \return the border header
01433     */
01434     //-------------------------------------------------------------------------------
01435     inline HEADER getBorderHeader(){return m->border_head;}
01436     //-------------------------------------------------------------------------------
01437     //! Get the number of columns in the domain decomposition
01438     /*!
01439       \return the number of columns in the domain decomposition
01440     */
01441     //-------------------------------------------------------------------------------
01442     inline int getCols(){return m->cols;}
01443     //-------------------------------------------------------------------------------
01444     //! Get the number of rows in the domain decomposition
01445     /*!
01446       \return the number of rows in the domain decomposition
01447     */
01448     //-------------------------------------------------------------------------------
01449     inline int getRows(){return m->rows;}
01450     //-------------------------------------------------------------------------------
01451     //! Get the column number of the DMatrix
01452     /*!
01453       \return the column number of the DMatrix
01454     */
01455     //-------------------------------------------------------------------------------
01456     inline int getCol(){return m->col;}
01457     //-------------------------------------------------------------------------------
01458     //! Get the row number of the DMatrix
01459     /*!
01460       \return the row number of the DMatrix
01461     */
01462     //-------------------------------------------------------------------------------
01463     inline int getRow(){return m->row;}
01464     //-------------------------------------------------------------------------------
01465     //! Get the data table of the DMatrix
01466     /*!
01467       \return the data table of the DMatrix
01468     */
01469     //-------------------------------------------------------------------------------
01470     inline T * getData(){return m->data;}
01471     //-------------------------------------------------------------------------------
01472     //! Get the recovery of the DMatrix (=R)
01473     /*!
01474       \return the recovery of the DMatrix
01475     */
01476     //-------------------------------------------------------------------------------
01477     inline int getBorder(){return R;}
01478     //-------------------------------------------------------------------------------
01479     //! Get the DMatrix_impl associated to the DMatrix interface
01480     /*!
01481       \return the DMatrix_impl
01482     */
01483     //-------------------------------------------------------------------------------
01484     inline DMatrix_impl<T,R,line> * getDMatrix(){return m;}
01485     //-------------------------------------------------------------------------------
01486   };
01487 
01488   //================================================================================
01489   //! DMatrix class
01490   /*!
01491     template of the distributed matrix of SkelGIS. This is the second specialization of the DMatrix.
01492     \tparam T is the type of data to store in the DMatrix
01493     R overlap template parameter is not asked and specialized to 0.
01494     The default value of line is used (true).
01495   */
01496   //-------------------------------------------------------------------------------
01497   template<class T> struct DMatrix<T,0>
01498   //-------------------------------------------------------------------------------
01499   {
01500   protected:
01501     //! Pointer to DMatrix_impl object
01502     /*!
01503       The pointer to Dmatrix_impl object is the real distributed matrix object. DMatrix class is the user interface to this object.
01504     */
01505     DMatrix_impl<T,0> * m;
01506 
01507   public:
01508     //! default constructor of the distributed matrix interface
01509     //-------------------------------------------------------------------------------
01510     DMatrix(){}
01511     //-------------------------------------------------------------------------------
01512     //! constructor of the distributed matrix interface from pointer
01513     /*!
01514       This Constructor is used in the user function when a skeleton ApplyList is called.
01515       \param _m is a DMatrix_impl pointer
01516     */
01517     //-------------------------------------------------------------------------------
01518     DMatrix(DMatrix_impl<T,0> * _m){m=_m;}
01519     //-------------------------------------------------------------------------------
01520     //! constructor of the distributed matrix interface with another DMatrix
01521     /*!
01522       It is possible to construct a DMatrix instance from another DMatrix instance
01523       \param _m is a DMatrix object
01524     */
01525     //-------------------------------------------------------------------------------
01526     DMatrix(DMatrix<T,0>& _m){m=_m.getDMatrix();}
01527     //-------------------------------------------------------------------------------
01528     //! constructor of the distributed matrix interface from a HEADER and a default value
01529     /*!
01530       The HEADER essentially define the size of the DMatrix, while the default value is given to each element of the DMatrix.
01531       \param h is the header to construct the object (see skelgis/util/utility.hpp)
01532       \param value is the default value to put in the matrix
01533       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
01534     */
01535     //-------------------------------------------------------------------------------
01536     DMatrix(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,0>(h,value,loc);}
01537     //-------------------------------------------------------------------------------
01538     //! constructor of the distributed matrix interface from a binary file
01539     /*!
01540       A specific binary file format is read by SkelGIS. A Dmatrix instance can be constructed from a binary file.
01541       \param binFile is a binary input file to construct the DMatrix with
01542       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
01543     */
01544     //-------------------------------------------------------------------------------
01545     DMatrix(const char * binFile, bool loc=false){m = new DMatrix_impl<T,0>(binFile,loc);}
01546     //-------------------------------------------------------------------------------
01547     //! destructor of the distributed matrix
01548     //-------------------------------------------------------------------------------
01549     ~DMatrix(){}
01550     //-------------------------------------------------------------------------------
01551     //! initialization of the distributed matrix interface from pointer
01552     /*!
01553       The equivalent to the constructor from a pointer
01554       \param _m is a DMatrix_impl object
01555     */
01556     //-------------------------------------------------------------------------------
01557     inline void init(DMatrix_impl<T,0> * _m){m=_m;}
01558     //-------------------------------------------------------------------------------
01559     //! initialization of the distributed matrix interface from another DMatrix
01560     /*!
01561       The equivalent to the constructor from another DMatrix
01562       \param _m is a DMatrix object
01563     */
01564     //-------------------------------------------------------------------------------
01565     inline void init(DMatrix<T,0>& _m){m=_m.getDMatrix();}
01566     //-------------------------------------------------------------------------------
01567     //! initialization of the distributed matrix interface from a HEADER and a default value
01568     /*!
01569       The equivalent to the constructor from a HEADER and a default value
01570       \param h is the header to construct the object (see skelgis/util/utility.hpp)
01571       \param value is the default value to put in the matrix
01572       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
01573     */
01574     //-------------------------------------------------------------------------------
01575     inline void init(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,0>(h,value,loc);}
01576     //-------------------------------------------------------------------------------
01577     //! initialization of the distributed matrix interface from a binary file
01578     /*!
01579       The equivalent to the constructor from a binary file
01580       \param binFile is a binary input file to construct the DMatrix with
01581       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
01582     */
01583     //-------------------------------------------------------------------------------
01584     inline void init(const char * binFile, bool loc=false){m = new DMatrix_impl<T,0>(binFile,loc);}
01585     //-------------------------------------------------------------------------------
01586     //! to erase and clear the DMatrix
01587     /*!
01588       The equivalent to the erase of a std::vector in the STL.
01589       The erase will empty the DMatrix and will deallocate the memory space associated.
01590       This has to be done when the DMatrix is not usefull anymore.
01591     */
01592     //-------------------------------------------------------------------------------
01593     inline void erase(){delete m;}
01594     //-------------------------------------------------------------------------------
01595     //! Methods to get the value of the matrix at the iterator it (alternative to [it])
01596     /*!
01597       This method exists for each type of iterator in SkelGIS. This method is const as the value returned could not be modified.
01598       \param it is the iterator position
01599       \return the value at the iterator it
01600     */
01601     //-------------------------------------------------------------------------------
01602     inline T getValue(iterator<T,0> it) const {return m->data[it._rank];}
01603     inline T getValue(iterator_cont<T,0> it) const {return m->data[it._rank];}
01604     inline T getValue(iterator_rev<T,0> it) const {return m->data[it._rank];}
01605     inline T getValue(iterator_step<T,0> it) const {return m->data[it._rank];}
01606     //-------------------------------------------------------------------------------
01607     //! Methods to set the value of the matrix at the iterator it (alternative to [it]=)
01608     /*!
01609       This method exists for each type of iterator in SkelGIS.
01610       \param it is the iterator position
01611       \param value is the value to set
01612     */
01613     //-------------------------------------------------------------------------------
01614     inline T setValue(iterator<T,0> it,T value){m->data[it._rank] = value;}
01615     inline T setValue(iterator_cont<T,0> it,T value){m->data[it._rank] = value;}
01616     inline T setValue(iterator_rev<T,0> it,T value){m->data[it._rank] = value;}
01617     inline T setValue(iterator_step<T,0> it,T value){m->data[it._rank] = value;}
01618     //-------------------------------------------------------------------------------
01619     //! Get the beginning iterator of the DMatrix (on the first element of the DMatrix)
01620     /*!
01621       This method exists for each type of iterator in SkelGIS.
01622       \return the iterator of the first element
01623     */
01624     //-------------------------------------------------------------------------------
01625     inline iterator<T,0> begin(){return m->begin();}
01626     inline iterator_cont<T,0> begin_cont(){return m->begin_cont();}
01627     inline iterator_rev<T,0> begin_rev(){return m->begin_rev();}
01628     inline iterator_step<T,0> begin_step(int step,int nb){return m->begin_step(step,nb);}
01629     inline iterator_line<T,0> begin_line(){return m->begin_line();}
01630     //-------------------------------------------------------------------------------
01631     //! Get the ending iterator of the DMatrix (on the last element of the DMatrix)
01632     /*!
01633       This method exists for each type of iterator in SkelGIS.
01634       \return the iterator of the last element
01635     */
01636     //-------------------------------------------------------------------------------
01637     inline iterator<T,0> end(){return m->end();}
01638     inline iterator_cont<T,0> end_cont(){return m->end_cont();}
01639     inline iterator_rev<T,0> end_rev(){return m->end_rev();}
01640     inline iterator_step<T,0> end_step(){return m->end_step();}
01641     inline iterator_line<T,0> end_line(){return m->end_line();}
01642     //-------------------------------------------------------------------------------
01643     //! Operator [] to get and set an element of the matrix at iterator it
01644     /*!
01645       This method exists for each type of iterator in SkelGIS.
01646       \param it is the iterator position
01647       \return the reference to the value at it
01648     */
01649     //-------------------------------------------------------------------------------
01650     inline T& operator[](iterator<T,0> it) { return m->data[it._rank]; }
01651     inline T& operator[](iterator_cont<T,0> it) { return m->data[it._rank]; }
01652     inline T& operator[](iterator_rev<T,0> it) { return m->data[it._rank]; }
01653     inline T& operator[](iterator_step<T,0> it) { return m->data[it._rank]; }
01654     //-------------------------------------------------------------------------------
01655     //! Operator = to assign the current DMatrix interface object to another one
01656     /*!
01657       \param right is the other DMatrix object
01658       \return the reference to the new current DMatrix object
01659     */
01660     //-------------------------------------------------------------------------------
01661     inline DMatrix<T,0,true>& operator=(DMatrix<T,0,true> & right){ m = right.getDMatrix();}
01662     //-------------------------------------------------------------------------------
01663     //! Print the matrix by block
01664     /*!
01665       This method will print the DMatrix by processors in the directory "outputs".
01666      */
01667     //-------------------------------------------------------------------------------
01668     inline void print(){m->print();}
01669     //-------------------------------------------------------------------------------
01670     //! Print all the matrix by block
01671     /*!
01672       This method will print the DMatrix by processors in the directory "outputs". 
01673       It will also print the physical border of the DMatrix and the parallel overlap of the DMatrix.
01674      */
01675     //-------------------------------------------------------------------------------
01676     inline void printAll(){m->printAll();}
01677     //-------------------------------------------------------------------------------
01678     //! Saving in a bin file the distributed matrix interface
01679     /*!
01680       This method writes the DMatrix in a single binary output file.
01681       \param binFile is a binary output file to save the DMatrix in
01682     */
01683     //-------------------------------------------------------------------------------
01684     inline void write(char * binFile){m->write(binFile);}
01685     //-------------------------------------------------------------------------------
01686     //! Get the iterator on the matrix at position (x,y)
01687     /*!
01688       This method exists for the three basic types of iterators.
01689       \param x is row index
01690       \pram y is column index
01691       \return returns the iterator at position (x,y)
01692     */
01693     //-------------------------------------------------------------------------------
01694     inline iterator<T,0> getIterator(int x,int y){return m->getIterator(x,y);}
01695     inline iterator<T,0> getIterator_cont(int x,int y){return m->getIterator_cont(x,y);}
01696     inline iterator<T,0> getIterator_rev(int x,int y){return m->getIterator_rev(x,y);}
01697     //-------------------------------------------------------------------------------
01698     //! Get the indexes of the iterator on the matrix
01699     /*!
01700       This method exists for the three basic types of iterators.
01701       \param it is the iterator from which the indexes will be taken
01702       \param x is the iterator position x returned
01703       \param y is the iterator position y returned
01704     */
01705     //-------------------------------------------------------------------------------
01706     inline void getIndexes(iterator<T,0> it,int &col,int &li){m->getIndexes(it,col,li);}
01707     inline void getIndexes(iterator_cont<T,0> it,int &col,int &li){m->getIndexes(it,col,li);}
01708     inline void getIndexes(iterator_rev<T,0> it,int &col,int &li){m->getIndexes(it,col,li);}
01709     //-------------------------------------------------------------------------------
01710     //-------------------------------------------------------------------------------
01711     //! Get the global header of the DMatrix
01712     /*!
01713       \return the global header
01714     */
01715     //-------------------------------------------------------------------------------
01716     inline HEADER getGlobalHeader(){return m->head;}
01717     //-------------------------------------------------------------------------------
01718     //! Get the header of the DMatrix
01719     /*!
01720       \return the header
01721     */
01722     //-------------------------------------------------------------------------------
01723     inline HEADER getHeader(){return m->loc_head;}
01724     //-------------------------------------------------------------------------------
01725     //! Get the number of columns in the domain decomposition
01726     /*!
01727       \return the number of columns in the domain decomposition
01728     */
01729     //-------------------------------------------------------------------------------
01730     inline int getCols(){return m->cols;}
01731     //-------------------------------------------------------------------------------
01732     //! Get the number of rows in the domain decomposition
01733     /*!
01734       \return the number of rows in the domain decomposition
01735     */
01736     //-------------------------------------------------------------------------------
01737     inline int getRows(){return m->rows;}
01738     //-------------------------------------------------------------------------------
01739     //! Get the column number of the DMatrix
01740     /*!
01741       \return the column number of the DMatrix
01742     */
01743     //-------------------------------------------------------------------------------
01744     inline int getCol(){return m->col;}
01745     //-------------------------------------------------------------------------------
01746     //! Get the row number of the DMatrix
01747     /*!
01748       \return the row number of the DMatrix
01749     */
01750     //-------------------------------------------------------------------------------
01751     inline int getRow(){return m->row;}
01752     //-------------------------------------------------------------------------------
01753     //! Get the data table of the DMatrix
01754     /*!
01755       \return the data table of the DMatrix
01756     */
01757     //-------------------------------------------------------------------------------
01758     inline T * getData(){return m->data;}
01759     //-------------------------------------------------------------------------------
01760     //! Get the DMatrix_impl associated to the DMatrix interface
01761     /*!
01762       \return the DMatrix_impl
01763     */
01764     //-------------------------------------------------------------------------------
01765     inline DMatrix_impl<T,0,true> * getDMatrix(){return m;}
01766     //-------------------------------------------------------------------------------
01767   };
01768 
01769   //================================================================================
01770   //! DMatrix class
01771   /*!
01772     template of the distributed matrix of SkelGIS. This is the third specialization of the DMatrix.
01773     \tparam T is the type of data to store in the DMatrix
01774     \tparam R is the overlap distance needed by the calculation, in other words, the size of the physical border needed
01775     The line template parameter is specialized with the false value. In this case the parallel data distribution will be done along height and width (by block).
01776   */
01777   //-------------------------------------------------------------------------------
01778   template<class T,int R> struct DMatrix<T,R,false>
01779   //-------------------------------------------------------------------------------
01780   {
01781   protected:
01782     //! Pointer to DMatrix_impl object
01783     /*!
01784       The pointer to Dmatrix_impl object is the real distributed matrix object. DMatrix class is the user interface to this object.
01785     */
01786     DMatrix_impl<T,R,false> * m;
01787 
01788     //-------------------------------------------------------------------------------
01789     //! Get all neighbor right values for the element to a precise rank
01790     /*!
01791       \param rank is the rank at which the neighbor values are wanted
01792       \return table of neighbor values
01793     */
01794     //-------------------------------------------------------------------------------
01795     T * allRight(unsigned int rank)
01796     //-------------------------------------------------------------------------------
01797     {
01798       T * res = new T[R];
01799       unsigned int r = rank+1;
01800       for(int i=0;i<R;i++)
01801         {
01802           res[i] = m->data[r];
01803           r++;
01804         }
01805       return res;
01806     }
01807     //-------------------------------------------------------------------------------
01808     //! Get all neighbor left values for the element to a precise rank
01809     /*!
01810       \param rank is the rank at which the neighbor values are wanted
01811       \return table of neighbor values
01812     */
01813     //-------------------------------------------------------------------------------
01814     T * allLeft(unsigned int rank)
01815     //-------------------------------------------------------------------------------
01816     {
01817       T * res = new T[R];
01818       unsigned int r = rank-1;
01819       for(int i=0;i<R;i++)
01820         {
01821           res[i] = m->data[r];
01822           r--;
01823         }
01824       return res;
01825     }
01826     //-------------------------------------------------------------------------------
01827     //! Get all neighbor up values for the element to a precise rank
01828     /*!
01829       \param rank is the rank at which the neighbor values are wanted
01830       \return table of neighbor values
01831     */
01832     //-------------------------------------------------------------------------------
01833     T * allUp(unsigned int rank,unsigned int width)
01834     //-------------------------------------------------------------------------------
01835     {
01836       T * res = new T[R];
01837       unsigned int r = rank - width;
01838       for(int i=0;i<R;i++)
01839         {
01840           res[i] = m->data[r];
01841           r = r - width;
01842         }
01843       return res;
01844     }
01845     //-------------------------------------------------------------------------------
01846     //! Get all neighbor down values for the element to a precise rank
01847     /*!
01848       \param rank is the rank at which the neighbor values are wanted
01849       \return table of neighbor values
01850     */
01851     //-------------------------------------------------------------------------------
01852     T * allDown(unsigned int rank,unsigned int width)
01853     //-------------------------------------------------------------------------------
01854     {
01855       T * res = new T[R];
01856       unsigned int r = rank + width;
01857       for(int i=0;i<R;i++)
01858         {
01859           res[i] = m->data[r];
01860           r = r + width;
01861         }
01862       return res;
01863     }
01864     //-------------------------------------------------------------------------------
01865     //! Get all neighbor right down values for the element to a precise rank
01866     /*!
01867       \param rank is the rank at which the neighbor values are wanted
01868       \return table of neighbor values
01869     */
01870     //-------------------------------------------------------------------------------
01871     T * allRightDown(unsigned int rank,unsigned int width)
01872     //-------------------------------------------------------------------------------
01873     {
01874       T * res = new T[R];
01875       unsigned int r = rank + width + 1;
01876       for(int i=0;i<R;i++)
01877         {
01878           res[i] = m->data[r];
01879           r = r + width + 1;
01880         }
01881       return res;
01882     }
01883     //-------------------------------------------------------------------------------
01884     //! Get all neighbor left down values for the element to a precise rank
01885     /*!
01886       \param rank is the rank at which the neighbor values are wanted
01887       \return table of neighbor values
01888     */
01889     //-------------------------------------------------------------------------------
01890     T * allLeftDown(unsigned int rank,unsigned int width)
01891     //-------------------------------------------------------------------------------
01892     {
01893       T * res = new T[R];
01894       unsigned int r = rank + width -1 ;
01895       for(int i=0;i<R;i++)
01896         {
01897           res[i] = m->data[r];
01898           r = r + width -1 ;
01899         }
01900       return res;
01901     }
01902     //-------------------------------------------------------------------------------
01903     //! Get all neighbor right up values for the element to a precise rank
01904     /*!
01905       \param rank is the rank at which the neighbor values are wanted
01906       \return table of neighbor values
01907     */
01908     //-------------------------------------------------------------------------------
01909     T * allRightUp(unsigned int rank,unsigned int width)
01910     //-------------------------------------------------------------------------------
01911     {
01912       T * res = new T[R];
01913       unsigned int r = rank - width + 1;
01914       for(int i=0;i<R;i++)
01915         {
01916           res[i] = m->data[r];
01917           r = r - width + 1;
01918         }
01919       return res;
01920     }
01921     //-------------------------------------------------------------------------------
01922     //! Get all neighbor left up values for the element to a precise rank
01923     /*!
01924       \param rank is the rank at which the neighbor values are wanted
01925       \return table of neighbor values
01926     */
01927     //-------------------------------------------------------------------------------
01928     T * allLeftUp(unsigned int rank,unsigned int width)
01929     //-------------------------------------------------------------------------------
01930     {
01931       T * res = new T[R];
01932       unsigned int r = rank - width - 1;
01933       for(int i=0;i<R;i++)
01934         {
01935           res[i] = m->data[r];
01936           r = r - width - 1;
01937         }
01938       return res;
01939     }
01940     //-------------------------------------------------------------------------------
01941     //! Get the nearest neighbor right value for the element to a precise rank
01942     /*!
01943       \param rank is the rank at which the neighbor value is wanted
01944       \return the neighbor value
01945     */
01946     //-------------------------------------------------------------------------------
01947     inline T right(unsigned int rank)
01948     //-------------------------------------------------------------------------------
01949     {
01950       unsigned int r = rank + 1;
01951       return m->data[r];
01952     }
01953     //-------------------------------------------------------------------------------
01954     //! Get the nearest neighbor left value for the element to a precise rank
01955     /*!
01956       \param rank is the rank at which the neighbor value is wanted
01957       \return the neighbor value
01958     */
01959     //-------------------------------------------------------------------------------
01960     inline T left(unsigned int rank)
01961     //-------------------------------------------------------------------------------
01962     {
01963       unsigned int r = rank - 1;
01964       return m->data[r];
01965     }
01966     //-------------------------------------------------------------------------------
01967     //! Get the nearest neighbor up value for the element to a precise rank
01968     /*!
01969       \param rank is the rank at which the neighbor value is wanted
01970       \return the neighbor value
01971     */
01972     //-------------------------------------------------------------------------------
01973     inline T up(unsigned int rank,unsigned int width)
01974     //-------------------------------------------------------------------------------
01975     {
01976       unsigned int r = rank - width;
01977       return m->data[r];
01978     }//-------------------------------------------------------------------------------
01979     //! Get the nearest neighbor down value for the element to a precise rank
01980     /*!
01981       \param rank is the rank at which the neighbor value is wanted
01982       \return the neighbor value
01983     */
01984     //-------------------------------------------------------------------------------
01985     inline T down(unsigned int rank,unsigned int width)
01986     //-------------------------------------------------------------------------------
01987     {
01988       unsigned int r = rank + width;
01989       return m->data[r];
01990     }
01991     //-------------------------------------------------------------------------------
01992     //! Get the nearest neighbor right down value for the element to a precise rank
01993     /*!
01994       \param rank is the rank at which the neighbor value is wanted
01995       \return the neighbor value
01996     */
01997     //-------------------------------------------------------------------------------
01998     inline T rightDown(unsigned int rank,unsigned int width)
01999     //-------------------------------------------------------------------------------
02000     {
02001       unsigned int r = rank + width +1;
02002       return m->data[r];
02003     }
02004     //-------------------------------------------------------------------------------
02005     //! Get the nearest neighbor left down value for the element to a precise rank
02006     /*!
02007       \param rank is the rank at which the neighbor value is wanted
02008       \return the neighbor value
02009     */
02010     //-------------------------------------------------------------------------------
02011     inline T leftDown(unsigned int rank,unsigned int width)
02012     //-------------------------------------------------------------------------------
02013     {
02014       unsigned int r = rank + width -1;
02015       return m->data[r];
02016     }
02017     //-------------------------------------------------------------------------------
02018     //! Get the nearest neighbor right up value for the element to a precise rank
02019     /*!
02020       \param rank is the rank at which the neighbor value is wanted
02021       \return the neighbor value
02022     */
02023     //-------------------------------------------------------------------------------
02024     inline T rightUp(unsigned int rank,unsigned int width)
02025     //-------------------------------------------------------------------------------
02026     {
02027       unsigned int r = rank - width +1;
02028       return m->data[r];
02029     }
02030     //-------------------------------------------------------------------------------
02031     //! Get the nearest neighbor left up value for the element to a precise rank
02032     /*!
02033       \param rank is the rank at which the neighbor value is wanted
02034       \return the neighbor value
02035     */
02036     //-------------------------------------------------------------------------------
02037     inline T leftUp(unsigned int rank,unsigned int width)
02038     //-------------------------------------------------------------------------------
02039     {
02040       unsigned int r = rank - width -1;
02041       return m->data[r];
02042     }
02043     //-------------------------------------------------------------------------------
02044     //! Get all values along X axe for the element to a precise rank
02045     /*!
02046       Equivalent to allLeft and allRight with a single call.
02047       \param rank is the rank at which the neighbor value is wanted
02048       \return a table of all neighbor values along X
02049     */
02050     //-------------------------------------------------------------------------------
02051     T * allX(unsigned int rank)
02052     //-------------------------------------------------------------------------------
02053     {
02054       T * res = new T[R*2];
02055       unsigned int b = rank - R;
02056       for(int i=0;i<R;i++)
02057         {
02058           res[i] = m->data[b];
02059           b++;
02060         }
02061       b++;
02062       for(int i=R;i<2*R;i++)
02063         {
02064           res[i] = m->data[b];
02065           b++;
02066         }
02067       return res;
02068     }
02069     //-------------------------------------------------------------------------------
02070     //! Get all values along X axe for the element to a precise rank
02071     /*!
02072       Equivalent to allLeft and allRight with a single call.
02073       \param rank is the rank at which the neighbor value is wanted
02074       \param result table of all neighbor values along X
02075     */
02076     //-------------------------------------------------------------------------------
02077     void allX(unsigned int rank, T * t)
02078     //-------------------------------------------------------------------------------
02079     {
02080       unsigned int b = rank - R;
02081       for(int i=0;i<R;i++)
02082         {
02083           t[i] = m->data[b];
02084           b++;
02085         }
02086       b++;
02087       for(int i=R;i<2*R;i++)
02088         {
02089           t[i] = m->data[b];
02090           b++;
02091         }
02092     }
02093     //-------------------------------------------------------------------------------
02094     //! Get all values along Y axe for the element to a precise rank
02095     /*!
02096       Equivalent to allDown and allUp with a single call.
02097       \param rank is the rank at which the neighbor value is wanted
02098       \return a table of all neighbor values along X
02099     */
02100     //-------------------------------------------------------------------------------
02101     T * allY(unsigned int rank,unsigned int width)
02102     //-------------------------------------------------------------------------------
02103     {
02104       T * res = new T[R*2];
02105       unsigned int b = rank - R*width;
02106 
02107       for(int i=0;i<R;i++)
02108         {
02109           res[i] = m->data[b];
02110           b = b + width;
02111         }
02112       b = b + width;
02113       for(int i=R;i<2*R;i++)
02114         {
02115           res[i] = m->data[b];
02116           b = b + width;
02117         }
02118       return res;
02119     }
02120     //-------------------------------------------------------------------------------
02121     //! Get all values along Y axe for the element to a precise rank
02122     /*!
02123       Equivalent to allDown and allUp with a single call.
02124       \param rank is the rank at which the neighbor value is wanted
02125       \param result table of all neighbor values along X
02126     */
02127     //-------------------------------------------------------------------------------
02128     void allY(unsigned int rank,unsigned int width, T * t)
02129     //-------------------------------------------------------------------------------
02130     {
02131       unsigned int b = rank - R*width;
02132 
02133       for(int i=0;i<R;i++)
02134         {
02135           t[i] = m->data[b];
02136           b = b + width;
02137         }
02138       b = b + width;
02139       for(int i=R;i<2*R;i++)
02140         {
02141           t[i] = m->data[b];
02142           b = b + width;
02143         }
02144     }
02145     //-------------------------------------------------------------------------------
02146     //! Get all 8 directions neighbor values for the element to a precise rank
02147     /*!
02148       Equivalent to leftUp, up, rightUp, right, rightDown, down, leftDown and left with a single call.
02149       \param rank is the rank at which the neighbor value is wanted
02150       \return a table of all 8 directions neighbor values
02151     */
02152     //-------------------------------------------------------------------------------
02153     T * eight(unsigned int rank,unsigned int width)
02154     //-------------------------------------------------------------------------------
02155     {
02156       T * res = new T[8];
02157       res[0] = leftUp(rank,width);
02158       res[1] = up(rank,width);
02159       res[2] = rightUp(rank,width);
02160       res[3] = right(rank);
02161       res[4] = rightDown(rank,width);
02162       res[5] = down(rank,width);
02163       res[6] = leftDown(rank,width);
02164       res[7] = left(rank);
02165       return res;
02166     }
02167     //-------------------------------------------------------------------------------
02168     //! Get all 4 directions neighbor values for the element to a precise rank
02169     /*!
02170       Equivalent to up, right, down and left with a single call.
02171       \param rank is the rank at which the neighbor value is wanted
02172       \return a table of all 8 directions neighbor values
02173     */
02174     //-------------------------------------------------------------------------------
02175     T * four(unsigned int rank,unsigned int width)
02176     //-------------------------------------------------------------------------------
02177     {
02178       T * res = new T[8];
02179       res[0] = up(rank,width);
02180       res[1] = right(rank);
02181       res[2] = down(rank,width);
02182       res[3] = left(rank);
02183       return res;
02184     }
02185     //-------------------------------------------------------------------------------
02186     //! Get the nearest right neighbor value inside the domain to a precise rank
02187     /*!
02188       This work for every size of R and will always give the nearest right inside-domain value.
02189       \param rank is the rank at which the neighbor value is wanted
02190       \return the neighbor value
02191     */
02192     //-------------------------------------------------------------------------------
02193     inline T inright(unsigned int rank)
02194     //-------------------------------------------------------------------------------
02195     {
02196       unsigned int r = rank + R;
02197       return m->data[r];
02198     }
02199     //-------------------------------------------------------------------------------
02200     //! Get the nearest left neighbor value inside the domain to a precise rank
02201     /*!
02202       This work for every size of R and will always give the nearest left inside-domain value.
02203       \param rank is the rank at which the neighbor value is wanted
02204       \return the neighbor value
02205     */
02206     //-------------------------------------------------------------------------------
02207     inline T inleft(unsigned int rank)
02208     //-------------------------------------------------------------------------------
02209     {
02210       unsigned int r = rank - R;
02211       return m->data[r];
02212     }
02213     //-------------------------------------------------------------------------------
02214     //! Get the nearest up neighbor value inside the domain to a precise rank
02215     /*!
02216       This work for every size of R and will always give the nearest up inside-domain value.
02217       \param rank is the rank at which the neighbor value is wanted
02218       \return the neighbor value
02219     */
02220     //-------------------------------------------------------------------------------
02221     inline T inup(unsigned int rank,unsigned int width)
02222     //-------------------------------------------------------------------------------
02223     {
02224       unsigned int r = rank - R*width;
02225       return m->data[r];
02226     }
02227     //-------------------------------------------------------------------------------
02228     //! Get the nearest down neighbor value inside the domain to a precise rank
02229     /*!
02230       This work for every size of R and will always give the nearest down inside-domain value.
02231       \param rank is the rank at which the neighbor value is wanted
02232       \return the neighbor value
02233     */
02234     //-------------------------------------------------------------------------------
02235     inline T indown(unsigned int rank,unsigned int width)
02236     //-------------------------------------------------------------------------------
02237     {
02238       unsigned int r = rank + R*width;
02239       return m->data[r];
02240     }
02241     //-------------------------------------------------------------------------------
02242 
02243   public:
02244     //! default constructor of the distributed matrix interface
02245     //-------------------------------------------------------------------------------
02246     DMatrix(){}
02247     //-------------------------------------------------------------------------------
02248     //! constructor of the distributed matrix interface from pointer
02249     /*!
02250       This Constructor is used in the user function when a skeleton ApplyList is called.
02251       \param _m is a DMatrix_impl pointer
02252     */
02253     //-------------------------------------------------------------------------------
02254     DMatrix(DMatrix_impl<T,R,false> * _m){m=_m;}
02255     //-------------------------------------------------------------------------------
02256     //! constructor of the distributed matrix interface with another DMatrix
02257     /*!
02258       It is possible to construct a DMatrix instance from another DMatrix instance
02259       \param _m is a DMatrix object
02260     */
02261     //-------------------------------------------------------------------------------
02262     DMatrix(DMatrix<T,R,false>& _m){m=_m.getDMatrix();}
02263     //-------------------------------------------------------------------------------
02264     //! constructor of the distributed matrix interface from a HEADER and a default value
02265     /*!
02266       The HEADER essentially define the size of the DMatrix, while the default value is given to each element of the DMatrix.
02267       \param h is the header to construct the object (see skelgis/util/utility.hpp)
02268       \param value is the default value to put in the matrix
02269       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
02270     */
02271     //-------------------------------------------------------------------------------
02272     DMatrix(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,R,false>(h,value,loc);}
02273     //-------------------------------------------------------------------------------
02274     //! constructor of the distributed matrix interface from a binary file
02275     /*!
02276       A specific binary file format is read by SkelGIS. A Dmatrix instance can be constructed from a binary file.
02277       \param binFile is a binary input file to construct the DMatrix with
02278       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
02279     */
02280     //-------------------------------------------------------------------------------
02281     DMatrix(const char * binFile, bool loc=false){m = new DMatrix_impl<T,R,false>(binFile,loc);}
02282     //-------------------------------------------------------------------------------
02283     //! destructor of the distributed matrix
02284     //-------------------------------------------------------------------------------
02285     ~DMatrix(){}
02286     //-------------------------------------------------------------------------------
02287     //! initialization of the distributed matrix interface from pointer
02288     /*!
02289       The equivalent to the constructor from a pointer
02290       \param _m is a DMatrix_impl object
02291     */
02292     //-------------------------------------------------------------------------------
02293     inline void init(DMatrix_impl<T,R,false> * _m){m=_m;}
02294     //-------------------------------------------------------------------------------
02295     //! initialization of the distributed matrix interface from another DMatrix
02296     /*!
02297       The equivalent to the constructor from another DMatrix
02298       \param _m is a DMatrix object
02299     */
02300     //-------------------------------------------------------------------------------
02301     inline void init(DMatrix<T,R,false>& _m){m=_m.getDMatrix();}
02302     //-------------------------------------------------------------------------------
02303     //! initialization of the distributed matrix interface from a HEADER and a default value
02304     /*!
02305       The equivalent to the constructor from a HEADER and a default value
02306       \param h is the header to construct the object (see skelgis/util/utility.hpp)
02307       \param value is the default value to put in the matrix
02308       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
02309     */
02310     //-------------------------------------------------------------------------------
02311     inline void init(HEADER h,const T value, bool loc=false){ m = new DMatrix_impl<T,R,false>(h,value,loc);}
02312     //-------------------------------------------------------------------------------
02313     //! initialization of the distributed matrix interface from a binary file
02314     /*!
02315       The equivalent to the constructor from a binary file
02316       \param binFile is a binary input file to construct the DMatrix with
02317       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
02318     */
02319     //-------------------------------------------------------------------------------
02320     inline void init(const char * binFile, bool loc=false){m = new DMatrix_impl<T,R,false>(binFile,loc);}
02321     //-------------------------------------------------------------------------------
02322     //! to erase and clear the DMatrix
02323     /*!
02324       The equivalent to the erase of a std::vector in the STL.
02325       The erase will empty the DMatrix and will deallocate the memory space associated.
02326       This has to be done when the DMatrix is not usefull anymore.
02327     */
02328     //-------------------------------------------------------------------------------
02329     inline void erase(){delete m;}
02330     //-------------------------------------------------------------------------------
02331     //! Methods to get the value of the matrix at the iterator it (alternative to [it])
02332     /*!
02333       This method exists for each type of iterator in SkelGIS. This method is const as the value returned could not be modified.
02334       \param it is the iterator position
02335       \return the value at the iterator it
02336     */
02337     //-------------------------------------------------------------------------------
02338     inline T getValue(iterator<T,R> it) const {return m->data[it._rank];}
02339     inline T getValue(iterator_cont<T,R> it) const {return m->data[it._rank];}
02340     inline T getValue(iterator_step<T,R> it) const {return m->data[it._rank];}
02341     inline T getValue(iterator_rev<T,R> it) const {return m->data[it._rank];}
02342     inline T getValue(iterator_phb_left<T,R> it) const {return m->data[it._rank];}
02343     inline T getValue(iterator_phb_right<T,R> it) const {return m->data[it._rank];}
02344     inline T getValue(iterator_phb_up<T,R> it) const {return m->data[it._rank];}
02345     inline T getValue(iterator_phb_down<T,R> it) const {return m->data[it._rank];}
02346     //-------------------------------------------------------------------------------
02347     //! Methods to set the value of the matrix at the iterator it (alternative to [it]=)
02348     /*!
02349       This method exists for each type of iterator in SkelGIS.
02350       \param it is the iterator position
02351       \param value is the value to set
02352     */
02353     //-------------------------------------------------------------------------------
02354     inline void setValue(iterator<T,R> it,T value){m->data[it._rank] = value;}
02355     inline void setValue(iterator_cont<T,R> it,T value){m->data[it._rank] = value;}
02356     inline void setValue(iterator_step<T,R> it,T value){m->data[it._rank] = value;}
02357     inline void setValue(iterator_rev<T,R> it,T value){m->data[it._rank] = value;}
02358     inline void setValue(iterator_phb_left<T,R> it,T value){m->data[it._rank] = value;}
02359     inline void setValue(iterator_phb_right<T,R> it,T value){m->data[it._rank] = value;}
02360     inline void setValue(iterator_phb_up<T,R> it,T value){m->data[it._rank] = value;}
02361     inline void setValue(iterator_phb_down<T,R> it,T value){m->data[it._rank] = value;}
02362     //-------------------------------------------------------------------------------
02363     //! Set value in the middle of the global matrix
02364     /*!
02365       \param val is the value to affect
02366     */
02367     //-------------------------------------------------------------------------------
02368     inline void setGlobalMiddleValue(T val){m->setGlobalMiddleValue(val);}
02369     //-------------------------------------------------------------------------------
02370     //! Set all the values of the physical border of the matrix
02371     /*!
02372       \param val is the value to set
02373     */
02374     //-------------------------------------------------------------------------------
02375     inline void setPhysicalBorder(T val){m->setPhysicalBorder(val);}
02376     //-------------------------------------------------------------------------------
02377     //! Set all the values on the right of physical border of the matrix
02378     /*!
02379       \param val is the value to set
02380     */
02381     //-------------------------------------------------------------------------------
02382     inline void setRightPhysicalBorder(T val){m->setRightPhysicalBorder(val);}
02383     //-------------------------------------------------------------------------------
02384     //! Set all the values on the left of physical border of the matrix
02385     /*!
02386       \param val is the value to set
02387     */
02388     //-------------------------------------------------------------------------------
02389     inline void setLeftPhysicalBorder(T val){m->setLeftPhysicalBorder(val);}
02390     //-------------------------------------------------------------------------------
02391     //! Set all the values on the up of physical border of the matrix
02392     /*!
02393       \param val is the value to set
02394     */
02395     //-------------------------------------------------------------------------------
02396     inline void setUpPhysicalBorder(T val){m->setUpPhysicalBorder(val);}
02397     //-------------------------------------------------------------------------------
02398     //! Set all the values on the down of physical border of the matrix
02399     /*!
02400       \param val is the value to set
02401     */
02402     //-------------------------------------------------------------------------------
02403     inline void setDownPhysicalBorder(T val){m->setDownPhysicalBorder(val);}
02404     //-------------------------------------------------------------------------------
02405     //! Get the beginning iterator of the DMatrix (on the first element of the DMatrix)
02406     /*!
02407       This method exists for each type of iterator in SkelGIS.
02408       \return the iterator of the first element
02409     */
02410     //-------------------------------------------------------------------------------
02411     inline iterator<T,R> begin(){return m->begin();}
02412     inline iterator_cont<T,R> begin_cont(){return m->begin_cont();}
02413     inline iterator_rev<T,R> begin_rev(){return m->begin_rev();}
02414     inline iterator_step<T,R> begin_step(int step,int nb){return m->begin_step(step,nb);}
02415     inline iterator_phb_left<T,R> begin_phb_left(){return m->begin_phb_left();}
02416     inline iterator_phb_right<T,R> begin_phb_right(){return m->begin_phb_right();}
02417     inline iterator_phb_up<T,R> begin_phb_up(){return m->begin_phb_up();}
02418     inline iterator_phb_down<T,R> begin_phb_down(){return m->begin_phb_down();}
02419     inline iterator_line<T,R> begin_line(){return m->begin_line();}
02420     //-------------------------------------------------------------------------------
02421     //! Get the ending iterator of the DMatrix (on the last element of the DMatrix)
02422     /*!
02423       This method exists for each type of iterator in SkelGIS.
02424       \return the iterator of the last element
02425     */
02426     //-------------------------------------------------------------------------------
02427     inline iterator<T,R> end(){return m->end();}
02428     inline iterator_cont<T,R> end_cont(){return m->end_cont();}
02429     inline iterator_rev<T,R> end_rev(){return m->end_rev();}
02430     inline iterator_step<T,R> end_step(){return m->end_step();}
02431     inline iterator_phb_left<T,R> end_phb_left(){return m->end_phb_left();}
02432     inline iterator_phb_right<T,R> end_phb_right(){return m->end_phb_right();}
02433     inline iterator_phb_up<T,R> end_phb_up(){return m->end_phb_up();}
02434     inline iterator_phb_down<T,R> end_phb_down(){return m->end_phb_down();}
02435     inline iterator_line<T,R> end_line(){return m->end_line();}
02436     //-------------------------------------------------------------------------------
02437     //! Operator [] to get and set an element of the matrix at iterator it
02438     /*!
02439       This method exists for each type of iterator in SkelGIS.
02440       \param it is the iterator position
02441       \return the reference to the value at it
02442     */
02443     //-------------------------------------------------------------------------------
02444     inline T& operator[](iterator<T,R> it) { return m->data[it._rank]; }
02445     inline T& operator[](iterator_cont<T,R> it) { return m->data[it._rank]; }
02446     inline T& operator[](iterator_rev<T,R> it) { return m->data[it._rank]; }
02447     inline T& operator[](iterator_step<T,R> it) { return m->data[it._rank]; }
02448     inline T& operator[](iterator_phb_left<T,R> it) { return m->data[it._rank]; }
02449     inline T& operator[](iterator_phb_right<T,R> it) { return m->data[it._rank]; }
02450     inline T& operator[](iterator_phb_up<T,R> it) { return m->data[it._rank]; }
02451     inline T& operator[](iterator_phb_down<T,R> it) { return m->data[it._rank]; }
02452     //-------------------------------------------------------------------------------
02453     //! Operator = to assign the current DMatrix interface object to another one
02454     /*!
02455       \param right is the other DMatrix object
02456       \return the reference to the new current DMatrix object
02457     */
02458     //-------------------------------------------------------------------------------
02459     inline DMatrix<T,R,false>& operator=(DMatrix<T,R,false> & right){m = right.getDMatrix();}
02460     //-------------------------------------------------------------------------------
02461     //! Print the matrix by block
02462     /*!
02463       This method will print the DMatrix by processors in the directory "outputs".
02464      */
02465     //-------------------------------------------------------------------------------
02466     inline void print(){m->print();}
02467     //-------------------------------------------------------------------------------
02468     //! Print all the matrix by block
02469     /*!
02470       This method will print the DMatrix by processors in the directory "outputs". 
02471       It will also print the physical border of the DMatrix and the parallel overlap of the DMatrix.
02472      */
02473     //-------------------------------------------------------------------------------
02474     inline void printAll(){m->printAll();}
02475     //-------------------------------------------------------------------------------
02476     //! Saving in a bin file the distributed matrix interface
02477     /*!
02478       This method writes the DMatrix in a single binary output file.
02479       \param binFile is a binary output file to save the DMatrix in
02480     */
02481     //-------------------------------------------------------------------------------
02482     inline void write(char * binFile){m->write(binFile);}
02483     //-------------------------------------------------------------------------------
02484     //! get borders
02485     /*!
02486       To get the needed parallel overlap from other processors.
02487       MPI exchanges done.
02488     */
02489     //-------------------------------------------------------------------------------
02490     inline void getBorders(){m->getBorders();}
02491     //-------------------------------------------------------------------------------
02492     //-------------------------------------------------------------------------------
02493     //! Get all neighbor right values for the element at iterator it
02494     /*!
02495       The returned table will contain R elements. 
02496       These elements are the R values on the right of the current it.
02497       This method exists for each type of iterator with right values in SkelGIS.
02498       \param it is the iterator position
02499       \return a table of right values
02500     */
02501     //-------------------------------------------------------------------------------
02502     inline T * getAllRight(iterator<T,R> it){return allRight(it._rank);}
02503     inline T * getAllRight(iterator_cont<T,R> it){return allRight(it._rank);}
02504     inline T * getAllRight(iterator_step<T,R> it){return allRight(it._rank);}
02505     inline T * getAllRight(iterator_rev<T,R> it){return allRight(it._rank);}
02506     inline T * getAllRight(iterator_phb_left<T,R> it){return allRight(it._rank);}
02507     //-------------------------------------------------------------------------------
02508     //! Get all neighbor left values for the element at iterator it
02509     /*!
02510       The returned table will contain R elements. 
02511       These elements are the R values on the left of the current it.
02512       This method exists for each type of iterator with left values in SkelGIS.
02513       \param it is the iterator position
02514       \return a table of left values
02515     */
02516     //-------------------------------------------------------------------------------
02517     inline T * getAllLeft(iterator<T,R> it){return allLeft(it._rank);}
02518     inline T * getAllLeft(iterator_cont<T,R> it){return allLeft(it._rank);}
02519     inline T * getAllLeft(iterator_step<T,R> it){return allLeft(it._rank);}
02520     inline T * getAllLeft(iterator_rev<T,R> it){return allLeft(it._rank);}
02521     inline T * getAllLeft(iterator_phb_right<T,R> it){return allLeft(it._rank);}
02522     //-------------------------------------------------------------------------------
02523     //! Get all neighbor up values for the element at iterator it
02524     /*!
02525       The returned table will contain R elements. 
02526       These elements are the R values on the up of the current it.
02527       This method exists for each type of iterator with up values in SkelGIS.
02528       \param it is the iterator position
02529       \return a table of up values
02530     */
02531     //-------------------------------------------------------------------------------
02532     inline T * getAllUp(iterator<T,R> it){return allUp(it._rank,it._width);}
02533     inline T * getAllUp(iterator_cont<T,R> it){return allUp(it._rank,it._width);}
02534     inline T * getAllUp(iterator_step<T,R> it){return allUp(it._rank,it._width);}
02535     inline T * getAllUp(iterator_rev<T,R> it){return allUp(it._rank,it._width);}
02536     inline T * getAllUp(iterator_phb_down<T,R> it){return allUp(it._rank,it._width);}
02537     //-------------------------------------------------------------------------------
02538     //! Get all neighbor down values for the element at iterator it
02539     /*!
02540       The returned table will contain R elements. 
02541       These elements are the R values on the down of the current it.
02542       This method exists for each type of iterator with down values in SkelGIS.
02543       \param it is the iterator position
02544       \return a table of down values
02545     */
02546     //-------------------------------------------------------------------------------
02547     inline T * getAllDown(iterator<T,R> it){return allDown(it._rank,it._width);}
02548     inline T * getAllDown(iterator_cont<T,R> it){return allDown(it._rank,it._width);}
02549     inline T * getAllDown(iterator_step<T,R> it){return allDown(it._rank,it._width);}
02550     inline T * getAllDown(iterator_rev<T,R> it){return allDown(it._rank,it._width);}
02551     inline T * getAllDown(iterator_phb_up<T,R> it){return allDown(it._rank,it._width);}
02552     //-------------------------------------------------------------------------------
02553     //! Get all neighbor right down values for the element at iterator it
02554     /*!
02555       The returned table will contain R elements. 
02556       These elements are the R values on the right down of the current it.
02557       This method exists for each type of iterator with right down values in SkelGIS.
02558       \param it is the iterator position
02559       \return a table of right down values
02560     */
02561     //-------------------------------------------------------------------------------
02562     inline T * getAllRightDown(iterator<T,R> it){return allRightDown(it._rank,it._width);}
02563     inline T * getAllRightDown(iterator_cont<T,R> it){return allRightDown(it._rank,it._width);}
02564     inline T * getAllRightDown(iterator_step<T,R> it){return allRightDown(it._rank,it._width);}
02565     inline T * getAllRightDown(iterator_rev<T,R> it){return allRightDown(it._rank,it._width);}
02566     //-------------------------------------------------------------------------------
02567     //! Get all neighbor left down values for the element at iterator it
02568     /*!
02569       The returned table will contain R elements. 
02570       These elements are the R values on the left down of the current it.
02571       This method exists for each type of iterator with left down values in SkelGIS.
02572       \param it is the iterator position
02573       \return a table of left down values
02574     */
02575     //-------------------------------------------------------------------------------
02576     inline T * getAllLeftDown(iterator<T,R> it){return allLeftDown(it._rank,it._width);}
02577     inline T * getAllLeftDown(iterator_cont<T,R> it){return allLeftDown(it._rank,it._width);}
02578     inline T * getAllLeftDown(iterator_step<T,R> it){return allLeftDown(it._rank,it._width);}
02579     inline T * getAllLeftDown(iterator_rev<T,R> it){return allLeftDown(it._rank,it._width);}
02580     //-------------------------------------------------------------------------------
02581     //! Get all neighbor right up values for the element at iterator it
02582     /*!
02583       The returned table will contain R elements. 
02584       These elements are the R values on the right up of the current it.
02585       This method exists for each type of iterator with right up values in SkelGIS.
02586       \param it is the iterator position
02587       \return a table of right up values
02588     */
02589     //-------------------------------------------------------------------------------
02590     inline T * getAllRightUp(iterator<T,R> it){return allRightUp(it._rank,it._width);}
02591     inline T * getAllRightUp(iterator_cont<T,R> it){return allRightUp(it._rank,it._width);}
02592     inline T * getAllRightUp(iterator_step<T,R> it){return allRightUp(it._rank,it._width);}
02593     inline T * getAllRightUp(iterator_rev<T,R> it){return allRightUp(it._rank,it._width);}
02594     //-------------------------------------------------------------------------------
02595     //! Get all neighbor left up values for the element at iterator it
02596     /*!
02597       The returned table will contain R elements. 
02598       These elements are the R values on the left up of the current it.
02599       This method exists for each type of iterator with left up values in SkelGIS.
02600       \param it is the iterator position
02601       \return a table of left up values
02602     */
02603     //-------------------------------------------------------------------------------
02604     inline T * getAllLeftUp(iterator<T,R> it){return allLeftUp(it._rank,it._width);}
02605     inline T * getAllLeftUp(iterator_cont<T,R> it){return allLeftUp(it._rank,it._width);}
02606     inline T * getAllLeftUp(iterator_step<T,R> it){return allLeftUp(it._rank,it._width);}
02607     inline T * getAllLeftUp(iterator_rev<T,R> it){return allLeftUp(it._rank,it._width);}
02608     //-------------------------------------------------------------------------------
02609     //! Get the nearest right neighbor value for the element at iterator it
02610     /*!
02611       This method exists for each type of iterator with right value in SkelGIS.
02612       \param it is the iterator position
02613       \return the right neighbor element value
02614     */
02615     //-------------------------------------------------------------------------------
02616     inline T getRight(iterator<T,R> it){return right(it._rank);}
02617     inline T getRight(iterator_cont<T,R> it){return right(it._rank);}
02618     inline T getRight(iterator_step<T,R> it){return right(it._rank);}
02619     inline T getRight(iterator_rev<T,R> it){return right(it._rank);}
02620     inline T getRight(iterator_phb_left<T,R> it){return right(it._rank);}
02621     //-------------------------------------------------------------------------------
02622     //! Get the nearest left neighbor value for the element at iterator it
02623     /*!
02624       This method exists for each type of iterator with left value in SkelGIS.
02625       \param it is the iterator position
02626       \return the left neighbor element value
02627     */
02628     //-------------------------------------------------------------------------------
02629     inline T getLeft(iterator<T,R> it){return left(it._rank);}
02630     inline T getLeft(iterator_cont<T,R> it){return left(it._rank);}
02631     inline T getLeft(iterator_step<T,R> it){return left(it._rank);}
02632     inline T getLeft(iterator_rev<T,R> it){return left(it._rank);}
02633     inline T getLeft(iterator_phb_right<T,R> it){return left(it._rank);}
02634     //-------------------------------------------------------------------------------
02635     //! Get the nearest up neighbor value for the element at iterator it
02636     /*!
02637       This method exists for each type of iterator with up value in SkelGIS.
02638       \param it is the iterator position
02639       \return the up neighbor element value
02640     */
02641     //-------------------------------------------------------------------------------
02642     inline T getUp(iterator<T,R> it){return up(it._rank,it._width);}
02643     inline T getUp(iterator_cont<T,R> it){return up(it._rank,it._width);}
02644     inline T getUp(iterator_step<T,R> it){return up(it._rank,it._width);}
02645     inline T getUp(iterator_rev<T,R> it){return up(it._rank,it._width);}
02646     inline T getUp(iterator_phb_down<T,R> it){return up(it._rank,it._width);}
02647     //-------------------------------------------------------------------------------
02648     //! Get the nearest down neighbor value for the element at iterator it
02649     /*!
02650       This method exists for each type of iterator with down value in SkelGIS.
02651       \param it is the iterator position
02652       \return the down neighbor element value
02653     */
02654     //-------------------------------------------------------------------------------
02655     inline T getDown(iterator<T,R> it){return down(it._rank,it._width);}
02656     inline T getDown(iterator_cont<T,R> it){return down(it._rank,it._width);}
02657     inline T getDown(iterator_step<T,R> it){return down(it._rank,it._width);}
02658     inline T getDown(iterator_rev<T,R> it){return down(it._rank,it._width);}
02659     inline T getDown(iterator_phb_up<T,R> it){return down(it._rank,it._width);}
02660     //-------------------------------------------------------------------------------
02661     //! Get the nearest right down neighbor value for the element at iterator it
02662     /*!
02663       This method exists for each type of iterator with right down value in SkelGIS.
02664       \param it is the iterator position
02665       \return the right down neighbor element value
02666     */
02667     //-------------------------------------------------------------------------------
02668     inline T getRightDown(iterator<T,R> it){return rightDown(it._rank,it._width);}
02669     inline T getRightDown(iterator_cont<T,R> it){return rightDown(it._rank,it._width);}
02670     inline T getRightDown(iterator_step<T,R> it){return rightDown(it._rank,it._width);}
02671     inline T getRightDown(iterator_rev<T,R> it){return rightDown(it._rank,it._width);}
02672     //-------------------------------------------------------------------------------
02673     //! Get the nearest left down neighbor value for the element at iterator it
02674     /*!
02675       This method exists for each type of iterator with left down value in SkelGIS.
02676       \param it is the iterator position
02677       \return the left down neighbor element value
02678     */
02679     //-------------------------------------------------------------------------------
02680     inline T getLeftDown(iterator<T,R> it){return leftDown(it._rank,it._width);}
02681     inline T getLeftDown(iterator_cont<T,R> it){return leftDown(it._rank,it._width);}
02682     inline T getLeftDown(iterator_step<T,R> it){return leftDown(it._rank,it._width);}
02683     inline T getLeftDown(iterator_rev<T,R> it){return leftDown(it._rank,it._width);}
02684     //-------------------------------------------------------------------------------
02685     //! Get the nearest right up neighbor value for the element at iterator it
02686     /*!
02687       This method exists for each type of iterator with right up value in SkelGIS.
02688       \param it is the iterator position
02689       \return the right up neighbor element value
02690     */
02691     //-------------------------------------------------------------------------------
02692     inline T getRightUp(iterator<T,R> it){return rightUp(it._rank,it._width);}
02693     inline T getRightUp(iterator_cont<T,R> it){return rightUp(it._rank,it._width);}
02694     inline T getRightUp(iterator_step<T,R> it){return rightUp(it._rank,it._width);}
02695     inline T getRightUp(iterator_rev<T,R> it){return rightUp(it._rank,it._width);}
02696     //-------------------------------------------------------------------------------
02697     //! Get the nearest left up neighbor value for the element at iterator it
02698     /*!
02699       This method exists for each type of iterator with left up value in SkelGIS.
02700       \param it is the iterator position
02701       \return the left up neighbor element value
02702     */
02703     //-------------------------------------------------------------------------------
02704     inline T getLeftUp(iterator<T,R> it){return leftUp(it._rank,it._width);}
02705     inline T getLeftUp(iterator_cont<T,R> it){return leftUp(it._rank,it._width);}
02706     inline T getLeftUp(iterator_step<T,R> it){return leftUp(it._rank,it._width);}
02707     inline T getLeftUp(iterator_rev<T,R> it){return leftUp(it._rank,it._width);}
02708     //-------------------------------------------------------------------------------
02709     //! Get all values along X axe for the element at iterator it
02710     /*!
02711       Equivalent to getAllLeft and getAllRight with a single call.
02712       This method exists for each type of iterator with left and right values in SkelGIS.
02713       \param it is the iterator position
02714       \return a table of all neighbor values along X
02715     */
02716     //-------------------------------------------------------------------------------
02717     inline T * getAllX(iterator<T,R> it){return allX(it._rank);}
02718     inline T * getAllX(iterator_cont<T,R> it){return allX(it._rank);}
02719     inline T * getAllX(iterator_step<T,R> it){return allX(it._rank);}
02720     inline T * getAllX(iterator_rev<T,R> it){return allX(it._rank);}
02721     //-------------------------------------------------------------------------------
02722     //! Get all values along X axe for the element at iterator it
02723     /*!
02724       Equivalent to getAllLeft and getAllRight with a single call.
02725       This method exists for each type of iterator with left and right values in SkelGIS.
02726       \param it is the iterator position
02727       \param result table of all neighbor values along X
02728     */
02729     //-------------------------------------------------------------------------------
02730     inline void getAllX(iterator<T,R> it, T * t){allX(it._rank,t);}
02731     inline void getAllX(iterator_cont<T,R> it, T * t){allX(it._rank,t);}
02732     inline void getAllX(iterator_rev<T,R> it, T * t){allX(it._rank,t);}
02733     inline void getAllX(iterator_step<T,R> it, T * t){allX(it._rank,t);}
02734     //-------------------------------------------------------------------------------
02735     //! Get all values along Y axe for the element at iterator it
02736     /*!
02737       Equivalent to getAllUp and getAllDown with a single call.
02738       This method exists for each type of iterator with left and right values in SkelGIS.
02739       \param it is the iterator position
02740       \return a table of all neighbor values along Y
02741     */
02742     //-------------------------------------------------------------------------------
02743     inline T * getAllY(iterator<T,R> it){return allY(it._rank,it._width);}
02744     inline T * getAllY(iterator_cont<T,R> it){return allY(it._rank,it._width);}
02745     inline T * getAllY(iterator_step<T,R> it){return allY(it._rank,it._width);}
02746     inline T * getAllY(iterator_rev<T,R> it){return allY(it._rank,it._width);}
02747     //-------------------------------------------------------------------------------
02748     //! Get all values along Y axe for the element at iterator it
02749     /*!
02750       Equivalent to getAllUp and getAllDown with a single call.
02751       This method exists for each type of iterator with left and right values in SkelGIS.
02752       \param it is the iterator position
02753       \param result table of all neighbor values along Y
02754     */
02755     //-------------------------------------------------------------------------------
02756     inline void getAllY(iterator<T,R> it, T * t){allY(it._rank,it._width,t);}
02757     inline void getAllY(iterator_cont<T,R> it, T * t){allY(it._rank,it._width,t);}
02758     inline void getAllY(iterator_rev<T,R> it, T * t){allY(it._rank,it._width,t);}
02759     inline void getAllY(iterator_step<T,R> it, T * t){allY(it._rank,it._width,t);}
02760     //-------------------------------------------------------------------------------
02761     //! Get all 8 directions neighbor values for the element at iterator it
02762     /*!
02763       Equivalent to getLeftUp, getUp, getRightUp, getRight, getRightDown, getDown, getLeftDown and getLeft with a single call.
02764       \param it is the iterator position
02765       \return a table of all 8 directions neighbor values
02766     */
02767     //-------------------------------------------------------------------------------
02768     inline T * get8(iterator<T,R> it){return eight(it._rank,it._width);}
02769     inline T * get8(iterator_cont<T,R> it){return eight(it._rank,it._width);}
02770     inline T * get8(iterator_step<T,R> it){return eight(it._rank,it._width);}
02771     inline T * get8(iterator_rev<T,R> it){return eight(it._rank,it._width);}
02772     //-------------------------------------------------------------------------------
02773     //! Get all 4 directions neighbor values for the element at iterator it
02774     /*!
02775       Equivalent to getUp, getRight, getDown and getLeft with a single call.
02776       \param it is the iterator position
02777       \return a table of all 4 directions neighbor values
02778     */
02779     //-------------------------------------------------------------------------------
02780     inline T * get4(iterator<T,R> it){return four(it._rank,it._width);}
02781     inline T * get4(iterator_cont<T,R> it){return four(it._rank,it._width);}
02782      inline T * get4(iterator_step<T,R> it){return four(it._rank,it._width);}
02783     inline T * get4(iterator_rev<T,R> it){return four(it._rank,it._width);}
02784     //-------------------------------------------------------------------------------
02785     //! Get the nearest right neighbor value inside the domain, for physical left border iterators
02786     /*!
02787       This work for every size of R and will always give the nearest right inside-domain value.
02788       \param it is the physical border iterator position
02789       \return the neighbor value
02790     */
02791     //-------------------------------------------------------------------------------
02792     inline T getInRight(iterator_phb_left<T,R> it){return inright(it._rank);}
02793     //-------------------------------------------------------------------------------
02794     //! Get the nearest left neighbor value inside the domain, for physical right border iterators
02795     /*!
02796       This work for every size of R and will always give the nearest left inside-domain value.
02797       \param it is the physical border iterator position
02798       \return the neighbor value
02799     */
02800     //-------------------------------------------------------------------------------
02801     inline T getInLeft(iterator_phb_right<T,R> it){return inleft(it._rank);}
02802     //-------------------------------------------------------------------------------
02803     //! Get the nearest up neighbor value inside the domain, for physical down border iterators
02804     /*!
02805       This work for every size of R and will always give the nearest up inside-domain value.
02806       \param it is the physical border iterator position
02807       \return the neighbor value
02808     */
02809     //-------------------------------------------------------------------------------
02810     inline T getInUp(iterator_phb_down<T,R> it){return inup(it._rank,it._width);}
02811     //-------------------------------------------------------------------------------
02812     //! Get the nearest down neighbor value inside the domain, for physical up border iterators
02813     /*!
02814       This work for every size of R and will always give the nearest down inside-domain value.
02815       \param it is the physical border iterator position
02816       \return the neighbor value
02817     */
02818     //-------------------------------------------------------------------------------
02819     inline T getInDown(iterator_phb_up<T,R> it){return indown(it._rank,it._width);}
02820     //-------------------------------------------------------------------------------
02821     //! Get all neighbor right values for the element at iterator it
02822     /*!
02823       The returned table will contain R elements. 
02824       These elements are the R values on the right of the current it.
02825       This method exists for each type of iterator with right values in SkelGIS.
02826       \param it is the iterator position
02827       \return a table of right values
02828     */
02829     //-------------------------------------------------------------------------------
02830     /*inline T * getAllRight(iterator<T,R> it){return m->getAllRight(it);}
02831     inline T * getAllRight(iterator_cont<T,R> it){return m->getAllRight(it);}
02832     inline T * getAllRight(iterator_rev<T,R> it){return m->getAllRight(it);}
02833     inline T * getAllRight(iterator_step<T,R> it){return m->getAllRight(it);}
02834     inline T * getAllRight(iterator_phb_left<T,R> it){return m->getAllRight(it);}*/
02835     //-------------------------------------------------------------------------------
02836     //! Get all neighbor left values for the element at iterator it
02837     /*!
02838       The returned table will contain R elements. 
02839       These elements are the R values on the left of the current it.
02840       This method exists for each type of iterator with left values in SkelGIS.
02841       \param it is the iterator position
02842       \return a table of left values
02843     */
02844     //-------------------------------------------------------------------------------
02845     /*inline T * getAllLeft(iterator<T,R> it){return m->getAllLeft(it);}
02846     inline T * getAllLeft(iterator_cont<T,R> it){return m->getAllLeft(it);}
02847     inline T * getAllLeft(iterator_rev<T,R> it){return m->getAllLeft(it);}
02848     inline T * getAllLeft(iterator_step<T,R> it){return m->getAllLeft(it);}
02849     inline T * getAllLeft(iterator_phb_right<T,R> it){return m->getAllLeft(it);}*/
02850     //-------------------------------------------------------------------------------
02851     //! Get all neighbor up values for the element at iterator it
02852     /*!
02853       The returned table will contain R elements. 
02854       These elements are the R values on the up of the current it.
02855       This method exists for each type of iterator with up values in SkelGIS.
02856       \param it is the iterator position
02857       \return a table of up values
02858     */
02859     //-------------------------------------------------------------------------------
02860     /*inline T * getAllUp(iterator<T,R> it){return m->getAllUp(it);}
02861     inline T * getAllUp(iterator_cont<T,R> it){return m->getAllUp(it);}
02862     inline T * getAllUp(iterator_rev<T,R> it){return m->getAllUp(it);}
02863     inline T * getAllUp(iterator_step<T,R> it){return m->getAllUp(it);}
02864     inline T * getAllUp(iterator_phb_down<T,R> it){return m->getAllUp(it);}*/
02865     //-------------------------------------------------------------------------------
02866     //! Get all neighbor down values for the element at iterator it
02867     /*!
02868       The returned table will contain R elements. 
02869       These elements are the R values on the down of the current it.
02870       This method exists for each type of iterator with down values in SkelGIS.
02871       \param it is the iterator position
02872       \return a table of down values
02873     */
02874     //-------------------------------------------------------------------------------
02875     /*inline T * getAllDown(iterator<T,R> it){return m->getAllDown(it);}
02876     inline T * getAllDown(iterator_cont<T,R> it){return m->getAllDown(it);}
02877     inline T * getAllDown(iterator_rev<T,R> it){return m->getAllDown(it);}
02878     inline T * getAllDown(iterator_step<T,R> it){return m->getAllDown(it);}
02879     inline T * getAllDown(iterator_phb_up<T,R> it){return m->getAllDown(it);}*/
02880     //-------------------------------------------------------------------------------
02881     //! Get all neighbor right down values for the element at iterator it
02882     /*!
02883       The returned table will contain R elements. 
02884       These elements are the R values on the right down of the current it.
02885       This method exists for each type of iterator with right down values in SkelGIS.
02886       \param it is the iterator position
02887       \return a table of right down values
02888     */
02889     //-------------------------------------------------------------------------------
02890     /*inline T * getAllRightDown(iterator<T,R> it){return m->getAllRightDown(it);}
02891     inline T * getAllRightDown(iterator_cont<T,R> it){return m->getAllRightDown(it);}
02892     inline T * getAllRightDown(iterator_rev<T,R> it){return m->getAllRightDown(it);}
02893     inline T * getAllRightDown(iterator_step<T,R> it){return m->getAllRightDown(it);}*/
02894     //-------------------------------------------------------------------------------
02895     //! Get all neighbor left down values for the element at iterator it
02896     /*!
02897       The returned table will contain R elements. 
02898       These elements are the R values on the left down of the current it.
02899       This method exists for each type of iterator with left down values in SkelGIS.
02900       \param it is the iterator position
02901       \return a table of left down values
02902     */
02903     //-------------------------------------------------------------------------------
02904     /*inline T * getAllLeftDown(iterator<T,R> it){return m->getAllLeftDown(it);}
02905     inline T * getAllLeftDown(iterator_cont<T,R> it){return m->getAllLeftDown(it);}
02906     inline T * getAllLeftDown(iterator_rev<T,R> it){return m->getAllLeftDown(it);}
02907     inline T * getAllLeftDown(iterator_step<T,R> it){return m->getAllLeftDown(it);}*/
02908     //-------------------------------------------------------------------------------
02909     //! Get all neighbor right up values for the element at iterator it
02910     /*!
02911       The returned table will contain R elements. 
02912       These elements are the R values on the right up of the current it.
02913       This method exists for each type of iterator with right up values in SkelGIS.
02914       \param it is the iterator position
02915       \return a table of right up values
02916     */
02917     //-------------------------------------------------------------------------------
02918     /*inline T * getAllRightUp(iterator<T,R> it){return m->getAllRightUp(it);}
02919     inline T * getAllRightUp(iterator_cont<T,R> it){return m->getAllRightUp(it);}
02920     inline T * getAllRightUp(iterator_rev<T,R> it){return m->getAllRightUp(it);}
02921     inline T * getAllRightUp(iterator_step<T,R> it){return m->getAllRightUp(it);}*/
02922     //-------------------------------------------------------------------------------
02923     /*!
02924       The returned table will contain R elements. 
02925       These elements are the R values on the left up of the current it.
02926       This method exists for each type of iterator with left up values in SkelGIS.
02927       \param it is the iterator position
02928       \return a table of left up values
02929     */
02930     //-------------------------------------------------------------------------------
02931     /*inline T * getAllLeftUp(iterator<T,R> it){return m->getAllLeftUp(it);}
02932     inline T * getAllLeftUp(iterator_cont<T,R> it){return m->getAllLeftUp(it);}
02933     inline T * getAllLeftUp(iterator_rev<T,R> it){return m->getAllLeftUp(it);}
02934     inline T * getAllLeftUp(iterator_step<T,R> it){return m->getAllLeftUp(it);}*/
02935     //-------------------------------------------------------------------------------
02936     //! Get the nearest right neighbor value for the element at iterator it
02937     /*!
02938       This method exists for each type of iterator with right value in SkelGIS.
02939       \param it is the iterator position
02940       \return the right neighbor element value
02941     */
02942     //-------------------------------------------------------------------------------
02943     /*inline T getRight(iterator<T,R> it){return m->getRight(it);}
02944     inline T getRight(iterator_cont<T,R> it){return m->getRight(it);}
02945     inline T getRight(iterator_rev<T,R> it){return m->getRight(it);}
02946     inline T getRight(iterator_step<T,R> it){return m->getRight(it);}
02947     inline T getRight(iterator_phb_left<T,R> it){return m->getRight(it);}*/
02948     //-------------------------------------------------------------------------------
02949     //! Get the nearest left neighbor value for the element at iterator it
02950     /*!
02951       This method exists for each type of iterator with left value in SkelGIS.
02952       \param it is the iterator position
02953       \return the left neighbor element value
02954     */
02955     //-------------------------------------------------------------------------------
02956     /*inline T getLeft(iterator<T,R> it){return m->getLeft(it);}
02957     inline T getLeft(iterator_cont<T,R> it){return m->getLeft(it);}
02958     inline T getLeft(iterator_rev<T,R> it){return m->getLeft(it);}
02959     inline T getLeft(iterator_step<T,R> it){return m->getLeft(it);}
02960     inline T getLeft(iterator_phb_right<T,R> it){return m->getLeft(it);}*/
02961     //-------------------------------------------------------------------------------
02962     //! Get the nearest up neighbor value for the element at iterator it
02963     /*!
02964       This method exists for each type of iterator with up value in SkelGIS.
02965       \param it is the iterator position
02966       \return the up neighbor element value
02967     */
02968     //-------------------------------------------------------------------------------
02969     /*inline T getUp(iterator<T,R> it){return m->getUp(it);}
02970     inline T getUp(iterator_cont<T,R> it){return m->getUp(it);}
02971     inline T getUp(iterator_rev<T,R> it){return m->getUp(it);}
02972     inline T getUp(iterator_step<T,R> it){return m->getUp(it);}
02973     inline T getUp(iterator_phb_down<T,R> it){return m->getUp(it);}*/
02974     //-------------------------------------------------------------------------------
02975     //! Get the nearest down neighbor value for the element at iterator it
02976     /*!
02977       This method exists for each type of iterator with down value in SkelGIS.
02978       \param it is the iterator position
02979       \return the down neighbor element value
02980     */
02981     //-------------------------------------------------------------------------------
02982     /*inline T getDown(iterator<T,R> it){return m->getDown(it);}
02983     inline T getDown(iterator_cont<T,R> it){return m->getDown(it);}
02984     inline T getDown(iterator_rev<T,R> it){return m->getDown(it);}
02985     inline T getDown(iterator_step<T,R> it){return m->getDown(it);}
02986     inline T getDown(iterator_phb_up<T,R> it){return m->getDown(it);}*/
02987     //-------------------------------------------------------------------------------
02988     //! Get the nearest right down neighbor value for the element at iterator it
02989     /*!
02990       This method exists for each type of iterator with right down value in SkelGIS.
02991       \param it is the iterator position
02992       \return the right down neighbor element value
02993     */
02994     //-------------------------------------------------------------------------------
02995     /*inline T getRightDown(iterator<T,R> it){return m->getRightDown(it);}
02996     inline T getRightDown(iterator_cont<T,R> it){return m->getRightDown(it);}
02997     inline T getRightDown(iterator_rev<T,R> it){return m->getRightDown(it);}
02998     inline T getRightDown(iterator_step<T,R> it){return m->getRightDown(it);}*/
02999     //-------------------------------------------------------------------------------
03000     //! Get the nearest left down neighbor value for the element at iterator it
03001     /*!
03002       This method exists for each type of iterator with left down value in SkelGIS.
03003       \param it is the iterator position
03004       \return the left down neighbor element value
03005     */
03006     //-------------------------------------------------------------------------------
03007     /*inline T getLeftDown(iterator<T,R> it){return m->getLeftDown(it);}
03008     inline T getLeftDown(iterator_cont<T,R> it){return m->getLeftDown(it);}
03009     inline T getLeftDown(iterator_rev<T,R> it){return m->getLeftDown(it);}
03010     inline T getLeftDown(iterator_step<T,R> it){return m->getLeftDown(it);}*/
03011     //-------------------------------------------------------------------------------
03012     //! Get the nearest right up neighbor value for the element at iterator it
03013     /*!
03014       This method exists for each type of iterator with right up value in SkelGIS.
03015       \param it is the iterator position
03016       \return the right up neighbor element value
03017     */
03018     //-------------------------------------------------------------------------------
03019     /*inline T getRightUp(iterator<T,R> it){return m->getRightUp(it);}
03020     inline T getRightUp(iterator_cont<T,R> it){return m->getRightUp(it);}
03021     inline T getRightUp(iterator_rev<T,R> it){return m->getRightUp(it);}
03022     inline T getRightUp(iterator_step<T,R> it){return m->getRightUp(it);}*/
03023     //-------------------------------------------------------------------------------
03024     //! Get the nearest left up neighbor value for the element at iterator it
03025     /*!
03026       This method exists for each type of iterator with left up value in SkelGIS.
03027       \param it is the iterator position
03028       \return the left up neighbor element value
03029     */
03030     //-------------------------------------------------------------------------------
03031     /*inline T getLeftUp(iterator<T,R> it){return m->getLeftUp(it);}
03032     inline T getLeftUp(iterator_cont<T,R> it){return m->getLeftUp(it);}
03033     inline T getLeftUp(iterator_rev<T,R> it){return m->getLeftUp(it);}
03034     inline T getLeftUp(iterator_step<T,R> it){return m->getLeftUp(it);}*/
03035     //-------------------------------------------------------------------------------
03036     //! Get all values along X axe for the element at iterator it
03037     /*!
03038       Equivalent to getAllLeft and getAllRight with a single call.
03039       This method exists for each type of iterator with left and right values in SkelGIS.
03040       \param it is the iterator position
03041       \return a table of all neighbor values along X
03042     */
03043     //-------------------------------------------------------------------------------
03044     /*inline T * getAllX(iterator<T,R> it){return m->getAllX(it);}
03045     inline T * getAllX(iterator_cont<T,R> it){return m->getAllX(it);}
03046     inline T * getAllX(iterator_rev<T,R> it){return m->getAllX(it);}
03047     inline T * getAllX(iterator_step<T,R> it){return m->getAllX(it);}*/
03048     //-------------------------------------------------------------------------------
03049     //! Get all values along Y axe for the element at iterator it
03050     /*!
03051       Equivalent to getAllUp and getAllDown with a single call.
03052       This method exists for each type of iterator with left and right values in SkelGIS.
03053       \param it is the iterator position
03054       \return a table of all neighbor values along Y
03055     */
03056     //-------------------------------------------------------------------------------
03057     /*inline T * getAllY(iterator<T,R> it){return m->getAllY(it);}
03058     inline T * getAllY(iterator_cont<T,R> it){return m->getAllY(it);}
03059     inline T * getAllY(iterator_rev<T,R> it){return m->getAllY(it);}
03060     inline T * getAllY(iterator_step<T,R> it){return m->getAllY(it);}*/
03061     //-------------------------------------------------------------------------------
03062     //! Get all 8 directions neighbor values for the element at iterator it
03063     /*!
03064       Equivalent to getLeftUp, getUp, getRightUp, getRight, getRightDown, getDown, getLeftDown and getLeft with a single call.
03065       \param it is the iterator position
03066       \return a table of all 8 directions neighbor values
03067     */
03068     //-------------------------------------------------------------------------------
03069     /*inline T * get8(iterator<T,R> it){return m->get8(it);}
03070     inline T * get8(iterator_cont<T,R> it){return m->get8(it);}
03071     inline T * get8(iterator_rev<T,R> it){return m->get8(it);}
03072     inline T * get8(iterator_step<T,R> it){return m->get8(it);}*/
03073     //-------------------------------------------------------------------------------
03074     //! Get all 4 directions neighbor values for the element at iterator it
03075     /*!
03076       Equivalent to getUp, getRight, getDown and getLeft with a single call.
03077       \param it is the iterator position
03078       \return a table of all 4 directions neighbor values
03079     */
03080     //-------------------------------------------------------------------------------
03081     /*inline T * get4(iterator<T,R> it){return m->get4(it);};
03082     inline T * get4(iterator_cont<T,R> it){return m->get4(it);}
03083     inline T * get4(iterator_rev<T,R> it){return m->get4(it);}
03084     inline T * get4(iterator_step<T,R> it){return m->get4(it);}*/
03085     //-------------------------------------------------------------------------------
03086     //! Get the nearest right neighbor value inside the domain, for physical left border iterators
03087     /*!
03088       This work for every size of R and will always give the nearest right inside-domain value.
03089       \param it is the physical border iterator position
03090       \return the neighbor value
03091     */
03092     //-------------------------------------------------------------------------------
03093     //inline T getInRight(iterator_phb_left<T,R> it){return m->getInRight(it);}
03094     //-------------------------------------------------------------------------------
03095     //! Get the nearest left neighbor value inside the domain, for physical right border iterators
03096     /*!
03097       This work for every size of R and will always give the nearest left inside-domain value.
03098       \param it is the physical border iterator position
03099       \return the neighbor value
03100     */
03101     //-------------------------------------------------------------------------------
03102     //inline T getInLeft(iterator_phb_right<T,R> it){return m->getInLeft(it);}
03103     //-------------------------------------------------------------------------------
03104     //! Get the nearest up neighbor value inside the domain, for physical down border iterators
03105     /*!
03106       This work for every size of R and will always give the nearest up inside-domain value.
03107       \param it is the physical border iterator position
03108       \return the neighbor value
03109     */
03110     //-------------------------------------------------------------------------------
03111     //inline T getInUp(iterator_phb_down<T,R> it){return m->getInUp(it);}
03112     //-------------------------------------------------------------------------------
03113     //! Get the nearest down neighbor value inside the domain, for physical up border iterators
03114     /*!
03115       This work for every size of R and will always give the nearest down inside-domain value.
03116       \param it is the physical border iterator position
03117       \return the neighbor value
03118     */
03119     //-------------------------------------------------------------------------------
03120     //inline T getInDown(iterator_phb_up<T,R> it){return m->getInDown(it);}
03121     //-------------------------------------------------------------------------------
03122     //! Get the iterator on the matrix at position (x,y)
03123     /*!
03124       This method exists for the three basic types of iterators.
03125       \param x is row index
03126       \pram y is column index
03127       \return returns the iterator at position (x,y)
03128     */
03129     //-------------------------------------------------------------------------------
03130     inline iterator<T,R> getIterator(int x,int y){return m->getIterator(x,y);}
03131     inline iterator<T,R> getIterator_cont(int x,int y){return m->getIterator_cont(x,y);}
03132     inline iterator<T,R> getIterator_rev(int x,int y){return m->getIterator_rev(x,y);}
03133     //-------------------------------------------------------------------------------
03134     //! get the indexes of the iterator on the matrix
03135     /*!
03136       \param it is the iterator from which the indexes will be taken
03137       \param x is the iterator position x returned
03138       \param y is the iterator position y returned
03139     */
03140     //-------------------------------------------------------------------------------
03141     inline void getIndexes(iterator<T,R> it,int &col,int &li){m->getIndexes(it,col,li);}
03142     inline void getIndexes(iterator_cont<T,R> it,int &col,int &li){m->getIndexes(it,col,li);}
03143     inline void getIndexes(iterator_rev<T,R> it,int &col,int &li){m->getIndexes(it,col,li);}
03144     //-------------------------------------------------------------------------------
03145     //! Get the indexes of the iterator on the matrix
03146     /*!
03147       This method exists for the three basic types of iterators.
03148       \param it is the iterator from which the indexes will be taken
03149       \param x is the iterator position x returned
03150       \param y is the iterator position y returned
03151     */
03152     //-------------------------------------------------------------------------------
03153     inline HEADER getGlobalHeader(){return m->head;}
03154     //-------------------------------------------------------------------------------
03155     //! Get the header of the DMatrix
03156     /*!
03157       \return the header
03158     */
03159     //-------------------------------------------------------------------------------
03160     inline HEADER getHeader(){return m->loc_head;}
03161     //-------------------------------------------------------------------------------
03162     //! Get the border header of the DMatrix
03163     /*!
03164       \return the border header
03165     */
03166     //-------------------------------------------------------------------------------
03167     inline HEADER getBorderHeader(){return m->border_head;}
03168     //-------------------------------------------------------------------------------
03169     //! Get the number of columns in the domain decomposition
03170     /*!
03171       \return the number of columns in the domain decomposition
03172     */
03173     //-------------------------------------------------------------------------------
03174     inline int getCols(){return m->cols;}
03175     //-------------------------------------------------------------------------------
03176     //! Get the number of rows in the domain decomposition
03177     /*!
03178       \return the number of rows in the domain decomposition
03179     */
03180     //-------------------------------------------------------------------------------
03181     inline int getRows(){return m->rows;}
03182     //-------------------------------------------------------------------------------
03183     //! Get the column number of the DMatrix
03184     /*!
03185       \return the column number of the DMatrix
03186     */
03187     //-------------------------------------------------------------------------------
03188     inline int getCol(){return m->col;}
03189     //-------------------------------------------------------------------------------
03190     //! Get the row number of the DMatrix
03191     /*!
03192       \return the row number of the DMatrix
03193     */
03194     //-------------------------------------------------------------------------------
03195     inline int getRow(){return m->row;}
03196     //-------------------------------------------------------------------------------
03197     //! Get the data table of the DMatrix
03198     /*!
03199       \return the data table of the DMatrix
03200     */
03201     //-------------------------------------------------------------------------------
03202     inline T * getData(){return m->data;}
03203     //-------------------------------------------------------------------------------
03204     //! Get the recovery of the DMatrix (=R)
03205     /*!
03206       \return the recovery of the DMatrix
03207     */
03208     //-------------------------------------------------------------------------------
03209     inline int getBorder(){return R;}
03210     //-------------------------------------------------------------------------------
03211     //! Get the DMatrix_impl associated to the DMatrix interface
03212     /*!
03213       \return the DMatrix_impl
03214     */
03215     //-------------------------------------------------------------------------------
03216     inline DMatrix_impl<T,R,false> * getDMatrix(){return m;}
03217     //-------------------------------------------------------------------------------
03218   };
03219 
03220   //================================================================================
03221   //! DMatrix class
03222   /*!
03223     template of the distributed matrix of SkelGIS. This is the fourth specialization of the DMatrix.
03224     \tparam T is the type of data to store in the DMatrix
03225     R overlap template parameter is not asked and specialized to 0.
03226     The line template parameter is specialized with the false value. In this case the parallel data distribution will be done along height and width (by block).
03227   */
03228   //-------------------------------------------------------------------------------
03229   template<class T> struct DMatrix<T,0,false>
03230   //-------------------------------------------------------------------------------
03231   {
03232   protected:
03233     //! Pointer to DMatrix_impl object
03234     /*!
03235       The pointer to Dmatrix_impl object is the real distributed matrix object. DMatrix class is the user interface to this object.
03236     */
03237     DMatrix_impl<T,0,false> * m;
03238 
03239   public:
03240     //! default constructor of the distributed matrix interface
03241     //-------------------------------------------------------------------------------
03242     DMatrix(){}
03243     //-------------------------------------------------------------------------------
03244     //! constructor of the distributed matrix interface from pointer
03245     /*!
03246       This Constructor is used in the user function when a skeleton ApplyList is called.
03247       \param _m is a DMatrix_impl pointer
03248     */
03249     //-------------------------------------------------------------------------------
03250     DMatrix(DMatrix_impl<T,0,false> * _m){m=_m;}
03251     //-------------------------------------------------------------------------------
03252     //! constructor of the distributed matrix interface with another DMatrix
03253     /*!
03254       It is possible to construct a DMatrix instance from another DMatrix instance
03255       \param _m is a DMatrix object
03256     */
03257     //-------------------------------------------------------------------------------
03258     DMatrix(DMatrix<T,0,false>& _m){m=_m.getDMatrix();}
03259     //-------------------------------------------------------------------------------
03260     //! constructor of the distributed matrix interface from a HEADER and a default value
03261     /*!
03262       The HEADER essentially define the size of the DMatrix, while the default value is given to each element of the DMatrix.
03263       \param h is the header to construct the object (see skelgis/util/utility.hpp)
03264       \param value is the default value to put in the matrix
03265       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
03266     */
03267     //-------------------------------------------------------------------------------
03268     DMatrix(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,0,false>(h,value,loc);}
03269     //-------------------------------------------------------------------------------
03270     //! constructor of the distributed matrix interface from a binary file
03271     /*!
03272       A specific binary file format is read by SkelGIS. A Dmatrix instance can be constructed from a binary file.
03273       \param binFile is a binary input file to construct the DMatrix with
03274       \param loc is a boolean value to indicate if the DMatrix_impl has to stay local to one MPI process (used in ApplyReduction).
03275     */
03276     //-------------------------------------------------------------------------------
03277     DMatrix(const char * binFile, bool loc=false){m = new DMatrix_impl<T,0,false>(binFile,loc);}
03278     //-------------------------------------------------------------------------------
03279     //! destructor of the distributed matrix
03280     //-------------------------------------------------------------------------------
03281     ~DMatrix(){}
03282     //-------------------------------------------------------------------------------
03283     //! initialization of the distributed matrix interface from pointer
03284     /*!
03285       The equivalent to the constructor from a pointer
03286       \param _m is a DMatrix_impl object
03287     */
03288     //-------------------------------------------------------------------------------
03289     inline void init(DMatrix_impl<T,0,false> * _m){m=_m;}
03290     //-------------------------------------------------------------------------------
03291     //! initialization of the distributed matrix interface from another DMatrix
03292     /*!
03293       The equivalent to the constructor from another DMatrix
03294       \param _m is a DMatrix object
03295     */
03296     //-------------------------------------------------------------------------------
03297     inline void init(DMatrix<T,0,false>& _m){m=_m.getDMatrix();}
03298     //-------------------------------------------------------------------------------
03299     //! initialization of the distributed matrix interface from a HEADER and a default value
03300     /*!
03301       The equivalent to the constructor from a HEADER and a default value
03302       \param h is the header to construct the object (see skelgis/util/utility.hpp)
03303       \param value is the default value to put in the matrix
03304     */
03305     //-------------------------------------------------------------------------------
03306     inline void init(HEADER h,const T value, bool loc=false){m = new DMatrix_impl<T,0,false>(h,value,loc);}
03307     //-------------------------------------------------------------------------------
03308     //! initialization of the distributed matrix interface from a binary file
03309     /*!
03310       The equivalent to the constructor from a binary file
03311       \param binFile is a binary input file to construct the DMatrix with
03312     */
03313     //-------------------------------------------------------------------------------
03314     inline void init(const char * binFile, bool loc=false){m = new DMatrix_impl<T,0,false>(binFile,loc);}
03315     //-------------------------------------------------------------------------------
03316     //! to erase and clear the DMatrix
03317     /*!
03318       The equivalent to the erase of a std::vector in the STL.
03319       The erase will empty the DMatrix and will deallocate the memory space associated.
03320       This has to be done when the DMatrix is not usefull anymore.
03321     */
03322     //-------------------------------------------------------------------------------
03323     inline void erase(){delete m;}
03324     //-------------------------------------------------------------------------------
03325     //! Methods to get the value of the matrix at the iterator it (alternative to [it])
03326     /*!
03327       This method exists for each type of iterator in SkelGIS. This method is const as the value returned could not be modified.
03328       \param it is the iterator position
03329       \return the value at the iterator it
03330     */
03331     //-------------------------------------------------------------------------------
03332     inline T getValue(iterator<T,0> it) const {return m->data[it._rank];}
03333     inline T getValue(iterator_cont<T,0> it) const {return m->data[it._rank];}
03334     inline T getValue(iterator_step<T,0> it) const {return m->data[it._rank];}
03335     inline T getValue(iterator_rev<T,0> it) const {return m->data[it._rank];}
03336     //-------------------------------------------------------------------------------
03337     //! Methods to set the value of the matrix at the iterator it (alternative to [it]=)
03338     /*!
03339       This method exists for each type of iterator in SkelGIS.
03340       \param it is the iterator position
03341       \param value is the value to set
03342     */
03343     //-------------------------------------------------------------------------------
03344     inline void setValue(iterator<T,0> it,T value){m->data[it._rank] = value;}
03345     inline void setValue(iterator_cont<T,0> it,T value){m->data[it._rank] = value;}
03346     inline void setValue(iterator_step<T,0> it,T value){m->data[it._rank] = value;}
03347     inline void setValue(iterator_rev<T,0> it,T value){m->data[it._rank] = value;}
03348     //-------------------------------------------------------------------------------
03349     //! Get the beginning iterator of the DMatrix (on the first element of the DMatrix)
03350     /*!
03351       This method exists for each type of iterator in SkelGIS.
03352       \return the iterator of the first element
03353     */
03354     //-------------------------------------------------------------------------------
03355     inline iterator<T,0> begin(){return m->begin();}
03356     inline iterator_cont<T,0> begin_cont(){return m->begin_cont();}
03357     inline iterator_rev<T,0> begin_rev(){return m->begin_rev();}
03358     inline iterator_step<T,0> begin_step(int step,int nb){return m->begin_step(step,nb);}
03359     inline iterator_line<T,0> begin_line(){return m->begin_line();}
03360     //-------------------------------------------------------------------------------
03361     //! Get the ending iterator of the DMatrix (on the last element of the DMatrix)
03362     /*!
03363       This method exists for each type of iterator in SkelGIS.
03364       \return the iterator of the last element
03365     */
03366     //-------------------------------------------------------------------------------
03367     inline iterator<T,0> end(){return m->end();}
03368     inline iterator_cont<T,0> end_cont(){return m->end_cont();}
03369     inline iterator_rev<T,0> end_rev(){return m->end_rev();}
03370     inline iterator_step<T,0> end_step(){return m->end_step();}
03371     inline iterator_line<T,0> end_line(){return m->end_line();}
03372     //-------------------------------------------------------------------------------
03373     //! Operator [] to get and set an element of the matrix at iterator it
03374     /*!
03375       This method exists for each type of iterator in SkelGIS.
03376       \param it is the iterator position
03377       \return the reference to the value at it
03378     */
03379     //-------------------------------------------------------------------------------
03380     inline T& operator[](iterator<T,0> it) { return m->data[it._rank]; }
03381     inline T& operator[](iterator_cont<T,0> it) { return m->data[it._rank]; }
03382     inline T& operator[](iterator_rev<T,0> it) { return m->data[it._rank]; }
03383     inline T& operator[](iterator_step<T,0> it) { return m->data[it._rank]; }
03384     //-------------------------------------------------------------------------------
03385     //! Operator = to assign the current DMatrix interface object to another one
03386     /*!
03387       \param right is the other DMatrix object
03388       \return the reference to the new current DMatrix object
03389     */
03390     //-------------------------------------------------------------------------------
03391     inline DMatrix<T,0,false>& operator=(DMatrix<T,0,false> & right){m = right.getDMatrix();}
03392     //-------------------------------------------------------------------------------
03393     //! Print the matrix by block
03394     /*!
03395       This method will print the DMatrix by processors in the directory "outputs".
03396      */
03397     //-------------------------------------------------------------------------------
03398     inline void print(){m->print();}
03399     //-------------------------------------------------------------------------------
03400     //! Print all the matrix by block
03401     /*!
03402       This method will print the DMatrix by processors in the directory "outputs". 
03403       It will also print the physical border of the DMatrix and the parallel overlap of the DMatrix.
03404      */
03405     //-------------------------------------------------------------------------------
03406     inline void printAll(){m->printAll();}
03407     //-------------------------------------------------------------------------------
03408     //! Saving in a bin file the distributed matrix interface
03409     /*!
03410       This method writes the DMatrix in a single binary output file.
03411       \param binFile is a binary output file to save the DMatrix in
03412     */
03413     //-------------------------------------------------------------------------------
03414     inline void write(char * binFile){m->write(binFile);}
03415     //-------------------------------------------------------------------------------
03416     //! Get the iterator on the matrix at position (x,y)
03417     /*!
03418       This method exists for the three basic types of iterators.
03419       \param x is row index
03420       \pram y is column index
03421       \return returns the iterator at position (x,y)
03422     */
03423     //-------------------------------------------------------------------------------
03424     inline iterator<T,0> getIterator(int x,int y){return m->getIterator(x,y);}
03425     inline iterator<T,0> getIterator_cont(int x,int y){return m->getIterator_cont(x,y);}
03426     inline iterator<T,0> getIterator_rev(int x,int y){return m->getIterator_rev(x,y);}
03427     //-------------------------------------------------------------------------------
03428     //! Get the indexes of the iterator on the matrix
03429     /*!
03430       This method exists for the three basic types of iterators.
03431       \param it is the iterator from which the indexes will be taken
03432       \param x is the iterator position x returned
03433       \param y is the iterator position y returned
03434     */
03435     //-------------------------------------------------------------------------------
03436     inline void getIndexes(iterator<T,0> it,int &col,int &li){m->getIndexes(it,col,li);}
03437     inline void getIndexes(iterator_cont<T,0> it,int &col,int &li){m->getIndexes(it,col,li);}
03438     inline void getIndexes(iterator_rev<T,0> it,int &col,int &li){m->getIndexes(it,col,li);}
03439     //-------------------------------------------------------------------------------
03440     //! Get the global header of the DMatrix
03441     /*!
03442       \return the global header
03443     */
03444     //-------------------------------------------------------------------------------
03445     inline HEADER getGlobalHeader(){return m->head;}
03446     //-------------------------------------------------------------------------------
03447     //! Get the header of the DMatrix
03448     /*!
03449       \return the header
03450     */
03451     //-------------------------------------------------------------------------------
03452     inline HEADER getHeader(){return m->loc_head;}
03453     //-------------------------------------------------------------------------------
03454     //! Get the number of columns in the domain decomposition
03455     /*!
03456       \return the number of columns in the domain decomposition
03457     */
03458     //-------------------------------------------------------------------------------
03459     inline int getCols(){return m->cols;}
03460     //-------------------------------------------------------------------------------
03461     //! Get the number of rows in the domain decomposition
03462     /*!
03463       \return the number of rows in the domain decomposition
03464     */
03465     //-------------------------------------------------------------------------------
03466     inline int getRows(){return m->rows;}
03467     //-------------------------------------------------------------------------------
03468     //! Get the column number of the DMatrix
03469     /*!
03470       \return the column number of the DMatrix
03471     */
03472     //-------------------------------------------------------------------------------
03473     inline int getCol(){return m->col;}
03474     //-------------------------------------------------------------------------------
03475     //! Get the row number of the DMatrix
03476     /*!
03477       \return the row number of the DMatrix
03478     */
03479     //-------------------------------------------------------------------------------
03480     inline int getRow(){return m->row;}
03481     //-------------------------------------------------------------------------------
03482     //! Get the data table of the DMatrix
03483     /*!
03484       \return the data table of the DMatrix
03485     */
03486     //-------------------------------------------------------------------------------
03487     inline T * getData(){return m->data;}
03488     //-------------------------------------------------------------------------------
03489     //! Get the DMatrix_impl associated to the DMatrix interface
03490     /*!
03491       \return the DMatrix_impl
03492     */
03493     //-------------------------------------------------------------------------------
03494     inline DMatrix_impl<T,0,false> * getDMatrix(){return m;}
03495     //-------------------------------------------------------------------------------
03496   };
03497   
03498 }
03499 
03500 #endif
 All Classes Files Functions Variables Defines