Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hp::DoFHandler::get_fe() #9734

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/news/changes/incompatibilities/20200326PeterMunch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Removed: The deprecated method hp::DoFHandler::get_fe() has been removed. Please use
hp::DoFHandler::get_fe_collection() instead.
<br>
(Peter Munch, 2020/03/26)
22 changes: 0 additions & 22 deletions include/deal.II/hp/dof_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,16 +955,6 @@ namespace hp
DEAL_II_DEPRECATED const std::vector<IndexSet> &
locally_owned_mg_dofs_per_processor(const unsigned int level) const;

/**
* Return a constant reference to the set of finite element objects that
* are used by this @p DoFHandler.
*
* @deprecated Use get_fe_collection() instead.
*/
DEAL_II_DEPRECATED
const hp::FECollection<dim, spacedim> &
get_fe() const;

/**
* Return a constant reference to the indexth finite element object that is
* used by this @p DoFHandler.
Expand Down Expand Up @@ -1720,18 +1710,6 @@ namespace hp



template <int dim, int spacedim>
inline const hp::FECollection<dim, spacedim> &
DoFHandler<dim, spacedim>::get_fe() const
{
Assert(fe_collection.size() > 0,
ExcMessage("No finite element collection is associated with "
"this DoFHandler"));
return fe_collection;
}



template <int dim, int spacedim>
inline const FiniteElement<dim, spacedim> &
DoFHandler<dim, spacedim>::get_fe(const unsigned int number) const
Expand Down
4 changes: 2 additions & 2 deletions include/deal.II/matrix_free/matrix_free.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ MatrixFree<dim, Number, VectorizedArrayType>::internal_reinit(
{
unsigned int n_components = 0;
for (unsigned int no = 0; no < dof_handler.size(); ++no)
n_components += dof_handler[no]->get_fe()[0].n_base_elements();
n_components += dof_handler[no]->get_fe(0).n_base_elements();
const unsigned int n_quad = quad.size();
unsigned int n_fe_in_collection = 0;
for (unsigned int i = 0; i < n_components; ++i)
Expand Down Expand Up @@ -587,7 +587,7 @@ MatrixFree<dim, Number, VectorizedArrayType>::internal_reinit(
additional_data.store_plain_indices;
dof_info[no].global_base_element_offset =
no > 0 ? dof_info[no - 1].global_base_element_offset +
dof_handler[no - 1]->get_fe()[0].n_base_elements() :
dof_handler[no - 1]->get_fe(0).n_base_elements() :
0;
}

Expand Down
4 changes: 2 additions & 2 deletions include/deal.II/numerics/data_out_dof_data.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ namespace internal
const VectorType *vector = &((*vectors)[dof_cell->level()]);

const unsigned int dofs_per_cell =
this->dof_handler->get_fe()[0].dofs_per_cell;
this->dof_handler->get_fe(0).dofs_per_cell;

std::vector<types::global_dof_index> dof_indices(dofs_per_cell);
dof_cell->get_mg_dof_indices(dof_indices);
Expand Down Expand Up @@ -1292,7 +1292,7 @@ namespace internal
const VectorType *vector = &((*vectors)[dof_cell->level()]);

const unsigned int dofs_per_cell =
this->dof_handler->get_fe()[0].dofs_per_cell;
this->dof_handler->get_fe(0).dofs_per_cell;

std::vector<types::global_dof_index> dof_indices(dofs_per_cell);
dof_cell->get_mg_dof_indices(dof_indices);
Expand Down
16 changes: 9 additions & 7 deletions include/deal.II/numerics/vector_tools.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ namespace VectorTools
const ComponentMask & component_mask)
{
Assert(component_mask.represents_n_components(
dof_handler.get_fe().n_components()),
dof_handler.get_fe_collection().n_components()),
ExcMessage(
"The number of components in the mask has to be either "
"zero or equal to the number of components in the finite "
Expand All @@ -296,7 +296,7 @@ namespace VectorTools
ExcDimensionMismatch(vec.size(), dof_handler.n_dofs()));

Assert(component_mask.n_selected_components(
dof_handler.get_fe().n_components()) > 0,
dof_handler.get_fe_collection().n_components()) > 0,
ComponentMask::ExcNoComponentSelected());

//
Expand Down Expand Up @@ -427,9 +427,10 @@ namespace VectorTools
dof_values.resize(n_dofs);

// Get all function values:
Assert(n_components == function(cell)->n_components,
ExcDimensionMismatch(dof_handler.get_fe().n_components(),
function(cell)->n_components));
Assert(
n_components == function(cell)->n_components,
ExcDimensionMismatch(dof_handler.get_fe_collection().n_components(),
function(cell)->n_components));
function(cell)->vector_value_list(generalized_support_points,
function_values);

Expand Down Expand Up @@ -553,8 +554,9 @@ namespace VectorTools
VectorType & vec,
const ComponentMask & component_mask)
{
Assert(dof_handler.get_fe().n_components() == function.n_components,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you actually need to introduce your new two internal::interpolate(...) functions? Both DoFHandler and hp::DoFHandler have the member function get_fe_collection().

I guess if you just replace dof_handler.get_fe() with dof_handler.get_fe_collection() in this assertion, you should be fine!

ExcDimensionMismatch(dof_handler.get_fe().n_components(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand why you need to duplicate this function into one for the hp and one for the non-hp case. Can't you just replace this call to get_fe() by get_fe_collection()? That works for both ::DoFHandler and hp::DoFHandler. If you did that, then you wouldn't have to duplicate the body of the function...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Assert(dof_handler.get_fe_collection().n_components() ==
function.n_components,
ExcDimensionMismatch(dof_handler.get_fe_collection().n_components(),
function.n_components));

// Create a small lambda capture wrapping function and call the
Expand Down
2 changes: 1 addition & 1 deletion tests/distributed_grids/hp_2d_dofhandler_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test()

typename hp::DoFHandler<dim>::active_cell_iterator cell = dofh.begin_active();

const unsigned int dofs_per_cell = dofh.get_fe()[0].dofs_per_cell;
const unsigned int dofs_per_cell = dofh.get_fe(0).dofs_per_cell;
std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);


Expand Down
2 changes: 1 addition & 1 deletion tests/dofs/dof_tools_12.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ template <typename DoFHandlerType>
void
check_this(const DoFHandlerType &dof_handler)
{
std::vector<bool> mask(dof_handler.get_fe().n_components(), false);
std::vector<bool> mask(dof_handler.get_fe(0).n_components(), false);

// only select first component
mask[0] = true;
Expand Down
4 changes: 2 additions & 2 deletions tests/hp/dof_renumbering_04.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ template <int dim>
void
check_renumbering(hp::DoFHandler<dim> &dof)
{
for (unsigned int i = 0; i < dof.get_fe().size(); ++i)
for (unsigned int i = 0; i < dof.get_fe_collection().size(); ++i)
{
const FiniteElement<dim> &element = dof.get_fe()[i];
const FiniteElement<dim> &element = dof.get_fe_collection()[i];
deallog << element.get_name() << std::endl;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/hp/dof_renumbering_05.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ template <int dim>
void
check_renumbering(hp::DoFHandler<dim> &dof)
{
for (unsigned int i = 0; i < dof.get_fe().size(); ++i)
for (unsigned int i = 0; i < dof.get_fe_collection().size(); ++i)
{
const FiniteElement<dim> &element = dof.get_fe()[i];
const FiniteElement<dim> &element = dof.get_fe_collection()[i];
deallog << element.get_name() << std::endl;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/hp/dof_renumbering_06.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ template <int dim>
void
check_renumbering(hp::DoFHandler<dim> &dof)
{
for (unsigned int i = 0; i < dof.get_fe().size(); ++i)
for (unsigned int i = 0; i < dof.get_fe_collection().size(); ++i)
{
const FiniteElement<dim> &element = dof.get_fe()[i];
const FiniteElement<dim> &element = dof.get_fe_collection()[i];
deallog << element.get_name() << std::endl;
}

Expand Down
10 changes: 6 additions & 4 deletions tests/hp/n_active_fe_indices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ check_cells(const hp::DoFHandler<dim> &dof_handler)
deallog << "cell=" << cell << std::endl;
deallog << "n=" << cell->n_active_fe_indices() << std::endl;
deallog << "x=";
for (unsigned int i = 0; i < dof_handler.get_fe().size(); ++i)
for (unsigned int i = 0; i < dof_handler.get_fe_collection().size(); ++i)
deallog << cell->fe_index_is_active(i);
deallog << std::endl;

Expand All @@ -74,7 +74,8 @@ check_faces(const hp::DoFHandler<dim> &dof_handler)
deallog << "face=" << cell->face(f) << std::endl;
deallog << "n=" << cell->face(f)->n_active_fe_indices() << std::endl;
deallog << "x=";
for (unsigned int i = 0; i < dof_handler.get_fe().size(); ++i)
for (unsigned int i = 0; i < dof_handler.get_fe_collection().size();
++i)
deallog << cell->face(f)->fe_index_is_active(i);
deallog << std::endl;

Expand Down Expand Up @@ -107,13 +108,14 @@ check_edges(const hp::DoFHandler<dim> &dof_handler)
deallog << "edge=" << cell->line(e) << std::endl;
deallog << "n=" << cell->line(e)->n_active_fe_indices() << std::endl;
deallog << "x=";
for (unsigned int i = 0; i < dof_handler.get_fe().size(); ++i)
for (unsigned int i = 0; i < dof_handler.get_fe_collection().size();
++i)
deallog << cell->line(e)->fe_index_is_active(i);
deallog << std::endl;

Assert(cell->line(e)->n_active_fe_indices() >= 1, ExcInternalError());
Assert(cell->line(e)->n_active_fe_indices() <=
dof_handler.get_fe().size(),
dof_handler.get_fe_collection().size(),
ExcInternalError());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/hp/renumber_block_wise_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ check_renumbering(hp::DoFHandler<dim> &dof)
// components so that each
// component maps to its natural
// block
std::vector<unsigned int> order(dof.get_fe().n_components());
std::vector<unsigned int> order(dof.get_fe_collection().n_components());
order[0] = 0;
order[1] = 1;
order[2] = 1;
Expand Down
2 changes: 1 addition & 1 deletion tests/hp/renumber_component_wise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ check_renumbering(hp::DoFHandler<dim> &dof)
{
// Prepare a reordering of
// components for later use
std::vector<unsigned int> order(dof.get_fe().n_components());
std::vector<unsigned int> order(dof.get_fe_collection().n_components());
for (unsigned int i = 0; i < order.size(); ++i)
order[i] = order.size() - i - 1;

Expand Down
4 changes: 2 additions & 2 deletions tests/hp/step-12.cc
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ template <int dim>
void
DGMethod<dim>::assemble_system1()
{
const unsigned int dofs_per_cell = dof_handler.get_fe()[0].dofs_per_cell;
const unsigned int dofs_per_cell = dof_handler.get_fe(0).dofs_per_cell;
std::vector<types::global_dof_index> dofs(dofs_per_cell);
std::vector<types::global_dof_index> dofs_neighbor(dofs_per_cell);

Expand Down Expand Up @@ -663,7 +663,7 @@ template <int dim>
void
DGMethod<dim>::assemble_system2()
{
const unsigned int dofs_per_cell = dof_handler.get_fe()[0].dofs_per_cell;
const unsigned int dofs_per_cell = dof_handler.get_fe(0).dofs_per_cell;
std::vector<types::global_dof_index> dofs(dofs_per_cell);
std::vector<types::global_dof_index> dofs_neighbor(dofs_per_cell);

Expand Down