Skip to content

Commit

Permalink
Merge pull request dealii#14037 from masterleinad/deprecate_matrixfree
Browse files Browse the repository at this point in the history
Remove deprecated MatrixFree functionalities
  • Loading branch information
kronbichler committed Jun 25, 2022
2 parents e4ca3b9 + b5314d7 commit 9d3761d
Show file tree
Hide file tree
Showing 114 changed files with 192 additions and 344 deletions.
6 changes: 6 additions & 0 deletions doc/news/changes/incompatibilities/20220622Arndt-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Removed: The deprecated functions MatrixFree::n_macro_cells(),
MatrixFree::get_hp_cell_iterator(), MatrixFree::n_components_filled(),
MatrixFree::get_dof_handler(), and
MatrixFree::reinit() with default Mapping argument have been removed.
<br>
(Daniel Arndt, 2022/06/22)
171 changes: 0 additions & 171 deletions include/deal.II/matrix_free/matrix_free.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,19 +585,6 @@ class MatrixFree : public Subscriptor
const QuadratureType & quad,
const AdditionalData & additional_data = AdditionalData());

/**
* Initializes the data structures. Same as above, but using a $Q_1$
* mapping.
*
* @deprecated Use the overload taking a Mapping object instead.
*/
template <typename QuadratureType, typename number2>
DEAL_II_DEPRECATED void
reinit(const DoFHandler<dim> & dof_handler,
const AffineConstraints<number2> &constraint,
const QuadratureType & quad,
const AdditionalData & additional_data = AdditionalData());

/**
* Extracts the information needed to perform loops over cells. The
* DoFHandler and AffineConstraints objects describe the layout of degrees of
Expand Down Expand Up @@ -627,19 +614,6 @@ class MatrixFree : public Subscriptor
const std::vector<QuadratureType> & quad,
const AdditionalData &additional_data = AdditionalData());

/**
* Initializes the data structures. Same as above, but using a $Q_1$
* mapping.
*
* @deprecated Use the overload taking a Mapping object instead.
*/
template <typename QuadratureType, typename number2>
DEAL_II_DEPRECATED void
reinit(const std::vector<const DoFHandler<dim> *> & dof_handler,
const std::vector<const AffineConstraints<number2> *> &constraint,
const std::vector<QuadratureType> & quad,
const AdditionalData &additional_data = AdditionalData());

/**
* Initializes the data structures. Same as before, but now the index set
* description of the locally owned range of degrees of freedom is taken
Expand All @@ -655,19 +629,6 @@ class MatrixFree : public Subscriptor
const QuadratureType & quad,
const AdditionalData &additional_data = AdditionalData());

/**
* Initializes the data structures. Same as above, but using a $Q_1$
* mapping.
*
* @deprecated Use the overload taking a Mapping object instead.
*/
template <typename QuadratureType, typename number2>
DEAL_II_DEPRECATED void
reinit(const std::vector<const DoFHandler<dim> *> & dof_handler,
const std::vector<const AffineConstraints<number2> *> &constraint,
const QuadratureType & quad,
const AdditionalData &additional_data = AdditionalData());

/**
* Copy function. Creates a deep copy of all data structures. It is usually
* enough to keep the data for different operations once, so this function
Expand Down Expand Up @@ -1592,12 +1553,6 @@ class MatrixFree : public Subscriptor
unsigned int
n_physical_cells() const;

/**
* @deprecated Use n_cell_batches() instead.
*/
DEAL_II_DEPRECATED unsigned int
n_macro_cells() const;

/**
* Return the number of cell batches that this structure works on. The
* batches are formed by application of vectorization over several cells in
Expand Down Expand Up @@ -1719,16 +1674,6 @@ class MatrixFree : public Subscriptor
const bool interior = true,
const unsigned int fe_component = 0) const;

/**
* @copydoc MatrixFree::get_cell_iterator()
*
* @deprecated Use get_cell_iterator() instead.
*/
DEAL_II_DEPRECATED typename DoFHandler<dim>::active_cell_iterator
get_hp_cell_iterator(const unsigned int cell_batch_index,
const unsigned int lane_index,
const unsigned int dof_handler_index = 0) const;

