Commit cc0691cd authored by Vít Hanousek's avatar Vít Hanousek
Browse files

Allow user to hint/force distribution of 2D grid between nodes.

parent 9a83c1f6
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ namespace Meshes {
          typename Real >*/

template<typename GridType,
        int meshDimensions= GridType::meshDimension>    
        int meshDimensions= GridType::getMeshDimension()>    
class DistributedGrid
{

@@ -86,7 +86,7 @@ class DistributedGrid <GridType,1>
     
   public:
       //compute everithing 
       DistributedGrid(GridType globalGrid)
       DistributedGrid(GridType globalGrid, int *distribution=NULL)
       {
           
           //fuj
@@ -229,7 +229,7 @@ class DistributedGrid <GridType,2>
     
   public:
       //compute everithing 
       DistributedGrid(GridType globalGrid)
       DistributedGrid(GridType globalGrid,int *distribution=NULL)
       {
           
           //fuj
@@ -239,7 +239,7 @@ class DistributedGrid <GridType,2>
           for (int i=0;i<8;i++)
                neighbors[i]=-1;
           
           Dimensions= GridType::meshDimension;
           Dimensions= GridType::getMeshDimension();
           GlobalGrid=globalGrid;
           //Detect MPI and number of process
           mpiInUse=false;
@@ -270,8 +270,16 @@ class DistributedGrid <GridType,2>
           {
               //With MPI
               //compute node distribution
               if(distribution!=NULL)
               {
                  procsdistr[0]=distribution[0];
                  procsdistr[1]=distribution[1];
               }
               else
               {
                  procsdistr[0]=0;
                  procsdistr[1]=0;
               }
               MPI_Dims_create(nproc, 2, procsdistr);
               myproccoord[0]=rank%procsdistr[0]; // CO je X a co Y? --x je 0 a je to sloupec
               myproccoord[1]=rank/procsdistr[0];        
+3 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ using namespace std;

#include <TNL/Timer.h>

//#define OUTPUT 
#define OUTPUT 

#include "Functions.h"

@@ -73,7 +73,8 @@ int main ( int argc, char *argv[])
 globalGrid.setDimensions(size,size);
 globalGrid.setDomain(globalOrigin,globalProportions);
 
 DistributedGrid<MeshType> distrgrid(globalGrid); 
 int distr[2]={0,1};
 DistributedGrid<MeshType> distrgrid(globalGrid, distr); 
  
 SharedPointer<MeshType> gridptr;
 SharedPointer<MeshFunctionType> meshFunctionptr;