* = accessor;
* @endcode
*/
- TriaRawIterator (const Accessor &a);
+ explicit TriaRawIterator (const Accessor &a);
/**
* Constructor. Assumes that the
* one.
*/
template <typename OtherAccessor>
- TriaRawIterator (const OtherAccessor &a);
+ explicit TriaRawIterator (const OtherAccessor &a);
/**
* Proper constructor, initialized
const int index,
const typename Accessor::AccessorData *local_data = 0);
+ /**
+ * Construct from an accessor of type OtherAccessor that is convertible
+ * to the type Accessor.
+ */
+ template <typename OtherAccessor>
+ explicit TriaIterator (const OtherAccessor &a);
+
/**
* This is a conversion operator
* (constructor) which takes another
#endif
}
-
+template <typename Accessor>
+template <typename OtherAccessor>
+TriaIterator<Accessor>::TriaIterator (const OtherAccessor &a)
+:
+TriaRawIterator<Accessor> (a)
+{
+#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
+}
template <typename Accessor>
template <typename OtherAccessor>
{
if (dof_wise_renumbering == false)
{
- std::vector<typename DH::active_cell_iterator>
- ordered_cells(dof.get_tria().n_active_cells());
+ std::vector<typename DH::active_cell_iterator> ordered_cells;
+ ordered_cells.reserve(dof.get_tria().n_active_cells());
const CompareDownstream<typename DH::active_cell_iterator, DH::space_dimension> comparator(direction);
- typename DH::active_cell_iterator begin = dof.begin_active();
+ typename DH::active_cell_iterator p = dof.begin_active();
typename DH::active_cell_iterator end = dof.end();
- std::copy (begin, end, ordered_cells.begin());
+ while (p!=end)
+ {
+ ordered_cells.push_back(p);
+ ++p;
+ }
std::sort (ordered_cells.begin(), ordered_cells.end(), comparator);
compute_cell_wise(new_indices, reverse, dof, ordered_cells);
{
if (dof_wise_renumbering == false)
{
- std::vector<typename DH::level_cell_iterator>
- ordered_cells(dof.get_tria().n_cells(level));
+ std::vector<typename DH::level_cell_iterator> ordered_cells;
+ ordered_cells.reserve (dof.get_tria().n_cells(level));
const CompareDownstream<typename DH::level_cell_iterator, DH::space_dimension> comparator(direction);
- typename DH::level_cell_iterator begin = dof.begin(level);
+ typename DH::level_cell_iterator p = dof.begin(level);
typename DH::level_cell_iterator end = dof.end(level);
- std::copy (begin, end, ordered_cells.begin());
+ while (p!=end)
+ {
+ ordered_cells.push_back(p);
+ ++p;
+ }
std::sort (ordered_cells.begin(), ordered_cells.end(), comparator);
compute_cell_wise(new_indices, reverse, dof, level, ordered_cells);
const Point<DH::space_dimension> ¢er,
const bool counter)
{
- std::vector<typename DH::active_cell_iterator>
- ordered_cells(dof.get_tria().n_active_cells());
+ std::vector<typename DH::active_cell_iterator> ordered_cells;
+ ordered_cells.reserve (dof.get_tria().n_active_cells());
internal::ClockCells<DH::space_dimension> comparator(center, counter);
- typename DH::active_cell_iterator begin = dof.begin_active();
+ typename DH::active_cell_iterator p = dof.begin_active();
typename DH::active_cell_iterator end = dof.end();
- std::copy (begin, end, ordered_cells.begin());
+ while (p!=end)
+ {
+ ordered_cells.push_back(p);
+ ++p;
+ }
std::sort (ordered_cells.begin(), ordered_cells.end(), comparator);
std::vector<types::global_dof_index> reverse(new_indices.size());
const Point<DH::space_dimension> ¢er,
const bool counter)
{
- std::vector<typename DH::level_cell_iterator>
- ordered_cells(dof.get_tria().n_cells(level));
+ std::vector<typename DH::level_cell_iterator> ordered_cells;
+ ordered_cells.reserve(dof.get_tria().n_active_cells());
internal::ClockCells<DH::space_dimension> comparator(center, counter);
- typename DH::level_cell_iterator begin = dof.begin(level);
+ typename DH::level_cell_iterator p = dof.begin(level);
typename DH::level_cell_iterator end = dof.end(level);
- std::copy (begin, end, ordered_cells.begin());
+ while (p!=end)
+ {
+ ordered_cells.push_back(p);
+ ++p;
+ }
std::sort (ordered_cells.begin(), ordered_cells.end(), comparator);
cell_wise(dof, level, ordered_cells);