19 #ifndef DH_CELL_ACCESSOR_HH_ 20 #define DH_CELL_ACCESSOR_HH_ 91 unsigned int n_dofs()
const;
100 inline unsigned int dim()
const {
107 template<
unsigned int dim>
126 return (loc_ele_idx_ < dof_handler_->el_ds_->lsize());
172 : dh_cell_accessor_(dh_cell_accessor), side_idx_(side_idx) {}
176 return dh_cell_accessor_.is_valid();
182 return Side(dh_cell_accessor_.dof_handler_->mesh(), dh_cell_accessor_.elm_idx(), side_idx_ );
187 return dh_cell_accessor_;
191 inline unsigned int dim()
const {
197 return side().centre();
205 return side().elem_idx();
209 return side().cond();
217 return side().measure();
221 return side().diameter();
233 unsigned int n_edge_sides()
const;
236 inline virtual void inc() {
280 edge_idx_(cell_side.dh_cell_accessor_.
elm()->edge_idx(cell_side.side_idx_)),
342 : dh_cell_(dh_cell), neighb_idx_(neighb_idx), max_idx_(max_idx)
345 while ( (neighb_idx_<max_idx_) && not_local_cell() ) {
352 return dh_cell_.is_valid();
360 if (neighb_idx_>=max_idx_)
break;
361 }
while ( not_local_cell() );
371 SideIter side = dh_cell_.elm()->neigh_vb[neighb_idx_]->side();
379 return ( dh_cell_.dof_handler_->global_to_local_el_idx_.end() ==
380 dh_cell_.dof_handler_->global_to_local_el_idx_.find((
LongIdx)dh_cell_.elm()->neigh_vb[neighb_idx_]->side()->elem_idx()) );
399 switch (this->
dim()) {
419 return fe<1>()->dof(idof);
422 return fe<2>()->dof(idof);
425 return fe<3>()->dof(idof);
432 auto bgn_it = make_iter<DHCellSide>(
DHCellSide(*
this, 0) );
433 auto end_it = make_iter<DHCellSide>(
DHCellSide(*
this,
dim()+1) );
440 auto bgn_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, 0, upper_bound) );
441 auto end_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, upper_bound, upper_bound) );
448 make_iter<DHEdgeSide, DHCellSide>(
DHEdgeSide( *
this, n_edge_sides()) ));
453 unsigned int edge_idx = dh_cell_accessor_.elm()->edge_idx(side_idx_);
454 Edge *edg = &dh_cell_accessor_.dof_handler_->mesh()->edges[edge_idx];
455 for (
int sid=0; sid<edg->
n_sides; sid++)
456 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.)
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
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
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.
std::vector< Edge > edges
Vector of MH edges, this should not be part of the geometrical mesh.
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.
unsigned int elem_idx() const
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
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.