19 #ifndef DH_CELL_ACCESSOR_HH_ 20 #define DH_CELL_ACCESSOR_HH_ 90 unsigned int n_dofs()
const;
99 inline unsigned int dim()
const {
106 template<
unsigned int dim>
125 return (loc_ele_idx_ < dof_handler_->el_ds_->lsize());
171 : dh_cell_accessor_(dh_cell_accessor), side_idx_(side_idx) {}
175 return dh_cell_accessor_.is_valid();
181 return Side(dh_cell_accessor_.dof_handler_->mesh(), dh_cell_accessor_.elm_idx(), side_idx_ );
186 return dh_cell_accessor_;
190 inline unsigned int dim()
const {
196 return side().centre();
204 return side().elem_idx();
208 return side().cond();
216 return side().measure();
220 return side().diameter();
232 unsigned int n_edge_sides()
const;
235 inline virtual void inc() {
279 edge_idx_(cell_side.dh_cell_accessor_.
elm()->edge_idx(cell_side.side_idx_)),
341 : dh_cell_(dh_cell), neighb_idx_(neighb_idx), max_idx_(max_idx)
344 while ( (neighb_idx_<max_idx_) && not_local_cell() ) {
351 return dh_cell_.is_valid();
359 if (neighb_idx_>=max_idx_)
break;
360 }
while ( not_local_cell() );
370 SideIter side = dh_cell_.elm()->neigh_vb[neighb_idx_]->side();
378 return ( dh_cell_.dof_handler_->global_to_local_el_idx_.end() ==
379 dh_cell_.dof_handler_->global_to_local_el_idx_.find((
LongIdx)dh_cell_.elm()->neigh_vb[neighb_idx_]->side()->elem_idx()) );
398 switch (this->
dim()) {
418 return fe<1>()->dof(idof);
421 return fe<2>()->dof(idof);
424 return fe<3>()->dof(idof);
428 ASSERT(0)(this->
dim()).error(
"Unsupported FE dimension.");
430 return fe<1>()->dof(idof);;
435 auto bgn_it = make_iter<DHCellSide>(
DHCellSide(*
this, 0) );
436 auto end_it = make_iter<DHCellSide>(
DHCellSide(*
this,
dim()+1) );
443 auto bgn_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, 0, upper_bound) );
444 auto end_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, upper_bound, upper_bound) );
451 make_iter<DHEdgeSide, DHCellSide>(
DHEdgeSide( *
this, n_edge_sides()) ));
456 unsigned int edge_idx = dh_cell_accessor_.elm()->edge_idx(side_idx_);
457 Edge edg = dh_cell_accessor_.dof_handler_->mesh()->edge(edge_idx);
459 if ( dh_cell_accessor_.dof_handler_->el_is_local(edg.
side(sid)->
element().
idx()) )
return edg.
n_sides();
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
unsigned int n_sides() const
Returns number of sides aligned with the edge.
const Element * element() const
virtual bool is_valid() const
Check validity of accessor (see default constructor)
const Dof & cell_dof(unsigned int idof) const
Return dof on a given cell.
Range< DHCellSide > side_range() const
Returns range of cell sides.
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
Class allows to iterate over sides of neighbour.
const DOFHandlerMultiDim * dof_handler_
Pointer to the DOF handler owning the element.
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
const DHCellAccessor cell_accessor_from_element(unsigned int elm_idx) const
Return DHCellAccessor appropriate to ElementAccessor of given idx.
void inc()
Iterates to next local element.
unsigned int dim() const
Return dimension of element appropriate to the side.
unsigned int side_idx() const
Returns local index of the side on the element.
DHCellAccessor dh_cell_accessor_
Appropriate DHCellAccessor.
unsigned int elem_idx() const
unsigned int get_loc_dof_indices(std::vector< LongIdx > &indices) const
Returns the indices of dofs associated to the cell on the local process.
Distribution * el_ds_
Distribution of elements.
unsigned int dim() const
Return dimension of element appropriate to cell.
unsigned int local_idx() const
Return local index to element (index of DOF handler).
FiniteElement< dim > * fe() const
Returns finite element object for given space dimension.
Cell accessor allow iterate over DOF handler cells.
bool is_valid() const
Check validity of accessor (see default constructor of DHCellAccessor)
const DOFHandlerMultiDim * dof_handler_
Pointer to the DOF handler owning the element.
unsigned int side_idx_
Index of side owned by Edge.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
bool is_valid() const
Check validity of accessor (see default constructor)
Mesh * mesh() const
Returns the mesh.
unsigned int max_idx_
Maximal index into neigh_vb array.
unsigned int side_idx() const
bool is_own() const
Return true if accessor represents own element (false for ghost element)
unsigned int n_dofs() const
Return number of dofs on given cell.
ElementAccessor< 3 > element() const
Returns iterator to the element of the side.
Side side() const
Return Side of given cell and side_idx.
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
DHNeighbSide(const DHCellAccessor &dh_cell, unsigned int neighb_idx, unsigned int max_idx)
Valid accessor allows iterate over neighbor sides.
bool is_valid() const
Check validity of accessor (see default constructor)
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
unsigned int neighb_idx_
Index into neigh_vb array.
DHNeighbSide()
Default invalid accessor.
RangeConvert< DHEdgeSide, DHCellSide > edge_sides() const
Returns range of all sides looped over common Edge.
void inc()
Iterates to next neighbour side.
ElementAccessor< 3 > element() const
DHCellAccessor()
Default invalid accessor.
RangeConvert< DHNeighbSide, DHCellSide > neighb_sides() const
Returns range of neighbour cell of lower dimension corresponding to cell of higher dimension...
Provides the numbering of the finite element degrees of freedom on the computational mesh...
DHCellAccessor(const DOFHandlerMultiDim *dof_handler, unsigned int loc_idx)
vector< LongIdx > ghost_4_loc
Indices of ghost cells (neighbouring with local elements).
unsigned int n_edge_sides() const
std::unordered_map< LongIdx, LongIdx > global_to_local_el_idx_
Maps global element index into local/ghost index (obsolete).
unsigned int edge_idx_
Global index of Edge.
DHEdgeSide()
Default invalid accessor.
const DHCellAccessor cell() const
Return DHCellAccessor appropriate to the side.
void inc()
Iterates to next edge side.
bool operator==(const DHNeighbSide &other)
Comparison of accessors.
unsigned int get_loc_dof_indices(const DHCellAccessor &cell, std::vector< LongIdx > &indices) const override
Returns the indices of dofs associated to the cell on the local process.
DHCellSide()
Default invalid accessor.
virtual void inc()
Iterates to next local element.
friend class DHNeighbSide
DHEdgeSide(const DHCellSide &cell_side, unsigned int side_idx)
DHCellAccessor dh_cell_
Appropriate cell accessor.
std::shared_ptr< DiscreteSpace > ds_
Pointer to the discrete space for which the handler distributes dofs.
Edge edge(uint edge_idx) const
unsigned int elem_idx() const
Returns index of element in Mesh::element_vec_.
unsigned int side_idx_
Index of side.
unsigned int get_dof_indices(const DHCellAccessor &cell, std::vector< LongIdx > &indices) const override
Returns the global indices of dofs associated to the cell.
Abstract class for the description of a general finite element on a reference simplex in dim dimensio...
bool operator==(const DHEdgeSide &other)
Comparison of accessors.
unsigned int n_neighs_vb() const
Return number of neighbours.
bool operator==(const DHCellAccessor &other)
Comparison of accessors.
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
bool not_local_cell()
Check if cell side of neighbour is not local (allow skip invalid accessors).
DHCellSide(const DHCellAccessor &dh_cell_accessor, unsigned int side_idx)
unsigned int get_dof_indices(std::vector< int > &indices) const
Fill vector of the global indices of dofs associated to the cell.
LongIdx * get_el_4_loc() const
SideIter side(const unsigned int i) const
Gets side iterator of the i -th side.
unsigned int loc_ele_idx_
Index into DOFHandler::el_4_loc array.
Side accessor allows to iterate over sides of DOF handler cell.
Class allows to iterate over sides of edge.
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
unsigned int lsize(int proc) const
get local size
arma::vec3 centre() const
Side centre.