Commit 5b89c25a authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Set-up of the distributed grid subdomains overlaps is taking the actualy...

Set-up of the distributed grid subdomains overlaps is taking the actualy applied periodic boundary conditions into account.
parent f675fa47
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ class SubdomainOverlapsGetter< Grid< 1, Real, Device, Index >, Communicator >
                               SubdomainOverlapsType& lower,
                               SubdomainOverlapsType& upper,
                               IndexType subdomainOverlapSize,
                               const SubdomainOverlapsType& periodicBoundariesOverlapSize = 0 );
                               const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
                               const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
   
};

@@ -108,7 +109,8 @@ class SubdomainOverlapsGetter< Grid< 2, Real, Device, Index >, Communicator >
                               SubdomainOverlapsType& lower,
                               SubdomainOverlapsType& upper,
                               IndexType subdomainOverlapSize,
                               const SubdomainOverlapsType& periodicBoundariesOverlapSize = 0 );
                               const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
                               const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
   
};

@@ -142,7 +144,8 @@ class SubdomainOverlapsGetter< Grid< 3, Real, Device, Index >, Communicator >
                               SubdomainOverlapsType& lower,
                               SubdomainOverlapsType& upper,
                               IndexType subdomainOverlapSize,
                               const SubdomainOverlapsType& periodicBoundariesOverlapSize = 0 );
                               const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
                               const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
   
};

+20 −15
Original line number Diff line number Diff line
@@ -68,7 +68,8 @@ getOverlaps( const DistributedMeshType* distributedMesh,
             SubdomainOverlapsType& lower,
             SubdomainOverlapsType& upper,
             IndexType subdomainOverlapSize,
             const SubdomainOverlapsType& periodicBoundariesOverlapSize )
             const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
             const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
{
   if( ! CommunicatorType::isDistributed() )
      return;
@@ -80,12 +81,12 @@ getOverlaps( const DistributedMeshType* distributedMesh,
   if( subdomainCoordinates[ 0 ] > 0 )
      lower[ 0 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYzXm ] != rank )
      lower[ 0 ] = periodicBoundariesOverlapSize[ 0 ];
      lower[ 0 ] = lowerPeriodicBoundariesOverlapSize[ 0 ];

   if( subdomainCoordinates[ 0 ] < distributedMesh->getDomainDecomposition()[ 0 ] - 1 )
      upper[ 0 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYzXp ] != rank )
      upper[ 0 ] = periodicBoundariesOverlapSize[ 0 ];
      upper[ 0 ] = upperPeriodicBoundariesOverlapSize[ 0 ];
}


@@ -99,7 +100,8 @@ getOverlaps( const DistributedMeshType* distributedMesh,
             SubdomainOverlapsType& lower,
             SubdomainOverlapsType& upper,
             IndexType subdomainOverlapSize,
             const SubdomainOverlapsType& periodicBoundariesOverlapSize )
             const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
             const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
{
   if( ! CommunicatorType::isDistributed() )
      return;
@@ -107,26 +109,28 @@ getOverlaps( const DistributedMeshType* distributedMesh,

   const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates();
   int rank = CommunicatorType::GetRank( CommunicatorType::AllGroup );
   lower = 0;
   upper = 0;
   
   if( subdomainCoordinates[ 0 ] > 0 )
      lower[ 0 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYzXm ] != rank )
      lower[ 0 ] = periodicBoundariesOverlapSize[ 0 ];
      lower[ 0 ] = lowerPeriodicBoundariesOverlapSize[ 0 ];

   if( subdomainCoordinates[ 0 ] < distributedMesh->getDomainDecomposition()[ 0 ] - 1 )
      upper[ 0 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYzXp ] != rank )
      upper[ 0 ] = periodicBoundariesOverlapSize[ 0 ];
      upper[ 0 ] = upperPeriodicBoundariesOverlapSize[ 0 ];
   
   if( subdomainCoordinates[ 1 ] > 0 )
      lower[ 1 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYmXz ] != rank )
      lower[ 1 ] = periodicBoundariesOverlapSize[ 1 ];
      lower[ 1 ] = lowerPeriodicBoundariesOverlapSize[ 1 ];

   if( subdomainCoordinates[ 1 ] < distributedMesh->getDomainDecomposition()[ 1 ] - 1 )
      upper[ 1 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYpXz ] != rank )
      upper[ 1 ] = periodicBoundariesOverlapSize[ 1 ];
      upper[ 1 ] = upperPeriodicBoundariesOverlapSize[ 1 ];
}

