19 #ifndef DOFHANDLER_HH_ 20 #define DOFHANDLER_HH_ 23 #include <unordered_map> 83 virtual std::size_t
hash()
const =0;
174 void distribute_dofs(std::shared_ptr<DiscreteSpace> ds);
180 std::shared_ptr<DOFHandlerMultiDim> sequential();
188 std::shared_ptr<VecScatter> sequential_scatter();
212 inline unsigned int n_loc_edges()
const {
return edg_4_loc.size(); }
217 inline unsigned int n_loc_nb()
const {
return nb_4_loc.size(); }
225 std::size_t
hash()
const override;
238 return el_ds_->lsize();
243 return el_ds_->lsize()+ghost_4_loc.size();
248 return ghost_4_loc.size();
252 const DHCellAccessor cell_accessor_from_element(
unsigned int elm_idx)
const;
255 std::shared_ptr<DiscreteSpace>
ds()
const {
return ds_; }
370 return LocDofVec(mem_ptr, ndofs,
false,
false);
393 std::shared_ptr<DiscreteSpace>
ds_;
500 void send_sub_ghost_dofs(
unsigned int proc,
const map<LongIdx,LongIdx> &global_to_local_dof_idx);
void receive_ghost_dofs(unsigned int proc, std::vector< LongIdx > &dofs)
Obtain dof numbers on ghost elements from other processor.
virtual ~DOFHandlerBase()
Destructor.
void create_sequential()
Communicate local dof indices to all processors and create new sequential dof handler.
void init_cell_starts()
Initialize vector of starting indices for elements.
const std::vector< LongIdx > & parent_indices()
Local indices in the parent handler.
Class allows to iterate over sides of neighbour.
void init_dof_starts(std::vector< LongIdx > &node_dof_starts, std::vector< LongIdx > &edge_dof_starts)
Initialize auxiliary vector of starting indices of nodal/edge dofs.
FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args)
unsigned int own_size() const
Return size of own range (number of own cells)
LocDofVec get_loc_dof_indices(unsigned int loc_ele_idx) const override
Returns the indices of dofs associated to the cell on the local process.
unsigned int local_size() const
Return size of local range (number of local cells)
Distribution * el_ds_
Distribution of elements.
static const int INVALID_NFACE
std::shared_ptr< DOFHandlerMultiDim > parent_
Parent dof handler.
unsigned int n_global_dofs() const
Getter for the number of all mesh dofs required by the given finite element.
std::vector< Idx > dof_indices
Dof numbers on local and ghost elements.
Template Iter serves as general template for internal iterators.
Cell accessor allow iterate over DOF handler cells.
std::vector< LongIdx > local_to_global_dof_idx_
Maps local and ghost dof indices to global ones.
unsigned int n_loc_nb() const
Returns number of local neighbours.
void init_status(std::vector< short int > &node_status, std::vector< short int > &edge_status)
Initialize node_status and edge_status.
std::shared_ptr< Distribution > dof_ds_
Distribution of dofs associated to local process.
Mesh * mesh() const
Returns the mesh.
std::shared_ptr< DOFHandlerMultiDim > dh_seq_
Sequential dof handler associated to the current (parallel) one.
unsigned int lsize_
Number of dofs associated to local process.
map< unsigned int, vector< LongIdx > > ghost_proc_el
Arrays of ghost cells for each neighbouring processor.
static const int ASSIGNED_NFACE
void send_ghost_dofs(unsigned int proc)
Send dof numbers to other processor.
std::vector< LongIdx > cell_starts
Starting indices for local (owned+ghost) element dofs.
Mesh * mesh_
Pointer to the mesh to which the dof handler is associated.
Provides the numbering of the finite element degrees of freedom on the computational mesh...
static const int VALID_NFACE
vector< LongIdx > nb_4_loc
Local neighbour index -> global neighbour index.
virtual unsigned int get_dof_indices(const DHCellAccessor &cell, std::vector< LongIdx > &indices) const =0
Fill vector of the global indices of dofs associated to the cell.
unsigned int max_elem_dofs_
Max. number of dofs per element.
vector< LongIdx > ghost_4_loc
Indices of ghost cells (neighbouring with local elements).
std::unordered_map< LongIdx, LongIdx > global_to_local_el_idx_
Maps global element index into local/ghost index (obsolete).
Declaration of class which provides the finite element for every mesh cell.
void make_elem_partitioning()
Prepare parallel distribution of elements, edges and neighbours.
unsigned int n_loc_edges() const
Returns number of local edges.
virtual std::size_t hash() const =0
Compute hash value of DOF handler.
unsigned int lsize() const
Returns the number of dofs on the current process.
std::shared_ptr< Distribution > distr() const
std::vector< LongIdx > parent_dof_idx_
Local indices in the parent handler.
LongIdx edge_index(int loc_edg) const
Returns the global index of local edge.
unsigned int ghost_size() const
Return size of ghost range (number of ghost cells)
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
vector< LongIdx > edg_4_loc
Local edge index -> global edge index.
unsigned int max_elem_dofs() const
Returns max. number of dofs on one element.
unsigned int loffset_
Index of the first dof on the local process.
static const int INVALID_DOF
set< unsigned int > ghost_proc
Processors of ghost elements.
const std::vector< LongIdx > & get_local_to_global_map() const
Get the map between local dof indices and the global ones.
std::shared_ptr< DiscreteSpace > ds_
Pointer to the discrete space for which the handler distributes dofs.
unsigned int fe_idx_
Index of FE in parent FESystem.
unsigned int n_global_dofs_
Number of global dofs assigned by the handler.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
bool el_is_local(int index) const
void update_local_dofs(unsigned int proc, const std::vector< bool > &update_cells, const std::vector< LongIdx > &dofs, const std::vector< LongIdx > &node_dof_starts, std::vector< LongIdx > &node_dofs, const std::vector< LongIdx > &edge_dof_starts, std::vector< LongIdx > &edge_dofs)
Update dofs on local elements from ghost element dofs.
bool is_parallel_
Indicator for parallel/sequential dof handler.
DOFHandlerBase(Mesh &_mesh)
Constructor.
arma::Col< Idx > LocDofVec
std::shared_ptr< VecScatter > scatter_to_seq_
Scatter context for parallel to sequential vectors.
LongIdx nb_index(int loc_nb) const
Returns the global index of local neighbour.
Implementation of range helper class.
Side accessor allows to iterate over sides of DOF handler cell.
virtual LocDofVec get_loc_dof_indices(unsigned int loc_ele_idx) const =0
Returns a vector of the indices of dofs associated to the cell on the local process.
std::shared_ptr< DiscreteSpace > ds() const
Return pointer to discrete space for which the handler distributes dofs.