20 #ifndef LIBMESH_DOF_MAP_H 21 #define LIBMESH_DOF_MAP_H 37 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS 60 class DefaultCoupling;
61 class DirichletBoundary;
62 class DirichletBoundaries;
68 class PeriodicBoundaryBase;
69 class PeriodicBoundaries;
71 template <
typename T>
class DenseVectorBase;
72 template <
typename T>
class DenseVector;
73 template <
typename T>
class DenseMatrix;
82 #if defined(LIBMESH_ENABLE_AMR) || \ 83 defined(LIBMESH_ENABLE_PERIODIC) || \ 84 defined(LIBMESH_ENABLE_DIRICHLET) 85 # define LIBMESH_ENABLE_CONSTRAINTS 1 91 #ifdef LIBMESH_ENABLE_CONSTRAINTS 96 std::less<dof_id_type>,
107 std::less<dof_id_type>,
108 Threads::scalable_allocator<std::pair<const dof_id_type, DofConstraintRow>>>
118 public std::map<dof_id_type, Number,
119 std::less<dof_id_type>,
120 Threads::scalable_allocator<std::pair<const dof_id_type, Number>>>
129 public std::map<unsigned int, DofConstraintValueMap,
130 std::less<unsigned int>,
131 Threads::scalable_allocator
132 <std::pair<const unsigned int, DofConstraintValueMap>>>
136 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 143 typedef std::map<
const Node *,
Real,
144 std::less<const Node *>,
154 std::pair<NodeConstraintRow,Point>,
155 std::less<const Node *>,
156 Threads::scalable_allocator<std::pair<const Node * const, std::pair<NodeConstraintRow,Point>>>>
159 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 161 #endif // LIBMESH_ENABLE_CONSTRAINTS 208 std::vector<dof_id_type> & n_nz,
209 std::vector<dof_id_type> & n_oz) = 0;
305 bool to_mesh =
true);
355 bool to_mesh =
true);
407 std::vector<dof_id_type> & n_nz,
408 std::vector<dof_id_type> & n_oz,
410 void * context =
nullptr)
430 void * context =
nullptr)
461 libmesh_assert(
_n_nz);
474 libmesh_assert(
_n_oz);
542 {
return cast_int<unsigned int>(
_variables.size()); }
551 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE 564 #ifdef LIBMESH_ENABLE_BLOCKED_STORAGE 592 libmesh_assert_less (proc,
_first_df.size());
605 #ifdef LIBMESH_ENABLE_AMR 615 #endif //LIBMESH_ENABLE_AMR 623 #ifdef LIBMESH_ENABLE_DEPRECATED 626 libmesh_deprecated();
627 libmesh_assert_less (proc,
_end_df.size());
628 return cast_int<dof_id_type>(
_end_df[proc] - 1);
642 { libmesh_assert_less (proc,
_end_df.size());
return _end_df[proc]; }
651 { std::vector<dof_id_type>::const_iterator ub =
653 libmesh_assert (ub !=
_end_df.end());
654 return cast_int<processor_id_type>(ub -
_end_df.begin());
657 #ifdef LIBMESH_ENABLE_AMR 670 #endif //LIBMESH_ENABLE_AMR 677 std::vector<dof_id_type> & di)
const;
685 std::vector<dof_id_type> & di,
686 const unsigned int vn,
687 int p_level = -12345)
const;
694 std::vector<dof_id_type> & di)
const;
701 std::vector<dof_id_type> & di,
702 const unsigned int vn)
const;
713 const unsigned int vn,
714 const bool old_dofs=
false)
const;
739 {
return (dof_index >= this->
first_dof()) && (dof_index < this->
end_dof()); }
746 template <
typename DofObjectSub
class>
787 unsigned int var_num)
const;
789 #ifdef LIBMESH_ENABLE_CONSTRAINTS 805 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 812 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 845 std::set<dof_id_type> & unexpanded_dofs,
846 bool look_for_constrainees);
870 const Number constraint_rhs,
871 const bool forbid_constraint_overwrite);
886 const Number constraint_rhs,
887 const bool forbid_constraint_overwrite);
896 const bool forbid_constraint_overwrite =
true)
923 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 935 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 976 bool print_nonlocal=
false)
const;
997 #endif // LIBMESH_ENABLE_CONSTRAINTS 1020 std::vector<dof_id_type> & elem_dofs,
1021 bool asymmetric_constraint_rows =
true)
const;
1030 std::vector<dof_id_type> & row_dofs,
1031 std::vector<dof_id_type> & col_dofs,
1032 bool asymmetric_constraint_rows =
true)
const;
1038 std::vector<dof_id_type> & dofs,
1039 bool asymmetric_constraint_rows =
true)
const;
1051 std::vector<dof_id_type> & elem_dofs,
1052 bool asymmetric_constraint_rows =
true)
const;
1079 std::vector<dof_id_type> & elem_dofs,
1080 bool asymmetric_constraint_rows =
true,
1081 int qoi_index = -1)
const;
1106 std::vector<dof_id_type> & elem_dofs,
1107 bool asymmetric_constraint_rows =
true,
1108 int qoi_index = -1)
const;
1122 std::vector<dof_id_type> & row_dofs,
1123 bool asymmetric_constraint_rows =
true)
const;
1148 bool homogeneous =
false)
const;
1157 unsigned int q)
const;
1161 #ifdef LIBMESH_ENABLE_PERIODIC 1190 #endif // LIBMESH_ENABLE_PERIODIC 1193 #ifdef LIBMESH_ENABLE_DIRICHLET 1241 #endif // LIBMESH_ENABLE_DIRICHLET 1244 #ifdef LIBMESH_ENABLE_AMR 1266 std::vector<dof_id_type> & di,
1283 #endif // LIBMESH_ENABLE_AMR 1340 std::vector<dof_id_type> & di,
1341 const unsigned int vg,
1342 const unsigned int vig,
1343 const Node *
const * nodes,
1347 const unsigned int v,
1348 std::size_t & tot_size
1381 template<
typename iterator_type>
1383 iterator_type objects_end,
1418 std::set<CouplingMatrix *> & temporary_coupling_matrices,
1419 const std::set<GhostingFunctor *>::iterator & gf_begin,
1420 const std::set<GhostingFunctor *>::iterator & gf_end,
1431 #ifdef LIBMESH_ENABLE_CONSTRAINTS 1444 std::vector<dof_id_type> & elem_dofs,
1445 const bool called_recursively=
false)
const;
1464 std::vector<dof_id_type> & elem_dofs,
1466 const bool called_recursively=
false)
const;
1487 #endif // LIBMESH_ENABLE_CONSTRAINTS 1558 std::vector<dof_id_type> & n_nz,
1559 std::vector<dof_id_type> & n_oz,
1630 std::unique_ptr<SparsityPattern::Build>
_sp;
1657 #ifdef LIBMESH_ENABLE_AMR 1682 #ifdef LIBMESH_ENABLE_CONSTRAINTS 1694 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 1699 #endif // LIBMESH_ENABLE_NODE_CONSTRAINTS 1702 #ifdef LIBMESH_ENABLE_PERIODIC 1710 #ifdef LIBMESH_ENABLE_DIRICHLET 1813 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS
1818 #ifdef LIBMESH_ENABLE_NODE_CONSTRAINTS 1826 #ifdef LIBMESH_ENABLE_CONSTRAINTS 1841 AdjointDofConstraintValues::const_iterator it =
1845 if (it->second.empty())
1856 AdjointDofConstraintValues::const_iterator it =
1860 DofConstraintValueMap::const_iterator rhsit =
1861 it->second.find(dof);
1862 if (rhsit == it->second.end())
1865 return rhsit->second;
1889 std::vector<dof_id_type> &,
1893 std::vector<dof_id_type> &,
1894 std::vector<dof_id_type> &,
1898 std::vector<dof_id_type> &,
1902 DenseVector<Number> &,
1903 std::vector<dof_id_type> &,
1907 DenseVector<Number> &,
1908 std::vector<dof_id_type> &,
1912 NumericVector<Number> *,
1913 bool =
false)
const {}
1916 unsigned int)
const {}
1918 #endif // LIBMESH_ENABLE_CONSTRAINTS 1922 #endif // LIBMESH_DOF_MAP_H std::vector< VariableGroup > _variable_groups
void remove_adjoint_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary, unsigned int q)
void find_connected_dofs(std::vector< dof_id_type > &elem_dofs) const
std::unique_ptr< SparsityPattern::Build > _sp
Manages the family, order, etc. parameters for a given FE.
std::string get_local_constraints(bool print_nonlocal=false) const
void constrain_element_dyad_matrix(DenseVector< Number > &v, DenseVector< Number > &w, std::vector< dof_id_type > &row_dofs, bool asymmetric_constraint_rows=true) const
bool _error_on_cyclic_constraint
bool _implicit_neighbor_dofs_initialized
void distribute_local_dofs_node_major(dof_id_type &next_free_dof, MeshBase &mesh)
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
bool is_constrained_node(const Node *node) const
void local_variable_indices(std::vector< dof_id_type > &idx, const MeshBase &mesh, unsigned int var_num) const
unsigned int n_variable_groups() const
void add_adjoint_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary, unsigned int q)
const unsigned int _sys_number
bool _implicit_neighbor_dofs
DofConstraintValueMap & get_primal_constraint_values()
void check_dirichlet_bcid_consistency(const MeshBase &mesh, const DirichletBoundary &boundary) const
dof_id_type n_local_dofs() const
DefaultCoupling & default_coupling()
const std::vector< dof_id_type > & get_n_oz() const
A geometric point in (x,y,z) space associated with a DOF.
dof_id_type n_SCALAR_dofs() const
std::set< GhostingFunctor * >::const_iterator coupling_functors_begin() const
virtual ~AugmentSparsityPattern()
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
const unsigned int invalid_uint
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
virtual ~AugmentSendList()
processor_id_type dof_owner(const dof_id_type dof) const
void scatter_constraints(MeshBase &)
void add_periodic_boundary(const PeriodicBoundaryBase &periodic_boundary)
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)
void * _extra_sparsity_context
void extract_local_vector(const NumericVector< Number > &Ug, const std::vector< dof_id_type > &dof_indices, DenseVectorBase< Number > &Ue) const
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
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
void set_implicit_neighbor_dofs(bool implicit_neighbor_dofs)
void add_default_ghosting()
Maps between boundary ids and PeriodicBoundaryBase objects.
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
dof_id_type last_dof() const
dof_id_type n_local_constrained_dofs() const
void remove_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
const FEType & variable_group_type(const unsigned int vg) const
NodeConstraints::const_iterator node_constraint_rows_begin() const
std::vector< dof_id_type > _send_list
const FEType & variable_type(const unsigned int c) const
unsigned int block_size() const
bool is_attached(SparseMatrix< Number > &matrix)
void attach_matrix(SparseMatrix< Number > &matrix)
The base class for all geometric element types.
void gather_constraints(MeshBase &mesh, std::set< dof_id_type > &unexpanded_dofs, bool look_for_constrainees)
uint8_t processor_id_type
unsigned int n_variables() const
DefaultCoupling & default_algebraic_ghosting()
AugmentSparsityPattern * _augment_sparsity_pattern
std::unique_ptr< DirichletBoundaries > _dirichlet_boundaries
Class for specifying Dirichlet boundary conditions as constraints.
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
std::set< GhostingFunctor * > _algebraic_ghosting_functors
std::vector< dof_id_type > _end_old_df
bool use_coupled_neighbor_dofs(const MeshBase &mesh) const
virtual void augment_send_list(std::vector< dof_id_type > &send_list)=0
dof_id_type n_old_dofs() const
void add_constraint_row(const dof_id_type dof_number, const DofConstraintRow &constraint_row, const bool forbid_constraint_overwrite=true)
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
std::vector< dof_id_type > _first_old_df
void old_dof_indices(const Elem *const elem, std::vector< dof_id_type > &di, const unsigned int vn=libMesh::invalid_uint) const
std::string get_info() const
void attach_extra_sparsity_object(DofMap::AugmentSparsityPattern &asp)
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
std::vector< dof_id_type > _first_scalar_df
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
AdjointDofConstraintValues _adjoint_constraint_values
std::vector< dof_id_type > * _n_nz
AugmentSendList * _augment_send_list
std::vector< dof_id_type > * _n_oz
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
Manages the degrees of freedom (DOFs) in a simulation.
const dof_id_type n_nodes
dof_id_type end_old_dof() const
dof_id_type n_dofs() const
A variable which is solved for in a System of equations.
void add_neighbors_to_send_list(MeshBase &mesh)
std::vector< dof_id_type > _first_old_scalar_df
const Variable & variable(const unsigned int c) const
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 *)
dof_id_type _n_SCALAR_dofs
PeriodicBoundaries * get_periodic_boundaries()
void set_nonlocal_dof_objects(iterator_type objects_begin, iterator_type objects_end, MeshBase &mesh, dofobject_accessor objects)
void add_constraint_row(const dof_id_type dof_number, const DofConstraintRow &constraint_row, const Number constraint_rhs, const bool forbid_constraint_overwrite)
DofConstraints::const_iterator constraint_rows_begin() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
NodeConstraints::const_iterator node_constraint_rows_end() const
std::unique_ptr< SparsityPattern::Build > build_sparsity(const MeshBase &mesh) const
dof_id_type n_constrained_nodes() const
void print_dof_constraints(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
DirichletBoundaries * get_dirichlet_boundaries()
bool is_constrained_dof(const dof_id_type dof) const
std::unordered_map< const Elem *, const CouplingMatrix * > map_type
void allgather_recursive_constraints(MeshBase &)
void distribute_dofs(MeshBase &)
const VariableGroup & variable_group(const unsigned int c) const
dof_id_type end_old_dof(const processor_id_type proc) const
DofConstraints _dof_constraints
void reinit(MeshBase &mesh)
DofMap(const unsigned int sys_number, MeshBase &mesh)
CouplingMatrix * _dof_coupling
std::vector< DirichletBoundaries * > _adjoint_dirichlet_boundaries
void print_info(std::ostream &os=libMesh::out) const
void * _extra_send_list_context
const DirichletBoundaries * get_dirichlet_boundaries() const
An object whose state is distributed along a set of processors.
bool is_evaluable(const DofObjectSubclass &obj, unsigned int var_num=libMesh::invalid_uint) const
dof_id_type end_dof() const
std::pair< Real, Real > max_constraint_error(const System &system, NumericVector< Number > *v=nullptr) const
std::vector< SparseMatrix< Number > *> _matrices
DofObject * elem_ptr(MeshBase &mesh, dof_id_type i) const
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_end() const
DofConstraints::const_iterator constraint_rows_end() const
virtual void augment_sparsity_pattern(SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz)=0
std::unique_ptr< PeriodicBoundaries > _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
void unstash_dof_constraints()
dof_id_type first_old_dof() const
void remove_coupling_functor(GhostingFunctor &coupling_functor)
DofObject *(DofMap::* dofobject_accessor)(MeshBase &mesh, dof_id_type i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void process_constraints(MeshBase &)
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
const std::vector< dof_id_type > & get_n_nz() const
void invalidate_dofs(MeshBase &mesh) const
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)
std::unique_ptr< DefaultCoupling > _default_coupling
void add_constraints_to_send_list()
DofConstraintValueMap _primal_constraint_values
std::vector< Variable > _variables
DofConstraints _stashed_dof_constraints
void remove_default_ghosting()
dof_id_type first_dof() const
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)
void find_connected_dof_objects(std::vector< const DofObject *> &objs) const
std::map< dof_id_type, Real, std::less< dof_id_type >, Threads::scalable_allocator< std::pair< const dof_id_type, Real > > > DofConstraintRow
Order variable_order(const unsigned int c) const
dof_id_type last_dof(const processor_id_type proc) const
std::set< GhostingFunctor * > _coupling_functors
std::vector< dof_id_type > _end_df
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
void build_constraint_matrix(DenseMatrix< Number > &C, std::vector< dof_id_type > &elem_dofs, const bool called_recursively=false) const
std::vector< dof_id_type > _first_df
void(* _extra_send_list_function)(std::vector< dof_id_type > &, void *)
DofObject * node_ptr(MeshBase &mesh, dof_id_type i) const
Base class for all PeriodicBoundary implementations.
void create_dof_constraints(const MeshBase &, Real time=0)
std::set< GhostingFunctor * >::const_iterator coupling_functors_end() const
std::map< const Node *, Real, std::less< const Node * >, Threads::scalable_allocator< std::pair< const Node *const, Real > > > NodeConstraintRow
bool all_semilocal_indices(const std::vector< dof_id_type > &dof_indices) const
std::unique_ptr< DefaultCoupling > _default_evaluating
std::vector< unsigned int > _variable_group_numbers
dof_id_type first_dof(const processor_id_type proc) const
void remove_algebraic_ghosting_functor(GhostingFunctor &evaluable_functor)
void attach_extra_send_list_object(DofMap::AugmentSendList &asl)
dof_id_type end_dof(const processor_id_type proc) const
Order variable_group_order(const unsigned int vg) const
std::set< GhostingFunctor * >::const_iterator algebraic_ghosting_functors_begin() const
void compute_sparsity(const MeshBase &)
void add_algebraic_ghosting_functor(GhostingFunctor &evaluable_functor, bool to_mesh=true)
processor_id_type processor_id() const
OStreamProxy out(std::cout)
void set_error_on_cyclic_constraint(bool error_on_cyclic_constraint)
void add_variable_group(const VariableGroup &var_group)
bool has_blocked_representation() const
const std::vector< dof_id_type > & get_send_list() const
void constrain_nothing(std::vector< dof_id_type > &dofs) const
void distribute_local_dofs_var_major(dof_id_type &next_free_dof, MeshBase &mesh)
dof_id_type first_old_dof(const processor_id_type proc) const
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)
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)
void check_for_cyclic_constraints()
bool local_index(dof_id_type dof_index) const
NodeConstraints _node_constraints
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
Defines the coupling between variables of a System.
void constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const