]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce masks in read_dof_values 12955/head
authorMaximilian Bergbauer <bergbauer@lnm.mw.tum.de>
Tue, 9 Nov 2021 13:37:57 +0000 (14:37 +0100)
committerMaximilian Bergbauer <bergbauer@lnm.mw.tum.de>
Tue, 16 Nov 2021 13:07:29 +0000 (14:07 +0100)
include/deal.II/matrix_free/fe_evaluation.h

index 31e1718c8db75a606c0550c30e206b770ccff716..d2961eaebbd07637e64cb02cad515d351dc1d7a6 100644 (file)
@@ -592,7 +592,10 @@ public:
    */
   template <typename VectorType>
   void
-  read_dof_values(const VectorType &src, const unsigned int first_index = 0);
+  read_dof_values(const VectorType & src,
+                  const unsigned int first_index = 0,
+                  const std::bitset<VectorizedArrayType::size()> &mask =
+                    std::bitset<VectorizedArrayType::size()>().flip());
 
   /**
    * For the vector @p src, read out the values on the degrees of freedom of
@@ -625,7 +628,9 @@ public:
   template <typename VectorType>
   void
   read_dof_values_plain(const VectorType & src,
-                        const unsigned int first_index = 0);
+                        const unsigned int first_index = 0,
+                        const std::bitset<VectorizedArrayType::size()> &mask =
+                          std::bitset<VectorizedArrayType::size()>().flip());
 
   /**
    * Takes the values stored internally on dof values of the current cell and
@@ -4971,6 +4976,12 @@ FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
 
         for (unsigned int v = 0; v < n_filled_lanes; ++v)
           {
+            if (mask[v] == false)
+              {
+                vector_ptrs[v] = nullptr;
+                continue;
+              }
+
             Assert(cells[v] != numbers::invalid_unsigned_int,
                    ExcNotImplemented());
             Assert(ind < this->dof_info->dof_indices_contiguous_sm.size(),
@@ -5437,7 +5448,9 @@ template <int dim,
 template <typename VectorType>
 inline void
 FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
-  read_dof_values(const VectorType &src, const unsigned int first_index)
+  read_dof_values(const VectorType &                              src,
+                  const unsigned int                              first_index,
+                  const std::bitset<VectorizedArrayType::size()> &mask)
 {
   const auto src_data = internal::get_vector_data<n_components_>(
     src,
@@ -5448,11 +5461,7 @@ FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
     this->dof_info);
 
   internal::VectorReader<Number, VectorizedArrayType> reader;
-  read_write_operation(reader,
-                       src_data.first,
-                       src_data.second,
-                       std::bitset<VectorizedArrayType::size()>().flip(),
-                       true);
+  read_write_operation(reader, src_data.first, src_data.second, mask, true);
 
   apply_hanging_node_constraints<false>();
 
@@ -5471,7 +5480,9 @@ template <int dim,
 template <typename VectorType>
 inline void
 FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
-  read_dof_values_plain(const VectorType &src, const unsigned int first_index)
+  read_dof_values_plain(const VectorType & src,
+                        const unsigned int first_index,
+                        const std::bitset<VectorizedArrayType::size()> &mask)
 {
   const auto src_data = internal::get_vector_data<n_components_>(
     src,
@@ -5482,11 +5493,7 @@ FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
     this->dof_info);
 
   internal::VectorReader<Number, VectorizedArrayType> reader;
-  read_write_operation(reader,
-                       src_data.first,
-                       src_data.second,
-                       std::bitset<VectorizedArrayType::size()>().flip(),
-                       false);
+  read_write_operation(reader, src_data.first, src_data.second, mask, false);
 
 #  ifdef DEBUG
   dof_values_initialized = true;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.