CellAccessor< dim > Class Template Reference
[Grid classesAccessor classes of the mesh iterators]

Inheritance diagram for CellAccessor< dim >:

Inheritance graph
[legend]

List of all members.

Public Types

typedef TriaObjectAccessor
< dim, dim >::AccessorData 
AccessorData

Public Member Functions

 CellAccessor (const Triangulation< dim > *parent=0, const int level=-1, const int index=-1, const AccessorData *local_data=0)
TriaIterator< dim,
CellAccessor< dim > > 
neighbor (const unsigned int i) const
int neighbor_index (const unsigned int i) const
int neighbor_level (const unsigned int i) const
void set_neighbor (const unsigned int i, const TriaIterator< dim, CellAccessor< dim > > &pointer) const
unsigned int neighbor_of_neighbor (const unsigned int neighbor) const
bool neighbor_is_coarser (const unsigned int neighbor) const
std::pair< unsigned int,
unsigned int
neighbor_of_coarser_neighbor (const unsigned int neighbor) const
unsigned int neighbor_face_no (const unsigned int neighbor) const
bool at_boundary (const unsigned int i) const
bool at_boundary () const
bool has_boundary_lines () const
RefinementCase< dim > refine_flag_set () const
void set_refine_flag (const RefinementCase< dim > ref_case=RefinementCase< dim >::isotropic_refinement) const
void clear_refine_flag () const
bool flag_for_face_refinement (const unsigned int face_no, const RefinementCase< dim-1 > &face_refinement_case=RefinementCase< dim-1 >::isotropic_refinement) const
bool flag_for_line_refinement (const unsigned int line_no) const
internal::SubfaceCase< dim > subface_case (const unsigned int face_no) const
bool coarsen_flag_set () const
void set_coarsen_flag () const
void clear_coarsen_flag () const
TriaIterator< dim,
CellAccessor< dim > > 
child (const unsigned int i) const
TriaIterator< dim,
TriaObjectAccessor< dim-1, dim > > 
face (const unsigned int i) const
unsigned int face_index (const unsigned int i) const
TriaIterator< dim,
CellAccessor< dim > > 
neighbor_child_on_subface (const unsigned int face_no, const unsigned int subface_no) const
unsigned char material_id () const
void set_material_id (const unsigned char new_material_id) const
void recursively_set_material_id (const unsigned char new_material_id) const
unsigned int subdomain_id () const
void set_subdomain_id (const unsigned int new_subdomain_id) const
bool active () const
bool point_inside (const Point< dim > &p) const

Protected Member Functions

unsigned int neighbor_of_neighbor_internal (const unsigned int neighbor) const

Private Member Functions

void operator= (const CellAccessor< dim > &)

Classes

class  ExcCellFlaggedForCoarsening
class  ExcCellFlaggedForRefinement
class  ExcRefineCellNotActive


Detailed Description

template<int dim>
class CellAccessor< dim >

This class allows access to a cell: a line in one dimension, a quad in two dimension, etc.

The following refers to any space dimension:

This class allows access to a cell, which is a line in 1D and a quad in 2D. Cells have more functionality than lines or quads by themselves, for example they can be flagged for refinement, they have neighbors, they have the possibility to check whether they are at the boundary etc. This class offers access to all this data.

Author:
Wolfgang Bangerth, 1998, 1999, 2000

Member Typedef Documentation

template<int dim>
typedef TriaObjectAccessor<dim,dim>::AccessorData CellAccessor< dim >::AccessorData

Propagate the AccessorData type into the present class.

Reimplemented from TriaObjectAccessor< dim, dim >.


Constructor & Destructor Documentation

template<int dim>
CellAccessor< dim >::CellAccessor ( const Triangulation< dim > *  parent = 0,
const int  level = -1,
const int  index = -1,
const AccessorData local_data = 0 
)

Constructor.


Member Function Documentation

