libMesh
dof_map.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_DOF_MAP_H
21 #define LIBMESH_DOF_MAP_H
22 
23 // Local Includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/auto_ptr.h" // deprecated
26 #include "libmesh/reference_counted_object.h"
27 #include "libmesh/libmesh.h" // libMesh::invalid_uint
28 #include "libmesh/variable.h"
29 #include "libmesh/threads.h"
30 #include "libmesh/threads_allocators.h"
31 #include "libmesh/elem_range.h"
32 #include "libmesh/ghosting_functor.h"
33 #include "libmesh/sparsity_pattern.h"
34 #include "libmesh/parallel_object.h"
35 #include "libmesh/point.h"
36 
37 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
38 namespace libMesh
39 {
40 enum Order : int;
41 }
42 #else
43 #include "libmesh/enum_order.h"
44 #endif
45 
46 // C++ Includes
47 #include <algorithm>
48 #include <cstddef>
49 #include <iterator>
50 #include <map>
51 #include <string>
52 #include <vector>
53 #include <memory>
54 
55 namespace libMesh
56 {
57 
58 // Forward Declarations
59 class CouplingMatrix;
60 class DefaultCoupling;
61 class DirichletBoundary;
62 class DirichletBoundaries;
63 class DofMap;
64 class DofObject;
65 class Elem;
66 class FEType;
67 class MeshBase;
68 class PeriodicBoundaryBase;
69 class PeriodicBoundaries;
70 class System;
71 class NonlinearImplicitSystem;
72 template <typename T> class DenseVectorBase;
73 template <typename T> class DenseVector;
74 template <typename T> class DenseMatrix;
75 template <typename T> class SparseMatrix;
76 template <typename T> class NumericVector;
77 
78 
79 
80 // ------------------------------------------------------------
81 // Do we need constraints for anything?
82 
83 #if defined(LIBMESH_ENABLE_AMR) || \
84  defined(LIBMESH_ENABLE_PERIODIC) || \
85  defined(LIBMESH_ENABLE_DIRICHLET)
86 # define LIBMESH_ENABLE_CONSTRAINTS 1
87 #endif
88 
89 // ------------------------------------------------------------
90 // AMR constraint matrix types
91 
92 #ifdef LIBMESH_ENABLE_CONSTRAINTS
93 
96 typedef std::map<dof_id_type, Real,
97  std::less<dof_id_type>,
99 
106 class DofConstraints : public std::map<dof_id_type,
107  DofConstraintRow,
108  std::less<dof_id_type>,
109  Threads::scalable_allocator<std::pair<const dof_id_type, DofConstraintRow>>>
110 {
111 };
112 
119  public std::map<dof_id_type, Number,
120  std::less<dof_id_type>,
121  Threads::scalable_allocator<std::pair<const dof_id_type, Number>>>
122 {
123 };
124 
130  public std::map<unsigned int, DofConstraintValueMap,
131  std::less<unsigned int>,
132  Threads::scalable_allocator
133  <std::pair<const unsigned int, DofConstraintValueMap>>>
134 {
135 };
136 
137 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
138 
144 typedef std::map<const Node *, Real,
145  std::less<const Node *>,
147 
154 class NodeConstraints : public std::map<const Node *,
155  std::pair<NodeConstraintRow,Point>,
156  std::less<const Node *>,
157  Threads::scalable_allocator<std::pair<const Node * const, std::pair<NodeConstraintRow,Point>>>>
158 {
159 };
160 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
161 
162 #endif // LIBMESH_ENABLE_CONSTRAINTS
163 
164 
165 
177 class DofMap : public ReferenceCountedObject<DofMap>,
178  public ParallelObject
179 {
180 public:
181 
187  explicit
188  DofMap(const unsigned int sys_number,
189  MeshBase & mesh);
190 
194  ~DofMap();
195 
201  {
202  public:
204 
208  virtual void augment_sparsity_pattern (SparsityPattern::Graph & sparsity,
209  std::vector<dof_id_type> & n_nz,
210  std::vector<dof_id_type> & n_oz) = 0;
211  };
212 
218  {
219  public:
220  virtual ~AugmentSendList () {}
221 
225  virtual void augment_send_list (std::vector<dof_id_type> & send_list) = 0;
226  };
227 
233  void attach_matrix (SparseMatrix<Number> & matrix);
234 
239  bool is_attached (SparseMatrix<Number> & matrix);
240 
246  void distribute_dofs (MeshBase &);
247 
253  void compute_sparsity (const MeshBase &);
254 
258  void clear_sparsity();
259 
274 
279  void add_default_ghosting();
280 
305  void add_coupling_functor(GhostingFunctor & coupling_functor,
306  bool to_mesh = true);
307 
313  void remove_coupling_functor(GhostingFunctor & coupling_functor);
314 
318  std::set<GhostingFunctor *>::const_iterator coupling_functors_begin() const
319  { return _coupling_functors.begin(); }
320 
324  std::set<GhostingFunctor *>::const_iterator coupling_functors_end() const
325  { return _coupling_functors.end(); }
326 
331 
355  void add_algebraic_ghosting_functor(GhostingFunctor & evaluable_functor,
356  bool to_mesh = true);
357 
363  void remove_algebraic_ghosting_functor(GhostingFunctor & evaluable_functor);
364 
368  std::set<GhostingFunctor *>::const_iterator algebraic_ghosting_functors_begin() const
369  { return _algebraic_ghosting_functors.begin(); }
370 
374  std::set<GhostingFunctor *>::const_iterator algebraic_ghosting_functors_end() const
375  { return _algebraic_ghosting_functors.end(); }
376 
381 
393  {
395  }
396 
408  std::vector<dof_id_type> & n_nz,
409  std::vector<dof_id_type> & n_oz,
410  void *),
411  void * context = nullptr)
413 
422  {
423  _augment_send_list = &asl;
424  }
425 
430  void attach_extra_send_list_function(void (*func)(std::vector<dof_id_type> &, void *),
431  void * context = nullptr)
433 
440  void prepare_send_list ();
441 
451  const std::vector<dof_id_type> & get_send_list() const { return _send_list; }
452 
460  const std::vector<dof_id_type> & get_n_nz() const
461  {
462  libmesh_assert(_n_nz);
463  return *_n_nz;
464  }
465 
473  const std::vector<dof_id_type> & get_n_oz() const
474  {
475  libmesh_assert(_n_oz);
476  return *_n_oz;
477  }
478 
479  // /**
480  // * Add an unknown of order \p order and finite element type
481  // * \p type to the system of equations.
482  // */
483  // void add_variable (const Variable & var);
484 
489  void add_variable_group (const VariableGroup & var_group);
490 
497  void set_error_on_cyclic_constraint(bool error_on_cyclic_constraint);
498 
502  const VariableGroup & variable_group (const unsigned int c) const;
503 
507  const Variable & variable (const unsigned int c) const;
508 
512  Order variable_order (const unsigned int c) const;
513 
517  Order variable_group_order (const unsigned int vg) const;
518 
522  const FEType & variable_type (const unsigned int c) const;
523 
527  const FEType & variable_group_type (const unsigned int vg) const;
528 
534  unsigned int n_variable_groups() const
535  { return cast_int<unsigned int>(_variable_groups.size()); }
536 
542  unsigned int n_variables() const
543  { return cast_int<unsigned int>(_variables.size()); }
544 
551  {
552 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE
553  return ((this->n_variable_groups() == 1) && (this->n_variables() > 1));
554 #else
555  return false;
556 #endif
557  }
558 
563  unsigned int block_size() const
564  {
565 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE
566  return (this->has_blocked_representation() ? this->n_variables() : 1);
567 #else
568  return 1;
569 #endif
570  }
571 
575  dof_id_type n_dofs() const { return _n_dfs; }
576 
581 
586  { return this->n_dofs_on_processor (this->processor_id()); }
587 
591  dof_id_type n_dofs_on_processor(const processor_id_type proc) const
592  {
593  libmesh_assert_less (proc, _first_df.size());
594  return cast_int<dof_id_type>(_end_df[proc] - _first_df[proc]);
595  }
596 
601  { libmesh_assert_less (proc, _first_df.size()); return _first_df[proc]; }
602 
604  { return this->first_dof(this->processor_id()); }
605 
606 #ifdef LIBMESH_ENABLE_AMR
607 
610  dof_id_type first_old_dof(const processor_id_type proc) const
611  { libmesh_assert_less (proc, _first_old_df.size()); return _first_old_df[proc]; }
612 
614  { return this->first_old_dof(this->processor_id()); }
615 
616 #endif //LIBMESH_ENABLE_AMR
617 
624 #ifdef LIBMESH_ENABLE_DEPRECATED
625  dof_id_type last_dof(const processor_id_type proc) const
626  {
627  libmesh_deprecated();
628  libmesh_assert_less (proc, _end_df.size());
629  return cast_int<dof_id_type>(_end_df[proc] - 1);
630  }
631 
633  { return this->last_dof(this->processor_id()); }
634 #endif
635 
642  dof_id_type end_dof(const processor_id_type proc) const
643  { libmesh_assert_less (proc, _end_df.size()); return _end_df[proc]; }
644 
646  { return this->end_dof(this->processor_id()); }
647 
652  { std::vector<dof_id_type>::const_iterator ub =
653  std::upper_bound(_end_df.begin(), _end_df.end(), dof);
654  libmesh_assert (ub != _end_df.end());
655  return cast_int<processor_id_type>(ub - _end_df.begin());
656  }
657 
658 #ifdef LIBMESH_ENABLE_AMR
659 
666  { libmesh_assert_less (proc, _end_old_df.size()); return _end_old_df[proc]; }
667 
669  { return this->end_old_dof(this->processor_id()); }
670 
671 #endif //LIBMESH_ENABLE_AMR
672 
677  void dof_indices (const Elem * const elem,
678  std::vector<dof_id_type> & di) const;
679 
685  void dof_indices (const Elem * const elem,
686  std::vector<dof_id_type> & di,
687  const unsigned int vn,
688  int p_level = -12345) const;
689 
694  void dof_indices (const Node * const node,
695  std::vector<dof_id_type> & di) const;
696 
701  void dof_indices (const Node * const node,
702  std::vector<dof_id_type> & di,
703  const unsigned int vn) const;
704 
713  void SCALAR_dof_indices (std::vector<dof_id_type> & di,
714  const unsigned int vn,
715  const bool old_dofs=false) const;
716 
724  bool semilocal_index (dof_id_type dof_index) const;
725 
733  bool all_semilocal_indices (const std::vector<dof_id_type> & dof_indices) const;
734 
739  bool local_index (dof_id_type dof_index) const
740  { return (dof_index >= this->first_dof()) && (dof_index < this->end_dof()); }
741 
747  template <typename DofObjectSubclass>
748  bool is_evaluable(const DofObjectSubclass & obj,
749  unsigned int var_num = libMesh::invalid_uint) const;
750 
758  void set_implicit_neighbor_dofs(bool implicit_neighbor_dofs);
759 
766  bool use_coupled_neighbor_dofs(const MeshBase & mesh) const;
767 
779  const std::vector<dof_id_type> & dof_indices,
780  DenseVectorBase<Number> & Ue) const;
781 
786  void local_variable_indices(std::vector<dof_id_type> & idx,
787  const MeshBase & mesh,
788  unsigned int var_num) const;
789 
790 #ifdef LIBMESH_ENABLE_CONSTRAINTS
791 
792  //--------------------------------------------------------------------
793  // Constraint-specific methods
799 
805 
806 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
807 
812  { return cast_int<dof_id_type>(_node_constraints.size()); }
813 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
814 
820  void create_dof_constraints (const MeshBase &, Real time=0);
821 
826 
830  void scatter_constraints (MeshBase &);
831 
845  void gather_constraints (MeshBase & mesh,
846  std::set<dof_id_type> & unexpanded_dofs,
847  bool look_for_constrainees);
848 
856  void process_constraints (MeshBase &);
857 
864 
869  void add_constraint_row (const dof_id_type dof_number,
870  const DofConstraintRow & constraint_row,
871  const Number constraint_rhs,
872  const bool forbid_constraint_overwrite);
873 
884  void add_adjoint_constraint_row (const unsigned int qoi_index,
885  const dof_id_type dof_number,
886  const DofConstraintRow & constraint_row,
887  const Number constraint_rhs,
888  const bool forbid_constraint_overwrite);
889 
895  void add_constraint_row (const dof_id_type dof_number,
896  const DofConstraintRow & constraint_row,
897  const bool forbid_constraint_overwrite = true)
898  { add_constraint_row(dof_number, constraint_row, 0., forbid_constraint_overwrite); }
899 
903  DofConstraints::const_iterator constraint_rows_begin() const
904  { return _dof_constraints.begin(); }
905 
909  DofConstraints::const_iterator constraint_rows_end() const
910  { return _dof_constraints.end(); }
911 
913  {
914  libmesh_assert(_stashed_dof_constraints.empty());
916  }
917 
919  {
920  libmesh_assert(_dof_constraints.empty());
922  }
923 
924 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
925 
928  NodeConstraints::const_iterator node_constraint_rows_begin() const
929  { return _node_constraints.begin(); }
930 
934  NodeConstraints::const_iterator node_constraint_rows_end() const
935  { return _node_constraints.end(); }
936 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
937 
942  bool is_constrained_dof (const dof_id_type dof) const;
943 
948  bool has_heterogenous_adjoint_constraints (const unsigned int qoi_num) const;
949 
955  Number has_heterogenous_adjoint_constraint (const unsigned int qoi_num,
956  const dof_id_type dof) const;
957 
963 
968  bool is_constrained_node (const Node * node) const;
969 
976  void print_dof_constraints(std::ostream & os=libMesh::out,
977  bool print_nonlocal=false) const;
978 
984  std::string get_local_constraints(bool print_nonlocal=false) const;
985 
986 
995  std::pair<Real, Real> max_constraint_error(const System & system,
996  NumericVector<Number> * v = nullptr) const;
997 
998 #endif // LIBMESH_ENABLE_CONSTRAINTS
999 
1000  //--------------------------------------------------------------------
1001  // Constraint-specific methods
1002  // Some of these methods are enabled (but inlined away to nothing)
1003  // when constraints are disabled at configure-time. This is to
1004  // increase API compatibility of user code with different library
1005  // builds.
1006 
1021  std::vector<dof_id_type> & elem_dofs,
1022  bool asymmetric_constraint_rows = true) const;
1023 
1031  std::vector<dof_id_type> & row_dofs,
1032  std::vector<dof_id_type> & col_dofs,
1033  bool asymmetric_constraint_rows = true) const;
1034 
1039  std::vector<dof_id_type> & dofs,
1040  bool asymmetric_constraint_rows = true) const;
1041 
1051  DenseVector<Number> & rhs,
1052  std::vector<dof_id_type> & elem_dofs,
1053  bool asymmetric_constraint_rows = true) const;
1054 
1079  DenseVector<Number> & rhs,
1080  std::vector<dof_id_type> & elem_dofs,
1081  bool asymmetric_constraint_rows = true,
1082  int qoi_index = -1) const;
1083 
1106  DenseVector<Number> & rhs,
1107  std::vector<dof_id_type> & elem_dofs,
1108  bool asymmetric_constraint_rows = true,
1109  int qoi_index = -1) const;
1110 
1111 
1112 
1122  DenseVector<Number> & w,
1123  std::vector<dof_id_type> & row_dofs,
1124  bool asymmetric_constraint_rows = true) const;
1125 
1132  void constrain_nothing (std::vector<dof_id_type> & dofs) const;
1133 
1147  void enforce_constraints_exactly (const System & system,
1148  NumericVector<Number> * v = nullptr,
1149  bool homogeneous = false) const;
1150 
1158  unsigned int q) const;
1159 
1161  NumericVector<Number> * rhs,
1162  NumericVector<Number> const * solution,
1163  bool homogeneous = true) const;
1165  SparseMatrix<Number> * jac) const;
1166 
1167 
1168 
1169 #ifdef LIBMESH_ENABLE_PERIODIC
1170 
1171  //--------------------------------------------------------------------
1172  // PeriodicBoundary-specific methods
1173 
1177  void add_periodic_boundary (const PeriodicBoundaryBase & periodic_boundary);
1178 
1185  void add_periodic_boundary (const PeriodicBoundaryBase & boundary, const PeriodicBoundaryBase & inverse_boundary);
1186 
1191  bool is_periodic_boundary (const boundary_id_type boundaryid) const;
1192 
1194  {
1195  return _periodic_boundaries.get();
1196  }
1197 
1198 #endif // LIBMESH_ENABLE_PERIODIC
1199 
1200 
1201 #ifdef LIBMESH_ENABLE_DIRICHLET
1202 
1203  //--------------------------------------------------------------------
1204  // DirichletBoundary-specific methods
1205 
1209  void add_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary);
1210 
1216  void add_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary,
1217  unsigned int q);
1218 
1222  void remove_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary);
1223 
1228  void remove_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary,
1229  unsigned int q);
1230 
1232  {
1233  return _dirichlet_boundaries.get();
1234  }
1235 
1237  {
1238  return _dirichlet_boundaries.get();
1239  }
1240 
1241  bool has_adjoint_dirichlet_boundaries(unsigned int q) const;
1242 
1243  const DirichletBoundaries *
1244  get_adjoint_dirichlet_boundaries(unsigned int q) const;
1245 
1247  get_adjoint_dirichlet_boundaries(unsigned int q);
1248 
1249 #endif // LIBMESH_ENABLE_DIRICHLET
1250 
1251 
1252 #ifdef LIBMESH_ENABLE_AMR
1253 
1254  //--------------------------------------------------------------------
1255  // AMR-specific methods
1256 
1265  // void augment_send_list_for_projection(const MeshBase &);
1266 
1273  void old_dof_indices (const Elem * const elem,
1274  std::vector<dof_id_type> & di,
1275  const unsigned int vn = libMesh::invalid_uint) const;
1279  dof_id_type n_old_dofs() const { return _n_old_dfs; }
1280 
1286  void constrain_p_dofs (unsigned int var,
1287  const Elem * elem,
1288  unsigned int s,
1289  unsigned int p);
1290 
1291 #endif // LIBMESH_ENABLE_AMR
1292 
1296  void reinit (MeshBase & mesh);
1297 
1302  void clear ();
1303 
1307  void print_info(std::ostream & os=libMesh::out) const;
1308 
1312  std::string get_info() const;
1313 
1328 
1332  unsigned int sys_number() const;
1333 
1334 private:
1335 
1346  void _dof_indices (const Elem & elem,
1347  int p_level,
1348  std::vector<dof_id_type> & di,
1349  const unsigned int vg,
1350  const unsigned int vig,
1351  const Node * const * nodes,
1352  unsigned int n_nodes
1353 #ifdef DEBUG
1354  ,
1355  const unsigned int v,
1356  std::size_t & tot_size
1357 #endif
1358  ) const;
1359 
1363  std::unique_ptr<SparsityPattern::Build> build_sparsity(const MeshBase & mesh) const;
1364 
1368  void invalidate_dofs(MeshBase & mesh) const;
1369 
1373  DofObject * node_ptr(MeshBase & mesh, dof_id_type i) const;
1374 
1378  DofObject * elem_ptr(MeshBase & mesh, dof_id_type i) const;
1379 
1383  typedef DofObject * (DofMap::*dofobject_accessor)
1384  (MeshBase & mesh, dof_id_type i) const;
1385 
1389  template<typename iterator_type>
1390  void set_nonlocal_dof_objects(iterator_type objects_begin,
1391  iterator_type objects_end,
1392  MeshBase & mesh,
1393  dofobject_accessor objects);
1394 
1403  void distribute_local_dofs_var_major (dof_id_type & next_free_dof,
1404  MeshBase & mesh);
1405 
1417  void distribute_local_dofs_node_major (dof_id_type & next_free_dof,
1418  MeshBase & mesh);
1419 
1420  /*
1421  * A utility method for obtaining a set of elements to ghost along
1422  * with merged coupling matrices.
1423  */
1424  static void
1426  std::set<CouplingMatrix *> & temporary_coupling_matrices,
1427  const std::set<GhostingFunctor *>::iterator & gf_begin,
1428  const std::set<GhostingFunctor *>::iterator & gf_end,
1429  const MeshBase::const_element_iterator & elems_begin,
1430  const MeshBase::const_element_iterator & elems_end,
1431  processor_id_type p);
1432 
1437  void add_neighbors_to_send_list(MeshBase & mesh);
1438 
1439 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1440 
1452  std::vector<dof_id_type> & elem_dofs,
1453  const bool called_recursively=false) const;
1454 
1471  DenseVector<Number> & H,
1472  std::vector<dof_id_type> & elem_dofs,
1473  int qoi_index = -1,
1474  const bool called_recursively=false) const;
1475 
1480  void find_connected_dofs (std::vector<dof_id_type> & elem_dofs) const;
1481 
1486  void find_connected_dof_objects (std::vector<const DofObject *> & objs) const;
1487 
1494 
1495 #endif // LIBMESH_ENABLE_CONSTRAINTS
1496 
1502 
1506  std::vector<Variable> _variables;
1507 
1511  std::vector<VariableGroup> _variable_groups;
1512 
1516  std::vector<unsigned int> _variable_group_numbers;
1517 
1521  const unsigned int _sys_number;
1522 
1527 
1533  std::vector<SparseMatrix<Number> * > _matrices;
1534 
1538  std::vector<dof_id_type> _first_df;
1539 
1543  std::vector<dof_id_type> _end_df;
1544 
1549  std::vector<dof_id_type> _first_scalar_df;
1550 
1555  std::vector<dof_id_type> _send_list;
1556 
1561 
1566  std::vector<dof_id_type> & n_nz,
1567  std::vector<dof_id_type> & n_oz,
1568  void *);
1573 
1578 
1582  void (*_extra_send_list_function)(std::vector<dof_id_type> &, void *);
1583 
1588 
1595  std::unique_ptr<DefaultCoupling> _default_coupling;
1596 
1603  std::unique_ptr<DefaultCoupling> _default_evaluating;
1604 
1613  std::set<GhostingFunctor *> _algebraic_ghosting_functors;
1614 
1626  std::set<GhostingFunctor *> _coupling_functors;
1627 
1633 
1638  std::unique_ptr<SparsityPattern::Build> _sp;
1639 
1646  std::vector<dof_id_type> * _n_nz;
1647 
1652  std::vector<dof_id_type> * _n_oz;
1653 
1658 
1664 
1665 #ifdef LIBMESH_ENABLE_AMR
1666 
1671 
1675  std::vector<dof_id_type> _first_old_df;
1676 
1680  std::vector<dof_id_type> _end_old_df;
1681 
1686  std::vector<dof_id_type> _first_old_scalar_df;
1687 
1688 #endif
1689 
1690 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1691 
1696 
1698 
1700 #endif
1701 
1702 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1703 
1707 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
1708 
1709 
1710 #ifdef LIBMESH_ENABLE_PERIODIC
1711 
1715  std::unique_ptr<PeriodicBoundaries> _periodic_boundaries;
1716 #endif
1717 
1718 #ifdef LIBMESH_ENABLE_DIRICHLET
1719 
1723  void check_dirichlet_bcid_consistency (const MeshBase & mesh,
1724  const DirichletBoundary & boundary) const;
1729  std::unique_ptr<DirichletBoundaries> _dirichlet_boundaries;
1730 
1735  std::vector<DirichletBoundaries *> _adjoint_dirichlet_boundaries;
1736 #endif
1737 
1739 
1746 };
1747 
1748 
1749 // ------------------------------------------------------------
1750 // Dof Map inline member functions
1751 inline
1752 unsigned int DofMap::sys_number() const
1753 {
1754  return _sys_number;
1755 }
1756 
1757 
1758 
1759 inline
1760 const VariableGroup & DofMap::variable_group (const unsigned int g) const
1761 {
1762  libmesh_assert_less (g, _variable_groups.size());
1763 
1764  return _variable_groups[g];
1765 }
1766 
1767 
1768 
1769 inline
1770 const Variable & DofMap::variable (const unsigned int c) const
1771 {
1772  libmesh_assert_less (c, _variables.size());
1773 
1774  return _variables[c];
1775 }
1776 
1777 
1778 
1779 inline
1780 Order DofMap::variable_order (const unsigned int c) const
1781 {
1782  libmesh_assert_less (c, _variables.size());
1783 
1784  return _variables[c].type().order;
1785 }
1786 
1787 
1788 
1789 inline
1790 Order DofMap::variable_group_order (const unsigned int vg) const
1791 {
1792  libmesh_assert_less (vg, _variable_groups.size());
1793 
1794  return _variable_groups[vg].type().order;
1795 }
1796 
1797 
1798 
1799 inline
1800 const FEType & DofMap::variable_type (const unsigned int c) const
1801 {
1802  libmesh_assert_less (c, _variables.size());
1803 
1804  return _variables[c].type();
1805 }
1806 
1807 
1808 
1809 inline
1810 const FEType & DofMap::variable_group_type (const unsigned int vg) const
1811 {
1812  libmesh_assert_less (vg, _variable_groups.size());
1813 
1814  return _variable_groups[vg].type();
1815 }
1816 
1817 
1818 
1819 inline
1821 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1822  node
1823 #endif
1824  ) const
1825 {
1826 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1827  if (_node_constraints.count(node))
1828  return true;
1829 #endif
1830 
1831  return false;
1832 }
1833 
1834 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1835 
1836 inline
1838 {
1839  if (_dof_constraints.count(dof))
1840  return true;
1841 
1842  return false;
1843 }
1844 
1845 
1846 inline
1847 bool DofMap::has_heterogenous_adjoint_constraints (const unsigned int qoi_num) const
1848 {
1849  AdjointDofConstraintValues::const_iterator it =
1850  _adjoint_constraint_values.find(qoi_num);
1851  if (it == _adjoint_constraint_values.end())
1852  return false;
1853  if (it->second.empty())
1854  return false;
1855 
1856  return true;
1857 }
1858 
1859 
1860 inline
1862  const dof_id_type dof) const
1863 {
1864  AdjointDofConstraintValues::const_iterator it =
1865  _adjoint_constraint_values.find(qoi_num);
1866  if (it != _adjoint_constraint_values.end())
1867  {
1868  DofConstraintValueMap::const_iterator rhsit =
1869  it->second.find(dof);
1870  if (rhsit == it->second.end())
1871  return 0;
1872  else
1873  return rhsit->second;
1874  }
1875 
1876  return 0;
1877 }
1878 
1879 
1880 
1881 inline
1883 {
1885 }
1886 
1887 
1888 
1889 #else
1890 
1891 //--------------------------------------------------------------------
1892 // Constraint-specific methods get inlined into nothing if
1893 // constraints are disabled, so there's no reason for users not to
1894 // use them.
1895 
1897  std::vector<dof_id_type> &,
1898  bool) const {}
1899 
1901  std::vector<dof_id_type> &,
1902  std::vector<dof_id_type> &,
1903  bool) const {}
1904 
1906  std::vector<dof_id_type> &,
1907  bool) const {}
1908 
1911  std::vector<dof_id_type> &,
1912  bool) const {}
1913 
1916  std::vector<dof_id_type> &,
1917  bool) const {}
1918 
1921  bool = false) const {}
1922 
1924  unsigned int) const {}
1925 
1926 #endif // LIBMESH_ENABLE_CONSTRAINTS
1927 
1928 } // namespace libMesh
1929 
1930 #endif // LIBMESH_DOF_MAP_H
std::vector< VariableGroup > _variable_groups
The finite element type for each variable group.
Definition: dof_map.h:1511
void remove_adjoint_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary, unsigned int q)
Removes from the system the specified Dirichlet boundary for the adjoint equation defined by Quantity...
void find_connected_dofs(std::vector< dof_id_type > &elem_dofs) const
Finds all the DOFS associated with the element DOFs elem_dofs.
std::unique_ptr< SparsityPattern::Build > _sp
The sparsity pattern of the global matrix, kept around if it might be needed by future additions of t...
Definition: dof_map.h:1638
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition: fe_type.h:179
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all DoF and Node constraints local to this processor.
void constrain_element_dyad_matrix(DenseVector< Number > &v, DenseVector< Number > &w, std::vector< dof_id_type > &row_dofs, bool asymmetric_constraint_rows=true) const
Constrains a dyadic element matrix B = v w&#39;.
Definition: dof_map.h:1914
bool _error_on_cyclic_constraint
This flag indicates whether or not we do an opt-mode check for the presence of cyclic constraints...
Definition: dof_map.h:1501
bool _implicit_neighbor_dofs_initialized
Bools to indicate if we override the –implicit_neighbor_dofs commandline options.
Definition: dof_map.h:1744
void distribute_local_dofs_node_major(dof_id_type &next_free_dof, MeshBase &mesh)
Distributes the global degrees of freedom for dofs on this processor.
void _dof_indices(const Elem &elem, int p_level, std::vector< dof_id_type > &di, const unsigned int vg, const unsigned int vig, const Node *const *nodes, unsigned int n_nodes #ifdef DEBUG, const unsigned int v, std::size_t &tot_size #endif) const
Helper function that gets the dof indices on the current element for a non-SCALAR type variable...
bool is_constrained_node(const Node *node) const
Definition: dof_map.h:1820
void local_variable_indices(std::vector< dof_id_type > &idx, const MeshBase &mesh, unsigned int var_num) const
Fills an array of those dof indices which belong to the given variable number and live on the current...
unsigned int n_variable_groups() const
Definition: dof_map.h:534
void add_adjoint_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary, unsigned int q)
Adds a copy of the specified Dirichlet boundary to the system, corresponding to the adjoint problem d...
const unsigned int _sys_number
The number of the system we manage DOFs for.
Definition: dof_map.h:1521
bool _implicit_neighbor_dofs
Definition: dof_map.h:1745
dof_id_type n_nodes(const MeshBase::const_node_iterator &begin, const MeshBase::const_node_iterator &end)
Count up the number of nodes of a specific type (as defined by an iterator range).
DofConstraintValueMap & get_primal_constraint_values()
Definition: dof_map.h:1882
void check_dirichlet_bcid_consistency(const MeshBase &mesh, const DirichletBoundary &boundary) const
Check that all the ids in dirichlet_bcids are actually present in the mesh.
dof_id_type n_local_dofs() const
Definition: dof_map.h:585
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
DefaultCoupling & default_coupling()
Default coupling functor.
Definition: dof_map.h:330
const std::vector< dof_id_type > & get_n_oz() const
Definition: dof_map.h:473
A Node is like a Point, but with more information.
Definition: node.h:52
This abstract base class defines the interface by which library code and user code can report associa...
dof_id_type n_SCALAR_dofs() const
Definition: dof_map.h:580
std::set< GhostingFunctor * >::const_iterator coupling_functors_begin() const
Beginning of range of coupling functors.
Definition: dof_map.h:318
void build_constraint_matrix_and_vector(DenseMatrix< Number > &C, DenseVector< Number > &H, std::vector< dof_id_type > &elem_dofs, int qoi_index=-1, const bool called_recursively=false) const
Build the constraint matrix C and the forcing vector H associated with the element degree of freedom ...
~DofMap()
Destructor.
This helper class can be called on multiple threads to compute the sparsity pattern (or graph) of the...
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:245
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
Definition: dof_map.h:591
processor_id_type dof_owner(const dof_id_type dof) const
Definition: dof_map.h:651
void scatter_constraints(MeshBase &)
Sends constraint equations to constraining processors.
void add_periodic_boundary(const PeriodicBoundaryBase &periodic_boundary)
Adds a copy of the specified periodic boundary to the system.
void add_adjoint_constraint_row(const unsigned int qoi_index, const dof_id_type dof_number, const DofConstraintRow &constraint_row, const Number constraint_rhs, const bool forbid_constraint_overwrite)
Adds a copy of the user-defined row to the constraint matrix, using an inhomogeneous right-hand-side ...
void * _extra_sparsity_context
A pointer associated with the extra sparsity that can optionally be passed in.
Definition: dof_map.h:1572
void extract_local_vector(const NumericVector< Number > &Ug, const std::vector< dof_id_type > &dof_indices, DenseVectorBase< Number > &Ue) const
Builds the local element vector Ue from the global vector Ug, accounting for any constrained degrees ...
void constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix and vector.
Definition: dof_map.h:1909
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
The definition of the const_element_iterator struct.
Definition: mesh_base.h:1527
void set_implicit_neighbor_dofs(bool implicit_neighbor_dofs)
Allow the implicit_neighbor_dofs flag to be set programmatically.
void add_default_ghosting()
Add the default functor(s) for coupling and algebraic ghosting.
We&#39;re using a class instead of a typedef to allow forward declarations and future flexibility...
bool is_periodic_boundary(const boundary_id_type boundaryid) const
Number has_heterogenous_adjoint_constraint(const unsigned int qoi_num, const dof_id_type dof) const
Definition: dof_map.h:1861
dof_id_type last_dof() const
Definition: dof_map.h:632
static void merge_ghost_functor_outputs(GhostingFunctor::map_type &elements_to_ghost, std::set< CouplingMatrix *> &temporary_coupling_matrices, const std::set< GhostingFunctor *>::iterator &gf_begin, const std::set< GhostingFunctor *>::iterator &gf_end, const MeshBase::const_element_iterator &elems_begin, const MeshBase::const_element_iterator &elems_end, processor_id_type p)
dof_id_type n_local_constrained_dofs() const
void remove_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Removes the specified Dirichlet boundary from the system.
const FEType & variable_group_type(const unsigned int vg) const
Definition: dof_map.h:1810
NodeConstraints::const_iterator node_constraint_rows_begin() const
Definition: dof_map.h:928
std::vector< dof_id_type > _send_list
A list containing all the global DOF indices that affect the solution on my processor.
Definition: dof_map.h:1555
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1800
unsigned int block_size() const
Definition: dof_map.h:563
bool is_attached(SparseMatrix< Number > &matrix)
Matrices should not be attached more than once.
void attach_matrix(SparseMatrix< Number > &matrix)
Additional matrices may be handled with this DofMap.
This is the base class from which all geometric element types are derived.
Definition: elem.h:101
DofObject * elem_ptr(MeshBase &mesh, dof_id_type i) const
void gather_constraints(MeshBase &mesh, std::set< dof_id_type > &unexpanded_dofs, bool look_for_constrainees)
Helper function for querying about constraint equations on other processors.
uint8_t processor_id_type
Definition: id_types.h:99
unsigned int n_variables() const
Definition: dof_map.h:542
DefaultCoupling & default_algebraic_ghosting()
Default algebraic ghosting functor.
Definition: dof_map.h:380
AugmentSparsityPattern * _augment_sparsity_pattern
Function object to call to add extra entries to the sparsity pattern.
Definition: dof_map.h:1560
std::unique_ptr< DirichletBoundaries > _dirichlet_boundaries
Data structure containing Dirichlet functions.
Definition: dof_map.h:1729
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
Definition: dof_map.h:76
The Node constraint storage format.
Definition: dof_map.h:154
std::set< GhostingFunctor * > _algebraic_ghosting_functors
The list of all GhostingFunctor objects to be used when distributing ghosted vectors.
Definition: dof_map.h:1613
std::vector< dof_id_type > _end_old_df
Last old DOF index (plus 1) on processor p.
Definition: dof_map.h:1680
bool use_coupled_neighbor_dofs(const MeshBase &mesh) const
Tells other library functions whether or not this problem includes coupling between dofs in neighbori...
virtual void augment_send_list(std::vector< dof_id_type > &send_list)=0
User-defined function to augment the send list.
The libMesh namespace provides an interface to certain functionality in the library.
dof_id_type n_old_dofs() const
Definition: dof_map.h:1279
void add_constraint_row(const dof_id_type dof_number, const DofConstraintRow &constraint_row, const bool forbid_constraint_overwrite=true)
Adds a copy of the user-defined row to the constraint matrix, using a homogeneous right-hand-side for...
Definition: dof_map.h:895
const DirichletBoundaries * get_adjoint_dirichlet_boundaries(unsigned int q) const
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
std::vector< dof_id_type > _first_old_df
First old DOF index on processor p.
Definition: dof_map.h:1675
void old_dof_indices(const Elem *const elem, std::vector< dof_id_type > &di, const unsigned int vn=libMesh::invalid_uint) const
After a mesh is refined and repartitioned it is possible that the _send_list will need to be augmente...
std::string get_info() const
Gets summary info about the sparsity bandwidth and constraints.
void attach_extra_sparsity_object(DofMap::AugmentSparsityPattern &asp)
Attach an object to use to populate the sparsity pattern with extra entries.
Definition: dof_map.h:392
unsigned int sys_number() const
Definition: dof_map.h:1752
void SCALAR_dof_indices(std::vector< dof_id_type > &di, const unsigned int vn, const bool old_dofs=false) const
Fills the vector di with the global degree of freedom indices corresponding to the SCALAR variable vn...
This is the MeshBase class.
Definition: mesh_base.h:77
std::vector< dof_id_type > _first_scalar_df
First DOF index for SCALAR variable v, or garbage for non-SCALAR variable v.
Definition: dof_map.h:1549
This class implements the default algebraic coupling in libMesh: elements couple to themselves...
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
Heterogenously constrains the numeric vector v, which represents an adjoint solution defined on the m...
Definition: dof_map.h:1923
AdjointDofConstraintValues _adjoint_constraint_values
Definition: dof_map.h:1699
std::vector< dof_id_type > * _n_nz
The number of on-processor nonzeros in my portion of the global matrix.
Definition: dof_map.h:1646
AugmentSendList * _augment_send_list
Function object to call to add extra entries to the send list.
Definition: dof_map.h:1577
std::vector< dof_id_type > * _n_oz
The number of off-processor nonzeros in my portion of the global matrix; allocated similar to _n_nz...
Definition: dof_map.h:1652
void heterogenously_constrain_element_vector(const DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true, int qoi_index=-1) const
Constrains the element vector.
bool need_full_sparsity_pattern
Default false; set to true if any attached matrix requires a full sparsity pattern.
Definition: dof_map.h:1632
Generic sparse matrix.
Definition: dof_map.h:75
void enforce_constraints_on_residual(const NonlinearImplicitSystem &system, NumericVector< Number > *rhs, NumericVector< Number > const *solution, bool homogeneous=true) const
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:177
dof_id_type end_old_dof() const
Definition: dof_map.h:668
dof_id_type n_dofs() const
Definition: dof_map.h:575
This class defines the notion of a variable in the system.
Definition: variable.h:49
void add_neighbors_to_send_list(MeshBase &mesh)
Adds entries to the _send_list vector corresponding to DoFs on elements neighboring the current proce...
std::vector< dof_id_type > _first_old_scalar_df
First old DOF index for SCALAR variable v, or garbage for non-SCALAR variable v.
Definition: dof_map.h:1686
const Variable & variable(const unsigned int c) const
Definition: dof_map.h:1770
int8_t boundary_id_type
Definition: id_types.h:51
bool has_adjoint_dirichlet_boundaries(unsigned int q) const
void(* _extra_sparsity_function)(SparsityPattern::Graph &, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz, void *)
A function pointer to a function to call to add extra entries to the sparsity pattern.
Definition: dof_map.h:1565
dof_id_type _n_SCALAR_dofs
The total number of SCALAR dofs associated to all SCALAR variables.
Definition: dof_map.h:1663
PeriodicBoundaries * get_periodic_boundaries()
Definition: dof_map.h:1193
void set_nonlocal_dof_objects(iterator_type objects_begin, iterator_type objects_end, MeshBase &mesh, dofobject_accessor objects)
Helper function for distributing dofs in parallel.
void add_constraint_row(const dof_id_type dof_number, const DofConstraintRow &constraint_row, const Number constraint_rhs, const bool forbid_constraint_overwrite)
Adds a copy of the user-defined row to the constraint matrix, using an inhomogeneous right-hand-side ...
DofConstraints::const_iterator constraint_rows_begin() const
Definition: dof_map.h:903
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:92
NodeConstraints::const_iterator node_constraint_rows_end() const
Definition: dof_map.h:934
dof_id_type n_constrained_nodes() const
Definition: dof_map.h:811
We&#39;re using a class instead of a typedef to allow forward declarations and future flexibility...
void print_dof_constraints(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all DoF and Node constraints.
DirichletBoundaries * get_dirichlet_boundaries()
Definition: dof_map.h:1236
bool is_constrained_dof(const dof_id_type dof) const
Definition: dof_map.h:1837
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
std::unordered_map< const Elem *, const CouplingMatrix * > map_type
What elements do we care about and what variables do we care about on each element?
void clear()
Free all new memory associated with the object, but restore its original state, with the mesh pointer...
void allgather_recursive_constraints(MeshBase &)
Gathers constraint equation dependencies from other processors.
void distribute_dofs(MeshBase &)
Distribute dofs on the current mesh.
const VariableGroup & variable_group(const unsigned int c) const
Definition: dof_map.h:1760
dof_id_type end_old_dof(const processor_id_type proc) const
Definition: dof_map.h:665
DofConstraints _dof_constraints
Data structure containing DOF constraints.
Definition: dof_map.h:1695
OStreamProxy out
void reinit(MeshBase &mesh)
Reinitialize the underlying data structures conformal to the current mesh.
DofMap(const unsigned int sys_number, MeshBase &mesh)
Constructor.
CouplingMatrix * _dof_coupling
Degree of freedom coupling.
Definition: dof_map.h:1327
std::vector< DirichletBoundaries * > _adjoint_dirichlet_boundaries
Data structure containing Dirichlet functions.
Definition: dof_map.h:1735
std::pair< Real, Real > max_constraint_error(const System &system, NumericVector< Number > *v=nullptr) const
Tests the constrained degrees of freedom on the numeric vector v, which represents a solution defined...
void print_info(std::ostream &os=libMesh::out) const
Prints summary info about the sparsity bandwidth and constraints.
void * _extra_send_list_context
A pointer associated with the extra send list that can optionally be passed in.
Definition: dof_map.h:1587
DofObject * node_ptr(MeshBase &mesh, dof_id_type i) const
This class implements reference counting.
const DirichletBoundaries * get_dirichlet_boundaries() const
Definition: dof_map.h:1231
An object whose state is distributed along a set of processors.
This class defines a logically grouped set of variables in the system.
Definition: variable.h:172
dof_id_type end_dof() const
Definition: dof_map.h:645
std::unique_ptr< SparsityPattern::Build > build_sparsity(const MeshBase &mesh) const
Builds a sparsity pattern.
Storage for DofConstraint right hand sides for a particular problem.
Definition: dof_map.h:118
std::vector< SparseMatrix< Number > *> _matrices
Additional matrices handled by this object.
Definition: dof_map.h:1533
Storage for DofConstraint right hand sides for all adjoint problems.
Definition: dof_map.h:129
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_end() const
End of range of algebraic ghosting functors.
Definition: dof_map.h:374
DofConstraints::const_iterator constraint_rows_end() const
Definition: dof_map.h:909
virtual void augment_sparsity_pattern(SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz)=0
User-defined function to augment the sparsity pattern.
std::unique_ptr< PeriodicBoundaries > _periodic_boundaries
Data structure containing periodic boundaries.
Definition: dof_map.h:1715
void heterogenously_constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true, int qoi_index=-1) const
Constrains the element matrix and vector.
bool has_heterogenous_adjoint_constraints(const unsigned int qoi_num) const
Definition: dof_map.h:1847
void unstash_dof_constraints()
Definition: dof_map.h:918
dof_id_type first_old_dof() const
Definition: dof_map.h:613
void remove_coupling_functor(GhostingFunctor &coupling_functor)
Removes a functor which was previously added to the set of coupling functors, from both this DofMap a...
DofObject *(DofMap::* dofobject_accessor)(MeshBase &mesh, dof_id_type i) const
A member function type like node_ptr() or elem_ptr().
Definition: dof_map.h:1384
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void process_constraints(MeshBase &)
Postprocesses any constrained degrees of freedom to be constrained only in terms of unconstrained dof...
void stash_dof_constraints()
Definition: dof_map.h:912
dof_id_type n_constrained_dofs() const
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
Constrains the element vector.
Definition: dof_map.h:1905
const std::vector< dof_id_type > & get_n_nz() const
Definition: dof_map.h:460
void invalidate_dofs(MeshBase &mesh) const
Invalidates all active DofObject dofs for this system.
void attach_extra_send_list_function(void(*func)(std::vector< dof_id_type > &, void *), void *context=nullptr)
Attach a function pointer to use as a callback to populate the send_list with extra entries...
Definition: dof_map.h:430
std::unique_ptr< DefaultCoupling > _default_coupling
The default coupling GhostingFunctor, used to implement standard libMesh sparsity pattern constructio...
Definition: dof_map.h:1595
void add_constraints_to_send_list()
Adds entries to the _send_list vector corresponding to DoFs which are dependencies for constraint equ...
DofConstraintValueMap _primal_constraint_values
Definition: dof_map.h:1697
std::vector< Variable > _variables
The finite element type for each variable.
Definition: dof_map.h:1506
DofConstraints _stashed_dof_constraints
Definition: dof_map.h:1695
void remove_default_ghosting()
Remove any default ghosting functor(s).
dof_id_type first_dof() const
Definition: dof_map.h:603
void attach_extra_sparsity_function(void(*func)(SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz, void *), void *context=nullptr)
Attach a function pointer to use as a callback to populate the sparsity pattern with extra entries...
Definition: dof_map.h:407
void find_connected_dof_objects(std::vector< const DofObject *> &objs) const
Finds all the DofObjects associated with the set in objs.
std::map< dof_id_type, Real, std::less< dof_id_type >, Threads::scalable_allocator< std::pair< const dof_id_type, Real > > > DofConstraintRow
A row of the Dof constraint matrix.
Definition: dof_map.h:98
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
Definition: dof_object.h:51
dof_id_type _n_old_dfs
Total number of degrees of freedom on old dof objects.
Definition: dof_map.h:1670
void clear_sparsity()
Clears the sparsity pattern.
Order variable_order(const unsigned int c) const
Definition: dof_map.h:1780
dof_id_type last_dof(const processor_id_type proc) const
Definition: dof_map.h:625
std::set< GhostingFunctor * > _coupling_functors
The list of all GhostingFunctor objects to be used when coupling degrees of freedom in matrix sparsit...
Definition: dof_map.h:1626
std::vector< dof_id_type > _end_df
Last DOF index (plus 1) on processor p.
Definition: dof_map.h:1543
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
void build_constraint_matrix(DenseMatrix< Number > &C, std::vector< dof_id_type > &elem_dofs, const bool called_recursively=false) const
Build the constraint matrix C associated with the element degree of freedom indices elem_dofs...
std::vector< dof_id_type > _first_df
First DOF index on processor p.
Definition: dof_map.h:1538
void(* _extra_send_list_function)(std::vector< dof_id_type > &, void *)
A function pointer to a function to call to add extra entries to the send list.
Definition: dof_map.h:1582
Scalable allocator to be used in multithreaded code chunks which allocate a lot of dynamic memory...
The base class for defining periodic boundaries.
void create_dof_constraints(const MeshBase &, Real time=0)
Rebuilds the raw degree of freedom and DofObject constraints.
std::set< GhostingFunctor * >::const_iterator coupling_functors_end() const
End of range of coupling functors.
Definition: dof_map.h:324
bool is_evaluable(const DofObjectSubclass &obj, unsigned int var_num=libMesh::invalid_uint) const
Defines an abstract dense vector base class for use in Finite Element-type computations.
Definition: dof_map.h:72
std::map< const Node *, Real, std::less< const Node * >, Threads::scalable_allocator< std::pair< const Node *const, Real > > > NodeConstraintRow
A row of the Node constraint mapping.
Definition: dof_map.h:146
MeshBase & _mesh
The mesh that system uses.
Definition: dof_map.h:1526
void prepare_send_list()
Takes the _send_list vector (which may have duplicate entries) and sorts it.
bool all_semilocal_indices(const std::vector< dof_id_type > &dof_indices) const
Defines a dense vector for use in Finite Element-type computations.
std::unique_ptr< DefaultCoupling > _default_evaluating
The default algebraic GhostingFunctor, used to implement standard libMesh send_list construction...
Definition: dof_map.h:1603
std::vector< unsigned int > _variable_group_numbers
The variable group number for each variable.
Definition: dof_map.h:1516
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:600
void remove_algebraic_ghosting_functor(GhostingFunctor &evaluable_functor)
Removes a functor which was previously added to the set of algebraic ghosting functors, from both this DofMap and from the underlying mesh.
Abstract base class to be used to add user-defined implicit degree of freedom couplings.
Definition: dof_map.h:200
void attach_extra_send_list_object(DofMap::AugmentSendList &asl)
Attach an object to populate the send_list with extra entries.
Definition: dof_map.h:421
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:642
Order variable_group_order(const unsigned int vg) const
Definition: dof_map.h:1790
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_begin() const
Beginning of range of algebraic ghosting functors.
Definition: dof_map.h:368
void compute_sparsity(const MeshBase &)
Computes the sparsity pattern for the matrices corresponding to proc_id and sends that data to Linear...
void add_algebraic_ghosting_functor(GhostingFunctor &evaluable_functor, bool to_mesh=true)
Adds a functor which can specify algebraic ghosting requirements for use with distributed vectors...
processor_id_type processor_id() const
Defines a dense matrix for use in Finite Element-type computations.
Definition: dof_map.h:74
void set_error_on_cyclic_constraint(bool error_on_cyclic_constraint)
Specify whether or not we perform an extra (opt-mode enabled) check for cyclic constraints.
void add_variable_group(const VariableGroup &var_group)
Add an unknown of order order and finite element type type to the system of equations.
bool has_blocked_representation() const
Definition: dof_map.h:550
The constraint matrix storage format.
Definition: dof_map.h:106
const std::vector< dof_id_type > & get_send_list() const
Definition: dof_map.h:451
Abstract base class to be used to add user-defined parallel degree of freedom couplings.
Definition: dof_map.h:217
void constrain_nothing(std::vector< dof_id_type > &dofs) const
Does not actually constrain anything, but modifies dofs in the same way as any of the constrain funct...
void distribute_local_dofs_var_major(dof_id_type &next_free_dof, MeshBase &mesh)
Distributes the global degrees of freedom, for dofs on this processor.
dof_id_type first_old_dof(const processor_id_type proc) const
Definition: dof_map.h:610
bool semilocal_index(dof_id_type dof_index) const
void constrain_p_dofs(unsigned int var, const Elem *elem, unsigned int s, unsigned int p)
Constrains degrees of freedom on side s of element elem which correspond to variable number var and t...
void check_for_cyclic_constraints()
Throw an error if we detect and cyclic constraints, since these are not supported by libMesh and give...
uint8_t dof_id_type
Definition: id_types.h:64
dof_id_type _n_dfs
Total number of degrees of freedom.
Definition: dof_map.h:1657
bool local_index(dof_id_type dof_index) const
Definition: dof_map.h:739
NodeConstraints _node_constraints
Data structure containing DofObject constraints.
Definition: dof_map.h:1706
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh. ...
Definition: dof_map.h:1919
This class defines a coupling matrix.
void constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix.
Definition: dof_map.h:1896
void enforce_constraints_on_jacobian(const NonlinearImplicitSystem &system, SparseMatrix< Number > *jac) const