From: Peter Munch Date: Fri, 20 Mar 2020 08:54:37 +0000 (+0100) Subject: Deprecate n_array_elements and replace its usage X-Git-Tag: v9.2.0-rc1~388^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e4f1c79a24b387a604355eaccc2c99b05fadfb6;p=dealii.git Deprecate n_array_elements and replace its usage --- diff --git a/doc/news/changes/incompatibilities/20200320PeterMunch b/doc/news/changes/incompatibilities/20200320PeterMunch new file mode 100644 index 0000000000..e66621dd55 --- /dev/null +++ b/doc/news/changes/incompatibilities/20200320PeterMunch @@ -0,0 +1,4 @@ +Chaned: VectorizedArray::n_array_elements has been deprecated. +Please use the method VectorizedArray::size() to access the same information. +
+(Peter Munch, 2020/03/20) diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 26bc11e0a5..32ffb2996d 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -245,18 +245,17 @@ private: * * @author Peter Munch, 2019 */ -template +template class VectorizedArrayBase { public: /** - * Return the number of elements in the array stored in the variable - * n_array_elements of VectorizedArray. + * Return the number of elements in the array. */ static constexpr std::size_t size() { - return T::n_array_elements; + return width; } /** @@ -284,8 +283,7 @@ public: VectorizedArrayIterator end() { - return VectorizedArrayIterator(static_cast(*this), - T::n_array_elements); + return VectorizedArrayIterator(static_cast(*this), width); } /** @@ -296,7 +294,7 @@ public: end() const { return VectorizedArrayIterator(static_cast(*this), - T::n_array_elements); + width); } }; @@ -390,7 +388,7 @@ public: */ template class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 1> { public: /** @@ -403,9 +401,9 @@ public: * case, there is only one element. Specializations use SIMD intrinsics and * can work on multiple elements at the same time. */ - static const unsigned int n_array_elements = 1; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 1; - static_assert(width == n_array_elements, + static_assert(width == 1, "You specified an illegal width that is not supported."); /** @@ -502,7 +500,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load size() data items from memory into the calling class, starting at * the given address. The pointer `ptr` needs not be aligned by the amount * of bytes in the vectorized array, as opposed to casting a double address * to VectorizedArray*. @@ -515,8 +513,8 @@ public: } /** - * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The pointer `ptr` needs not be + * Write the content of the calling class into memory in form of + * size() data items to the given address. The pointer `ptr` needs not be * aligned by the amount of bytes in the vectorized array, as opposed to * casting a double address to VectorizedArray*. */ @@ -529,7 +527,7 @@ public: /** * Write the content of the calling class into memory in form of - * @p n_array_elements to the given address using non-temporal stores that + * size() data items to the given address using non-temporal stores that * bypass the processor's caches, using @p _mm_stream_pd store intrinsics on * supported CPUs. The destination of the store @p ptr must be aligned by * the amount of bytes in the vectorized array. @@ -581,14 +579,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load size() data items from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -600,14 +598,14 @@ public: } /** - * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * Write the content of the calling class into memory in form of + * size() data items to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -740,7 +738,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArrayType static_assert( std::is_same>::value, + VectorizedArrayType::size()>>::value, "VectorizedArrayType is not a VectorizedArray."); VectorizedArrayType result = u; @@ -750,13 +748,13 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArrayType /** - * Load @p n_array_elements from memory into the the VectorizedArray @p out, + * Load size() data items from memory into the the VectorizedArray @p out, * starting at the given addresses and with given offset, each entry from the * offset providing one element of the vectorized array. * * This operation corresponds to the following code: * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * out.data[v] = ptrs[v][offset]; * @endcode */ @@ -773,7 +771,7 @@ gather(VectorizedArray & out, /** - * This method loads VectorizedArray::n_array_elements data streams from the + * This method loads VectorizedArray::size() data streams from the * given array @p in. The offsets to the input array are given by the array @p * offsets. From each stream, n_entries are read. The data is then transposed * and stored it into an array of VectorizedArray type. The output array @p @@ -787,7 +785,7 @@ gather(VectorizedArray & out, * * @code * for (unsigned int i=0; i::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * out[i][v] = in[offsets[v]+i]; * @endcode * @@ -805,9 +803,7 @@ vectorized_load_and_transpose(const unsigned int n_entries, VectorizedArray *out) { for (unsigned int i = 0; i < n_entries; ++i) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) out[i][v] = in[offsets[v] + i]; } @@ -830,9 +826,7 @@ vectorized_load_and_transpose(const unsigned int n_entries, VectorizedArray * out) { for (unsigned int i = 0; i < n_entries; ++i) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) out[i][v] = in[v][i]; } @@ -858,7 +852,7 @@ vectorized_load_and_transpose(const unsigned int n_entries, * * @code * for (unsigned int i=0; i::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * out[offsets[v]+i] = in[i][v]; * @endcode * @@ -866,7 +860,7 @@ vectorized_load_and_transpose(const unsigned int n_entries, * action: * @code * for (unsigned int i=0; i::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * out[offsets[v]+i] += in[i][v]; * @endcode * @@ -886,15 +880,11 @@ vectorized_transpose_and_store(const bool add_into, { if (add_into) for (unsigned int i = 0; i < n_entries; ++i) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) out[offsets[v] + i] += in[i][v]; else for (unsigned int i = 0; i < n_entries; ++i) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) out[offsets[v] + i] = in[i][v]; } @@ -919,15 +909,11 @@ vectorized_transpose_and_store(const bool add_into, { if (add_into) for (unsigned int i = 0; i < n_entries; ++i) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) out[v][i] += in[i][v]; else for (unsigned int i = 0; i < n_entries; ++i) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) out[v][i] = in[i][v]; } @@ -946,7 +932,7 @@ vectorized_transpose_and_store(const bool add_into, */ template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 8> { public: /** @@ -957,7 +943,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 8; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 8; /** * Default empty constructor, leaving the data in an uninitialized state @@ -1069,7 +1055,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load size() data items from memory into the calling class, starting at * the given address. The memory need not be aligned by 64 bytes, as opposed * to casting a double address to VectorizedArray*. */ @@ -1082,7 +1068,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The memory need not be aligned by + * size() to the given address. The memory need not be aligned by * 64 bytes, as opposed to casting a double address to * VectorizedArray*. */ @@ -1106,14 +1092,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -1132,13 +1118,13 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * size() to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -1498,7 +1484,7 @@ vectorized_transpose_and_store(const bool add_into, */ template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 16> { public: /** @@ -1509,7 +1495,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 16; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 16; /** * Default empty constructor, leaving the data in an uninitialized state @@ -1621,7 +1607,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. The memory need not be aligned by 64 bytes, as opposed * to casting a float address to VectorizedArray*. */ @@ -1634,7 +1620,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The memory need not be aligned by + * size() to the given address. The memory need not be aligned by * 64 bytes, as opposed to casting a float address to * VectorizedArray*. */ @@ -1658,14 +1644,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -1684,13 +1670,13 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * size() to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -2146,7 +2132,7 @@ vectorized_transpose_and_store(const bool add_into, */ template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 4> { public: /** @@ -2157,7 +2143,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 4; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 4; /** * Default empty constructor, leaving the data in an uninitialized state @@ -2269,7 +2255,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. The memory need not be aligned by 32 bytes, as opposed * to casting a double address to VectorizedArray*. */ @@ -2282,7 +2268,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The memory need not be aligned by + * size() to the given address. The memory need not be aligned by * 32 bytes, as opposed to casting a double address to * VectorizedArray*. */ @@ -2306,14 +2292,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -2337,13 +2323,13 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * size() to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -2657,7 +2643,7 @@ vectorized_transpose_and_store(const bool add_into, */ template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 8> { public: /** @@ -2668,7 +2654,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 8; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 8; /** * Default empty constructor, leaving the data in an uninitialized state @@ -2780,7 +2766,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. The memory need not be aligned by 32 bytes, as opposed * to casting a float address to VectorizedArray*. */ @@ -2793,7 +2779,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The memory need not be aligned by + * size() to the given address. The memory need not be aligned by * 32 bytes, as opposed to casting a float address to * VectorizedArray*. */ @@ -2817,14 +2803,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -2848,13 +2834,13 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * size() to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -3202,7 +3188,7 @@ vectorized_transpose_and_store(const bool add_into, */ template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 2> { public: /** @@ -3213,7 +3199,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 2; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 2; /** * Default empty constructor, leaving the data in an uninitialized state @@ -3321,7 +3307,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. The memory need not be aligned by 16 bytes, as opposed * to casting a double address to VectorizedArray*. */ @@ -3334,7 +3320,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The memory need not be aligned by + * size() to the given address. The memory need not be aligned by * 16 bytes, as opposed to casting a double address to * VectorizedArray*. */ @@ -3358,14 +3344,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -3379,13 +3365,13 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * size() to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -3643,7 +3629,7 @@ vectorized_transpose_and_store(const bool add_into, */ template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 4> { public: /** @@ -3654,7 +3640,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 4; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 4; /** * This function can be used to set all data fields to a given scalar. @@ -3763,7 +3749,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. The memory need not be aligned by 16 bytes, as opposed * to casting a float address to VectorizedArray*. */ @@ -3776,7 +3762,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. The memory need not be aligned by + * size() to the given address. The memory need not be aligned by * 16 bytes, as opposed to casting a float address to * VectorizedArray*. */ @@ -3800,14 +3786,14 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address and with given offsets, each entry from the offset * providing one element of the vectorized array. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * this->operator[](v) = base_ptr[offsets[v]]; * @endcode */ @@ -3821,13 +3807,13 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address and the given offsets, filling the + * size() to the given address and the given offsets, filling the * elements of the vectorized array into each offset. * * This operation corresponds to the following code (but uses a more * efficient implementation in case the hardware allows for that): * @code - * for (unsigned int v=0; v::n_array_elements; ++v) + * for (unsigned int v=0; v::size(); ++v) * base_ptr[offsets[v]] = this->operator[](v); * @endcode */ @@ -4122,7 +4108,7 @@ vectorized_transpose_and_store(const bool add_into, template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 2> { public: /** @@ -4133,7 +4119,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 2; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 2; /** * Default empty constructor, leaving the data in an uninitialized state @@ -4230,7 +4216,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. */ DEAL_II_ALWAYS_INLINE @@ -4242,7 +4228,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. + * size() to the given address. */ DEAL_II_ALWAYS_INLINE void @@ -4361,7 +4347,7 @@ private: template <> class VectorizedArray - : public VectorizedArrayBase> + : public VectorizedArrayBase, 4> { public: /** @@ -4372,7 +4358,7 @@ public: /** * This gives the number of vectors collected in this class. */ - static const unsigned int n_array_elements = 4; + DEAL_II_DEPRECATED static const unsigned int n_array_elements = 4; /** * Default empty constructor, leaving the data in an uninitialized state @@ -4469,7 +4455,7 @@ public: } /** - * Load @p n_array_elements from memory into the calling class, starting at + * Load @p size() from memory into the calling class, starting at * the given address. */ DEAL_II_ALWAYS_INLINE @@ -4481,7 +4467,7 @@ public: /** * Write the content of the calling class into memory in form of @p - * n_array_elements to the given address. + * size() to the given address. */ DEAL_II_ALWAYS_INLINE void @@ -4617,8 +4603,7 @@ inline DEAL_II_ALWAYS_INLINE bool operator==(const VectorizedArray &lhs, const VectorizedArray &rhs) { - for (unsigned int i = 0; i < VectorizedArray::n_array_elements; - ++i) + for (unsigned int i = 0; i < VectorizedArray::size(); ++i) if (lhs[i] != rhs[i]) return false; @@ -4684,7 +4669,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Addition of a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) and a vectorized array. + * size() equal entries) and a vectorized array. * * @relatesalso VectorizedArray */ @@ -4698,7 +4683,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Addition of a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) and a vectorized array in case the scalar + * size() equal entries) and a vectorized array in case the scalar * is a double (needed in order to be able to write simple code with constants * that are usually double numbers). * @@ -4714,7 +4699,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Addition of a vectorized array and a scalar (expanded to a vectorized array - * with @p n_array_elements equal entries). + * with @p size() equal entries). * * @relatesalso VectorizedArray */ @@ -4727,7 +4712,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Addition of a vectorized array and a scalar (expanded to a vectorized array - * with @p n_array_elements equal entries) in case the scalar is a double + * with @p size() equal entries) in case the scalar is a double * (needed in order to be able to write simple code with constants that are * usually double numbers). * @@ -4742,7 +4727,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Subtraction of a vectorized array from a scalar (expanded to a vectorized - * array with @p n_array_elements equal entries). + * array with @p size() equal entries). * * @relatesalso VectorizedArray */ @@ -4756,7 +4741,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Subtraction of a vectorized array from a scalar (expanded to a vectorized - * array with @p n_array_elements equal entries) in case the scalar is a + * array with @p size() equal entries) in case the scalar is a * double (needed in order to be able to write simple code with constants that * are usually double numbers). * @@ -4772,7 +4757,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Subtraction of a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) from a vectorized array. + * size() equal entries) from a vectorized array. * * @relatesalso VectorizedArray */ @@ -4786,7 +4771,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Subtraction of a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) from a vectorized array in case the scalar + * size() equal entries) from a vectorized array in case the scalar * is a double (needed in order to be able to write simple code with constants * that are usually double numbers). * @@ -4802,7 +4787,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Multiplication of a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) and a vectorized array. + * size() equal entries) and a vectorized array. * * @relatesalso VectorizedArray */ @@ -4816,7 +4801,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Multiplication of a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) and a vectorized array in case the scalar + * size() equal entries) and a vectorized array in case the scalar * is a double (needed in order to be able to write simple code with constants * that are usually double numbers). * @@ -4832,7 +4817,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Multiplication of a vectorized array and a scalar (expanded to a vectorized - * array with @p n_array_elements equal entries). + * array with @p size() equal entries). * * @relatesalso VectorizedArray */ @@ -4845,7 +4830,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Multiplication of a vectorized array and a scalar (expanded to a vectorized - * array with @p n_array_elements equal entries) in case the scalar is a + * array with @p size() equal entries) in case the scalar is a * double (needed in order to be able to write simple code with constants that * are usually double numbers). * @@ -4860,7 +4845,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Quotient between a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) and a vectorized array. + * size() equal entries) and a vectorized array. * * @relatesalso VectorizedArray */ @@ -4874,7 +4859,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Quotient between a scalar (expanded to a vectorized array with @p - * n_array_elements equal entries) and a vectorized array in case the scalar + * size() equal entries) and a vectorized array in case the scalar * is a double (needed in order to be able to write simple code with constants * that are usually double numbers). * @@ -4890,7 +4875,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Quotient between a vectorized array and a scalar (expanded to a vectorized - * array with @p n_array_elements equal entries). + * array with @p size() equal entries). * * @relatesalso VectorizedArray */ @@ -4904,7 +4889,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray /** * Quotient between a vectorized array and a scalar (expanded to a vectorized - * array with @p n_array_elements equal entries) in case the scalar is a + * array with @p size() equal entries) in case the scalar is a * double (needed in order to be able to write simple code with constants that * are usually double numbers). * @@ -4953,7 +4938,7 @@ template inline std::ostream & operator<<(std::ostream &out, const VectorizedArray &p) { - constexpr unsigned int n = VectorizedArray::n_array_elements; + constexpr unsigned int n = VectorizedArray::size(); for (unsigned int i = 0; i < n - 1; ++i) out << p[i] << ' '; out << p[n - 1]; @@ -5280,7 +5265,7 @@ namespace std /** * Compute the sine of a vectorized data field. The result is returned as * vectorized array in the form {sin(x[0]), sin(x[1]), ..., - * sin(x[n_array_elements-1])}. + * sin(x[VectorizedArray::size()-1])}. * * @relatesalso VectorizedArray */ @@ -5293,9 +5278,8 @@ namespace std // setting the individual elements and also circumvents a compiler // optimization bug in gcc-4.6 with SSE2 (see also deal.II developers list // from April 2014, topic "matrix_free/step-48 Test"). - Number values[::dealii::VectorizedArray::n_array_elements]; - for (unsigned int i = 0; - i < dealii::VectorizedArray::n_array_elements; + Number values[::dealii::VectorizedArray::size()]; + for (unsigned int i = 0; i < dealii::VectorizedArray::size(); ++i) values[i] = std::sin(x[i]); ::dealii::VectorizedArray out; @@ -5308,7 +5292,7 @@ namespace std /** * Compute the cosine of a vectorized data field. The result is returned as * vectorized array in the form {cos(x[0]), cos(x[1]), ..., - * cos(x[n_array_elements-1])}. + * cos(x[size()-1])}. * * @relatesalso VectorizedArray */ @@ -5316,9 +5300,8 @@ namespace std inline ::dealii::VectorizedArray cos(const ::dealii::VectorizedArray &x) { - Number values[::dealii::VectorizedArray::n_array_elements]; - for (unsigned int i = 0; - i < dealii::VectorizedArray::n_array_elements; + Number values[::dealii::VectorizedArray::size()]; + for (unsigned int i = 0; i < dealii::VectorizedArray::size(); ++i) values[i] = std::cos(x[i]); ::dealii::VectorizedArray out; @@ -5331,7 +5314,7 @@ namespace std /** * Compute the tangent of a vectorized data field. The result is returned * as vectorized array in the form {tan(x[0]), tan(x[1]), ..., - * tan(x[n_array_elements-1])}. + * tan(x[size()-1])}. * * @relatesalso VectorizedArray */ @@ -5339,9 +5322,8 @@ namespace std inline ::dealii::VectorizedArray tan(const ::dealii::VectorizedArray &x) { - Number values[::dealii::VectorizedArray::n_array_elements]; - for (unsigned int i = 0; - i < dealii::VectorizedArray::n_array_elements; + Number values[::dealii::VectorizedArray::size()]; + for (unsigned int i = 0; i < dealii::VectorizedArray::size(); ++i) values[i] = std::tan(x[i]); ::dealii::VectorizedArray out; @@ -5354,7 +5336,7 @@ namespace std /** * Compute the exponential of a vectorized data field. The result is * returned as vectorized array in the form {exp(x[0]), exp(x[1]), ..., - * exp(x[n_array_elements-1])}. + * exp(x[size()-1])}. * * @relatesalso VectorizedArray */ @@ -5362,9 +5344,8 @@ namespace std inline ::dealii::VectorizedArray exp(const ::dealii::VectorizedArray &x) { - Number values[::dealii::VectorizedArray::n_array_elements]; - for (unsigned int i = 0; - i < dealii::VectorizedArray::n_array_elements; + Number values[::dealii::VectorizedArray::size()]; + for (unsigned int i = 0; i < dealii::VectorizedArray::size(); ++i) values[i] = std::exp(x[i]); ::dealii::VectorizedArray out; @@ -5377,7 +5358,7 @@ namespace std /** * Compute the natural logarithm of a vectorized data field. The result is * returned as vectorized array in the form {log(x[0]), log(x[1]), ..., - * log(x[n_array_elements-1])}. + * log(x[size()-1])}. * * @relatesalso VectorizedArray */ @@ -5385,9 +5366,8 @@ namespace std inline ::dealii::VectorizedArray log(const ::dealii::VectorizedArray &x) { - Number values[::dealii::VectorizedArray::n_array_elements]; - for (unsigned int i = 0; - i < dealii::VectorizedArray::n_array_elements; + Number values[::dealii::VectorizedArray::size()]; + for (unsigned int i = 0; i < dealii::VectorizedArray::size(); ++i) values[i] = std::log(x[i]); ::dealii::VectorizedArray out; @@ -5400,7 +5380,7 @@ namespace std /** * Compute the square root of a vectorized data field. The result is * returned as vectorized array in the form {sqrt(x[0]), sqrt(x[1]), - * ..., sqrt(x[n_array_elements-1])}. + * ..., sqrt(x[size()-1])}. * * @relatesalso VectorizedArray */ @@ -5416,7 +5396,7 @@ namespace std /** * Raises the given number @p x to the power @p p for a vectorized data * field. The result is returned as vectorized array in the form - * {pow(x[0],p), pow(x[1],p), ..., pow(x[n_array_elements-1],p)}. + * {pow(x[0],p), pow(x[1],p), ..., pow(x[size()-1],p)}. * * @relatesalso VectorizedArray */ @@ -5424,9 +5404,8 @@ namespace std inline ::dealii::VectorizedArray pow(const ::dealii::VectorizedArray &x, const Number p) { - Number values[::dealii::VectorizedArray::n_array_elements]; - for (unsigned int i = 0; - i < dealii::VectorizedArray::n_array_elements; + Number values[::dealii::VectorizedArray::size()]; + for (unsigned int i = 0; i < dealii::VectorizedArray::size(); ++i) values[i] = std::pow(x[i], p); ::dealii::VectorizedArray out; @@ -5439,7 +5418,7 @@ namespace std /** * Compute the absolute value (modulus) of a vectorized data field. The * result is returned as vectorized array in the form {abs(x[0]), - * abs(x[1]), ..., abs(x[n_array_elements-1])}. + * abs(x[1]), ..., abs(x[size()-1])}. * * @relatesalso VectorizedArray */ diff --git a/include/deal.II/lac/tensor_product_matrix.h b/include/deal.II/lac/tensor_product_matrix.h index fba0b39829..061ff661ee 100644 --- a/include/deal.II/lac/tensor_product_matrix.h +++ b/include/deal.II/lac/tensor_product_matrix.h @@ -799,7 +799,7 @@ TensorProductMatrixSymmetricSum, n_rows_1d>:: this->mass_matrix = mass_matrix; this->derivative_matrix = derivative_matrix; - constexpr unsigned int macro_size = VectorizedArray::n_array_elements; + constexpr unsigned int macro_size = VectorizedArray::size(); std::size_t n_rows_max = (n_rows_1d > 0) ? n_rows_1d : 0; if (n_rows_1d == -1) for (unsigned int d = 0; d < dim; ++d) diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 21d72a7335..d4c4cd6e5e 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -764,9 +764,8 @@ namespace internal template struct Dot { - static const bool vectorizes = - std::is_same::value && - (VectorizedArray::n_array_elements > 1); + static constexpr bool vectorizes = std::is_same::value && + (VectorizedArray::size() > 1); Dot(const Number *const X, const Number2 *const Y) : X(X) @@ -806,8 +805,7 @@ namespace internal template struct Norm2 { - static const bool vectorizes = - VectorizedArray::n_array_elements > 1; + static const bool vectorizes = VectorizedArray::size() > 1; Norm2(const Number *const X) : X(X) @@ -833,8 +831,7 @@ namespace internal template struct Norm1 { - static const bool vectorizes = - VectorizedArray::n_array_elements > 1; + static const bool vectorizes = VectorizedArray::size() > 1; Norm1(const Number *X) : X(X) @@ -860,8 +857,7 @@ namespace internal template struct NormP { - static const bool vectorizes = - VectorizedArray::n_array_elements > 1; + static const bool vectorizes = VectorizedArray::size() > 1; NormP(const Number *X, RealType p) : X(X) @@ -889,8 +885,7 @@ namespace internal template struct MeanValue { - static const bool vectorizes = - VectorizedArray::n_array_elements > 1; + static const bool vectorizes = VectorizedArray::size() > 1; MeanValue(const Number *X) : X(X) @@ -916,8 +911,7 @@ namespace internal template struct AddAndDot { - static const bool vectorizes = - VectorizedArray::n_array_elements > 1; + static const bool vectorizes = VectorizedArray::size() > 1; AddAndDot(Number *const X, const Number *const V, @@ -1202,8 +1196,8 @@ namespace internal // First we work on (n_chunks/nvecs) chunks, where each chunk processes // nvecs*(4*8) elements. - const unsigned int nvecs = VectorizedArray::n_array_elements; - const size_type regular_chunks = n_chunks / nvecs; + constexpr unsigned int nvecs = VectorizedArray::size(); + const size_type regular_chunks = n_chunks / nvecs; for (size_type i = 0; i < regular_chunks; ++i) { VectorizedArray r0 = op.do_vectorized(index); @@ -1221,8 +1215,7 @@ namespace internal r0 += r1; r2 += r3; r0 += r2; - r0.store( - &outer_results[i * VectorizedArray::n_array_elements]); + r0.store(&outer_results[i * nvecs]); } // If we are treating a case where the vector length is not divisible by @@ -1231,9 +1224,12 @@ namespace internal // regular_chunks * nvecs; We do as much as possible with 2 SIMD // operations within each chunk. Here we assume that nvecs < 32/2 = 16 as // well as 16%nvecs==0. - AssertIndexRange(VectorizedArray::n_array_elements, 17); + static_assert( + VectorizedArray::size() <= 16 && + 16 % VectorizedArray::size() == 0, + "VectorizedArray::size() must be a power of 2 and not more than 16"); Assert(16 % nvecs == 0, ExcInternalError()); - if (n_chunks % VectorizedArray::n_array_elements != 0) + if (n_chunks % nvecs != 0) { VectorizedArray r0 = VectorizedArray(), r1 = VectorizedArray(); @@ -1248,7 +1244,7 @@ namespace internal r0.store(&outer_results[start_irreg]); // update n_chunks to denote unused element in outer_results[] from // which we can keep writing. - n_chunks = start_irreg + VectorizedArray::n_array_elements; + n_chunks = start_irreg + VectorizedArray::size(); } } diff --git a/include/deal.II/matrix_free/dof_info.h b/include/deal.II/matrix_free/dof_info.h index 37d684d309..7da0f1bf1c 100644 --- a/include/deal.II/matrix_free/dof_info.h +++ b/include/deal.II/matrix_free/dof_info.h @@ -381,7 +381,7 @@ namespace internal * cells batched together. As opposed to the other classes which are * templated on the number type, this class as a pure index container is * not templated, so we need to keep the information otherwise contained - * in VectorizedArrayType::n_array_elements. + * in VectorizedArrayType::size(). */ unsigned int vectorization_length; diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 79623b3e8a..090b985625 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -1739,7 +1739,7 @@ namespace internal void do_vectorized_read(const Number2 *src_ptr, VectorizedArrayType &dst) { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dst[v] = src_ptr[v]; } @@ -1763,7 +1763,7 @@ namespace internal const unsigned int * indices, VectorizedArrayType &dst) { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dst[v] = src_ptr[indices[v]]; } @@ -1787,7 +1787,7 @@ namespace internal void do_vectorized_add(const VectorizedArrayType src, Number2 *dst_ptr) { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dst_ptr[v] += src[v]; } @@ -1813,7 +1813,7 @@ namespace internal const unsigned int * indices, Number2 * dst_ptr) { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dst_ptr[indices[v]] += src[v]; } @@ -2089,13 +2089,14 @@ namespace internal { AssertDimension( dof_info.n_vectorization_lanes_filled[dof_access_index][cell], - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); const unsigned int dof_index = - dof_info.dof_indices_contiguous - [dof_access_index][cell * VectorizedArrayType::n_array_elements] + + dof_info + .dof_indices_contiguous[dof_access_index] + [cell * VectorizedArrayType::size()] + dof_info.component_dof_indices_offset[active_fe_index] [first_selected_component] * - VectorizedArrayType::n_array_elements; + VectorizedArrayType::size(); if (fe_degree > 1 && evaluate_gradients == true) { @@ -2116,15 +2117,15 @@ namespace internal AssertIndexRange(ind2, data.dofs_per_component_on_cell); for (unsigned int comp = 0; comp < n_components; ++comp) { - do_vectorized_read( - src_ptr + dof_index + - (ind1 + comp * static_dofs_per_component) * - VectorizedArrayType::n_array_elements, - temp1[i + 2 * comp * dofs_per_face]); + do_vectorized_read(src_ptr + dof_index + + (ind1 + + comp * static_dofs_per_component) * + VectorizedArrayType::size(), + temp1[i + 2 * comp * dofs_per_face]); do_vectorized_read( src_ptr + dof_index + (ind2 + comp * static_dofs_per_component) * - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), temp1[dofs_per_face + i + 2 * comp * dofs_per_face]); temp1[i + dofs_per_face + 2 * comp * dofs_per_face] = grad_weight * @@ -2143,11 +2144,11 @@ namespace internal { const unsigned int ind = index_array[i]; for (unsigned int comp = 0; comp < n_components; ++comp) - do_vectorized_read( - src_ptr + dof_index + - (ind + comp * static_dofs_per_component) * - VectorizedArrayType::n_array_elements, - temp1[i + 2 * comp * dofs_per_face]); + do_vectorized_read(src_ptr + dof_index + + (ind + + comp * static_dofs_per_component) * + VectorizedArrayType::size(), + temp1[i + 2 * comp * dofs_per_face]); } } } @@ -2164,10 +2165,11 @@ namespace internal { AssertDimension( dof_info.n_vectorization_lanes_filled[dof_access_index][cell], - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); const unsigned int *indices = - &dof_info.dof_indices_contiguous - [dof_access_index][cell * VectorizedArrayType::n_array_elements]; + &dof_info + .dof_indices_contiguous[dof_access_index] + [cell * VectorizedArrayType::size()]; if (fe_degree > 1 && evaluate_gradients == true) { // we know that the gradient weights for the Hermite case on the @@ -2183,29 +2185,28 @@ namespace internal for (unsigned int i = 0; i < dofs_per_face; ++i) { const unsigned int ind1 = - index_array[2 * i] * VectorizedArrayType::n_array_elements; + index_array[2 * i] * VectorizedArrayType::size(); const unsigned int ind2 = - index_array[2 * i + 1] * - VectorizedArrayType::n_array_elements; + index_array[2 * i + 1] * VectorizedArrayType::size(); for (unsigned int comp = 0; comp < n_components; ++comp) { do_vectorized_gather( src_ptr + ind1 + comp * static_dofs_per_component * - VectorizedArrayType::n_array_elements + + VectorizedArrayType::size() + dof_info.component_dof_indices_offset [active_fe_index][first_selected_component] * - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), indices, temp1[i + 2 * comp * dofs_per_face]); VectorizedArrayType grad; do_vectorized_gather( src_ptr + ind2 + comp * static_dofs_per_component * - VectorizedArrayType::n_array_elements + + VectorizedArrayType::size() + dof_info.component_dof_indices_offset [active_fe_index][first_selected_component] * - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), indices, grad); temp1[i + dofs_per_face + 2 * comp * dofs_per_face] = @@ -2223,15 +2224,15 @@ namespace internal for (unsigned int i = 0; i < dofs_per_face; ++i) { const unsigned int ind = - index_array[i] * VectorizedArrayType::n_array_elements; + index_array[i] * VectorizedArrayType::size(); for (unsigned int comp = 0; comp < n_components; ++comp) do_vectorized_gather( src_ptr + ind + comp * static_dofs_per_component * - VectorizedArrayType::n_array_elements + + VectorizedArrayType::size() + dof_info.component_dof_indices_offset [active_fe_index][first_selected_component] * - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), indices, temp1[i + 2 * comp * dofs_per_face]); } @@ -2250,14 +2251,12 @@ namespace internal { const unsigned int *strides = &dof_info.dof_indices_interleave_strides - [dof_access_index][cell * VectorizedArrayType::n_array_elements]; - unsigned int indices[VectorizedArrayType::n_array_elements]; - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; - ++v) + [dof_access_index][cell * VectorizedArrayType::size()]; + unsigned int indices[VectorizedArrayType::size()]; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) indices[v] = dof_info.dof_indices_contiguous - [dof_access_index] - [cell * VectorizedArrayType::n_array_elements + v] + + [dof_access_index][cell * VectorizedArrayType::size() + v] + dof_info.component_dof_indices_offset[active_fe_index] [first_selected_component] * strides[v]; @@ -2276,23 +2275,21 @@ namespace internal const unsigned int *index_array = &data.face_to_cell_index_hermite(face_no, 0); - if (nvec == VectorizedArrayType::n_array_elements) + if (nvec == VectorizedArrayType::size()) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { - unsigned int ind1[VectorizedArrayType::n_array_elements]; + unsigned int ind1[VectorizedArrayType::size()]; DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) ind1[v] = indices[v] + (comp * static_dofs_per_component + index_array[2 * i]) * strides[v]; - unsigned int ind2[VectorizedArrayType::n_array_elements]; + unsigned int ind2[VectorizedArrayType::size()]; DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) ind2[v] = indices[v] + (comp * static_dofs_per_component + @@ -2340,14 +2337,13 @@ namespace internal dofs_per_face); const unsigned int *index_array = &data.face_to_cell_index_nodal(face_no, 0); - if (nvec == VectorizedArrayType::n_array_elements) + if (nvec == VectorizedArrayType::size()) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { - unsigned int ind[VectorizedArrayType::n_array_elements]; + unsigned int ind[VectorizedArrayType::size()]; DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) ind[v] = indices[v] + @@ -2387,11 +2383,12 @@ namespace internal MatrixFreeFunctions::DoFInfo::IndexStorageVariants:: contiguous && dof_info.n_vectorization_lanes_filled[dof_access_index][cell] == - VectorizedArrayType::n_array_elements) + VectorizedArrayType::size()) { const unsigned int *indices = - &dof_info.dof_indices_contiguous - [dof_access_index][cell * VectorizedArrayType::n_array_elements]; + &dof_info + .dof_indices_contiguous[dof_access_index] + [cell * VectorizedArrayType::size()]; if (evaluate_gradients == true && data.element_type == MatrixFreeFunctions::tensor_symmetric_hermite) @@ -2607,13 +2604,14 @@ namespace internal { AssertDimension( dof_info.n_vectorization_lanes_filled[dof_access_index][cell], - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); const unsigned int dof_index = - dof_info.dof_indices_contiguous - [dof_access_index][cell * VectorizedArrayType::n_array_elements] + + dof_info + .dof_indices_contiguous[dof_access_index] + [cell * VectorizedArrayType::size()] + dof_info.component_dof_indices_offset[active_fe_index] [first_selected_component] * - VectorizedArrayType::n_array_elements; + VectorizedArrayType::size(); if (fe_degree > 1 && integrate_gradients == true) { @@ -2641,16 +2639,16 @@ namespace internal VectorizedArrayType grad = grad_weight * temp1[i + dofs_per_face + 2 * comp * dofs_per_face]; - do_vectorized_add( - val, - dst_ptr + dof_index + - (ind1 + comp * static_dofs_per_component) * - VectorizedArrayType::n_array_elements); - do_vectorized_add( - grad, - dst_ptr + dof_index + - (ind2 + comp * static_dofs_per_component) * - VectorizedArrayType::n_array_elements); + do_vectorized_add(val, + dst_ptr + dof_index + + (ind1 + + comp * static_dofs_per_component) * + VectorizedArrayType::size()); + do_vectorized_add(grad, + dst_ptr + dof_index + + (ind2 + + comp * static_dofs_per_component) * + VectorizedArrayType::size()); } } } @@ -2664,11 +2662,11 @@ namespace internal { const unsigned int ind = index_array[i]; for (unsigned int comp = 0; comp < n_components; ++comp) - do_vectorized_add( - temp1[i + 2 * comp * dofs_per_face], - dst_ptr + dof_index + - (ind + comp * static_dofs_per_component) * - VectorizedArrayType::n_array_elements); + do_vectorized_add(temp1[i + 2 * comp * dofs_per_face], + dst_ptr + dof_index + + (ind + + comp * static_dofs_per_component) * + VectorizedArrayType::size()); } } } @@ -2685,10 +2683,11 @@ namespace internal { AssertDimension( dof_info.n_vectorization_lanes_filled[dof_access_index][cell], - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); const unsigned int *indices = - &dof_info.dof_indices_contiguous - [dof_access_index][cell * VectorizedArrayType::n_array_elements]; + &dof_info + .dof_indices_contiguous[dof_access_index] + [cell * VectorizedArrayType::size()]; if (fe_degree > 1 && integrate_gradients == true) { // we know that the gradient weights for the Hermite case on the @@ -2704,10 +2703,9 @@ namespace internal for (unsigned int i = 0; i < dofs_per_face; ++i) { const unsigned int ind1 = - index_array[2 * i] * VectorizedArrayType::n_array_elements; + index_array[2 * i] * VectorizedArrayType::size(); const unsigned int ind2 = - index_array[2 * i + 1] * - VectorizedArrayType::n_array_elements; + index_array[2 * i + 1] * VectorizedArrayType::size(); for (unsigned int comp = 0; comp < n_components; ++comp) { VectorizedArrayType val = @@ -2722,19 +2720,19 @@ namespace internal indices, dst_ptr + ind1 + comp * static_dofs_per_component * - VectorizedArrayType::n_array_elements + + VectorizedArrayType::size() + dof_info.component_dof_indices_offset [active_fe_index][first_selected_component] * - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); do_vectorized_scatter_add( grad, indices, dst_ptr + ind2 + comp * static_dofs_per_component * - VectorizedArrayType::n_array_elements + + VectorizedArrayType::size() + dof_info.component_dof_indices_offset [active_fe_index][first_selected_component] * - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); } } } @@ -2747,17 +2745,17 @@ namespace internal for (unsigned int i = 0; i < dofs_per_face; ++i) { const unsigned int ind = - index_array[i] * VectorizedArrayType::n_array_elements; + index_array[i] * VectorizedArrayType::size(); for (unsigned int comp = 0; comp < n_components; ++comp) do_vectorized_scatter_add( temp1[i + 2 * comp * dofs_per_face], indices, dst_ptr + ind + comp * static_dofs_per_component * - VectorizedArrayType::n_array_elements + + VectorizedArrayType::size() + dof_info.component_dof_indices_offset [active_fe_index][first_selected_component] * - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); } } } @@ -2774,14 +2772,12 @@ namespace internal { const unsigned int *strides = &dof_info.dof_indices_interleave_strides - [dof_access_index][cell * VectorizedArrayType::n_array_elements]; - unsigned int indices[VectorizedArrayType::n_array_elements]; - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; - ++v) + [dof_access_index][cell * VectorizedArrayType::size()]; + unsigned int indices[VectorizedArrayType::size()]; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) indices[v] = dof_info.dof_indices_contiguous - [dof_access_index] - [cell * VectorizedArrayType::n_array_elements + v] + + [dof_access_index][cell * VectorizedArrayType::size() + v] + dof_info.component_dof_indices_offset[active_fe_index] [first_selected_component] * strides[v]; @@ -2800,23 +2796,21 @@ namespace internal const unsigned int *index_array = &data.face_to_cell_index_hermite(face_no, 0); - if (nvec == VectorizedArrayType::n_array_elements) + if (nvec == VectorizedArrayType::size()) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { - unsigned int ind1[VectorizedArrayType::n_array_elements]; + unsigned int ind1[VectorizedArrayType::size()]; DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) ind1[v] = indices[v] + (comp * static_dofs_per_component + index_array[2 * i]) * strides[v]; - unsigned int ind2[VectorizedArrayType::n_array_elements]; + unsigned int ind2[VectorizedArrayType::size()]; DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) ind2[v] = indices[v] + (comp * static_dofs_per_component + @@ -2864,14 +2858,13 @@ namespace internal dofs_per_face); const unsigned int *index_array = &data.face_to_cell_index_nodal(face_no, 0); - if (nvec == VectorizedArrayType::n_array_elements) + if (nvec == VectorizedArrayType::size()) for (unsigned int comp = 0; comp < n_components; ++comp) for (unsigned int i = 0; i < dofs_per_face; ++i) { - unsigned int ind[VectorizedArrayType::n_array_elements]; + unsigned int ind[VectorizedArrayType::size()]; DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) ind[v] = indices[v] + @@ -2907,11 +2900,12 @@ namespace internal internal::MatrixFreeFunctions::DoFInfo::IndexStorageVariants:: contiguous && dof_info.n_vectorization_lanes_filled[dof_access_index][cell] == - VectorizedArrayType::n_array_elements) + VectorizedArrayType::size()) { const unsigned int *indices = - &dof_info.dof_indices_contiguous - [dof_access_index][cell * VectorizedArrayType::n_array_elements]; + &dof_info + .dof_indices_contiguous[dof_access_index] + [cell * VectorizedArrayType::size()]; if (integrate_gradients == true && data.element_type == diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 8d4e14d739..35f6d577b1 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -179,7 +179,7 @@ public: * on the given cell. This call is slower than the ones done through a * MatrixFree object and lead to a structure that does not effectively use * vectorization in the evaluate routines based on these values (instead, - * VectorizedArray::n_array_elements same copies are worked on). + * VectorizedArray::size() same copies are worked on). * * If the given vector template class is a block vector (determined through * the template function 'IsBlockVector::value', which checks @@ -211,7 +211,7 @@ public: * on the given cell. This call is slower than the ones done through a * MatrixFree object and lead to a structure that does not effectively use * vectorization in the evaluate routines based on these values (instead, - * VectorizedArray::n_array_elements same copies are worked on). + * VectorizedArray::size() same copies are worked on). * * If the given vector template class is a block vector (determined through * the template function 'IsBlockVector::value', which checks @@ -246,7 +246,7 @@ public: * on the given cell. This call is slower than the ones done through a * MatrixFree object and lead to a structure that does not effectively use * vectorization in the evaluate routines based on these values (instead, - * VectorizedArray::n_array_elements same copies are worked on). + * VectorizedArray::size() same copies are worked on). * * If the given vector template class is a block vector (determined through * the template function 'IsBlockVector::value', which checks @@ -258,10 +258,10 @@ public: template void distribute_local_to_global( - VectorType & dst, - const unsigned int first_index = 0, - const std::bitset &mask = - std::bitset().flip()) const; + VectorType & dst, + const unsigned int first_index = 0, + const std::bitset &mask = + std::bitset().flip()) const; /** * Takes the values stored internally on dof values of the current cell and @@ -286,7 +286,7 @@ public: * on the given cell. This call is slower than the ones done through a * MatrixFree object and lead to a structure that does not effectively use * vectorization in the evaluate routines based on these values (instead, - * VectorizedArray::n_array_elements same copies are worked on). + * VectorizedArray::size() same copies are worked on). * * If the given vector template class is a block vector (determined through * the template function 'IsBlockVector::value', which checks @@ -297,11 +297,10 @@ public: */ template void - set_dof_values( - VectorType & dst, - const unsigned int first_index = 0, - const std::bitset &mask = - std::bitset().flip()) const; + set_dof_values(VectorType & dst, + const unsigned int first_index = 0, + const std::bitset &mask = + std::bitset().flip()) const; //@} @@ -606,16 +605,15 @@ public: * arbitrary data type. */ template - std::array - read_cell_data( - const AlignedVector> - &array) const; + std::array + read_cell_data(const AlignedVector> + &array) const; /** * Return the id of the cells this FEEvaluation or FEFaceEvaluation is * associated with. */ - std::array + std::array get_cell_ids() const; //@} @@ -838,11 +836,10 @@ protected: */ template void - read_write_operation( - const VectorOperation & operation, - VectorType * vectors[], - const std::bitset &mask, - const bool apply_constraints = true) const; + read_write_operation(const VectorOperation &operation, + VectorType * vectors[], + const std::bitset &mask, + const bool apply_constraints = true) const; /** * A unified function to read from and write into vectors based on the given @@ -854,9 +851,9 @@ protected: template void read_write_operation_contiguous( - const VectorOperation & operation, - VectorType * vectors[], - const std::bitset &mask) const; + const VectorOperation & operation, + VectorType * vectors[], + const std::bitset &mask) const; /** * A unified function to read from and write into vectors based on the given @@ -1757,9 +1754,7 @@ protected: * phi.quadrature_point(q_index); * // Need to evaluate function for each component in VectorizedArray * VectorizedArray f_value; - * for (unsigned int v=0; - * v::n_array_elements; - * ++v) + * for (unsigned int v=0; v::size(); ++v) * { * Point p; * for (unsigned int d=0; d::n_array_elements) + * i += VectorizedArray::size()) * { * const unsigned int n_items = - * i+VectorizedArray::n_array_elements > dofs_per_cell ? + * i+VectorizedArray::size() > dofs_per_cell ? * (dofs_per_cell - i) : - * VectorizedArray::n_array_elements; + * VectorizedArray::size(); * * // Set n_items unit vectors * for (unsigned int j=0; jmapping_initialized() == true, ExcNotInitialized()); AssertDimension(matrix_info->get_task_info().vectorization_length, - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); AssertDimension((is_face ? data->n_q_points_face : data->n_q_points), n_quadrature_points); AssertDimension(n_quadrature_points, @@ -3564,12 +3559,12 @@ template -std::array +std::array FEEvaluationBase:: get_cell_ids() const { - const unsigned int v_len = VectorizedArrayType::n_array_elements; - std::array cells; + const unsigned int v_len = VectorizedArrayType::size(); + std::array cells; // initialize array for (unsigned int i = 0; i < v_len; ++i) @@ -3627,7 +3622,7 @@ FEEvaluationBase:: is_interior_face ? &this->matrix_info->get_face_info(cell).cells_interior[0] : &this->matrix_info->get_face_info(cell).cells_exterior[0]; - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; ++i) + for (unsigned int i = 0; i < VectorizedArrayType::size(); ++i) if (cells_[i] != numbers::invalid_unsigned_int) cells[i] = cells_[i]; } @@ -3655,10 +3650,10 @@ FEEvaluationBase:: // 2) actually gather values VectorizedArrayType out = make_vectorized_array(Number(1.)); - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; ++i) + for (unsigned int i = 0; i < VectorizedArrayType::size(); ++i) if (cells[i] != numbers::invalid_unsigned_int) - out[i] = array[cells[i] / VectorizedArrayType::n_array_elements] - [cells[i] % VectorizedArrayType::n_array_elements]; + out[i] = array[cells[i] / VectorizedArrayType::size()] + [cells[i] % VectorizedArrayType::size()]; return out; } @@ -3670,11 +3665,10 @@ template template -inline std::array +inline std::array FEEvaluationBase:: - read_cell_data( - const AlignedVector> - &array) const + read_cell_data(const AlignedVector> + &array) const { Assert(matrix_info != nullptr, ExcNotImplemented()); AssertDimension(array.size(), @@ -3684,11 +3678,11 @@ FEEvaluationBase:: const auto cells = this->get_cell_ids(); // 2) actually gather values - std::array out; - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; ++i) + std::array out; + for (unsigned int i = 0; i < VectorizedArrayType::size(); ++i) if (cells[i] != numbers::invalid_unsigned_int) - out[i] = array[cells[i] / VectorizedArrayType::n_array_elements] - [cells[i] % VectorizedArrayType::n_array_elements]; + out[i] = array[cells[i] / VectorizedArrayType::size()] + [cells[i] % VectorizedArrayType::size()]; return out; } @@ -3780,11 +3774,10 @@ template inline void FEEvaluationBase:: - read_write_operation( - const VectorOperation & operation, - VectorType * src[], - const std::bitset &mask, - const bool apply_constraints) const + read_write_operation(const VectorOperation &operation, + VectorType * src[], + const std::bitset &mask, + const bool apply_constraints) const { // Case 1: No MatrixFree object given, simple case because we do not need to // process constraints and need not care about vectorization -> go to @@ -3831,8 +3824,7 @@ FEEvaluationBase:: // Case 3: standard operation with one index per degree of freedom -> go on // here - constexpr unsigned int n_vectorization = - VectorizedArrayType::n_array_elements; + constexpr unsigned int n_vectorization = VectorizedArrayType::size(); Assert(mask.count() == n_vectorization, ExcNotImplemented("Masking currently not implemented for " "non-contiguous DoF storage")); @@ -3889,7 +3881,7 @@ FEEvaluationBase:: if (dof_access_index == internal::MatrixFreeFunctions::DoFInfo::dof_access_cell) for (unsigned int v = 0; v < n_vectorization_actual; ++v) - cells_copied[v] = cell * VectorizedArrayType::n_array_elements + v; + cells_copied[v] = cell * VectorizedArrayType::size() + v; cells = dof_access_index == internal::MatrixFreeFunctions::DoFInfo::dof_access_cell ? &cells_copied[0] : @@ -4209,9 +4201,9 @@ template inline void FEEvaluationBase:: read_write_operation_contiguous( - const VectorOperation & operation, - VectorType * src[], - const std::bitset &mask) const + const VectorOperation & operation, + VectorType * src[], + const std::bitset &mask) const { // This functions processes the functions read_dof_values, // distribute_local_to_global, and set_dof_values with the same code for @@ -4236,13 +4228,13 @@ FEEvaluationBase:: if (dof_info->index_storage_variants[ind][cell] == internal::MatrixFreeFunctions::DoFInfo::IndexStorageVariants:: interleaved_contiguous && - n_lanes == VectorizedArrayType::n_array_elements) + n_lanes == VectorizedArrayType::size()) { const unsigned int dof_index = - dof_indices_cont[cell * VectorizedArrayType::n_array_elements] + + dof_indices_cont[cell * VectorizedArrayType::size()] + dof_info->component_dof_indices_offset[active_fe_index] [first_selected_component] * - VectorizedArrayType::n_array_elements; + VectorizedArrayType::size(); if (n_components == 1 || n_fe_components == 1) for (unsigned int comp = 0; comp < n_components; ++comp) operation.process_dofs_vectorized(data->dofs_per_component_on_cell, @@ -4265,24 +4257,24 @@ FEEvaluationBase:: const unsigned int vectorization_populated = dof_info->n_vectorization_lanes_filled[ind][this->cell]; - unsigned int dof_indices[VectorizedArrayType::n_array_elements]; + unsigned int dof_indices[VectorizedArrayType::size()]; for (unsigned int v = 0; v < vectorization_populated; ++v) dof_indices[v] = - dof_indices_cont[cell * VectorizedArrayType::n_array_elements + v] + + dof_indices_cont[cell * VectorizedArrayType::size() + v] + dof_info->component_dof_indices_offset[active_fe_index] [first_selected_component] * dof_info->dof_indices_interleave_strides - [ind][cell * VectorizedArrayType::n_array_elements + v]; + [ind][cell * VectorizedArrayType::size() + v]; for (unsigned int v = vectorization_populated; - v < VectorizedArrayType::n_array_elements; + v < VectorizedArrayType::size(); ++v) dof_indices[v] = numbers::invalid_unsigned_int; // In the case with contiguous cell indices, we know that there are no // constraints and that the indices within each element are contiguous - if (vectorization_populated == VectorizedArrayType::n_array_elements && - n_lanes == VectorizedArrayType::n_array_elements) + if (vectorization_populated == VectorizedArrayType::size() && + n_lanes == VectorizedArrayType::size()) { if (dof_info->index_storage_variants[ind][cell] == internal::MatrixFreeFunctions::DoFInfo::IndexStorageVariants:: @@ -4312,12 +4304,11 @@ FEEvaluationBase:: for (unsigned int i = 0; i < data->dofs_per_component_on_cell; ++i) { for (unsigned int comp = 0; comp < n_components; ++comp) - operation.process_dof_gather( - dof_indices, - *src[comp], - i * VectorizedArrayType::n_array_elements, - values_dofs[comp][i], - vector_selector); + operation.process_dof_gather(dof_indices, + *src[comp], + i * VectorizedArrayType::size(), + values_dofs[comp][i], + vector_selector); } else for (unsigned int comp = 0; comp < n_components; ++comp) @@ -4328,7 +4319,7 @@ FEEvaluationBase:: dof_indices, *src[0], (comp * data->dofs_per_component_on_cell + i) * - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), values_dofs[comp][i], vector_selector); } @@ -4341,7 +4332,7 @@ FEEvaluationBase:: ExcNotImplemented()); const unsigned int *offsets = &dof_info->dof_indices_interleave_strides - [ind][VectorizedArrayType::n_array_elements * cell]; + [ind][VectorizedArrayType::size() * cell]; if (n_components == 1 || n_fe_components == 1) for (unsigned int i = 0; i < data->dofs_per_component_on_cell; ++i) { @@ -4352,9 +4343,7 @@ FEEvaluationBase:: values_dofs[comp][i], vector_selector); DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dof_indices[v] += offsets[v]; } else @@ -4368,9 +4357,7 @@ FEEvaluationBase:: values_dofs[comp][i], vector_selector); DEAL_II_OPENMP_SIMD_PRAGMA - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dof_indices[v] += offsets[v]; } } @@ -4413,10 +4400,9 @@ FEEvaluationBase:: { const unsigned int *offsets = &dof_info->dof_indices_interleave_strides - [ind][VectorizedArrayType::n_array_elements * cell]; + [ind][VectorizedArrayType::size() * cell]; for (unsigned int v = 0; v < vectorization_populated; ++v) - AssertIndexRange(offsets[v], - VectorizedArrayType::n_array_elements + 1); + AssertIndexRange(offsets[v], VectorizedArrayType::size() + 1); if (n_components == 1 || n_fe_components == 1) for (unsigned int v = 0; v < vectorization_populated; ++v) { @@ -4470,11 +4456,10 @@ FEEvaluationBase:: get_vector_component(const_cast(src), d + first_index); internal::VectorReader reader; - read_write_operation( - reader, - src_data, - std::bitset().flip(), - true); + read_write_operation(reader, + src_data, + std::bitset().flip(), + true); # ifdef DEBUG dof_values_initialized = true; @@ -4505,11 +4490,10 @@ FEEvaluationBase:: get_vector_component(const_cast(src), d + first_index); internal::VectorReader reader; - read_write_operation( - reader, - src_data, - std::bitset().flip(), - false); + read_write_operation(reader, + src_data, + std::bitset().flip(), + false); # ifdef DEBUG dof_values_initialized = true; @@ -4527,9 +4511,9 @@ template inline void FEEvaluationBase:: distribute_local_to_global( - VectorType & dst, - const unsigned int first_index, - const std::bitset &mask) const + VectorType & dst, + const unsigned int first_index, + const std::bitset &mask) const { # ifdef DEBUG Assert(dof_values_initialized == true, @@ -4562,10 +4546,9 @@ template inline void FEEvaluationBase:: - set_dof_values( - VectorType & dst, - const unsigned int first_index, - const std::bitset &mask) const + set_dof_values(VectorType & dst, + const unsigned int first_index, + const std::bitset &mask) const { # ifdef DEBUG Assert(dof_values_initialized == true, @@ -7090,7 +7073,7 @@ FEEvaluation< input_vector.begin() + this->dof_info->dof_indices_contiguous [internal::MatrixFreeFunctions::DoFInfo::dof_access_cell] - [this->cell * VectorizedArrayType::n_array_elements]) % + [this->cell * VectorizedArrayType::size()]) % sizeof(VectorizedArrayType) == 0) { @@ -7099,11 +7082,11 @@ FEEvaluation< input_vector.begin() + this->dof_info->dof_indices_contiguous [internal::MatrixFreeFunctions::DoFInfo::dof_access_cell] - [this->cell * VectorizedArrayType::n_array_elements] + + [this->cell * VectorizedArrayType::size()] + this->dof_info ->component_dof_indices_offset[this->active_fe_index] [this->first_selected_component] * - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); evaluate(vec_values, evaluate_values, @@ -7226,7 +7209,7 @@ FEEvaluation< destination.begin() + this->dof_info->dof_indices_contiguous [internal::MatrixFreeFunctions::DoFInfo::dof_access_cell] - [this->cell * VectorizedArrayType::n_array_elements]) % + [this->cell * VectorizedArrayType::size()]) % sizeof(VectorizedArrayType) == 0) { @@ -7234,11 +7217,11 @@ FEEvaluation< destination.begin() + this->dof_info->dof_indices_contiguous [internal::MatrixFreeFunctions::DoFInfo::dof_access_cell] - [this->cell * VectorizedArrayType::n_array_elements] + + [this->cell * VectorizedArrayType::size()] + this->dof_info ->component_dof_indices_offset[this->active_fe_index] [this->first_selected_component] * - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); SelectEvaluatormapping_data != nullptr, ExcNotInitialized()); - const unsigned int n_vectors = VectorizedArrayType::n_array_elements; + const unsigned int n_vectors = VectorizedArrayType::size(); const internal::MatrixFreeFunctions::FaceToCellTopology &faces = this->matrix_info->get_face_info(face_index); if (face_index >= diff --git a/include/deal.II/matrix_free/mapping_info.h b/include/deal.II/matrix_free/mapping_info.h index 6d43632194..120fa1379c 100644 --- a/include/deal.II/matrix_free/mapping_info.h +++ b/include/deal.II/matrix_free/mapping_info.h @@ -327,7 +327,7 @@ namespace internal initialize( const dealii::Triangulation & tria, const std::vector> &cells, - const FaceInfo & faces, + const FaceInfo & faces, const std::vector & active_fe_index, const Mapping & mapping, const std::vector> &quad, @@ -346,7 +346,7 @@ namespace internal update_mapping( const dealii::Triangulation & tria, const std::vector> &cells, - const FaceInfo & faces, + const FaceInfo & faces, const std::vector &active_fe_index, const Mapping & mapping); @@ -460,9 +460,9 @@ namespace internal initialize_faces( const dealii::Triangulation & tria, const std::vector> &cells, - const std::vector< - FaceToCellTopology> &faces, - const Mapping & mapping); + const std::vector> + & faces, + const Mapping &mapping); /** * Computes the information in the given faces, called within @@ -545,32 +545,23 @@ namespace internal bool operator()( - const Tensor<1, VectorizedArrayType::n_array_elements, Number> &t1, - const Tensor<1, VectorizedArrayType::n_array_elements, Number> &t2) - const; + const Tensor<1, VectorizedArrayType::size(), Number> &t1, + const Tensor<1, VectorizedArrayType::size(), Number> &t2) const; template bool operator()( - const Tensor<1, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> + const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t1, - const Tensor<1, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> + const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t2) const; template bool operator()( - const Tensor<2, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> + const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t1, - const Tensor<2, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> + const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t2) const; Number tolerance; diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 6b192976e4..18882a192a 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -299,7 +299,7 @@ namespace internal MappingInfo::initialize( const dealii::Triangulation & tria, const std::vector> &cells, - const FaceInfo & face_info, + const FaceInfo & face_info, const std::vector & active_fe_index, const Mapping & mapping, const std::vector> & quad, @@ -363,11 +363,11 @@ namespace internal MappingInfo::update_mapping( const dealii::Triangulation & tria, const std::vector> &cells, - const FaceInfo & face_info, + const FaceInfo & face_info, const std::vector & active_fe_index, const Mapping & mapping) { - AssertDimension(cells.size() / VectorizedArrayType::n_array_elements, + AssertDimension(cells.size() / VectorizedArrayType::size(), cell_type.size()); for (auto &data : cell_data) @@ -413,12 +413,9 @@ namespace internal : data(FPArrayComparator(expected_size)) {} - std::map< - Tensor<2, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>>, - unsigned int, - FPArrayComparator> + std::map>, + unsigned int, + FPArrayComparator> data; }; @@ -471,14 +468,13 @@ namespace internal */ template void - evaluate_on_cell( - const dealii::Triangulation & tria, - const std::pair *cells, - const unsigned int my_q, - GeometryType & cell_t_prev, - GeometryType (&cell_t)[VectorizedArrayType::n_array_elements], - dealii::FEValues & fe_val, - LocalData &cell_data) + evaluate_on_cell(const dealii::Triangulation & tria, + const std::pair *cells, + const unsigned int my_q, + GeometryType & cell_t_prev, + GeometryType (&cell_t)[VectorizedArrayType::size()], + dealii::FEValues & fe_val, + LocalData &cell_data) { const unsigned int n_q_points = fe_val.n_quadrature_points; const UpdateFlags update_flags = fe_val.get_update_flags(); @@ -489,7 +485,7 @@ namespace internal // not have that field here) const double zero_tolerance_double = cell_data.jac_size * std::numeric_limits::epsilon() * 1024.; - for (unsigned int j = 0; j < VectorizedArrayType::n_array_elements; ++j) + for (unsigned int j = 0; j < VectorizedArrayType::size(); ++j) { typename dealii::Triangulation::cell_iterator cell_it( &tria, cells[j].first, cells[j].second); @@ -651,10 +647,10 @@ namespace internal jacobian_grad[d][e][f]; } } - } // end loop over entries of vectorization (n_array_elements cells) + } // end loop over entries of vectorization (size() cells) // set information for next cell - cell_t_prev = cell_t[VectorizedArrayType::n_array_elements - 1]; + cell_t_prev = cell_t[VectorizedArrayType::size() - 1]; } @@ -695,7 +691,7 @@ namespace internal // encodes the cell types of the current cell. Since several cells // must be considered together, this variable holds the individual // info of the last chunk of cells - GeometryType cell_t[VectorizedArrayType::n_array_elements]; + GeometryType cell_t[VectorizedArrayType::size()]; GeometryType cell_t_prev = general; // fe_values object that is used to compute the mapping data. for @@ -782,7 +778,7 @@ namespace internal evaluate_on_cell( tria, - &cells[cell * VectorizedArrayType::n_array_elements], + &cells[cell * VectorizedArrayType::size()], my_q, cell_t_prev, cell_t, @@ -799,9 +795,7 @@ namespace internal // find the most general cell type (most general type is 3 // (general cell)) GeometryType most_general_type = cartesian; - for (unsigned int j = 0; - j < VectorizedArrayType::n_array_elements; - ++j) + for (unsigned int j = 0; j < VectorizedArrayType::size(); ++j) if (cell_t[j] > most_general_type) most_general_type = cell_t[j]; AssertIndexRange(most_general_type, 4U); @@ -827,9 +821,7 @@ namespace internal std::pair< Tensor<2, dim, - Tensor<1, - VectorizedArrayType::n_array_elements, - Number>>, + Tensor<1, VectorizedArrayType::size(), Number>>, unsigned int> new_entry; // This number overlaps with the general data but we @@ -839,7 +831,7 @@ namespace internal for (unsigned int d = 0; d < dim; ++d) for (unsigned int e = 0; e < dim; ++e) for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + v < VectorizedArrayType::size(); ++v) new_entry.first[d][e][v] = cell_data.const_jac[d][e][v]; @@ -864,8 +856,7 @@ namespace internal cell_data.general_jac[q]; Tensor<3, dim, VectorizedArrayType> &jacobian_grad = cell_data.general_jac_grad[q]; - for (unsigned int j = 0; - j < VectorizedArrayType::n_array_elements; + for (unsigned int j = 0; j < VectorizedArrayType::size(); ++j) if (cell_t[j] < general) { @@ -1112,9 +1103,8 @@ namespace internal const std::vector & active_fe_index, const Mapping & mapping) { - const unsigned int n_cells = cells.size(); - const unsigned int vectorization_width = - VectorizedArrayType::n_array_elements; + const unsigned int n_cells = cells.size(); + const unsigned int vectorization_width = VectorizedArrayType::size(); Assert(n_cells % vectorization_width == 0, ExcInternalError()); const unsigned int n_macro_cells = n_cells / vectorization_width; cell_type.resize(n_macro_cells); @@ -1233,8 +1223,7 @@ namespace internal Tensor<2, dim, VectorizedArrayType> jac; for (unsigned int d = 0; d < dim; ++d) for (unsigned int e = 0; e < dim; ++e) - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) jac[d][e][v] = it.first[d][e][v]; AssertIndexRange(it.second, n_constant_jacobians); @@ -1287,12 +1276,11 @@ namespace internal // (inner tensor). We cannot choose a VectorizedArray type directly // because std::map does not provide the necessary alignment upon // memory allocation. - std::map< - Tensor<1, - 2 * dim * dim + dim + 1, - Tensor<1, VectorizedArrayType::n_array_elements, Number>>, - unsigned int, - FPArrayComparator> + std::map>, + unsigned int, + FPArrayComparator> data; // Store the scaling factor @@ -1338,9 +1326,9 @@ namespace internal const std::pair face_range, const dealii::Triangulation & tria, const std::vector> &cells, - const std::vector< - FaceToCellTopology> &faces, - const Mapping & mapping, + const std::vector> + & faces, + const Mapping & mapping, MappingInfo &mapping_info, std::pair< std::vector< @@ -1414,9 +1402,7 @@ namespace internal bool normal_is_similar = true; bool JxW_is_similar = true; bool cell_is_cartesian = true; - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) { Tensor<2, dim> jacobian_0; double compare_norm_jac = 1.; @@ -1643,8 +1629,7 @@ namespace internal face_data.quadrature_points[q]); } - using VEC_ARRAY = - Tensor<1, VectorizedArrayType::n_array_elements, Number>; + using VEC_ARRAY = Tensor<1, VectorizedArrayType::size(), Number>; unsigned int insert_position = data.first[my_q].JxW_values.size(); // Fill in JxW values, apply compression @@ -1657,8 +1642,7 @@ namespace internal unsigned int> new_entry; new_entry.second = data.second.data.size(); - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) new_entry.first[2 * dim * dim + dim][v] = face_data.JxW_values[0][v] / quadrature.weight(0) / @@ -1668,7 +1652,7 @@ namespace internal for (unsigned int d = 0; d < dim; ++d) for (unsigned int e = 0; e < dim; ++e) for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + v < VectorizedArrayType::size(); ++v) new_entry.first[d * dim + e][v] = face_data.general_jac[0][d][e][v]; @@ -1676,7 +1660,7 @@ namespace internal for (unsigned int d = 0; d < dim; ++d) for (unsigned int e = 0; e < dim; ++e) for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + v < VectorizedArrayType::size(); ++v) new_entry.first[dim * dim + d * dim + e][v] = face_data.general_jac[n_q_points][d][e][v]; @@ -1689,7 +1673,7 @@ namespace internal // size to get the right scaling for (unsigned int d = 0; d < dim; ++d) for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + v < VectorizedArrayType::size(); ++v) new_entry.first[2 * dim * dim + d][v] = face_data.normal_vectors[0][d][v] / @@ -1727,8 +1711,8 @@ namespace internal const unsigned int first_face, const unsigned int last_face, const std::vector &face_type, - const std::vector< - FaceToCellTopology> &faces, + const std::vector> + &faces, MappingInfoStorage &data_faces) { @@ -1761,11 +1745,10 @@ namespace internal template void MappingInfo::initialize_faces( - const dealii::Triangulation & tria, - const std::vector> &cells, - const std::vector< - FaceToCellTopology> &faces, - const Mapping & mapping) + const dealii::Triangulation & tria, + const std::vector> & cells, + const std::vector> &faces, + const Mapping &mapping) { face_type.resize(faces.size(), general); @@ -1899,9 +1882,7 @@ namespace internal for (const auto &it : data_faces_local[0].second.data) { // JxW values; invert previously applied scaling - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) face_data[my_q].JxW_values[it.second][v] = it.first[2 * dim * dim + dim][v] * Utilities::fixed_power(jac_size); @@ -1911,15 +1892,14 @@ namespace internal for (unsigned int d = 0; d < dim; ++d) for (unsigned int e = 0; e < dim; ++e) for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + v < VectorizedArrayType::size(); ++v) face_data[my_q].jacobians[i][it.second][d][e][v] = it.first[i * dim * dim + d * dim + e][v]; // normal vectors; invert previously applied scaling for (unsigned int d = 0; d < dim; ++d) - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) face_data[my_q].normal_vectors[it.second][d][v] = it.first[2 * dim * dim + d][v] * jac_size; @@ -1967,10 +1947,9 @@ namespace internal if (update_flags_faces_by_cells == update_default) return; - const unsigned int n_quads = face_data_by_cells.size(); - const unsigned int vectorization_width = - VectorizedArrayType::n_array_elements; - UpdateFlags update_flags = + const unsigned int n_quads = face_data_by_cells.size(); + const unsigned int vectorization_width = VectorizedArrayType::size(); + UpdateFlags update_flags = (update_flags_faces_by_cells & update_quadrature_points ? update_quadrature_points : update_default) | @@ -2297,11 +2276,11 @@ namespace internal template bool - FPArrayComparator::operator()( - const Tensor<1, VectorizedArrayType::n_array_elements, Number> &t1, - const Tensor<1, VectorizedArrayType::n_array_elements, Number> &t2) const + FPArrayComparator:: + operator()(const Tensor<1, VectorizedArrayType::size(), Number> &t1, + const Tensor<1, VectorizedArrayType::size(), Number> &t2) const { - for (unsigned int k = 0; k < VectorizedArrayType::n_array_elements; ++k) + for (unsigned int k = 0; k < VectorizedArrayType::size(); ++k) if (t1[k] < t2[k] - tolerance) return true; else if (t1[k] > t2[k] + tolerance) @@ -2315,17 +2294,12 @@ namespace internal template bool FPArrayComparator::operator()( - const Tensor<1, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> - &t1, - const Tensor<1, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> - &t2) const + const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t1, + const Tensor<1, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t2) + const { for (unsigned int d = 0; d < dim; ++d) - for (unsigned int k = 0; k < VectorizedArrayType::n_array_elements; ++k) + for (unsigned int k = 0; k < VectorizedArrayType::size(); ++k) if (t1[d][k] < t2[d][k] - tolerance) return true; else if (t1[d][k] > t2[d][k] + tolerance) @@ -2339,19 +2313,13 @@ namespace internal template bool FPArrayComparator::operator()( - const Tensor<2, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> - &t1, - const Tensor<2, - dim, - Tensor<1, VectorizedArrayType::n_array_elements, Number>> - &t2) const + const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t1, + const Tensor<2, dim, Tensor<1, VectorizedArrayType::size(), Number>> &t2) + const { for (unsigned int d = 0; d < dim; ++d) for (unsigned int e = 0; e < dim; ++e) - for (unsigned int k = 0; k < VectorizedArrayType::n_array_elements; - ++k) + for (unsigned int k = 0; k < VectorizedArrayType::size(); ++k) if (t1[d][e][k] < t2[d][e][k] - tolerance) return true; else if (t1[d][e][k] > t2[d][e][k] + tolerance) diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 45f562a141..68efa4c5cf 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -1570,7 +1570,7 @@ public: * general. The cell range in @p cell_loop runs from zero to n_cell_batches() * (exclusive), so this is the appropriate size if you want to store arrays * of data for all cells to be worked on. This number is approximately - * `n_physical_cells()/VectorizedArray::n_array_elements` (depending on how + * `n_physical_cells()/VectorizedArray::size()` (depending on how * many cell chunks that do not get filled up completely). */ unsigned int @@ -1582,7 +1582,7 @@ public: * general. The cell range in @p cell_loop runs from zero to * n_cell_batches() (exclusive), so this is the appropriate size if you want * to store arrays of data for all cells to be worked on. This number is - * approximately `n_physical_cells()/VectorizedArray::n_array_elements` + * approximately `n_physical_cells()/VectorizedArray::size()` * (depending on how many cell chunks that do not get filled up completely). */ unsigned int @@ -1638,7 +1638,7 @@ public: * Return the boundary ids for the faces within a cell, using the cells' * sorting by lanes in the VectorizedArray. */ - std::array + std::array get_faces_by_cells_boundary_id(const unsigned int macro_cell, const unsigned int face_number) const; @@ -1924,7 +1924,7 @@ public: * Return the connectivity information of a face. */ const internal::MatrixFreeFunctions::FaceToCellTopology< - VectorizedArrayType::n_array_elements> & + VectorizedArrayType::size()> & get_face_info(const unsigned int face_batch_number) const; @@ -2139,7 +2139,7 @@ private: * Vector holding face information. Only initialized if * build_face_info=true. */ - internal::MatrixFreeFunctions::FaceInfo + internal::MatrixFreeFunctions::FaceInfo face_info; /** @@ -2350,7 +2350,7 @@ MatrixFree::get_boundary_id( template -inline std::array +inline std::array MatrixFree::get_faces_by_cells_boundary_id( const unsigned int macro_cell, const unsigned int face_number) const @@ -2359,7 +2359,7 @@ MatrixFree::get_faces_by_cells_boundary_id( AssertIndexRange(face_number, GeometryInfo::faces_per_cell); Assert(face_info.cell_and_face_boundary_id.size(0) >= n_macro_cells(), ExcNotInitialized()); - std::array result; + std::array result; result.fill(numbers::invalid_boundary_id); for (unsigned int v = 0; v < n_active_entries_per_cell_batch(macro_cell); ++v) result[v] = face_info.cell_and_face_boundary_id(macro_cell, face_number, v); @@ -2461,13 +2461,9 @@ MatrixFree::at_irregular_cell( const unsigned int macro_cell) const { AssertIndexRange(macro_cell, task_info.cell_partition_data.back()); - return VectorizedArrayType::n_array_elements > 1 && - cell_level_index[(macro_cell + 1) * - VectorizedArrayType::n_array_elements - - 1] == - cell_level_index[(macro_cell + 1) * - VectorizedArrayType::n_array_elements - - 2]; + return VectorizedArrayType::size() > 1 && + cell_level_index[(macro_cell + 1) * VectorizedArrayType::size() - 1] == + cell_level_index[(macro_cell + 1) * VectorizedArrayType::size() - 2]; } @@ -2488,16 +2484,14 @@ MatrixFree::n_active_entries_per_cell_batch( const unsigned int cell_batch_number) const { AssertIndexRange(cell_batch_number, task_info.cell_partition_data.back()); - unsigned int n_components = VectorizedArrayType::n_array_elements; - while ( - n_components > 1 && - cell_level_index[cell_batch_number * VectorizedArrayType::n_array_elements + - n_components - 1] == - cell_level_index[cell_batch_number * - VectorizedArrayType::n_array_elements + - n_components - 2]) + unsigned int n_components = VectorizedArrayType::size(); + while (n_components > 1 && + cell_level_index[cell_batch_number * VectorizedArrayType::size() + + n_components - 1] == + cell_level_index[cell_batch_number * VectorizedArrayType::size() + + n_components - 2]) --n_components; - AssertIndexRange(n_components - 1, VectorizedArrayType::n_array_elements); + AssertIndexRange(n_components - 1, VectorizedArrayType::size()); return n_components; } @@ -2509,12 +2503,12 @@ MatrixFree::n_active_entries_per_face_batch( const unsigned int face_batch_number) const { AssertIndexRange(face_batch_number, face_info.faces.size()); - unsigned int n_components = VectorizedArrayType::n_array_elements; + unsigned int n_components = VectorizedArrayType::size(); while (n_components > 1 && face_info.faces[face_batch_number].cells_interior[n_components - 1] == numbers::invalid_unsigned_int) --n_components; - AssertIndexRange(n_components - 1, VectorizedArrayType::n_array_elements); + AssertIndexRange(n_components - 1, VectorizedArrayType::size()); return n_components; } @@ -2613,7 +2607,7 @@ MatrixFree::get_shape_info( template inline const internal::MatrixFreeFunctions::FaceToCellTopology< - VectorizedArrayType::n_array_elements> & + VectorizedArrayType::size()> & MatrixFree::get_face_info( const unsigned int macro_face) const { @@ -2686,7 +2680,7 @@ MatrixFree::get_face_category( return std::make_pair(0U, 0U); std::pair result; - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements && + for (unsigned int v = 0; v < VectorizedArrayType::size() && face_info.faces[macro_face].cells_interior[v] != numbers::invalid_unsigned_int; ++v) @@ -2696,7 +2690,7 @@ MatrixFree::get_face_category( .cell_active_fe_index[face_info.faces[macro_face].cells_interior[v]]); if (face_info.faces[macro_face].cells_exterior[0] != numbers::invalid_unsigned_int) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements && + for (unsigned int v = 0; v < VectorizedArrayType::size() && face_info.faces[macro_face].cells_exterior[v] != numbers::invalid_unsigned_int; ++v) diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index c4dad79eeb..c9a206fd0e 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -199,8 +199,7 @@ MatrixFree::get_cell_iterator( const unsigned int vector_number, const unsigned int dof_handler_index) const { - const unsigned int vectorization_length = - VectorizedArrayType::n_array_elements; + const unsigned int vectorization_length = VectorizedArrayType::size(); AssertIndexRange(dof_handler_index, dof_handlers.n_dof_handlers); AssertIndexRange(macro_cell_number, task_info.cell_partition_data.back()); AssertIndexRange(vector_number, n_components_filled(macro_cell_number)); @@ -235,8 +234,7 @@ MatrixFree::get_cell_level_and_index( const unsigned int macro_cell_number, const unsigned int vector_number) const { - const unsigned int vectorization_length = - VectorizedArrayType::n_array_elements; + const unsigned int vectorization_length = VectorizedArrayType::size(); AssertIndexRange(macro_cell_number, task_info.cell_partition_data.back()); AssertIndexRange(vector_number, n_components_filled(macro_cell_number)); @@ -284,7 +282,7 @@ MatrixFree::get_face_iterator( } const internal::MatrixFreeFunctions::FaceToCellTopology< - VectorizedArrayType::n_array_elements> + VectorizedArrayType::size()> face2cell_info = get_face_info(face_batch_number); const unsigned int cell_index = @@ -308,8 +306,7 @@ MatrixFree::get_hp_cell_iterator( const unsigned int vector_number, const unsigned int dof_handler_index) const { - constexpr unsigned int vectorization_length = - VectorizedArrayType::n_array_elements; + constexpr unsigned int vectorization_length = VectorizedArrayType::size(); AssertIndexRange(dof_handler_index, dof_handlers.n_dof_handlers); AssertIndexRange(macro_cell_number, task_info.cell_partition_data.back()); AssertIndexRange(vector_number, n_components_filled(macro_cell_number)); @@ -454,7 +451,7 @@ MatrixFree::internal_reinit( std::vector dummy2; task_info.collect_boundary_cells(cell_level_index.size(), cell_level_index.size(), - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), dummy); task_info.create_blocks_serial( dummy, dummy, 1, dummy, false, dummy, dummy2); @@ -480,9 +477,7 @@ MatrixFree::internal_reinit( // if indices are not initialized, the cell_level_index might not be // divisible by the vectorization length. But it must be for // mapping_info... - while (cell_level_index.size() % - VectorizedArrayType::n_array_elements != - 0) + while (cell_level_index.size() % VectorizedArrayType::size() != 0) cell_level_index.push_back(cell_level_index.back()); } } @@ -626,7 +621,7 @@ MatrixFree::internal_reinit( std::vector dummy2; task_info.collect_boundary_cells(cell_level_index.size(), cell_level_index.size(), - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), dummy); task_info.create_blocks_serial( dummy, dummy, 1, dummy, false, dummy, dummy2); @@ -654,9 +649,7 @@ MatrixFree::internal_reinit( // if indices are not initialized, the cell_level_index might not be // divisible by the vectorization length. But it must be for // mapping_info... - while (cell_level_index.size() % - VectorizedArrayType::n_array_elements != - 0) + while (cell_level_index.size() % VectorizedArrayType::size() != 0) cell_level_index.push_back(cell_level_index.back()); } } @@ -781,7 +774,7 @@ MatrixFree::initialize_dof_handlers( dof_info.resize(dof_handlers.n_dof_handlers); for (unsigned int no = 0; no < dof_handlers.n_dof_handlers; ++no) - dof_info[no].vectorization_length = VectorizedArrayType::n_array_elements; + dof_info[no].vectorization_length = VectorizedArrayType::size(); // Go through cells on zeroth level and then successively step down into // children. This gives a z-ordering of the cells, which is beneficial when @@ -852,7 +845,7 @@ MatrixFree::initialize_dof_handlers( dof_info.resize(dof_handlers.n_dof_handlers); for (unsigned int no = 0; no < dof_handlers.n_dof_handlers; ++no) - dof_info[no].vectorization_length = VectorizedArrayType::n_array_elements; + dof_info[no].vectorization_length = VectorizedArrayType::size(); // go through cells on zeroth level and then successively step down into // children. This gives a z-ordering of the cells, which is beneficial when @@ -1139,8 +1132,7 @@ MatrixFree::initialize_indices( subdomain_boundary_cells.push_back(counter); } - const unsigned int vectorization_length = - VectorizedArrayType::n_array_elements; + const unsigned int vectorization_length = VectorizedArrayType::size(); task_info.collect_boundary_cells(cell_level_index_end_local, n_active_cells, vectorization_length, @@ -1518,7 +1510,7 @@ MatrixFree::initialize_indices( cell_level_index.resize( cell_level_index.size() + - VectorizedArrayType::n_array_elements * + VectorizedArrayType::size() * (task_info.refinement_edge_face_partition_data[1] - task_info.refinement_edge_face_partition_data[0])); @@ -1530,48 +1522,48 @@ MatrixFree::initialize_indices( face_info.cell_and_face_to_plain_faces.reinit( TableIndices<3>(task_info.cell_partition_data.back(), GeometryInfo::faces_per_cell, - VectorizedArrayType::n_array_elements), + VectorizedArrayType::size()), true); face_info.cell_and_face_to_plain_faces.fill( numbers::invalid_unsigned_int); face_info.cell_and_face_boundary_id.reinit( TableIndices<3>(task_info.cell_partition_data.back(), GeometryInfo::faces_per_cell, - VectorizedArrayType::n_array_elements), + VectorizedArrayType::size()), true); face_info.cell_and_face_boundary_id.fill(numbers::invalid_boundary_id); for (unsigned int f = 0; f < task_info.ghost_face_partition_data.back(); ++f) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements && + for (unsigned int v = 0; v < VectorizedArrayType::size() && face_info.faces[f].cells_interior[v] != numbers::invalid_unsigned_int; ++v) { TableIndices<3> index(face_info.faces[f].cells_interior[v] / - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), face_info.faces[f].interior_face_no, face_info.faces[f].cells_interior[v] % - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); // Assert(cell_and_face_to_plain_faces(index) == // numbers::invalid_unsigned_int, // ExcInternalError("Should only visit each face once")); face_info.cell_and_face_to_plain_faces(index) = - f * VectorizedArrayType::n_array_elements + v; + f * VectorizedArrayType::size() + v; if (face_info.faces[f].cells_exterior[v] != numbers::invalid_unsigned_int) { TableIndices<3> index(face_info.faces[f].cells_exterior[v] / - VectorizedArrayType::n_array_elements, + VectorizedArrayType::size(), face_info.faces[f].exterior_face_no, face_info.faces[f].cells_exterior[v] % - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); // Assert(cell_and_face_to_plain_faces(index) == // numbers::invalid_unsigned_int, // ExcInternalError("Should only visit each face once")); face_info.cell_and_face_to_plain_faces(index) = - f * VectorizedArrayType::n_array_elements + v; + f * VectorizedArrayType::size() + v; } else face_info.cell_and_face_boundary_id(index) = @@ -1590,8 +1582,7 @@ MatrixFree::initialize_indices( std::vector ghost_indices; { for (unsigned int cell = 0; - cell < - VectorizedArrayType::n_array_elements * n_macro_cells_before; + cell < VectorizedArrayType::size() * n_macro_cells_before; ++cell) if (cell == 0 || cell_level_index[cell] != cell_level_index[cell - 1]) @@ -1654,15 +1645,14 @@ MatrixFree::initialize_indices( const bool, const bool)> &fu) { for (unsigned int f = 0; f < n_inner_face_batches(); ++f) - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements && - face_info.faces[f].cells_interior[v] != - numbers::invalid_unsigned_int; + for (unsigned int v = 0; v < VectorizedArrayType::size() && + face_info.faces[f].cells_interior[v] != + numbers::invalid_unsigned_int; ++v) { AssertIndexRange(face_info.faces[f].cells_interior[v], n_macro_cells_before * - VectorizedArrayType::n_array_elements); + VectorizedArrayType::size()); const unsigned int p = face_info.faces[f].cells_exterior[v]; const unsigned int face_no = face_info.faces[f].exterior_face_no; @@ -1680,17 +1670,14 @@ MatrixFree::initialize_indices( const bool)> &fu) { for (unsigned int c = 0; c < n_cell_batches(); ++c) for (const unsigned int d : GeometryInfo::face_indices()) - for (unsigned int v = 0; - v < VectorizedArrayType::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) { unsigned int f = this->face_info.cell_and_face_to_plain_faces(c, d, v); if (f == numbers::invalid_unsigned_int) continue; - const unsigned int v_len = - VectorizedArrayType::n_array_elements; + const unsigned int v_len = VectorizedArrayType::size(); const unsigned int cell_this = c * v_len + v; const unsigned int cell_m = this->get_face_info(f / v_len) @@ -1855,14 +1842,12 @@ MatrixFree::initialize_indices( // using AssertIndexRange, but that leads to an // internal compiler error with GCC 7.4. Do things // by hand instead. - Assert( - face_info.faces[f].cells_interior[v] < - n_macro_cells_before * - VectorizedArrayType::n_array_elements, - ExcIndexRange(face_info.faces[f].cells_interior[v], - 0, - n_macro_cells_before * - VectorizedArrayType::n_array_elements)); + Assert(face_info.faces[f].cells_interior[v] < + n_macro_cells_before * VectorizedArrayType::size(), + ExcIndexRange(face_info.faces[f].cells_interior[v], + 0, + n_macro_cells_before * + VectorizedArrayType::size())); if (flag || (di.index_storage_variants [ext ? internal::MatrixFreeFunctions::DoFInfo:: diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index 5f93f4ed2f..af79e158d5 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -2034,7 +2034,7 @@ namespace MatrixFreeOperators bool non_negative(const VectorizedArrayType &n) { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) if (n[v] < 0.) return false; diff --git a/include/deal.II/matrix_free/vector_access_internal.h b/include/deal.II/matrix_free/vector_access_internal.h index 5275f90aa5..46bd9b268c 100644 --- a/include/deal.II/matrix_free/vector_access_internal.h +++ b/include/deal.II/matrix_free/vector_access_internal.h @@ -237,7 +237,7 @@ namespace internal { const Number *vec_ptr = vec.begin() + dof_index; for (unsigned int i = 0; i < dofs_per_cell; - ++i, vec_ptr += VectorizedArrayType::n_array_elements) + ++i, vec_ptr += VectorizedArrayType::size()) dof_values[i].load(vec_ptr); } @@ -252,9 +252,9 @@ namespace internal std::integral_constant) const { for (unsigned int i = 0; i < dofs_per_cell; ++i) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) - dof_values[i][v] = vector_access( - vec, dof_index + v + i * VectorizedArrayType::n_array_elements); + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) + dof_values[i][v] = + vector_access(vec, dof_index + v + i * VectorizedArrayType::size()); } @@ -284,7 +284,7 @@ namespace internal std::integral_constant) const { for (unsigned int d = 0; d < dofs_per_cell; ++d) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) dof_values[d][v] = vector_access(vec, dof_indices[v] + d); } @@ -315,7 +315,7 @@ namespace internal VectorizedArrayType &res, std::integral_constant) const { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) res[v] = vector_access(vec, indices[v] + constant_offset); } @@ -393,7 +393,7 @@ namespace internal { Number *vec_ptr = vec.begin() + dof_index; for (unsigned int i = 0; i < dofs_per_cell; - ++i, vec_ptr += VectorizedArrayType::n_array_elements) + ++i, vec_ptr += VectorizedArrayType::size()) { VectorizedArrayType tmp; tmp.load(vec_ptr); @@ -413,10 +413,9 @@ namespace internal std::integral_constant) const { for (unsigned int i = 0; i < dofs_per_cell; ++i) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access_add(vec, - dof_index + v + - i * VectorizedArrayType::n_array_elements, + dof_index + v + i * VectorizedArrayType::size(), dof_values[i][v]); } @@ -445,7 +444,7 @@ namespace internal std::integral_constant) const { for (unsigned int d = 0; d < dofs_per_cell; ++d) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access_add(vec, dof_indices[v] + d, dof_values[d][v]); } @@ -462,7 +461,7 @@ namespace internal std::integral_constant) const { #if DEAL_II_COMPILER_VECTORIZATION_LEVEL < 3 - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access(vec, indices[v] + constant_offset) += res[v]; #else // only use gather in case there is also scatter. @@ -485,7 +484,7 @@ namespace internal VectorizedArrayType &res, std::integral_constant) const { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access_add(vec, indices[v] + constant_offset, res[v]); } @@ -558,7 +557,7 @@ namespace internal { Number *vec_ptr = vec.begin() + dof_index; for (unsigned int i = 0; i < dofs_per_cell; - ++i, vec_ptr += VectorizedArrayType::n_array_elements) + ++i, vec_ptr += VectorizedArrayType::size()) dof_values[i].store(vec_ptr); } @@ -573,10 +572,8 @@ namespace internal std::integral_constant) const { for (unsigned int i = 0; i < dofs_per_cell; ++i) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) - vector_access(vec, - dof_index + v + - i * VectorizedArrayType::n_array_elements) = + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) + vector_access(vec, dof_index + v + i * VectorizedArrayType::size()) = dof_values[i][v]; } @@ -605,7 +602,7 @@ namespace internal std::integral_constant) const { for (unsigned int i = 0; i < dofs_per_cell; ++i) - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access(vec, dof_indices[v] + i) = dof_values[i][v]; } @@ -632,7 +629,7 @@ namespace internal VectorizedArrayType &res, std::integral_constant) const { - for (unsigned int v = 0; v < VectorizedArrayType::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v) vector_access(vec, indices[v] + constant_offset) = res[v]; } diff --git a/source/fe/mapping_q_generic.cc b/source/fe/mapping_q_generic.cc index d2156ba6f3..b466aef730 100644 --- a/source/fe/mapping_q_generic.cc +++ b/source/fe/mapping_q_generic.cc @@ -757,7 +757,7 @@ MappingQGeneric::InternalData::initialize( const unsigned int max_size = std::max(n_q_points, n_shape_values); const unsigned int vec_length = - dealii::VectorizedArray::n_array_elements; + dealii::VectorizedArray::size(); const unsigned int n_comp = 1 + (spacedim - 1) / vec_length; scratch.resize((dim - 1) * max_size); @@ -824,8 +824,8 @@ MappingQGeneric::InternalData::initialize_face( const unsigned int n_shape_values = fe.n_dofs_per_cell(); const unsigned int n_q_points = q.size(); const unsigned int max_size = std::max(n_q_points, n_shape_values); - const unsigned int vec_length = VectorizedArray::n_array_elements; - const unsigned int n_comp = 1 + (spacedim - 1) / vec_length; + const unsigned int vec_length = VectorizedArray::size(); + const unsigned int n_comp = 1 + (spacedim - 1) / vec_length; scratch.resize((dim - 1) * max_size); values_dofs.resize(n_comp * n_shape_values); @@ -1495,10 +1495,9 @@ namespace internal const unsigned int n_shape_values = data.n_shape_functions; const unsigned int n_q_points = data.shape_info.n_q_points; - const unsigned int vec_length = - VectorizedArray::n_array_elements; - const unsigned int n_comp = 1 + (spacedim - 1) / vec_length; - const unsigned int n_hessians = (dim * (dim + 1)) / 2; + const unsigned int vec_length = VectorizedArray::size(); + const unsigned int n_comp = 1 + (spacedim - 1) / vec_length; + const unsigned int n_hessians = (dim * (dim + 1)) / 2; const bool evaluate_values = update_flags & update_quadrature_points; const bool evaluate_gradients = diff --git a/source/multigrid/mg_transfer_matrix_free.cc b/source/multigrid/mg_transfer_matrix_free.cc index 894b4c7a4a..2849142472 100644 --- a/source/multigrid/mg_transfer_matrix_free.cc +++ b/source/multigrid/mg_transfer_matrix_free.cc @@ -149,7 +149,7 @@ MGTransferMatrixFree::build( prolongation_matrix_1d[i] = elem_info.prolongation_matrix_1d[i]; // reshuffle into aligned vector of vectorized arrays - const unsigned int vec_size = VectorizedArray::n_array_elements; + const unsigned int vec_size = VectorizedArray::size(); const unsigned int n_levels = dof_handler.get_triangulation().n_global_levels(); @@ -379,8 +379,8 @@ MGTransferMatrixFree::do_prolongate_add( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const { - const unsigned int vec_size = VectorizedArray::n_array_elements; - const unsigned int degree_size = (degree > -1 ? degree : fe_degree) + 1; + const unsigned int vec_size = VectorizedArray::size(); + const unsigned int degree_size = (degree > -1 ? degree : fe_degree) + 1; const unsigned int n_child_dofs_1d = 2 * degree_size - element_is_continuous; const unsigned int n_scalar_cell_dofs = Utilities::fixed_power(n_child_dofs_1d); @@ -518,8 +518,8 @@ MGTransferMatrixFree::do_restrict_add( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const { - const unsigned int vec_size = VectorizedArray::n_array_elements; - const unsigned int degree_size = (degree > -1 ? degree : fe_degree) + 1; + const unsigned int vec_size = VectorizedArray::size(); + const unsigned int degree_size = (degree > -1 ? degree : fe_degree) + 1; const unsigned int n_child_dofs_1d = 2 * degree_size - element_is_continuous; const unsigned int n_scalar_cell_dofs = Utilities::fixed_power(n_child_dofs_1d); diff --git a/tests/base/point_03.cc b/tests/base/point_03.cc index efb9d9452d..187c8366c7 100644 --- a/tests/base/point_03.cc +++ b/tests/base/point_03.cc @@ -29,7 +29,7 @@ check() VectorizedArray distance_vec; Point> p1_vec, p2_vec; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { Point p1, p2; for (unsigned int i = 0; i < dim; ++i) @@ -48,12 +48,12 @@ check() distance_vec -= distance_vec2; number diff = 0.; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) diff += std::abs(distance_vec[v]); AssertThrow(diff < 2 * std::numeric_limits::epsilon() * - VectorizedArray::n_array_elements * - VectorizedArray::n_array_elements, + VectorizedArray::size() * + VectorizedArray::size(), ExcMessage("diff is " + std::to_string(diff))); deallog << "Ok" << std::endl; diff --git a/tests/base/utilities_02b.cc b/tests/base/utilities_02b.cc index b78cc7968a..280b48d3e8 100644 --- a/tests/base/utilities_02b.cc +++ b/tests/base/utilities_02b.cc @@ -25,18 +25,18 @@ template void do_test(const VectorizedArrayType array) { - deallog << " test " << VectorizedArrayType::n_array_elements - << " array elements" << std::endl; + deallog << " test " << VectorizedArrayType::size() << " array elements" + << std::endl; auto exponentiated_array = Utilities::fixed_power<3>(array); - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + for (unsigned int i = 0; i < VectorizedArrayType::size(); i++) deallog << exponentiated_array[i] << " "; deallog << std::endl; exponentiated_array = Utilities::fixed_power<-3>(array); - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + for (unsigned int i = 0; i < VectorizedArrayType::size(); i++) deallog << exponentiated_array[i] << " "; deallog << std::endl; } diff --git a/tests/base/vectorization_01.cc b/tests/base/vectorization_01.cc index 82c86cdbc4..1ab6c35491 100644 --- a/tests/base/vectorization_01.cc +++ b/tests/base/vectorization_01.cc @@ -30,7 +30,7 @@ test() // since the number of array elements is system dependent, it is not a good // idea to print them to an output file. Instead, check the values manually VectorizedArray a, b, c; - const unsigned int n_vectors = VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); a = Number(2.); b = Number(-1.); for (unsigned int i = 0; i < n_vectors; ++i) diff --git a/tests/base/vectorization_02.cc b/tests/base/vectorization_02.cc index c575cf0530..ae8a386fa2 100644 --- a/tests/base/vectorization_02.cc +++ b/tests/base/vectorization_02.cc @@ -25,7 +25,7 @@ void test() { typedef VectorizedArray vector_t; - const unsigned int n_vectors = VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); typedef AlignedVector VEC; std::vector a_ref(4), b_ref; VEC a(4); diff --git a/tests/base/vectorization_03.cc b/tests/base/vectorization_03.cc index 285b3b546e..2a930ed212 100644 --- a/tests/base/vectorization_03.cc +++ b/tests/base/vectorization_03.cc @@ -74,7 +74,7 @@ test() weight = random_value(); VectorizedArray vec; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) vec[v] = random_value(); current.values[0] = vec; @@ -91,7 +91,7 @@ test() vector *= 2. * current.get_value(0)[0]; double error = 0; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) error += std::abs(current.get_value(0)[v] / (current.cartesian_weight[v] * current.jac_weight[0][0]) - (2. * vec[v] - ol[v] - weight[v] * std::sin(vec[v]))); diff --git a/tests/base/vectorization_04.cc b/tests/base/vectorization_04.cc index e968f0cd7c..ad9fe72856 100644 --- a/tests/base/vectorization_04.cc +++ b/tests/base/vectorization_04.cc @@ -25,7 +25,7 @@ template void test() { - const unsigned int n_vectors = VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); std::vector values(n_vectors * 5); for (unsigned int i = 0; i < values.size(); ++i) values[i] = i; diff --git a/tests/base/vectorization_05.cc b/tests/base/vectorization_05.cc index 91323f8812..7451e8f49b 100644 --- a/tests/base/vectorization_05.cc +++ b/tests/base/vectorization_05.cc @@ -30,7 +30,7 @@ test() { // since the number of array elements is system dependent, it is not a good // idea to print them to an output file. Instead, check the values manually - const unsigned int n_vectors = VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); VectorizedArray arr[n_numbers]; Number other[n_vectors * n_numbers]; unsigned int offsets[n_vectors]; diff --git a/tests/base/vectorization_06.cc b/tests/base/vectorization_06.cc index d283f49d91..25793f2c27 100644 --- a/tests/base/vectorization_06.cc +++ b/tests/base/vectorization_06.cc @@ -35,7 +35,7 @@ test() for (unsigned int i = 0; i < vec.size(); ++i) vec[i] = i + 1; - const unsigned int n_vectors = VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); unsigned int indices[n_vectors]; for (unsigned int i = 0; i < n_vectors; ++i) indices[i] = i; diff --git a/tests/base/vectorization_09.cc b/tests/base/vectorization_09.cc index 7f69fcc8b3..2f4d10ca01 100644 --- a/tests/base/vectorization_09.cc +++ b/tests/base/vectorization_09.cc @@ -26,7 +26,7 @@ void test() { const unsigned int n_chunks = 50000; - const unsigned int n_vectors = VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); std::vector values(n_vectors * n_chunks); for (unsigned int i = 0; i < values.size(); ++i) values[i] = i; diff --git a/tests/base/vectorization_10.cc b/tests/base/vectorization_10.cc index 6823059429..ad1beea6f3 100644 --- a/tests/base/vectorization_10.cc +++ b/tests/base/vectorization_10.cc @@ -31,8 +31,7 @@ do_test() { // since the number of array elements is system dependent, it is not a good // idea to print them to an output file. Instead, check the values manually - const unsigned int n_vectors = - VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); VectorizedArray arr[n_numbers]; Number other[n_vectors * n_numbers]; unsigned int offsets[n_vectors]; diff --git a/tests/base/vectorization_11.cc b/tests/base/vectorization_11.cc index f6b76d3a01..3a26982d36 100644 --- a/tests/base/vectorization_11.cc +++ b/tests/base/vectorization_11.cc @@ -29,9 +29,9 @@ void do_test(const VectorizedArrayType array, const typename VectorizedArrayType::value_type number) { - deallog << " test " << VectorizedArrayType::n_array_elements - << " array elements" << std::endl; - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + deallog << " test " << VectorizedArrayType::size() << " array elements" + << std::endl; + for (unsigned int i = 0; i < VectorizedArrayType::size(); i++) if (array[i] != number) deallog << " problem in element " << i << std::endl; } diff --git a/tests/base/vectorization_12.cc b/tests/base/vectorization_12.cc index a196b99579..666c510811 100644 --- a/tests/base/vectorization_12.cc +++ b/tests/base/vectorization_12.cc @@ -27,7 +27,7 @@ template void test() { - constexpr unsigned int n = VectorizedArray::n_array_elements; + constexpr unsigned int n = VectorizedArray::size(); VectorizedArray a; std::stringstream test_stream; diff --git a/tests/base/vectorization_13.cc b/tests/base/vectorization_13.cc index d1adc1e2ed..59ffcfe743 100644 --- a/tests/base/vectorization_13.cc +++ b/tests/base/vectorization_13.cc @@ -26,12 +26,12 @@ void do_test(const VectorizedArrayType array, const typename VectorizedArrayType::value_type number) { - deallog << " test " << VectorizedArrayType::n_array_elements - << " array elements" << std::endl; + deallog << " test " << VectorizedArrayType::size() << " array elements" + << std::endl; auto exponentiated_array = std::pow(array, number); - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + for (unsigned int i = 0; i < VectorizedArrayType::size(); i++) deallog << exponentiated_array[i] << " "; deallog << std::endl; } diff --git a/tests/base/vectorization_14.cc b/tests/base/vectorization_14.cc index 4c1ce45c8c..3ff642e466 100644 --- a/tests/base/vectorization_14.cc +++ b/tests/base/vectorization_14.cc @@ -25,11 +25,11 @@ template void do_test() { - deallog << " test " << VectorizedArrayType::n_array_elements - << " array elements" << std::endl; + deallog << " test " << VectorizedArrayType::size() << " array elements" + << std::endl; VectorizedArrayType left; - for (unsigned int i = 0; i < VectorizedArrayType::n_array_elements; i++) + for (unsigned int i = 0; i < VectorizedArrayType::size(); i++) left[i] = i + 1.; VectorizedArrayType right(3.); diff --git a/tests/base/vectorization_15.cc b/tests/base/vectorization_15.cc index 38a5b23a6a..41da2ff1a0 100644 --- a/tests/base/vectorization_15.cc +++ b/tests/base/vectorization_15.cc @@ -31,8 +31,7 @@ do_test() { // since the number of array elements is system dependent, it is not a good // idea to print them to an output file. Instead, check the values manually - const unsigned int n_vectors = - VectorizedArray::n_array_elements; + const unsigned int n_vectors = VectorizedArray::size(); VectorizedArray arr[n_numbers]; Number other[n_vectors * n_numbers]; unsigned int offsets[n_vectors]; diff --git a/tests/base/vectorization_iterator_02.cc b/tests/base/vectorization_iterator_02.cc index 9f45b1a059..2354d068d1 100644 --- a/tests/base/vectorization_iterator_02.cc +++ b/tests/base/vectorization_iterator_02.cc @@ -26,15 +26,14 @@ void test_const(const VectorizedArray &vector) { AssertDimension(*std::max_element(vector.begin(), vector.end()), - VectorizedArray::n_array_elements - 1); + VectorizedArray::size() - 1); AssertDimension(std::distance(vector.begin(), std::max_element(vector.begin(), vector.end())), - VectorizedArray::n_array_elements - 1); + VectorizedArray::size() - 1); AssertDimension(std::distance(vector.begin(), vector.begin() + - (VectorizedArray::n_array_elements - - 1)), - VectorizedArray::n_array_elements - 1); + (VectorizedArray::size() - 1)), + VectorizedArray::size() - 1); } template @@ -42,19 +41,18 @@ void test_nonconst(VectorizedArray &vector) { AssertDimension(*std::max_element(vector.begin(), vector.end()), - VectorizedArray::n_array_elements - 1); + VectorizedArray::size() - 1); AssertDimension(std::distance(vector.begin(), std::max_element(vector.begin(), vector.end())), - VectorizedArray::n_array_elements - 1); + VectorizedArray::size() - 1); AssertDimension(std::distance(vector.begin(), vector.begin() + - (VectorizedArray::n_array_elements - - 1)), - VectorizedArray::n_array_elements - 1); + (VectorizedArray::size() - 1)), + VectorizedArray::size() - 1); auto it = vector.begin(); - std::advance(it, VectorizedArray::n_array_elements - 1); - AssertDimension(*it, VectorizedArray::n_array_elements - 1); + std::advance(it, VectorizedArray::size() - 1); + AssertDimension(*it, VectorizedArray::size() - 1); } template diff --git a/tests/lac/tensor_product_matrix_vectorized_01.cc b/tests/lac/tensor_product_matrix_vectorized_01.cc index bf54655501..63e439d83b 100644 --- a/tests/lac/tensor_product_matrix_vectorized_01.cc +++ b/tests/lac/tensor_product_matrix_vectorized_01.cc @@ -77,7 +77,7 @@ do_test(const unsigned int size) v3(w1.size()); convert_to_vectorized(w1, v1); - constexpr unsigned int macro_size = VectorizedArray::n_array_elements; + constexpr unsigned int macro_size = VectorizedArray::size(); Vector vec_flat(v1.size() * macro_size); std::array offsets; for (unsigned int i = 0; i < macro_size; ++i) diff --git a/tests/lac/tensor_product_matrix_vectorized_02.cc b/tests/lac/tensor_product_matrix_vectorized_02.cc index 4849cb6306..c645e5d1c1 100644 --- a/tests/lac/tensor_product_matrix_vectorized_02.cc +++ b/tests/lac/tensor_product_matrix_vectorized_02.cc @@ -77,7 +77,7 @@ do_test() v3(w1.size()); convert_to_vectorized(w1, v1); - constexpr unsigned int macro_size = VectorizedArray::n_array_elements; + constexpr unsigned int macro_size = VectorizedArray::size(); Vector vec_flat(v1.size() * macro_size); std::array offsets; for (unsigned int i = 0; i < macro_size; ++i) diff --git a/tests/lac/tensor_product_matrix_vectorized_03.cc b/tests/lac/tensor_product_matrix_vectorized_03.cc index 2e4126332f..f945172af2 100644 --- a/tests/lac/tensor_product_matrix_vectorized_03.cc +++ b/tests/lac/tensor_product_matrix_vectorized_03.cc @@ -77,7 +77,7 @@ do_test() v3(w1.size()); convert_to_vectorized(w1, v1); - constexpr unsigned int macro_size = VectorizedArray::n_array_elements; + constexpr unsigned int macro_size = VectorizedArray::size(); Vector vec_flat(v1.size() * macro_size); std::array offsets; for (unsigned int i = 0; i < macro_size; ++i) diff --git a/tests/lac/tensor_product_matrix_vectorized_04.cc b/tests/lac/tensor_product_matrix_vectorized_04.cc index 4e6fb656e5..1a0f155acc 100644 --- a/tests/lac/tensor_product_matrix_vectorized_04.cc +++ b/tests/lac/tensor_product_matrix_vectorized_04.cc @@ -71,7 +71,7 @@ do_test(const unsigned int size) v3(w1.size()); convert_to_vectorized(w1, v1); - constexpr unsigned int macro_size = VectorizedArray::n_array_elements; + constexpr unsigned int macro_size = VectorizedArray::size(); Vector vec_flat(v1.size() * macro_size); std::array offsets; for (unsigned int i = 0; i < macro_size; ++i) diff --git a/tests/mappings/mapping_q_eulerian_08.cc b/tests/mappings/mapping_q_eulerian_08.cc index a6afbbda8a..082254b95f 100644 --- a/tests/mappings/mapping_q_eulerian_08.cc +++ b/tests/mappings/mapping_q_eulerian_08.cc @@ -92,8 +92,7 @@ public: { Tensor<1, dim, VectorizedArray> shift_vec; Point p; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { for (unsigned int d = 0; d < dim; ++d) p[d] = p_vec[d][v]; @@ -256,8 +255,7 @@ test(const unsigned int n_ref = 0) const auto &qp = fe_eval.quadrature_point(q); const auto v2 = qp + displacement_function.shift_value(qp); VectorizedArray dist = v1.distance(v2); - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) AssertThrow(dist[v] < 1e-8, ExcMessage("distance: " + std::to_string(dist[v]))); @@ -336,7 +334,7 @@ test(const unsigned int n_ref = 0) const auto v2 = qp + displacement_function.shift_value(qp); VectorizedArray dist = v1.distance(v2); for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; + v < VectorizedArray::size(); ++v) AssertThrow(dist[v] < 1e-8, ExcMessage( diff --git a/tests/matrix_free/advect_1d_vectorization_mask.cc b/tests/matrix_free/advect_1d_vectorization_mask.cc index fcfc47daa0..10e848d4f2 100644 --- a/tests/matrix_free/advect_1d_vectorization_mask.cc +++ b/tests/matrix_free/advect_1d_vectorization_mask.cc @@ -107,7 +107,7 @@ private: FEEvaluation phi( data, 0, 0, start_vector_component); - const unsigned int n_vect = VectorizedArray::n_array_elements; + const unsigned int n_vect = VectorizedArray::size(); for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell) { @@ -143,7 +143,7 @@ private: n_components, number>::value_type value_type; - const unsigned int n_vect = VectorizedArray::n_array_elements; + const unsigned int n_vect = VectorizedArray::size(); for (unsigned int face = face_range.first; face < face_range.second; face++) { @@ -200,7 +200,7 @@ private: n_components, number>::value_type value_type; - const unsigned int n_vect = VectorizedArray::n_array_elements; + const unsigned int n_vect = VectorizedArray::size(); for (unsigned int face = face_range.first; face < face_range.second; face++) { @@ -225,7 +225,7 @@ private: for (unsigned int v = 0; v < n_vect; ++v) { std::bitset mask = - std::bitset::n_array_elements>(); + std::bitset::size()>(); mask[v] = true; fe_eval.distribute_local_to_global(dst, 0, mask); } diff --git a/tests/matrix_free/assemble_matrix_01.cc b/tests/matrix_free/assemble_matrix_01.cc index e683e8f685..c2bdef206c 100644 --- a/tests/matrix_free/assemble_matrix_01.cc +++ b/tests/matrix_free/assemble_matrix_01.cc @@ -89,12 +89,12 @@ do_test(const DoFHandler &dof) fe_eval.reinit(cell); for (unsigned int i = 0; i < dofs_per_cell; - i += VectorizedArray::n_array_elements) + i += VectorizedArray::size()) { const unsigned int n_items = - i + VectorizedArray::n_array_elements > dofs_per_cell ? + i + VectorizedArray::size() > dofs_per_cell ? (dofs_per_cell - i) : - VectorizedArray::n_array_elements; + VectorizedArray::size(); for (unsigned int j = 0; j < dofs_per_cell; ++j) fe_eval.begin_dof_values()[j] = VectorizedArray(); for (unsigned int v = 0; v < n_items; ++v) diff --git a/tests/matrix_free/assemble_matrix_02.cc b/tests/matrix_free/assemble_matrix_02.cc index b58fb5a84d..a6206ed518 100644 --- a/tests/matrix_free/assemble_matrix_02.cc +++ b/tests/matrix_free/assemble_matrix_02.cc @@ -112,12 +112,12 @@ do_test(const DoFHandler &dof) const unsigned int dofs_per_cell_u = phi_u.dofs_per_cell; const unsigned int dofs_per_cell_p = phi_p.dofs_per_cell; for (unsigned int i = 0; i < dofs_per_cell_u; - i += VectorizedArray::n_array_elements) + i += VectorizedArray::size()) { const unsigned int n_items = - i + VectorizedArray::n_array_elements > dofs_per_cell_u ? + i + VectorizedArray::size() > dofs_per_cell_u ? (dofs_per_cell_u - i) : - VectorizedArray::n_array_elements; + VectorizedArray::size(); for (unsigned int j = 0; j < dofs_per_cell_u; ++j) phi_u.begin_dof_values()[j] = VectorizedArray(); for (unsigned int v = 0; v < n_items; ++v) @@ -148,12 +148,12 @@ do_test(const DoFHandler &dof) } for (unsigned int i = 0; i < dofs_per_cell_p; - i += VectorizedArray::n_array_elements) + i += VectorizedArray::size()) { const unsigned int n_items = - i + VectorizedArray::n_array_elements > dofs_per_cell_p ? + i + VectorizedArray::size() > dofs_per_cell_p ? (dofs_per_cell_p - i) : - VectorizedArray::n_array_elements; + VectorizedArray::size(); for (unsigned int j = 0; j < dofs_per_cell_p; ++j) phi_p.begin_dof_values()[j] = VectorizedArray(); for (unsigned int v = 0; v < n_items; ++v) diff --git a/tests/matrix_free/assemble_matrix_03.cc b/tests/matrix_free/assemble_matrix_03.cc index a4c8c38adc..9eea186af0 100644 --- a/tests/matrix_free/assemble_matrix_03.cc +++ b/tests/matrix_free/assemble_matrix_03.cc @@ -110,12 +110,12 @@ assemble_on_cell(const typename DoFHandler::active_cell_iterator &cell, FEEvaluation &fe_eval = data.fe_eval[0]; fe_eval.reinit(cell); for (unsigned int i = 0; i < dofs_per_cell; - i += VectorizedArray::n_array_elements) + i += VectorizedArray::size()) { const unsigned int n_items = - i + VectorizedArray::n_array_elements > dofs_per_cell ? + i + VectorizedArray::size() > dofs_per_cell ? (dofs_per_cell - i) : - VectorizedArray::n_array_elements; + VectorizedArray::size(); for (unsigned int j = 0; j < dofs_per_cell; ++j) fe_eval.begin_dof_values()[j] = VectorizedArray(); for (unsigned int v = 0; v < n_items; ++v) diff --git a/tests/matrix_free/cell_level_and_index.cc b/tests/matrix_free/cell_level_and_index.cc index bd57218902..0dbccc766a 100644 --- a/tests/matrix_free/cell_level_and_index.cc +++ b/tests/matrix_free/cell_level_and_index.cc @@ -43,7 +43,7 @@ void compare_indices(const MatrixFree *mf_data) { const unsigned int n_batches = mf_data->n_macro_cells(); - constexpr unsigned int batch_size = VectorizedArray::n_array_elements; + constexpr unsigned int batch_size = VectorizedArray::size(); for (unsigned int batch_no = 0; batch_no < n_batches; ++batch_no) { const unsigned int n_lanes_filled = diff --git a/tests/matrix_free/compare_faces_by_cells.cc b/tests/matrix_free/compare_faces_by_cells.cc index 90fe98dcf8..5ab473d1f7 100644 --- a/tests/matrix_free/compare_faces_by_cells.cc +++ b/tests/matrix_free/compare_faces_by_cells.cc @@ -278,13 +278,10 @@ private: phif.inverse_jacobian(0))[dim - 1]) * (number)(std::max(1, fe_degree) * (fe_degree + 1.0)) * 2.; - std::array::n_array_elements> + std::array::size()> boundary_ids = data.get_faces_by_cells_boundary_id(cell, face); VectorizedArray factor_boundary; - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) // interior face if (boundary_ids[v] == numbers::invalid_boundary_id) factor_boundary[v] = 0.5; diff --git a/tests/matrix_free/dg_pbc_02.cc b/tests/matrix_free/dg_pbc_02.cc index 4a04f8f50d..2ffe08aff3 100644 --- a/tests/matrix_free/dg_pbc_02.cc +++ b/tests/matrix_free/dg_pbc_02.cc @@ -101,9 +101,7 @@ test() n_inner_other_faces(2 * dim), n_boundary_faces(2 * dim); for (unsigned int f = 0; f < mf_data.n_inner_face_batches(); ++f) { - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) if (mf_data.get_face_info(f).cells_interior[v] != numbers::invalid_unsigned_int) { @@ -117,9 +115,7 @@ test() mf_data.n_inner_face_batches() + mf_data.n_boundary_face_batches(); ++f) { - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) if (mf_data.get_face_info(f).cells_interior[v] != numbers::invalid_unsigned_int) { diff --git a/tests/matrix_free/dof_info_01.cc b/tests/matrix_free/dof_info_01.cc index 9596192e9d..4303a1f86a 100644 --- a/tests/matrix_free/dof_info_01.cc +++ b/tests/matrix_free/dof_info_01.cc @@ -97,10 +97,9 @@ test(const bool adaptive_ref = true) mf_data->reinit(dof, constraints, quad, data); } - const unsigned int n_cells = mf_data->n_macro_cells(); - const auto & dof_info = mf_data->get_dof_info(); - constexpr unsigned int n_vectorization = - VectorizedArray::n_array_elements; + const unsigned int n_cells = mf_data->n_macro_cells(); + const auto & dof_info = mf_data->get_dof_info(); + constexpr unsigned int n_vectorization = VectorizedArray::size(); std::vector my_rows; my_rows.reserve(fe.dofs_per_cell * n_vectorization); diff --git a/tests/matrix_free/dof_info_02.cc b/tests/matrix_free/dof_info_02.cc index 70dbdc726b..8ba0a542fd 100644 --- a/tests/matrix_free/dof_info_02.cc +++ b/tests/matrix_free/dof_info_02.cc @@ -99,10 +99,9 @@ test(const bool adaptive_ref = true) mf_data->reinit(dof, constraints, quad, data); } - const unsigned int n_cells = mf_data->n_macro_cells(); - const auto & dof_info = mf_data->get_dof_info(); - constexpr unsigned int n_vectorization = - VectorizedArray::n_array_elements; + const unsigned int n_cells = mf_data->n_macro_cells(); + const auto & dof_info = mf_data->get_dof_info(); + constexpr unsigned int n_vectorization = VectorizedArray::size(); std::vector my_rows; my_rows.reserve(fe.dofs_per_cell * n_vectorization); diff --git a/tests/matrix_free/estimate_condition_number_mass.cc b/tests/matrix_free/estimate_condition_number_mass.cc index bbc3312f0f..2c16d3669b 100644 --- a/tests/matrix_free/estimate_condition_number_mass.cc +++ b/tests/matrix_free/estimate_condition_number_mass.cc @@ -119,7 +119,7 @@ test(const FiniteElement &fe, const unsigned int n_iterations) { const QGauss<1> quad(fe_degree + 1); typename MatrixFree::AdditionalData data; - data.tasks_block_size = 8 / VectorizedArray::n_array_elements; + data.tasks_block_size = 8 / VectorizedArray::size(); mf_data.reinit(dof, constraints, quad, data); } diff --git a/tests/matrix_free/evaluate_1d_shape_07.cc b/tests/matrix_free/evaluate_1d_shape_07.cc index 997d65fe17..b74eb67760 100644 --- a/tests/matrix_free/evaluate_1d_shape_07.cc +++ b/tests/matrix_free/evaluate_1d_shape_07.cc @@ -40,7 +40,7 @@ test() VectorizedArray x[N], x_ref[N], y[M], y_ref[M]; for (unsigned int i = 0; i < N; ++i) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) x[i][v] = random_value(); // compute reference @@ -71,8 +71,7 @@ test() for (unsigned int i = 0; i < M; ++i) { deallog << y[i][0] - y_ref[i][0] << " "; - for (unsigned int v = 1; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 1; v < VectorizedArray::size(); ++v) AssertThrow(std::abs(y[i][v] - y_ref[i][v]) < 1e-12, ExcInternalError()); } @@ -80,7 +79,7 @@ test() for (unsigned int i = 0; i < M; ++i) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) y[i][v] = random_value(); // compute reference @@ -104,8 +103,7 @@ test() for (unsigned int i = 0; i < N; ++i) { deallog << x[i][0] - x_ref[i][0] << " "; - for (unsigned int v = 1; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 1; v < VectorizedArray::size(); ++v) AssertThrow(std::abs(x[i][v] - x_ref[i][v]) < 1e-12, ExcInternalError()); } diff --git a/tests/matrix_free/evaluate_1d_shape_08.cc b/tests/matrix_free/evaluate_1d_shape_08.cc index a9366f40a6..98ef871000 100644 --- a/tests/matrix_free/evaluate_1d_shape_08.cc +++ b/tests/matrix_free/evaluate_1d_shape_08.cc @@ -69,7 +69,7 @@ test() VectorizedArray x[N], x_ref[N], y[M], y_ref[M]; for (unsigned int i = 0; i < N; ++i) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) x[i][v] = random_value(); // compute reference @@ -100,15 +100,14 @@ test() for (unsigned int i = 0; i < M; ++i) { deallog << y[i][0] - y_ref[i][0] << " "; - for (unsigned int v = 1; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 1; v < VectorizedArray::size(); ++v) AssertThrow(std::abs(y[i][v] - y_ref[i][v]) < 1e-12, ExcInternalError()); } deallog << std::endl; for (unsigned int i = 0; i < M; ++i) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) y[i][v] = random_value(); // compute reference @@ -132,8 +131,7 @@ test() for (unsigned int i = 0; i < N; ++i) { deallog << x[i][0] - x_ref[i][0] << " "; - for (unsigned int v = 1; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 1; v < VectorizedArray::size(); ++v) AssertThrow(std::abs(x[i][v] - x_ref[i][v]) < 1e-12, ExcInternalError()); } diff --git a/tests/matrix_free/evaluate_1d_shape_09.cc b/tests/matrix_free/evaluate_1d_shape_09.cc index b52eaa9c77..b712942448 100644 --- a/tests/matrix_free/evaluate_1d_shape_09.cc +++ b/tests/matrix_free/evaluate_1d_shape_09.cc @@ -48,7 +48,7 @@ test() VectorizedArray x[N], x_ref[N], y[M], y_ref[M]; for (unsigned int i = 0; i < N; ++i) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) x[i][v] = random_value(); // compute reference @@ -79,8 +79,7 @@ test() for (unsigned int i = 0; i < M; ++i) { deallog << y[i][0] - y_ref[i][0] << " "; - for (unsigned int v = 1; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 1; v < VectorizedArray::size(); ++v) AssertThrow(std::abs(y[i][v] - y_ref[i][v]) < 1e-12, ExcInternalError()); } @@ -88,7 +87,7 @@ test() for (unsigned int i = 0; i < M; ++i) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) y[i][v] = random_value(); // compute reference @@ -112,8 +111,7 @@ test() for (unsigned int i = 0; i < N; ++i) { deallog << x[i][0] - x_ref[i][0] << " "; - for (unsigned int v = 1; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 1; v < VectorizedArray::size(); ++v) AssertThrow(std::abs(x[i][v] - x_ref[i][v]) < 1e-12, ExcInternalError()); } diff --git a/tests/matrix_free/faces_value_optimization.cc b/tests/matrix_free/faces_value_optimization.cc index e57f50518b..17aac35746 100644 --- a/tests/matrix_free/faces_value_optimization.cc +++ b/tests/matrix_free/faces_value_optimization.cc @@ -88,9 +88,7 @@ private: { VectorizedArray diff = (ref.get_value(q) - check.get_value(q)); - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { if (std::abs(diff[v]) > 1e-12) { @@ -138,9 +136,7 @@ private: { VectorizedArray diff = (refr.get_value(q) - checkr.get_value(q)); - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { if (std::abs(diff[v]) > 1e-12) { diff --git a/tests/matrix_free/faces_value_optimization_02.cc b/tests/matrix_free/faces_value_optimization_02.cc index 617f3bc268..2c60da94a1 100644 --- a/tests/matrix_free/faces_value_optimization_02.cc +++ b/tests/matrix_free/faces_value_optimization_02.cc @@ -88,9 +88,7 @@ private: { VectorizedArray diff = (ref.get_value(q) - check.get_value(q)); - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { if (std::abs(diff[v]) > 1e-12) { @@ -138,9 +136,7 @@ private: { VectorizedArray diff = (refr.get_value(q) - checkr.get_value(q)); - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { if (std::abs(diff[v]) > 1e-12) { diff --git a/tests/matrix_free/get_functions_variants.cc b/tests/matrix_free/get_functions_variants.cc index 2c6f45e29c..364714ccfd 100644 --- a/tests/matrix_free/get_functions_variants.cc +++ b/tests/matrix_free/get_functions_variants.cc @@ -132,8 +132,7 @@ operator()(const MatrixFree &data, // FEEvaluations. Those are tested in other // functions and seen as reference here for (unsigned int q = 0; q < fe_eval.n_q_points; ++q) - for (unsigned int j = 0; j < VectorizedArray::n_array_elements; - ++j) + for (unsigned int j = 0; j < VectorizedArray::size(); ++j) { errors[0] += std::fabs(fe_eval.get_value(q)[j] - fe_eval2.get_value(q)[j]); diff --git a/tests/matrix_free/get_functions_variants_gl.cc b/tests/matrix_free/get_functions_variants_gl.cc index db387ee071..95f46ed965 100644 --- a/tests/matrix_free/get_functions_variants_gl.cc +++ b/tests/matrix_free/get_functions_variants_gl.cc @@ -128,8 +128,7 @@ operator()(const MatrixFree &data, // FEEvaluations. Those are tested in other // functions and seen as reference here for (unsigned int q = 0; q < fe_eval.n_q_points; ++q) - for (unsigned int j = 0; j < VectorizedArray::n_array_elements; - ++j) + for (unsigned int j = 0; j < VectorizedArray::size(); ++j) { errors[0] += std::fabs(fe_eval.get_value(q)[j] - fe_eval2.get_value(q)[j]); diff --git a/tests/matrix_free/get_values_plain.cc b/tests/matrix_free/get_values_plain.cc index 58550ef4e8..67cf1d29de 100644 --- a/tests/matrix_free/get_values_plain.cc +++ b/tests/matrix_free/get_values_plain.cc @@ -75,9 +75,7 @@ public: fe_eval_plain.read_dof_values_plain(src); for (unsigned int i = 0; i < fe_eval.dofs_per_cell; ++i) - for (unsigned int j = 0; - j < VectorizedArray::n_array_elements; - ++j) + for (unsigned int j = 0; j < VectorizedArray::size(); ++j) { error += std::fabs(fe_eval.get_dof_value(i)[j] - fe_eval_plain.get_dof_value(i)[j]); diff --git a/tests/matrix_free/interpolate_functions_common.h b/tests/matrix_free/interpolate_functions_common.h index 914fbf4218..ce14deb268 100644 --- a/tests/matrix_free/interpolate_functions_common.h +++ b/tests/matrix_free/interpolate_functions_common.h @@ -130,8 +130,7 @@ public: fe_evalp.read_dof_values(src); fe_evalp.evaluate(true, true); - for (unsigned int j = 0; j < VectorizedArray::n_array_elements; - ++j) + for (unsigned int j = 0; j < VectorizedArray::size(); ++j) { // skip empty components in VectorizedArray if (data.get_face_info(face).cells_interior[j] == @@ -194,8 +193,7 @@ public: fe_evalm.read_dof_values(src); fe_evalm.evaluate(true, true); - for (unsigned int j = 0; j < VectorizedArray::n_array_elements; - ++j) + for (unsigned int j = 0; j < VectorizedArray::size(); ++j) { // skip empty components in VectorizedArray if (data.get_face_info(face).cells_interior[j] == diff --git a/tests/matrix_free/laplace_operator_02.cc b/tests/matrix_free/laplace_operator_02.cc index 5b1770cd5a..a88bd4b8d5 100644 --- a/tests/matrix_free/laplace_operator_02.cc +++ b/tests/matrix_free/laplace_operator_02.cc @@ -69,7 +69,7 @@ public: { VectorizedArray res = make_vectorized_array(0.); Point p; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { for (unsigned int d = 0; d < dim; d++) p[d] = p_vec[d][v]; diff --git a/tests/matrix_free/matrix_vector_12.cc b/tests/matrix_free/matrix_vector_12.cc index 9372a9be23..e8f86e88c4 100644 --- a/tests/matrix_free/matrix_vector_12.cc +++ b/tests/matrix_free/matrix_vector_12.cc @@ -83,8 +83,7 @@ class MatrixFreeTest { public: typedef VectorizedArray vector_t; - static const std::size_t n_vectors = - VectorizedArray::n_array_elements; + static const std::size_t n_vectors = VectorizedArray::size(); MatrixFreeTest(const MatrixFree &data_in) : data(data_in){}; diff --git a/tests/matrix_free/matrix_vector_13.cc b/tests/matrix_free/matrix_vector_13.cc index c391df4808..f9000a4fa2 100644 --- a/tests/matrix_free/matrix_vector_13.cc +++ b/tests/matrix_free/matrix_vector_13.cc @@ -83,8 +83,7 @@ class MatrixFreeTest { public: typedef VectorizedArray vector_t; - static const std::size_t n_vectors = - VectorizedArray::n_array_elements; + static const std::size_t n_vectors = VectorizedArray::size(); MatrixFreeTest(const MatrixFree &data_in) : data(data_in){}; diff --git a/tests/matrix_free/matrix_vector_20.cc b/tests/matrix_free/matrix_vector_20.cc index 05a6a32eb5..1cb3725661 100644 --- a/tests/matrix_free/matrix_vector_20.cc +++ b/tests/matrix_free/matrix_vector_20.cc @@ -95,8 +95,7 @@ class MatrixFreeTest { public: typedef VectorizedArray vector_t; - static const std::size_t n_vectors = - VectorizedArray::n_array_elements; + static const std::size_t n_vectors = VectorizedArray::size(); MatrixFreeTest(const MatrixFree &data_in) : data(data_in){}; diff --git a/tests/matrix_free/matrix_vector_21.cc b/tests/matrix_free/matrix_vector_21.cc index 4266bda748..8eca70a3b3 100644 --- a/tests/matrix_free/matrix_vector_21.cc +++ b/tests/matrix_free/matrix_vector_21.cc @@ -85,8 +85,7 @@ class MatrixFreeTest { public: typedef VectorizedArray vector_t; - static const std::size_t n_vectors = - VectorizedArray::n_array_elements; + static const std::size_t n_vectors = VectorizedArray::size(); MatrixFreeTest(const MatrixFree &data_in) : data(data_in){}; diff --git a/tests/matrix_free/matrix_vector_22.cc b/tests/matrix_free/matrix_vector_22.cc index 89ac7ef7d1..60b96837b4 100644 --- a/tests/matrix_free/matrix_vector_22.cc +++ b/tests/matrix_free/matrix_vector_22.cc @@ -84,8 +84,7 @@ class MatrixFreeTest { public: typedef VectorizedArray vector_t; - static const std::size_t n_vectors = - VectorizedArray::n_array_elements; + static const std::size_t n_vectors = VectorizedArray::size(); MatrixFreeTest(const MatrixFree &data_in) : data(data_in){}; diff --git a/tests/matrix_free/matrix_vector_23.cc b/tests/matrix_free/matrix_vector_23.cc index 0fc5b02e96..99320148a7 100644 --- a/tests/matrix_free/matrix_vector_23.cc +++ b/tests/matrix_free/matrix_vector_23.cc @@ -96,8 +96,7 @@ class MatrixFreeTest { public: typedef VectorizedArray vector_t; - static const std::size_t n_vectors = - VectorizedArray::n_array_elements; + static const std::size_t n_vectors = VectorizedArray::size(); MatrixFreeTest(const MatrixFree &data_in) : data(data_in){}; diff --git a/tests/matrix_free/matrix_vector_faces_common.h b/tests/matrix_free/matrix_vector_faces_common.h index 7e91396c31..71e2691928 100644 --- a/tests/matrix_free/matrix_vector_faces_common.h +++ b/tests/matrix_free/matrix_vector_faces_common.h @@ -165,17 +165,14 @@ private: { value_type average_value = (fe_eval.get_value(q) - fe_eval_neighbor.get_value(q)) * - make_vectorized_array(0.5); + make_vectorized_array(0.5); value_type average_valgrad = fe_eval.get_normal_derivative(q) + fe_eval_neighbor.get_normal_derivative(q); average_valgrad = average_value * sigmaF - average_valgrad * - make_vectorized_array( - 0.5); + make_vectorized_array(0.5); fe_eval.submit_normal_derivative(-average_value, q); fe_eval_neighbor.submit_normal_derivative(-average_value, q); fe_eval.submit_value(average_valgrad, q); @@ -369,17 +366,14 @@ private: { value_type average_value = (fe_eval.get_value(q) - fe_eval_neighbor.get_value(q)) * - make_vectorized_array(0.5); + make_vectorized_array(0.5); value_type average_valgrad = fe_eval.get_normal_derivative(q) + fe_eval_neighbor.get_normal_derivative(q); average_valgrad = average_value * sigmaF - average_valgrad * - make_vectorized_array( - 0.5); + make_vectorized_array(0.5); fe_eval.submit_normal_derivative(-average_value, q); fe_eval_neighbor.submit_normal_derivative(-average_value, q); fe_eval.submit_value(average_valgrad, q); @@ -592,9 +586,7 @@ private: const VectorizedArrayType normal_times_advection = advection * phi_m.get_normal_vector(q); const value_type flux_times_normal = - make_vectorized_array( - 0.5) * + make_vectorized_array(0.5) * ((u_minus + u_plus) * normal_times_advection + std::abs(normal_times_advection) * (u_minus - u_plus)); phi_m.submit_value(-flux_times_normal, q); @@ -628,8 +620,7 @@ private: number, VectorizedArrayType>::value_type value_type; value_type u_plus; - u_plus = - make_vectorized_array(1.3); + u_plus = make_vectorized_array(1.3); for (unsigned int face = face_range.first; face < face_range.second; face++) { @@ -642,9 +633,7 @@ private: const VectorizedArrayType normal_times_advection = advection * fe_eval.get_normal_vector(q); const value_type flux_times_normal = - make_vectorized_array( - 0.5) * + make_vectorized_array(0.5) * ((u_minus + u_plus) * normal_times_advection + std::abs(normal_times_advection) * (u_minus - u_plus)); fe_eval.submit_value(-flux_times_normal, q); diff --git a/tests/matrix_free/multigrid_dg_sip_02.cc b/tests/matrix_free/multigrid_dg_sip_02.cc index 733a0b0b66..7df1f593a0 100644 --- a/tests/matrix_free/multigrid_dg_sip_02.cc +++ b/tests/matrix_free/multigrid_dg_sip_02.cc @@ -331,13 +331,10 @@ private: std::abs((phif.get_normal_vector(0) * phif.inverse_jacobian(0))[dim - 1]) * (number)(std::max(1, fe_degree) * (fe_degree + 1.0)) * 2.; - std::array::n_array_elements> + std::array::size()> boundary_ids = data.get_faces_by_cells_boundary_id(cell, face); VectorizedArray factor_boundary; - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) // interior face if (boundary_ids[v] == numbers::invalid_boundary_id) factor_boundary[v] = 0.5; diff --git a/tests/matrix_free/no_index_initialize.cc b/tests/matrix_free/no_index_initialize.cc index 2599d3930e..302c6e234c 100644 --- a/tests/matrix_free/no_index_initialize.cc +++ b/tests/matrix_free/no_index_initialize.cc @@ -85,9 +85,7 @@ public: // values should evaluate to one, derivatives to zero for (unsigned int q = 0; q < fe_eval.n_q_points; ++q) - for (unsigned int d = 0; - d < VectorizedArray::n_array_elements; - ++d) + for (unsigned int d = 0; d < VectorizedArray::size(); ++d) { Assert(fe_eval.get_value(q)[d] == 1., ExcInternalError()); for (unsigned int e = 0; e < dim; ++e) diff --git a/tests/matrix_free/read_cell_data_01.cc b/tests/matrix_free/read_cell_data_01.cc index 415256267f..8ebed3be8f 100644 --- a/tests/matrix_free/read_cell_data_01.cc +++ b/tests/matrix_free/read_cell_data_01.cc @@ -180,8 +180,7 @@ private: } } - AlignedVector> - cell_ids; + AlignedVector> cell_ids; }; diff --git a/tests/matrix_free/read_cell_data_02.cc b/tests/matrix_free/read_cell_data_02.cc index 7a11f6a1e5..b534133360 100644 --- a/tests/matrix_free/read_cell_data_02.cc +++ b/tests/matrix_free/read_cell_data_02.cc @@ -151,8 +151,7 @@ private: } } - AlignedVector> - cell_ids; + AlignedVector> cell_ids; }; diff --git a/tests/matrix_free/step-48b.cc b/tests/matrix_free/step-48b.cc index b8106a0c5b..2c3e592b3e 100644 --- a/tests/matrix_free/step-48b.cc +++ b/tests/matrix_free/step-48b.cc @@ -154,9 +154,7 @@ namespace Step48 // components (should be stable irrespective of vectorization // width) if (q == 0) - for (unsigned int v = 0; - v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) deallog << submit_value[v] << " = " << simple_value[v] << " - " << sin_value[v] << std::endl; } diff --git a/tests/matrix_free/stokes_computation.cc b/tests/matrix_free/stokes_computation.cc index 67aebc6b53..1accfa44e6 100644 --- a/tests/matrix_free/stokes_computation.cc +++ b/tests/matrix_free/stokes_computation.cc @@ -486,9 +486,7 @@ namespace StokesClass { VectorizedArray return_value = make_vectorized_array(1.); - for (unsigned int i = 0; - i < VectorizedArray::n_array_elements; - ++i) + for (unsigned int i = 0; i < VectorizedArray::size(); ++i) { Point p; for (unsigned int d = 0; d < dim; ++d) @@ -623,9 +621,7 @@ namespace StokesClass { VectorizedArray return_value = make_vectorized_array(1.); - for (unsigned int i = 0; - i < VectorizedArray::n_array_elements; - ++i) + for (unsigned int i = 0; i < VectorizedArray::size(); ++i) { Point p; for (unsigned int d = 0; d < dim; ++d) @@ -803,9 +799,7 @@ namespace StokesClass { VectorizedArray return_value = make_vectorized_array(1.); - for (unsigned int i = 0; - i < VectorizedArray::n_array_elements; - ++i) + for (unsigned int i = 0; i < VectorizedArray::size(); ++i) { Point p; for (unsigned int d = 0; d < dim; ++d) @@ -1228,9 +1222,7 @@ namespace StokesClass for (unsigned int d = 0; d < dim; ++d) rhs_u[d] = make_vectorized_array(1.0); VectorizedArray rhs_p = make_vectorized_array(1.0); - for (unsigned int i = 0; - i < VectorizedArray::n_array_elements; - ++i) + for (unsigned int i = 0; i < VectorizedArray::size(); ++i) { Point p; for (unsigned int d = 0; d < dim; ++d) diff --git a/tests/numerics/project_parallel_qp_common.h b/tests/numerics/project_parallel_qp_common.h index 580a18d547..2ab69a3df7 100644 --- a/tests/numerics/project_parallel_qp_common.h +++ b/tests/numerics/project_parallel_qp_common.h @@ -78,7 +78,7 @@ public: { VectorizedArray res = make_vectorized_array(0.); Point p; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { for (unsigned int d = 0; d < dim; d++) p[d] = p_vec[d][v]; diff --git a/tests/numerics/project_parallel_qpmf_common.h b/tests/numerics/project_parallel_qpmf_common.h index 357a4926a2..2f9a0dc2cb 100644 --- a/tests/numerics/project_parallel_qpmf_common.h +++ b/tests/numerics/project_parallel_qpmf_common.h @@ -80,7 +80,7 @@ public: { VectorizedArray res = make_vectorized_array(0.); Point p; - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) { for (unsigned int d = 0; d < dim; d++) p[d] = p_vec[d][v]; diff --git a/tests/physics/elasticity-kinematics_02.cc b/tests/physics/elasticity-kinematics_02.cc index 10ef530719..130f7d3fdd 100644 --- a/tests/physics/elasticity-kinematics_02.cc +++ b/tests/physics/elasticity-kinematics_02.cc @@ -55,7 +55,7 @@ main() // Scale the gradients along the vectorization-index so that each grad_u[v] is // unique. - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; v++) + for (unsigned int v = 0; v < VectorizedArray::size(); v++) for (unsigned int i = 0; i < dim; i++) for (unsigned int j = 0; j < dim; j++) grad_u[i][j][v] *= (v + 1); @@ -69,7 +69,7 @@ main() // You can't use .norm() on some difference-tensor of the two so we compare // element-wise! - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; v++) + for (unsigned int v = 0; v < VectorizedArray::size(); v++) for (unsigned int i = 0; i < dim; i++) for (unsigned int j = 0; j < dim; j++) if (F_solution[i][j][v] - F_test[i][j][v] != 0.0) @@ -84,7 +84,7 @@ main() SymmetricTensor<2, dim, VectorizedArray> E_test = Kinematics::E(F_test); - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; v++) + for (unsigned int v = 0; v < VectorizedArray::size(); v++) for (unsigned int i = 0; i < dim; i++) for (unsigned int j = 0; j < dim; j++) if (E_test[i][j][v] - E_solution[i][j][v] != 0.0) @@ -96,7 +96,7 @@ main() Tensor<2, dim, VectorizedArray> F_iso_test; F_iso_test = Kinematics::F_iso(F_test); - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; v++) + for (unsigned int v = 0; v < VectorizedArray::size(); v++) for (unsigned int i = 0; i < dim; i++) for (unsigned int j = 0; j < dim; j++) if (F_iso_test[i][j][v] - F_iso_solution[i][j][v] != 0.0) diff --git a/tests/tensors/symmetric_tensor_38.cc b/tests/tensors/symmetric_tensor_38.cc index 1c1e40153f..17c2406b3e 100644 --- a/tests/tensors/symmetric_tensor_38.cc +++ b/tests/tensors/symmetric_tensor_38.cc @@ -52,8 +52,7 @@ main() deallog << r1[i][j][0] << std::endl; AssertThrow(std::abs(r1[i][j][0] - factor_float * s1[i][j][0]) < 1.e-10, ExcInternalError()); - for (unsigned int k = 1; k < VectorizedArray::n_array_elements; - ++k) + for (unsigned int k = 1; k < VectorizedArray::size(); ++k) { AssertThrow(std::abs(r1[i][j][k] - r1[i][j][0]) < 1.e-10, ExcInternalError()); @@ -61,8 +60,7 @@ main() deallog << r2[i][j][0] << std::endl; Assert(std::abs(r2[i][j][0] - factor_double * s2[i][j][0]) < 1.e-10, ExcInternalError()); - for (unsigned int k = 1; k < VectorizedArray::n_array_elements; - ++k) + for (unsigned int k = 1; k < VectorizedArray::size(); ++k) { AssertThrow(std::abs(r2[i][j][k] - r2[i][j][0]) < 1.e-10, ExcInternalError()); diff --git a/tests/tensors/symmetric_tensor_39.cc b/tests/tensors/symmetric_tensor_39.cc index 1fef6758bf..1e3e7c9e26 100644 --- a/tests/tensors/symmetric_tensor_39.cc +++ b/tests/tensors/symmetric_tensor_39.cc @@ -32,9 +32,7 @@ void fill_tensor( Number counter = 0.0; for (unsigned int i = 0; i < dim; ++i) for (unsigned int j = 0; j < dim; ++j) - for (unsigned int v = 0; - v < dealii::VectorizedArray::n_array_elements; - v++) + for (unsigned int v = 0; v < dealii::VectorizedArray::size(); v++) { A[i][j][v] = counter; counter += 1.0; @@ -72,8 +70,7 @@ main() // like VectorizedArray frob_norm = B.norm() -> Maybe a TODO? for (unsigned int i = 0; i < dim; ++i) for (unsigned int j = 0; j < dim; ++j) - for (unsigned int v = 0; v < VectorizedArray::n_array_elements; - ++v) + for (unsigned int v = 0; v < VectorizedArray::size(); ++v) if (B[i][j][v] != 0.0) deallog << "Not OK" << std::endl;