/**
* Flag all mesh cells for which the value in @p criteria exceeds @p
- * threshold for refinement.
+ * threshold for refinement, but only flag up to @p max_to_mark cells.
*
* The vector @p criteria contains a nonnegative value for each active
* cell, ordered in the canonical order of of
template <int dim, class Vector, int spacedim>
void refine (Triangulation<dim,spacedim> &tria,
const Vector &criteria,
- const double threshold);
+ const double threshold,
+ const unsigned int max_to_mark = numbers::invalid_unsigned_int);
/**
* Flag all mesh cells for which the value in @p criteria
template <int dim, class Vector, int spacedim>
void GridRefinement::refine (Triangulation<dim,spacedim> &tria,
const Vector &criteria,
- const double threshold)
+ const double threshold,
+ const unsigned int max_to_mark)
{
Assert (criteria.size() == tria.n_active_cells(),
ExcDimensionMismatch(criteria.size(), tria.n_active_cells()));
new_threshold=criteria(index);
}
+ unsigned int marked=0;
for (unsigned int index=0; index<n_cells; ++cell, ++index)
if (std::fabs(criteria(index)) >= new_threshold)
+ {
+ if (max_to_mark!=numbers::invalid_unsigned_int && marked>=max_to_mark)
+ break;
+ marked++;
cell->set_refine_flag();
+ }
}
// actually flag cells
if (top_threshold < max_element(criteria))
- refine (tria, criteria, top_threshold);
+ refine (tria, criteria, top_threshold, pp - tmp.begin());
if (bottom_threshold > min_element(criteria))
coarsen (tria, criteria, bottom_threshold);
refine<deal_II_dimension,dealii::Vector<S>,deal_II_dimension>
(Triangulation<deal_II_dimension> &,
const dealii::Vector<S> &,
- const double);
+ const double,
+ const unsigned int);
template
void
refine<deal_II_dimension,dealii::Vector<S>,deal_II_dimension+1>
(Triangulation<deal_II_dimension,deal_II_dimension+1> &,
const dealii::Vector<S> &,
- const double);
+ const double,
+ const unsigned int);
template
void