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>
131 return (loc_ele_idx_ < dof_handler_->el_ds_->lsize());
137 .error(
"Incompatible DOF handlers!");
214 inline unsigned int dim()
const {
259 inline virtual void inc() {
422 switch (this->
dim()) {
424 return fe<0>()->n_dofs();
427 return fe<1>()->n_dofs();
430 return fe<2>()->n_dofs();
433 return fe<3>()->n_dofs();
445 return fe<0>()->dof(idof);
448 return fe<1>()->dof(idof);
451 return fe<2>()->dof(idof);
454 return fe<3>()->dof(idof);
460 return fe<1>()->dof(idof);
465 auto bgn_it = make_iter<DHCellSide>(
DHCellSide(*
this, 0) );
466 auto end_it = make_iter<DHCellSide>(
DHCellSide(*
this,
dim()+1) );
473 auto bgn_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, 0, upper_bound) );
474 auto end_it = make_iter<DHNeighbSide, DHCellSide>(
DHNeighbSide(*
this, upper_bound, upper_bound) );
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
Cell accessor allow iterate over DOF handler cells.
const ElementAccessor< 3 > elm() const
Return ElementAccessor to element of loc_ele_idx_.
unsigned int n_dofs() const
Return number of dofs on given cell.
RangeConvert< DHNeighbSide, DHCellSide > neighb_sides() const
Returns range of neighbour cell of lower dimension corresponding to cell of higher dimension.
DHCellAccessor(const DOFHandlerMultiDim *dof_handler, unsigned int loc_idx)
bool is_own() const
Return true if accessor represents own element (false for ghost element)
const Dof & cell_dof(unsigned int idof) const
Return dof on a given cell.
void inc()
Iterates to next local element.
LocDofVec get_loc_dof_indices() const
Returns the local indices of dofs associated to the cell on the local process.
bool operator!=(const DHCellAccessor &other) const
Comparison of accessors.
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...
bool operator==(const DHCellAccessor &other) const
Comparison of accessors.
DHCellAccessor()
Default invalid accessor.
unsigned int get_dof_indices(std::vector< LongIdx > &indices) const
Fill vector of the global indices of dofs associated to the cell.
unsigned int loc_ele_idx_
Index into DOFHandler::el_4_loc array.
const DOFHandlerMultiDim * dh() const
Return DOF handler.
unsigned int dim() const
Return dimension of element appropriate to cell.
const DOFHandlerMultiDim * dof_handler_
Pointer to the DOF handler owning the element.
Range< DHCellSide > side_range() const
Returns range of cell sides.
unsigned int elm_idx() const
Return serial idx to element of loc_ele_idx_.
FEPtr< dim > fe() const
Returns finite element object for given space dimension.
friend class DHNeighbSide
bool is_valid() const
Check validity of accessor (see default constructor)
unsigned int local_idx() const
Return local index to element (index of DOF handler).
Side accessor allows to iterate over sides of DOF handler cell.
virtual bool is_valid() const
Check validity of accessor (see default constructor)
unsigned int elem_idx() const
DHCellAccessor & cell()
Return DHCellAccessor appropriate to the side.
DHCellSide(const DHCellAccessor &dh_cell_accessor, unsigned int side_idx)
DHCellAccessor dh_cell_accessor_
Appropriate DHCellAccessor.
DHCellSide()
Default invalid accessor.
bool operator==(const DHCellSide &other)
Comparison of accessors.
unsigned int n_edge_sides() const
Side side() const
Return Side of given cell and side_idx.
const DHCellAccessor & cell() const
Return DHCellAccessor appropriate to the side.
RangeConvert< DHEdgeSide, DHCellSide > edge_sides() const
Returns range of all sides looped over common Edge.
unsigned int dim() const
Return dimension of element appropriate to the side.
bool operator!=(const DHCellSide &other) const
unsigned int side_idx_
Index of side.
virtual void inc()
Iterates to next local element.
ElementAccessor< 3 > element() const
unsigned int side_idx() const
arma::vec3 centre() const
Side centre.
Class allows to iterate over sides of edge.
DHEdgeSide(const DHCellSide &cell_side, unsigned int side_idx)
bool operator==(const DHEdgeSide &other)
Comparison of accessors.
DHEdgeSide()
Default invalid accessor.
void inc()
Iterates to next edge side.
unsigned int side_idx_
Index of side owned by Edge.
const DOFHandlerMultiDim * dof_handler_
Pointer to the DOF handler owning the element.
bool is_valid() const
Check validity of accessor (see default constructor)
unsigned int edge_idx_
Global index of Edge.
Class allows to iterate over sides of neighbour.
bool is_valid() const
Check validity of accessor (see default constructor of DHCellAccessor)
DHNeighbSide(const DHCellAccessor &dh_cell, unsigned int neighb_idx, unsigned int max_idx)
Valid accessor allows iterate over neighbor sides.
DHCellAccessor dh_cell_
Appropriate cell accessor.
unsigned int max_idx_
Maximal index into neigh_vb array.
bool not_local_cell()
Check if cell side of neighbour is not local (allow skip invalid accessors).
bool operator==(const DHNeighbSide &other)
Comparison of accessors.
void inc()
Iterates to next neighbour side.
DHNeighbSide()
Default invalid accessor.
unsigned int neighb_idx_
Index into neigh_vb array.
MeshBase * mesh() const
Returns the mesh.
Provides the numbering of the finite element degrees of freedom on the computational mesh.
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.
std::shared_ptr< DiscreteSpace > ds_
Pointer to the discrete space for which the handler distributes dofs.
unsigned int get_dof_indices(const DHCellAccessor &cell, std::vector< LongIdx > &indices) const override
Returns the global indices of dofs associated to the cell.
vector< LongIdx > ghost_4_loc
Indices of ghost cells (neighbouring with local elements).
bool el_is_local(int index) const
const DHCellAccessor cell_accessor_from_element(unsigned int elm_idx) const
Return DHCellAccessor appropriate to ElementAccessor of given idx.
std::unordered_map< LongIdx, LongIdx > global_to_local_el_idx_
Maps global element index into local/ghost index (obsolete).
unsigned int lsize(int proc) const
get local size
unsigned int n_sides() const
Returns number of sides aligned with the edge.
SideIter side(const unsigned int i) const
Gets side iterator of the i -th side.
unsigned int idx() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
unsigned int edge_idx(unsigned int edg_idx) const
Return edge_idx of given index.
unsigned int n_neighs_vb() const
Return number of neighbours.
LongIdx * get_el_4_loc() const
unsigned int n_nodes() const
unsigned int n_elements() const
Edge edge(uint edge_idx) const
Return edge with given index.
ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
double measure() const
Calculate metrics of the side.
unsigned int elem_idx() const
Returns index of element in Mesh::element_vec_.
unsigned int side_idx() const
Returns local index of the side on the element.
ElementAccessor< 3 > element() const
Returns iterator to the element of the side.
double diameter() const
Calculate the side diameter.
arma::vec3 centre() const
Centre of side.
std::shared_ptr< FiniteElement< dim > > FEPtr
Declaration of class which handles the ordering of degrees of freedom (dof) and mappings between loca...
Abstract class for description of finite elements.
arma::Col< IntIdx > LocDofVec
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)