20 #ifndef LIBMESH_DOF_MAP_H 21 #define LIBMESH_DOF_MAP_H 24 #include "libmesh/libmesh_common.h" 25 #include "libmesh/reference_counted_object.h" 26 #include "libmesh/libmesh.h" 27 #include "libmesh/variable.h" 28 #include "libmesh/threads.h" 29 #include "libmesh/threads_allocators.h" 30 #include "libmesh/elem_range.h" 31 #include "libmesh/ghosting_functor.h" 32 #include "libmesh/sparsity_pattern.h" 33 #include "libmesh/parallel_object.h" 34 #include "libmesh/point.h" 35 #include "libmesh/utility.h" 36 #include "libmesh/elem.h" 37 #include "libmesh/fe_interface.h" 38 #include "libmesh/libmesh_logging.h" 39 #include "libmesh/enum_elem_type.h" 40 #include "libmesh/mesh_subdivision_support.h" 41 #include "libmesh/dof_map_base.h" 61 class DefaultCoupling;
62 class DirichletBoundary;
63 class DirichletBoundaries;
68 class PeriodicBoundaryBase;
69 class PeriodicBoundaries;
71 class NonlinearImplicitSystem;
72 class StaticCondensationDofMap;
85 #if defined(LIBMESH_ENABLE_AMR) || \ 86 defined(LIBMESH_ENABLE_PERIODIC) || \ 87 defined(LIBMESH_ENABLE_DIRICHLET) 88 # define LIBMESH_ENABLE_CONSTRAINTS 1 94 #ifdef LIBMESH_ENABLE_CONSTRAINTS 99 std::less<dof_id_type>,
110 std::less<dof_id_type>,
111 Threads::scalable_allocator<std::pair<const dof_id_type, DofConstraintRow>>>
121 public std::map<dof_id_type, Number,
122 std::less<dof_id_type>,
123 Threads::scalable_allocator<std::pair<const dof_id_type, Number>>>
132 public std::map<unsigned int, DofConstraintValueMap,
133 std::less<unsigned int>,
134 Threads::scalable_allocator
135 <std::pair<const unsigned int, DofConstraintValueMap>>>
139 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 146 typedef std::map<
const Node *,
Real,
147 std::less<const Node *>,
157 std::pair<NodeConstraintRow,Point>,
158 std::less<const Node *>,
159 Threads::scalable_allocator<std::pair<const Node * const, std::pair<NodeConstraintRow,Point>>>>
162 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 164 #endif // LIBMESH_ENABLE_CONSTRAINTS 335 bool to_mesh =
true);
397 bool to_mesh =
true);
461 std::vector<dof_id_type> & n_nz,
462 std::vector<dof_id_type> & n_oz,
464 void * context =
nullptr)
484 void * context =
nullptr)
538 return _sp->get_n_nz();
551 return _sp->get_n_oz();
629 {
return cast_int<unsigned int>(
_variables.size()); }
668 dof_id_type
n_dofs(
const unsigned int vn)
const 708 { std::vector<dof_id_type>::const_iterator ub =
711 return cast_int<processor_id_type>(ub -
_end_df.begin());
715 std::vector<dof_id_type> & di)
const;
723 std::vector<dof_id_type> & di,
724 const unsigned int vn,
725 int p_level = -12345)
const override;
756 template <
typename ScalarDofsFunctor,
typename FieldDofsFunctor>
758 std::vector<dof_id_type> & di,
759 const unsigned int vn,
760 ScalarDofsFunctor scalar_dofs_functor,
761 FieldDofsFunctor field_dofs_functor,
762 int p_level = -12345)
const;
769 std::vector<dof_id_type> & di)
const;
776 std::vector<dof_id_type> & di,
777 const unsigned int vn)
const override;
787 std::vector<dof_id_type> & di,
788 const unsigned int vn)
const;
790 #ifdef LIBMESH_ENABLE_AMR 800 std::vector<dof_id_type> & di,
801 const unsigned int vn)
const;
803 #endif // LIBMESH_ENABLE_AMR 814 const unsigned int vn,
815 const bool old_dofs=
false)
const;
840 {
return (dof_index >= this->
first_dof()) && (dof_index < this->
end_dof()); }
847 template <
typename DofObjectSub
class>
892 template <
typename T, std::enable_if_t<std::is_same_v<T, dof_
id_type> ||
893 std::is_same_v<T, std::vector<dof_
id_type>>,
int> = 0>
896 unsigned int var_num)
const;
903 template <
typename T,
904 std::enable_if_t<std::is_same_v<T, dof_id_type> ||
905 std::is_same_v<T, std::vector<dof_id_type>>,
910 #ifdef LIBMESH_ENABLE_CONSTRAINTS 926 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 933 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 969 std::set<dof_id_type> & unexpanded_dofs,
970 bool look_for_constrainees);
1004 const Number constraint_rhs,
1005 const bool forbid_constraint_overwrite);
1020 const Number constraint_rhs,
1021 const bool forbid_constraint_overwrite);
1030 const bool forbid_constraint_overwrite =
true)
1080 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 1092 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 1150 bool print_nonlocal=
false)
const;
1171 #endif // LIBMESH_ENABLE_CONSTRAINTS 1194 std::vector<dof_id_type> & elem_dofs,
1195 bool asymmetric_constraint_rows =
true)
const;
1204 std::vector<dof_id_type> & row_dofs,
1205 std::vector<dof_id_type> & col_dofs,
1206 bool asymmetric_constraint_rows =
true)
const;
1212 std::vector<dof_id_type> & dofs,
1213 bool asymmetric_constraint_rows =
true)
const;
1225 std::vector<dof_id_type> & elem_dofs,
1226 bool asymmetric_constraint_rows =
true)
const;
1253 std::vector<dof_id_type> & elem_dofs,
1254 bool asymmetric_constraint_rows =
true,
1255 int qoi_index = -1)
const;
1262 std::vector<dof_id_type> & elem_dofs,
1263 bool asymmetric_constraint_rows =
true,
1264 int qoi_index = -1)
const 1267 (matrix, rhs, elem_dofs, asymmetric_constraint_rows, qoi_index);
1297 std::vector<dof_id_type> & elem_dofs,
1298 bool asymmetric_constraint_rows =
true,
1299 int qoi_index = -1)
const;
1306 std::vector<dof_id_type> & elem_dofs,
1307 bool asymmetric_constraint_rows =
true,
1308 int qoi_index = -1)
const 1311 (matrix, rhs, elem_dofs, asymmetric_constraint_rows, qoi_index);
1335 std::vector<dof_id_type> & elem_dofs,
1353 std::vector<dof_id_type> & elem_dofs,
1373 std::vector<dof_id_type> & elem_dofs,
1386 std::vector<dof_id_type> & row_dofs,
1387 bool asymmetric_constraint_rows =
true)
const;
1412 bool homogeneous =
false)
const;
1421 unsigned int q)
const;
1426 bool homogeneous =
true)
const;
1431 #ifdef LIBMESH_ENABLE_PERIODIC 1465 #endif // LIBMESH_ENABLE_PERIODIC 1468 #ifdef LIBMESH_ENABLE_DIRICHLET 1532 #endif // LIBMESH_ENABLE_DIRICHLET 1535 #ifdef LIBMESH_ENABLE_AMR 1550 #ifdef LIBMESH_ENABLE_AMR 1559 std::vector<dof_id_type> & di,
1562 #endif // LIBMESH_ENABLE_AMR 1574 #endif // LIBMESH_ENABLE_AMR 1581 const std::map<
const Node *, std::set<subdomain_id_type>> &
1582 constraining_subdomains);
1588 virtual void clear ()
override;
1635 bool calculate_constrained =
false,
1636 bool use_condensed_system =
false)
const;
1695 std::vector<dof_id_type> & di,
1696 const unsigned int vg,
1697 const unsigned int vig,
1698 const Node *
const * nodes,
1700 const unsigned int v
1703 std::size_t & tot_size
1722 template <
typename FieldDofsFunctor>
1725 std::vector<dof_id_type> & di,
1726 const unsigned int vg,
1727 const unsigned int vig,
1728 const Node *
const * nodes,
1730 const unsigned int v,
1732 std::size_t & tot_size,
1734 FieldDofsFunctor field_dofs_functor)
const;
1743 std::vector<dof_id_type> & di,
1744 const unsigned int vn)
const;
1770 template<
typename iterator_type>
1772 iterator_type objects_end,
1790 std::map<const Node *, std::set<subdomain_id_type>>
1808 const std::map<
const Node *, std::set<subdomain_id_type>> &
1809 constraining_subdomains);
1829 const std::map<
const Node *, std::set<subdomain_id_type>> &
1830 constraining_subdomains);
1852 const std::set<GhostingFunctor *>::iterator & gf_begin,
1853 const std::set<GhostingFunctor *>::iterator & gf_end,
1864 #ifdef LIBMESH_ENABLE_CONSTRAINTS 1877 std::vector<dof_id_type> & elem_dofs,
1878 const bool called_recursively=
false)
const;
1897 std::vector<dof_id_type> & elem_dofs,
1899 const bool called_recursively=
false)
const;
1927 #endif // LIBMESH_ENABLE_CONSTRAINTS 2000 std::vector<dof_id_type> & n_nz,
2001 std::vector<dof_id_type> & n_oz,
2079 std::unique_ptr<SparsityPattern::Build>
_sp;
2087 #ifdef LIBMESH_ENABLE_AMR 2101 #ifdef LIBMESH_ENABLE_CONSTRAINTS 2113 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 2118 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 2121 #ifdef LIBMESH_ENABLE_PERIODIC 2129 #ifdef LIBMESH_ENABLE_DIRICHLET 2165 std::unique_ptr<StaticCondensationDofMap>
_sc;
2238 #ifdef LIBMESH_ENABLE_CONSTRAINTS 2243 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
2248 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 2270 AdjointDofConstraintValues::const_iterator it =
2274 if (it->second.empty())
2285 AdjointDofConstraintValues::const_iterator it =
2289 DofConstraintValueMap::const_iterator rhsit =
2290 it->second.find(dof);
2291 if (rhsit == it->second.end())
2294 return rhsit->second;
2318 std::vector<dof_id_type> &,
2322 std::vector<dof_id_type> &,
2323 std::vector<dof_id_type> &,
2327 std::vector<dof_id_type> &,
2332 std::vector<dof_id_type> &,
2337 std::vector<dof_id_type> &,
bool,
int)
const {}
2341 std::vector<dof_id_type> &,
bool,
int)
const {}
2345 std::vector<dof_id_type> &,
2355 unsigned int)
const {}
2368 #endif // LIBMESH_ENABLE_CONSTRAINTS 2376 if (use_constraints)
2377 libmesh_not_implemented();
2379 #ifdef LIBMESH_ENABLE_CONSTRAINTS 2394 #ifdef LIBMESH_ENABLE_CONSTRAINTS 2404 #ifdef LIBMESH_ENABLE_AMR 2421 #ifdef LIBMESH_ENABLE_AMR 2433 return libmesh_map_find(
_var_to_vg, var_num);
2439 #ifdef LIBMESH_ENABLE_AMR 2448 template <
typename FieldDofsFunctor>
2451 std::vector<dof_id_type> & di,
2452 const unsigned int vg,
2453 const unsigned int vig,
2454 const Node *
const * nodes,
2456 const unsigned int v,
2458 std::size_t & tot_size,
2460 FieldDofsFunctor field_dofs_functor)
const 2467 const unsigned int sys_num = this->
sys_number();
2468 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 2469 const bool is_inf = elem.
infinite();
2472 const bool extra_hanging_dofs =
2477 const bool add_p_level =
2478 #ifdef LIBMESH_ENABLE_AMR 2501 for (
unsigned int n=0; n !=
n_nodes; n++)
2503 const Node & node = *nodes[n];
2508 const std::pair<unsigned int, unsigned int>
2510 libmesh_assert_equal_to (vg, vg_and_offset.first);
2511 libmesh_assert_equal_to (vig, vg_and_offset.second);
2513 const unsigned int n_comp = node.
n_comp_group(sys_num,vg);
2519 const unsigned int nc =
2520 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 2524 ndan (type, fe_type.order + add_p_level*p_level, n);
2530 if (extra_hanging_dofs && !elem.
is_vertex(n))
2532 const int dof_offset = n_comp - nc;
2543 for (
int i=
int(n_comp)-1; i>=dof_offset; i--)
2546 node.
dof_number(sys_num, vg, vig, i, n_comp);
2548 field_dofs_functor(elem, n, v, di, d);
2559 const unsigned int good_nc = std::min(n_comp, nc);
2560 for (
unsigned int i=0; i!=good_nc; ++i)
2563 node.
dof_number(sys_num, vg, vig, i, n_comp);
2565 libmesh_assert_less (d, this->
n_dofs());
2566 field_dofs_functor(elem, n, v, di, d);
2573 for (
unsigned int i=n_comp; i!=nc; ++i)
2588 const unsigned int n_comp = elem.
n_comp_group(sys_num,vg);
2589 if (elem.
n_systems() > sys_num && nc <= n_comp)
2591 for (
unsigned int i=0; i<nc; i++)
2594 elem.
dof_number(sys_num, vg, vig, i, n_comp);
2611 template <
typename ScalarDofsFunctor,
typename FieldDofsFunctor>
2613 std::vector<dof_id_type> & di,
2614 const unsigned int vn,
2615 ScalarDofsFunctor scalar_dofs_functor,
2616 FieldDofsFunctor field_dofs_functor,
2622 LOG_SCOPE(
"dof_indices()",
"DofMap");
2628 if (p_level == -12345)
2629 p_level = elem ? elem->
p_level() : 0;
2633 const unsigned int vig = vn - var.
number();
2637 std::size_t tot_size = 0;
2649 std::vector<const Node *> elem_nodes;
2652 _dof_indices(*elem, p_level, di, vg, vig, elem_nodes.data(),
2653 cast_int<unsigned int>(elem_nodes.size()), vn,
2657 field_dofs_functor);
2671 std::vector<dof_id_type> di_new;
2673 scalar_dofs_functor(*elem, di, di_new);
2681 field_dofs_functor);
2684 libmesh_assert_equal_to (tot_size, di.size());
2697 #endif // LIBMESH_DOF_MAP_H std::vector< VariableGroup > _variable_groups
The finite element type for each variable group.
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.
static unsigned int n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all DoF and Node constraints local to this processor.
FEFamily family
The type of finite element.
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'.
A class holding degree of freedom information pertinent to static condensation.
bool _implicit_neighbor_dofs_initialized
Bools to indicate if we override the –implicit_neighbor_dofs commandline options.
ElemType
Defines an enum for geometric element types.
bool is_constrained_node(const Node *node) const
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
unsigned int n_variable_groups() const
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.
bool _implicit_neighbor_dofs
DofConstraintValueMap & get_primal_constraint_values()
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 dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Order
defines an enum for polynomial orders.
DefaultCoupling & default_coupling()
Default coupling functor.
const std::vector< dof_id_type > & get_n_oz() const
A Node is like a Point, but with more information.
static unsigned int n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
This abstract base class defines the interface by which library code and user code can report associa...
dof_id_type n_SCALAR_dofs() const
std::set< GhostingFunctor * >::const_iterator coupling_functors_begin() const
Beginning of range of coupling functors.
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 ...
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 for an unsigned int...
void local_variable_indices(T &idx, unsigned int var_num) const
If T == dof_id_type, counts, if T == std::vector<dof_id_type>, fills an array of, those dof indices w...
processor_id_type dof_owner(const dof_id_type dof) const
void scatter_constraints(MeshBase &)
Sends constraint equations to constraining processors.
void reinit(MeshBase &mesh, const std::map< const Node *, std::set< subdomain_id_type >> &constraining_subdomains)
Reinitialize the underlying data structures conformal to the current mesh.
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...
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 process_mesh_constraint_rows(const MeshBase &mesh)
Adds any spline constraints from the Mesh to our DoF constraints.
void * _extra_sparsity_context
A pointer associated with the extra sparsity that can optionally be passed in.
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.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
dof_id_type n_dofs() const
The definition of the const_element_iterator struct.
std::size_t distribute_dofs(MeshBase &)
Distribute dofs on the current mesh.
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're using a class instead of a typedef to allow forward declarations and future flexibility...
void local_variable_indices(T &idx, const MeshBase &mesh, unsigned int var_num) const
If T == dof_id_type, counts, if T == std::vector<dof_id_type>, fills an array of, those dof indices w...
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
Backwards compatibility with misspelling.
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
std::unique_ptr< StaticCondensationDofMap > _sc
Static condensation class.
NodeConstraints::const_iterator node_constraint_rows_begin() const
std::vector< dof_id_type > _send_list
A list containing all the global DOF indices that affect the solution on my processor.
const FEType & variable_type(const unsigned int c) const
std::unique_ptr< SparsityPattern::Build > build_sparsity(const MeshBase &mesh, bool calculate_constrained=false, bool use_condensed_system=false) const
Builds a sparsity pattern for matrices using the current degree-of-freedom numbering and coupling...
void set_verify_dirichlet_bc_consistency(bool val)
Set the _verify_dirichlet_bc_consistency flag.
unsigned int block_size() const
bool is_attached(SparseMatrix< Number > &matrix)
Matrices should not be attached more than once.
void attach_matrix(SparseMatrix< Number > &matrix)
Additional matrices may be attached to this DofMap.
This is the base class from which all geometric element types are derived.
void clear_send_list()
Clears the _send_list vector.
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.
DefaultCoupling & default_algebraic_ghosting()
Default algebraic ghosting functor.
std::unique_ptr< DirichletBoundaries > _dirichlet_boundaries
Data structure containing Dirichlet functions.
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...
const Parallel::Communicator & comm() const
The Node constraint storage format.
std::set< GhostingFunctor * > _algebraic_ghosting_functors
The list of all GhostingFunctor objects to be used when distributing ghosted vectors.
unsigned int p_level() const
OrderWrapper order
The approximation order of the element.
bool use_coupled_neighbor_dofs(const MeshBase &mesh) const
Tells other library functions whether or not this problem includes coupling between dofs in neighbori...
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
What elements do we care about and what variables do we care about on each element?
void reinit_static_condensation()
Calls reinit on the static condensation map if it exists.
void should_p_refine(unsigned int g, bool p_refine)
Describe whether the given variable group should be p-refined.
dof_id_type n_dofs(const unsigned int vn) const
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.
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...
dof_id_type n_local_dofs(const unsigned int vn) const
void set_error_on_constraint_loop(bool error_on_constraint_loop)
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
const SparsityPattern::Build * get_sparsity_pattern() const
std::string get_info() const
Gets summary info about the sparsity bandwidth and constraints.
unsigned int sys_number() const
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
This is the MeshBase class.
std::vector< dof_id_type > _first_scalar_df
First DOF index for SCALAR variable v, or garbage for non-SCALAR variable v.
const Variable & variable(const unsigned int c) const override
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
Heterogeneously constrains the numeric vector v, which represents an adjoint solution defined on the ...
AdjointDofConstraintValues _adjoint_constraint_values
bool _constrained_sparsity_construction
This flag indicates whether or not we explicitly take constraint equations into account when computin...
bool should_p_refine_var(unsigned int var) const
Whether the given variable should be p-refined.
unsigned int var_group_from_var_number(unsigned int var_num) const
dof_id_type end_dof() const
AugmentSendList * _augment_send_list
Function object to call to add extra entries to the send list.
void check_for_constraint_loops()
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
bool need_full_sparsity_pattern
Default false; set to true if any attached matrix requires a full sparsity pattern.
bool constrained_sparsity_construction()
Returns true iff the current policy when constructing sparsity patterns is to explicitly account for ...
void distribute_local_dofs_var_major(dof_id_type &next_free_dof, MeshBase &mesh, const std::map< const Node *, std::set< subdomain_id_type >> &constraining_subdomains)
Distributes the global degrees of freedom, for dofs on this processor.
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.
virtual void clear() override
Free all new memory associated with the object, but restore its original state, with the mesh pointer...
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...
void reinit_send_list(MeshBase &mesh)
Clears the _send_list vector and then rebuilds it.
processor_id_type n_processors() const
void libmesh_ignore(const Args &...)
const dof_id_type n_nodes
dof_id_type first_dof() const
std::unordered_map< unsigned int, unsigned int > _var_to_vg
A map from variable number to variable group number.
This class defines the notion of a variable in the system.
bool has_static_condensation() const
Checks whether we have static condensation.
static void merge_ghost_functor_outputs(GhostingFunctor::map_type &elements_to_ghost, CouplingMatricesSet &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)
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.
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.
dof_id_type _n_SCALAR_dofs
The total number of SCALAR dofs associated to all SCALAR variables.
void assert_no_nodes_missed(MeshBase &mesh)
PeriodicBoundaries * get_periodic_boundaries()
StaticCondensationDofMap & get_static_condensation()
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 ...
static bool extra_hanging_dofs(const FEType &fe_t)
virtual unsigned int n_nodes() const =0
std::set< std::unique_ptr< CouplingMatrix >, Utility::CompareUnderlying > CouplingMatricesSet
DofConstraints::const_iterator constraint_rows_begin() const
void heterogeneously_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.
Manages consistently variables, degrees of freedom, and coefficient vectors.
unsigned int n_variables() const override
unsigned int n_systems() const
void add_variable_group(VariableGroup var_group)
Add an unknown of order order and finite element type type to the system of equations.
void swap_dof_constraints()
Similar to the stash/unstash_dof_constraints() API, but swaps _dof_constraints and _stashed_dof_const...
NodeConstraints::const_iterator node_constraint_rows_end() const
This base class provides a minimal set of interfaces for satisfying user requests for...
dof_id_type n_constrained_nodes() const
const Node *const * get_nodes() const
We'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.
void attach_extra_sparsity_object(SparsityPattern::AugmentSparsityPattern &asp)
Attach an object to use to populate the sparsity pattern with extra entries.
DirichletBoundaries * get_dirichlet_boundaries()
bool is_constrained_dof(const dof_id_type dof) const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
The Tri3Subdivision element is a three-noded subdivision surface shell element used in mechanics calc...
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
void allgather_recursive_constraints(MeshBase &)
Gathers constraint equation dependencies from other processors.
const VariableGroup & variable_group(const unsigned int c) const
DofConstraints _dof_constraints
Data structure containing DOF constraints.
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.
DofMap(const unsigned int sys_number, MeshBase &mesh)
Constructor.
CouplingMatrix * _dof_coupling
Degree of freedom coupling.
bool active_on_subdomain(subdomain_id_type sid) const
void create_static_condensation(MeshBase &mesh, System &system)
Add a static condensation class.
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.
Number has_heterogeneous_adjoint_constraint(const unsigned int qoi_num, const dof_id_type dof) const
This class implements reference counting.
const DirichletBoundaries * get_dirichlet_boundaries() const
bool computed_sparsity_already() const
Returns true iff a sparsity pattern has already been computed.
This class defines a logically grouped set of variables in the system.
void update_sparsity_pattern(SparseMatrix< Number > &matrix) const
Additional matrices may be be temporarily initialized by this DofMap.
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...
static n_dofs_at_node_ptr n_dofs_at_node_function(const unsigned int dim, const FEType &fe_t)
Storage for DofConstraint right hand sides for a particular problem.
std::vector< SparseMatrix< Number > *> _matrices
Additional matrices handled by this object.
DofObject * elem_ptr(MeshBase &mesh, dof_id_type i) const
Storage for DofConstraint right hand sides for all adjoint problems.
std::vector< std::unique_ptr< DirichletBoundaries > > _adjoint_dirichlet_boundaries
Data structure containing Dirichlet functions.
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_end() const
End of range of algebraic ghosting functors.
static unsigned int n_dofs_at_node(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int n)
void distribute_scalar_dofs(dof_id_type &next_free_dof)
DofConstraints::const_iterator constraint_rows_end() const
std::unique_ptr< PeriodicBoundaries > _periodic_boundaries
Data structure containing periodic boundaries.
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
bool has_heterogenous_adjoint_constraints(const unsigned int qoi_num) const
Backwards compatibility with misspelling.
void unstash_dof_constraints()
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...
unsigned int(* n_dofs_at_node_ptr)(const ElemType, const Order, const unsigned int)
DofObject *(DofMap::* dofobject_accessor)(MeshBase &mesh, dof_id_type i) const
A member function type like node_ptr() or elem_ptr().
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Struct which defines a custom comparison object that can be used with std::sets of std::unique_ptrs...
void process_constraints(MeshBase &)
Postprocesses any constrained degrees of freedom to be constrained only in terms of unconstrained dof...
subdomain_id_type subdomain_id() const
void stash_dof_constraints()
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.
const DofConstraints & get_dof_constraints() const
Provide a const accessor to the DofConstraints map.
const std::vector< dof_id_type > & get_n_nz() const
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, const unsigned int v #ifdef DEBUG, std::size_t &tot_size #endif) const
Helper function that gets the dof indices on the current element for a non-SCALAR type variable...
void invalidate_dofs(MeshBase &mesh) const
Invalidates all active DofObject dofs for this system.
const DirichletBoundaries * get_adjoint_dirichlet_boundaries(unsigned int q) const
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...
virtual bool is_vertex(const unsigned int i) const =0
bool _verify_dirichlet_bc_consistency
Flag which determines whether we should do some additional checking of the consistency of the Dirichl...
std::unique_ptr< DefaultCoupling > _default_coupling
The default coupling GhostingFunctor, used to implement standard libMesh sparsity pattern constructio...
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
void heterogeneously_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.
std::vector< Variable > _variables
The finite element type for each variable.
DofConstraints _stashed_dof_constraints
void remove_default_ghosting()
Remove any default ghosting functor(s).
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...
SparsityPattern::AugmentSparsityPattern * _augment_sparsity_pattern
Function object to call to add extra entries to the sparsity pattern.
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.
The DofObject defines an abstract base class for objects that have degrees of freedom associated with...
void clear_sparsity()
Clears the sparsity pattern.
void set_constrained_sparsity_construction(bool use_constraints)
Sets the current policy for constructing sparsity patterns: if use_constraints is true (for robustnes...
Order variable_order(const unsigned int c) const
dof_id_type n_local_dofs() const
std::set< GhostingFunctor * > _coupling_functors
The list of all GhostingFunctor objects to be used when coupling degrees of freedom in matrix sparsit...
std::unordered_set< unsigned int > _dont_p_refine
A container of variable groups that we should not p-refine.
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
unsigned int number(unsigned int v) const
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::pair< unsigned int, unsigned int > var_to_vg_and_offset(const unsigned int s, const unsigned int var) const
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.
Scalable allocator to be used in multithreaded code chunks which allocate a lot of dynamic memory...
DofObject * node_ptr(MeshBase &mesh, dof_id_type i) const
void heterogeneously_constrain_element_residual(DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element residual.
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, based on attached DirichletBoundary obj...
std::set< GhostingFunctor * >::const_iterator coupling_functors_end() const
End of range of coupling functors.
Defines an abstract dense vector base class for use in Finite Element-type computations.
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.
MeshBase & _mesh
The mesh that system uses.
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.
virtual bool infinite() const =0
std::unique_ptr< DefaultCoupling > _default_evaluating
The default algebraic GhostingFunctor, used to implement standard libMesh send_list construction...
void full_sparsity_pattern_needed()
Sets need_full_sparsity_pattern to true regardless of the requirements by matrices.
std::vector< unsigned int > _variable_group_numbers
The variable group number for each variable.
std::map< GhostingFunctor *, std::shared_ptr< GhostingFunctor > > _shared_functors
Hang on to references to any GhostingFunctor objects we were passed in shared_ptr form...
void heterogeneously_constrain_element_jacobian_and_residual(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element Jacobian and residual.
FEFamily
defines an enum for finite element families.
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.
virtual ~AugmentSendList()=default
Backwards compatibility for prior AugmentSparsityPattern users.
void attach_extra_send_list_object(DofMap::AugmentSendList &asl)
Attach an object to populate the send_list with extra entries.
Order variable_group_order(const unsigned int vg) const
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_begin() const
Beginning of range of algebraic ghosting functors.
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...
unsigned int n_comp_group(const unsigned int s, const unsigned int vg) const
bool has_heterogeneous_adjoint_constraints(const unsigned int qoi_num) const
void constrain_element_residual(DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element residual.
const PeriodicBoundaries * get_periodic_boundaries() const
std::map< const Node *, std::set< subdomain_id_type > > calculate_constraining_subdomains()
We may have mesh constraint rows with dependent nodes in one subdomain but dependency nodes in anothe...
Defines a dense matrix for use in Finite Element-type computations.
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...
virtual ElemType type() const =0
Abstract base class to be used to add user-defined implicit degree of freedom couplings.
bool has_blocked_representation() const
The constraint matrix storage format.
void ErrorVector unsigned int
const std::vector< dof_id_type > & get_send_list() const
std::vector< dof_id_type > n_dofs_per_processor(const unsigned int vn) const
Abstract base class to be used to add user-defined parallel degree of freedom couplings.
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...
bool is_evaluable(const DofObjectSubclass &obj, unsigned int var_num=libMesh::invalid_uint) const
bool semilocal_index(dof_id_type dof_index) const
void distribute_local_dofs_node_major(dof_id_type &next_free_dof, MeshBase &mesh, const std::map< const Node *, std::set< subdomain_id_type >> &constraining_subdomains)
Distributes the global degrees of freedom for dofs on this processor.
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.
std::vector< dof_id_type > _end_df
Last DOF index (plus 1) on processor p.
bool local_index(dof_id_type dof_index) const
const FEType & type() const
NodeConstraints _node_constraints
Data structure containing DofObject constraints.
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. ...
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.
void enforce_constraints_on_jacobian(const NonlinearImplicitSystem &system, SparseMatrix< Number > *jac) const