19 #ifndef DH_CELL_ACCESSOR_HH_ 20 #define DH_CELL_ACCESSOR_HH_ 87 unsigned int n_dofs()
const;
96 inline unsigned int dim()
const {
103 template<
unsigned int dim>
122 return (loc_ele_idx_ < dof_handler_->el_ds_->lsize());
168 : dh_cell_accessor_(dh_cell_accessor), side_idx_(side_idx) {}
172 return dh_cell_accessor_.is_valid();
178 return new Side( const_cast<const Mesh*>(dh_cell_accessor_.dof_handler_->mesh()), dh_cell_accessor_.elm_idx(), side_idx_ );
183 return dh_cell_accessor_;
187 inline unsigned int dim()
const {
199 unsigned int n_edge_sides()
const;
202 inline virtual void inc() {
242 edge_idx_(cell_side.dh_cell_accessor_.
elm()->edge_idx(cell_side.side_idx_)),
304 : dh_cell_(dh_cell), neighb_idx_(neighb_idx), max_idx_(max_idx)
307 while ( (neighb_idx_<max_idx_) && not_local_cell() ) {
314 return dh_cell_.is_valid();
322 if (neighb_idx_>=max_idx_)
break;
323 }
while ( not_local_cell() );
333 SideIter side = dh_cell_.elm()->neigh_vb[neighb_idx_]->side();
341 return ( dh_cell_.dof_handler_->global_to_local_el_idx_.end() ==
342 dh_cell_.dof_handler_->global_to_local_el_idx_.find((
LongIdx)dh_cell_.elm()->neigh_vb[neighb_idx_]->side()->elem_idx()) );
361 unsigned int ndofs = 0;
363 for (
unsigned int k=0; k<ndofs; k++)
372 unsigned int ndofs = 0;
374 for (
unsigned int k=0; k<ndofs; k++)
383 switch (this->
dim()) {
403 return fe<1>()->dof(idof);
406 return fe<2>()->dof(idof);
409 return fe<3>()->dof(idof);
416 auto bgn_it = make_iter<DHCellSide>(
DHCellSide(*
this, 0) );
417 auto end_it = make_iter<DHCellSide>(
DHCellSide(*
this,
dim()+1) );
424 auto bgn_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, 0, upper_bound) );
425 auto end_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, upper_bound, upper_bound) );
432 make_iter<DHEdgeSide, DHCellSide>(
DHEdgeSide( *
this, n_edge_sides()) ));
437 unsigned int edge_idx = dh_cell_accessor_.elm()->edge_idx(side_idx_);
438 Edge *edg = &dh_cell_accessor_.dof_handler_->mesh()->edges[edge_idx];
439 for (
int sid=0; sid<edg->
n_sides; sid++)
440 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.)
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 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 Side * side() const
Return Side of given cell and side_idx.
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.
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
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
bool operator==(const DHCellSide &other)
Comparison of accessors.
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)
std::vector< LongIdx > cell_starts
Starting indices for local (owned+ghost) element dofs.
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.
std::vector< LongIdx > dof_indices
Dof numbers on local and ghost elements.
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
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.
DHCellSide()
Default invalid accessor.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than)
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.
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