template<int dim>
TriaIterator<dim,CellAccessor<dim> > CellAccessor< dim >::neighbor ( const unsigned int  i  )  const

Return a pointer to the ith neighbor. If the neighbor does not exist, an invalid iterator is returned.

Note (cf. TriaLevel<0>): The neighbor of a cell has at most the same level as this cell, i.e. it may or may not be refined.

template<int dim>
int CellAccessor< dim >::neighbor_index ( const unsigned int  i  )  const

Return the index of the ith neighbor. If the neighbor does not exist, its index is -1.

template<int dim>
int CellAccessor< dim >::neighbor_level ( const unsigned int  i  )  const

Return the level of the ith neighbor. If the neighbor does not exist, its level is -1.

template<int dim>
void CellAccessor< dim >::set_neighbor ( const unsigned int  i,
const TriaIterator< dim, CellAccessor< dim > > &  pointer 
) const

Set the neighbor i of this cell to the cell pointed to by pointer. This line must be used.

template<int dim>
unsigned int CellAccessor< dim >::neighbor_of_neighbor ( const unsigned int  neighbor  )  const

Return the how-many'th neighbor this cell is of cell->neighbor(neighbor), i.e. return the face_no such that cell->neighbor(neighbor)->neighbor(face_no)==cell. This function is the right one if you want to know how to get back from a neighbor to the present cell.

Note that this operation is only useful if the neighbor is not coarser than the present cell. If the neighbor is coarser this function throws an exception. Use the neighbor_of_coarser_neighbor function in that case.

template<int dim>
bool CellAccessor< dim >::neighbor_is_coarser ( const unsigned int  neighbor  )  const

Return, whether the neighbor is coarser then the present cell. This is important in case of ansiotropic refinement where this information does not depend on the levels of the cells.

Note, that in an anisotropic setting, a cell can only be coarser than another one at a given face, not on a general basis. The face of the finer cell is contained in the corresponding face of the coarser cell, the finer face is either a child or a grandchild of the coarser face.

template<int dim>
std::pair<unsigned int, unsigned int> CellAccessor< dim >::neighbor_of_coarser_neighbor ( const unsigned int  neighbor  )  const

This function is a generalization of the neighbor_of_neighbor function for the case of a coarser neighbor. It returns a pair of numbers, face_no and subface_no, with the following property, if the neighbor is not refined: cell->neighbor(neighbor)->neighbor_child_on_subface(face_no,subface_no)==cell. In 3D, a coarser neighbor can still be refined. In that case subface_no denotes the child index of the neighbors face that relates to our face: cell->neighbor(neighbor)->face(face_no)->child(subface_no)==cell->face(neighbor). This case in 3d and how it can happen is discussed in the introduction of the step-30 tutorial program.

This function is impossible for dim==1.

template<int dim>
unsigned int CellAccessor< dim >::neighbor_face_no ( const unsigned int  neighbor  )  const

This function is a generalization of the neighbor_of_neighbor and the neighbor_of_coarser_neighbor functions. It checks whether the neighbor is coarser or not and calls the respective function. In both cases, only the face_no is returned.

template<int dim>
bool CellAccessor< dim >::at_boundary ( const unsigned int  i  )  const

Return whether the ith vertex or face (depending on the dimension) is part of the boundary. This is true, if the ith neighbor does not exist.

template<int dim>
bool CellAccessor< dim >::at_boundary (  )  const

Return whether the cell is at the boundary. Being at the boundary is defined by one face being on the boundary. Note that this does not catch cases where only one vertex of a quad or of a hex is at the boundary, or where only one line of a hex is at the boundary while the interiors of all faces are in the interior of the domain. For the latter case, the has_boundary_lines function is the right one to ask.

Reimplemented from TriaObjectAccessor< dim, dim >.

template<int dim>
bool CellAccessor< dim >::has_boundary_lines (  )  const

