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 
315  void add_coupling_functor(std::shared_ptr<GhostingFunctor> coupling_functor,
316  bool to_mesh = true)
317  { _shared_functors[coupling_functor.get()] = coupling_functor;
318  this->add_coupling_functor(*coupling_functor, to_mesh); }
319 
325  void remove_coupling_functor(GhostingFunctor & coupling_functor);
326 
330  std::set<GhostingFunctor *>::const_iterator coupling_functors_begin() const
331  { return _coupling_functors.begin(); }
332 
336  std::set<GhostingFunctor *>::const_iterator coupling_functors_end() const
337  { return _coupling_functors.end(); }
338 
343 
367  void add_algebraic_ghosting_functor(GhostingFunctor & evaluable_functor,
368  bool to_mesh = true);
369 
377  void add_algebraic_ghosting_functor(std::shared_ptr<GhostingFunctor> evaluable_functor,
378  bool to_mesh = true)
379  { _shared_functors[evaluable_functor.get()] = evaluable_functor;
380  this->add_algebraic_ghosting_functor(*evaluable_functor, to_mesh); }
381 
387  void remove_algebraic_ghosting_functor(GhostingFunctor & evaluable_functor);
388 
392  std::set<GhostingFunctor *>::const_iterator algebraic_ghosting_functors_begin() const
393  { return _algebraic_ghosting_functors.begin(); }
394 
398  std::set<GhostingFunctor *>::const_iterator algebraic_ghosting_functors_end() const
399  { return _algebraic_ghosting_functors.end(); }
400 
405 
417  {
419  }
420 
432  std::vector<dof_id_type> & n_nz,
433  std::vector<dof_id_type> & n_oz,
434  void *),
435  void * context = nullptr)
437 
446  {
447  _augment_send_list = &asl;
448  }
449 
454  void attach_extra_send_list_function(void (*func)(std::vector<dof_id_type> &, void *),
455  void * context = nullptr)
457 
464  void prepare_send_list ();
465 
472  {
473  _send_list.clear();
474  }
475 
485  void reinit_send_list (MeshBase & mesh);
486 
487 
497  const std::vector<dof_id_type> & get_send_list() const { return _send_list; }
498 
506  const std::vector<dof_id_type> & get_n_nz() const
507  {
508  libmesh_assert(_n_nz);
509  return *_n_nz;
510  }
511 
519  const std::vector<dof_id_type> & get_n_oz() const
520  {
521  libmesh_assert(_n_oz);
522  return *_n_oz;
523  }
524 
525  // /**
526  // * Add an unknown of order \p order and finite element type
527  // * \p type to the system of equations.
528  // */
529  // void add_variable (const Variable & var);
530 
535  void add_variable_group (const VariableGroup & var_group);
536 
547  void set_error_on_cyclic_constraint(bool error_on_cyclic_constraint);
548  void set_error_on_constraint_loop(bool error_on_constraint_loop);
549 
553  const VariableGroup & variable_group (const unsigned int c) const;
554 
558  const Variable & variable (const unsigned int c) const;
559 
563  Order variable_order (const unsigned int c) const;
564 
568  Order variable_group_order (const unsigned int vg) const;
569 
573  const FEType & variable_type (const unsigned int c) const;
574 
578  const FEType & variable_group_type (const unsigned int vg) const;
579 
585  unsigned int n_variable_groups() const
586  { return cast_int<unsigned int>(_variable_groups.size()); }
587 
593  unsigned int n_variables() const
594  { return cast_int<unsigned int>(_variables.size()); }
595 
602  {
603 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE
604  return ((this->n_variable_groups() == 1) && (this->n_variables() > 1));
605 #else
606  return false;
607 #endif
608  }
609 
614  unsigned int block_size() const
615  {
616 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE
617  return (this->has_blocked_representation() ? this->n_variables() : 1);
618 #else
619  return 1;
620 #endif
621  }
622 
626  dof_id_type n_dofs() const { return _n_dfs; }
627 
632 
637  { return this->n_dofs_on_processor (this->processor_id()); }
638 
642  dof_id_type n_dofs_on_processor(const processor_id_type proc) const
643  {
644  libmesh_assert_less (proc, _first_df.size());
645  return cast_int<dof_id_type>(_end_df[proc] - _first_df[proc]);
646  }
647 
652  { libmesh_assert_less (proc, _first_df.size()); return _first_df[proc]; }
653 
655  { return this->first_dof(this->processor_id()); }
656 
657 #ifdef LIBMESH_ENABLE_AMR
658 
661  dof_id_type first_old_dof(const processor_id_type proc) const
662  { libmesh_assert_less (proc, _first_old_df.size()); return _first_old_df[proc]; }
663 
665  { return this->first_old_dof(this->processor_id()); }
666 
667 #endif //LIBMESH_ENABLE_AMR
668 
675 #ifdef LIBMESH_ENABLE_DEPRECATED
676  dof_id_type last_dof(const processor_id_type proc) const
677  {
678  libmesh_deprecated();
679  libmesh_assert_less (proc, _end_df.size());
680  return cast_int<dof_id_type>(_end_df[proc] - 1);
681  }
682 
684  { return this->last_dof(this->processor_id()); }
685 #endif
686 
693  dof_id_type end_dof(const processor_id_type proc) const
694  { libmesh_assert_less (proc, _end_df.size()); return _end_df[proc]; }
695 
697  { return this->end_dof(this->processor_id()); }
698 
703  { std::vector<dof_id_type>::const_iterator ub =
704  std::upper_bound(_end_df.begin(), _end_df.end(), dof);
705  libmesh_assert (ub != _end_df.end());
706  return cast_int<processor_id_type>(ub - _end_df.begin());
707  }
708 
709 #ifdef LIBMESH_ENABLE_AMR
710 
717  { libmesh_assert_less (proc, _end_old_df.size()); return _end_old_df[proc]; }
718 
720  { return this->end_old_dof(this->processor_id()); }
721 
722 #endif //LIBMESH_ENABLE_AMR
723 
728  void dof_indices (const Elem * const elem,
729  std::vector<dof_id_type> & di) const;
730 
736  void dof_indices (const Elem * const elem,
737  std::vector<dof_id_type> & di,
738  const unsigned int vn,
739  int p_level = -12345) const;
740 
745  void dof_indices (const Node * const node,
746  std::vector<dof_id_type> & di) const;
747 
752  void dof_indices (const Node * const node,
753  std::vector<dof_id_type> & di,
754  const unsigned int vn) const;
755 
762  void dof_indices (const Elem & elem,
763  unsigned int n,
764  std::vector<dof_id_type> & di,
765  const unsigned int vn) const;
766 
773  void old_dof_indices (const Elem & elem,
774  unsigned int n,
775  std::vector<dof_id_type> & di,
776  const unsigned int vn) const;
777 
786  void SCALAR_dof_indices (std::vector<dof_id_type> & di,
787  const unsigned int vn,
788  const bool old_dofs=false) const;
789 
797  bool semilocal_index (dof_id_type dof_index) const;
798 
806  bool all_semilocal_indices (const std::vector<dof_id_type> & dof_indices) const;
807 
812  bool local_index (dof_id_type dof_index) const
813  { return (dof_index >= this->first_dof()) && (dof_index < this->end_dof()); }
814 
820  template <typename DofObjectSubclass>
821  bool is_evaluable(const DofObjectSubclass & obj,
822  unsigned int var_num = libMesh::invalid_uint) const;
823 
831  void set_implicit_neighbor_dofs(bool implicit_neighbor_dofs);
832 
839  bool use_coupled_neighbor_dofs(const MeshBase & mesh) const;
840 
852  const std::vector<dof_id_type> & dof_indices,
853  DenseVectorBase<Number> & Ue) const;
854 
859  void local_variable_indices(std::vector<dof_id_type> & idx,
860  const MeshBase & mesh,
861  unsigned int var_num) const;
862 
863 #ifdef LIBMESH_ENABLE_CONSTRAINTS
864 
865  //--------------------------------------------------------------------
866  // Constraint-specific methods
872 
878 
879 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
880 
885  { return cast_int<dof_id_type>(_node_constraints.size()); }
886 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
887 
893  void create_dof_constraints (const MeshBase &, Real time=0);
894 
899 
903  void scatter_constraints (MeshBase &);
904 
918  void gather_constraints (MeshBase & mesh,
919  std::set<dof_id_type> & unexpanded_dofs,
920  bool look_for_constrainees);
921 
929  void process_constraints (MeshBase &);
930 
947 
952  void add_constraint_row (const dof_id_type dof_number,
953  const DofConstraintRow & constraint_row,
954  const Number constraint_rhs,
955  const bool forbid_constraint_overwrite);
956 
967  void add_adjoint_constraint_row (const unsigned int qoi_index,
968  const dof_id_type dof_number,
969  const DofConstraintRow & constraint_row,
970  const Number constraint_rhs,
971  const bool forbid_constraint_overwrite);
972 
978  void add_constraint_row (const dof_id_type dof_number,
979  const DofConstraintRow & constraint_row,
980  const bool forbid_constraint_overwrite = true)
981  { add_constraint_row(dof_number, constraint_row, 0., forbid_constraint_overwrite); }
982 
986  DofConstraints::const_iterator constraint_rows_begin() const
987  { return _dof_constraints.begin(); }
988 
992  DofConstraints::const_iterator constraint_rows_end() const
993  { return _dof_constraints.end(); }
994 
996  {
997  libmesh_assert(_stashed_dof_constraints.empty());
999  }
1000 
1002  {
1003  libmesh_assert(_dof_constraints.empty());
1005  }
1006 
1020  {
1022  }
1023 
1024 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1025 
1028  NodeConstraints::const_iterator node_constraint_rows_begin() const
1029  { return _node_constraints.begin(); }
1030 
1034  NodeConstraints::const_iterator node_constraint_rows_end() const
1035  { return _node_constraints.end(); }
1036 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
1037 
1042  bool is_constrained_dof (const dof_id_type dof) const;
1043 
1048  bool has_heterogenous_adjoint_constraints (const unsigned int qoi_num) const;
1049 
1055  Number has_heterogenous_adjoint_constraint (const unsigned int qoi_num,
1056  const dof_id_type dof) const;
1057 
1063 
1068  bool is_constrained_node (const Node * node) const;
1069 
1076  void print_dof_constraints(std::ostream & os=libMesh::out,
1077  bool print_nonlocal=false) const;
1078 
1084  std::string get_local_constraints(bool print_nonlocal=false) const;
1085 
1086 
1095  std::pair<Real, Real> max_constraint_error(const System & system,
1096  NumericVector<Number> * v = nullptr) const;
1097 
1098 #endif // LIBMESH_ENABLE_CONSTRAINTS
1099 
1100  //--------------------------------------------------------------------
1101  // Constraint-specific methods
1102  // Some of these methods are enabled (but inlined away to nothing)
1103  // when constraints are disabled at configure-time. This is to
1104  // increase API compatibility of user code with different library
1105  // builds.
1106 
1121  std::vector<dof_id_type> & elem_dofs,
1122  bool asymmetric_constraint_rows = true) const;
1123 
1131  std::vector<dof_id_type> & row_dofs,
1132  std::vector<dof_id_type> & col_dofs,
1133  bool asymmetric_constraint_rows = true) const;
1134 
1139  std::vector<dof_id_type> & dofs,
1140  bool asymmetric_constraint_rows = true) const;
1141 
1151  DenseVector<Number> & rhs,
1152  std::vector<dof_id_type> & elem_dofs,
1153  bool asymmetric_constraint_rows = true) const;
1154 
1179  DenseVector<Number> & rhs,
1180  std::vector<dof_id_type> & elem_dofs,
1181  bool asymmetric_constraint_rows = true,
1182  int qoi_index = -1) const;
1183 
1206  DenseVector<Number> & rhs,
1207  std::vector<dof_id_type> & elem_dofs,
1208  bool asymmetric_constraint_rows = true,
1209  int qoi_index = -1) const;
1210 
1211 
1212 
1222  DenseVector<Number> & w,
1223  std::vector<dof_id_type> & row_dofs,
1224  bool asymmetric_constraint_rows = true) const;
1225 
1232  void constrain_nothing (std::vector<dof_id_type> & dofs) const;
1233 
1247  void enforce_constraints_exactly (const System & system,
1248  NumericVector<Number> * v = nullptr,
1249  bool homogeneous = false) const;
1250 
1258  unsigned int q) const;
1259 
1261  NumericVector<Number> * rhs,
1262  NumericVector<Number> const * solution,
1263  bool homogeneous = true) const;
1265  SparseMatrix<Number> * jac) const;
1266 
1267 
1268 
1269 #ifdef LIBMESH_ENABLE_PERIODIC
1270 
1271  //--------------------------------------------------------------------
1272  // PeriodicBoundary-specific methods
1273 
1277  void add_periodic_boundary (const PeriodicBoundaryBase & periodic_boundary);
1278 
1285  void add_periodic_boundary (const PeriodicBoundaryBase & boundary, const PeriodicBoundaryBase & inverse_boundary);
1286 
1291  bool is_periodic_boundary (const boundary_id_type boundaryid) const;
1292 
1294  {
1295  return _periodic_boundaries.get();
1296  }
1297 
1298 #endif // LIBMESH_ENABLE_PERIODIC
1299 
1300 
1301 #ifdef LIBMESH_ENABLE_DIRICHLET
1302 
1303  //--------------------------------------------------------------------
1304  // DirichletBoundary-specific methods
1305 
1309  void add_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary);
1310 
1316  void add_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary,
1317  unsigned int q);
1318 
1322  void remove_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary);
1323 
1328  void remove_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary,
1329  unsigned int q);
1330 
1332  {
1333  return _dirichlet_boundaries.get();
1334  }
1335 
1337  {
1338  return _dirichlet_boundaries.get();
1339  }
1340 
1341  bool has_adjoint_dirichlet_boundaries(unsigned int q) const;
1342 
1343  const DirichletBoundaries *
1344  get_adjoint_dirichlet_boundaries(unsigned int q) const;
1345 
1347  get_adjoint_dirichlet_boundaries(unsigned int q);
1348 
1349 #endif // LIBMESH_ENABLE_DIRICHLET
1350 
1351 
1352 #ifdef LIBMESH_ENABLE_AMR
1353 
1354  //--------------------------------------------------------------------
1355  // AMR-specific methods
1356 
1365  // void augment_send_list_for_projection(const MeshBase &);
1366 
1373  void old_dof_indices (const Elem * const elem,
1374  std::vector<dof_id_type> & di,
1375  const unsigned int vn = libMesh::invalid_uint) const;
1379  dof_id_type n_old_dofs() const { return _n_old_dfs; }
1380 
1386  void constrain_p_dofs (unsigned int var,
1387  const Elem * elem,
1388  unsigned int s,
1389  unsigned int p);
1390 
1391 #endif // LIBMESH_ENABLE_AMR
1392 
1396  void reinit (MeshBase & mesh);
1397 
1402  void clear ();
1403 
1407  void print_info(std::ostream & os=libMesh::out) const;
1408 
1412  std::string get_info() const;
1413 
1428 
1432  unsigned int sys_number() const;
1433 
1434 private:
1435 
1446  void _dof_indices (const Elem & elem,
1447  int p_level,
1448  std::vector<dof_id_type> & di,
1449  const unsigned int vg,
1450  const unsigned int vig,
1451  const Node * const * nodes,
1452  unsigned int n_nodes
1453 #ifdef DEBUG
1454  ,
1455  const unsigned int v,
1456  std::size_t & tot_size
1457 #endif
1458  ) const;
1459 
1464  void _node_dof_indices (const Elem & elem,
1465  unsigned int n,
1466  const DofObject & obj,
1467  std::vector<dof_id_type> & di,
1468  const unsigned int vn) const;
1469 
1473  std::unique_ptr<SparsityPattern::Build> build_sparsity(const MeshBase & mesh) const;
1474 
1478  void invalidate_dofs(MeshBase & mesh) const;
1479 
1483  DofObject * node_ptr(MeshBase & mesh, dof_id_type i) const;
1484 
1488  DofObject * elem_ptr(MeshBase & mesh, dof_id_type i) const;
1489 
1493  typedef DofObject * (DofMap::*dofobject_accessor)
1494  (MeshBase & mesh, dof_id_type i) const;
1495 
1499  template<typename iterator_type>
1500  void set_nonlocal_dof_objects(iterator_type objects_begin,
1501  iterator_type objects_end,
1502  MeshBase & mesh,
1503  dofobject_accessor objects);
1504 
1513  void distribute_local_dofs_var_major (dof_id_type & next_free_dof,
1514  MeshBase & mesh);
1515 
1527  void distribute_local_dofs_node_major (dof_id_type & next_free_dof,
1528  MeshBase & mesh);
1529 
1530  /*
1531  * A utility method for obtaining a set of elements to ghost along
1532  * with merged coupling matrices.
1533  */
1534  static void
1536  std::set<CouplingMatrix *> & temporary_coupling_matrices,
1537  const std::set<GhostingFunctor *>::iterator & gf_begin,
1538  const std::set<GhostingFunctor *>::iterator & gf_end,
1539  const MeshBase::const_element_iterator & elems_begin,
1540  const MeshBase::const_element_iterator & elems_end,
1541  processor_id_type p);
1542 
1547  void add_neighbors_to_send_list(MeshBase & mesh);
1548 
1549 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1550 
1562  std::vector<dof_id_type> & elem_dofs,
1563  const bool called_recursively=false) const;
1564 
1581  DenseVector<Number> & H,
1582  std::vector<dof_id_type> & elem_dofs,
1583  int qoi_index = -1,
1584  const bool called_recursively=false) const;
1585 
1590  void find_connected_dofs (std::vector<dof_id_type> & elem_dofs) const;
1591 
1596  void find_connected_dof_objects (std::vector<const DofObject *> & objs) const;
1597 
1604 
1605 #endif // LIBMESH_ENABLE_CONSTRAINTS
1606 
1613 
1617  std::vector<Variable> _variables;
1618 
1622  std::vector<VariableGroup> _variable_groups;
1623 
1627  std::vector<unsigned int> _variable_group_numbers;
1628 
1632  const unsigned int _sys_number;
1633 
1638 
1644  std::vector<SparseMatrix<Number> * > _matrices;
1645 
1649  std::vector<dof_id_type> _first_df;
1650 
1654  std::vector<dof_id_type> _end_df;
1655 
1660  std::vector<dof_id_type> _first_scalar_df;
1661 
1666  std::vector<dof_id_type> _send_list;
1667 
1672 
1677  std::vector<dof_id_type> & n_nz,
1678  std::vector<dof_id_type> & n_oz,
1679  void *);
1684 
1689 
1693  void (*_extra_send_list_function)(std::vector<dof_id_type> &, void *);
1694 
1699 
1706  std::unique_ptr<DefaultCoupling> _default_coupling;
1707 
1714  std::unique_ptr<DefaultCoupling> _default_evaluating;
1715 
1724  std::set<GhostingFunctor *> _algebraic_ghosting_functors;
1725 
1737  std::set<GhostingFunctor *> _coupling_functors;
1738 
1743  std::map<GhostingFunctor *, std::shared_ptr<GhostingFunctor> > _shared_functors;
1744 
1750 
1755  std::unique_ptr<SparsityPattern::Build> _sp;
1756 
1763  std::vector<dof_id_type> * _n_nz;
1764 
1769  std::vector<dof_id_type> * _n_oz;
1770 
1775 
1781 
1782 #ifdef LIBMESH_ENABLE_AMR
1783 
1788 
1792  std::vector<dof_id_type> _first_old_df;
1793 
1797  std::vector<dof_id_type> _end_old_df;
1798 
1803  std::vector<dof_id_type> _first_old_scalar_df;
1804 
1805 #endif
1806 
1807 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1808 
1813 
1815 
1817 #endif
1818 
1819 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1820 
1824 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
1825 
1826 
1827 #ifdef LIBMESH_ENABLE_PERIODIC
1828 
1832  std::unique_ptr<PeriodicBoundaries> _periodic_boundaries;
1833 #endif
1834 
1835 #ifdef LIBMESH_ENABLE_DIRICHLET
1836 
1840  void check_dirichlet_bcid_consistency (const MeshBase & mesh,
1841  const DirichletBoundary & boundary) const;
1846  std::unique_ptr<DirichletBoundaries> _dirichlet_boundaries;
1847 
1852  std::vector<DirichletBoundaries *> _adjoint_dirichlet_boundaries;
1853 #endif
1854 
1856 
1863 };
1864 
1865 
1866 // ------------------------------------------------------------
1867 // Dof Map inline member functions
1868 inline
1869 unsigned int DofMap::sys_number() const
1870 {
1871  return _sys_number;
1872 }
1873 
1874 
1875 
1876 inline
1877 const VariableGroup & DofMap::variable_group (const unsigned int g) const
1878 {
1879  libmesh_assert_less (g, _variable_groups.size());
1880 
1881  return _variable_groups[g];
1882 }
1883 
1884 
1885 
1886 inline
1887 const Variable & DofMap::variable (const unsigned int c) const
1888 {
1889  libmesh_assert_less (c, _variables.size());
1890 
1891  return _variables[c];
1892 }
1893 
1894 
1895 
1896 inline
1897 Order DofMap::variable_order (const unsigned int c) const
1898 {
1899  libmesh_assert_less (c, _variables.size());
1900 
1901  return _variables[c].type().order;
1902 }
1903 
1904 
1905 
1906 inline
1907 Order DofMap::variable_group_order (const unsigned int vg) const
1908 {
1909  libmesh_assert_less (vg, _variable_groups.size());
1910 
1911  return _variable_groups[vg].type().order;
1912 }
1913 
1914 
1915 
1916 inline
1917 const FEType & DofMap::variable_type (const unsigned int c) const
1918 {
1919  libmesh_assert_less (c, _variables.size());
1920 
1921  return _variables[c].type();
1922 }
1923 
1924 
1925 
1926 inline
1927 const FEType & DofMap::variable_group_type (const unsigned int vg) const
1928 {
1929  libmesh_assert_less (vg, _variable_groups.size());
1930 
1931  return _variable_groups[vg].type();
1932 }
1933 
1934 
1935 
1936 inline
1938 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1939  node
1940 #endif
1941  ) const
1942 {
1943 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1944  if (_node_constraints.count(node))
1945  return true;
1946 #endif
1947 
1948  return false;
1949 }
1950 
1951 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1952 
1953 inline
1955 {
1956  if (_dof_constraints.count(dof))
1957  return true;
1958 
1959  return false;
1960 }
1961 
1962 
1963 inline
1964 bool DofMap::has_heterogenous_adjoint_constraints (const unsigned int qoi_num) const
1965 {
1966  AdjointDofConstraintValues::const_iterator it =
1967  _adjoint_constraint_values.find(qoi_num);
1968  if (it == _adjoint_constraint_values.end())
1969  return false;
1970  if (it->second.empty())
1971  return false;
1972 
1973  return true;
1974 }
1975 
1976 
1977 inline
1979  const dof_id_type dof) const
1980 {
1981  AdjointDofConstraintValues::const_iterator it =
1982  _adjoint_constraint_values.find(qoi_num);
1983  if (it != _adjoint_constraint_values.end())
1984  {
1985  DofConstraintValueMap::const_iterator rhsit =
1986  it->second.find(dof);
1987  if (rhsit == it->second.end())
1988  return 0;
1989  else
1990  return rhsit->second;
1991  }
1992 
1993  return 0;
1994 }
1995 
1996 
1997 
1998 inline
2000 {
2002 }
2003 
2004 
2005 
2006 #else
2007 
2008 //--------------------------------------------------------------------
2009 // Constraint-specific methods get inlined into nothing if
2010 // constraints are disabled, so there's no reason for users not to
2011 // use them.
2012 
2014  std::vector<dof_id_type> &,
2015  bool) const {}
2016 
2018  std::vector<dof_id_type> &,
2019  std::vector<dof_id_type> &,
2020  bool) const {}
2021 
2023  std::vector<dof_id_type> &,
2024  bool) const {}
2025 
2028  std::vector<dof_id_type> &,
2029  bool) const {}
2030 
2033  std::vector<dof_id_type> &,
2034  bool) const {}
2035 
2038  bool = false) const {}
2039 
2041  unsigned int) const {}
2042 
2043 #endif // LIBMESH_ENABLE_CONSTRAINTS
2044 
2045 } // namespace libMesh
2046 
2047 #endif // LIBMESH_DOF_MAP_H
std::vector< VariableGroup > _variable_groups
The finite element type for each variable group.
Definition: dof_map.h:1622
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:1755
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:2031
bool _implicit_neighbor_dofs_initialized
Bools to indicate if we override the –implicit_neighbor_dofs commandline options.
Definition: dof_map.h:1861
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:1937
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:585
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:1632
bool _implicit_neighbor_dofs
Definition: dof_map.h:1862
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:1999
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:636
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
DefaultCoupling & default_coupling()
Default coupling functor.
Definition: dof_map.h:342
const std::vector< dof_id_type > & get_n_oz() const
Definition: dof_map.h:519
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:631
std::set< GhostingFunctor * >::const_iterator coupling_functors_begin() const
Beginning of range of coupling functors.
Definition: dof_map.h:330
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:642
processor_id_type dof_owner(const dof_id_type dof) const
Definition: dof_map.h:702
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:1612
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:1683
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:2026
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:1670
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:1978
dof_id_type last_dof() const
Definition: dof_map.h:683
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:1927
NodeConstraints::const_iterator node_constraint_rows_begin() const
Definition: dof_map.h:1028
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:1666
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1917
unsigned int block_size() const
Definition: dof_map.h:614
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 clear_send_list()
Clears the _send_list vector.
Definition: dof_map.h:471
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:593
DefaultCoupling & default_algebraic_ghosting()
Default algebraic ghosting functor.
Definition: dof_map.h:404
AugmentSparsityPattern * _augment_sparsity_pattern
Function object to call to add extra entries to the sparsity pattern.
Definition: dof_map.h:1671
std::unique_ptr< DirichletBoundaries > _dirichlet_boundaries
Data structure containing Dirichlet functions.
Definition: dof_map.h:1846
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:1724
std::vector< dof_id_type > _end_old_df
Last old DOF index (plus 1) on processor p.
Definition: dof_map.h:1797
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:1379
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:978
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:1792
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:416
unsigned int sys_number() const
Definition: dof_map.h:1869
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:104
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:1660
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:2040
AdjointDofConstraintValues _adjoint_constraint_values
Definition: dof_map.h:1816
std::vector< dof_id_type > * _n_nz
The number of on-processor nonzeros in my portion of the global matrix.
Definition: dof_map.h:1763
AugmentSendList * _augment_send_list
Function object to call to add extra entries to the send list.
Definition: dof_map.h:1688
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:1769
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:1749
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
void _node_dof_indices(const Elem &elem, unsigned int n, const DofObject &obj, std::vector< dof_id_type > &di, const unsigned int vn) const
Helper function that implements the element-nodal versions of dof_indices and old_dof_indices.
void add_algebraic_ghosting_functor(std::shared_ptr< GhostingFunctor > evaluable_functor, bool to_mesh=true)
Adds a functor which can specify algebraic ghosting requirements for use with distributed vectors...
Definition: dof_map.h:377
void reinit_send_list(MeshBase &mesh)
Clears the _send_list vector and then rebuilds it.
dof_id_type end_old_dof() const
Definition: dof_map.h:719
dof_id_type n_dofs() const
Definition: dof_map.h:626
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:1803
const Variable & variable(const unsigned int c) const
Definition: dof_map.h:1887
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:1676
dof_id_type _n_SCALAR_dofs
The total number of SCALAR dofs associated to all SCALAR variables.
Definition: dof_map.h:1780
PeriodicBoundaries * get_periodic_boundaries()
Definition: dof_map.h:1293
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:986
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:92
void swap_dof_constraints()
Similar to the stash/unstash_dof_constraints() API, but swaps _dof_constraints and _stashed_dof_const...
Definition: dof_map.h:1019
NodeConstraints::const_iterator node_constraint_rows_end() const
Definition: dof_map.h:1034
dof_id_type n_constrained_nodes() const
Definition: dof_map.h:884
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:1336
bool is_constrained_dof(const dof_id_type dof) const
Definition: dof_map.h:1954
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:1877
dof_id_type end_old_dof(const processor_id_type proc) const
Definition: dof_map.h:716
DofConstraints _dof_constraints
Data structure containing DOF constraints.
Definition: dof_map.h:1812
void add_coupling_functor(std::shared_ptr< GhostingFunctor > coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
Definition: dof_map.h:315
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:1427
std::vector< DirichletBoundaries * > _adjoint_dirichlet_boundaries
Data structure containing Dirichlet functions.
Definition: dof_map.h:1852
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:1698
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:1331
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:696
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:1644
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:398
DofConstraints::const_iterator constraint_rows_end() const
Definition: dof_map.h:992
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:1832
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:1964
void unstash_dof_constraints()
Definition: dof_map.h:1001
dof_id_type first_old_dof() const
Definition: dof_map.h:664
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:1494
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:995
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:2022
const std::vector< dof_id_type > & get_n_nz() const
Definition: dof_map.h:506
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:454
std::unique_ptr< DefaultCoupling > _default_coupling
The default coupling GhostingFunctor, used to implement standard libMesh sparsity pattern constructio...
Definition: dof_map.h:1706
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:1814
std::vector< Variable > _variables
The finite element type for each variable.
Definition: dof_map.h:1617
DofConstraints _stashed_dof_constraints
Definition: dof_map.h:1812
void remove_default_ghosting()
Remove any default ghosting functor(s).
dof_id_type first_dof() const
Definition: dof_map.h:654
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:431
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:1787
void clear_sparsity()
Clears the sparsity pattern.
Order variable_order(const unsigned int c) const
Definition: dof_map.h:1897
dof_id_type last_dof(const processor_id_type proc) const
Definition: dof_map.h:676
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:1737
std::vector< dof_id_type > _end_df
Last DOF index (plus 1) on processor p.
Definition: dof_map.h:1654
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:1649
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:1693
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:336
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:1637
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:1714
std::vector< unsigned int > _variable_group_numbers
The variable group number for each variable.
Definition: dof_map.h:1627
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
Definition: dof_map.h:1743
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:651
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:445
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:693
Order variable_group_order(const unsigned int vg) const
Definition: dof_map.h:1907
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_begin() const
Beginning of range of algebraic ghosting functors.
Definition: dof_map.h:392
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:601
The constraint matrix storage format.
Definition: dof_map.h:106
const std::vector< dof_id_type > & get_send_list() const
Definition: dof_map.h:497
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:661
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.
void old_dof_indices(const Elem &elem, unsigned int n, std::vector< dof_id_type > &di, const unsigned int vn) const
Appends to the vector di the old global degree of freedom indices for elem.node_ref(n), for one variable vn.
uint8_t dof_id_type
Definition: id_types.h:67
dof_id_type _n_dfs
Total number of degrees of freedom.
Definition: dof_map.h:1774
bool local_index(dof_id_type dof_index) const
Definition: dof_map.h:812
NodeConstraints _node_constraints
Data structure containing DofObject constraints.
Definition: dof_map.h:1823
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:2036
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:2013
void enforce_constraints_on_jacobian(const NonlinearImplicitSystem &system, SparseMatrix< Number > *jac) const