24#ifdef DEAL_II_WITH_TRILINOS
25# ifdef DEAL_II_WITH_MPI
26# include <Epetra_MpiComm.h>
28# include <Epetra_Map.h>
29# include <Epetra_SerialComm.h>
36#ifdef DEAL_II_WITH_TRILINOS
41# ifdef DEAL_II_WITH_64BIT_INDICES
46 , largest_range(
numbers::invalid_unsigned_int)
48 Assert(map.MinAllGID64() == 0,
50 "The Epetra_BlockMap does not contain the global index 0, "
51 "which means some entries are not present on any processor."));
60 reinterpret_cast<size_type *
>(map.MyGlobalElements64());
61 add_indices(indices, indices +
n_indices);
73 , largest_range(
numbers::invalid_unsigned_int)
75 Assert(map.MinAllGID() == 0,
77 "The Epetra_BlockMap does not contain the global index 0, "
78 "which means some entries are not present on any processor."));
86 unsigned int * indices =
87 reinterpret_cast<unsigned int *
>(map.MyGlobalElements());
113 std::vector<Range>::iterator store =
ranges.begin();
114 for (std::vector<Range>::iterator i =
ranges.begin(); i !=
ranges.end();)
116 std::vector<Range>::iterator next = i;
135 if (store !=
ranges.end())
143 for (std::vector<Range>::iterator i =
ranges.begin(); i !=
ranges.end(); ++i)
147 i->nth_index_in_set = next_index;
148 next_index += (i->end - i->begin);
217 ExcMessage(
"End index needs to be larger or equal to begin index!"));
259 sum += partition.size();
340 for (
const auto el : *
this)
353 "pop_back() failed, because this IndexSet contains no entries."));
371 "pop_front() failed, because this IndexSet contains no entries."));
399 boost::container::small_vector<std::pair<size_type, size_type>, 200>
419 tmp_set.add_range(i.first, i.second);
423 if (this->
ranges.size() <= 1)
425 if (this->
ranges.size() == 1)
442 if ((
this == &
other) && (offset == 0))
497 out <<
size() <<
" ";
498 out <<
ranges.size() << std::endl;
499 std::vector<Range>::const_iterator r =
ranges.begin();
500 for (; r !=
ranges.end(); ++r)
502 out << r->begin <<
" " << r->end << std::endl;
519 for (
unsigned int i = 0; i <
n_ranges; ++i)
538 if (
ranges.empty() ==
false)
539 out.write(
reinterpret_cast<const char *
>(&*
ranges.begin()),
549 in.read(
reinterpret_cast<char *
>(&
size),
sizeof(
size));
556 in.read(
reinterpret_cast<char *
>(&*
ranges.begin()),
579 std::vector<Range>::const_iterator p = std::upper_bound(
587 return ((index >= p->begin) && (index < p->end));
595 return (p->end > index);
612 return p->begin + (n - p->nth_index_in_set);
624 std::vector<Range>::const_iterator p =
628 if (p ==
ranges.end() || p->end == n || p->begin > n)
634 return (n - p->begin) + p->nth_index_in_set;
648 std::vector<Range>::const_iterator
main_range =
651 Range r(global_index, global_index + 1);
668 const std::vector<Range>::const_iterator p =
684 return {
this,
static_cast<size_type>(p -
ranges.begin()), global_index};
689std::vector<IndexSet::size_type>
694 std::vector<size_type> indices;
699 indices.push_back(entry);
716#ifdef DEAL_II_WITH_TRILINOS
717# ifdef DEAL_II_TRILINOS_WITH_TPETRA
732 ExcMessage(
"You are trying to create an Tpetra::Map object "
733 "that partitions elements of an index set "
734 "between processors. However, the union of the "
735 "index sets on different processors does not "
736 "contain all indices exactly once: the sum of "
737 "the number of entries the various processors "
738 "want to store locally is " +
739 std::to_string(n_global_elements) +
740 " whereas the total size of the object to be "
742 std::to_string(
size()) +
743 ". In other words, there are "
744 "either indices that are not spoken for "
745 "by any processor, or there are indices that are "
746 "claimed by multiple processors."));
768 std::vector<types::signed_global_dof_index>
int_indices(indices.size());
801 ExcMessage(
"You are trying to create an Epetra_Map object "
802 "that partitions elements of an index set "
803 "between processors. However, the union of the "
804 "index sets on different processors does not "
805 "contain all indices exactly once: the sum of "
806 "the number of entries the various processors "
807 "want to store locally is " +
808 std::to_string(n_global_elements) +
809 " whereas the total size of the object to be "
811 std::to_string(
size()) +
812 ". In other words, there are "
813 "either indices that are not spoken for "
814 "by any processor, or there are indices that are "
815 "claimed by multiple processors."));
829 Epetra_MpiComm(communicator)
846 Epetra_MpiComm(communicator)
856#ifdef DEAL_II_WITH_PETSC
860 std::vector<size_type> indices;
863 PetscInt n = indices.size();
864 std::vector<PetscInt>
pindices(indices.begin(), indices.end());
884 if (n_global_elements !=
size())
887 if (n_global_elements == 0)
890#ifdef DEAL_II_WITH_MPI
904 const std::vector<types::global_dof_index>
global_dofs =
value_type * data() const noexcept
bool is_element_binary_search(const size_type local_index) const
size_type index_within_set_binary_search(const size_type global_index) const
IS make_petsc_is(const MPI_Comm communicator=MPI_COMM_WORLD) const
bool is_ascending_and_one_to_one(const MPI_Comm communicator) const
bool is_contiguous() const
ElementIterator at(const size_type global_index) const
void fill_index_vector(std::vector< size_type > &indices) const
std::vector< IndexSet > split_by_block(const std::vector< types::global_dof_index > &n_indices_per_block) const
size_type n_elements() const
void add_range_lower_bound(const Range &range)
ElementIterator begin() const
void set_size(const size_type size)
void read(std::istream &in)
Epetra_Map make_trilinos_map(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) const
IndexSet tensor_product(const IndexSet &other) const
void write(std::ostream &out) const
void block_read(std::istream &in)
void add_ranges_internal(boost::container::small_vector< std::pair< size_type, size_type >, 200 > &tmp_ranges, const bool ranges_are_sorted)
IntervalIterator begin_intervals() const
Tpetra::Map< int, types::signed_global_dof_index > make_tpetra_map(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) const
std::vector< Range > ranges
void subtract_set(const IndexSet &other)
ElementIterator end() const
Threads::Mutex compress_mutex
size_type index_space_size
void block_write(std::ostream &out) const
IndexSet get_view(const size_type begin, const size_type end) const
void add_range(const size_type begin, const size_type end)
std::size_t memory_consumption() const
size_type nth_index_in_set_binary_search(const size_type local_index) const
std::vector< size_type > get_index_vector() const
types::global_dof_index size_type
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
IndexSet operator&(const IndexSet &is) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIO()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
types::global_dof_index size_type
std::enable_if_t< std::is_fundamental< T >::value, std::size_t > memory_consumption(const T &t)
T sum(const T &t, const MPI_Comm mpi_communicator)
T min(const T &t, const MPI_Comm mpi_communicator)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
std::vector< T > gather(const MPI_Comm comm, const T &object_to_send, const unsigned int root_process=0)
std::string compress(const std::string &input)
Iterator lower_bound(Iterator first, Iterator last, const T &val)
const types::global_dof_index invalid_dof_index
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
static bool end_compare(const IndexSet::Range &x, const IndexSet::Range &y)
static bool nth_index_compare(const IndexSet::Range &x, const IndexSet::Range &y)
size_type nth_index_in_set