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

internal::MatrixFreeFunctions::ConstraintInfo: switch data type #14279

Merged
merged 1 commit into from
Sep 18, 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: 14 additions & 14 deletions include/deal.II/matrix_free/constraint_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ namespace internal

template <typename T, typename VectorType>
void
read_write_operation(const T & operation,
VectorType & global_vector,
AlignedVector<Number> &local_vector,
const unsigned int first_cell,
const unsigned int n_cells,
const unsigned int n_dofs_per_cell,
const bool apply_constraints) const;
read_write_operation(const T & operation,
VectorType & global_vector,
Number * local_vector,
const unsigned int first_cell,
const unsigned int n_cells,
const unsigned int n_dofs_per_cell,
const bool apply_constraints) const;

void
apply_hanging_node_constraints(
Expand Down Expand Up @@ -457,13 +457,13 @@ namespace internal
template <typename T, typename VectorType>
inline void
ConstraintInfo<dim, Number>::read_write_operation(
const T & operation,
VectorType & global_vector,
AlignedVector<Number> &local_vector,
const unsigned int first_cell,
const unsigned int n_cells,
const unsigned int n_dofs_per_cell,
const bool apply_constraints) const
const T & operation,
VectorType & global_vector,
Number * local_vector,
const unsigned int first_cell,
const unsigned int n_cells,
const unsigned int n_dofs_per_cell,
const bool apply_constraints) const
{
if (apply_constraints == false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,7 @@ MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
internal::VectorReader<Number, VectorizedArrayType> reader;
constraint_info.read_write_operation(reader,
*vec_coarse_ptr,
evaluation_data_coarse,
evaluation_data_coarse.data(),
cell_counter,
n_lanes_filled,
scheme.n_dofs_per_cell_coarse,
Expand Down Expand Up @@ -2761,7 +2761,7 @@ MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
cell_counter, n_lanes_filled, true, evaluation_data_coarse);
constraint_info.read_write_operation(writer,
*vec_coarse_ptr,
evaluation_data_coarse,
evaluation_data_coarse.data(),
cell_counter,
n_lanes_filled,
scheme.n_dofs_per_cell_coarse,
Expand Down Expand Up @@ -2894,7 +2894,7 @@ MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>::
internal::VectorSetter<Number, VectorizedArrayType> writer;
constraint_info.read_write_operation(writer,
*vec_coarse_ptr,
evaluation_data_coarse,
evaluation_data_coarse.data(),
cell_counter,
n_lanes_filled,
scheme.n_dofs_per_cell_coarse,
Expand Down
36 changes: 28 additions & 8 deletions tests/matrix_free/constraint_info_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,13 @@ main()
const unsigned int n_cells,
const unsigned int n_dofs_per_cell) {
internal::VectorReader<Number, VectorizedArrayType> reader;
constraint_info.read_write_operation(
reader, src, local_vector, first_cell, n_cells, n_dofs_per_cell, true);
constraint_info.read_write_operation(reader,
src,
local_vector.data(),
first_cell,
n_cells,
n_dofs_per_cell,
true);
constraint_info.apply_hanging_node_constraints(first_cell,
n_cells,
false,
Expand All @@ -151,24 +156,39 @@ main()
n_cells,
true,
local_vector);
constraint_info.read_write_operation(
writer, dst, local_vector, first_cell, n_cells, n_dofs_per_cell, true);
constraint_info.read_write_operation(writer,
dst,
local_vector.data(),
first_cell,
n_cells,
n_dofs_per_cell,
true);
};

const auto read_dof_values_plain = [&](const unsigned int first_cell,
const unsigned int n_cells,
const unsigned int n_dofs_per_cell) {
internal::VectorReader<Number, VectorizedArrayType> reader;
constraint_info.read_write_operation(
reader, src, local_vector, first_cell, n_cells, n_dofs_per_cell, false);
constraint_info.read_write_operation(reader,
src,
local_vector.data(),
first_cell,
n_cells,
n_dofs_per_cell,
false);
};

const auto set_dof_values_plain = [&](const unsigned int first_cell,
const unsigned int n_cells,
const unsigned int n_dofs_per_cell) {
internal::VectorSetter<Number, VectorizedArrayType> writer;
constraint_info.read_write_operation(
writer, dst, local_vector, first_cell, n_cells, n_dofs_per_cell, false);
constraint_info.read_write_operation(writer,
dst,
local_vector.data(),
first_cell,
n_cells,
n_dofs_per_cell,
false);
};

unsigned int first_cell = 0;
Expand Down