Skip to content

Commit

Permalink
Reuse MappingInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
bergbauer committed Jun 14, 2023
1 parent 569c0e6 commit 6304ef8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
23 changes: 23 additions & 0 deletions include/deal.II/non_matching/mapping_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ namespace NonMatching
const UpdateFlags update_flags,
const AdditionalData additional_data = AdditionalData());

/**
* Clears fields to make the object reusable.
*/
void
clear();

/**
* Compute the mapping information for the incoming cell and unit
* points. This overload is needed to resolve ambiguity.
Expand Down Expand Up @@ -673,6 +679,17 @@ namespace NonMatching



template <int dim, int spacedim, typename Number>
void
MappingInfo<dim, spacedim, Number>::clear()
{
n_q_points_unvectorized.clear();
unit_points_index.clear();
data_index_offsets.clear();
}



template <int dim, int spacedim, typename Number>
void
MappingInfo<dim, spacedim, Number>::reinit(
Expand Down Expand Up @@ -778,6 +795,8 @@ namespace NonMatching
const std::vector<Quadrature<dim>> &quadrature_vector,
const unsigned int n_unfiltered_cells)
{
clear();

do_cell_index_compression =
n_unfiltered_cells != numbers::invalid_unsigned_int;

Expand Down Expand Up @@ -873,6 +892,8 @@ namespace NonMatching
const std::vector<ImmersedSurfaceQuadrature<dim>> &quadrature_vector,
const unsigned int n_unfiltered_cells)
{
clear();

Assert(
additional_data.use_global_weights == false,
ExcMessage(
Expand Down Expand Up @@ -976,6 +997,8 @@ namespace NonMatching
const std::vector<std::vector<Quadrature<dim - 1>>> &quadrature_vector,
const unsigned int n_unfiltered_cells)
{
clear();

do_cell_index_compression =
n_unfiltered_cells != numbers::invalid_unsigned_int;

Expand Down
18 changes: 5 additions & 13 deletions tests/non_matching/mapping_info_03.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ test()
FE_Q<dim> fe(degree);
MappingQ<dim> mapping(degree);

NonMatching::MappingInfo<dim>::AdditionalData additional_data;
additional_data.use_global_weights = true;
NonMatching::MappingInfo<dim> mapping_info(mapping,
update_JxW_values,
additional_data);

deallog << "Check JxW faces..." << std::endl;
{
NonMatching::MappingInfo<dim>::AdditionalData additional_data;
additional_data.use_global_weights = true;
NonMatching::MappingInfo<dim> mapping_info(mapping,
update_JxW_values,
additional_data);

// 1) build vector of quadratures
std::vector<std::vector<Quadrature<dim - 1>>> quad_vec;
// prescribe JxW (there is no meaning in the actual values, they just have
Expand Down Expand Up @@ -96,13 +95,6 @@ test()

deallog << "\n\nCheck JxW cells..." << std::endl;
{
NonMatching::MappingInfo<dim>::AdditionalData additional_data;
additional_data.use_global_weights = true;
NonMatching::MappingInfo<dim> mapping_info(mapping,
update_JxW_values,
additional_data);


// 1) build vector of quadratures
std::vector<Quadrature<dim>> quad_vec;
// prescribe JxW (there is no meaning in the actual values, they just have
Expand Down

0 comments on commit 6304ef8

Please sign in to comment.