Skip to content
Snippets Groups Projects
UniqueBorderPartitionTest.cpp 1.05 KiB
Newer Older
  • Learn to ignore specific revisions
  • #include <amdis/AMDiS.hpp>
    #include <amdis/utility/UniqueBorderPartition.hpp>
    
    #include <dune/grid/yaspgrid.hh>
    
    #include "Tests.hpp"
    
    using namespace AMDiS;
    
    template <class GridView>
    void test(GridView const& gv)
    {
      using Grid = typename GridView::Grid;
      using DataHandle = UniqueBorderPartitionDataHandle<Grid>;
    
      using EntitySet = typename DataHandle::EntitySet;
      EntitySet borderEntities;
    
      DataHandle handle(gv.comm().rank(), borderEntities, gv.grid().globalIdSet());
      gv.communicate(handle,
        Dune::InterfaceType::InteriorBorder_InteriorBorder_Interface,
        Dune::CommunicationDirection::ForwardCommunication);
    
      msg("#borderEntities = {}", borderEntities.size());
    }
    
    int main(int argc, char** argv)
    {
      Environment env(argc, argv);
    
    
      Dune::YaspGrid<2> grid1({1.0, 1.0}, {8,8}, 0, 0); // no overlap
      Dune::YaspGrid<2> grid2({1.0, 1.0}, {8,8}, 0, 1); // overlap = 1
      Dune::YaspGrid<3> grid3({1.0, 1.0, 1.0}, {8,8,8}, 0, 1); // overlap = 1
    
    
      test(grid1.leafGridView());
      test(grid2.leafGridView());
      test(grid3.leafGridView());
    
      return report_errors();
    }