Flow123d
release_3.0.0-968-gc87a28e79
|
Go to the documentation of this file.
19 #ifndef DOFHANDLER_HH_
20 #define DOFHANDLER_HH_
23 #include <unordered_map>
99 virtual std::size_t
hash()
const =0;
181 std::shared_ptr<DOFHandlerMultiDim>
sequential();
250 std::size_t
hash()
const override;
265 std::shared_ptr<DiscreteSpace>
ds()
const {
return ds_; }
354 std::shared_ptr<DiscreteSpace>
ds_;
Range< DHCellAccessor > ghost_range() const
Returns range over ghosts DOF handler cells.
std::vector< LongIdx > dof_indices
Dof numbers on local and ghost elements.
std::vector< LongIdx > local_to_global_dof_idx_
Maps local and ghost dof indices to global ones.
Template Iter serves as general template for internal iterators.
static const int INVALID_DOF
std::unordered_map< LongIdx, LongIdx > global_to_local_el_idx_
Maps global element index into local/ghost index (obsolete).
set< unsigned int > ghost_proc
Processors of ghost elements.
Declaration of class which provides the finite element for every mesh cell.
std::shared_ptr< DiscreteSpace > ds() const
Return pointer to discrete space for which the handler distributes dofs.
LongIdx nb_index(int loc_nb) const
Returns the global index of local neighbour.
virtual std::size_t hash() const =0
Compute hash value of DOF handler.
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
DOFHandlerMultiDim(Mesh &_mesh, bool make_elem_part=true)
Constructor.
const unsigned int max_elem_dofs() const
Returns max. number of dofs on one element.
unsigned int n_loc_nb() const
Returns number of local neighbours.
vector< LongIdx > ghost_4_loc
Indices of ghost cells (neighbouring with local elements).
Mesh * mesh_
Pointer to the mesh to which the dof handler is associated.
virtual ~DOFHandlerBase()
Destructor.
Distribution * el_ds_
Distribution of elements.
const unsigned int lsize() const
Returns the number of dofs on the current process.
Range< DHCellAccessor > local_range() const
Returns range over own and ghost cells of DOF handler.
map< unsigned int, vector< LongIdx > > ghost_proc_el
Arrays of ghost cells for each neighbouring processor.
void init_node_dof_starts(std::vector< LongIdx > &node_dof_starts)
Initialize auxiliary vector of starting indices of nodal dofs.
unsigned int get_loc_dof_indices(const ElementAccessor< 3 > &cell, std::vector< LongIdx > &indices) const override
Returns the indices of dofs associated to the cell on the local process.
static const int VALID_NODE
DOFHandlerBase(Mesh &_mesh)
Constructor.
std::shared_ptr< DOFHandlerMultiDim > dh_seq_
Sequential dof handler associated to the current (parallel) one.
LongIdx edge_index(int loc_edg) const
Returns the global index of local edge.
bool el_is_local(int index) const
Provides the numbering of the finite element degrees of freedom on the computational mesh.
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)
Update dofs on local elements from ghost element dofs.
Mesh * mesh() const
Returns the mesh.
Range< DHCellAccessor > own_range() const
Returns range of DOF handler cells (only range of own without ghost cells)
void distribute_dofs(std::shared_ptr< DiscreteSpace > ds)
Distributes degrees of freedom on the mesh needed for the given discrete space.
void receive_ghost_dofs(unsigned int proc, std::vector< LongIdx > &dofs)
Obtain dof numbers on ghost elements from other processor.
VectorMPI create_vector()
Allocates PETSc vector according to the dof distribution.
unsigned int n_global_dofs_
Number of global dofs assigned by the handler.
unsigned int loffset_
Index of the first dof on the local process.
std::shared_ptr< DOFHandlerMultiDim > sequential()
Returns sequential version of the current dof handler.
static const int INVALID_NODE
std::shared_ptr< Distribution > distr() const
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
unsigned int n_loc_edges() const
Returns number of local edges.
const DHCellAccessor cell_accessor_from_element(unsigned int elm_idx) const
Return DHCellAccessor appropriate to ElementAccessor of given idx.
static const int ASSIGNED_NODE
const unsigned int n_global_dofs() const
Getter for the number of all mesh dofs required by the given finite element.
~DOFHandlerMultiDim() override
Destructor.
vector< LongIdx > nb_4_loc
Local neighbour index -> global neighbour index.
std::shared_ptr< DiscreteSpace > ds_
Pointer to the discrete space for which the handler distributes dofs.
unsigned int get_dof_indices(const ElementAccessor< 3 > &cell, std::vector< LongIdx > &indices) const override
Returns the global indices of dofs associated to the cell.
std::vector< LongIdx > cell_starts
Starting indices for element dofs.
void print() const
Output structure of dof handler.
void make_elem_partitioning()
Prepare parallel distribution of elements, edges and neighbours.
unsigned int max_elem_dofs_
Max. number of dofs per element.
void create_sequential()
Communicate local dof indices to all processors and create new sequential dof handler.
unsigned int lsize_
Number of dofs associated to local process.
std::shared_ptr< VecScatter > scatter_to_seq_
Scatter context for parallel to sequential vectors.
std::shared_ptr< VecScatter > sequential_scatter()
Returns scatter context from parallel to sequential vectors.
bool is_parallel_
Indicator for parallel/sequential dof handler.
virtual unsigned int get_loc_dof_indices(const ElementAccessor< 3 > &cell, std::vector< LongIdx > &indices) const =0
Fill vector of the indices of dofs associated to the cell on the local process.
std::size_t hash() const override
void send_ghost_dofs(unsigned int proc)
Send dof numbers to other processor.
void init_node_status(std::vector< short int > &node_status)
Initialize node_status.
std::shared_ptr< Distribution > dof_ds_
Distribution of dofs associated to local process.
void init_cell_starts()
Initialize vector of starting indices for elements.
virtual unsigned int get_dof_indices(const ElementAccessor< 3 > &cell, std::vector< LongIdx > &indices) const =0
Fill vector of the global indices of dofs associated to the cell.
Implementation of range helper class.
vector< LongIdx > edg_4_loc
Local edge index -> global edge index.