* coordinates of the TriaAccessor.
*/
void copy_from (const TriaAccessorBase<structdim, DH::dimension, DH::space_dimension> &da);
+
+ /**
+ * Return an iterator pointing to
+ * the the parent.
+ */
+ TriaIterator<DoFAccessor<structdim,DH> >
+ parent () const;
/**
* @name Accessing sub-objects
* @}
*/
+ /**
+ * Return the parent as a DoF
+ * cell iterator. This
+ * function is needed since the
+ * parent function of the base
+ * class returns a cell accessor
+ * without access to the DoF
+ * data.
+ */
+ typename internal::DoFHandler::Iterators<DH>::cell_iterator
+ parent () const;
+
/**
* @name Accessing sub-objects and neighbors
*/
}
+template <int structdim, class DH>
+inline
+TriaIterator<DoFAccessor<structdim,DH> >
+DoFAccessor<structdim,DH>::parent () const
+{
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
+ ExcMessage ("DoFHandler not initialized"));
+ Assert (this->level () > 0,
+ ExcMessage ("Cell is at coarsest level."));
+
+ int previous_level;
+
+ if (DH::dimension==structdim)
+ previous_level = this->level () - 1;
+
+ else
+ previous_level = 0;
+
+ TriaIterator<DoFAccessor<structdim,DH> > q (this->tria,
+ previous_level,
+ this->parent_index (),
+ this->dof_handler);
+
+ return q;
+}
+
+
namespace internal
{
}
+template <class DH>
+inline
+typename internal::DoFHandler::Iterators<DH>::cell_iterator
+DoFCellAccessor<DH>::parent () const
+{
+ typename internal::DoFHandler::Iterators<DH>::cell_iterator
+ q (this->tria,
+ this->level() - 1,
+ this->parent_index (),
+ this->dof_handler);
+
+ return q;
+}
+
template <class DH>
typename internal::DoFHandler::Iterators<DH>::face_iterator
*/
bool used () const;
+ /**
+ * Index of the parent.
+ * The level of the parent is one
+ * lower than that of the
+ * present cell, if the parent
+ * of a cell is accessed. If the
+ * parent does not exist, -1 is
+ * returned.
+ */
+ int parent_index () const;
+
/**
* @name Accessing sub-objects
}
+template <int structdim, int dim, int spacedim>
+int
+TriaAccessor<structdim, dim, spacedim>::
+parent_index () const
+{
+ Assert (this->present_level > 0, TriaAccessorExceptions::ExcCellHasNoParent ());
+
+ // the parent of two consecutive cells
+ // is stored only once, since it is
+ // the same
+ return this->tria->levels[this->present_level]->parents[this->present_index / 2];
+}
+
template <int structdim, int dim, int spacedim>
int
* @}
*/
+ /**
+ * Return an iterator pointing to
+ * the the parent.
+ */
+ TriaIterator<MGDoFAccessor<structdim,dim,spacedim> >
+ parent () const;
+
/**
* Implement the copy operator needed
* for the iterator classes.
/**
* @}
*/
+
+ /**
+ * Return the parent as a MGDoF cell
+ * iterator. This function is needed since
+ * the parent function of the base
+ * class returns a cell accessor without
+ * access to the DoF data.
+ */
+ TriaIterator<MGDoFCellAccessor<dim,spacedim> >
+ parent () const;
};
/*@}*/
Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
Assert (this->present_level > 0, TriaAccessorExceptions::ExcCellHasNoParent ());
TriaIterator<CellAccessor<dim,spacedim> >
- q (this->tria, this->present_level-1,
- this->tria->levels[this->present_level]->parents[this->present_index / 2]);
+ q (this->tria, this->present_level-1, this->parent_index ());
return q;
}
}
+template <int structdim, int dim, int spacedim>
+TriaIterator<MGDoFAccessor<structdim,dim,spacedim> >
+MGDoFAccessor<structdim, dim, spacedim>::parent () const
+{
+ Assert (this->level () > 0,
+ ExcMessage ("Cell is at coarsest level."));
+
+ const TriaIterator<MGDoFAccessor<structdim,dim,spacedim> >
+ q (this->tria,
+ (structdim == dim ?
+ this->level() - 1 :
+ 0),
+ this->parent_index (),
+ this->mg_dof_handler);
+
+ return q;
+}
+
template <int structdim, int dim, int spacedim>
void
}
+template <int dim, int spacedim>
+TriaIterator<MGDoFCellAccessor<dim,spacedim> >
+MGDoFCellAccessor<dim, spacedim>::parent () const
+{
+ const TriaIterator<MGDoFCellAccessor<dim,spacedim> >
+ q (this->tria,
+ this->level() - 1,
+ this->parent_index (),
+ this->mg_dof_handler);
+
+ return q;
+}
+
+
template <int dim, int spacedim>
typename internal::MGDoFHandler::Iterators<dim,spacedim>::face_iterator
MGDoFCellAccessor<dim,spacedim>::face (const unsigned int i) const
<ol>
+ <li>
+ <p>
+ New: Reimplementation of the parent function in the various DoFCellAccessors so
+ that one can call the parent function from a DoFIterator and also gets a
+ DoFIterator returned.
+ <br>
+ (Markus Buerg 2010/08/30)
+ </p>
+
<li>
<p>
New: FETools::compute_embedding_matrices now computes the embedding matrix