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