23 #include <dolfin/common/MPI.h> 62 void init(std::size_t local_size, std::size_t block_size);
65 std::pair<std::size_t, std::size_t>
local_range()
const;
104 std::vector<std::size_t> _all_ranges;
107 std::vector<std::size_t> _local_to_global;
110 std::vector<int> _off_process_owner;
122 const std::size_t local_size =
size(IndexMap::MapSize::OWNED);
123 const std::size_t global_offset =
local_range().first;
126 return (i + global_offset);
129 const std::div_t div = std::div((i - local_size), _block_size);
130 const int component = div.rem;
131 const int index = div.quot;
132 dolfin_assert((std::size_t) index < _local_to_global.size());
133 return _block_size*_local_to_global[index] + component;
const std::vector< std::size_t > & local_to_global_unowned() const
Definition: IndexMap.cpp:107
int block_size() const
Get block size.
Definition: IndexMap.cpp:137
void set_local_to_global(const std::vector< std::size_t > &indices)
Definition: IndexMap.cpp:112
Definition: IndexMap.h:35
MPI_Comm mpi_comm() const
Return MPI communicator.
Definition: IndexMap.cpp:142
int global_index_owner(std::size_t index) const
Get process owner of any global index.
Definition: IndexMap.cpp:124
const std::vector< int > & off_process_owner() const
Get off process owner for unowned indices.
Definition: IndexMap.cpp:132
~IndexMap()
Destructor.
Definition: IndexMap.cpp:44
std::size_t local_to_global(std::size_t i) const
Get global index of local index i.
Definition: IndexMap.h:118
void init(std::size_t local_size, std::size_t block_size)
Definition: IndexMap.cpp:49
std::size_t size(MapSize type) const
Definition: IndexMap.cpp:77
MapSize
Definition: IndexMap.h:42
IndexMap()
Constructor.
Definition: IndexMap.cpp:25
std::pair< std::size_t, std::size_t > local_range() const
Local range of indices.
Definition: IndexMap.cpp:63