19 #ifndef DH_CELL_ACCESSOR_HH_ 20 #define DH_CELL_ACCESSOR_HH_ 92 unsigned int n_dofs()
const;
101 inline unsigned int dim()
const {
113 template<
unsigned int dim>
142 return (loc_ele_idx_ < dof_handler_->el_ds_->lsize());
148 .error(
"Incompatible DOF handlers!");
204 : dh_cell_accessor_(dh_cell_accessor), side_idx_(side_idx) {}
208 return dh_cell_accessor_.is_valid();
214 return Side(dh_cell_accessor_.dof_handler_->mesh(), dh_cell_accessor_.elm_idx(), side_idx_ );
219 return dh_cell_accessor_;
224 return dh_cell_accessor_;
228 inline unsigned int dim()
const {
234 return side().centre();
242 return side().elem_idx();
246 return side().cond();
254 return side().measure();
258 return side().diameter();
270 unsigned int n_edge_sides()
const;
273 inline virtual void inc() {
317 edge_idx_(cell_side.dh_cell_accessor_.
elm()->edge_idx(cell_side.side_idx_)),
379 : dh_cell_(dh_cell), neighb_idx_(neighb_idx), max_idx_(max_idx)
382 while ( (neighb_idx_<max_idx_) && not_local_cell() ) {
389 return dh_cell_.is_valid();
397 if (neighb_idx_>=max_idx_)
break;
398 }
while ( not_local_cell() );
408 SideIter side = dh_cell_.elm()->neigh_vb[neighb_idx_]->side();
416 return ( dh_cell_.dof_handler_->global_to_local_el_idx_.end() ==
417 dh_cell_.dof_handler_->global_to_local_el_idx_.find((
LongIdx)dh_cell_.elm()->neigh_vb[neighb_idx_]->side()->elem_idx()) );
436 switch (this->
dim()) {
456 return fe<1>()->dof(idof);
459 return fe<2>()->dof(idof);
462 return fe<3>()->dof(idof);
466 ASSERT(0)(this->
dim()).error(
"Unsupported FE dimension.");
468 return fe<1>()->dof(idof);;
473 auto bgn_it = make_iter<DHCellSide>(
DHCellSide(*
this, 0) );
474 auto end_it = make_iter<DHCellSide>(
DHCellSide(*
this,
dim()+1) );
481 auto bgn_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, 0, upper_bound) );
482 auto end_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, upper_bound, upper_bound) );
489 make_iter<DHEdgeSide, DHCellSide>(
DHEdgeSide( *
this, n_edge_sides()) ));
494 unsigned int edge_idx = dh_cell_accessor_.elm()->edge_idx(side_idx_);
495 Edge edg = dh_cell_accessor_.dof_handler_->mesh()->edge(edge_idx);
497 if ( dh_cell_accessor_.dof_handler_->el_is_local(edg.
side(sid)->
element().
idx()) )
return edg.
n_sides();
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...
bool operator!=(const DHCellAccessor &other) const
Comparison of accessors.
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.
unsigned int elm_cache_index_
Optional member used in field evaluation, holds index of cell in field data cache.
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 get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
unsigned int elem_idx() const
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.
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).
unsigned int element_cache_index() const
Getter of elm_cache_index_.
Cell accessor allow iterate over DOF handler cells.
bool is_valid() const
Check validity of accessor (see default constructor of DHCellAccessor)
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
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...
virtual unsigned int n_nodes() const
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.
const DOFHandlerMultiDim * dh() const
Return DOF handler.
void set_element_cache_index(unsigned int idx) const
Setter of elm_cache_index_.
DHEdgeSide()
Default invalid accessor.
std::shared_ptr< FiniteElement< dim >> FEPtr
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
void inc()
Iterates to next edge side.
DHCellAccessor & cell()
Return DHCellAccessor appropriate to the side.
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
bool operator==(const DHNeighbSide &other)
Comparison of accessors.
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.
DHCellAccessor cell_with_other_dh(const DOFHandlerMultiDim *dh) const
Create new accessor with same local idx and given DOF handler. Actual and given DOF handler must be c...
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 description of finite elements.
bool operator==(const DHEdgeSide &other)
Comparison of accessors.
unsigned int n_neighs_vb() const
Return number of neighbours.
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
arma::Col< Idx > LocDofVec
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)
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.
bool operator==(const DHCellAccessor &other) const
Comparison of accessors.
FEPtr< dim > fe() const
Returns finite element object for given space dimension.
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.