fe_degree != -1 ? fe_degree :
fe_eval.get_shape_info().data.front().fe_degree;
- const auto is_set = [](const unsigned int a, const unsigned int b) {
+ const auto is_set = [](const auto a, const auto b) -> bool {
return (a & b) == b;
};
- const auto not_set = [](const unsigned int a, const unsigned int b) {
- return (a & b) == 0;
+ const auto not_set = [](const auto a, const auto b) -> bool {
+ return (a & b) == MatrixFreeFunctions::ConstraintTypes::unconstrained;
};
const unsigned int points = given_degree + 1;
if (dim == 2) // 2D: only faces
{
// direction 0:
- if (mask & MatrixFreeFunctions::ConstraintTypes::face_y)
+ if ((mask & MatrixFreeFunctions::ConstraintTypes::face_y) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained)
{
const bool is_subface_0 =
- mask & MatrixFreeFunctions::ConstraintTypes::type_x;
+ (mask & MatrixFreeFunctions::ConstraintTypes::type_x) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained;
if (is_set(mask,
MatrixFreeFunctions::ConstraintTypes::type_y))
interpolate_2D<fe_degree, 2, transpose>(
}
// direction 1:
- if (mask & MatrixFreeFunctions::ConstraintTypes::face_x)
+ if ((mask & MatrixFreeFunctions::ConstraintTypes::face_x) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained)
{
const bool is_subface_0 =
- mask & MatrixFreeFunctions::ConstraintTypes::type_y;
+ (mask & MatrixFreeFunctions::ConstraintTypes::type_y) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained;
if (is_set(mask,
MatrixFreeFunctions::ConstraintTypes::type_x))
interpolate_2D<fe_degree, 0, transpose>(
// direction 0:
{
const bool is_subface_0 =
- mask & MatrixFreeFunctions::ConstraintTypes::type_x;
+ (mask & MatrixFreeFunctions::ConstraintTypes::type_x) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained;
// ... faces
if (is_face_2)
// direction 1:
{
const bool is_subface_0 =
- mask & MatrixFreeFunctions::ConstraintTypes::type_y;
+ (mask & MatrixFreeFunctions::ConstraintTypes::type_y) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained;
// ... faces
if (is_face_0)
// direction 2:
{
const bool is_subface_0 =
- mask & MatrixFreeFunctions::ConstraintTypes::type_z;
+ (mask & MatrixFreeFunctions::ConstraintTypes::type_z) !=
+ MatrixFreeFunctions::ConstraintTypes::unconstrained;
// ... faces
if (is_face_0)
this->dof_info
->hanging_node_constraint_masks[(this->cell * n_lanes + v) *
n_fe_components +
- first_selected_component] != 0)
+ first_selected_component] !=
+ internal::MatrixFreeFunctions::ConstraintTypes::unconstrained)
has_hn_constraints = true;
}
->hanging_node_constraint_masks[(this->cell * n_lanes + v) *
n_fe_components +
first_selected_component] !=
- 0)
+ internal::MatrixFreeFunctions::ConstraintTypes::unconstrained)
has_hn_constraints = true;
Assert(my_index_start[n_components_read].first ==
this->dof_info->row_starts[cell_dof_index + n_components_read]
.second ||
(this->dof_info->hanging_node_constraint_masks.size() > 0 &&
- this->dof_info->hanging_node_constraint_masks[cell_dof_index] > 0)))
+ this->dof_info->hanging_node_constraint_masks[cell_dof_index] !=
+ internal::MatrixFreeFunctions::ConstraintTypes::unconstrained)))
{
Assert(this->dof_info->row_starts_plain_indices[cell_index] !=
numbers::invalid_unsigned_int,
* determine which face is constrained. For example, in 2D, if
* face_x and type are set, then x = 0 is constrained.
*/
- enum ConstraintTypes : unsigned short
+ enum class ConstraintTypes : std::uint16_t
{
unconstrained = 0,
* would be an integer which would in turn trigger a compiler warning when
* we tried to assign it to an object of type UpdateFlags.
*/
- inline ConstraintTypes
+ DEAL_II_CUDA_HOST_DEV inline ConstraintTypes
operator|(const ConstraintTypes f1, const ConstraintTypes f2)
{
- return static_cast<ConstraintTypes>(static_cast<unsigned short>(f1) |
- static_cast<unsigned short>(f2));
+ return static_cast<ConstraintTypes>(static_cast<std::uint16_t>(f1) |
+ static_cast<std::uint16_t>(f2));
}
* Global operator which sets the bits from the second argument also in the
* first one.
*/
- inline ConstraintTypes &
+ DEAL_II_CUDA_HOST_DEV inline ConstraintTypes &
operator|=(ConstraintTypes &f1, const ConstraintTypes f2)
{
f1 = f1 | f2;
-#ifdef DEAL_II_COMPILER_CUDA_AWARE
- __device__ inline ConstraintTypes
- operator|(const ConstraintTypes f1, const ConstraintTypes f2)
+ /**
+ * Global operator which checks inequality.
+ */
+ DEAL_II_CUDA_HOST_DEV inline bool
+ operator!=(const ConstraintTypes f1, const ConstraintTypes f2)
{
- return static_cast<ConstraintTypes>(static_cast<unsigned short>(f1) |
- static_cast<unsigned short>(f2));
+ return static_cast<std::uint16_t>(f1) != static_cast<std::uint16_t>(f2);
}
- __device__ inline ConstraintTypes &
- operator|=(ConstraintTypes &f1, const ConstraintTypes f2)
+ /**
+ * Global operator which checks if the first argument is less than the
+ * second.
+ */
+ DEAL_II_CUDA_HOST_DEV inline bool
+ operator<(const ConstraintTypes f1, const ConstraintTypes f2)
{
- f1 = f1 | f2;
- return f1;
+ return static_cast<std::uint16_t>(f1) < static_cast<std::uint16_t>(f2);
+ }
+
+
+
+ /**
+ * Global operator which performs a binary and for the provided arguments.
+ */
+ DEAL_II_CUDA_HOST_DEV inline ConstraintTypes
+ operator&(const ConstraintTypes f1, const ConstraintTypes f2)
+ {
+ return static_cast<ConstraintTypes>(static_cast<std::uint16_t>(f1) &
+ static_cast<std::uint16_t>(f2));
}
-#endif
{
// If we don't already have a constraint for as part of a
// face
- if (!(mask & line_to_edge[local_line][0]))
+ if ((mask & line_to_edge[local_line][0]) ==
+ ConstraintTypes::unconstrained)
{
// For each cell which share that edge
const unsigned int line =
}
}
}
- cell_has_hanging_node_constraints |= mask != 0;
+ cell_has_hanging_node_constraints |=
+ mask != ConstraintTypes::unconstrained;
}
return cell_has_hanging_node_constraints;
}
{
auto &vec = dof_info[no].hanging_node_constraint_masks;
if (std::all_of(vec.begin(), vec.end(), [](const auto i) {
- return i == 0;
+ return i == internal::MatrixFreeFunctions::ConstraintTypes::
+ unconstrained;
}))
vec.clear();
}
first_selected_component];
// cell has hanging nodes
- if (mask != 0)
+ if (mask != dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained)
{
// check if hanging node internpolation matrix has been set
// up
// constraints!
std::array<std::vector<Number>, n_lanes> diagonals_local_constrained;
- std::map<unsigned int,
+ std::map<dealii::internal::MatrixFreeFunctions::ConstraintTypes,
std::vector<std::tuple<unsigned int, unsigned int, Number>>>
locally_relevant_constrains_hn_map;
};
// one
const bool has_constraints =
(hanging_node_constraint_masks.size() != 0 &&
- hanging_node_constraint_masks[ib] != 0) ||
+ hanging_node_constraint_masks[ib] !=
+ ConstraintTypes::unconstrained) ||
(row_starts[ib].second != row_starts[ib + n_fe_components].second);
auto do_copy = [&](const unsigned int *begin,
has_hanging_nodes |=
hanging_node_constraint_masks[boundary_cells[i] *
n_components +
- comp] > 0;
+ comp] !=
+ ConstraintTypes::unconstrained;
if (has_hanging_nodes ||
row_starts[boundary_cells[i] * n_components].second !=
const auto mask =
hanging_node_constraint_masks[cell_no + comp];
new_hanging_node_constraint_masks.push_back(mask);
- has_hanging_nodes |= mask > 0;
+ has_hanging_nodes |=
+ mask != ConstraintTypes::unconstrained;
}
new_dof_indices.insert(
for (unsigned int v = 0; v < Number::size(); ++v)
{
- if (constraint_mask[v] == 0)
+ if (constraint_mask[v] == dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained)
continue;
- const unsigned int this_type =
+ const auto this_type =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_x :
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_y;
((direction == 1) ? dealii::internal::MatrixFreeFunctions::
ConstraintTypes::face_x :
dealii::internal::MatrixFreeFunctions::
- ConstraintTypes::unconstrained)));
+ ConstraintTypes::unconstrained))) !=
+ dealii::internal::MatrixFreeFunctions::ConstraintTypes::
+ unconstrained;
- const bool type = constraint_mask[v] & this_type;
+ const bool type = (constraint_mask[v] & this_type) !=
+ dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained;
for (unsigned int x_idx = 0; x_idx < fe_degree + 1; ++x_idx)
for (unsigned int y_idx = 0; y_idx < fe_degree + 1; ++y_idx)
// (left (= 0) or right (= fe_degree))
const bool constrained_dof =
((direction == 0) &&
- ((constraint_mask[v] &
- dealii::internal::MatrixFreeFunctions::ConstraintTypes::
- type_y) ?
+ (((constraint_mask[v] &
+ dealii::internal::MatrixFreeFunctions::ConstraintTypes::
+ type_y) != dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained) ?
(y_idx == 0) :
(y_idx == fe_degree))) ||
((direction == 1) &&
- ((constraint_mask[v] &
- dealii::internal::MatrixFreeFunctions::ConstraintTypes::
- type_x) ?
+ (((constraint_mask[v] &
+ dealii::internal::MatrixFreeFunctions::ConstraintTypes::
+ type_x) != dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained) ?
(x_idx == 0) :
(x_idx == fe_degree)));
for (unsigned int i = 0; i < n_dofs; ++i)
values_temp[i] = values[i];
- const unsigned int this_type =
+ const auto this_type =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_x :
(direction == 1) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_y :
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_z;
- const unsigned int face1_type =
+ const auto face1_type =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_y :
(direction == 1) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_z :
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_x;
- const unsigned int face2_type =
+ const auto face2_type =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::type_z :
(direction == 1) ?
// If computing in x-direction, need to match against
// dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_y or
// dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_z
- const unsigned int face1 =
+ const auto face1 =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_y :
(direction == 1) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_z :
dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_x;
- const unsigned int face2 =
+ const auto face2 =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_z :
(direction == 1) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_x :
dealii::internal::MatrixFreeFunctions::ConstraintTypes::face_y;
- const unsigned int edge =
+ const auto edge =
(direction == 0) ?
dealii::internal::MatrixFreeFunctions::ConstraintTypes::edge_yz :
(direction == 1) ?
for (unsigned int v = 0; v < Number::size(); ++v)
{
- if (constraint_mask[v] == 0)
+ if (constraint_mask[v] == dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained)
continue;
- const unsigned int constrained_face =
+ const auto constrained_face =
constraint_mask[v] & (face1 | face2 | edge);
- const bool type = constraint_mask[v] & this_type;
+ const bool type = (constraint_mask[v] & this_type) !=
+ dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained;
for (unsigned int x_idx = 0; x_idx < fe_degree + 1; ++x_idx)
for (unsigned int y_idx = 0; y_idx < fe_degree + 1; ++y_idx)
y_idx;
typename Number::value_type t = 0;
- const bool on_face1 = (constraint_mask[v] & face1_type) ?
- (face1_idx == 0) :
- (face1_idx == fe_degree);
- const bool on_face2 = (constraint_mask[v] & face2_type) ?
- (face2_idx == 0) :
- (face2_idx == fe_degree);
+ const bool on_face1 =
+ ((constraint_mask[v] & face1_type) !=
+ dealii::internal::MatrixFreeFunctions::ConstraintTypes::
+ unconstrained) ?
+ (face1_idx == 0) :
+ (face1_idx == fe_degree);
+ const bool on_face2 =
+ ((constraint_mask[v] & face2_type) !=
+ dealii::internal::MatrixFreeFunctions::ConstraintTypes::
+ unconstrained) ?
+ (face2_idx == 0) :
+ (face2_idx == fe_degree);
const bool constrained_dof =
- (((constraint_mask[v] & face1) && on_face1) ||
- ((constraint_mask[v] & face2) && on_face2) ||
- ((constraint_mask[v] & edge) && on_face1 && on_face2));
-
- if (constrained_face && constrained_dof)
+ ((((constraint_mask[v] & face1) !=
+ dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained) &&
+ on_face1) ||
+ (((constraint_mask[v] & face2) !=
+ dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained) &&
+ on_face2) ||
+ (((constraint_mask[v] & edge) !=
+ dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained) &&
+ on_face1 && on_face2));
+
+ if ((constrained_face !=
+ dealii::internal::MatrixFreeFunctions::
+ ConstraintTypes::unconstrained) &&
+ constrained_dof)
{
if (type)
{