Reference documentation for deal.II version 8.4.2
constraint_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2016 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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii__constraint_matrix_h
18 #define dealii__constraint_matrix_h
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/index_set.h>
23 #include <deal.II/base/subscriptor.h>
24 #include <deal.II/base/template_constraints.h>
25 #include <deal.II/base/thread_local_storage.h>
26 
27 #include <deal.II/lac/vector.h>
28 
29 #include <vector>
30 #include <map>
31 #include <set>
32 #include <utility>
33 #include <complex>
34 
35 
36 DEAL_II_NAMESPACE_OPEN
37 
38 template<int dim, class T> class Table;
39 template <typename> class FullMatrix;
40 class SparsityPattern;
44 template <typename number> class SparseMatrix;
45 template <typename number> class BlockSparseMatrix;
46 class BlockIndices;
47 
48 
49 namespace internals
50 {
51  class GlobalRowsFromLocal;
52 }
53 
54 
55 //TODO[WB]: We should have a function of the kind
56 // ConstraintMatrix::add_constraint (const size_type constrained_dof,
57 // const std::vector<std::pair<size_type, double> > &entries,
58 // const double inhomogeneity = 0);
59 // rather than building up constraints piecemeal through add_line/add_entry
60 // etc. This would also eliminate the possibility of accidentally changing
61 // existing constraints into something pointless, see the discussion on the
62 // mailing list on "Tiny bug in interpolate_boundary_values" in Sept. 2010.
63 
140 {
141 public:
146 
153  {
159 
166 
172  right_object_wins
173  };
174 
192  explicit ConstraintMatrix (const IndexSet &local_constraints = IndexSet());
193 
197  explicit ConstraintMatrix (const ConstraintMatrix &constraint_matrix);
198 
205  void reinit (const IndexSet &local_constraints = IndexSet());
206 
213  bool can_store_line (const size_type line_index) const;
214 
221  const IndexSet &get_local_lines() const;
222 
242  void add_selected_constraints (const ConstraintMatrix &constraints_in,
243  const IndexSet &filter);
244 
254  void add_line (const size_type line);
255 
268  void add_lines (const std::vector<bool> &lines);
269 
282  void add_lines (const std::set<size_type> &lines);
283 
296  void add_lines (const IndexSet &lines);
297 
309  void add_entry (const size_type line,
310  const size_type column,
311  const double value);
312 
318  void add_entries (const size_type line,
319  const std::vector<std::pair<size_type,double> > &col_val_pairs);
320 
327  void set_inhomogeneity (const size_type line,
328  const double value);
329 
350  void close ();
351 
368  void merge (const ConstraintMatrix &other_constraints,
369  const MergeConflictBehavior merge_conflict_behavior = no_conflicts_allowed);
370 
382  void shift (const size_type offset);
383 
391  void clear ();
392 
406  size_type n_constraints () const;
407 
417  bool is_constrained (const size_type index) const;
418 
430  bool is_identity_constrained (const size_type index) const;
431 
438  bool are_identity_constrained (const size_type index1,
439  const size_type index2) const;
440 
451  size_type max_constraint_indirections () const;
452 
457  bool is_inhomogeneously_constrained (const size_type index) const;
458 
464  bool has_inhomogeneities () const;
465 
470  const std::vector<std::pair<size_type,double> > *
471  get_constraint_entries (const size_type line) const;
472 
477  double get_inhomogeneity (const size_type line) const;
478 
487  void print (std::ostream &) const;
488 
501  void write_dot (std::ostream &) const;
502 
507  std::size_t memory_consumption () const;
508 
515  void resolve_indices(std::vector<types::global_dof_index> &indices) const;
516 
544  void condense (SparsityPattern &sparsity) const;
545 
549  void condense (BlockSparsityPattern &sparsity) const;
550 
555  void condense (DynamicSparsityPattern &sparsity) const;
556 
561  void condense (BlockDynamicSparsityPattern &sparsity) const;
562 
570  template<typename number>
571  void condense (SparseMatrix<number> &matrix) const;
572 
576  template <typename number>
577  void condense (BlockSparseMatrix<number> &matrix) const;
578 
590  template <class VectorType>
591  void condense (VectorType &vec) const;
592 
599  template <class VectorType>
600  void condense (const VectorType &vec_ghosted,
601  VectorType &output) const;
602 
615  template<typename number, class VectorType>
616  void condense (SparseMatrix<number> &matrix,
617  VectorType &vector) const;
618 
623  template <typename number, class BlockVectorType>
624  void condense (BlockSparseMatrix<number> &matrix,
625  BlockVectorType &vector) const;
626 
633  template <class VectorType>
634  void set_zero (VectorType &vec) const;
635 
687  template <class InVector, class OutVector>
688  void
689  distribute_local_to_global (const InVector &local_vector,
690  const std::vector<size_type> &local_dof_indices,
691  OutVector &global_vector) const;
692 
736  template <typename VectorType, typename LocalType>
737  void
738  distribute_local_to_global (const Vector<LocalType> &local_vector,
739  const std::vector<size_type> &local_dof_indices,
740  VectorType &global_vector,
741  const FullMatrix<LocalType> &local_matrix) const;
742 
746  template <class VectorType>
747  void
748  distribute_local_to_global (const size_type index,
749  const double value,
750  VectorType &global_vector) const;
751 
780  template <typename ForwardIteratorVec, typename ForwardIteratorInd,
781  class VectorType>
782  void
783  distribute_local_to_global (ForwardIteratorVec local_vector_begin,
784  ForwardIteratorVec local_vector_end,
785  ForwardIteratorInd local_indices_begin,
786  VectorType &global_vector) const;
787 
835  template <typename MatrixType>
836  void
837  distribute_local_to_global (const FullMatrix<typename MatrixType::value_type> &local_matrix,
838  const std::vector<size_type> &local_dof_indices,
839  MatrixType &global_matrix) const;
840 
868  template <typename MatrixType>
869  void
870  distribute_local_to_global (const FullMatrix<typename MatrixType::value_type> &local_matrix,
871  const std::vector<size_type> &row_indices,
872  const std::vector<size_type> &col_indices,
873  MatrixType &global_matrix) const;
874 
891  template <typename MatrixType, typename VectorType>
892  void
893  distribute_local_to_global (const FullMatrix<typename MatrixType::value_type> &local_matrix,
894  const Vector<typename VectorType::value_type> &local_vector,
895  const std::vector<size_type> &local_dof_indices,
896  MatrixType &global_matrix,
897  VectorType &global_vector,
898  bool use_inhomogeneities_for_rhs = false) const;
899 
953  template <typename SparsityPatternType>
954  void
955  add_entries_local_to_global (const std::vector<size_type> &local_dof_indices,
956  SparsityPatternType &sparsity_pattern,
957  const bool keep_constrained_entries = true,
958  const Table<2,bool> &dof_mask = default_empty_table) const;
959 
963  template <typename SparsityPatternType>
964  void
965  add_entries_local_to_global (const std::vector<size_type> &row_indices,
966  const std::vector<size_type> &col_indices,
967  SparsityPatternType &sparsity_pattern,
968  const bool keep_constrained_entries = true,
969  const Table<2,bool> &dof_mask = default_empty_table) const;
970 
990  template <typename ForwardIteratorVec, typename ForwardIteratorInd,
991  class VectorType>
992  void
993  get_dof_values (const VectorType &global_vector,
994  ForwardIteratorInd local_indices_begin,
995  ForwardIteratorVec local_vector_begin,
996  ForwardIteratorVec local_vector_end) const;
997 
1019  template <class VectorType>
1020  void distribute (VectorType &vec) const;
1021 
1031  DeclException0 (ExcMatrixIsClosed);
1037  DeclException0 (ExcMatrixNotClosed);
1043  DeclException1 (ExcLineInexistant,
1044  size_type,
1045  << "The specified line " << arg1
1046  << " does not exist.");
1052  DeclException4 (ExcEntryAlreadyExists,
1053  size_type, size_type, double, double,
1054  << "The entry for the indices " << arg1 << " and "
1055  << arg2 << " already exists, but the values "
1056  << arg3 << " (old) and " << arg4 << " (new) differ "
1057  << "by " << (arg4-arg3) << ".");
1063  DeclException2 (ExcDoFConstrainedToConstrainedDoF,
1064  int, int,
1065  << "You tried to constrain DoF " << arg1
1066  << " to DoF " << arg2
1067  << ", but that one is also constrained. This is not allowed!");
1073  DeclException1 (ExcDoFIsConstrainedFromBothObjects,
1074  size_type,
1075  << "Degree of freedom " << arg1
1076  << " is constrained from both object in a merge operation.");
1082  DeclException1 (ExcDoFIsConstrainedToConstrainedDoF,
1083  size_type,
1084  << "In the given argument a degree of freedom is constrained "
1085  << "to another DoF with number " << arg1
1086  << ", which however is constrained by this object. This is not"
1087  << " allowed.");
1093  DeclException1 (ExcRowNotStoredHere,
1094  size_type,
1095  << "The index set given to this constraint matrix indicates "
1096  << "constraints for degree of freedom " << arg1
1097  << " should not be stored by this object, but a constraint "
1098  << "is being added.");
1099 
1105  DeclException2 (ExcColumnNotStoredHere,
1106  size_type,
1107  size_type,
1108  << "The index set given to this constraint matrix indicates "
1109  << "constraints using degree of freedom " << arg2
1110  << " should not be stored by this object, but a constraint "
1111  << "for degree of freedom " << arg1 <<" uses it.");
1112 
1118  DeclException2 (ExcIncorrectConstraint,
1119  int, int,
1120  << "While distributing the constraint for DoF "
1121  << arg1 << ", it turns out that one of the processors "
1122  << "who own the " << arg2
1123  << " degrees of freedom that x_" << arg1
1124  << " is constrained against does not know about "
1125  << "the constraint on x_" << arg1
1126  << ". Did you not initialize the ConstraintMatrix "
1127  << "with the appropriate locally_relevant set so "
1128  << "that every processor who owns a DoF that constrains "
1129  << "another DoF also knows about this constraint?");
1130 
1131 private:
1132 
1137  {
1142  typedef std::vector<std::pair<size_type,double> > Entries;
1143 
1148  size_type line;
1149 
1157  Entries entries;
1158 
1163 
1171  bool operator < (const ConstraintLine &) const;
1172 
1178  bool operator == (const ConstraintLine &) const;
1179 
1184  std::size_t memory_consumption () const;
1185  };
1186 
1198  std::vector<ConstraintLine> lines;
1199 
1232  std::vector<size_type> lines_cache;
1233 
1240 
1244  bool sorted;
1245 
1250  size_type calculate_line_index (const size_type line) const;
1251 
1256  static bool check_zero_weight (const std::pair<size_type, double> &p);
1257 
1263 
1268  template <typename MatrixType, typename VectorType>
1269  void
1270  distribute_local_to_global (const FullMatrix<typename MatrixType::value_type> &local_matrix,
1271  const Vector<typename VectorType::value_type> &local_vector,
1272  const std::vector<size_type> &local_dof_indices,
1273  MatrixType &global_matrix,
1274  VectorType &global_vector,
1275  bool use_inhomogeneities_for_rhs,
1277 
1282  template <typename MatrixType, typename VectorType>
1283  void
1284  distribute_local_to_global (const FullMatrix<typename MatrixType::value_type> &local_matrix,
1285  const Vector<typename VectorType::value_type> &local_vector,
1286  const std::vector<size_type> &local_dof_indices,
1287  MatrixType &global_matrix,
1288  VectorType &global_vector,
1289  bool use_inhomogeneities_for_rhs,
1291 
1296  template <typename SparsityPatternType>
1297  void
1298  add_entries_local_to_global (const std::vector<size_type> &local_dof_indices,
1299  SparsityPatternType &sparsity_pattern,
1300  const bool keep_constrained_entries,
1301  const Table<2,bool> &dof_mask,
1303 
1308  template <typename SparsityPatternType>
1309  void
1310  add_entries_local_to_global (const std::vector<size_type> &local_dof_indices,
1311  SparsityPatternType &sparsity_pattern,
1312  const bool keep_constrained_entries,
1313  const Table<2,bool> &dof_mask,
1315 
1323  void
1324  make_sorted_row_list (const std::vector<size_type> &local_dof_indices,
1325  internals::GlobalRowsFromLocal &global_rows) const;
1326 
1334  void
1335  make_sorted_row_list (const std::vector<size_type> &local_dof_indices,
1336  std::vector<size_type> &active_dofs) const;
1337 
1341  template <typename LocalType>
1342  LocalType
1343  resolve_vector_entry (const size_type i,
1344  const internals::GlobalRowsFromLocal &global_rows,
1345  const Vector<LocalType> &local_vector,
1346  const std::vector<size_type> &local_dof_indices,
1347  const FullMatrix<LocalType> &local_matrix) const;
1348 
1353  ConstraintMatrix &operator= (const ConstraintMatrix &other);
1354 };
1355 
1356 
1357 
1358 /* ---------------- template and inline functions ----------------- */
1359 
1360 inline
1362  :
1363  lines (),
1364  local_lines (local_constraints),
1365  sorted (false)
1366 {
1367  // make sure the IndexSet is compressed. Otherwise this can lead to crashes
1368  // that are hard to find (only happen in release mode).
1369  // see tests/mpi/constraint_matrix_crash_01
1371 }
1372 
1373 
1374 
1375 inline
1377  :
1378  Subscriptor (),
1379  lines (constraint_matrix.lines),
1380  lines_cache (constraint_matrix.lines_cache),
1381  local_lines (constraint_matrix.local_lines),
1382  sorted (constraint_matrix.sorted)
1383 {}
1384 
1385 
1386 inline
1387 void
1388 ConstraintMatrix::add_line (const size_type line)
1389 {
1390  Assert (sorted==false, ExcMatrixIsClosed());
1391 
1392  // the following can happen when we compute with distributed meshes and dof
1393  // handlers and we constrain a degree of freedom whose number we don't have
1394  // locally. if we don't abort here the program will try to allocate several
1395  // terabytes of memory to resize the various arrays below :-)
1397  ExcInternalError());
1398  const size_type line_index = calculate_line_index (line);
1399 
1400  // check whether line already exists; it may, in which case we can just quit
1401  if (is_constrained(line))
1402  return;
1403 
1404  // if necessary enlarge vector of existing entries for cache
1405  if (line_index >= lines_cache.size())
1406  lines_cache.resize (std::max(2*static_cast<size_type>(lines_cache.size()),
1407  line_index+1),
1409 
1410  // push a new line to the end of the list
1411  lines.push_back (ConstraintLine());
1412  lines.back().line = line;
1413  lines.back().inhomogeneity = 0.;
1414  lines_cache[line_index] = lines.size()-1;
1415 }
1416 
1417 
1418 
1419 inline
1420 void
1421 ConstraintMatrix::add_entry (const size_type line,
1422  const size_type column,
1423  const double value)
1424 {
1425  Assert (sorted==false, ExcMatrixIsClosed());
1426  Assert (line != column,
1427  ExcMessage ("Can't constrain a degree of freedom to itself"));
1428 
1429  // if in debug mode, check whether an entry for this column already exists
1430  // and if it's the same as the one entered at present
1431  //
1432  // in any case: exit the function if an entry for this column already
1433  // exists, since we don't want to enter it twice
1435  ExcInternalError());
1436  Assert (!local_lines.size() || local_lines.is_element(column),
1437  ExcColumnNotStoredHere(line, column));
1439  Assert (line_ptr->line == line, ExcInternalError());
1440  for (ConstraintLine::Entries::const_iterator
1441  p=line_ptr->entries.begin();
1442  p != line_ptr->entries.end(); ++p)
1443  if (p->first == column)
1444  {
1445  Assert (std::fabs(p->second - value) < 1.e-14,
1446  ExcEntryAlreadyExists(line, column, p->second, value));
1447  return;
1448  }
1449 
1450  line_ptr->entries.push_back (std::make_pair(column,value));
1451 }
1452 
1453 
1454 
1455 inline
1456 void
1458  const double value)
1459 {
1460  const size_type line_index = calculate_line_index(line);
1461  Assert( line_index < lines_cache.size() &&
1462  lines_cache[line_index] != numbers::invalid_size_type,
1463  ExcMessage("call add_line() before calling set_inhomogeneity()"));
1464  Assert(lines_cache[line_index] < lines.size(), ExcInternalError());
1465  ConstraintLine *line_ptr = &lines[lines_cache[line_index]];
1466  line_ptr->inhomogeneity = value;
1467 }
1468 
1469 
1470 
1471 inline
1474 {
1475  return lines.size();
1476 }
1477 
1478 
1479 
1480 inline
1481 bool
1482 ConstraintMatrix::is_constrained (const size_type index) const
1483 {
1484  const size_type line_index = calculate_line_index(index);
1485  return ((line_index < lines_cache.size())
1486  &&
1487  (lines_cache[line_index] != numbers::invalid_size_type));
1488 }
1489 
1490 
1491 
1492 inline
1493 bool
1495 {
1496  // check whether the entry is constrained. could use is_constrained, but
1497  // that means computing the line index twice
1498  const size_type line_index = calculate_line_index(index);
1499  if (line_index >= lines_cache.size() ||
1500  lines_cache[line_index] == numbers::invalid_size_type)
1501  return false;
1502  else
1503  {
1504  Assert(lines_cache[line_index] < lines.size(), ExcInternalError());
1505  return !(lines[lines_cache[line_index]].inhomogeneity == 0);
1506  }
1507 }
1508 
1509 
1510 
1511 inline
1512 const std::vector<std::pair<types::global_dof_index,double> > *
1513 ConstraintMatrix::get_constraint_entries (const size_type line) const
1514 {
1515  // check whether the entry is constrained. could use is_constrained, but
1516  // that means computing the line index twice
1517  const size_type line_index = calculate_line_index(line);
1518  if (line_index >= lines_cache.size() ||
1519  lines_cache[line_index] == numbers::invalid_size_type)
1520  return 0;
1521  else
1522  return &lines[lines_cache[line_index]].entries;
1523 }
1524 
1525 
1526 
1527 inline
1528 double
1529 ConstraintMatrix::get_inhomogeneity (const size_type line) const
1530 {
1531  // check whether the entry is constrained. could use is_constrained, but
1532  // that means computing the line index twice
1533  const size_type line_index = calculate_line_index(line);
1534  if (line_index >= lines_cache.size() ||
1535  lines_cache[line_index] == numbers::invalid_size_type)
1536  return 0;
1537  else
1538  return lines[lines_cache[line_index]].inhomogeneity;
1539 }
1540 
1541 
1542 
1544 ConstraintMatrix::calculate_line_index (const size_type line) const
1545 {
1546  //IndexSet is unused (serial case)
1547  if (!local_lines.size())
1548  return line;
1549 
1551  ExcRowNotStoredHere(line));
1552 
1553  return local_lines.index_within_set(line);
1554 }
1555 
1556 
1557 
1558 inline bool
1559 ConstraintMatrix::can_store_line (size_type line_index) const
1560 {
1561  return !local_lines.size() || local_lines.is_element(line_index);
1562 }
1563 
1564 
1565 
1566 inline
1567 const IndexSet &
1569 {
1570  return local_lines;
1571 }
1572 
1573 
1574 
1575 template <class VectorType>
1576 inline
1578  const size_type index,
1579  const double value,
1580  VectorType &global_vector) const
1581 {
1582  Assert (lines.empty() || sorted == true, ExcMatrixNotClosed());
1583 
1584  if (is_constrained(index) == false)
1585  global_vector(index) += value;
1586  else
1587  {
1588  const ConstraintLine &position =
1590  for (size_type j=0; j<position.entries.size(); ++j)
1591  global_vector(position.entries[j].first)
1592  += value * position.entries[j].second;
1593  }
1594 }
1595 
1596 
1597 template <typename ForwardIteratorVec, typename ForwardIteratorInd,
1598  class VectorType>
1599 inline
1601  ForwardIteratorVec local_vector_begin,
1602  ForwardIteratorVec local_vector_end,
1603  ForwardIteratorInd local_indices_begin,
1604  VectorType &global_vector) const
1605 {
1606  Assert (lines.empty() || sorted == true, ExcMatrixNotClosed());
1607  for ( ; local_vector_begin != local_vector_end;
1608  ++local_vector_begin, ++local_indices_begin)
1609  {
1610  if (is_constrained(*local_indices_begin) == false)
1611  global_vector(*local_indices_begin) += *local_vector_begin;
1612  else
1613  {
1614  const ConstraintLine &position =
1615  lines[lines_cache[calculate_line_index(*local_indices_begin)]];
1616  for (size_type j=0; j<position.entries.size(); ++j)
1617  global_vector(position.entries[j].first)
1618  += *local_vector_begin * position.entries[j].second;
1619  }
1620  }
1621 }
1622 
1623 
1624 template <class InVector, class OutVector>
1625 inline
1626 void
1628  const InVector &local_vector,
1629  const std::vector<size_type> &local_dof_indices,
1630  OutVector &global_vector) const
1631 {
1632  Assert (local_vector.size() == local_dof_indices.size(),
1633  ExcDimensionMismatch(local_vector.size(), local_dof_indices.size()));
1634  distribute_local_to_global (local_vector.begin(), local_vector.end(),
1635  local_dof_indices.begin(), global_vector);
1636 }
1637 
1638 
1639 
1640 template <typename ForwardIteratorVec, typename ForwardIteratorInd,
1641  class VectorType>
1642 inline
1643 void ConstraintMatrix::get_dof_values (const VectorType &global_vector,
1644  ForwardIteratorInd local_indices_begin,
1645  ForwardIteratorVec local_vector_begin,
1646  ForwardIteratorVec local_vector_end) const
1647 {
1648  Assert (lines.empty() || sorted == true, ExcMatrixNotClosed());
1649  for ( ; local_vector_begin != local_vector_end;
1650  ++local_vector_begin, ++local_indices_begin)
1651  {
1652  if (is_constrained(*local_indices_begin) == false)
1653  *local_vector_begin = global_vector(*local_indices_begin);
1654  else
1655  {
1656  const ConstraintLine &position =
1657  lines[lines_cache[calculate_line_index(*local_indices_begin)]];
1658  typename VectorType::value_type value = position.inhomogeneity;
1659  for (size_type j=0; j<position.entries.size(); ++j)
1660  value += (global_vector(position.entries[j].first) *
1661  position.entries[j].second);
1662  *local_vector_begin = value;
1663  }
1664  }
1665 }
1666 
1667 
1668 template <typename MatrixType> class BlockMatrixBase;
1669 template <typename SparsityPatternType> class BlockSparsityPatternBase;
1670 template <typename number> class BlockSparseMatrixEZ;
1671 
1690 template <typename MatrixType>
1692 {
1693 private:
1694  struct yes_type
1695  {
1696  char c[1];
1697  };
1698  struct no_type
1699  {
1700  char c[2];
1701  };
1702 
1708  template <typename T>
1709  static yes_type check_for_block_matrix (const BlockMatrixBase<T> *);
1710 
1715  template <typename T>
1716  static yes_type check_for_block_matrix (const BlockSparsityPatternBase<T> *);
1717 
1722  template <typename T>
1723  static yes_type check_for_block_matrix (const BlockSparseMatrixEZ<T> *);
1724 
1729  static no_type check_for_block_matrix (...);
1730 
1731 public:
1737  static const bool value = (sizeof(check_for_block_matrix
1738  ((MatrixType *)0))
1739  ==
1740  sizeof(yes_type));
1741 };
1742 
1743 
1744 // instantiation of the static member
1745 template <typename MatrixType>
1747 
1748 
1749 template <typename MatrixType>
1750 inline
1751 void
1754  const std::vector<size_type> &local_dof_indices,
1755  MatrixType &global_matrix) const
1756 {
1757  // create a dummy and hand on to the function actually implementing this
1758  // feature in the cm.templates.h file.
1760  distribute_local_to_global (local_matrix, dummy, local_dof_indices,
1761  global_matrix, dummy, false,
1762  ::internal::bool2type<IsBlockMatrix<MatrixType>::value>());
1763 }
1764 
1765 
1766 
1767 
1768 template <typename MatrixType, typename VectorType>
1769 inline
1770 void
1773  const Vector<typename VectorType::value_type> &local_vector,
1774  const std::vector<size_type> &local_dof_indices,
1775  MatrixType &global_matrix,
1776  VectorType &global_vector,
1777  bool use_inhomogeneities_for_rhs) const
1778 {
1779  // enter the internal function with the respective block information set,
1780  // the actual implementation follows in the cm.templates.h file.
1781  distribute_local_to_global (local_matrix, local_vector, local_dof_indices,
1782  global_matrix, global_vector, use_inhomogeneities_for_rhs,
1783  ::internal::bool2type<IsBlockMatrix<MatrixType>::value>());
1784 }
1785 
1786 
1787 
1788 
1789 template <typename SparsityPatternType>
1790 inline
1791 void
1793 add_entries_local_to_global (const std::vector<size_type> &local_dof_indices,
1794  SparsityPatternType &sparsity_pattern,
1795  const bool keep_constrained_entries,
1796  const Table<2,bool> &dof_mask) const
1797 {
1798  // enter the internal function with the respective block information set,
1799  // the actual implementation follows in the cm.templates.h file.
1800  add_entries_local_to_global (local_dof_indices, sparsity_pattern,
1801  keep_constrained_entries, dof_mask,
1803 }
1804 
1805 
1806 DEAL_II_NAMESPACE_CLOSE
1807 
1808 #endif
const types::global_dof_index invalid_size_type
Definition: types.h:173
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:552
std::vector< size_type > lines_cache
void get_dof_values(const VectorType &global_vector, ForwardIteratorInd local_indices_begin, ForwardIteratorVec local_vector_begin, ForwardIteratorVec local_vector_end) const
::ExceptionBase & ExcMessage(std::string arg1)
Auxiliary class aiding in the handling of block structures like in BlockVector or FESystem...
Definition: block_indices.h:54
const IndexSet & get_local_lines() const
types::global_dof_index size_type
std::vector< std::pair< size_type, double > > Entries
size_type size() const
Definition: index_set.h:1247
void add_line(const size_type line)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:542
void add_entry(const size_type line, const size_type column, const double value)
unsigned int global_dof_index
Definition: types.h:88
bool is_inhomogeneously_constrained(const size_type index) const
#define Assert(cond, exc)
Definition: exceptions.h:294
size_type index_within_set(const size_type global_index) const
Definition: index_set.h:1475
void distribute_local_to_global(const InVector &local_vector, const std::vector< size_type > &local_dof_indices, OutVector &global_vector) const
ConstraintMatrix(const IndexSet &local_constraints=IndexSet())
size_type n_constraints() const
#define DeclException0(Exception0)
Definition: exceptions.h:522
static const Table< 2, bool > default_empty_table
size_type calculate_line_index(const size_type line) const
bool can_store_line(const size_type line_index) const
void compress() const
Definition: index_set.h:1256
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:572
void add_entries_local_to_global(const std::vector< size_type > &local_dof_indices, SparsityPatternType &sparsity_pattern, const bool keep_constrained_entries=true, const Table< 2, bool > &dof_mask=default_empty_table) const
Definition: table.h:33
bool is_element(const size_type index) const
Definition: index_set.h:1317
const std::vector< std::pair< size_type, double > > * get_constraint_entries(const size_type line) const
double get_inhomogeneity(const size_type line) const
void set_inhomogeneity(const size_type line, const double value)
std::vector< ConstraintLine > lines
bool is_constrained(const size_type index) const