1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 // vi: set et ts=4 sw=2 sts=2: 3 4 #include <config.h> 5 6 #include <dune/common/parallel/indexset.hh> 7 #include <dune/common/parallel/plocalindex.hh> 8 #include <dune/common/parallel/mpihelper.hh> 9 #include <iostream> 10 #include "buildindexset.hh" 11 #include "reverse.hh" 12 main(int argc,char ** argv)13int main(int argc, char **argv) 14 { 15 // This is a parallel programm so we need to 16 // initialize mpi first. 17 Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv); 18 19 // The rank of our process 20 int rank = helper.rank(); 21 22 // The type used as the global index 23 typedef int GlobalIndex; 24 25 // The index set we use to identify the local indices with the globally 26 // unique ones 27 typedef Dune::ParallelIndexSet<GlobalIndex,LocalIndex,100> ParallelIndexSet; 28 29 // The index set 30 ParallelIndexSet indexSet; 31 32 build(helper, indexSet); 33 34 // Print the index set 35 std::cout<<indexSet<<std::endl; 36 37 38 reverseLocalIndex(indexSet); 39 40 // Print the index set 41 if(rank==0) 42 std::cout<<"Reordered lcoal indices:"<<std::endl; 43 44 // Wait for all processes 45 helper.getCommunication().barrier(); 46 47 std::cout<<indexSet<<std::endl; 48 // Assign new local indices 49 50 return 0; 51 } 52