This is a slight variation to the at_boundary function: for 1 and 2 space dimensions, it is equivalent, for three space dimensions it returns whether at least one of the 12 lines of the hexahedron is at a boundary. This, of course, includes the case where a whole face is at the boundary, but also some other cases.

template<int dim>
RefinementCase<dim> CellAccessor< dim >::refine_flag_set (  )  const

Return the RefinementCase<dim> this cell was flagged to be refined with.

template<int dim>
void CellAccessor< dim >::set_refine_flag ( const RefinementCase< dim >  ref_case = RefinementCase< dim >::isotropic_refinement  )  const

Flag the cell pointed to for refinement. This function is only allowed for active cells.

template<int dim>
void CellAccessor< dim >::clear_refine_flag (  )  const

Clear the refinement flag.

template<int dim>
bool CellAccessor< dim >::flag_for_face_refinement ( const unsigned int  face_no,
const RefinementCase< dim-1 > &  face_refinement_case = RefinementCase< dim-1 >::isotropic_refinement 
) const

Modify the refinement flag of the cell to ensure (at least) the given refinement case face_refinement_case at face face_no, taking into account orientation, flip and rotation of the face. Return, whether the refinement flag had to be modified. This function is only allowed for active cells.

template<int dim>
bool CellAccessor< dim >::flag_for_line_refinement ( const unsigned int  line_no  )  const

Modify the refinement flag of the cell to ensure that line face_no will be refined. Return, whether the refinement flag had to be modified. This function is only allowed for active cells.

template<int dim>
internal::SubfaceCase<dim> CellAccessor< dim >::subface_case ( const unsigned int  face_no  )  const

Return the SubfaceCase of face face_no. Note that this is not identical to asking cell->face(face_no)->refinement_case() since the latter returns a RefinementCase<dim-1> and thus only considers one (anisotropic) refinement, whereas this function considers the complete refinement situation including possible refinement of the face's children. This function may only be called for active cells in 2d and 3d.

template<int dim>
bool CellAccessor< dim >::coarsen_flag_set (  )  const

Return whether the coarsen flag is set or not.

template<int dim>
void CellAccessor< dim >::set_coarsen_flag (  )  const

Flag the cell pointed to for coarsening. This function is only allowed for active cells.

template<int dim>
void CellAccessor< dim >::clear_coarsen_flag (  )  const

Clear the coarsen flag.

template<int dim>
TriaIterator<dim,CellAccessor<dim> > CellAccessor< dim >::child ( const unsigned int  i  )  const

Return a pointer to the ith child. Overloaded version which returns a more reasonable iterator class.

Reimplemented from TriaObjectAccessor< dim, dim >.

template<int dim>
TriaIterator<dim,TriaObjectAccessor<dim-1, dim> > CellAccessor< dim >::face ( const unsigned int  i  )  const

Return an iterator to the ith face of this cell.

This function is not implemented in 1D, and maps to QuadAccessor::line in 2D.

template<int dim>
unsigned int CellAccessor< dim >::face_index ( const unsigned int  i  )  const

Return the (global) index of the ith face of this cell.

This function is not implemented in 1D, and maps to line_index in 2D and quad_index in 3D.

template<int dim>
TriaIterator<dim,CellAccessor<dim> > CellAccessor< dim >::neighbor_child_on_subface ( const unsigned int  face_no,
const unsigned int  subface_no 
) const

Return an iterator to that cell that neighbors the present cell on the given face and subface number.

To succeed, the present cell must not be further refined, and the neighbor on the given face must be further refined exactly once; the returned cell is then a child of that neighbor.

The function may not be called in 1d, since there we have no subfaces. The implementation of this function is rather straightforward in 2d, by first determining which face of the neighbor cell the present cell is bordering on (this is what the neighbor_of_neighbor function does), and then asking GeometryInfo::child_cell_on_subface for the index of the child.

However, the situation is more complicated in 3d, since there faces may have more than one orientation, and we have to use face_orientation, face_flip and face_rotation for both this and the neighbor cell to figure out which cell we want to have.