template< typename Real,
@@ -139,7 +143,8 @@ getOverlaps( const DistributedMeshType* distributedMesh,
             SubdomainOverlapsType& lower,
             SubdomainOverlapsType& upper,
             IndexType subdomainOverlapSize,
             const SubdomainOverlapsType& periodicBoundariesOverlapSize )
             const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
             const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
{
   if( ! CommunicatorType::isDistributed() )
      return;
@@ -151,32 +156,32 @@ getOverlaps( const DistributedMeshType* distributedMesh,
   if( subdomainCoordinates[ 0 ] > 0 )
      lower[ 0 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYzXm ] != rank )
      lower[ 0 ] = periodicBoundariesOverlapSize[ 0 ];
      lower[ 0 ] = lowerPeriodicBoundariesOverlapSize[ 0 ];

   if( subdomainCoordinates[ 0 ] < distributedMesh->getDomainDecomposition()[ 0 ] - 1 )
      upper[ 0 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYzXp ] != rank )
      upper[ 0 ] = periodicBoundariesOverlapSize[ 0 ];
      upper[ 0 ] = upperPeriodicBoundariesOverlapSize[ 0 ];
   
   if( subdomainCoordinates[ 1 ] > 0 )
      lower[ 1 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYmXz ] != rank )
      lower[ 1 ] = periodicBoundariesOverlapSize[ 1 ];
      lower[ 1 ] = lowerPeriodicBoundariesOverlapSize[ 1 ];

   if( subdomainCoordinates[ 1 ] < distributedMesh->getDomainDecomposition()[ 1 ] - 1 )
      upper[ 1 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZzYpXz ] != rank )
      upper[ 1 ] = periodicBoundariesOverlapSize[ 1 ];
      upper[ 1 ] = upperPeriodicBoundariesOverlapSize[ 1 ];
   
   if( subdomainCoordinates[ 2 ] > 0 )
      lower[ 2 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZmYzXz ] != rank )
      lower[ 2 ] = periodicBoundariesOverlapSize[ 2 ];
      lower[ 2 ] = lowerPeriodicBoundariesOverlapSize[ 2 ];

   if( subdomainCoordinates[ 2 ] < distributedMesh->getDomainDecomposition()[ 2 ] - 1 )
      upper[ 2 ] = subdomainOverlapSize;
   else if( distributedMesh->getPeriodicNeighbors()[ ZpYzXz ] != rank )
      upper[ 2 ] = periodicBoundariesOverlapSize[ 2 ];
      upper[ 2 ] = upperPeriodicBoundariesOverlapSize[ 2 ];
}

      } // namespace DistributedMeshes
+4 −1
Original line number Diff line number Diff line
@@ -257,7 +257,10 @@ decomposeMesh( const Config::ParameterContainer& parameters,

   if( CommunicatorType::isDistributed() )
   {
      SubdomainOverlapsType lower, upper;
      SubdomainOverlapsType lower( 0 ), upper( 0 );
      distributedMesh.setOverlaps( lower, upper );
      distributedMesh.setupGrid( mesh );
      
      problem.getSubdomainOverlaps( parameters, prefix, mesh, lower, upper  );
      distributedMesh.setOverlaps( lower, upper );
      distributedMesh.setupGrid( mesh );