AssertDimension(exact.n_components, n_components);
AssertDimension(dh.get_fe().n_components(), n_components);
- const unsigned int n_active_cells =
+ const types::global_cell_index n_active_cells =
dh.get_triangulation().n_global_active_cells();
const unsigned int n_dofs = dh.n_dofs();
number
compute_threshold(const dealii::Vector<number> & criteria,
const std::pair<double, double> &global_min_and_max,
- const types::global_dof_index n_target_cells,
+ const types::global_cell_index n_target_cells,
MPI_Comm mpi_communicator);
} // namespace RefineAndCoarsenFixedNumber
refine_and_coarsen_fixed_number(
parallel::distributed::Triangulation<dim, spacedim> &tria,
const dealii::Vector<Number> & criteria,
- const double top_fraction_of_cells,
- const double bottom_fraction_of_cells,
- const types::global_dof_index max_n_cells =
- std::numeric_limits<types::global_dof_index>::max());
+ const double top_fraction_of_cells,
+ const double bottom_fraction_of_cells,
+ const types::global_cell_index max_n_cells =
+ std::numeric_limits<types::global_cell_index>::max());
/**
* Like dealii::GridRefinement::refine_and_coarsen_fixed_fraction, but
* by each processor. This equals the overall number of active cells in
* the triangulation.
*/
- virtual types::global_dof_index
+ virtual types::global_cell_index
n_global_active_cells() const override;
/**
* The total number of active cells (sum of @p
* n_locally_owned_active_cells).
*/
- types::global_dof_index n_global_active_cells;
+ types::global_cell_index n_global_active_cells;
/**
* The global number of levels computed as the maximum number of levels
* taken over all MPI ranks, so <tt>n_levels()<=n_global_levels =
template <int dim>
std::pair<double, double>
adjust_refine_and_coarsen_number_fraction(
- const types::global_dof_index current_n_cells,
- const types::global_dof_index max_n_cells,
- const double top_fraction_of_cells,
- const double bottom_fraction_of_cells);
+ const types::global_cell_index current_n_cells,
+ const types::global_cell_index max_n_cells,
+ const double top_fraction_of_cells,
+ const double bottom_fraction_of_cells);
/**
* This function provides a strategy to mark cells for refinement and
* may return a value greater than the number of active cells reported by
* the triangulation object on the current processor.
*/
- virtual types::global_dof_index
+ virtual types::global_cell_index
n_global_active_cells() const;
number
compute_threshold(const dealii::Vector<number> & criteria,
const std::pair<double, double> &global_min_and_max,
- const types::global_dof_index n_target_cells,
+ const types::global_cell_index n_target_cells,
MPI_Comm mpi_communicator)
{
double interesting_range[2] = {global_min_and_max.first,
// Count how many of our own elements would be above this
// threshold:
- types::global_dof_index my_count =
+ types::global_cell_index my_count =
std::count_if(criteria.begin(),
criteria.end(),
[test_threshold](const double c) {
});
// Potentially accumulate in a 64bit int to avoid overflow:
- types::global_dof_index total_count = 0;
-
- ierr = MPI_Reduce(&my_count,
- &total_count,
- 1,
- DEAL_II_DOF_INDEX_MPI_TYPE,
- MPI_SUM,
- master_mpi_rank,
- mpi_communicator);
- AssertThrowMPI(ierr);
+ types::global_cell_index total_count =
+ Utilities::MPI::sum(my_count, mpi_communicator);
// now adjust the range. if we have too many cells, we take the
// upper half of the previous range, otherwise the lower half.
refine_and_coarsen_fixed_number(
parallel::distributed::Triangulation<dim, spacedim> &tria,
const dealii::Vector<Number> & criteria,
- const double top_fraction_of_cells,
- const double bottom_fraction_of_cells,
- const types::global_dof_index max_n_cells)
+ const double top_fraction_of_cells,
+ const double bottom_fraction_of_cells,
+ const types::global_cell_index max_n_cells)
{
Assert(criteria.size() == tria.n_active_cells(),
ExcDimensionMismatch(criteria.size(), tria.n_active_cells()));
GridRefinement::RefineAndCoarsenFixedNumber::compute_threshold(
locally_owned_indicators,
global_min_and_max,
- static_cast<types::global_dof_index>(adjusted_fractions.first *
- tria.n_global_active_cells()),
+ static_cast<types::global_cell_index>(adjusted_fractions.first *
+ tria.n_global_active_cells()),
mpi_communicator);
// compute bottom threshold only if necessary. otherwise use a threshold
GridRefinement::RefineAndCoarsenFixedNumber::compute_threshold(
locally_owned_indicators,
global_min_and_max,
- static_cast<types::global_dof_index>(
- std::ceil((1 - adjusted_fractions.second) *
+ static_cast<types::global_cell_index>(
+ std::ceil((1. - adjusted_fractions.second) *
tria.n_global_active_cells())),
mpi_communicator);
else
template S
compute_threshold<S>(const dealii::Vector<S> &,
const std::pair<double, double> &,
- const types::global_dof_index,
+ const types::global_cell_index,
MPI_Comm);
\}
namespace RefineAndCoarsenFixedFraction
const dealii::Vector<S> &,
const double,
const double,
- const types::global_dof_index);
+ const types::global_cell_index);
template void
refine_and_coarsen_fixed_fraction<deal_II_dimension,
const dealii::Vector<S> &,
const double,
const double,
- const types::global_dof_index);
+ const types::global_cell_index);
template void refine_and_coarsen_fixed_fraction<deal_II_dimension - 1,
S,
}
template <int dim, int spacedim>
- types::global_dof_index
+ types::global_cell_index
TriangulationBase<dim, spacedim>::n_global_active_cells() const
{
return number_cache.n_global_active_cells;
// Potentially cast to a 64 bit type before accumulating to avoid overflow:
number_cache.n_global_active_cells =
- Utilities::MPI::sum(static_cast<types::global_dof_index>(
+ Utilities::MPI::sum(static_cast<types::global_cell_index>(
number_cache.n_locally_owned_active_cells),
this->mpi_communicator);
template <int dim>
std::pair<double, double>
GridRefinement::adjust_refine_and_coarsen_number_fraction(
- const types::global_dof_index current_n_cells,
- const types::global_dof_index max_n_cells,
- const double top_fraction,
- const double bottom_fraction)
+ const types::global_cell_index current_n_cells,
+ const types::global_cell_index max_n_cells,
+ const double top_fraction,
+ const double bottom_fraction)
{
Assert(top_fraction >= 0, ExcInvalidParameterValue());
Assert(top_fraction <= 1, ExcInvalidParameterValue());
// again, this is true for isotropically
// refined cells. we take this as an
// approximation of a mixed refinement.
- else if (static_cast<types::global_dof_index>(
+ else if (static_cast<types::global_cell_index>(
current_n_cells + refine_cells * cell_increase_on_refine -
coarsen_cells * cell_decrease_on_coarsen) > max_n_cells)
{
{
template std::pair<double, double>
GridRefinement::adjust_refine_and_coarsen_number_fraction<
- deal_II_dimension>(const types::global_dof_index,
- const types::global_dof_index,
+ deal_II_dimension>(const types::global_cell_index,
+ const types::global_cell_index,
const double,
const double);
}
}
template <int dim, int spacedim>
-types::global_dof_index
+types::global_cell_index
Triangulation<dim, spacedim>::n_global_active_cells() const
{
return n_active_cells();