Commit e21b28af authored by Vít Hanousek's avatar Vít Hanousek Committed by Jakub Klinkovský
Browse files

Issue #15 - FIX synchronizer by refactorization - doesnt work, do to

bad interpretation of lower and upper overlap.
parent a1f8dd04
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <TNL/Devices/Host.h>
#include <TNL/Devices/Cuda.h>
#include <TNL/ParallelFor.h>
#include <TNL/Containers/StaticVector.h>

namespace TNL {
namespace Meshes { 
@@ -43,10 +44,14 @@ class BufferEntitiesHelper< MeshFunctionType, MaskPointer, 1, RealType, Device,
         const MaskPointer& maskPointer,
         RealType* buffer,
         bool isBoundary,
         const Index& beginx,
         const Index& sizex,
         const Containers::StaticVector<1,Index>& begin,
         const Containers::StaticVector<1,Index>& size,
         bool tobuffer )
      {

         Index beginx=begin.x();
         Index sizex=size.x();

         auto mesh = meshFunction.getMesh();
         RealType* meshFunctionData = meshFunction.getData().getData();
         const typename MaskPointer::ObjectType* mask( nullptr );
@@ -83,12 +88,16 @@ class BufferEntitiesHelper< MeshFunctionType, MaskPointer, 2, RealType, Device,
         const MaskPointer& maskPointer,
         RealType* buffer,
         bool isBoundary,
         const Index& beginx,
         const Index& beginy,
         const Index& sizex,
         const Index& sizey,
         const Containers::StaticVector<2,Index>& begin,
         const Containers::StaticVector<2,Index>& size,
         bool tobuffer)
      {

         Index beginx=begin.x();
         Index beginy=begin.y();
         Index sizex=size.x();
         Index sizey=size.y();

         auto mesh=meshFunction.getMesh();
         RealType* meshFunctionData = meshFunction.getData().getData();      
         const typename MaskPointer::ObjectType* mask( nullptr );
@@ -127,15 +136,18 @@ class BufferEntitiesHelper< MeshFunctionType, MaskPointer, 3, RealType, Device,
         const MaskPointer& maskPointer,
         RealType* buffer,
         bool isBoundary,
         const Index& beginx,
         const Index& beginy,
         const Index& beginz,
         const Index& sizex,
         const Index& sizey,
         const Index& sizez,
         const Containers::StaticVector<3,Index>& begin,
         const Containers::StaticVector<3,Index>& size,
         bool tobuffer)
      {

         Index beginx=begin.x();
         Index beginy=begin.y();
         Index beginz=begin.z();
         Index sizex=size.x();
         Index sizey=size.y();
         Index sizez=size.z();

         auto mesh=meshFunction.getMesh();
         RealType * meshFunctionData=meshFunction.getData().getData();
         const typename MaskPointer::ObjectType* mask( nullptr );
+2 −2
Original line number Diff line number Diff line
@@ -10,6 +10,6 @@

#pragma once

#include <TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer_1D.h>
#include <TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer_2D.h>
//#include <TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer_1D.h>
//#include <TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer_2D.h>
#include <TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer_3D.h>
+111 −205

File changed.

Preview size limit exceeded, changes collapsed.

+8 −7
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ class DistributedGridTest_1D : public ::testing::Test
         delete distributedGrid;
      }
};

/*
TEST_F( DistributedGridTest_1D, isBoundaryDomainTest )
{
   if( rank == 0 || rank == nproc - 1 )
@@ -209,20 +209,21 @@ TEST_F(DistributedGridTest_1D, evaluateInteriorEntities)
   check_Overlap_1D(rank, nproc, dof, -1);
   check_Inner_1D(rank, nproc, dof, rank);
}    

*/
TEST_F(DistributedGridTest_1D, SynchronizerNeighborsTest )
{
   setDof_1D(dof,-1);
   constFunctionEvaluator.evaluateAllEntities( meshFunctionPtr , constFunctionPtr );
   meshFunctionPtr->template synchronize<CommunicatorType>();

   std::cout << rank << dof << std::endl;

   if(rank!=0)
      EXPECT_EQ((dof)[0],rank-1)<< "Left Overlap was filled by wrong process.";
   if(rank!=nproc-1)
      EXPECT_EQ((dof)[dof.getSize()-1],rank+1)<< "Right Overlap was filled by wrong process.";
}


/*
TEST_F(DistributedGridTest_1D, EvaluateLinearFunction )
{
   //fill mesh function with linear function (physical center of cell corresponds with its coordinates in grid) 
@@ -237,9 +238,9 @@ TEST_F(DistributedGridTest_1D, EvaluateLinearFunction )
   auto entity2= gridptr->template getEntity< Cell >((dof).getSize()-1);
   entity2.refresh();
   EXPECT_EQ(meshFunctionPtr->getValue(entity), (*linearFunctionPtr)(entity)) << "Linear function Overlap error on right Edge.";
}

}*/

/*
TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithoutMask )
{
   // Setup periodic boundaries
@@ -374,7 +375,7 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicBoundariesLinearTest )
   if( rank == nproc - 1 )
      EXPECT_EQ( meshFunctionPtr->getValue(entity2), -1 ) << "Linear function Overlap error on right Edge.";
}

*/


#else
+2 −2
Original line number Diff line number Diff line
@@ -663,7 +663,7 @@ class DistributedGirdTest_3D : public ::testing::Test
         delete distributedGrid;
      }
};

/*
TEST_F(DistributedGirdTest_3D, evaluateAllEntities)
{

@@ -695,7 +695,7 @@ TEST_F(DistributedGirdTest_3D, evaluateInteriorEntities)
    check_Boundary_3D(rank, *gridptr, *dof, -1);
    check_Overlap_3D(rank, *gridptr, *dof, -1);
    check_Inner_3D(rank, *gridptr, *dof, rank);
}   
}   */

TEST_F(DistributedGirdTest_3D, LinearFunctionTest)
{