This can lead to surprising results: if we are sitting on a cell and are asking for a cell behind subface sf, then this means that we are considering the subface for the face in the natural direction for the present cell. However, if the face as seen from this cell has face_orientation()==false, then the child of the face that separates the present cell from the neighboring cell's child is not necessarily the sf-th child of the face of this cell. This is so because the subface_no on a cell corresponds to the subface with respect to the intrinsic ordering of the present cell, whereas children of face iterators are computed with respect to the intrinsic ordering of faces; these two orderings are only identical if the face orientation is true, and reversed otherwise.

Similarly, effects of face_flip()==true and face_rotation()==true(), both of which indicate a non-standard face have to be considered.

Fortunately, this is only very rarely of concern, since usually one simply wishes to loop over all finer neighbors at a given face of an active cell. Only in the process of refinement of a Triangulation we want to set neighbor information for both our child cells and the neighbor's children. Since we can respect orientation of faces from our current cell in that case, we do NOT respect face_orientation, face_flip and face_rotation of the present cell within this function, i.e. the returned neighbor's child is behind subface subface concerning the intrinsic ordering of the given face.

template<int dim>
unsigned char CellAccessor< dim >::material_id (  )  const

Return the material id of this cell.

For a typical use of this function, see the step-28 tutorial program.

template<int dim>
void CellAccessor< dim >::set_material_id ( const unsigned char  new_material_id  )  const

Set the material id of this cell.

For a typical use of this function, see the step-28 tutorial program.

template<int dim>
void CellAccessor< dim >::recursively_set_material_id ( const unsigned char  new_material_id  )  const

Set the material id of this cell and all its children (and grand-children, and so on) to the given value.

template<int dim>
unsigned int CellAccessor< dim >::subdomain_id (  )  const

Return the subdomain id of this cell.

template<int dim>
void CellAccessor< dim >::set_subdomain_id ( const unsigned int  new_subdomain_id  )  const

Set the subdomain id of this cell.

template<int dim>
bool CellAccessor< dim >::active (  )  const

Test whether the cell has children (this is the criterion for activity of a cell).

template<int dim>
bool CellAccessor< dim >::point_inside ( const Point< dim > &  p  )  const

Test whether the point p is inside this cell. Points on the boundary are counted as being inside the cell.

Note that this function assumes that the mapping between unit cell and real cell is (bi-, tri-)linear, i.e. that faces in 2d and edges in 3d are straight lines. If you have higher order transformations, results may be different as to whether a point is in- or outside the cell in real space.

template<int dim>
unsigned int CellAccessor< dim >::neighbor_of_neighbor_internal ( const unsigned int  neighbor  )  const [protected]

This function assumes that the neighbor is not coarser than the current cell. In this case it returns the neighbor_of_neighbor() value. If, however, the neighbor is coarser this function returns an invalid_unsigned_int.

This function is not for public use. Use the function neighbor_of_neighbor() instead which throws an exception if called for a coarser neighbor. If neighbor is indeed coarser (you get to know this by e.g. the neighbor_is_coarser() function) then the neighbor_of_coarser_neighbor() function should be call. If you'd like to know only the face_no which is required to get back from the neighbor to the present cell then simply use the neighbor_face_no() function which can be used for coarser as well as noncoarser neighbors.

template<int dim>
void CellAccessor< dim >::operator= ( const CellAccessor< dim > &   )  [private]

Copy operator. This is normally used in a context like iterator a,b; *a=*b;. Since the meaning is to copy the object pointed to by b to the object pointed to by a and since accessors are not real but virtual objects, this operation is not useful for iterators on triangulations. We declare this function here private, thus it may not be used from outside. Furthermore it is not implemented and will give a linker error if used anyway.


The documentation for this class was generated from the following file:

deal.II documentation generated on Wed Aug 27 19:11:09 2008 by doxygen 1.5.6