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

Use compressed_constraint_kind in MatrixFree (CPU) #13566

Merged
merged 1 commit into from
Mar 26, 2022
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
28 changes: 15 additions & 13 deletions include/deal.II/matrix_free/constraint_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ namespace internal
std::vector<typename Number::value_type> constraint_pool_data;
std::vector<unsigned int> constraint_pool_row_index;

std::vector<ShapeInfo<Number>> shape_infos;
std::vector<ConstraintKinds> hanging_node_constraint_masks;
std::vector<unsigned int> active_fe_indices;
std::vector<ShapeInfo<Number>> shape_infos;
std::vector<compressed_constraint_kind> hanging_node_constraint_masks;
std::vector<unsigned int> active_fe_indices;

private:
inline const typename Number::value_type *
Expand Down Expand Up @@ -231,7 +231,7 @@ namespace internal
hanging_nodes->setup_constraints(
cell, {}, lexicographic_numbering, local_dof_indices_lex, mask);

hanging_node_constraint_masks[cell_no] = mask[0];
hanging_node_constraint_masks[cell_no] = compress(mask[0], dim);
active_fe_indices[cell_no] = cell->active_fe_index();
}

Expand Down Expand Up @@ -353,12 +353,12 @@ namespace internal
dof_indices_per_cell.clear();
constraint_indicator_per_cell.clear();

if (hanging_nodes && std::all_of(hanging_node_constraint_masks.begin(),
hanging_node_constraint_masks.end(),
[](const auto i) {
return i ==
ConstraintKinds::unconstrained;
}))
if (hanging_nodes &&
std::all_of(hanging_node_constraint_masks.begin(),
hanging_node_constraint_masks.end(),
[](const auto i) {
return i == unconstrained_compressed_constraint_kind;
}))
hanging_node_constraint_masks.clear();
}

Expand Down Expand Up @@ -459,7 +459,9 @@ namespace internal
if (hanging_node_constraint_masks.size() == 0)
return;

std::array<ConstraintKinds, Number::size()> constraint_mask;
std::array<MatrixFreeFunctions::compressed_constraint_kind,
Number::size()>
constraint_mask;

bool hn_available = false;

Expand All @@ -469,13 +471,13 @@ namespace internal

constraint_mask[v] = mask;

hn_available |= (mask != ConstraintKinds::unconstrained);
hn_available |= (mask != unconstrained_compressed_constraint_kind);
}

if (hn_available == true)
{
for (unsigned int v = n_lanes_filled; v < Number::size(); ++v)
constraint_mask[v] = ConstraintKinds::unconstrained;
constraint_mask[v] = unconstrained_compressed_constraint_kind;

for (unsigned int i = 1; i < n_lanes_filled; ++i)
AssertDimension(active_fe_indices[first_cell],
Expand Down
2 changes: 1 addition & 1 deletion include/deal.II/matrix_free/dof_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ namespace internal
* Masks indicating for each cell and component if the optimized
* hanging-node constraint is applicable and if yes which type.
*/
std::vector<ConstraintKinds> hanging_node_constraint_masks;
std::vector<compressed_constraint_kind> hanging_node_constraint_masks;

/**
* This variable describes the position of constraints in terms of the
Expand Down
3 changes: 2 additions & 1 deletion include/deal.II/matrix_free/dof_info.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ namespace internal
refinement_configuration,
dof_indices);

hanging_node_constraint_masks[cell_number] = refinement_configuration;
hanging_node_constraint_masks[cell_number] =
compress(refinement_configuration, dim);

return true;
}
Expand Down