Commit 96fb7f8d authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Refactoring: removed DistributedMeshSynchronizer from MeshFunction

parent a4eb532b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "tnlFastSweepingMethod.h"

#include <TNL/Meshes/DistributedMeshes/DistributedGridIO.h>
#include <TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h>

template< typename Mesh,
          typename Communicator,
@@ -79,6 +80,9 @@ class tnlDirectEikonalProblem

      protected:
         
         using DistributedMeshSynchronizerType = Meshes::DistributedMeshes::DistributedMeshSynchronizer< MeshFunctionType >;
         DistributedMeshSynchronizerType synchronizer;

         MeshFunctionPointer u;
         
         MeshFunctionPointer initialData;
+2 −1
Original line number Diff line number Diff line
@@ -131,7 +131,8 @@ setInitialCondition( const Config::ParameterContainer& parameters,
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::MpiIO> ::load(inputFile, *initialData );
    if(distributedIOType==Meshes::DistributedMeshes::LocalCopy)
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::LocalCopy> ::load(inputFile, *initialData );
    initialData->template synchronize<CommunicatorType>();
    synchronizer.setDistributedGrid( initialData->getMesh().getDistributedMesh() );
    synchronizer.template synchronize<CommunicatorType>( *initialData );
  }
  else
  {
+7 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
//#include <TNL/Functions/Analytic/Constant.h>
//#include <TNL/Pointers/SharedPointer.h>
#include "tnlDirectEikonalMethodsBase.h"
#include <TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h>


template< typename Mesh,
@@ -112,6 +113,9 @@ class FastSweepingMethod< Meshes::Grid< 2, Real, Device, Index >, Communicator,
    
    protected:
      
      using DistributedMeshSynchronizerType = Meshes::DistributedMeshes::DistributedMeshSynchronizer< MeshFunctionType >;
      DistributedMeshSynchronizerType synchronizer;

      const IndexType maxIterations;
    
      void setOverlaps( StaticVector& vecLowerOverlaps, StaticVector& vecUpperOverlaps,
@@ -170,6 +174,9 @@ class FastSweepingMethod< Meshes::Grid< 3, Real, Device, Index >, Communicator,
    
    protected:
      
      using DistributedMeshSynchronizerType = Meshes::DistributedMeshes::DistributedMeshSynchronizer< MeshFunctionType >;
      DistributedMeshSynchronizerType synchronizer;

      const IndexType maxIterations;
      
      void setOverlaps( StaticVector& vecLowerOverlaps, StaticVector& vecUpperOverlaps,
+3 −2
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ solve( const MeshPointer& mesh,
  IndexType iteration( 0 );
  InterfaceMapType interfaceMap = *interfaceMapPtr;
  MeshFunctionType aux = *auxPtr;
  aux.template synchronize< Communicator >(); //synchronize initialized overlaps
  synchronizer.setDistributedGrid( aux.getMesh().getDistributedMesh() );
  synchronizer.template synchronize< Communicator >( aux ); //synchronize initialized overlaps
  
  std::cout << "Calculating the values ..." << std::endl; 
  while( iteration < this->maxIterations )
@@ -364,7 +365,7 @@ solve( const MeshPointer& mesh,
      if( CommunicatorType::isDistributed() ){
        getInfoFromNeighbours( calculatedBefore, calculateMPIAgain, mesh );
       
        aux.template synchronize< Communicator >();
        synchronizer.template synchronize< Communicator >( aux );
      }
#endif
      if( !CommunicatorType::isDistributed() ) // If we start the solver without MPI, we need calculated 0!
+3 −2
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ solve( const MeshPointer& mesh,
  IndexType iteration( 0 );
  MeshFunctionType aux = *auxPtr;
  InterfaceMapType interfaceMap = * interfaceMapPtr;
  aux.template synchronize< Communicator >(); //synchronization of intial conditions
  synchronizer.setDistributedGrid( aux.getMesh().getDistributedMesh() );
  synchronizer.template synchronize< Communicator >( aux ); //synchronization of intial conditions
  
  while( iteration < this->maxIterations )
  {
@@ -355,7 +356,7 @@ solve( const MeshPointer& mesh,
        getInfoFromNeighbours( calculatedBefore, calculateMPIAgain, mesh );

        // synchronizate the overlaps 
        aux.template synchronize< Communicator >();
        synchronizer.template synchronize< Communicator >( aux );

      }
#endif
Loading