Reference documentation for deal.II version 9.2.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\}}\)
aligned_vector.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2020 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_aligned_vector_h
18 #define dealii_aligned_vector_h
19 
20 #include <deal.II/base/config.h>
21 
24 #include <deal.II/base/parallel.h>
25 #include <deal.II/base/utilities.h>
26 
27 // boost::serialization::make_array used to be in array.hpp, but was
28 // moved to a different file in BOOST 1.64
29 #include <boost/version.hpp>
30 #if BOOST_VERSION >= 106400
31 # include <boost/serialization/array_wrapper.hpp>
32 #else
33 # include <boost/serialization/array.hpp>
34 #endif
35 #include <boost/serialization/split_member.hpp>
36 
37 #include <cstring>
38 #include <type_traits>
39 
40 
41 
43 
44 
60 template <class T>
62 {
63 public:
68  using value_type = T;
69  using pointer = value_type *;
70  using const_pointer = const value_type *;
71  using iterator = value_type *;
72  using const_iterator = const value_type *;
73  using reference = value_type &;
74  using const_reference = const value_type &;
75  using size_type = std::size_t;
76 
80  AlignedVector();
81 
88  AlignedVector(const size_type size, const T &init = T());
89 
94 
100  AlignedVector(const AlignedVector<T> &vec);
101 
106  AlignedVector(AlignedVector<T> &&vec) noexcept;
107 
113  AlignedVector &
114  operator=(const AlignedVector<T> &vec);
115 
119  AlignedVector &
120  operator=(AlignedVector<T> &&vec) noexcept;
121 
130  void
131  resize_fast(const size_type size);
132 
145  void
146  resize(const size_type size_in);
147 
163  void
164  resize(const size_type size_in, const T &init);
165 
174  void
175  reserve(const size_type size_alloc);
176 
181  void
182  clear();
183 
189  void
190  push_back(const T in_data);
191 
195  reference
196  back();
197 
202  back() const;
203 
208  template <typename ForwardIterator>
209  void
210  insert_back(ForwardIterator begin, ForwardIterator end);
211 
221  void
222  fill();
223 
232  void
233  fill(const T &element);
234 
238  void
239  swap(AlignedVector<T> &vec);
240 
244  bool
245  empty() const;
246 
250  size_type
251  size() const;
252 
257  size_type
258  capacity() const;
259 
263  reference operator[](const size_type index);
264 
268  const_reference operator[](const size_type index) const;
269 
273  pointer
274  data();
275 
280  data() const;
281 
285  iterator
286  begin();
287 
291  iterator
292  end();
293 
298  begin() const;
299 
304  end() const;
305 
311  size_type
312  memory_consumption() const;
313 
318  template <class Archive>
319  void
320  save(Archive &ar, const unsigned int version) const;
321 
326  template <class Archive>
327  void
328  load(Archive &ar, const unsigned int version);
329 
330 #ifdef DOXYGEN
331 
335  template <class Archive>
336  void
337  serialize(Archive &archive, const unsigned int version);
338 #else
339  // This macro defines the serialize() method that is compatible with
340  // the templated save() and load() method that have been implemented.
341  BOOST_SERIALIZATION_SPLIT_MEMBER()
342 #endif
343 
344 private:
349 
354 
359 };
360 
361 
362 // ------------------------------- inline functions --------------------------
363 
369 namespace internal
370 {
386  template <typename T>
388  {
389  static const std::size_t minimum_parallel_grain_size =
390  160000 / sizeof(T) + 1;
391 
392  public:
402  AlignedVectorCopy(const T *const source_begin,
403  const T *const source_end,
404  T *const destination)
405  : source_(source_begin)
406  , destination_(destination)
407  {
408  Assert(source_end >= source_begin, ExcInternalError());
409  Assert(source_end == source_begin || destination != nullptr,
410  ExcInternalError());
411  const std::size_t size = source_end - source_begin;
412  if (size < minimum_parallel_grain_size)
414  else
416  }
417 
422  virtual void
423  apply_to_subrange(const std::size_t begin,
424  const std::size_t end) const override
425  {
426  if (end == begin)
427  return;
428 
429  // for classes trivial assignment can use memcpy. cast element to
430  // (void*) to silence compiler warning for virtual classes (they will
431  // never arrive here because they are non-trivial).
432 
433  if (std::is_trivial<T>::value == true)
434  std::memcpy(static_cast<void *>(destination_ + begin),
435  static_cast<const void *>(source_ + begin),
436  (end - begin) * sizeof(T));
437  else
438  for (std::size_t i = begin; i < end; ++i)
439  new (&destination_[i]) T(source_[i]);
440  }
441 
442  private:
443  const T *const source_;
444  T *const destination_;
445  };
446 
447 
453  template <typename T>
455  {
456  static const std::size_t minimum_parallel_grain_size =
457  160000 / sizeof(T) + 1;
458 
459  public:
469  AlignedVectorMove(T *const source_begin,
470  T *const source_end,
471  T *const destination)
472  : source_(source_begin)
473  , destination_(destination)
474  {
475  Assert(source_end >= source_begin, ExcInternalError());
476  Assert(source_end == source_begin || destination != nullptr,
477  ExcInternalError());
478  const std::size_t size = source_end - source_begin;
479  if (size < minimum_parallel_grain_size)
481  else
483  }
484 
489  virtual void
490  apply_to_subrange(const std::size_t begin,
491  const std::size_t end) const override
492  {
493  if (end == begin)
494  return;
495 
496  // for classes trivial assignment can use memcpy. cast element to
497  // (void*) to silence compiler warning for virtual classes (they will
498  // never arrive here because they are non-trivial).
499 
500  if (std::is_trivial<T>::value == true)
501  std::memcpy(static_cast<void *>(destination_ + begin),
502  static_cast<void *>(source_ + begin),
503  (end - begin) * sizeof(T));
504  else
505  for (std::size_t i = begin; i < end; ++i)
506  {
507  // initialize memory (copy construct by placement new), and
508  // destruct the source
509  new (&destination_[i]) T(std::move(source_[i]));
510  source_[i].~T();
511  }
512  }
513 
514  private:
515  T *const source_;
516  T *const destination_;
517  };
518 
519 
531  template <typename T, bool initialize_memory>
533  {
534  static const std::size_t minimum_parallel_grain_size =
535  160000 / sizeof(T) + 1;
536 
537  public:
542  AlignedVectorSet(const std::size_t size,
543  const T & element,
544  T *const destination)
545  : element_(element)
546  , destination_(destination)
547  , trivial_element(false)
548  {
549  if (size == 0)
550  return;
551  Assert(destination != nullptr, ExcInternalError());
552 
553  // do not use memcmp for long double because on some systems it does not
554  // completely fill its memory and may lead to false positives in
555  // e.g. valgrind
556  if (std::is_trivial<T>::value == true &&
558  {
559  const unsigned char zero[sizeof(T)] = {};
560  // cast element to (void*) to silence compiler warning for virtual
561  // classes (they will never arrive here because they are
562  // non-trivial).
563  if (std::memcmp(zero,
564  static_cast<const void *>(&element),
565  sizeof(T)) == 0)
566  trivial_element = true;
567  }
568  if (size < minimum_parallel_grain_size)
570  else
572  }
573 
577  virtual void
578  apply_to_subrange(const std::size_t begin,
579  const std::size_t end) const override
580  {
581  // for classes with trivial assignment of zero can use memset. cast
582  // element to (void*) to silence compiler warning for virtual
583  // classes (they will never arrive here because they are
584  // non-trivial).
586  std::memset(static_cast<void *>(destination_ + begin),
587  0,
588  (end - begin) * sizeof(T));
589  else
591  begin, end, std::integral_constant<bool, initialize_memory>());
592  }
593 
594  private:
595  const T & element_;
596  mutable T *destination_;
598 
599  // copy assignment operation
600  void
601  copy_construct_or_assign(const std::size_t begin,
602  const std::size_t end,
603  std::integral_constant<bool, false>) const
604  {
605  for (std::size_t i = begin; i < end; ++i)
606  destination_[i] = element_;
607  }
608 
609  // copy constructor (memory initialization)
610  void
611  copy_construct_or_assign(const std::size_t begin,
612  const std::size_t end,
613  std::integral_constant<bool, true>) const
614  {
615  for (std::size_t i = begin; i < end; ++i)
616  new (&destination_[i]) T(element_);
617  }
618  };
619 
620 
621 
633  template <typename T, bool initialize_memory>
635  {
636  static const std::size_t minimum_parallel_grain_size =
637  160000 / sizeof(T) + 1;
638 
639  public:
644  AlignedVectorDefaultInitialize(const std::size_t size, T *const destination)
645  : destination_(destination)
646  {
647  if (size == 0)
648  return;
649  Assert(destination != nullptr, ExcInternalError());
650 
651  if (size < minimum_parallel_grain_size)
653  else
655  }
656 
660  virtual void
661  apply_to_subrange(const std::size_t begin,
662  const std::size_t end) const override
663  {
664  // for classes with trivial assignment of zero can use memset. cast
665  // element to (void*) to silence compiler warning for virtual
666  // classes (they will never arrive here because they are
667  // non-trivial).
668  if (std::is_trivial<T>::value == true)
669  std::memset(static_cast<void *>(destination_ + begin),
670  0,
671  (end - begin) * sizeof(T));
672  else
674  begin, end, std::integral_constant<bool, initialize_memory>());
675  }
676 
677  private:
678  mutable T *destination_;
679 
680  // copy assignment operation
681  void
683  const std::size_t end,
684  std::integral_constant<bool, false>) const
685  {
686  for (std::size_t i = begin; i < end; ++i)
687  destination_[i] = std::move(T());
688  }
689 
690  // copy constructor (memory initialization)
691  void
693  const std::size_t end,
694  std::integral_constant<bool, true>) const
695  {
696  for (std::size_t i = begin; i < end; ++i)
697  new (&destination_[i]) T;
698  }
699  };
700 
701 } // end of namespace internal
702 
703 
704 #ifndef DOXYGEN
705 
706 
707 template <class T>
709  : data_begin(nullptr)
710  , data_end(nullptr)
711  , allocated_end(nullptr)
712 {}
713 
714 
715 
716 template <class T>
717 inline AlignedVector<T>::AlignedVector(const size_type size, const T &init)
718  : data_begin(nullptr)
719  , data_end(nullptr)
720  , allocated_end(nullptr)
721 {
722  if (size > 0)
723  resize(size, init);
724 }
725 
726 
727 
728 template <class T>
730 {
731  clear();
732 }
733 
734 
735 
736 template <class T>
738  : data_begin(nullptr)
739  , data_end(nullptr)
740  , allocated_end(nullptr)
741 {
742  // copy the data from vec
743  reserve(vec.data_end - vec.data_begin);
744  data_end = allocated_end;
745  internal::AlignedVectorCopy<T>(vec.data_begin, vec.data_end, data_begin);
746 }
747 
748 
749 
750 template <class T>
752  : data_begin(vec.data_begin)
753  , data_end(vec.data_end)
754  , allocated_end(vec.allocated_end)
755 {
756  vec.data_begin = nullptr;
757  vec.data_end = nullptr;
758  vec.allocated_end = nullptr;
759 }
760 
761 
762 
763 template <class T>
764 inline AlignedVector<T> &
766 {
767  resize(0);
768  resize_fast(vec.data_end - vec.data_begin);
769  internal::AlignedVectorCopy<T>(vec.data_begin, vec.data_end, data_begin);
770  return *this;
771 }
772 
773 
774 
775 template <class T>
776 inline AlignedVector<T> &
778 {
779  clear();
780 
781  data_begin = vec.data_begin;
782  data_end = vec.data_end;
783  allocated_end = vec.allocated_end;
784 
785  vec.data_begin = nullptr;
786  vec.data_end = nullptr;
787  vec.allocated_end = nullptr;
788 
789  return *this;
790 }
791 
792 
793 
794 template <class T>
795 inline void
797 {
798  const size_type old_size = size();
799  if (std::is_trivial<T>::value == false && size_in < old_size)
800  {
801  // call destructor on fields that are released. doing it backward
802  // releases the elements in reverse order as compared to how they were
803  // created
804  while (data_end != data_begin + size_in)
805  (--data_end)->~T();
806  }
807  reserve(size_in);
808  data_end = data_begin + size_in;
809 
810  // need to still set the values in case the class is non-trivial because
811  // virtual classes etc. need to run their (default) constructor
812  if (std::is_trivial<T>::value == false && size_in > old_size)
814  size_in - old_size, data_begin + old_size);
815 }
816 
817 
818 
819 template <class T>
820 inline void
821 AlignedVector<T>::resize(const size_type size_in)
822 {
823  const size_type old_size = size();
824  if (std::is_trivial<T>::value == false && size_in < old_size)
825  {
826  // call destructor on fields that are released. doing it backward
827  // releases the elements in reverse order as compared to how they were
828  // created
829  while (data_end != data_begin + size_in)
830  (--data_end)->~T();
831  }
832  reserve(size_in);
833  data_end = data_begin + size_in;
834 
835  // finally set the desired init values
836  if (size_in > old_size)
838  size_in - old_size, data_begin + old_size);
839 }
840 
841 
842 
843 template <class T>
844 inline void
845 AlignedVector<T>::resize(const size_type size_in, const T &init)
846 {
847  const size_type old_size = size();
848  if (std::is_trivial<T>::value == false && size_in < old_size)
849  {
850  // call destructor on fields that are released. doing it backward
851  // releases the elements in reverse order as compared to how they were
852  // created
853  while (data_end != data_begin + size_in)
854  (--data_end)->~T();
855  }
856  reserve(size_in);
857  data_end = data_begin + size_in;
858 
859  // finally set the desired init values
860  if (size_in > old_size)
861  ::internal::AlignedVectorSet<T, true>(size_in - old_size,
862  init,
863  data_begin + old_size);
864 }
865 
866 
867 
868 template <class T>
869 inline void
870 AlignedVector<T>::reserve(const size_type size_alloc)
871 {
872  const size_type old_size = data_end - data_begin;
873  const size_type allocated_size = allocated_end - data_begin;
874  if (size_alloc > allocated_size)
875  {
876  // if we continuously increase the size of the vector, we might be
877  // reallocating a lot of times. therefore, try to increase the size more
878  // aggressively
879  size_type new_size = size_alloc;
880  if (size_alloc < (2 * allocated_size))
881  new_size = 2 * allocated_size;
882 
883  const size_type size_actual_allocate = new_size * sizeof(T);
884 
885  // allocate and align along 64-byte boundaries (this is enough for all
886  // levels of vectorization currently supported by deal.II)
887  T *new_data;
888  Utilities::System::posix_memalign(reinterpret_cast<void **>(&new_data),
889  64,
890  size_actual_allocate);
891 
892  // copy data in case there was some content before and release the old
893  // memory with the function corresponding to the one used for allocating
894  std::swap(data_begin, new_data);
895  data_end = data_begin + old_size;
896  allocated_end = data_begin + new_size;
897  if (data_end != data_begin)
898  {
900  new_data + old_size,
901  data_begin);
902  free(new_data);
903  }
904  else
905  Assert(new_data == nullptr, ExcInternalError());
906  }
907  else if (size_alloc == 0)
908  clear();
909 }
910 
911 
912 
913 template <class T>
914 inline void
916 {
917  if (data_begin != nullptr)
918  {
919  if (std::is_trivial<T>::value == false)
920  while (data_end != data_begin)
921  (--data_end)->~T();
922 
923  free(data_begin);
924  }
925  data_begin = nullptr;
926  data_end = nullptr;
927  allocated_end = nullptr;
928 }
929 
930 
931 
932 template <class T>
933 inline void
934 AlignedVector<T>::push_back(const T in_data)
935 {
936  Assert(data_end <= allocated_end, ExcInternalError());
937  if (data_end == allocated_end)
938  reserve(std::max(2 * capacity(), static_cast<size_type>(16)));
939  if (std::is_trivial<T>::value == false)
940  new (data_end++) T(in_data);
941  else
942  *data_end++ = in_data;
943 }
944 
945 
946 
947 template <class T>
948 inline typename AlignedVector<T>::reference
950 {
951  AssertIndexRange(0, size());
952  T *field = data_end - 1;
953  return *field;
954 }
955 
956 
957 
958 template <class T>
959 inline typename AlignedVector<T>::const_reference
961 {
962  AssertIndexRange(0, size());
963  const T *field = data_end - 1;
964  return *field;
965 }
966 
967 
968 
969 template <class T>
970 template <typename ForwardIterator>
971 inline void
972 AlignedVector<T>::insert_back(ForwardIterator begin, ForwardIterator end)
973 {
974  const unsigned int old_size = size();
975  reserve(old_size + (end - begin));
976  for (; begin != end; ++begin, ++data_end)
977  {
978  if (std::is_trivial<T>::value == false)
979  new (data_end) T;
980  *data_end = *begin;
981  }
982 }
983 
984 
985 
986 template <class T>
987 inline void
989 {
991  data_begin);
992 }
993 
994 
995 
996 template <class T>
997 inline void
999 {
1000  ::internal::AlignedVectorSet<T, false>(size(), value, data_begin);
1001 }
1002 
1003 
1004 
1005 template <class T>
1006 inline void
1008 {
1009  std::swap(data_begin, vec.data_begin);
1010  std::swap(data_end, vec.data_end);
1011  std::swap(allocated_end, vec.allocated_end);
1012 }
1013 
1014 
1015 
1016 template <class T>
1017 inline bool
1019 {
1020  return data_end == data_begin;
1021 }
1022 
1023 
1024 
1025 template <class T>
1026 inline typename AlignedVector<T>::size_type
1027 AlignedVector<T>::size() const
1028 {
1029  return data_end - data_begin;
1030 }
1031 
1032 
1033 
1034 template <class T>
1035 inline typename AlignedVector<T>::size_type
1037 {
1038  return allocated_end - data_begin;
1039 }
1040 
1041 
1042 
1043 template <class T>
1045  operator[](const size_type index)
1046 {
1047  AssertIndexRange(index, size());
1048  return data_begin[index];
1049 }
1050 
1051 
1052 
1053 template <class T>
1055  operator[](const size_type index) const
1056 {
1057  AssertIndexRange(index, size());
1058  return data_begin[index];
1059 }
1060 
1061 
1062 
1063 template <typename T>
1064 inline typename AlignedVector<T>::pointer
1066 {
1067  return data_begin;
1068 }
1069 
1070 
1071 
1072 template <typename T>
1073 inline typename AlignedVector<T>::const_pointer
1074 AlignedVector<T>::data() const
1075 {
1076  return data_begin;
1077 }
1078 
1079 
1080 
1081 template <class T>
1082 inline typename AlignedVector<T>::iterator
1084 {
1085  return data_begin;
1086 }
1087 
1088 
1089 
1090 template <class T>
1091 inline typename AlignedVector<T>::iterator
1093 {
1094  return data_end;
1095 }
1096 
1097 
1098 
1099 template <class T>
1100 inline typename AlignedVector<T>::const_iterator
1102 {
1103  return data_begin;
1104 }
1105 
1106 
1107 
1108 template <class T>
1109 inline typename AlignedVector<T>::const_iterator
1110 AlignedVector<T>::end() const
1111 {
1112  return data_end;
1113 }
1114 
1115 
1116 
1117 template <class T>
1118 template <class Archive>
1119 inline void
1120 AlignedVector<T>::save(Archive &ar, const unsigned int) const
1121 {
1122  size_type vec_size(size());
1123  ar & vec_size;
1124  if (vec_size > 0)
1125  ar &boost::serialization::make_array(data_begin, vec_size);
1126 }
1127 
1128 
1129 
1130 template <class T>
1131 template <class Archive>
1132 inline void
1133 AlignedVector<T>::load(Archive &ar, const unsigned int)
1134 {
1135  size_type vec_size = 0;
1136  ar & vec_size;
1137 
1138  if (vec_size > 0)
1139  {
1140  reserve(vec_size);
1141  ar &boost::serialization::make_array(data_begin, vec_size);
1142  data_end = data_begin + vec_size;
1143  }
1144 }
1145 
1146 
1147 
1148 template <class T>
1149 inline typename AlignedVector<T>::size_type
1151 {
1152  size_type memory = sizeof(*this);
1153  for (const T *t = data_begin; t != data_end; ++t)
1154  memory += ::MemoryConsumption::memory_consumption(*t);
1155  memory += sizeof(T) * (allocated_end - data_end);
1156  return memory;
1157 }
1158 
1159 
1160 #endif // ifndef DOXYGEN
1161 
1162 
1168 template <class T>
1169 bool
1171 {
1172  if (lhs.size() != rhs.size())
1173  return false;
1174  for (typename AlignedVector<T>::const_iterator lit = lhs.begin(),
1175  rit = rhs.begin();
1176  lit != lhs.end();
1177  ++lit, ++rit)
1178  if (*lit != *rit)
1179  return false;
1180  return true;
1181 }
1182 
1183 
1184 
1190 template <class T>
1191 bool
1193 {
1194  return !(operator==(lhs, rhs));
1195 }
1196 
1197 
1199 
1200 #endif
operator!=
bool operator!=(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
Definition: aligned_vector.h:1192
AlignedVector::serialize
void serialize(Archive &archive, const unsigned int version)
AlignedVector::iterator
value_type * iterator
Definition: aligned_vector.h:71
operator==
bool operator==(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
Definition: aligned_vector.h:1170
internal::AlignedVectorMove::apply_to_subrange
virtual void apply_to_subrange(const std::size_t begin, const std::size_t end) const override
Definition: aligned_vector.h:490
memory_consumption.h
utilities.h
AlignedVector::capacity
size_type capacity() const
internal::AlignedVectorSet::copy_construct_or_assign
void copy_construct_or_assign(const std::size_t begin, const std::size_t end, std::integral_constant< bool, false >) const
Definition: aligned_vector.h:601
AlignedVector::size
size_type size() const
AlignedVector::allocated_end
T * allocated_end
Definition: aligned_vector.h:358
AssertIndexRange
#define AssertIndexRange(index, range)
Definition: exceptions.h:1649
AlignedVector::save
void save(Archive &ar, const unsigned int version) const
AlignedVector::end
iterator end()
AlignedVector::resize
void resize(const size_type size_in)
internal::AlignedVectorSet::AlignedVectorSet
AlignedVectorSet(const std::size_t size, const T &element, T *const destination)
Definition: aligned_vector.h:542
AlignedVector::insert_back
void insert_back(ForwardIterator begin, ForwardIterator end)
internal::AlignedVectorSet::element_
const T & element_
Definition: aligned_vector.h:595
AlignedVector::const_pointer
const value_type * const_pointer
Definition: aligned_vector.h:70
internal::AlignedVectorCopy::apply_to_subrange
virtual void apply_to_subrange(const std::size_t begin, const std::size_t end) const override
Definition: aligned_vector.h:423
internal::AlignedVectorDefaultInitialize::AlignedVectorDefaultInitialize
AlignedVectorDefaultInitialize(const std::size_t size, T *const destination)
Definition: aligned_vector.h:644
internal::AlignedVectorSet::minimum_parallel_grain_size
static const std::size_t minimum_parallel_grain_size
Definition: aligned_vector.h:534
internal::AlignedVectorCopy::minimum_parallel_grain_size
static const std::size_t minimum_parallel_grain_size
Definition: aligned_vector.h:389
AlignedVector::~AlignedVector
~AlignedVector()
Utilities::CUDA::free
void free(T *&pointer)
Definition: cuda.h:96
AlignedVector::begin
iterator begin()
internal::AlignedVectorMove::minimum_parallel_grain_size
static const std::size_t minimum_parallel_grain_size
Definition: aligned_vector.h:456
LAPACKSupport::T
static const char T
Definition: lapack_support.h:163
internal::AlignedVectorCopy
Definition: aligned_vector.h:387
internal::AlignedVectorDefaultInitialize::destination_
T * destination_
Definition: aligned_vector.h:678
internal::AlignedVectorCopy::destination_
T *const destination_
Definition: aligned_vector.h:444
internal::AlignedVectorMove::destination_
T *const destination_
Definition: aligned_vector.h:516
internal::AlignedVectorDefaultInitialize::minimum_parallel_grain_size
static const std::size_t minimum_parallel_grain_size
Definition: aligned_vector.h:636
AlignedVector::load
void load(Archive &ar, const unsigned int version)
AlignedVector::operator=
AlignedVector & operator=(const AlignedVector< T > &vec)
TrilinosWrappers::internal::begin
VectorType::value_type * begin(VectorType &V)
Definition: trilinos_sparse_matrix.cc:51
AlignedVector< T >
internal::AlignedVectorDefaultInitialize::default_construct_or_assign
void default_construct_or_assign(const std::size_t begin, const std::size_t end, std::integral_constant< bool, true >) const
Definition: aligned_vector.h:692
Tensor< 1, dim >
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
MemoryConsumption::memory_consumption
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Definition: memory_consumption.h:268
AlignedVector
Definition: aligned_vector.h:61
AlignedVector::operator[]
reference operator[](const size_type index)
internal::AlignedVectorCopy::source_
const T *const source_
Definition: aligned_vector.h:443
TrilinosWrappers::internal::end
VectorType::value_type * end(VectorType &V)
Definition: trilinos_sparse_matrix.cc:65
MemorySpace::swap
void swap(MemorySpaceData< Number, MemorySpace > &, MemorySpaceData< Number, MemorySpace > &)
Definition: memory_space.h:103
internal::AlignedVectorMove::AlignedVectorMove
AlignedVectorMove(T *const source_begin, T *const source_end, T *const destination)
Definition: aligned_vector.h:469
AlignedVector::data
pointer data()
internal::AlignedVectorDefaultInitialize
Definition: aligned_vector.h:634
internal::AlignedVectorSet::apply_to_subrange
virtual void apply_to_subrange(const std::size_t begin, const std::size_t end) const override
Definition: aligned_vector.h:578
AlignedVector::swap
void swap(AlignedVector< T > &vec)
exceptions.h
AlignedVector::pointer
value_type * pointer
Definition: aligned_vector.h:69
AlignedVector::reserve
void reserve(const size_type size_alloc)
AlignedVector::back
reference back()
internal::AlignedVectorDefaultInitialize::default_construct_or_assign
void default_construct_or_assign(const std::size_t begin, const std::size_t end, std::integral_constant< bool, false >) const
Definition: aligned_vector.h:682
AlignedVector::resize_fast
void resize_fast(const size_type size)
AlignedVector::const_iterator
const value_type * const_iterator
Definition: aligned_vector.h:72
internal::AlignedVectorDefaultInitialize::apply_to_subrange
virtual void apply_to_subrange(const std::size_t begin, const std::size_t end) const override
Definition: aligned_vector.h:661
value
static const bool value
Definition: dof_tools_constraints.cc:433
AlignedVector::memory_consumption
size_type memory_consumption() const
StandardExceptions::ExcInternalError
static ::ExceptionBase & ExcInternalError()
internal::AlignedVectorSet
Definition: aligned_vector.h:532
LinearAlgebra::CUDAWrappers::kernel::size_type
types::global_dof_index size_type
Definition: cuda_kernels.h:45
AlignedVector::push_back
void push_back(const T in_data)
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
internal::AlignedVectorSet::trivial_element
bool trivial_element
Definition: aligned_vector.h:597
internal::AlignedVectorMove::source_
T *const source_
Definition: aligned_vector.h:515
AlignedVector< Tensor< 1, dim > >::size_type
std::size_t size_type
Definition: aligned_vector.h:75
AlignedVector::AlignedVector
AlignedVector()
AlignedVector::data_end
T * data_end
Definition: aligned_vector.h:353
LAPACKSupport::zero
static const types::blas_int zero
Definition: lapack_support.h:179
AlignedVector::clear
void clear()
config.h
AlignedVector::data_begin
T * data_begin
Definition: aligned_vector.h:348
internal::AlignedVectorSet::destination_
T * destination_
Definition: aligned_vector.h:596
internal
Definition: aligned_vector.h:369
AlignedVector::empty
bool empty() const
parallel.h
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Utilities::System::posix_memalign
void posix_memalign(void **memptr, std::size_t alignment, std::size_t size)
Definition: utilities.cc:1051
AlignedVector::const_reference
const value_type & const_reference
Definition: aligned_vector.h:74
internal::AlignedVectorCopy::AlignedVectorCopy
AlignedVectorCopy(const T *const source_begin, const T *const source_end, T *const destination)
Definition: aligned_vector.h:402
AlignedVector::reference
value_type & reference
Definition: aligned_vector.h:73
internal::AlignedVectorMove
Definition: aligned_vector.h:454
parallel::ParallelForInteger::apply_parallel
void apply_parallel(const std::size_t begin, const std::size_t end, const std::size_t minimum_parallel_grain_size) const
Definition: parallel.h:851
parallel::ParallelForInteger
Definition: parallel.h:503
Utilities::MPI::max
T max(const T &t, const MPI_Comm &mpi_communicator)
AlignedVector::fill
void fill()
internal::AlignedVectorSet::copy_construct_or_assign
void copy_construct_or_assign(const std::size_t begin, const std::size_t end, std::integral_constant< bool, true >) const
Definition: aligned_vector.h:611