[go: up one dir, main page]

File: indexset.cc

package info (click to toggle)
dune-common 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,100 kB
  • ctags: 3,915
  • sloc: cpp: 22,677; sh: 2,396; python: 656; makefile: 604
file content (55 lines) | stat: -rw-r--r-- 1,367 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id: indexset.cc 1728 2012-11-06 13:06:44Z christi $

#include "config.h"

#include <dune/common/parallel/indexset.hh>
#include <dune/common/parallel/plocalindex.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <iostream>
#include "buildindexset.hh"
#include "reverse.hh"

int main(int argc, char **argv)
{
  // This is a parallel programm so we need to
  // initialize mpi first.
  Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv);

  // The rank of our process
  int rank = helper.rank();

  // The type used as the local index
  typedef Dune::ParallelLocalIndex<Flag> LocalIndex;

  // The type used as the global index
  typedef int GlobalIndex;

  // The index set we use to identify the local indices with the globally
  // unique ones
  typedef Dune::ParallelIndexSet<GlobalIndex,LocalIndex,100> ParallelIndexSet;

  // The index set
  ParallelIndexSet indexSet;

  build(helper, indexSet);

  // Print the index set
  std::cout<<indexSet<<std::endl;


  reverseLocalIndex(indexSet);

  // Print the index set
  if(rank==0)
    std::cout<<"Reordered lcoal indices:"<<std::endl;

  // Wait for all processes
  helper.getCollectiveCommunication().barrier();

  std::cout<<indexSet<<std::endl;
  // Assign new local indices

  return 0;
}