diff --git a/src/TNL/Meshes/DistributedGrid.h b/src/TNL/Meshes/DistributedGrid.h index efb0f5f4a06b2734ad2c1642a2b44cd70271ecbb..2347202f0fb11ca3fdc272468653d2a5133176a9 100644 --- a/src/TNL/Meshes/DistributedGrid.h +++ b/src/TNL/Meshes/DistributedGrid.h @@ -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 - procsdistr[0]=0; - procsdistr[1]=0; + 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]; diff --git a/tests/mpi/MeshFunctionEvauateTest.cpp b/tests/mpi/MeshFunctionEvauateTest.cpp index 7ab5a7f6ad044f183e308f8cc90fe13f5b35e46d..a80bbd2283dedecc0c257044e9a5a40144c63694 100644 --- a/tests/mpi/MeshFunctionEvauateTest.cpp +++ b/tests/mpi/MeshFunctionEvauateTest.cpp @@ -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;