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 
501  void set_error_on_cyclic_constraint(bool error_on_cyclic_constraint);
502  void set_error_on_constraint_loop(bool error_on_constraint_loop);
503 
507  const VariableGroup & variable_group (const unsigned int c) const;
508 
512  const Variable & variable (const unsigned int c) const;
513 
517  Order variable_order (const unsigned int c) const;
518 
522  Order variable_group_order (const unsigned int vg) const;
523 
527  const FEType & variable_type (const unsigned int c) const;
528 
532  const FEType & variable_group_type (const unsigned int vg) const;
533 
539  unsigned int n_variable_groups() const
540  { return cast_int<unsigned int>(_variable_groups.size()); }
541 
547  unsigned int n_variables() const
548  { return cast_int<unsigned int>(_variables.size()); }
549 
556  {
557 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE
558  return ((this->n_variable_groups() == 1) && (this->n_variables() > 1));
559 #else
560  return false;
561 #endif
562  }
563 
568  unsigned int block_size() const
569  {
570 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE
571  return (this->has_blocked_representation() ? this->n_variables() : 1);
572 #else
573  return 1;
574 #endif
575  }
576 
580  dof_id_type n_dofs() const { return _n_dfs; }
581 
586 
591  { return this->n_dofs_on_processor (this->processor_id()); }
592 
596  dof_id_type n_dofs_on_processor(const processor_id_type proc) const
597  {
598  libmesh_assert_less (proc, _first_df.size());
599  return cast_int<dof_id_type>(_end_df[proc] - _first_df[proc]);
600  }
601 
606  { libmesh_assert_less (proc, _first_df.size()); return _first_df[proc]; }
607 
609  { return this->first_dof(this->processor_id()); }
610 
611 #ifdef LIBMESH_ENABLE_AMR
612 
615  dof_id_type first_old_dof(const processor_id_type proc) const
616  { libmesh_assert_less (proc, _first_old_df.size()); return _first_old_df[proc]; }
617 
619  { return this->first_old_dof(this->processor_id()); }
620 
621 #endif //LIBMESH_ENABLE_AMR
622 
629 #ifdef LIBMESH_ENABLE_DEPRECATED
630  dof_id_type last_dof(const processor_id_type proc) const
631  {
632  libmesh_deprecated();
633  libmesh_assert_less (proc, _end_df.size());
634  return cast_int<dof_id_type>(_end_df[proc] - 1);
635  }
636 
638  { return this->last_dof(this->processor_id()); }
639 #endif
640 
647  dof_id_type end_dof(const processor_id_type proc) const
648  { libmesh_assert_less (proc, _end_df.size()); return _end_df[proc]; }
649 
651  { return this->end_dof(this->processor_id()); }
652 
657  { std::vector<dof_id_type>::const_iterator ub =
658  std::upper_bound(_end_df.begin(), _end_df.end(), dof);
659  libmesh_assert (ub != _end_df.end());
660  return cast_int<processor_id_type>(ub - _end_df.begin());
661  }
662 
663 #ifdef LIBMESH_ENABLE_AMR
664 
671  { libmesh_assert_less (proc, _end_old_df.size()); return _end_old_df[proc]; }
672 
674  { return this->end_old_dof(this->processor_id()); }
675 
676 #endif //LIBMESH_ENABLE_AMR
677 
682  void dof_indices (const Elem * const elem,
683  std::vector<dof_id_type> & di) const;
684 
690  void dof_indices (const Elem * const elem,
691  std::vector<dof_id_type> & di,
692  const unsigned int vn,
693  int p_level = -12345) const;
694 
699  void dof_indices (const Node * const node,
700  std::vector<dof_id_type> & di) const;
701 
706  void dof_indices (const Node * const node,
707  std::vector<dof_id_type> & di,
708  const unsigned int vn) const;
709 
718  void SCALAR_dof_indices (std::vector<dof_id_type> & di,
719  const unsigned int vn,
720  const bool old_dofs=false) const;
721 
729  bool semilocal_index (dof_id_type dof_index) const;
730 
738  bool all_semilocal_indices (const std::vector<dof_id_type> & dof_indices) const;
739 
744  bool local_index (dof_id_type dof_index) const
745  { return (dof_index >= this->first_dof()) && (dof_index < this->end_dof()); }
746 
752  template <typename DofObjectSubclass>
753  bool is_evaluable(const DofObjectSubclass & obj,
754  unsigned int var_num = libMesh::invalid_uint) const;
755 
763  void set_implicit_neighbor_dofs(bool implicit_neighbor_dofs);
764 
771  bool use_coupled_neighbor_dofs(const MeshBase & mesh) const;
772 
784  const std::vector<dof_id_type> & dof_indices,
785  DenseVectorBase<Number> & Ue) const;
786 
791  void local_variable_indices(std::vector<dof_id_type> & idx,
792  const MeshBase & mesh,
793  unsigned int var_num) const;
794 
795 #ifdef LIBMESH_ENABLE_CONSTRAINTS
796 
797  //--------------------------------------------------------------------
798  // Constraint-specific methods
804 
810 
811 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
812 
817  { return cast_int<dof_id_type>(_node_constraints.size()); }
818 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
819 
825  void create_dof_constraints (const MeshBase &, Real time=0);
826 
831 
835  void scatter_constraints (MeshBase &);
836 
850  void gather_constraints (MeshBase & mesh,
851  std::set<dof_id_type> & unexpanded_dofs,
852  bool look_for_constrainees);
853 
861  void process_constraints (MeshBase &);
862 
879 
884  void add_constraint_row (const dof_id_type dof_number,
885  const DofConstraintRow & constraint_row,
886  const Number constraint_rhs,
887  const bool forbid_constraint_overwrite);
888 
899  void add_adjoint_constraint_row (const unsigned int qoi_index,
900  const dof_id_type dof_number,
901  const DofConstraintRow & constraint_row,
902  const Number constraint_rhs,
903  const bool forbid_constraint_overwrite);
904 
910  void add_constraint_row (const dof_id_type dof_number,
911  const DofConstraintRow & constraint_row,
912  const bool forbid_constraint_overwrite = true)
913  { add_constraint_row(dof_number, constraint_row, 0., forbid_constraint_overwrite); }
914 
918  DofConstraints::const_iterator constraint_rows_begin() const
919  { return _dof_constraints.begin(); }
920 
924  DofConstraints::const_iterator constraint_rows_end() const
925  { return _dof_constraints.end(); }
926 
928  {
929  libmesh_assert(_stashed_dof_constraints.empty());
931  }
932 
934  {
935  libmesh_assert(_dof_constraints.empty());
937  }
938 
939 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
940 
943  NodeConstraints::const_iterator node_constraint_rows_begin() const
944  { return _node_constraints.begin(); }
945 
949  NodeConstraints::const_iterator node_constraint_rows_end() const
950  { return _node_constraints.end(); }
951 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
952 
957  bool is_constrained_dof (const dof_id_type dof) const;
958 
963  bool has_heterogenous_adjoint_constraints (const unsigned int qoi_num) const;
964 
970  Number has_heterogenous_adjoint_constraint (const unsigned int qoi_num,
971  const dof_id_type dof) const;
972 
978 
983  bool is_constrained_node (const Node * node) const;
984 
991  void print_dof_constraints(std::ostream & os=libMesh::out,
992  bool print_nonlocal=false) const;
993 
999  std::string get_local_constraints(bool print_nonlocal=false) const;
1000 
1001 
1010  std::pair<Real, Real> max_constraint_error(const System & system,
1011  NumericVector<Number> * v = nullptr) const;
1012 
1013 #endif // LIBMESH_ENABLE_CONSTRAINTS
1014 
1015  //--------------------------------------------------------------------
1016  // Constraint-specific methods
1017  // Some of these methods are enabled (but inlined away to nothing)
1018  // when constraints are disabled at configure-time. This is to
1019  // increase API compatibility of user code with different library
1020  // builds.
1021 
1036  std::vector<dof_id_type> & elem_dofs,
1037  bool asymmetric_constraint_rows = true) const;
1038 
1046  std::vector<dof_id_type> & row_dofs,
1047  std::vector<dof_id_type> & col_dofs,
1048  bool asymmetric_constraint_rows = true) const;
1049 
1054  std::vector<dof_id_type> & dofs,
1055  bool asymmetric_constraint_rows = true) const;
1056 
1066  DenseVector<Number> & rhs,
1067  std::vector<dof_id_type> & elem_dofs,
1068  bool asymmetric_constraint_rows = true) const;
1069 
1094  DenseVector<Number> & rhs,
1095  std::vector<dof_id_type> & elem_dofs,
1096  bool asymmetric_constraint_rows = true,
1097  int qoi_index = -1) const;
1098 
1121  DenseVector<Number> & rhs,
1122  std::vector<dof_id_type> & elem_dofs,
1123  bool asymmetric_constraint_rows = true,
1124  int qoi_index = -1) const;
1125 
1126 
1127 
1137  DenseVector<Number> & w,
1138  std::vector<dof_id_type> & row_dofs,
1139  bool asymmetric_constraint_rows = true) const;
1140 
1147  void constrain_nothing (std::vector<dof_id_type> & dofs) const;
1148 
1162  void enforce_constraints_exactly (const System & system,
1163  NumericVector<Number> * v = nullptr,
1164  bool homogeneous = false) const;
1165 
1173  unsigned int q) const;
1174 
1176  NumericVector<Number> * rhs,
1177  NumericVector<Number> const * solution,
1178  bool homogeneous = true) const;
1180  SparseMatrix<Number> * jac) const;
1181 
1182 
1183 
1184 #ifdef LIBMESH_ENABLE_PERIODIC
1185 
1186  //--------------------------------------------------------------------
1187  // PeriodicBoundary-specific methods
1188 
1192  void add_periodic_boundary (const PeriodicBoundaryBase & periodic_boundary);
1193 
1200  void add_periodic_boundary (const PeriodicBoundaryBase & boundary, const PeriodicBoundaryBase & inverse_boundary);
1201 
1206  bool is_periodic_boundary (const boundary_id_type boundaryid) const;
1207 
1209  {
1210  return _periodic_boundaries.get();
1211  }
1212 
1213 #endif // LIBMESH_ENABLE_PERIODIC
1214 
1215 
1216 #ifdef LIBMESH_ENABLE_DIRICHLET
1217 
1218  //--------------------------------------------------------------------
1219  // DirichletBoundary-specific methods
1220 
1224  void add_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary);
1225 
1231  void add_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary,
1232  unsigned int q);
1233 
1237  void remove_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary);
1238 
1243  void remove_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary,
1244  unsigned int q);
1245 
1247  {
1248  return _dirichlet_boundaries.get();
1249  }
1250 
1252  {
1253  return _dirichlet_boundaries.get();
1254  }
1255 
1256  bool has_adjoint_dirichlet_boundaries(unsigned int q) const;
1257 
1258  const DirichletBoundaries *
1259  get_adjoint_dirichlet_boundaries(unsigned int q) const;
1260 
1262  get_adjoint_dirichlet_boundaries(unsigned int q);
1263 
1264 #endif // LIBMESH_ENABLE_DIRICHLET
1265 
1266 
1267 #ifdef LIBMESH_ENABLE_AMR
1268 
1269  //--------------------------------------------------------------------
1270  // AMR-specific methods
1271 
1280  // void augment_send_list_for_projection(const MeshBase &);
1281 
1288  void old_dof_indices (const Elem * const elem,
1289  std::vector<dof_id_type> & di,
1290  const unsigned int vn = libMesh::invalid_uint) const;
1294  dof_id_type n_old_dofs() const { return _n_old_dfs; }
1295 
1301  void constrain_p_dofs (unsigned int var,
1302  const Elem * elem,
1303  unsigned int s,
1304  unsigned int p);
1305 
1306 #endif // LIBMESH_ENABLE_AMR
1307 
1311  void reinit (MeshBase & mesh);
1312 
1317  void clear ();
1318 
1322  void print_info(std::ostream & os=libMesh::out) const;
1323 
1327  std::string get_info() const;
1328 
1343 
1347  unsigned int sys_number() const;
1348 
1349 private:
1350 
1361  void _dof_indices (const Elem & elem,
1362  int p_level,
1363  std::vector<dof_id_type> & di,
1364  const unsigned int vg,
1365  const unsigned int vig,
1366  const Node * const * nodes,
1367  unsigned int n_nodes
1368 #ifdef DEBUG
1369  ,
1370  const unsigned int v,
1371  std::size_t & tot_size
1372 #endif
1373  ) const;
1374 
1378  std::unique_ptr<SparsityPattern::Build> build_sparsity(const MeshBase & mesh) const;
1379 
1383  void invalidate_dofs(MeshBase & mesh) const;
1384 
1388  DofObject * node_ptr(MeshBase & mesh, dof_id_type i) const;
1389 
1393  DofObject * elem_ptr(MeshBase & mesh, dof_id_type i) const;
1394 
1398  typedef DofObject * (DofMap::*dofobject_accessor)
1399  (MeshBase & mesh, dof_id_type i) const;
1400 
1404  template<typename iterator_type>
1405  void set_nonlocal_dof_objects(iterator_type objects_begin,
1406  iterator_type objects_end,
1407  MeshBase & mesh,
1408  dofobject_accessor objects);
1409 
1418  void distribute_local_dofs_var_major (dof_id_type & next_free_dof,
1419  MeshBase & mesh);
1420 
1432  void distribute_local_dofs_node_major (dof_id_type & next_free_dof,
1433  MeshBase & mesh);
1434 
1435  /*
1436  * A utility method for obtaining a set of elements to ghost along
1437  * with merged coupling matrices.
1438  */
1439  static void
1441  std::set<CouplingMatrix *> & temporary_coupling_matrices,
1442  const std::set<GhostingFunctor *>::iterator & gf_begin,
1443  const std::set<GhostingFunctor *>::iterator & gf_end,
1444  const MeshBase::const_element_iterator & elems_begin,
1445  const MeshBase::const_element_iterator & elems_end,
1446  processor_id_type p);
1447 
1452  void add_neighbors_to_send_list(MeshBase & mesh);
1453 
1454 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1455 
1467  std::vector<dof_id_type> & elem_dofs,
1468  const bool called_recursively=false) const;
1469 
1486  DenseVector<Number> & H,
1487  std::vector<dof_id_type> & elem_dofs,
1488  int qoi_index = -1,
1489  const bool called_recursively=false) const;
1490 
1495  void find_connected_dofs (std::vector<dof_id_type> & elem_dofs) const;
1496 
1501  void find_connected_dof_objects (std::vector<const DofObject *> & objs) const;
1502 
1509 
1510 #endif // LIBMESH_ENABLE_CONSTRAINTS
1511 
1518 
1522  std::vector<Variable> _variables;
1523 
1527  std::vector<VariableGroup> _variable_groups;
1528 
1532  std::vector<unsigned int> _variable_group_numbers;
1533 
1537  const unsigned int _sys_number;
1538 
1543 
1549  std::vector<SparseMatrix<Number> * > _matrices;
1550 
1554  std::vector<dof_id_type> _first_df;
1555 
1559  std::vector<dof_id_type> _end_df;
1560 
1565  std::vector<dof_id_type> _first_scalar_df;
1566 
1571  std::vector<dof_id_type> _send_list;
1572 
1577 
1582  std::vector<dof_id_type> & n_nz,
1583  std::vector<dof_id_type> & n_oz,
1584  void *);
1589 
1594 
1598  void (*_extra_send_list_function)(std::vector<dof_id_type> &, void *);
1599 
1604 
1611  std::unique_ptr<DefaultCoupling> _default_coupling;
1612 
1619  std::unique_ptr<DefaultCoupling> _default_evaluating;
1620 
1629  std::set<GhostingFunctor *> _algebraic_ghosting_functors;
1630 
1642  std::set<GhostingFunctor *> _coupling_functors;
1643 
1649 
1654  std::unique_ptr<SparsityPattern::Build> _sp;
1655 
1662  std::vector<dof_id_type> * _n_nz;
1663 
1668  std::vector<dof_id_type> * _n_oz;
1669 
1674 
1680 
1681 #ifdef LIBMESH_ENABLE_AMR
1682 
1687 
1691  std::vector<dof_id_type> _first_old_df;
1692 
1696  std::vector<dof_id_type> _end_old_df;
1697 
1702  std::vector<dof_id_type> _first_old_scalar_df;
1703 
1704 #endif
1705 
1706 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1707 
1712 
1714 
1716 #endif
1717 
1718 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1719 
1723 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
1724 
1725 
1726 #ifdef LIBMESH_ENABLE_PERIODIC
1727 
1731  std::unique_ptr<PeriodicBoundaries> _periodic_boundaries;
1732 #endif
1733 
1734 #ifdef LIBMESH_ENABLE_DIRICHLET
1735 
1739  void check_dirichlet_bcid_consistency (const MeshBase & mesh,
1740  const DirichletBoundary & boundary) const;
1745  std::unique_ptr<DirichletBoundaries> _dirichlet_boundaries;
1746 
1751  std::vector<DirichletBoundaries *> _adjoint_dirichlet_boundaries;
1752 #endif
1753 
1755 
1762 };
1763 
1764 
1765 // ------------------------------------------------------------
1766 // Dof Map inline member functions
1767 inline
1768 unsigned int DofMap::sys_number() const
1769 {
1770  return _sys_number;
1771 }
1772 
1773 
1774 
1775 inline
1776 const VariableGroup & DofMap::variable_group (const unsigned int g) const
1777 {
1778  libmesh_assert_less (g, _variable_groups.size());
1779 
1780  return _variable_groups[g];
1781 }
1782 
1783 
1784 
1785 inline
1786 const Variable & DofMap::variable (const unsigned int c) const
1787 {
1788  libmesh_assert_less (c, _variables.size());
1789 
1790  return _variables[c];
1791 }
1792 
1793 
1794 
1795 inline
1796 Order DofMap::variable_order (const unsigned int c) const
1797 {
1798  libmesh_assert_less (c, _variables.size());
1799 
1800  return _variables[c].type().order;
1801 }
1802 
1803 
1804 
1805 inline
1806 Order DofMap::variable_group_order (const unsigned int vg) const
1807 {
1808  libmesh_assert_less (vg, _variable_groups.size());
1809 
1810  return _variable_groups[vg].type().order;
1811 }
1812 
1813 
1814 
1815 inline
1816 const FEType & DofMap::variable_type (const unsigned int c) const
1817 {
1818  libmesh_assert_less (c, _variables.size());
1819 
1820  return _variables[c].type();
1821 }
1822 
1823 
1824 
1825 inline
1826 const FEType & DofMap::variable_group_type (const unsigned int vg) const
1827 {
1828  libmesh_assert_less (vg, _variable_groups.size());
1829 
1830  return _variable_groups[vg].type();
1831 }
1832 
1833 
1834 
1835 inline
1837 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1838  node
1839 #endif
1840  ) const
1841 {
1842 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1843  if (_node_constraints.count(node))
1844  return true;
1845 #endif
1846 
1847  return false;
1848 }
1849 
1850 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1851 
1852 inline
1854 {
1855  if (_dof_constraints.count(dof))
1856  return true;
1857 
1858  return false;
1859 }
1860 
1861 
1862 inline
1863 bool DofMap::has_heterogenous_adjoint_constraints (const unsigned int qoi_num) const
1864 {
1865  AdjointDofConstraintValues::const_iterator it =
1866  _adjoint_constraint_values.find(qoi_num);
1867  if (it == _adjoint_constraint_values.end())
1868  return false;
1869  if (it->second.empty())
1870  return false;
1871 
1872  return true;
1873 }
1874 
1875 
1876 inline
1878  const dof_id_type dof) const
1879 {
1880  AdjointDofConstraintValues::const_iterator it =
1881  _adjoint_constraint_values.find(qoi_num);
1882  if (it != _adjoint_constraint_values.end())
1883  {
1884  DofConstraintValueMap::const_iterator rhsit =
1885  it->second.find(dof);
1886  if (rhsit == it->second.end())
1887  return 0;
1888  else
1889  return rhsit->second;
1890  }
1891 
1892  return 0;
1893 }
1894 
1895 
1896 
1897 inline
1899 {
1901 }
1902 
1903 
1904 
1905 #else
1906 
1907 //--------------------------------------------------------------------
1908 // Constraint-specific methods get inlined into nothing if
1909 // constraints are disabled, so there's no reason for users not to
1910 // use them.
1911 
1913  std::vector<dof_id_type> &,
1914  bool) const {}
1915 
1917  std::vector<dof_id_type> &,
1918  std::vector<dof_id_type> &,
1919  bool) const {}
1920 
1922  std::vector<dof_id_type> &,
1923  bool) const {}
1924 
1927  std::vector<dof_id_type> &,
1928  bool) const {}
1929 
1932  std::vector<dof_id_type> &,
1933  bool) const {}
1934 
1937  bool = false) const {}
1938 
1940  unsigned int) const {}
1941 
1942 #endif // LIBMESH_ENABLE_CONSTRAINTS
1943 
1944 } // namespace libMesh
1945 
1946 #endif // LIBMESH_DOF_MAP_H
std::vector< VariableGroup > _variable_groups
The finite element type for each variable group.
Definition: dof_map.h:1527
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:1654
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:1930
bool _implicit_neighbor_dofs_initialized
Bools to indicate if we override the –implicit_neighbor_dofs commandline options.
Definition: dof_map.h:1760
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:1836
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:539
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:1537
bool _implicit_neighbor_dofs
Definition: dof_map.h:1761
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:1898
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:590
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:585
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:596
processor_id_type dof_owner(const dof_id_type dof) const
Definition: dof_map.h:656
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.
bool _error_on_constraint_loop
This flag indicates whether or not we do an opt-mode check for the presence of constraint loops...
Definition: dof_map.h:1517
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:1588
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:1925
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:1574
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:1877
dof_id_type last_dof() const
Definition: dof_map.h:637
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:1826
NodeConstraints::const_iterator node_constraint_rows_begin() const
Definition: dof_map.h:943
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:1571
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1816
unsigned int block_size() const
Definition: dof_map.h:568
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.
unsigned int n_variables() const
Definition: dof_map.h:547
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:1576
std::unique_ptr< DirichletBoundaries > _dirichlet_boundaries
Data structure containing Dirichlet functions.
Definition: dof_map.h:1745
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:1629
std::vector< dof_id_type > _end_old_df
Last old DOF index (plus 1) on processor p.
Definition: dof_map.h:1696
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:1294
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:910
void set_error_on_constraint_loop(bool error_on_constraint_loop)
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:1691
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:1768
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...
uint8_t processor_id_type
Definition: id_types.h:97
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:1565
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:1939
AdjointDofConstraintValues _adjoint_constraint_values
Definition: dof_map.h:1715
std::vector< dof_id_type > * _n_nz
The number of on-processor nonzeros in my portion of the global matrix.
Definition: dof_map.h:1662
AugmentSendList * _augment_send_list
Function object to call to add extra entries to the send list.
Definition: dof_map.h:1593
void check_for_constraint_loops()
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:1668
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:1648
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:673
dof_id_type n_dofs() const
Definition: dof_map.h:580
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:1702
const Variable & variable(const unsigned int c) const
Definition: dof_map.h:1786
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:1581
dof_id_type _n_SCALAR_dofs
The total number of SCALAR dofs associated to all SCALAR variables.
Definition: dof_map.h:1679
PeriodicBoundaries * get_periodic_boundaries()
Definition: dof_map.h:1208
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:918
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:949
dof_id_type n_constrained_nodes() const
Definition: dof_map.h:816
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:1251
bool is_constrained_dof(const dof_id_type dof) const
Definition: dof_map.h:1853
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:1776
dof_id_type end_old_dof(const processor_id_type proc) const
Definition: dof_map.h:670
DofConstraints _dof_constraints
Data structure containing DOF constraints.
Definition: dof_map.h:1711
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:1342
std::vector< DirichletBoundaries * > _adjoint_dirichlet_boundaries
Data structure containing Dirichlet functions.
Definition: dof_map.h:1751
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:1603
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:1246
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:650
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:1549
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:924
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:1731
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:1863
void unstash_dof_constraints()
Definition: dof_map.h:933
dof_id_type first_old_dof() const
Definition: dof_map.h:618
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:1399
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:927
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:1921
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:1611
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:1713
std::vector< Variable > _variables
The finite element type for each variable.
Definition: dof_map.h:1522
DofConstraints _stashed_dof_constraints
Definition: dof_map.h:1711
void remove_default_ghosting()
Remove any default ghosting functor(s).
dof_id_type first_dof() const
Definition: dof_map.h:608
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:1686
void clear_sparsity()
Clears the sparsity pattern.
Order variable_order(const unsigned int c) const
Definition: dof_map.h:1796
dof_id_type last_dof(const processor_id_type proc) const
Definition: dof_map.h:630
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:1642
std::vector< dof_id_type > _end_df
Last DOF index (plus 1) on processor p.
Definition: dof_map.h:1559
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:1554
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:1598
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:1542
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:1619
std::vector< unsigned int > _variable_group_numbers
The variable group number for each variable.
Definition: dof_map.h:1532
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:605
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:647
Order variable_group_order(const unsigned int vg) const
Definition: dof_map.h:1806
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 constraint loops...
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:555
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:615
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 any constraint loops, i.e.
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:1673
bool local_index(dof_id_type dof_index) const
Definition: dof_map.h:744
NodeConstraints _node_constraints
Data structure containing DofObject constraints.
Definition: dof_map.h:1722
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:1935
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:1912
void enforce_constraints_on_jacobian(const NonlinearImplicitSystem &system, SparseMatrix< Number > *jac) const