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"
51 class DefaultCoupling;
52 class DirichletBoundary;
53 class DirichletBoundaries;
59 class PeriodicBoundaryBase;
60 class PeriodicBoundaries;
62 class NonlinearImplicitSystem;
75 #if defined(LIBMESH_ENABLE_AMR) || \
76 defined(LIBMESH_ENABLE_PERIODIC) || \
77 defined(LIBMESH_ENABLE_DIRICHLET)
78 # define LIBMESH_ENABLE_CONSTRAINTS 1
84 #ifdef LIBMESH_ENABLE_CONSTRAINTS
89 std::less<dof_id_type>,
100 std::less<dof_id_type>,
101 Threads::scalable_allocator<std::pair<const dof_id_type, DofConstraintRow>>>
111 public std::map<dof_id_type, Number,
112 std::less<dof_id_type>,
113 Threads::scalable_allocator<std::pair<const dof_id_type, Number>>>
122 public std::map<unsigned int, DofConstraintValueMap,
123 std::less<unsigned int>,
124 Threads::scalable_allocator
125 <std::pair<const unsigned int, DofConstraintValueMap>>>
129 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
136 typedef std::map<
const Node *,
Real,
137 std::less<const Node *>,
147 std::pair<NodeConstraintRow,Point>,
148 std::less<const Node *>,
149 Threads::scalable_allocator<std::pair<const Node * const, std::pair<NodeConstraintRow,Point>>>>
152 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
154 #endif // LIBMESH_ENABLE_CONSTRAINTS
170 public ParallelObject
320 bool to_mesh =
true);
382 bool to_mesh =
true);
446 std::vector<dof_id_type> & n_nz,
447 std::vector<dof_id_type> & n_oz,
449 void * context =
nullptr)
469 void * context =
nullptr)
523 return _sp->get_n_nz();
536 return _sp->get_n_oz();
622 {
return cast_int<unsigned int>(
_variables.size()); }
677 libmesh_assert_less (proc,
_first_df.size());
688 {
return this->
first_dof(this->processor_id()); }
690 #ifdef LIBMESH_ENABLE_AMR
700 #endif //LIBMESH_ENABLE_AMR
709 { libmesh_assert_less (proc,
_end_df.size());
return _end_df[proc]; }
712 {
return this->
end_dof(this->processor_id()); }
718 { std::vector<dof_id_type>::const_iterator ub =
720 libmesh_assert (ub !=
_end_df.end());
721 return cast_int<processor_id_type>(ub -
_end_df.begin());
724 #ifdef LIBMESH_ENABLE_AMR
735 {
return this->
end_old_dof(this->processor_id()); }
737 #endif //LIBMESH_ENABLE_AMR
744 std::vector<dof_id_type> & di)
const;
752 std::vector<dof_id_type> & di,
753 const unsigned int vn,
754 int p_level = -12345)
const;
761 std::vector<dof_id_type> & di)
const;
768 std::vector<dof_id_type> & di,
769 const unsigned int vn)
const;
779 std::vector<dof_id_type> & di,
780 const unsigned int vn)
const;
782 #ifdef LIBMESH_ENABLE_AMR
792 std::vector<dof_id_type> & di,
793 const unsigned int vn)
const;
795 #endif // LIBMESH_ENABLE_AMR
806 const unsigned int vn,
807 const bool old_dofs=
false)
const;
832 {
return (dof_index >= this->
first_dof()) && (dof_index < this->
end_dof()); }
839 template <
typename DofObjectSub
class>
884 const MeshBase & mesh,
885 unsigned int var_num)
const;
887 #ifdef LIBMESH_ENABLE_CONSTRAINTS
903 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
910 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
943 std::set<dof_id_type> & unexpanded_dofs,
944 bool look_for_constrainees);
978 const Number constraint_rhs,
979 const bool forbid_constraint_overwrite);
994 const Number constraint_rhs,
995 const bool forbid_constraint_overwrite);
1004 const bool forbid_constraint_overwrite =
true)
1054 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1066 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
1124 bool print_nonlocal=
false)
const;
1145 #endif // LIBMESH_ENABLE_CONSTRAINTS
1168 std::vector<dof_id_type> & elem_dofs,
1169 bool asymmetric_constraint_rows =
true)
const;
1178 std::vector<dof_id_type> & row_dofs,
1179 std::vector<dof_id_type> & col_dofs,
1180 bool asymmetric_constraint_rows =
true)
const;
1186 std::vector<dof_id_type> & dofs,
1187 bool asymmetric_constraint_rows =
true)
const;
1199 std::vector<dof_id_type> & elem_dofs,
1200 bool asymmetric_constraint_rows =
true)
const;
1227 std::vector<dof_id_type> & elem_dofs,
1228 bool asymmetric_constraint_rows =
true,
1229 int qoi_index = -1)
const;
1236 std::vector<dof_id_type> & elem_dofs,
1237 bool asymmetric_constraint_rows =
true,
1238 int qoi_index = -1)
const
1241 (matrix, rhs, elem_dofs, asymmetric_constraint_rows, qoi_index);
1271 std::vector<dof_id_type> & elem_dofs,
1272 bool asymmetric_constraint_rows =
true,
1273 int qoi_index = -1)
const;
1280 std::vector<dof_id_type> & elem_dofs,
1281 bool asymmetric_constraint_rows =
true,
1282 int qoi_index = -1)
const
1285 (matrix, rhs, elem_dofs, asymmetric_constraint_rows, qoi_index);
1309 std::vector<dof_id_type> & elem_dofs,
1327 std::vector<dof_id_type> & elem_dofs,
1347 std::vector<dof_id_type> & elem_dofs,
1360 std::vector<dof_id_type> & row_dofs,
1361 bool asymmetric_constraint_rows =
true)
const;
1386 bool homogeneous =
false)
const;
1395 unsigned int q)
const;
1400 bool homogeneous =
true)
const;
1405 #ifdef LIBMESH_ENABLE_PERIODIC
1439 #endif // LIBMESH_ENABLE_PERIODIC
1442 #ifdef LIBMESH_ENABLE_DIRICHLET
1506 #endif // LIBMESH_ENABLE_DIRICHLET
1509 #ifdef LIBMESH_ENABLE_AMR
1524 #ifdef LIBMESH_ENABLE_AMR
1533 std::vector<dof_id_type> & di,
1541 #endif // LIBMESH_ENABLE_AMR
1553 #endif // LIBMESH_ENABLE_AMR
1558 void reinit (MeshBase & mesh);
1610 std::unique_ptr<SparsityPattern::Build>
build_sparsity(
const MeshBase & mesh,
1611 bool calculate_constrained =
false)
const;
1649 std::vector<dof_id_type> & di,
1650 const unsigned int vg,
1651 const unsigned int vig,
1652 const Node *
const * nodes,
1653 unsigned int n_nodes
1656 const unsigned int v,
1657 std::size_t & tot_size
1668 std::vector<dof_id_type> & di,
1669 const unsigned int vn)
const;
1695 template<
typename iterator_type>
1697 iterator_type objects_end,
1746 const std::set<GhostingFunctor *>::iterator & gf_begin,
1747 const std::set<GhostingFunctor *>::iterator & gf_end,
1748 const MeshBase::const_element_iterator & elems_begin,
1749 const MeshBase::const_element_iterator & elems_end,
1758 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1771 std::vector<dof_id_type> & elem_dofs,
1772 const bool called_recursively=
false)
const;
1791 std::vector<dof_id_type> & elem_dofs,
1793 const bool called_recursively=
false)
const;
1821 #endif // LIBMESH_ENABLE_CONSTRAINTS
1904 std::vector<dof_id_type> & n_nz,
1905 std::vector<dof_id_type> & n_oz,
1983 std::unique_ptr<SparsityPattern::Build>
_sp;
1996 #ifdef LIBMESH_ENABLE_AMR
2025 #ifdef LIBMESH_ENABLE_CONSTRAINTS
2037 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
2042 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS
2045 #ifdef LIBMESH_ENABLE_PERIODIC
2053 #ifdef LIBMESH_ENABLE_DIRICHLET
2159 #ifdef LIBMESH_ENABLE_CONSTRAINTS
2164 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
2169 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
2191 AdjointDofConstraintValues::const_iterator it =
2195 if (it->second.empty())
2206 AdjointDofConstraintValues::const_iterator it =
2210 DofConstraintValueMap::const_iterator rhsit =
2211 it->second.find(dof);
2212 if (rhsit == it->second.end())
2215 return rhsit->second;
2239 std::vector<dof_id_type> &,
2243 std::vector<dof_id_type> &,
2244 std::vector<dof_id_type> &,
2248 std::vector<dof_id_type> &,
2252 DenseVector<Number> &,
2253 std::vector<dof_id_type> &,
2257 (DenseMatrix<Number> &, DenseVector<Number> &,
2258 std::vector<dof_id_type> &,
bool,
int)
const {}
2261 (
const DenseMatrix<Number> &, DenseVector<Number> &,
2262 std::vector<dof_id_type> &,
bool,
int)
const {}
2265 DenseVector<Number> &,
2266 std::vector<dof_id_type> &,
2276 unsigned int)
const {}
2280 (
const NonlinearImplicitSystem &,
2286 (
const NonlinearImplicitSystem &,
2289 #endif // LIBMESH_ENABLE_CONSTRAINTS
2297 if (use_constraints)
2298 libmesh_not_implemented();
2300 #ifdef LIBMESH_ENABLE_CONSTRAINTS
2311 #ifdef LIBMESH_ENABLE_CONSTRAINTS
2321 #ifdef LIBMESH_ENABLE_AMR
2338 #ifdef LIBMESH_ENABLE_AMR
2350 return libmesh_map_find(
_var_to_vg, var_num);
2356 #ifdef LIBMESH_ENABLE_AMR
2366 #endif // LIBMESH_DOF_MAP_H
std::vector< VariableGroup > _variable_groups
The finite element type for each variable group.
unsigned int var_group_from_var_number(unsigned int var_num) const
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...
std::unique_ptr< SparsityPattern::Build > _sp
The sparsity pattern of the global matrix.
DofObject * elem_ptr(MeshBase &mesh, dof_id_type i) const
bool _implicit_neighbor_dofs_initialized
Bools to indicate if we override the –implicit_neighbor_dofs commandline options. ...
dof_id_type end_old_dof(const processor_id_type proc) const
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 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
std::string get_info() const
Gets summary info about the sparsity bandwidth and constraints.
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.
DofConstraintValueMap & get_primal_constraint_values()
void print_info(std::ostream &os=libMesh::out) const
Prints summary info about the sparsity bandwidth and constraints.
DefaultCoupling & default_coupling()
Default coupling functor.
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::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_begin() const
Beginning of range of algebraic ghosting functors.
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 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...
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.
const FEType & variable_type(const unsigned int c) const
dof_id_type n_constrained_dofs() const
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 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 ...
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...
dof_id_type end_old_dof() const
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.
void remove_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Removes the specified Dirichlet boundary from the system.
std::set< GhostingFunctor * >::const_iterator coupling_functors_begin() const
Beginning of range of coupling functors.
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...
std::vector< dof_id_type > _send_list
A list containing all the global DOF indices that affect the solution on my processor.
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
Constrains the element vector.
void set_verify_dirichlet_bc_consistency(bool val)
Set the _verify_dirichlet_bc_consistency flag.
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.
void enforce_constraints_on_jacobian(const NonlinearImplicitSystem &system, SparseMatrix< Number > *jac) const
DofObject * node_ptr(MeshBase &mesh, dof_id_type i) const
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.
DofConstraints::const_iterator constraint_rows_begin() const
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...
bool computed_sparsity_already() const
Returns true iff a sparsity pattern has already been computed.
The Node constraint storage format.
std::set< GhostingFunctor * > _algebraic_ghosting_functors
The list of all GhostingFunctor objects to be used when distributing ghosted vectors.
std::vector< dof_id_type > _end_old_df
Last old DOF index (plus 1) on processor p.
processor_id_type dof_owner(const dof_id_type dof) const
unsigned int block_size() const
void should_p_refine(unsigned int g, bool p_refine)
Describe whether the given variable group should be p-refined.
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...
void invalidate_dofs(MeshBase &mesh) const
Invalidates all active DofObject dofs for this system.
virtual void augment_send_list(std::vector< dof_id_type > &send_list)=0
User-defined function to augment the send list.
bool local_index(dof_id_type dof_index) const
const Variable & variable(const unsigned int c) const
void find_connected_dof_objects(std::vector< const DofObject * > &objs) const
Finds all the DofObjects associated with the set in objs.
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_dofs() const
void set_error_on_constraint_loop(bool error_on_constraint_loop)
const VariableGroup & variable_group(const unsigned int c) 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.
const FEType & variable_group_type(const unsigned int vg) const
std::vector< dof_id_type > _first_old_df
First old DOF index on processor p.
Number has_heterogeneous_adjoint_constraint(const unsigned int qoi_num, const dof_id_type dof) const
uint8_t processor_id_type
std::vector< dof_id_type > _first_scalar_df
First DOF index for SCALAR variable v, or garbage for non-SCALAR variable v.
dof_id_type first_old_dof() const
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
bool has_heterogeneous_adjoint_constraints(const unsigned int qoi_num) const
AdjointDofConstraintValues _adjoint_constraint_values
bool _constrained_sparsity_construction
This flag indicates whether or not we explicitly take constraint equations into account when computin...
AugmentSendList * _augment_send_list
Function object to call to add extra entries to the send list.
void check_for_constraint_loops()
bool has_adjoint_dirichlet_boundaries(unsigned int q) 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 ...
这是一个通用的稀疏矩阵类。该类包含了必须在派生类中覆盖的纯虚拟成员。 使用一个公共的基类允许从不同的求解器包中以不同的格式统一访问稀疏矩阵。
This class handles the numbering of degrees of freedom on a mesh.
dof_id_type first_dof(const processor_id_type proc) const
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...
dof_id_type end_dof(const processor_id_type proc) const
const DirichletBoundaries * get_adjoint_dirichlet_boundaries(unsigned int q) const
void reinit_send_list(MeshBase &mesh)
Clears the _send_list vector and then rebuilds it.
void libmesh_ignore(const Args &...)
const PeriodicBoundaries * get_periodic_boundaries() const
bool is_constrained_dof(const dof_id_type dof) const
void print_dof_constraints(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all DoF and Node constraints.
std::unordered_map< unsigned int, unsigned int > _var_to_vg
A map from variable number to variable group number.
bool is_constrained_node(const Node *node) const
This class defines the notion of a variable in the system.
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.
std::string get_local_constraints(bool print_nonlocal=false) const
Gets a string reporting all DoF and Node constraints local to this processor.
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()
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 ...
std::set< std::unique_ptr< CouplingMatrix >, Utility::CompareUnderlying > CouplingMatricesSet
NodeConstraints::const_iterator node_constraint_rows_end() const
bool is_periodic_boundary(const boundary_id_type boundaryid) const
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. ...
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...
dof_id_type n_local_constrained_dofs() const
We're using a class instead of a typedef to allow forward declarations and future flexibility...
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()
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.
const DirichletBoundaries * get_dirichlet_boundaries() const
void clear()
Free all new memory associated with the object, but restore its original state, with the mesh pointer...
const SparsityPattern::Build * get_sparsity_pattern() const
void allgather_recursive_constraints(MeshBase &)
Gathers constraint equation dependencies from other processors.
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...
DofConstraints _dof_constraints
Data structure containing DOF constraints.
std::unique_ptr< SparsityPattern::Build > build_sparsity(const MeshBase &mesh, bool calculate_constrained=false) const
Builds a sparsity pattern for matrices using the current degree-of-freedom numbering and coupling...
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.
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.
unsigned int n_variable_groups() const
Number has_heterogenous_adjoint_constraint(const unsigned int qoi_num, const dof_id_type dof) const
Backwards compatibility with misspelling.
NodeConstraints::const_iterator node_constraint_rows_begin() 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...
unsigned int sys_number() const
void * _extra_send_list_context
A pointer associated with the extra send list that can optionally be passed in.
This class implements reference counting.
This class defines a logically grouped set of variables in the system.
bool semilocal_index(dof_id_type dof_index) const
void constrain_element_residual(DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element residual.
void update_sparsity_pattern(SparseMatrix< Number > &matrix) const
Additional matrices may be be temporarily initialized by this DofMap.
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_end() const
End of range of algebraic ghosting functors.
Storage for DofConstraint right hand sides for a particular problem.
std::vector< SparseMatrix< Number > * > _matrices
Additional matrices handled by this object.
Storage for DofConstraint right hand sides for all adjoint problems.
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
dof_id_type end_dof() const
DofConstraints::const_iterator constraint_rows_end() const
std::vector< std::unique_ptr< DirichletBoundaries > > _adjoint_dirichlet_boundaries
Data structure containing Dirichlet functions.
const std::vector< dof_id_type > & get_n_oz() const
void distribute_scalar_dofs(dof_id_type &next_free_dof)
unsigned int n_variables() const
std::unique_ptr< PeriodicBoundaries > _periodic_boundaries
Data structure containing periodic boundaries.
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.
void heterogeneously_constrain_element_residual(DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element residual.
void unstash_dof_constraints()
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...
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...
template class LIBMESH_EXPORT SparseMatrix< Number >
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...
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 constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix.
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 stash_dof_constraints()
dof_id_type n_old_dofs() 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...
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
std::vector< Variable > _variables
The finite element type for each variable.
DofConstraints _stashed_dof_constraints
Order variable_order(const unsigned int c) const
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...
dof_id_type n_local_dofs() const
SparsityPattern::AugmentSparsityPattern * _augment_sparsity_pattern
Function object to call to add extra entries to the sparsity pattern.
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...
dof_id_type _n_old_dfs
Total number of degrees of freedom on old dof objects.
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
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...
bool all_semilocal_indices(const std::vector< dof_id_type > &dof_indices) 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.
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.
std::vector< dof_id_type > _end_df
Last DOF index (plus 1) on processor p.
dof_id_type n_SCALAR_dofs() const
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
std::vector< dof_id_type > _first_df
First DOF index on processor p.
bool has_heterogenous_adjoint_constraints(const unsigned int qoi_num) const
Backwards compatibility with misspelling.
const DofConstraints & get_dof_constraints() const
Provide a const accessor to the DofConstraints map.
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.
定义用于有限元计算的抽象稠密向量基类。 可以从这个类派生出特定的稠密向量,例如 DenseSubVectors。
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 find_connected_dofs(std::vector< dof_id_type > &elem_dofs) const
Finds all the DOFS associated with the element DOFs elem_dofs.
void prepare_send_list()
Takes the _send_list vector (which may have duplicate entries) and sorts it.
定义用于有限元计算的稠密向量类。该类基本上是为了补充 DenseMatrix 类而设计的。 它相对于 std::vector 具有额外的功能,使其在有限元中特别有用,特别是对于方程组。 所有重写的虚拟函...
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.
std::unique_ptr< DefaultCoupling > _default_evaluating
The default algebraic GhostingFunctor, used to implement standard libMesh send_list construction...
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.
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...
std::set< GhostingFunctor * >::const_iterator coupling_functors_end() const
End of range of coupling functors.
DofObject *(DofMap::* dofobject_accessor)(MeshBase &mesh, dof_id_type i) const
A member function type like node_ptr() or elem_ptr().
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.
void compute_sparsity(const MeshBase &)
Computes the sparsity pattern for the matrices corresponding to proc_id and sends that data to Linear...
bool has_blocked_representation() const
Order variable_group_order(const unsigned int vg) const
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...
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'.
bool should_p_refine_var(unsigned int var) const
Whether the given variable should be p-refined.
const std::vector< dof_id_type > & get_n_nz() const
定义用于有限元类型计算的密集矩阵。 用于在求和成全局矩阵之前存储单元刚度矩阵。所有被覆盖的虚函数都记录在dense_matrix_base.h中。
bool use_coupled_neighbor_dofs(const MeshBase &mesh) const
Tells other library functions whether or not this problem includes coupling between dofs in neighbori...
dof_id_type first_old_dof(const processor_id_type proc) const
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...
const std::vector< dof_id_type > & get_send_list() const
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 ...
Abstract base class to be used to add user-defined implicit degree of freedom couplings.
bool is_evaluable(const DofObjectSubclass &obj, unsigned int var_num=libMesh::invalid_uint) const
template class LIBMESH_EXPORT NumericVector< Number >
The constraint matrix storage format.
dof_id_type n_constrained_nodes() const
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.
Abstract base class to be used to add user-defined parallel degree of freedom couplings.
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 ...
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.
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.
dof_id_type first_dof() const
dof_id_type _n_dfs
Total number of degrees of freedom.
void enforce_constraints_on_residual(const NonlinearImplicitSystem &system, NumericVector< Number > *rhs, NumericVector< Number > const *solution, bool homogeneous=true) const
NodeConstraints _node_constraints
Data structure containing DofObject constraints.
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.