Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_1D.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ setGlobalGrid( const GridType& globalGrid, +this->globalBegin.x()*this->globalGrid.getSpaceSteps().x(); } this->setUpNeighbors(); this->setupNeighbors(); this->localBegin=overlap; Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_2D.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ setGlobalGrid( const GridType &globalGrid, this->localOrigin=globalGrid.getOrigin()+TNL::Containers::tnlDotProduct(globalGrid.getSpaceSteps(),this->globalBegin-this->overlap); this->setUpNeighbors(); this->setupNeighbors(); //nearnodes /*if(this->subdomainCoordinates[0]>0) Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_3D.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ setGlobalGrid( const GridType &globalGrid, this->localOrigin=globalGrid.getOrigin()+TNL::Containers::tnlDotProduct(globalGrid.getSpaceSteps(),this->globalBegin-this->overlap); this->setUpNeighbors(); this->setupNeighbors(); this->localBegin=this->overlap; Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h +3 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class DistributedGrid_Base public: bool isThereNeighbor(const CoordinatesType &direction) const; void setUpNeighbors(); void setupNeighbors(); GridType globalGrid; PointType localOrigin; Loading @@ -109,6 +109,8 @@ class DistributedGrid_Base int neighbors[getNeighborsCount()]; int periodicNeighbors[getNeighborsCount()]; IndexType Dimensions; bool distributed; Loading src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.hpp +29 −18 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ #include <iostream> #include "DistributedGrid_Base.h" namespace TNL { namespace Meshes { namespace DistributedMeshes { Loading Loading @@ -207,21 +209,30 @@ isThereNeighbor(const CoordinatesType &direction) const template< int dim, typename RealType, typename Device, typename Index > void DistributedGrid_Base< dim, RealType, Device, Index >:: setUpNeighbors() setupNeighbors() { int *neighbors = this->neighbors; for( int i = 0; i < getNeighborsCount(); i++ ) { auto direction = Directions::template getXYZ< dim >( i ); auto coordinates = this->subdomainCoordinates+direction; if( this->isThereNeighbor( direction ) ) { this->neighbors[i]=this->getRankOfProcCoord(this->subdomainCoordinates+direction); } this->neighbors[ i ] = this->getRankOfProcCoord( coordinates ); else { this->neighbors[ i ] =- 1; // Handling periodic neighbors for( int d = 0; d < dim; d++ ) { if( coordinates[ d ] == -1 ) coordinates[ d ] = this->domainDecomposition[ d ] - 1; if( coordinates[ d ] == this->domainDecomposition[ d ] ) coordinates[ d ] = 0; this->periodicNeighbors[ i ] = this->getRankOfProcCoord( coordinates ); } std::cout << "Setting i-th neigbour to " << neighbors[ i ] << " and " << periodicNeighbors[ i ] << std::endl; } } Loading Loading @@ -293,7 +304,7 @@ SetupByCut(DistributedGridType &inputDistributedGrid, CommunicatorType::CreateNewGroup(isInCut,newRank,*oldGroup ,*((typename CommunicatorType::CommunicationGroup*) this->communicationGroup)); setUpNeighbors(); setupNeighbors(); Loading Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_1D.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ setGlobalGrid( const GridType& globalGrid, +this->globalBegin.x()*this->globalGrid.getSpaceSteps().x(); } this->setUpNeighbors(); this->setupNeighbors(); this->localBegin=overlap; Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_2D.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ setGlobalGrid( const GridType &globalGrid, this->localOrigin=globalGrid.getOrigin()+TNL::Containers::tnlDotProduct(globalGrid.getSpaceSteps(),this->globalBegin-this->overlap); this->setUpNeighbors(); this->setupNeighbors(); //nearnodes /*if(this->subdomainCoordinates[0]>0) Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_3D.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ setGlobalGrid( const GridType &globalGrid, this->localOrigin=globalGrid.getOrigin()+TNL::Containers::tnlDotProduct(globalGrid.getSpaceSteps(),this->globalBegin-this->overlap); this->setUpNeighbors(); this->setupNeighbors(); this->localBegin=this->overlap; Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h +3 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class DistributedGrid_Base public: bool isThereNeighbor(const CoordinatesType &direction) const; void setUpNeighbors(); void setupNeighbors(); GridType globalGrid; PointType localOrigin; Loading @@ -109,6 +109,8 @@ class DistributedGrid_Base int neighbors[getNeighborsCount()]; int periodicNeighbors[getNeighborsCount()]; IndexType Dimensions; bool distributed; Loading
src/TNL/Meshes/DistributedMeshes/DistributedGrid_Base.hpp +29 −18 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ #include <iostream> #include "DistributedGrid_Base.h" namespace TNL { namespace Meshes { namespace DistributedMeshes { Loading Loading @@ -207,21 +209,30 @@ isThereNeighbor(const CoordinatesType &direction) const template< int dim, typename RealType, typename Device, typename Index > void DistributedGrid_Base< dim, RealType, Device, Index >:: setUpNeighbors() setupNeighbors() { int *neighbors = this->neighbors; for( int i = 0; i < getNeighborsCount(); i++ ) { auto direction = Directions::template getXYZ< dim >( i ); auto coordinates = this->subdomainCoordinates+direction; if( this->isThereNeighbor( direction ) ) { this->neighbors[i]=this->getRankOfProcCoord(this->subdomainCoordinates+direction); } this->neighbors[ i ] = this->getRankOfProcCoord( coordinates ); else { this->neighbors[ i ] =- 1; // Handling periodic neighbors for( int d = 0; d < dim; d++ ) { if( coordinates[ d ] == -1 ) coordinates[ d ] = this->domainDecomposition[ d ] - 1; if( coordinates[ d ] == this->domainDecomposition[ d ] ) coordinates[ d ] = 0; this->periodicNeighbors[ i ] = this->getRankOfProcCoord( coordinates ); } std::cout << "Setting i-th neigbour to " << neighbors[ i ] << " and " << periodicNeighbors[ i ] << std::endl; } } Loading Loading @@ -293,7 +304,7 @@ SetupByCut(DistributedGridType &inputDistributedGrid, CommunicatorType::CreateNewGroup(isInCut,newRank,*oldGroup ,*((typename CommunicatorType::CommunicationGroup*) this->communicationGroup)); setUpNeighbors(); setupNeighbors(); Loading