Reference documentation for deal.II version Git 497f915867 2021-09-17 22:46:48 +0200
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
index_set.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2005 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/base/index_set.h>
18 #include <deal.II/base/mpi.h>
19 
20 #include <vector>
21 
22 #ifdef DEAL_II_WITH_TRILINOS
23 # ifdef DEAL_II_WITH_MPI
24 # include <Epetra_MpiComm.h>
25 # endif
26 # include <Epetra_Map.h>
27 # include <Epetra_SerialComm.h>
28 #endif
29 
31 
32 
33 
34 #ifdef DEAL_II_WITH_TRILINOS
35 
36 // the 64-bit path uses a few different names, so put that into a separate
37 // implementation
38 
39 # ifdef DEAL_II_WITH_64BIT_INDICES
40 
41 IndexSet::IndexSet(const Epetra_BlockMap &map)
42  : is_compressed(true)
43  , index_space_size(1 + map.MaxAllGID64())
44  , largest_range(numbers::invalid_unsigned_int)
45 {
46  Assert(map.MinAllGID64() == 0,
47  ExcMessage(
48  "The Epetra_BlockMap does not contain the global index 0, "
49  "which means some entries are not present on any processor."));
50 
51  // For a contiguous map, we do not need to go through the whole data...
52  if (map.LinearMap())
53  add_range(size_type(map.MinMyGID64()), size_type(map.MaxMyGID64() + 1));
54  else
55  {
56  const size_type n_indices = map.NumMyElements();
57  size_type * indices =
58  reinterpret_cast<size_type *>(map.MyGlobalElements64());
59  add_indices(indices, indices + n_indices);
60  }
61  compress();
62 }
63 
64 # else
65 
66 // this is the standard 32-bit implementation
67 
68 IndexSet::IndexSet(const Epetra_BlockMap &map)
69  : is_compressed(true)
70  , index_space_size(1 + map.MaxAllGID())
71  , largest_range(numbers::invalid_unsigned_int)
72 {
73  Assert(map.MinAllGID() == 0,
74  ExcMessage(
75  "The Epetra_BlockMap does not contain the global index 0, "
76  "which means some entries are not present on any processor."));
77 
78  // For a contiguous map, we do not need to go through the whole data...
79  if (map.LinearMap())
80  add_range(size_type(map.MinMyGID()), size_type(map.MaxMyGID() + 1));
81  else
82  {
83  const size_type n_indices = map.NumMyElements();
84  unsigned int * indices =
85  reinterpret_cast<unsigned int *>(map.MyGlobalElements());
86  add_indices(indices, indices + n_indices);
87  }
88  compress();
89 }
90 
91 # endif
92 
93 #endif // ifdef DEAL_II_WITH_TRILINOS
94 
95 
96 
97 void
99 {
100  // we will, in the following, modify mutable variables. this can only
101  // work in multithreaded applications if we lock the data structures
102  // via a mutex, so that users can call 'const' functions from threads
103  // in parallel (and these 'const' functions can then call compress()
104  // which itself calls the current function)
105  std::lock_guard<std::mutex> lock(compress_mutex);
106 
107  // see if any of the contiguous ranges can be merged. do not use
108  // std::vector::erase in-place as it is quadratic in the number of
109  // ranges. since the ranges are sorted by their first index, determining
110  // overlap isn't all that hard
111  std::vector<Range>::iterator store = ranges.begin();
112  for (std::vector<Range>::iterator i = ranges.begin(); i != ranges.end();)
113  {
114  std::vector<Range>::iterator next = i;
115  ++next;
116 
117  size_type first_index = i->begin;
118  size_type last_index = i->end;
119 
120  // see if we can merge any of the following ranges
121  while (next != ranges.end() && (next->begin <= last_index))
122  {
123  last_index = std::max(last_index, next->end);
124  ++next;
125  }
126  i = next;
127 
128  // store the new range in the slot we last occupied
129  *store = Range(first_index, last_index);
130  ++store;
131  }
132  // use a compact array with exactly the right amount of storage
133  if (store != ranges.end())
134  {
135  std::vector<Range> new_ranges(ranges.begin(), store);
136  ranges.swap(new_ranges);
137  }
138 
139  // now compute indices within set and the range with most elements
140  size_type next_index = 0, largest_range_size = 0;
141  for (std::vector<Range>::iterator i = ranges.begin(); i != ranges.end(); ++i)
142  {
143  Assert(i->begin < i->end, ExcInternalError());
144 
145  i->nth_index_in_set = next_index;
146  next_index += (i->end - i->begin);
147  if (i->end - i->begin > largest_range_size)
148  {
149  largest_range_size = i->end - i->begin;
150  largest_range = i - ranges.begin();
151  }
152  }
153  is_compressed = true;
154 
155  // check that next_index is correct. needs to be after the previous
156  // statement because we otherwise will get into an endless loop
157  Assert(next_index == n_elements(), ExcInternalError());
158 }
159 
160 
161 
162 #ifndef DOXYGEN
163 IndexSet
164 IndexSet::operator&(const IndexSet &is) const
165 {
166  Assert(size() == is.size(), ExcDimensionMismatch(size(), is.size()));
167 
168  compress();
169  is.compress();
170 
171  std::vector<Range>::const_iterator r1 = ranges.begin(),
172  r2 = is.ranges.begin();
173  IndexSet result(size());
174 
175  while ((r1 != ranges.end()) && (r2 != is.ranges.end()))
176  {
177  // if r1 and r2 do not overlap at all, then move the pointer that sits
178  // to the left of the other up by one
179  if (r1->end <= r2->begin)
180  ++r1;
181  else if (r2->end <= r1->begin)
182  ++r2;
183  else
184  {
185  // the ranges must overlap somehow
186  Assert(((r1->begin <= r2->begin) && (r1->end > r2->begin)) ||
187  ((r2->begin <= r1->begin) && (r2->end > r1->begin)),
188  ExcInternalError());
189 
190  // add the overlapping range to the result
191  result.add_range(std::max(r1->begin, r2->begin),
192  std::min(r1->end, r2->end));
193 
194  // now move that iterator that ends earlier one up. note that it has
195  // to be this one because a subsequent range may still have a chance
196  // of overlapping with the range that ends later
197  if (r1->end <= r2->end)
198  ++r1;
199  else
200  ++r2;
201  }
202  }
203 
204  result.compress();
205  return result;
206 }
207 #endif
208 
209 
210 
211 IndexSet
213 {
214  Assert(begin <= end,
215  ExcMessage("End index needs to be larger or equal to begin index!"));
216  Assert(end <= size(), ExcMessage("Given range exceeds index set dimension"));
217 
218  IndexSet result(end - begin);
219  std::vector<Range>::const_iterator r1 = ranges.begin();
220 
221  while (r1 != ranges.end())
222  {
223  if ((r1->end > begin) && (r1->begin < end))
224  {
225  result.add_range(std::max(r1->begin, begin) - begin,
226  std::min(r1->end, end) - begin);
227  }
228  else if (r1->begin >= end)
229  break;
230 
231  ++r1;
232  }
233 
234  result.compress();
235  return result;
236 }
237 
238 std::vector<IndexSet>
240  const std::vector<types::global_dof_index> &n_indices_per_block) const
241 {
242  std::vector<IndexSet> partitioned;
243  const unsigned int n_blocks = n_indices_per_block.size();
244 
245  partitioned.reserve(n_blocks);
246  types::global_dof_index start = 0;
247  for (const auto n_block_indices : n_indices_per_block)
248  {
249  partitioned.push_back(this->get_view(start, start + n_block_indices));
250  start += n_block_indices;
251  }
252 
253 #ifdef DEBUG
255  for (const auto &partition : partitioned)
256  {
257  sum += partition.size();
258  }
259  AssertDimension(sum, this->size());
260 #endif
261 
262  return partitioned;
263 }
264 
265 void
267 {
268  compress();
269  other.compress();
270  is_compressed = false;
271 
272 
273  // we save new ranges to be added to our IndexSet in an temporary vector and
274  // add all of them in one go at the end.
275  std::vector<Range> new_ranges;
276 
277  std::vector<Range>::iterator own_it = ranges.begin();
278  std::vector<Range>::iterator other_it = other.ranges.begin();
279 
280  while (own_it != ranges.end() && other_it != other.ranges.end())
281  {
282  // advance own iterator until we get an overlap
283  if (own_it->end <= other_it->begin)
284  {
285  ++own_it;
286  continue;
287  }
288  // we are done with other_it, so advance
289  if (own_it->begin >= other_it->end)
290  {
291  ++other_it;
292  continue;
293  }
294 
295  // Now own_it and other_it overlap. First save the part of own_it that
296  // is before other_it (if not empty).
297  if (own_it->begin < other_it->begin)
298  {
299  Range r(own_it->begin, other_it->begin);
300  r.nth_index_in_set = 0; // fix warning of unused variable
301  new_ranges.push_back(r);
302  }
303  // change own_it to the sub range behind other_it. Do not delete own_it
304  // in any case. As removal would invalidate iterators, we just shrink
305  // the range to an empty one.
306  own_it->begin = other_it->end;
307  if (own_it->begin > own_it->end)
308  {
309  own_it->begin = own_it->end;
310  ++own_it;
311  }
312 
313  // continue without advancing iterators, the right one will be advanced
314  // next.
315  }
316 
317  // Now delete all empty ranges we might
318  // have created.
319  for (std::vector<Range>::iterator it = ranges.begin(); it != ranges.end();)
320  {
321  if (it->begin >= it->end)
322  it = ranges.erase(it);
323  else
324  ++it;
325  }
326 
327  // done, now add the temporary ranges
328  const std::vector<Range>::iterator end = new_ranges.end();
329  for (std::vector<Range>::iterator it = new_ranges.begin(); it != end; ++it)
330  add_range(it->begin, it->end);
331 
332  compress();
333 }
334 
335 
336 
337 IndexSet
339 {
340  IndexSet set(this->size() * other.size());
341  for (const auto el : *this)
342  set.add_indices(other, el * other.size());
343  set.compress();
344  return set;
345 }
346 
347 
348 
351 {
352  Assert(is_empty() == false,
353  ExcMessage(
354  "pop_back() failed, because this IndexSet contains no entries."));
355 
356  const size_type index = ranges.back().end - 1;
357  --ranges.back().end;
358 
359  if (ranges.back().begin == ranges.back().end)
360  ranges.pop_back();
361 
362  return index;
363 }
364 
365 
366 
369 {
370  Assert(is_empty() == false,
371  ExcMessage(
372  "pop_front() failed, because this IndexSet contains no entries."));
373 
374  const size_type index = ranges.front().begin;
375  ++ranges.front().begin;
376 
377  if (ranges.front().begin == ranges.front().end)
378  ranges.erase(ranges.begin());
379 
380  // We have to set this in any case, because nth_index_in_set is no longer
381  // up to date for all but the first range
382  is_compressed = false;
383 
384  return index;
385 }
386 
387 
388 
389 void
390 IndexSet::add_indices(const IndexSet &other, const size_type offset)
391 {
392  if ((this == &other) && (offset == 0))
393  return;
394 
395  if (other.ranges.size() != 0)
396  {
397  AssertIndexRange(other.ranges.back().end - 1, index_space_size);
398  }
399 
400  compress();
401  other.compress();
402 
403  std::vector<Range>::const_iterator r1 = ranges.begin(),
404  r2 = other.ranges.begin();
405 
406  std::vector<Range> new_ranges;
407  // just get the start and end of the ranges right in this method, everything
408  // else will be done in compress()
409  while (r1 != ranges.end() || r2 != other.ranges.end())
410  {
411  // the two ranges do not overlap or we are at the end of one of the
412  // ranges
413  if (r2 == other.ranges.end() ||
414  (r1 != ranges.end() && r1->end < (r2->begin + offset)))
415  {
416  new_ranges.push_back(*r1);
417  ++r1;
418  }
419  else if (r1 == ranges.end() || (r2->end + offset) < r1->begin)
420  {
421  new_ranges.emplace_back(r2->begin + offset, r2->end + offset);
422  ++r2;
423  }
424  else
425  {
426  // ok, we do overlap, so just take the combination of the current
427  // range (do not bother to merge with subsequent ranges)
428  Range next(std::min(r1->begin, r2->begin + offset),
429  std::max(r1->end, r2->end + offset));
430  new_ranges.push_back(next);
431  ++r1;
432  ++r2;
433  }
434  }
435  ranges.swap(new_ranges);
436 
437  is_compressed = false;
438  compress();
439 }
440 
441 
442 
443 void
444 IndexSet::write(std::ostream &out) const
445 {
446  compress();
447  out << size() << " ";
448  out << ranges.size() << std::endl;
449  std::vector<Range>::const_iterator r = ranges.begin();
450  for (; r != ranges.end(); ++r)
451  {
452  out << r->begin << " " << r->end << std::endl;
453  }
454 }
455 
456 
457 
458 void
459 IndexSet::read(std::istream &in)
460 {
461  AssertThrow(in, ExcIO());
462 
463  size_type s;
464  unsigned int n_ranges;
465 
466  in >> s >> n_ranges;
467  ranges.clear();
468  set_size(s);
469  for (unsigned int i = 0; i < n_ranges; ++i)
470  {
471  AssertThrow(in, ExcIO());
472 
473  size_type b, e;
474  in >> b >> e;
475  add_range(b, e);
476  }
477 }
478 
479 
480 void
481 IndexSet::block_write(std::ostream &out) const
482 {
483  AssertThrow(out, ExcIO());
484  out.write(reinterpret_cast<const char *>(&index_space_size),
485  sizeof(index_space_size));
486  std::size_t n_ranges = ranges.size();
487  out.write(reinterpret_cast<const char *>(&n_ranges), sizeof(n_ranges));
488  if (ranges.empty() == false)
489  out.write(reinterpret_cast<const char *>(&*ranges.begin()),
490  ranges.size() * sizeof(Range));
491  AssertThrow(out, ExcIO());
492 }
493 
494 void
495 IndexSet::block_read(std::istream &in)
496 {
497  size_type size;
498  std::size_t n_ranges;
499  in.read(reinterpret_cast<char *>(&size), sizeof(size));
500  in.read(reinterpret_cast<char *>(&n_ranges), sizeof(n_ranges));
501  // we have to clear ranges first
502  ranges.clear();
503  set_size(size);
504  ranges.resize(n_ranges, Range(0, 0));
505  if (n_ranges)
506  in.read(reinterpret_cast<char *>(&*ranges.begin()),
507  ranges.size() * sizeof(Range));
508 
509  do_compress(); // needed so that largest_range can be recomputed
510 }
511 
512 
513 
514 void
515 IndexSet::fill_index_vector(std::vector<size_type> &indices) const
516 {
517  compress();
518 
519  indices.clear();
520  indices.reserve(n_elements());
521 
522  for (const auto &range : ranges)
523  for (size_type entry = range.begin; entry < range.end; ++entry)
524  indices.push_back(entry);
525 
526  Assert(indices.size() == n_elements(), ExcInternalError());
527 }
528 
529 
530 
531 #ifdef DEAL_II_WITH_TRILINOS
532 # ifdef DEAL_II_TRILINOS_WITH_TPETRA
533 
534 Tpetra::Map<int, types::global_dof_index>
536  const bool overlapping) const
537 {
538  compress();
539  (void)communicator;
540 
541 # ifdef DEBUG
542  if (!overlapping)
543  {
545  Utilities::MPI::sum(n_elements(), communicator);
546  Assert(n_global_elements == size(),
547  ExcMessage("You are trying to create an Tpetra::Map object "
548  "that partitions elements of an index set "
549  "between processors. However, the union of the "
550  "index sets on different processors does not "
551  "contain all indices exactly once: the sum of "
552  "the number of entries the various processors "
553  "want to store locally is " +
554  std::to_string(n_global_elements) +
555  " whereas the total size of the object to be "
556  "allocated is " +
557  std::to_string(size()) +
558  ". In other words, there are "
559  "either indices that are not spoken for "
560  "by any processor, or there are indices that are "
561  "claimed by multiple processors."));
562  }
563 # endif
564 
565  // Find out if the IndexSet is ascending and 1:1. This corresponds to a
566  // linear Tpetra::Map. Overlapping IndexSets are never 1:1.
567  const bool linear =
568  overlapping ? false : is_ascending_and_one_to_one(communicator);
569  if (linear)
570  return Tpetra::Map<int, types::global_dof_index>(
571  size(),
572  n_elements(),
573  0,
574 # ifdef DEAL_II_WITH_MPI
575  Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
576 # else
577  Teuchos::rcp(new Teuchos::Comm<int>())
578 # endif
579  );
580  else
581  {
582  std::vector<size_type> indices;
583  fill_index_vector(indices);
584  std::vector<types::global_dof_index> int_indices(indices.size());
585  std::copy(indices.begin(), indices.end(), int_indices.begin());
586  const Teuchos::ArrayView<types::global_dof_index> arr_view(int_indices);
587  return Tpetra::Map<int, types::global_dof_index>(
588  size(),
589  arr_view,
590  0,
591 # ifdef DEAL_II_WITH_MPI
592  Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
593 # else
594  Teuchos::rcp(new Teuchos::Comm<int>())
595 # endif
596  );
597  }
598 }
599 # endif
600 
601 
602 
603 Epetra_Map
605  const bool overlapping) const
606 {
607  compress();
608  (void)communicator;
609 
610 # ifdef DEBUG
611  if (!overlapping)
612  {
614  Utilities::MPI::sum(n_elements(), communicator);
615  Assert(n_global_elements == size(),
616  ExcMessage("You are trying to create an Epetra_Map object "
617  "that partitions elements of an index set "
618  "between processors. However, the union of the "
619  "index sets on different processors does not "
620  "contain all indices exactly once: the sum of "
621  "the number of entries the various processors "
622  "want to store locally is " +
623  std::to_string(n_global_elements) +
624  " whereas the total size of the object to be "
625  "allocated is " +
626  std::to_string(size()) +
627  ". In other words, there are "
628  "either indices that are not spoken for "
629  "by any processor, or there are indices that are "
630  "claimed by multiple processors."));
631  }
632 # endif
633 
634  // Find out if the IndexSet is ascending and 1:1. This corresponds to a
635  // linear EpetraMap. Overlapping IndexSets are never 1:1.
636  const bool linear =
637  overlapping ? false : is_ascending_and_one_to_one(communicator);
638 
639  if (linear)
640  return Epetra_Map(TrilinosWrappers::types::int_type(size()),
642  0,
643 # ifdef DEAL_II_WITH_MPI
644  Epetra_MpiComm(communicator)
645 # else
646  Epetra_SerialComm()
647 # endif
648  );
649  else
650  {
651  std::vector<size_type> indices;
652  fill_index_vector(indices);
653  return Epetra_Map(
656  (n_elements() > 0 ?
657  reinterpret_cast<TrilinosWrappers::types::int_type *>(
658  indices.data()) :
659  nullptr),
660  0,
661 # ifdef DEAL_II_WITH_MPI
662  Epetra_MpiComm(communicator)
663 # else
664  Epetra_SerialComm()
665 # endif
666  );
667  }
668 }
669 #endif
670 
671 
672 
673 bool
675 {
676  // If the sum of local elements does not add up to the total size,
677  // the IndexSet can't be complete.
679  Utilities::MPI::sum(n_elements(), communicator);
680  if (n_global_elements != size())
681  return false;
682 
683  if (n_global_elements == 0)
684  return true;
685 
686 #ifdef DEAL_II_WITH_MPI
687  // Non-contiguous IndexSets can't be linear.
688  const bool all_contiguous =
689  (Utilities::MPI::min(is_contiguous() ? 1 : 0, communicator) == 1);
690  if (!all_contiguous)
691  return false;
692 
693  bool is_globally_ascending = true;
694  // we know that there is only one interval
695  types::global_dof_index first_local_dof = (n_elements() > 0) ?
696  *(begin_intervals()->begin()) :
698 
699  const unsigned int my_rank = Utilities::MPI::this_mpi_process(communicator);
700  const std::vector<types::global_dof_index> global_dofs =
701  Utilities::MPI::gather(communicator, first_local_dof, 0);
702 
703  if (my_rank == 0)
704  {
705  // find out if the received std::vector is ascending
706  types::global_dof_index index = 0;
707  while (global_dofs[index] == numbers::invalid_dof_index)
708  ++index;
709  types::global_dof_index old_dof = global_dofs[index++];
710  for (; index < global_dofs.size(); ++index)
711  {
712  const types::global_dof_index new_dof = global_dofs[index];
713  if (new_dof != numbers::invalid_dof_index)
714  {
715  if (new_dof <= old_dof)
716  {
717  is_globally_ascending = false;
718  break;
719  }
720  else
721  old_dof = new_dof;
722  }
723  }
724  }
725 
726  // now broadcast the result
727  int is_ascending = is_globally_ascending ? 1 : 0;
728  int ierr = MPI_Bcast(&is_ascending, 1, MPI_INT, 0, communicator);
729  AssertThrowMPI(ierr);
730 
731  return (is_ascending == 1);
732 #else
733  return true;
734 #endif // DEAL_II_WITH_MPI
735 }
736 
737 
738 
739 std::size_t
741 {
745  sizeof(compress_mutex));
746 }
747 
748 
749 
static const unsigned int invalid_unsigned_int
Definition: types.h:196
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1653
ElementIterator end() const
Definition: index_set.h:1585
types::global_dof_index size_type
Definition: cuda_kernels.h:45
static ::ExceptionBase & ExcIO()
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
void block_read(std::istream &in)
Definition: index_set.cc:495
#define AssertIndexRange(index, range)
Definition: exceptions.h:1718
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
Definition: index_set.h:1708
#define AssertThrow(cond, exc)
Definition: exceptions.h:1571
types::global_dof_index size_type
Definition: index_set.h:83
std::size_t memory_consumption() const
Definition: index_set.cc:740
size_type index_space_size
Definition: index_set.h:972
Tpetra::Map< int, types::global_dof_index > make_tpetra_map(const MPI_Comm &communicator=MPI_COMM_WORLD, const bool overlapping=false) const
Definition: index_set.cc:535
bool is_ascending_and_one_to_one(const MPI_Comm &communicator) const
Definition: index_set.cc:674
Epetra_Map make_trilinos_map(const MPI_Comm &communicator=MPI_COMM_WORLD, const bool overlapping=false) const
Definition: index_set.cc:604
size_type size() const
Definition: index_set.h:1639
static ::ExceptionBase & ExcMessage(std::string arg1)
void block_write(std::ostream &out) const
Definition: index_set.cc:481
std::vector< Range > ranges
Definition: index_set.h:956
std::string compress(const std::string &input)
Definition: utilities.cc:392
T sum(const T &t, const MPI_Comm &mpi_communicator)
void partition(const SparsityPattern &sparsity_pattern, const unsigned int n_partitions, std::vector< unsigned int > &partition_indices, const Partitioner partitioner=Partitioner::metis)
void subtract_set(const IndexSet &other)
Definition: index_set.cc:266
#define Assert(cond, exc)
Definition: exceptions.h:1461
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void do_compress() const
Definition: index_set.cc:98
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:401
std::vector< T > gather(const MPI_Comm &comm, const T &object_to_send, const unsigned int root_process=0)
std::string to_string(const T &t)
Definition: patterns.h:2329
std::enable_if< IsBlockVector< VectorType >::value, unsigned int >::type n_blocks(const VectorType &vector)
Definition: operators.h:50
IndexSet tensor_product(const IndexSet &other) const
Definition: index_set.cc:338
size_type pop_back()
Definition: index_set.cc:350
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
void fill_index_vector(std::vector< size_type > &indices) const
Definition: index_set.cc:515
void add_range(const size_type begin, const size_type end)
Definition: index_set.h:1678
TrilinosWrappers::types::int_type n_global_elements(const Epetra_BlockMap &map)
IndexSet operator &(const IndexSet &is) const
void set_size(const size_type size)
Definition: index_set.h:1627
std::vector< IndexSet > split_by_block(const std::vector< types::global_dof_index > &n_indices_per_block) const
Definition: index_set.cc:239
IndexSet get_view(const size_type begin, const size_type end) const
Definition: index_set.cc:212
void compress() const
Definition: index_set.h:1647
IntervalIterator begin_intervals() const
Definition: index_set.h:1594
#define AssertThrowMPI(error_code)
Definition: exceptions.h:1776
bool is_contiguous() const
Definition: index_set.h:1820
Threads::Mutex compress_mutex
Definition: index_set.h:989
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:400
T min(const T &t, const MPI_Comm &mpi_communicator)
size_type pop_front()
Definition: index_set.cc:368
bool is_compressed
Definition: index_set.h:966
ElementIterator begin() const
Definition: index_set.h:1078
unsigned int this_mpi_process(const MPI_Comm &mpi_communicator)
Definition: mpi.cc:128
void write(std::ostream &out) const
Definition: index_set.cc:444
const types::global_dof_index invalid_dof_index
Definition: types.h:211
ElementIterator begin() const
Definition: index_set.h:1523
void read(std::istream &in)
Definition: index_set.cc:459
size_type n_elements() const
Definition: index_set.h:1837
void copy(const T *begin, const T *end, U *dest)
bool is_empty() const
Definition: index_set.h:1829
size_type largest_range
Definition: index_set.h:983
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
size_type nth_index_in_set
Definition: index_set.h:884
static ::ExceptionBase & ExcInternalError()