// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
void copy_from (const DoFAccessor<structdim, DH> &a);
+ /**
+ * Copy operator used by the
+ * iterator class. Keeps the
+ * previously set dof handler,
+ * but sets the object
+ * coordinates of the TriaAccessor.
+ */
+ void copy_from (const TriaAccessorBase<structdim, DH::dimension, DH::space_dimension> &da);
+
/**
* @name Accessing sub-objects
*/
template <int structdim, class DH>
-DoFAccessor<structdim,DH>::
-DoFAccessor ()
+inline
+DoFAccessor<structdim,DH>::DoFAccessor ()
{
Assert (false, ExcInvalidObject());
}
template <int structdim, class DH>
inline
-DoFAccessor<structdim,DH>::
-DoFAccessor (const Triangulation<DH::dimension,DH::space_dimension> *tria,
- const int level,
- const int index,
- const DH *dof_handler)
+DoFAccessor<structdim,DH>::DoFAccessor (
+ const Triangulation<DH::dimension,DH::space_dimension> *tria,
+ const int level,
+ const int index,
+ const DH *dof_handler)
:
internal::DoFAccessor::Inheritance<structdim,DH::dimension,
DH::space_dimension>::BaseClass (tria,
template <int structdim, class DH>
template <int structdim2, int dim2, int spacedim2>
-DoFAccessor<structdim,DH>::
-DoFAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &)
+DoFAccessor<structdim,DH>::DoFAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &)
{
Assert (false, ExcInvalidObject());
}
template <int structdim, class DH>
template <int dim2, class DH2>
-DoFAccessor<structdim,DH>::
-DoFAccessor (const DoFAccessor<dim2, DH2> &)
+inline
+DoFAccessor<structdim,DH>::DoFAccessor (const DoFAccessor<dim2, DH2> &)
{
Assert (false, ExcInvalidObject());
}
}
+//TODO: This seems to set only the DH, not the other data.
+
template <int structdim, class DH>
inline
DoFAccessor<structdim,DH> &
+template <int structdim, class DH>
+inline
+void
+DoFAccessor<structdim,DH>::copy_from (
+ const TriaAccessorBase<structdim, DH::dimension, DH::space_dimension> &da)
+{
+ Assert (this->dof_handler != 0, ExcInvalidObject());
+ BaseClass::copy_from(da);
+}
+
+
+
template <int structdim, class DH>
inline
void
/**
* @ingroup Exceptions
*/
- DeclException1 (ExcInvalidNeighbor,
- int,
- << "Neighbor indices must be between 0 and 2^dim-1, but "
- << "yours was " << arg1);
- /**
- * @ingroup Exceptions
- */
DeclException0 (ExcCellHasNoChildren);
/**
* @ingroup Exceptions
* for syntactic correctness, none of the functions do anything but
* generate errors.
*
+ * @ingroup Accessors
* @author Wolfgang Bangerth, 2008
*/
template <int structdim, int dim, int spacedim=dim>
* <code>spacedim@>dim</code> the triangulation is of a manifold
* embedded in a higher dimensional space).
*
+ * @ingroup Accessors
* @author Wolfgang Bangerth and others, 1998, 2000, 2008
*/
template <int structdim, int dim, int spacedim>
// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
int
CellAccessor<dim,spacedim>::neighbor_index (const unsigned int i) const
{
- Assert (i<GeometryInfo<dim>::faces_per_cell,
- TriaAccessorExceptions::ExcInvalidNeighbor(i));
+ AssertIndexRange (i,GeometryInfo<dim>::faces_per_cell);
return this->tria->levels[this->present_level]->
neighbors[this->present_index*GeometryInfo<dim>::faces_per_cell+i].second;
}
int
CellAccessor<dim,spacedim>::neighbor_level (const unsigned int i) const
{
- Assert (i<GeometryInfo<dim>::faces_per_cell,
- TriaAccessorExceptions::ExcInvalidNeighbor(i));
+ AssertIndexRange (i, GeometryInfo<dim>::faces_per_cell);
return this->tria->levels[this->present_level]->
neighbors[this->present_index*GeometryInfo<dim>::faces_per_cell+i].first;
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
TriaRawIterator & operator = (const TriaRawIterator &);
+ /**
+ * Assignment operator.
+ */
+// template <class OtherAccessor>
+// TriaRawIterator & operator = (const TriaRawIterator<OtherAccessor>&);
+
+ /**
+ * Assignment operator.
+ */
+// template <class OtherAccessor>
+// TriaRawIterator & operator = (const TriaIterator<OtherAccessor>&);
+
+ /**
+ * Assignment operator.
+ */
+// template <class OtherAccessor>
+// TriaRawIterator & operator = (const TriaActiveIterator<OtherAccessor>&);
+
/**
* Compare for equality.
*/
* Assignment operator.
*/
TriaIterator<Accessor> &
- operator = (const TriaIterator<Accessor> &);
-
+ operator = (const TriaIterator<Accessor>&);
+
/**
* Cross assignment operator. This
* assignment is only valid if the
* element.
*/
TriaIterator<Accessor> &
- operator = (const TriaRawIterator<Accessor> &);
+ operator = (const TriaRawIterator<Accessor>&);
+
+ /**
+ * Assignment
+ * operator. Requires, that
+ * Accessor can be copied from
+ * OtherAccessor.
+ */
+ template <class OtherAccessor>
+ TriaIterator<Accessor> &
+ operator = (const TriaIterator<OtherAccessor>&);
+
+ /**
+ * Cross assignment operator. This
+ * assignment is only valid if the
+ * given iterator points to a used
+ * element. Requires, that
+ * Accessor can be copied from
+ * OtherAccessor.
+ */
+ template <class OtherAccessor>
+ TriaIterator<Accessor> &
+ operator = (const TriaRawIterator<OtherAccessor>&);
/**@name Advancement of iterators*/
/*@{*/
TriaActiveIterator<Accessor> &
operator = (const TriaActiveIterator<Accessor> &);
+ /**
+ * Cross assignment operator. This
+ * assignment is only valid if the
+ * given iterator points to an active
+ * element.
+ */
+ TriaActiveIterator<Accessor> &
+ operator = (const TriaIterator<Accessor> &);
+
/**
* Cross assignment operator. This
* assignment is only valid if the
TriaActiveIterator<Accessor> &
operator = (const TriaRawIterator<Accessor> &);
+ /**
+ * Assignment operator. Requires, that
+ * Accessor can be copied from
+ * OtherAccessor.
+ */
+ template <class OtherAccessor>
+ TriaActiveIterator<Accessor> &
+ operator = (const TriaActiveIterator<OtherAccessor> &);
+
+ /**
+ * Cross assignment operator. This
+ * assignment is only valid if the
+ * given iterator points to an active
+ * element or past the end. Requires, that
+ * Accessor can be copied from
+ * OtherAccessor.
+ */
+ template <class OtherAccessor>
+ TriaActiveIterator<Accessor> &
+ operator = (const TriaRawIterator<OtherAccessor> &);
+
/**
* Cross assignment operator. This
* assignment is only valid if the
* given iterator points to an active
- * element or past the end.
+ * element. Requires, that
+ * Accessor can be copied from
+ * OtherAccessor.
*/
- TriaActiveIterator<Accessor> &
- operator = (const TriaIterator<Accessor> &);
+ template <class OtherAccessor>
+ TriaActiveIterator<Accessor> &
+ operator = (const TriaIterator<OtherAccessor> &);
/**
* Prefix <tt>++</tt> operator: <tt>++i</tt>. This
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
}
+// template <typename Accessor>
+// template <typename OtherAccessor>
+// inline
+// TriaRawIterator<Accessor> &
+// TriaRawIterator<Accessor>::operator = (const TriaRawIterator<OtherAccessor> &i)
+// {
+// accessor.copy_from (i.accessor);
+// return *this;
+// }
+
+
+// template <typename Accessor>
+// template <typename OtherAccessor>
+// inline
+// TriaRawIterator<Accessor> &
+// TriaRawIterator<Accessor>::operator = (const TriaIterator<OtherAccessor> &i)
+// {
+// accessor.copy_from (i.accessor);
+// return *this;
+// }
+
+
+// template <typename Accessor>
+// template <typename OtherAccessor>
+// inline
+// TriaRawIterator<Accessor> &
+// TriaRawIterator<Accessor>::operator = (const TriaActiveIterator<OtherAccessor> &i)
+// {
+// accessor.copy_from (i.accessor);
+// return *this;
+// }
+
+
template <typename Accessor>
inline
bool
template <typename Accessor>
inline
TriaIterator<Accessor> &
-TriaIterator<Accessor>::operator = (const TriaIterator<Accessor> &i) {
+TriaIterator<Accessor>::operator = (const TriaIterator<Accessor> &i)
+{
+ this->accessor.copy_from (i.accessor);
+ return *this;
+}
+
+
+template <typename Accessor>
+template <typename OtherAccessor>
+inline
+TriaIterator<Accessor> &
+TriaIterator<Accessor>::operator = (const TriaIterator<OtherAccessor> &i)
+{
this->accessor.copy_from (i.accessor);
return *this;
}
template <typename Accessor>
inline
TriaIterator<Accessor> &
-TriaIterator<Accessor>::operator = (const TriaRawIterator<Accessor> &i) {
+TriaIterator<Accessor>::operator = (const TriaRawIterator<Accessor> &i)
+{
this->accessor.copy_from (i.accessor);
#ifdef DEBUG
// do this like this, because:
template <typename Accessor>
+template <typename OtherAccessor>
inline
-TriaIterator<Accessor> & TriaIterator<Accessor>::operator ++ () {
+TriaIterator<Accessor> &
+TriaIterator<Accessor>::operator = (const TriaRawIterator<OtherAccessor> &i)
+{
+ this->accessor.copy_from (i.accessor);
+#ifdef DEBUG
+ // do this like this, because:
+ // if we write
+ // "Assert (IteratorState::past_the_end || used)"
+ // used() is called anyway, even if
+ // state==IteratorState::past_the_end, and will then
+ // throw the exception!
+ if (this->state() != IteratorState::past_the_end)
+ Assert (this->accessor.used(),
+ ExcAssignmentOfUnusedObject());
+#endif
+ return *this;
+}
+
+
+template <typename Accessor>
+inline
+TriaIterator<Accessor> & TriaIterator<Accessor>::operator ++ ()
+{
while (TriaRawIterator<Accessor>::operator++(),
(this->state() == IteratorState::valid))
if (this->accessor.used() == true)
template <typename Accessor>
inline
-TriaIterator<Accessor> TriaIterator<Accessor>::operator ++ (int) {
+TriaIterator<Accessor> TriaIterator<Accessor>::operator ++ (int)
+{
TriaIterator<Accessor> tmp(*this);
operator++ ();
template <typename Accessor>
inline
TriaIterator<Accessor> &
-TriaIterator<Accessor>::operator -- () {
+TriaIterator<Accessor>::operator -- ()
+{
while (TriaRawIterator<Accessor>::operator--(),
(this->state() == IteratorState::valid))
if (this->accessor.used() == true)
template <typename Accessor>
inline
TriaIterator<Accessor>
-TriaIterator<Accessor>::operator -- (int) {
+TriaIterator<Accessor>::operator -- (int)
+{
TriaIterator<Accessor> tmp(*this);
operator-- ();
template <typename Accessor>
inline
TriaActiveIterator<Accessor> &
-TriaActiveIterator<Accessor>::operator = (const TriaActiveIterator<Accessor> &i) {
+TriaActiveIterator<Accessor>::operator = (const TriaActiveIterator<Accessor> &i)
+{
this->accessor.copy_from (i.accessor);
return *this;
}
template <typename Accessor>
+template <class OtherAccessor>
inline
TriaActiveIterator<Accessor> &
-TriaActiveIterator<Accessor>::operator = (const TriaRawIterator<Accessor> &i) {
+TriaActiveIterator<Accessor>::operator = (const TriaActiveIterator<OtherAccessor> &i)
+{
+ this->accessor.copy_from (i.accessor);
+ return *this;
+}
+
+
+template <typename Accessor>
+inline
+TriaActiveIterator<Accessor> &
+TriaActiveIterator<Accessor>::operator = (const TriaRawIterator<Accessor> &i)
+{
+ this->accessor.copy_from (i.accessor);
+#ifdef DEBUG
+ // do this like this, because:
+ // if we write
+ // "Assert (IteratorState::past_the_end || !has_children())"
+ // has_chidlren() is called anyway, even if
+ // state==IteratorState::past_the_end, and will then
+ // throw the exception!
+ if (this->state() != IteratorState::past_the_end)
+ Assert (this->accessor.used() && this->accessor.has_children()==false,
+ ExcAssignmentOfInactiveObject());
+#endif
+ return *this;
+}
+
+
+template <typename Accessor>
+template <class OtherAccessor>
+inline
+TriaActiveIterator<Accessor> &
+TriaActiveIterator<Accessor>::operator = (const TriaRawIterator<OtherAccessor> &i)
+{
this->accessor.copy_from (i.accessor);
#ifdef DEBUG
// do this like this, because:
template <typename Accessor>
+template <class OtherAccessor>
inline
TriaActiveIterator<Accessor> &
-TriaActiveIterator<Accessor>::operator = (const TriaIterator<Accessor> &i) {
+TriaActiveIterator<Accessor>::operator = (const TriaIterator<OtherAccessor> &i)
+{
+ this->accessor.copy_from (i.accessor);
+#ifdef DEBUG
+ // do this like this, because:
+ // if we write
+ // "Assert (IteratorState::past_the_end || !has_children())"
+ // has_children() is called anyway, even if
+ // state==IteratorState::past_the_end, and will then
+ // throw the exception!
+ if (this->state() != IteratorState::past_the_end)
+ Assert (this->accessor.has_children()==false,
+ ExcAssignmentOfInactiveObject());
+#endif
+ return *this;
+}
+
+
+template <typename Accessor>
+inline
+TriaActiveIterator<Accessor> &
+TriaActiveIterator<Accessor>::operator = (const TriaIterator<Accessor> &i)
+{
this->accessor.copy_from (i.accessor);
#ifdef DEBUG
// do this like this, because:
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
void CellAccessor<dim, spacedim>::set_neighbor (const unsigned int i,
const TriaIterator<CellAccessor<dim, spacedim> > &pointer) const
{
- Assert (i<GeometryInfo<dim>::faces_per_cell,
- TriaAccessorExceptions::ExcInvalidNeighbor(i));
+ AssertIndexRange (i, GeometryInfo<dim>::faces_per_cell);
if (pointer.state() == IteratorState::valid)
{
template <int dim, int spacedim>
unsigned int CellAccessor<dim,spacedim>::neighbor_of_neighbor_internal (const unsigned int neighbor) const
{
- Assert (neighbor < GeometryInfo<dim>::faces_per_cell,
- TriaAccessorExceptions::ExcInvalidNeighbor(neighbor));
+ AssertIndexRange (neighbor, GeometryInfo<dim>::faces_per_cell);
if (dim==1)
return GeometryInfo<dim>::opposite_face[neighbor];
std::pair<unsigned int, unsigned int>
CellAccessor<dim, spacedim>::neighbor_of_coarser_neighbor (const unsigned int neighbor) const
{
- Assert (neighbor < GeometryInfo<dim>::faces_per_cell,
- TriaAccessorExceptions::ExcInvalidNeighbor(neighbor));
+ AssertIndexRange (neighbor, GeometryInfo<dim>::faces_per_cell);
// make sure that the neighbor is
// on a coarser level
Assert (neighbor_is_coarser(neighbor),
<h3>deal.II</h3>
<ol>
+
+ <li>
+ <p> Improved: DoFHandler iterators now can be assigned from a Triangulation iterator
+ after the dof handler was set once.
+ <br>
+ (GK 2010/03/25)
+ </p></li>
+
<li>
<p>
New: The function DoFRenumbering::downstream has now an additional bool