TriaIterator<DH::dimension,DoFObjectAccessor<structdim,DH> >
DoFAccessor<structdim,DH>::child (const unsigned int i) const
{
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
int next_level;
if (DH::dimension==structdim)
- next_level = this->present_level+1;
+ next_level = this->level()+1;
else
next_level = 0;
{
// access the respective DoF
return this->dof_handler
- ->template get_dof_index<dim> (this->present_level,
+ ->template get_dof_index<dim> (this->level(),
this->present_index,
fe_index,
i);
{
// access the respective DoF
this->dof_handler
- ->template set_dof_index<dim> (this->present_level,
+ ->template set_dof_index<dim> (this->level(),
this->present_index,
fe_index,
i,
{
// access the respective DoF
return this->dof_handler
- ->template n_active_fe_indices<dim> (this->present_level,
+ ->template n_active_fe_indices<dim> (this->level(),
this->present_index);
}
{
// access the respective DoF
return this->dof_handler
- ->template nth_active_fe_index<dim> (this->present_level,
+ ->template nth_active_fe_index<dim> (this->level(),
this->present_index,
n);
}
{
// access the respective DoF
return this->dof_handler
- ->template fe_index_is_active<dim> (this->present_level,
+ ->template fe_index_is_active<dim> (this->level(),
this->present_index,
fe_index);
}
DoFObjectAccessor<1,DH>::get_dof_indices (std::vector<unsigned int> &dof_indices,
const unsigned int fe_index) const
{
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject());
DoFObjectAccessor<2,DH>::line (const unsigned int i) const
{
Assert (i<4, ExcIndexRange (i, 0, 4));
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
return TriaIterator<dim,DoFObjectAccessor<1,DH> >
4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex),
ExcInternalError());
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
6*this->dof_handler->get_fe()[fe_index].dofs_per_quad +
this->dof_handler->get_fe()[fe_index].dofs_per_hex),
typename BaseClass::ExcVectorDoesNotMatch());
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
// this function really only makes
8*this->dof_handler->get_fe()[fe_index].dofs_per_vertex),
ExcInternalError());
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
const unsigned int dofs_per_vertex = this->dof_handler->get_fe()[fe_index].dofs_per_vertex,
DoFCellAccessor<DH>::child (const unsigned int i) const
{
TriaIterator<dim,DoFCellAccessor<DH> > q (this->tria,
- this->present_level+1,
+ this->level()+1,
this->child_index (i),
this->dof_handler);
this->get_fe().dofs_per_vertex * GeometryInfo<1>::vertices_per_cell),
ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
- unsigned int *cache = &this->dof_handler->levels[this->present_level]
+ unsigned int *cache = &this->dof_handler->levels[this->level()]
->cell_dof_indices_cache[this->present_index * this->get_fe().dofs_per_cell];
for (unsigned int i=0; i<this->get_fe().dofs_per_cell; ++i, ++cache)
dof_indices[i] = *cache;
this->get_fe().dofs_per_vertex * GeometryInfo<2>::vertices_per_cell),
ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
- unsigned int *cache = &this->dof_handler->levels[this->present_level]
+ unsigned int *cache = &this->dof_handler->levels[this->level()]
->cell_dof_indices_cache[this->present_index * this->get_fe().dofs_per_cell];
for (unsigned int i=0; i<this->get_fe().dofs_per_cell; ++i, ++cache)
dof_indices[i] = *cache;
this->get_fe().dofs_per_vertex * GeometryInfo<3>::vertices_per_cell),
ExcMessage ("Cell must either be active, or all DoFs must be in vertices"));
- unsigned int *cache = &this->dof_handler->levels[this->present_level]
+ unsigned int *cache = &this->dof_handler->levels[this->level()]
->cell_dof_indices_cache[this->present_index * this->get_fe().dofs_per_cell];
for (unsigned int i=0; i<this->get_fe().dofs_per_cell; ++i, ++cache)
dof_indices[i] = *cache;
unsigned int
DoFCellAccessor<hp::DoFHandler<1> >::active_fe_index () const
{
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
- this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
+ this->dof_handler->levels[this->level()]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
- this->dof_handler->levels[this->present_level]->active_fe_indices.size ()));
- return this->dof_handler->levels[this->present_level]
+ this->dof_handler->levels[this->level()]->active_fe_indices.size ()));
+ return this->dof_handler->levels[this->level()]
->active_fe_indices[this->present_index];
}
unsigned int
DoFCellAccessor<hp::DoFHandler<2> >::active_fe_index () const
{
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
- this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
+ this->dof_handler->levels[this->level()]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
- this->dof_handler->levels[this->present_level]->active_fe_indices.size ()));
- return this->dof_handler->levels[this->present_level]
+ this->dof_handler->levels[this->level()]->active_fe_indices.size ()));
+ return this->dof_handler->levels[this->level()]
->active_fe_indices[this->present_index];
}
unsigned int
DoFCellAccessor<hp::DoFHandler<3> >::active_fe_index () const
{
- Assert (static_cast<unsigned int>(this->present_level) < this->dof_handler->levels.size(),
+ Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
- this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
+ this->dof_handler->levels[this->level()]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
- this->dof_handler->levels[this->present_level]->active_fe_indices.size ()));
- return this->dof_handler->levels[this->present_level]
+ this->dof_handler->levels[this->level()]->active_fe_indices.size ()));
+ return this->dof_handler->levels[this->level()]
->active_fe_indices[this->present_index];
}
{
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
- Assert (static_cast<unsigned int>(this->present_level) <
+ Assert (static_cast<unsigned int>(this->level()) <
this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
- this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
+ this->dof_handler->levels[this->level()]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
- this->dof_handler->levels[this->present_level]->active_fe_indices.size ()));
- this->dof_handler->levels[this->present_level]
+ this->dof_handler->levels[this->level()]->active_fe_indices.size ()));
+ this->dof_handler->levels[this->level()]
->active_fe_indices[this->present_index] = i;
}
{
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
- Assert (static_cast<unsigned int>(this->present_level) <
+ Assert (static_cast<unsigned int>(this->level()) <
this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
- this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
+ this->dof_handler->levels[this->level()]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
- this->dof_handler->levels[this->present_level]->active_fe_indices.size ()));
- this->dof_handler->levels[this->present_level]
+ this->dof_handler->levels[this->level()]->active_fe_indices.size ()));
+ this->dof_handler->levels[this->level()]
->active_fe_indices[this->present_index] = i;
}
{
Assert (this->dof_handler != 0,
BaseClass::ExcInvalidObject());
- Assert (static_cast<unsigned int>(this->present_level) <
+ Assert (static_cast<unsigned int>(this->level()) <
this->dof_handler->levels.size(),
ExcMessage ("DoFHandler not initialized"));
Assert (static_cast<std::vector<unsigned int>::size_type>(this->present_index) <
- this->dof_handler->levels[this->present_level]->active_fe_indices.size (),
+ this->dof_handler->levels[this->level()]->active_fe_indices.size (),
ExcIndexRange (this->present_index, 0,
- this->dof_handler->levels[this->present_level]->active_fe_indices.size ()));
- this->dof_handler->levels[this->present_level]
+ this->dof_handler->levels[this->level()]->active_fe_indices.size ()));
+ this->dof_handler->levels[this->level()]
->active_fe_indices[this->present_index] = i;
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// make a couple of classes
// friends
- template <int dim1> friend class TriaAccessor;
+ template <int,int> friend class TriaAccessor;
template <int dim1, int dim2>
friend class TriaObjectAccessor;
* @ingroup Accessors
* @author Wolfgang Bangerth, 1998
*/
-template <int dim>
+template <int structdim, int dim>
class TriaAccessor
+{
+ protected:
+ /**
+ * Declare the data type that
+ * this accessor class expects to
+ * get passed from the iterator
+ * classes. Since the pure
+ * triangulation iterators need
+ * no additional data, this data
+ * type is @p void.
+ */
+ typedef void AccessorData;
+
+ /**
+ * Constructor. Protected, thus
+ * only callable from friend
+ * classes.
+ */
+ TriaAccessor (const Triangulation<dim> *parent = 0,
+ const int level = -1,
+ const int index = -1,
+ const AccessorData * = 0);
+
+ /**
+ * Copy operator. Since this is
+ * only called from iterators,
+ * do not return anything, since
+ * the iterator will return
+ * itself.
+ *
+ * This method is protected,
+ * since it is only to be called
+ * from the iterator class.
+ */
+ void copy_from (const TriaAccessor &);
+
+ /**
+ * Copy operator. This is normally
+ * used in a context like
+ * <tt>iterator a,b; *a=*b;</tt>. Since
+ * the meaning is to copy the object
+ * pointed to by @p b to the object
+ * pointed to by @p 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.
+ */
+ void operator = (const TriaAccessor *);
+
+ /**
+ * Same as above.
+ */
+ TriaAccessor & operator = (const TriaAccessor &);
+
+ protected:
+
+ /**
+ * Compare for equality.
+ */
+ bool operator == (const TriaAccessor &) const;
+
+ /**
+ * Compare for inequality.
+ */
+ bool operator != (const TriaAccessor &) const;
+
+ public:
+ /**
+ * Data type to be used for passing
+ * parameters from iterators to the
+ * accessor classes in a unified
+ * way, no matter what the type of
+ * number of these parameters is.
+ */
+ typedef void * LocalData;
+
+ /**@ name Iterator address and state
+ */
+ /*@{*/
+ /**
+ * Return the level the element
+ * pointed to belongs to.
+ * This is only valid for cells.
+ */
+ static int level ();
+
+ /**
+ * Return the index of the
+ * element presently pointed to
+ * on the present level.
+ */
+ int index () const;
+
+ /**
+ * Return the state of the
+ * iterator. For the different
+ * states an accessor can be in,
+ * refer to the
+ * TriaRawIterator
+ * documentation.
+ */
+ IteratorState::IteratorStates state () const;
+
+ /**
+ * Return a pointer to the
+ * triangulation which the object
+ * pointed to by this class
+ * belongs to.
+ */
+ const Triangulation<dim> & get_triangulation () const;
+
+ /*@}*/
+ protected:
+ /**
+ * Used to store the index of
+ * the element presently pointed
+ * to on the level presentl
+ * used.
+ */
+ int present_index;
+
+ /**
+ * Pointer to the triangulation
+ * which we act on.
+ */
+ const Triangulation<dim> *tria;
+
+ private:
+
+ /**
+ * Dimension of the TriaObject
+ * this accessor gives access to.
+ */
+ static const unsigned int objectdim = dim;
+
+ template <int anydim, typename Accessor> friend class TriaRawIterator;
+ template <int anydim, typename Accessor> friend class TriaIterator;
+ template <int anydim, typename Accessor> friend class TriaActiveIterator;
+};
+
+
+
+template <int dim>
+class TriaAccessor<dim,dim>
{
protected:
/**
+
/**
* Common template for line, quad, hex accessors. According to
* @p celldim, objects of this class represent lines, quadrilaterals,
* @author Wolfgang Bangerth, Guido Kanschat, 1999
*/
template <int celldim, int dim>
-class TriaObjectAccessor : public TriaAccessor<dim>
+class TriaObjectAccessor : public TriaAccessor<celldim,dim>
{
public:
/**
* Propagate typedef from
* base class to this class.
*/
- typedef typename TriaAccessor<dim>::AccessorData AccessorData;
+ typedef typename TriaAccessor<celldim,dim>::AccessorData AccessorData;
/**
* Constructor.
*/
void set (const internal::Triangulation::Hexahedron&) const;
- /**
- * Return the level the element
- * pointed to belongs to.
- * This is only valid for cells.
- */
- int level () const;
-
/**
* Index of vertex. The convention
* regarding the numbering of vertices
* @ingroup grid
*/
template<int dim>
-class TriaObjectAccessor<0, dim> : public TriaAccessor<dim>
+class TriaObjectAccessor<0, dim> : public TriaAccessor<0,dim>
{
public:
/**
* Propagate typedef from
* base class to this class.
*/
- typedef typename TriaAccessor<dim>::AccessorData AccessorData;
+ typedef typename TriaAccessor<0,dim>::AccessorData AccessorData;
/**
* Constructor. Should never be
const int index = -1,
const AccessorData *local_data = 0)
:
- TriaAccessor<dim> (parent, level, index, local_data)
+ TriaAccessor<0,dim> (parent, level, index, local_data)
{
Assert (false, ExcInternalError());
};
* @author Wolfgang Bangerth, 1998
*/
template <int dim>
-class TriaObjectAccessor<1, dim> : public TriaAccessor<dim>
+class TriaObjectAccessor<1, dim> : public TriaAccessor<1,dim>
{
public:
/**
* Propagate typedef from
* base class to this class.
*/
- typedef typename TriaAccessor<dim>::AccessorData AccessorData;
+ typedef typename TriaAccessor<1,dim>::AccessorData AccessorData;
/**
* Constructor.
*/
void set (const internal::Triangulation::Line &l) const;
- /**
- * Return the level the element
- * pointed to belongs to.
- * This is only valid for cells.
- */
- int level () const;
-
/**
* Return the index of vertex
* <tt>i=0,1</tt> of a line.
* @author Wolfgang Bangerth, 1998
*/
template <int dim>
-class TriaObjectAccessor<2, dim> : public TriaAccessor<dim>
+class TriaObjectAccessor<2, dim> : public TriaAccessor<2,dim>
{
public:
/**
* Propagate typedef from base
* class to this class.
*/
- typedef typename TriaAccessor<dim>::AccessorData AccessorData;
+ typedef typename TriaAccessor<2,dim>::AccessorData AccessorData;
/**
* Constructor.
*/
void set (const internal::Triangulation::Quad &q) const;
- /**
- * Return the level the element
- * pointed to belongs to.
- * This is only valid for cells.
- */
- int level () const;
-
/**
* Return index of a vertex of a
* quad in the internal data
* @author Wolfgang Bangerth, 1998
*/
template <int dim>
-class TriaObjectAccessor<3, dim> : public TriaAccessor<dim>
+class TriaObjectAccessor<3, dim> : public TriaAccessor<3,dim>
{
public:
/**
* Propagate typedef from base
* class to this class.
*/
- typedef typename TriaAccessor<dim>::AccessorData AccessorData;
+ typedef typename TriaAccessor<3,dim>::AccessorData AccessorData;
/**
* Constructor.
// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
/*------------------------ Functions: TriaAccessor ---------------------------*/
+template <int structdim, int dim>
+inline
+TriaAccessor<structdim,dim>::TriaAccessor (const Triangulation<dim> *parent,
+ const int /*level*/,
+ const int index,
+ const AccessorData *)
+ :
+ present_index (index),
+ tria (parent)
+{}
+
+
+
+template <int structdim, int dim>
+inline
+void
+TriaAccessor<structdim,dim>::copy_from (const TriaAccessor<structdim,dim> &a)
+{
+ present_index = a.present_index;
+ tria = a.tria;
+}
+
+
+
+template <int structdim, int dim>
+inline
+bool
+TriaAccessor<structdim,dim>::operator == (const TriaAccessor<structdim,dim> &a) const
+{
+ Assert (tria == a.tria, TriaAccessorExceptions::ExcCantCompareIterators());
+ return (present_index == a.present_index);
+}
+
+
+
+template <int structdim, int dim>
+inline
+bool
+TriaAccessor<structdim,dim>::operator != (const TriaAccessor<structdim,dim> &a) const
+{
+ Assert (tria == a.tria, TriaAccessorExceptions::ExcCantCompareIterators());
+ return (present_index != a.present_index);
+}
+
+
+
+template <int structdim, int dim>
+inline
+int
+TriaAccessor<structdim,dim>::level ()
+{
+ return 0;
+}
+
+
+
+template <int structdim, int dim>
+inline
+int
+TriaAccessor<structdim,dim>::index () const
+{
+ return present_index;
+}
+
+
+
+template <int structdim, int dim>
+inline
+IteratorState::IteratorStates
+TriaAccessor<structdim,dim>::state () const
+{
+ if (present_index>=0)
+ return IteratorState::valid;
+ else
+ if (present_index==-1)
+ return IteratorState::past_the_end;
+ else
+ return IteratorState::invalid;
+}
+
+
+
+template <int structdim, int dim>
+inline
+const Triangulation<dim> &
+TriaAccessor<structdim,dim>::get_triangulation () const
+{
+ return *tria;
+}
+
+
+
+/*------------------------ Functions: TriaAccessor<dim,dim> ---------------------------*/
+
template <int dim>
inline
-TriaAccessor<dim>::TriaAccessor (const Triangulation<dim> *parent,
- const int level,
- const int index,
- const AccessorData *)
+TriaAccessor<dim,dim>::TriaAccessor (const Triangulation<dim> *parent,
+ const int level,
+ const int index,
+ const AccessorData *)
:
present_level (level),
present_index (index),
template <int dim>
inline
void
-TriaAccessor<dim>::copy_from (const TriaAccessor<dim> &a)
+TriaAccessor<dim,dim>::copy_from (const TriaAccessor<dim,dim> &a)
{
present_level = a.present_level;
present_index = a.present_index;
template <int dim>
inline
bool
-TriaAccessor<dim>::operator == (const TriaAccessor<dim> &a) const
+TriaAccessor<dim,dim>::operator == (const TriaAccessor<dim,dim> &a) const
{
Assert (tria == a.tria, TriaAccessorExceptions::ExcCantCompareIterators());
return ((present_index == a.present_index) &&
template <int dim>
inline
bool
-TriaAccessor<dim>::operator != (const TriaAccessor<dim> &a) const
+TriaAccessor<dim,dim>::operator != (const TriaAccessor<dim,dim> &a) const
{
Assert (tria == a.tria, TriaAccessorExceptions::ExcCantCompareIterators());
return ((present_index != a.present_index) ||
template <int dim>
inline
int
-TriaAccessor<dim>::level () const
+TriaAccessor<dim,dim>::level () const
{
return present_level;
}
template <int dim>
inline
int
-TriaAccessor<dim>::index () const
+TriaAccessor<dim,dim>::index () const
{
return present_index;
}
template <int dim>
inline
IteratorState::IteratorStates
-TriaAccessor<dim>::state () const
+TriaAccessor<dim,dim>::state () const
{
if ((present_level>=0) && (present_index>=0))
return IteratorState::valid;
template <int dim>
inline
const Triangulation<dim> &
-TriaAccessor<dim>::get_triangulation () const
+TriaAccessor<dim,dim>::get_triangulation () const
{
return *tria;
}
const int index,
const AccessorData *local_data)
:
- TriaAccessor<dim> (parent, level, index, local_data)
+ TriaAccessor<1,dim> (parent, level, index, local_data)
{
if (dim!=1)
Assert(level <= 0, ExcInternalError());
-template <int dim>
-inline
-int
-TriaObjectAccessor<1,dim>::level () const
-{
- Assert(dim==1, TriaAccessorExceptions::ExcFacesHaveNoLevel());
- return TriaAccessor<dim>::level();
-}
-
-
-
template <int dim>
inline
bool
TriaObjectAccessor<1,dim>::child (const unsigned int i) const
{
Assert (i<2, ExcIndexRange(i,0,2));
- int next_level;
- if (dim==1)
- next_level = this->present_level+1;
- else
- next_level = 0;
-
+
TriaIterator<dim,TriaObjectAccessor<1,dim> >
- q (this->tria, next_level, child_index (i));
+ q (this->tria,
+ (dim == 1 ? this->level() + 1 : 0),
+ child_index (i));
Assert ((q.state() == IteratorState::past_the_end) || q->used(),
TriaAccessorExceptions::ExcUnusedCellAsChild());
{
++this->present_index;
// is index still in the range of
- // the vector?
+ // the vector? (note that we don't
+ // have to set the level, since
+ // dim!=1 and the object therefore
+ // has no level)
if (this->present_index
>=
static_cast<int>(this->tria->faces->lines.cells.size()))
- this->present_level = this->present_index = -1;
+ this->present_index = -1;
}
{
--this->present_index;
// is index still in the range of
- // the vector?
- if (this->present_index <0 )
- this->present_level = this->present_index = -1;
+ // the vector? (note that we don't
+ // have to set the level, since
+ // dim!=1 and the object therefore
+ // has no level)
+ if (this->present_index < 0)
+ this->present_index = -1;
return;
}
const int index,
const AccessorData *local_data)
:
- TriaAccessor<dim> (parent, level, index, local_data)
+ TriaAccessor<2,dim> (parent, level, index, local_data)
{
if (dim!=2)
Assert(level <= 0, ExcInternalError());
-template <int dim>
-inline
-int
-TriaObjectAccessor<2,dim>::level () const
-{
- Assert(dim==2, TriaAccessorExceptions::ExcFacesHaveNoLevel());
- return TriaAccessor<dim>::level();
-}
-
-
-
template <int dim>
inline
bool
TriaObjectAccessor<2,dim>::child (const unsigned int i) const
{
Assert (i<4, ExcIndexRange(i,0,4));
- int next_level;
- if (dim==2)
- next_level = this->present_level+1;
- else
- next_level = 0;
TriaIterator<dim,TriaObjectAccessor<2,dim> >
- q (this->tria, next_level, child_index (i));
+ q (this->tria,
+ (dim == 2 ? this->level() + 1 : 0),
+ child_index (i));
Assert ((q.state() == IteratorState::past_the_end) || q->used(),
TriaAccessorExceptions::ExcUnusedCellAsChild());
{
++this->present_index;
// is index still in the range of
- // the vector?
+ // the vector? (note that we don't
+ // have to set the level, since
+ // dim!=1 and the object therefore
+ // has no level)
if (this->present_index
>=
static_cast<int>(quads().cells.size()))
- this->present_level = this->present_index = -1;
+ this->present_index = -1;
}
{
--this->present_index;
// is index still in the range of
- // the vector?
- if (this->present_index<0)
- this->present_level = this->present_index = -1;
+ // the vector? (note that we don't
+ // have to set the level, since
+ // dim!=1 and the object therefore
+ // has no level)
+ if (this->present_index < 0)
+ this->present_index = -1;
}
const int index,
const AccessorData *local_data)
:
- TriaAccessor<dim> (parent, level, index, local_data)
+ TriaAccessor<3,dim> (parent, level, index, local_data)
{
if (dim!=3)
Assert(level <= 0, ExcInternalError());
const int dim=3;
Assert (i<8, ExcIndexRange(i,0,8));
- TriaIterator<dim,TriaObjectAccessor<3,dim> > q (this->tria, this->present_level+1, child_index (i));
+ TriaIterator<dim,TriaObjectAccessor<3,dim> >
+ q (this->tria, this->present_level+1, child_index (i));
Assert ((q.state() == IteratorState::past_the_end) || q->used(),
TriaAccessorExceptions::ExcUnusedCellAsChild());
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 2003, 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
DEAL_II_NAMESPACE_OPEN
template <int dim> class CellAccessor;
-template <int dim> class TriaAccessor;
+template <int, int> class TriaAccessor;
+template <int dim> class TriaAccessor<dim,dim>;
template <int, int> class TriaObjectAccessor;
template <int dim> class TriaObjectAccessor<0, dim>;
template <int dim> class TriaObjectAccessor<1, dim>;
DEAL_II_NAMESPACE_OPEN
-template <int dim>
-const unsigned int TriaAccessor<dim>::objectdim;
+template <int structdim,int dim>
+const unsigned int TriaAccessor<structdim,dim>::objectdim;
/*------------------------ Functions: LineAccessor ---------------------------*/
// For more information, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24331
// explicit instantiations
-template class TriaAccessor<deal_II_dimension>;
+template class TriaAccessor<1,deal_II_dimension>;
+#if deal_II_dimension >= 2
+template class TriaAccessor<2,deal_II_dimension>;
+#endif
+#if deal_II_dimension >= 3
+template class TriaAccessor<3,deal_II_dimension>;
+#endif
+
template class CellAccessor<deal_II_dimension>;
template class TriaRawIterator<deal_II_dimension,TriaObjectAccessor<1, deal_II_dimension> >;
template class TriaRawIterator<deal_II_dimension,CellAccessor<deal_II_dimension> >;
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
TriaIterator<dim,MGDoFObjectAccessor<structdim, dim> >
MGDoFAccessor<structdim, dim>::child (const unsigned int i) const
{
- int next_level;
- if (structdim==dim)
- next_level=this->present_level+1;
- else
- next_level=0;
-
- TriaIterator<dim,MGDoFObjectAccessor<structdim, dim> > q (this->tria,
- next_level,
- this->child_index (i),
- this->mg_dof_handler);
+ const TriaIterator<dim,MGDoFObjectAccessor<structdim, dim> >
+ q (this->tria,
+ (structdim == dim ?
+ this->level() + 1 :
+ 0),
+ this->child_index (i),
+ this->mg_dof_handler);
// make sure that we either created
// a past-the-end iterator or one