Reference documentation for deal.II version GIT relicensing-384-g4769914377 2024-04-13 09:00:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
vector_access_internal.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2019 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15
16#ifndef dealii_matrix_free_vector_access_internal_h
17#define dealii_matrix_free_vector_access_internal_h
18
19#include <deal.II/base/config.h>
20
22
26
27#ifdef DEBUG
28# include <boost/algorithm/string/join.hpp>
29#endif
30
32
33
34namespace internal
35{
36 // below we use type-traits from matrix-free/type_traits.h
37
38 // access to generic const vectors that have operator ().
39 // FIXME: this is wrong for Trilinos/PETSc MPI vectors
40 // where we should first do Partitioner::local_to_global()
41 template <
42 typename VectorType,
43 std::enable_if_t<!has_local_element<VectorType>, VectorType> * = nullptr>
44 inline typename VectorType::value_type
45 vector_access(const VectorType &vec, const unsigned int entry)
46 {
47 return vec(entry);
48 }
49
50
51
52 // access to generic non-const vectors that have operator ().
53 // FIXME: this is wrong for Trilinos/PETSc MPI vectors
54 // where we should first do Partitioner::local_to_global()
55 template <
56 typename VectorType,
57 std::enable_if_t<!has_local_element<VectorType>, VectorType> * = nullptr>
58 inline typename VectorType::value_type &
59 vector_access(VectorType &vec, const unsigned int entry)
60 {
61 return vec(entry);
62 }
63
64
65
66 // access to distributed MPI vectors that have a local_element(uint)
67 // method to access data in local index space, which is what we use in
68 // DoFInfo and hence in read_dof_values etc.
69 template <
70 typename VectorType,
71 std::enable_if_t<has_local_element<VectorType>, VectorType> * = nullptr>
72 inline typename VectorType::value_type &
73 vector_access(VectorType &vec, const unsigned int entry)
74 {
75 return vec.local_element(entry);
76 }
77
78
79
80 // same for const access
81 template <
82 typename VectorType,
83 std::enable_if_t<has_local_element<VectorType>, VectorType> * = nullptr>
84 inline typename VectorType::value_type
85 vector_access(const VectorType &vec, const unsigned int entry)
86 {
87 return vec.local_element(entry);
88 }
89
90
91
92 template <
93 typename VectorType,
94 std::enable_if_t<has_add_local_element<VectorType>, VectorType> * = nullptr>
95 inline void
96 vector_access_add(VectorType &vec,
97 const unsigned int entry,
98 const typename VectorType::value_type &val)
99 {
100 vec.add_local_element(entry, val);
101 }
102
103
104
105 template <typename VectorType,
106 std::enable_if_t<!has_add_local_element<VectorType>, VectorType> * =
107 nullptr>
108 inline void
109 vector_access_add(VectorType &vec,
110 const unsigned int entry,
111 const typename VectorType::value_type &val)
112 {
113 vector_access(vec, entry) += val;
114 }
115
116
117
118 template <
119 typename VectorType,
120 std::enable_if_t<has_add_local_element<VectorType>, VectorType> * = nullptr>
121 inline void
123 const types::global_dof_index entry,
124 const typename VectorType::value_type &val)
125 {
126 vec.add(entry, val);
127 }
128
129
130
131 template <typename VectorType,
132 std::enable_if_t<!has_add_local_element<VectorType>, VectorType> * =
133 nullptr>
134 inline void
135 vector_access_add_global(VectorType &vec,
136 const types::global_dof_index entry,
137 const typename VectorType::value_type &val)
138 {
139 vec(entry) += val;
140 }
141
142
143
144 template <
145 typename VectorType,
146 std::enable_if_t<has_set_local_element<VectorType>, VectorType> * = nullptr>
147 inline void
148 vector_access_set(VectorType &vec,
149 const unsigned int entry,
150 const typename VectorType::value_type &val)
151 {
152 vec.set_local_element(entry, val);
153 }
154
155
156
157 template <typename VectorType,
158 std::enable_if_t<!has_set_local_element<VectorType>, VectorType> * =
159 nullptr>
160 inline void
161 vector_access_set(VectorType &vec,
162 const unsigned int entry,
163 const typename VectorType::value_type &val)
164 {
165 vector_access(vec, entry) = val;
166 }
167
168
169
170 // this is to make sure that the parallel partitioning in VectorType
171 // is really the same as stored in MatrixFree.
172 // version below is when has_partitioners_are_compatible == false
173 // FIXME: this is incorrect for PETSc/Trilinos MPI vectors
174 template <int dim,
175 typename Number,
176 typename VectorizedArrayType,
177 typename VectorType,
178 std::enable_if_t<!has_partitioners_are_compatible<VectorType>,
179 VectorType> * = nullptr>
180 inline void
182 const VectorType &vec,
185 {
186 (void)vec;
187 (void)matrix_free;
188 (void)dof_info;
189
190 AssertDimension(vec.size(), dof_info.vector_partitioner->size());
191 }
192
193
194
195 // same as above for has_partitioners_are_compatible == true
196 template <int dim,
197 typename Number,
198 typename VectorizedArrayType,
199 typename VectorType,
200 std::enable_if_t<has_partitioners_are_compatible<VectorType>,
201 VectorType> * = nullptr>
202 inline void
204 const VectorType &vec,
207 {
208 (void)vec;
209 (void)matrix_free;
210 (void)dof_info;
211
212#ifdef DEBUG
213 if (vec.partitioners_are_compatible(*dof_info.vector_partitioner) == false)
214 {
215 unsigned int dof_index = numbers::invalid_unsigned_int;
216
217 for (unsigned int i = 0; i < matrix_free.n_components(); ++i)
218 if (&matrix_free.get_dof_info(i) == &dof_info)
219 {
220 dof_index = i;
221 break;
222 }
223
225
226 std::vector<std::string> dof_indices_with_compatible_partitioners;
227
228 for (unsigned int i = 0; i < matrix_free.n_components(); ++i)
229 if (vec.partitioners_are_compatible(
230 *matrix_free.get_dof_info(i).vector_partitioner))
231 dof_indices_with_compatible_partitioners.push_back(
232 std::to_string(i));
233
234 if (dof_indices_with_compatible_partitioners.empty())
235 {
236 Assert(false,
237 ExcMessage("The parallel layout of the given vector is "
238 "compatible neither with the Partitioner of the "
239 "current FEEvaluation with dof_handler_index=" +
240 std::to_string(dof_index) +
241 " nor with any Partitioner in MatrixFree. A "
242 "potential reason is that you did not use "
243 "MatrixFree::initialize_dof_vector() to get a "
244 "compatible vector."));
245 }
246 else
247 {
248 Assert(
249 false,
251 "The parallel layout of the given vector is "
252 "not compatible with the Partitioner of the "
253 "current FEEvaluation with dof_handler_index=" +
254 std::to_string(dof_index) +
255 ". However, the underlying "
256 "MatrixFree contains Partitioner objects that are compatible. "
257 "They have the following dof_handler_index values: " +
258 boost::algorithm::join(dof_indices_with_compatible_partitioners,
259 ", ") +
260 ". Did you want to pass any of these values to the "
261 "constructor of the current FEEvaluation object or "
262 "did you not use MatrixFree::initialize_dof_vector() "
263 "with dof_handler_index=" +
264 std::to_string(dof_index) +
265 " to get a "
266 "compatible vector?"));
267 }
268 }
269#endif
270 }
271
272
273
274 // Below, three classes (VectorReader, VectorSetter,
275 // VectorDistributorLocalToGlobal) implement the same interface and can be
276 // used to to read from vector, set elements of a vector and add to elements
277 // of the vector.
278
279 // 1. A class to read data from vector
280 template <typename Number, typename VectorizedArrayType>
282 {
283 template <typename VectorType>
284 void
285 process_dof(const unsigned int index,
286 const VectorType &vec,
287 Number &res) const
288 {
289 res = vector_access(vec, index);
290 }
291
292
293
294 template <typename VectorNumberType>
295 void
296 process_dof(const VectorNumberType &global, Number &local) const
297 {
298 local = global;
299 }
300
301
302
303 template <typename VectorType>
304 void
305 process_dofs_vectorized(const unsigned int dofs_per_cell,
306 const unsigned int dof_index,
307 VectorType &vec,
308 VectorizedArrayType *dof_values,
309 std::bool_constant<true>) const
310 {
311#ifdef DEBUG
312 // in debug mode, run non-vectorized version because this path
313 // has additional checks (e.g., regarding ghosting)
315 dofs_per_cell, dof_index, vec, dof_values, std::bool_constant<false>());
316#else
317 const Number *vec_ptr = vec.begin() + dof_index;
318 for (unsigned int i = 0; i < dofs_per_cell;
319 ++i, vec_ptr += VectorizedArrayType::size())
320 dof_values[i].load(vec_ptr);
321#endif
322 }
323
324
325
326 template <typename VectorType>
327 void
328 process_dofs_vectorized(const unsigned int dofs_per_cell,
329 const unsigned int dof_index,
330 const VectorType &vec,
331 VectorizedArrayType *dof_values,
332 std::bool_constant<false>) const
333 {
334 for (unsigned int i = 0; i < dofs_per_cell; ++i)
335 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
336 dof_values[i][v] =
337 vector_access(vec, dof_index + v + i * VectorizedArrayType::size());
338 }
339
340
341
342 template <typename VectorType>
343 void
344 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
345 const unsigned int *dof_indices,
346 VectorType &vec,
347 const unsigned int constant_offset,
348 VectorizedArrayType *dof_values,
349 std::bool_constant<true>) const
350 {
352 vec.begin() + constant_offset,
353 dof_indices,
354 dof_values);
355 }
356
357
358
359 template <typename VectorType>
360 void
361 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
362 const unsigned int *dof_indices,
363 const VectorType &vec,
364 const unsigned int constant_offset,
365 VectorizedArrayType *dof_values,
366 std::bool_constant<false>) const
367 {
368 for (unsigned int d = 0; d < dofs_per_cell; ++d)
369 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
370 dof_values[d][v] =
371 vector_access(vec, dof_indices[v] + constant_offset + d);
372 }
373
374
375
376 template <typename VectorType>
377 void
378 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
379 const unsigned int *dof_indices,
380 VectorType &vec,
381 VectorizedArrayType *dof_values,
382 std::bool_constant<true> type) const
383 {
385 dofs_per_cell, dof_indices, vec, 0, dof_values, type);
386 }
387
388
389
390 template <typename VectorType>
391 void
392 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
393 const unsigned int *dof_indices,
394 const VectorType &vec,
395 VectorizedArrayType *dof_values,
396 std::bool_constant<false> type) const
397 {
399 dofs_per_cell, dof_indices, vec, 0, dof_values, type);
400 }
401
402
403
404 template <typename Number2>
405 void
407 const unsigned int dofs_per_cell,
408 const std::array<Number2 *, VectorizedArrayType::size()> &global_ptr,
409 VectorizedArrayType *dof_values,
410 std::bool_constant<true>) const
411 {
413 global_ptr,
414 dof_values);
415 }
416
417
418
419 template <typename Number2>
420 void
422 const unsigned int,
423 const std::array<Number2 *, VectorizedArrayType::size()> &,
424 VectorizedArrayType *,
425 std::bool_constant<false>) const
426 {
428 }
429
430
431
432 // variant where VectorType::value_type is the same as Number -> can call
433 // gather
434 template <typename VectorType>
435 void
436 process_dof_gather(const unsigned int *indices,
437 VectorType &vec,
438 const unsigned int constant_offset,
439 typename VectorType::value_type *vec_ptr,
440 VectorizedArrayType &res,
441 std::bool_constant<true>) const
442 {
443 (void)constant_offset;
444 (void)vec;
445
446#ifdef DEBUG
447 // in debug mode, run non-vectorized version because this path
448 // has additional checks (e.g., regarding ghosting)
449 Assert(vec_ptr == vec.begin() + constant_offset, ExcInternalError());
450 process_dof_gather(indices,
451 vec,
452 constant_offset,
453 vec_ptr,
454 res,
455 std::bool_constant<false>());
456#else
457 res.gather(vec_ptr, indices);
458#endif
459 }
460
461
462
463 // variant where VectorType::value_type is not the same as Number -> must
464 // manually load the data
465 template <typename VectorType>
466 void
467 process_dof_gather(const unsigned int *indices,
468 const VectorType &vec,
469 const unsigned int constant_offset,
470 typename VectorType::value_type *,
471 VectorizedArrayType &res,
472 std::bool_constant<false>) const
473 {
474 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
475 res[v] = vector_access(vec, indices[v] + constant_offset);
476 }
477
478
479
480 template <typename VectorType>
481 void
483 const VectorType &vec,
484 Number &res) const
485 {
486 res = vec(index);
487 }
488
489
490
491 void
492 pre_constraints(const Number &, Number &res) const
493 {
494 res = Number();
495 }
496
497
498
499 template <typename VectorType>
500 void
501 process_constraint(const unsigned int index,
502 const Number weight,
503 const VectorType &vec,
504 Number &res) const
505 {
506 res += weight * vector_access(vec, index);
507 }
508
509
510
511 void
512 post_constraints(const Number &sum, Number &write_pos) const
513 {
514 write_pos = sum;
515 }
516
517
518
519 void
520 process_empty(VectorizedArrayType &res) const
521 {
522 res = VectorizedArrayType();
523 }
524 };
525
526
527
528 // 2. A class to add values to the vector during
529 // FEEvaluation::distribute_local_to_global() call
530 template <typename Number, typename VectorizedArrayType>
532 {
533 template <typename VectorType>
534 void
535 process_dof(const unsigned int index, VectorType &vec, Number &res) const
536 {
537 vector_access_add(vec, index, res);
538 }
539
540
541 template <typename VectorNumberType>
542 void
543 process_dof(VectorNumberType &global, Number &local) const
544 {
545 global += local;
546 }
547
548
549
550 template <typename VectorType>
551 void
552 process_dofs_vectorized(const unsigned int dofs_per_cell,
553 const unsigned int dof_index,
554 VectorType &vec,
555 VectorizedArrayType *dof_values,
556 std::bool_constant<true>) const
557 {
558 Number *vec_ptr = vec.begin() + dof_index;
559 for (unsigned int i = 0; i < dofs_per_cell;
560 ++i, vec_ptr += VectorizedArrayType::size())
561 {
562 VectorizedArrayType tmp;
563 tmp.load(vec_ptr);
564 tmp += dof_values[i];
565 tmp.store(vec_ptr);
566 }
567 }
568
569
570
571 template <typename VectorType>
572 void
573 process_dofs_vectorized(const unsigned int dofs_per_cell,
574 const unsigned int dof_index,
575 VectorType &vec,
576 VectorizedArrayType *dof_values,
577 std::bool_constant<false>) const
578 {
579 for (unsigned int i = 0; i < dofs_per_cell; ++i)
580 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
582 dof_index + v + i * VectorizedArrayType::size(),
583 dof_values[i][v]);
584 }
585
586
587
588 template <typename VectorType>
589 void
590 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
591 const unsigned int *dof_indices,
592 VectorType &vec,
593 const unsigned int constant_offset,
594 VectorizedArrayType *dof_values,
595 std::bool_constant<true>) const
596 {
598 dofs_per_cell,
599 dof_values,
600 dof_indices,
601 vec.begin() + constant_offset);
602 }
603
604
605
606 template <typename VectorType>
607 void
608 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
609 const unsigned int *dof_indices,
610 VectorType &vec,
611 const unsigned int constant_offset,
612 VectorizedArrayType *dof_values,
613 std::bool_constant<false>) const
614 {
615 for (unsigned int d = 0; d < dofs_per_cell; ++d)
616 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
618 dof_indices[v] + constant_offset + d,
619 dof_values[d][v]);
620 }
621
622
623
624 template <typename VectorType>
625 void
626 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
627 const unsigned int *dof_indices,
628 VectorType &vec,
629 VectorizedArrayType *dof_values,
630 std::bool_constant<true> type) const
631 {
633 dofs_per_cell, dof_indices, vec, 0, dof_values, type);
634 }
635
636
637
638 template <typename VectorType>
639 void
640 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
641 const unsigned int *dof_indices,
642 VectorType &vec,
643 VectorizedArrayType *dof_values,
644 std::bool_constant<false> type) const
645 {
647 dofs_per_cell, dof_indices, vec, 0, dof_values, type);
648 }
649
650
651
652 template <typename Number2>
653 void
655 const unsigned int dofs_per_cell,
656 std::array<Number2 *, VectorizedArrayType::size()> &global_ptr,
657 VectorizedArrayType *dof_values,
658 std::bool_constant<true>) const
659 {
661 dofs_per_cell,
662 dof_values,
663 global_ptr);
664 }
665
666
667
668 template <typename Number2>
669 void
671 const unsigned int,
672 std::array<Number2 *, VectorizedArrayType::size()> &,
673 VectorizedArrayType *,
674 std::bool_constant<false>) const
675 {
677 }
678
679
680
681 // variant where VectorType::value_type is the same as Number -> can call
682 // scatter
683 template <typename VectorType>
684 void
685 process_dof_gather(const unsigned int *indices,
686 VectorType &vec,
687 const unsigned int constant_offset,
688 typename VectorType::value_type *vec_ptr,
689 VectorizedArrayType &res,
690 std::bool_constant<true>) const
691 {
692 (void)constant_offset;
693 (void)vec_ptr;
694 (void)vec;
695
696#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS < 512
697 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
698 vector_access(vec, indices[v] + constant_offset) += res[v];
699#else
700 // only use gather in case there is also scatter.
701 VectorizedArrayType tmp;
702 tmp.gather(vec_ptr, indices);
703 tmp += res;
704 tmp.scatter(indices, vec_ptr);
705#endif
706 }
707
708
709
710 // variant where VectorType::value_type is not the same as Number -> must
711 // manually append all data
712 template <typename VectorType>
713 void
714 process_dof_gather(const unsigned int *indices,
715 VectorType &vec,
716 const unsigned int constant_offset,
717 typename VectorType::value_type *,
718 VectorizedArrayType &res,
719 std::bool_constant<false>) const
720 {
721 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
722 vector_access_add(vec, indices[v] + constant_offset, res[v]);
723 }
724
725
726
727 template <typename VectorType>
728 void
730 VectorType &vec,
731 Number &res) const
732 {
734 }
735
736
737
738 void
739 pre_constraints(const Number &input, Number &res) const
740 {
741 res = input;
742 }
743
744
745
746 template <typename VectorType>
747 void
748 process_constraint(const unsigned int index,
749 const Number weight,
750 VectorType &vec,
751 Number &res) const
752 {
753 vector_access_add(vec, index, weight * res);
754 }
755
756
757
758 void
759 post_constraints(const Number &, Number &) const
760 {}
761
762
763
764 void
765 process_empty(VectorizedArrayType &) const
766 {}
767 };
768
769
770
771 // 3. A class to set elements of the vector
772 template <typename Number, typename VectorizedArrayType>
774 {
775 template <typename VectorType>
776 void
777 process_dof(const unsigned int index, VectorType &vec, Number &res) const
778 {
779 vector_access(vec, index) = res;
780 }
781
782
783
784 template <typename VectorNumberType>
785 void
786 process_dof(VectorNumberType &global, Number &local) const
787 {
788 global = local;
789 }
790
791
792
793 template <typename VectorType>
794 void
795 process_dofs_vectorized(const unsigned int dofs_per_cell,
796 const unsigned int dof_index,
797 VectorType &vec,
798 VectorizedArrayType *dof_values,
799 std::bool_constant<true>) const
800 {
801 Number *vec_ptr = vec.begin() + dof_index;
802 for (unsigned int i = 0; i < dofs_per_cell;
803 ++i, vec_ptr += VectorizedArrayType::size())
804 dof_values[i].store(vec_ptr);
805 }
806
807
808
809 template <typename VectorType>
810 void
811 process_dofs_vectorized(const unsigned int dofs_per_cell,
812 const unsigned int dof_index,
813 VectorType &vec,
814 VectorizedArrayType *dof_values,
815 std::bool_constant<false>) const
816 {
817 for (unsigned int i = 0; i < dofs_per_cell; ++i)
818 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
819 vector_access(vec, dof_index + v + i * VectorizedArrayType::size()) =
820 dof_values[i][v];
821 }
822
823
824
825 template <typename VectorType>
826 void
827 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
828 const unsigned int *dof_indices,
829 VectorType &vec,
830 const unsigned int constant_offset,
831 VectorizedArrayType *dof_values,
832 std::bool_constant<true>) const
833 {
835 dofs_per_cell,
836 dof_values,
837 dof_indices,
838 vec.begin() + constant_offset);
839 }
840
841
842
843 template <typename VectorType, bool booltype>
844 void
845 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
846 const unsigned int *dof_indices,
847 VectorType &vec,
848 const unsigned int constant_offset,
849 VectorizedArrayType *dof_values,
850 std::bool_constant<false>) const
851 {
852 for (unsigned int i = 0; i < dofs_per_cell; ++i)
853 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
854 vector_access(vec, constant_offset + dof_indices[v] + i) =
855 dof_values[i][v];
856 }
857
858
859
860 template <typename VectorType>
861 void
862 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
863 const unsigned int *dof_indices,
864 VectorType &vec,
865 VectorizedArrayType *dof_values,
866 std::bool_constant<true> type) const
867 {
869 dofs_per_cell, dof_indices, vec, 0, dof_values, type);
870 }
871
872
873
874 template <typename VectorType, bool booltype>
875 void
876 process_dofs_vectorized_transpose(const unsigned int dofs_per_cell,
877 const unsigned int *dof_indices,
878 VectorType &vec,
879 VectorizedArrayType *dof_values,
880 std::bool_constant<false> type) const
881 {
883 dofs_per_cell, dof_indices, vec, 0, dof_values, type);
884 }
885
886
887
888 template <typename Number2>
889 void
891 const unsigned int dofs_per_cell,
892 std::array<Number2 *, VectorizedArrayType::size()> &global_ptr,
893 VectorizedArrayType *dof_values,
894 std::bool_constant<true>) const
895 {
897 dofs_per_cell,
898 dof_values,
899 global_ptr);
900 }
901
902
903
904 template <typename Number2>
905 void
907 const unsigned int,
908 std::array<Number2 *, VectorizedArrayType::size()> &,
909 VectorizedArrayType *,
910 std::bool_constant<false>) const
911 {
913 }
914
915
916
917 template <typename VectorType>
918 void
919 process_dof_gather(const unsigned int *indices,
920 VectorType &vec,
921 const unsigned int constant_offset,
922 typename VectorType::value_type *vec_ptr,
923 VectorizedArrayType &res,
924 std::bool_constant<true>) const
925 {
926 (void)vec_ptr;
927 (void)constant_offset;
928 (void)vec;
929 Assert(vec_ptr == vec.begin() + constant_offset, ExcInternalError());
930 res.scatter(indices, vec_ptr);
931 }
932
933
934
935 template <typename VectorType>
936 void
937 process_dof_gather(const unsigned int *indices,
938 VectorType &vec,
939 const unsigned int constant_offset,
940 typename VectorType::value_type *,
941 VectorizedArrayType &res,
942 std::bool_constant<false>) const
943 {
944 for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
945 vector_access(vec, indices[v] + constant_offset) = res[v];
946 }
947
948
949
950 template <typename VectorType>
951 void
953 VectorType &vec,
954 Number &res) const
955 {
956 vec(index) = res;
957 }
958
959
960
961 void
962 pre_constraints(const Number &, Number &) const
963 {}
964
965
966
967 template <typename VectorType>
968 void
969 process_constraint(const unsigned int,
970 const Number,
971 VectorType &,
972 Number &) const
973 {}
974
975
976
977 void
978 post_constraints(const Number &, Number &) const
979 {}
980
981
982
983 void
984 process_empty(VectorizedArrayType &) const
985 {}
986 };
987} // namespace internal
988
989
991
992#endif
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info(const unsigned int dof_handler_index_component=0) const
unsigned int n_components() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define DEAL_II_NOT_IMPLEMENTED()
void vector_access_add(VectorType &vec, const unsigned int entry, const typename VectorType::value_type &val)
void check_vector_compatibility(const VectorType &vec, const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const internal::MatrixFreeFunctions::DoFInfo &dof_info)
void vector_access_add_global(VectorType &vec, const types::global_dof_index entry, const typename VectorType::value_type &val)
VectorType::value_type vector_access(const VectorType &vec, const unsigned int entry)
void vector_access_set(VectorType &vec, const unsigned int entry, const typename VectorType::value_type &val)
static const unsigned int invalid_unsigned_int
Definition types.h:220
std::shared_ptr< const Utilities::MPI::Partitioner > vector_partitioner
Definition dof_info.h:592
void process_dof_gather(const unsigned int *indices, VectorType &vec, const unsigned int constant_offset, typename VectorType::value_type *vec_ptr, VectorizedArrayType &res, std::bool_constant< true >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< false > type) const
void pre_constraints(const Number &input, Number &res) const
void process_empty(VectorizedArrayType &) const
void process_dof(const unsigned int index, VectorType &vec, Number &res) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, const unsigned int constant_offset, VectorizedArrayType *dof_values, std::bool_constant< false >) const
void post_constraints(const Number &, Number &) const
void process_dofs_vectorized(const unsigned int dofs_per_cell, const unsigned int dof_index, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dofs_vectorized(const unsigned int dofs_per_cell, const unsigned int dof_index, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< false >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, const unsigned int constant_offset, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< true > type) const
void process_dofs_vectorized_transpose(const unsigned int, std::array< Number2 *, VectorizedArrayType::size()> &, VectorizedArrayType *, std::bool_constant< false >) const
void process_dof_gather(const unsigned int *indices, VectorType &vec, const unsigned int constant_offset, typename VectorType::value_type *, VectorizedArrayType &res, std::bool_constant< false >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, std::array< Number2 *, VectorizedArrayType::size()> &global_ptr, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dof(VectorNumberType &global, Number &local) const
void process_constraint(const unsigned int index, const Number weight, VectorType &vec, Number &res) const
void process_dof_global(const types::global_dof_index index, VectorType &vec, Number &res) const
void pre_constraints(const Number &, Number &res) const
void post_constraints(const Number &sum, Number &write_pos) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, const unsigned int constant_offset, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dof_global(const types::global_dof_index index, const VectorType &vec, Number &res) const
void process_dofs_vectorized(const unsigned int dofs_per_cell, const unsigned int dof_index, const VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< false >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, const VectorType &vec, const unsigned int constant_offset, VectorizedArrayType *dof_values, std::bool_constant< false >) const
void process_constraint(const unsigned int index, const Number weight, const VectorType &vec, Number &res) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< true > type) const
void process_dof_gather(const unsigned int *indices, const VectorType &vec, const unsigned int constant_offset, typename VectorType::value_type *, VectorizedArrayType &res, std::bool_constant< false >) const
void process_dofs_vectorized(const unsigned int dofs_per_cell, const unsigned int dof_index, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dof(const VectorNumberType &global, Number &local) const
void process_empty(VectorizedArrayType &res) const
void process_dof(const unsigned int index, const VectorType &vec, Number &res) const
void process_dofs_vectorized_transpose(const unsigned int, const std::array< Number2 *, VectorizedArrayType::size()> &, VectorizedArrayType *, std::bool_constant< false >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, const VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< false > type) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const std::array< Number2 *, VectorizedArrayType::size()> &global_ptr, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dof_gather(const unsigned int *indices, VectorType &vec, const unsigned int constant_offset, typename VectorType::value_type *vec_ptr, VectorizedArrayType &res, std::bool_constant< true >) const
void process_dofs_vectorized(const unsigned int dofs_per_cell, const unsigned int dof_index, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< false >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, std::array< Number2 *, VectorizedArrayType::size()> &global_ptr, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_empty(VectorizedArrayType &) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< true > type) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, const unsigned int constant_offset, VectorizedArrayType *dof_values, std::bool_constant< false >) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< false > type) const
void process_dofs_vectorized_transpose(const unsigned int dofs_per_cell, const unsigned int *dof_indices, VectorType &vec, const unsigned int constant_offset, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dof_global(const types::global_dof_index index, VectorType &vec, Number &res) const
void pre_constraints(const Number &, Number &) const
void process_dof_gather(const unsigned int *indices, VectorType &vec, const unsigned int constant_offset, typename VectorType::value_type *vec_ptr, VectorizedArrayType &res, std::bool_constant< true >) const
void process_dofs_vectorized(const unsigned int dofs_per_cell, const unsigned int dof_index, VectorType &vec, VectorizedArrayType *dof_values, std::bool_constant< true >) const
void process_dofs_vectorized_transpose(const unsigned int, std::array< Number2 *, VectorizedArrayType::size()> &, VectorizedArrayType *, std::bool_constant< false >) const
void process_constraint(const unsigned int, const Number, VectorType &, Number &) const
void process_dof(const unsigned int index, VectorType &vec, Number &res) const
void post_constraints(const Number &, Number &) const
void process_dof(VectorNumberType &global, Number &local) const
void process_dof_gather(const unsigned int *indices, VectorType &vec, const unsigned int constant_offset, typename VectorType::value_type *, VectorizedArrayType &res, std::bool_constant< false >) const
void vectorized_load_and_transpose(const unsigned int n_entries, const Number *in, const unsigned int *offsets, VectorizedArray< Number, width > *out)
void vectorized_transpose_and_store(const bool add_into, const unsigned int n_entries, const VectorizedArray< Number, width > *in, const unsigned int *offsets, Number *out)