<ol>
-
- <li> Changed: the functionparser library bundled with deal.II got replaced
+ <li> Changed: The functionparser library bundled with deal.II got replaced
by the muparser library.
<br>
(Timo Heister, 2014/02/10)
<h3>Specific improvements</h3>
<ol>
+ <li> Changed: Class TriaAccessor had a function parent_index(), but this function
+ could only work for cell accessors. The function has consequently been moved
+ to class CellAccessor.
+ <br>
+ (Wolfgang Bangerth, 2014/03/15)
+ </li>
<li> Fixed: step-32 had a piece of code where we accessed an internal
representation of how Trilinos vectors are actually stored. This is poor
*/
static bool is_level_cell();
- /**
- * Return an iterator pointing to the the parent.
- */
- TriaIterator<DoFAccessor<structdim,DH, level_dof_access> >
- parent () const;
-
/**
* @name Accessing sub-objects
*/
*/
void copy_from (const TriaAccessorBase<0, 1, spacedim> &da);
- /**
- * Return an iterator pointing to the the parent.
- */
- TriaIterator<DoFAccessor<0,DH<1,spacedim>, level_dof_access> >
- 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.
+ * Return the parent of this cell as a DoF cell iterator.
+ * If the parent does not exist (i.e., if the object is at the coarsest level of
+ * the mesh hierarchy), an exception is generated.
+ *
+ * This function is needed
+ * since the parent function of the base class CellAccessor returns a triangulation
+ * cell accessor without access to the DoF data.
*/
TriaIterator<DoFCellAccessor<DH, level_dof_access> >
parent () const;
}
-template <int structdim, class DH, bool level_dof_access>
-inline
-TriaIterator<DoFAccessor<structdim,DH,level_dof_access> >
-DoFAccessor<structdim,DH,level_dof_access>::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,level_dof_access> > q (this->tria,
- previous_level,
- this->parent_index (),
- this->dof_handler);
-
- return q;
-}
-
-
-
namespace internal
{
namespace DoFAccessor
*/
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
*/
*/
void clear_refinement_case () const;
- /**
- * Set the parent of a cell.
- */
- void set_parent (const unsigned int parent_index);
-
/**
* Set the index of the ith
* child. Since the children
* @}
*/
- /**
- * Index of the parent. You
- * can't do this for points.
- */
- static int parent_index ();
-
/**
* @name Accessing sub-objects
*/
*/
bool direction_flag () const;
-
+ /**
+ * Index of the parent of this cell.
+ * 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 (i.e., if the object is at the coarsest level of
+ * the mesh hierarchy), an exception is generated.
+ */
+ int parent_index () const;
/**
* Return an iterator to the
- * parent. Throws an exception if this cell has no parent, i.e. has
- * level 0.
+ * parent. If the
+ * parent does not exist (i.e., if the object is at the coarsest level of
+ * the mesh hierarchy), an exception is generated.
*/
TriaIterator<CellAccessor<dim,spacedim> >
parent () const;
private:
+ /**
+ * Set the parent of a cell.
+ */
+ void set_parent (const unsigned int parent_index);
+
/**
* Set the orientation of this
* cell.
}
-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
TriaAccessor<structdim, dim, spacedim>::
-template <int structdim, int dim, int spacedim>
-void
-TriaAccessor<structdim, dim, spacedim>::set_parent (const unsigned int parent_index)
-{
- Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
- Assert (this->present_level > 0, TriaAccessorExceptions::ExcCellHasNoParent ());
- this->tria->levels[this->present_level]->parents[this->present_index / 2]
- = parent_index;
-}
-
-
-
template <int structdim, int dim, int spacedim>
void
TriaAccessor<structdim, dim, spacedim>::clear_children () const
-
-template <int spacedim>
-inline
-int
-TriaAccessor<0, 1, spacedim>::parent_index ()
-{
- return -1;
-}
-
-
template <int spacedim>
inline
unsigned int
* In TriaLevel, all cell data is stored which is not dependent on the
* dimension, e.g. a field to store the refinement flag for the cells
* (what a cell actually is is declared elsewhere), etc. See also
- * TriaObjects for non leveloriented data.
+ * TriaObjects for non level-oriented data.
*
* There is another field, which may fit in here, namely the
* material data (for cells) or the boundary indicators (for faces),
* One integer for every consecutive
* pair of cells to store which
* index their parent has.
+ *
+ * (We store this information once for each pair of cells since every
+ * refinement, isotropic or anisotropic, and in any space dimension,
+ * always creates children in multiples of two, so there is no need to
+ * store the parent index for every cell.)
*/
std::vector<int> parents;
+template <int dim, int spacedim>
+void
+CellAccessor<dim, spacedim>::set_parent (const unsigned int parent_index)
+{
+ Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
+ Assert (this->present_level > 0, TriaAccessorExceptions::ExcCellHasNoParent ());
+ this->tria->levels[this->present_level]->parents[this->present_index / 2]
+ = parent_index;
+}
+
+
+
+template <int dim, int spacedim>
+int
+CellAccessor<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 dim, int spacedim>
TriaIterator<CellAccessor<dim,spacedim> >
CellAccessor<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->parent_index ());
+ q (this->tria, this->present_level-1, parent_index ());
return q;
}