/**
* Since this class uses vectorized data types with usually more than one
* value in the data field, a situation might occur when some components of
Expand All @@ -1744,12 +1689,6 @@ class MatrixFree : public Subscriptor
bool
at_irregular_cell(const unsigned int cell_batch_index) const;

/**
* @deprecated Use n_active_entries_per_cell_batch() instead.
*/
DEAL_II_DEPRECATED unsigned int
n_components_filled(const unsigned int cell_batch_number) const;

/**
* This query returns how many cells among the `VectorizedArrayType::size()`
* many cells within a cell batch to actual cells in the mesh, rather than
Expand Down Expand Up @@ -2277,15 +2216,6 @@ MatrixFree<dim, Number, VectorizedArrayType>::get_task_info() const



template <int dim, typename Number, typename VectorizedArrayType>
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::n_macro_cells() const
{
return *(task_info.cell_partition_data.end() - 2);
}



template <int dim, typename Number, typename VectorizedArrayType>
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::n_physical_cells() const
Expand Down Expand Up @@ -2556,16 +2486,6 @@ MatrixFree<dim, Number, VectorizedArrayType>::get_face_active_fe_index(



template <int dim, typename Number, typename VectorizedArrayType>
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::n_components_filled(
const unsigned int cell_batch_index) const
{
return n_active_entries_per_cell_batch(cell_batch_index);
}



template <int dim, typename Number, typename VectorizedArrayType>
inline unsigned int
MatrixFree<dim, Number, VectorizedArrayType>::n_active_entries_per_cell_batch(
Expand Down Expand Up @@ -2960,42 +2880,6 @@ namespace internal



template <int dim, typename Number, typename VectorizedArrayType>
template <typename QuadratureType, typename number2>
void
MatrixFree<dim, Number, VectorizedArrayType>::reinit(
const DoFHandler<dim> & dof_handler,
const AffineConstraints<number2> &constraints_in,
const QuadratureType & quad,
const typename MatrixFree<dim, Number, VectorizedArrayType>::AdditionalData
&additional_data)
{
std::vector<const DoFHandler<dim, dim> *> dof_handlers;
std::vector<const AffineConstraints<number2> *> constraints;
std::vector<QuadratureType> quads;

dof_handlers.push_back(&dof_handler);
constraints.push_back(&constraints_in);
quads.push_back(quad);

std::vector<IndexSet> locally_owned_sets =
internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
dof_handlers, additional_data.mg_level);

std::vector<hp::QCollection<dim>> quad_hp;
quad_hp.emplace_back(quad);

internal_reinit(std::make_shared<hp::MappingCollection<dim>>(
StaticMappingQ1<dim>::mapping),
dof_handlers,
constraints,
locally_owned_sets,
quad_hp,
additional_data);
}



template <int dim, typename Number, typename VectorizedArrayType>
template <typename QuadratureType, typename number2, typename MappingType>
void
Expand Down Expand Up @@ -3030,61 +2914,6 @@ MatrixFree<dim, Number, VectorizedArrayType>::reinit(



template <int dim, typename Number, typename VectorizedArrayType>
template <typename QuadratureType, typename number2>
void
MatrixFree<dim, Number, VectorizedArrayType>::reinit(
const std::vector<const DoFHandler<dim> *> & dof_handler,
const std::vector<const AffineConstraints<number2> *> &constraint,
const std::vector<QuadratureType> & quad,
const typename MatrixFree<dim, Number, VectorizedArrayType>::AdditionalData
&additional_data)
{
std::vector<IndexSet> locally_owned_set =
internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
dof_handler, additional_data.mg_level);
std::vector<hp::QCollection<dim>> quad_hp;
for (unsigned int q = 0; q < quad.size(); ++q)
quad_hp.emplace_back(quad[q]);

internal_reinit(std::make_shared<hp::MappingCollection<dim>>(
StaticMappingQ1<dim>::mapping),
dof_handler,
constraint,
locally_owned_set,
quad_hp,
additional_data);
}



template <int dim, typename Number, typename VectorizedArrayType>
template <typename QuadratureType, typename number2>
void
MatrixFree<dim, Number, VectorizedArrayType>::reinit(
const std::vector<const DoFHandler<dim> *> & dof_handler,
const std::vector<const AffineConstraints<number2> *> &constraint,
const QuadratureType & quad,
const typename MatrixFree<dim, Number, VectorizedArrayType>::AdditionalData
&additional_data)
{
std::vector<IndexSet> locally_owned_set =
internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
dof_handler, additional_data.mg_level);
std::vector<hp::QCollection<dim>> quad_hp;
quad_hp.emplace_back(quad);

internal_reinit(std::make_shared<hp::MappingCollection<dim>>(
StaticMappingQ1<dim>::mapping),
dof_handler,
constraint,
locally_owned_set,
quad_hp,
additional_data);
}



template <int dim, typename Number, typename VectorizedArrayType>
template <typename QuadratureType, typename number2, typename MappingType>
void
Expand Down
24 changes: 0 additions & 24 deletions include/deal.II/matrix_free/matrix_free.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,6 @@ MatrixFree<dim, Number, VectorizedArrayType>::get_face_iterator(



template <int dim, typename Number, typename VectorizedArrayType>
typename DoFHandler<dim>::active_cell_iterator
MatrixFree<dim, Number, VectorizedArrayType>::get_hp_cell_iterator(
const unsigned int cell_batch_index,
const unsigned int lane_index,
const unsigned int dof_handler_index) const
{
AssertIndexRange(dof_handler_index, dof_handlers.size());
AssertIndexRange(cell_batch_index, task_info.cell_partition_data.back());
AssertIndexRange(lane_index,
n_active_entries_per_cell_batch(cell_batch_index));

std::pair<unsigned int, unsigned int> index =
cell_level_index[cell_batch_index * VectorizedArrayType::size() +
lane_index];
return typename DoFHandler<dim>::cell_iterator(
&dof_handlers[dof_handler_index]->get_triangulation(),
index.first,
index.second,
&*dof_handlers[dof_handler_index]);
}



template <int dim, typename Number, typename VectorizedArrayType>
void
MatrixFree<dim, Number, VectorizedArrayType>::copy_from(
Expand Down
2 changes: 1 addition & 1 deletion tests/arpack/step-36_parpack_mf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ test()
MatrixFree<dim, double>::AdditionalData::partition_color;
data.mapping_update_flags =
update_values | update_gradients | update_JxW_values;
mf_data->reinit(dof_handler, constraints, quad, data);
mf_data->reinit(MappingQ1<dim>{}, dof_handler, constraints, quad, data);
}


Expand Down
2 changes: 1 addition & 1 deletion tests/arpack/step-36_parpack_mf_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ test()
MatrixFree<dim, double>::AdditionalData::partition_color;
data.mapping_update_flags =
update_values | update_gradients | update_JxW_values;
mf_data->reinit(dof_handler, constraints, quad, data);
mf_data->reinit(MappingQ1<dim>{}, dof_handler, constraints, quad, data);
}

std::vector<LinearAlgebra::distributed::Vector<double>> eigenfunctions;
Expand Down
2 changes: 1 addition & 1 deletion tests/arpack/step-36_parpack_mf_03.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ test()
MatrixFree<dim, double>::AdditionalData::partition_color;
data.mapping_update_flags =
update_values | update_gradients | update_JxW_values;
mf_data->reinit(dof_handler, constraints, quad, data);
mf_data->reinit(MappingQ1<dim>{}, dof_handler, constraints, quad, data);
}

std::vector<LinearAlgebra::distributed::Vector<double>> eigenfunctions;
Expand Down
2 changes: 1 addition & 1 deletion tests/lac/utilities_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ test()
MatrixFree<dim, double>::AdditionalData::partition_color;
data.mapping_update_flags =
update_values | update_gradients | update_JxW_values;
mf_data->reinit(dof_handler, constraints, quad, data);
mf_data->reinit(MappingQ1<dim>{}, dof_handler, constraints, quad, data);
}

MatrixFreeOperators::MassOperator<dim,
Expand Down
3 changes: 2 additions & 1 deletion tests/mappings/mapping_q_eulerian_08.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ test(const unsigned int n_ref = 0)
euler_fine, dof_handler, constraints, quadrature_formula, data);

MatrixFree<dim, NumberType> matrix_free;
matrix_free.reinit(dof_handler, constraints, quadrature_formula, data);
matrix_free.reinit(
MappingQ1<dim>{}, dof_handler, constraints, quadrature_formula, data);


// test fine-level mapping:
Expand Down
3 changes: 2 additions & 1 deletion tests/mappings/mapping_q_eulerian_14.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ test(const unsigned int n_ref = 0)
euler_fine, dof_handler, constraints, quadrature_formula, data);

MatrixFree<dim, NumberType> matrix_free;
matrix_free.reinit(dof_handler, constraints, quadrature_formula, data);
matrix_free.reinit(
MappingQ1<dim>{}, dof_handler, constraints, quadrature_formula, data);


// test fine-level mapping:
Expand Down
2 changes: 1 addition & 1 deletion tests/matrix_free/advect_1d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ test(const unsigned int n_refine)
(update_gradients | update_JxW_values);

MatrixFree<dim, double> mf_data;
mf_data.reinit(dof, constraints, quad, data);
mf_data.reinit(MappingQ1<dim>{}, dof, constraints, quad, data);

mf_data.initialize_dof_vector(in);
mf_data.initialize_dof_vector(out);
Expand Down
2 changes: 1 addition & 1 deletion tests/matrix_free/advect_1d_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ test(const unsigned int n_refine)
(update_gradients | update_JxW_values);

MatrixFree<dim, double> mf_data;
mf_data.reinit(dof, constraints, quad, data);
mf_data.reinit(MappingQ1<dim>{}, dof, constraints, quad, data);

mf_data.initialize_dof_vector(in);
mf_data.initialize_dof_vector(out);
Expand Down
2 changes: 1 addition & 1 deletion tests/matrix_free/advect_1d_vectorization_mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ test(const unsigned int n_refine)
(update_gradients | update_JxW_values);

MatrixFree<dim, double> mf_data;
mf_data.reinit(dof, constraints, quad, data);
mf_data.reinit(MappingQ1<dim>{}, dof, constraints, quad, data);

mf_data.initialize_dof_vector(in);
mf_data.initialize_dof_vector(out);
Expand Down
3 changes: 2 additions & 1 deletion tests/matrix_free/categorize_by_boundary_ids_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ test(const unsigned int n_refinements)
bool result = true;

MatrixFree<dim, double> data;
data.reinit(dof_handler, dummy, quadrature, additional_data);
data.reinit(
MappingQ1<dim>{}, dof_handler, dummy, quadrature, additional_data);

using VectorType = Vector<double>;

Expand Down
6 changes: 3 additions & 3 deletions tests/matrix_free/cell_categorization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test()
static_cast<unsigned int>(cell->center()[1] * 10.);

data.cell_vectorization_categories_strict = false;
mf_data.reinit(dof, constraints, QGauss<1>(2), data);
mf_data.reinit(MappingQ1<dim>{}, dof, constraints, QGauss<1>(2), data);

deallog << "Number of cell batches: " << mf_data.n_cell_batches()
<< std::endl;
Expand All @@ -99,7 +99,7 @@ test()
deallog << std::endl;

data.cell_vectorization_categories_strict = true;
mf_data.reinit(dof, constraints, QGauss<1>(2), data);
mf_data.reinit(MappingQ1<dim>{}, dof, constraints, QGauss<1>(2), data);
deallog << "Number of cell batches: " << mf_data.n_cell_batches()
<< std::endl;
for (unsigned int i = 0; i < mf_data.n_cell_batches(); ++i)
Expand All @@ -116,7 +116,7 @@ test()
100000000);

data.cell_vectorization_categories_strict = false;
mf_data.reinit(dof, constraints, QGauss<1>(2), data);
mf_data.reinit(MappingQ1<dim>{}, dof, constraints, QGauss<1>(2), data);
deallog << "Number of cell batches: " << mf_data.n_cell_batches()
<< std::endl;
for (unsigned int i = 0; i < mf_data.n_cell_batches(); ++i)
Expand Down

0 comments on commit 9d3761d

Please sign in to comment.