7#include <gtest/gtest.h>
9#include "arccore/collections/Array.h"
10#include "arccore/collections/IMemoryAllocator.h"
12#include "arccore/base/FatalErrorException.h"
13#include "arccore/base/Iterator.h"
15#include "TestArrayCommon.h"
18using namespace TestArccore;
22void _testArraySwap(
bool use_own_swap)
24 std::cout <<
"** TestArraySwap is_own=" << use_own_swap <<
"\n";
28 c1.setDebugName(c1_name);
30 std::cout <<
"** C1_this = " << &c1 <<
"\n";
31 std::cout <<
"** C1_BASE = " << x1 <<
"\n";
34 std::cout <<
"** C2_this = " << &c2 <<
"\n";
35 std::cout <<
"** C2_BASE = " << x2 <<
"\n";
37 ASSERT_EQ(c1.debugName(), c1_name);
38 ASSERT_EQ(c2.debugName(),
String{});
46 ASSERT_EQ(c2.debugName(), c1_name);
47 ASSERT_EQ(c1.debugName(),
String{});
51 std::cout <<
"** C1_BASE_AFTER = " << after_x1 <<
" size=" << c1.size() <<
"\n";
52 std::cout <<
"** C2_BASE_AFTER = " << after_x2 <<
" size=" << c2.size() <<
"\n";
54 ASSERT_TRUE(x1 == after_x2) <<
"Bad value after swap [1]";
55 ASSERT_TRUE(x2 == after_x1) <<
"Bad value after swap [2]";
66 _testArraySwap(
false);
72Integer IntPtrSubClass::count = 0;
77template <
typename Container,
typename SubClass>
89 ARCCORE_UT_CHECK((c.size() == 3),
"Bad size (3)");
90 ARCCORE_UT_CHECK((c[0] == 1),
"Bad value [0]");
91 ARCCORE_UT_CHECK((c[1] == 2),
"Bad value [1]");
92 ARCCORE_UT_CHECK((c[2] == 3),
"Bad value [2]");
94 ARCCORE_UT_CHECK((c.size() == 0),
"Bad size (0)");
96 ARCCORE_UT_CHECK((c.size() == 5),
"Bad size");
98 ARCCORE_UT_CHECK((c.size() == 6),
"Bad size");
99 ARCCORE_UT_CHECK((c[5] == 6),
"Bad value [5]");
101 ASSERT_EQ(c.size(), c.capacity()) <<
"Bad capacity (test 1)";
104 ASSERT_EQ(c.size(), c.capacity()) <<
"Bad capacity (test 2)";
109 ASSERT_EQ(c.capacity(), 0) <<
"Bad capacity (test 3)";
114 for (
Integer i = 0; i < nb; ++i)
117 Int64 current_capacity = c.capacity();
118 ASSERT_EQ(current_capacity, (nb * 2)) <<
"Bad capacity (test 4)";
119 c.shrink(c.capacity() + 5);
120 ASSERT_EQ(c.capacity(), current_capacity) <<
"Bad capacity (test 5)";
122 ASSERT_EQ(c.capacity(), 32) <<
"Bad capacity (test 6)";
124 ASSERT_EQ(c.capacity(), c.size()) <<
"Bad capacity (test 7)";
130 for (Container& c : uc) {
137 for (
Integer i = 0; i < 50; ++i)
138 c.add(SubClass(i + 2));
141 for (
Integer i = 50; i < 100; ++i) {
142 c2.add(SubClass(i + 2));
150 for (
Integer i = 100; i < 150; ++i) {
151 c4.add(SubClass(i + 2));
154 ARCCORE_UT_CHECK((c.size() == 150),
"Bad size (150)");
156 ARCCORE_UT_CHECK((c.capacity() == 300),
"Bad capacity (300)");
157 for (
Integer i = 0; i < 50; ++i) {
160 ARCCORE_UT_CHECK((c.size() == 100),
"Bad size (100)");
161 for (
Integer i = 0; i < 50; ++i) {
163 ARCCORE_UT_CHECK((c[i] == ((i * 2) + 3)),
"Bad value");
165 for (
Integer i = 50; i < 100; ++i) {
167 ARCCORE_UT_CHECK((c[i] == (i + 52)),
"Bad value");
175void _testArrayNewInternal()
178 std::cout <<
"** TEST VECTOR NEW\n";
187 std::cout <<
"** TEST VECTOR NEW 2\n";
191 std::cout <<
"** COUNT = " << IntPtrSubClass::count <<
"\n";
193 std::cout <<
"** TEST VECTOR NEW 3\n";
197 std::cout <<
"** COUNT = " << IntPtrSubClass::count <<
"\n";
205 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
206 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
207 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
208 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
209 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
210 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
211 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
219 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
220 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
221 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
222 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
223 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
224 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
225 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
231 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
232 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
233 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
234 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
235 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
236 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
237 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
241 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
242 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
243 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
247 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
248 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
249 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
255 ARCCORE_UT_CHECK((cx.size() == 5),
"Bad value [5]");
260 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
261 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
262 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
263 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
264 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
265 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
266 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
267 for (
Integer i = 0; i < 50; ++i)
277 ASSERT_EQ(c22.size(),33);
287 ASSERT_EQ(c2.
size(),c3.size());
288 ASSERT_EQ(c2.
size(),c4.size());
290 ASSERT_EQ(c2.
size(),c3.size());
291 ASSERT_EQ(c2.
size(),c4.size());
296 ARCCORE_UT_CHECK((c2.
size() == 33),
"Bad value [3]");
297 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
298 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
299 ARCCORE_UT_CHECK((c2[32] == 3),
"Bad value [7]");
301 ASSERT_EQ(c2.
size(),1293);
302 ASSERT_EQ(c22.size(),2);
306 ASSERT_EQ(values1.
size(),3);
307 ASSERT_EQ(values1[0],-7);
308 ASSERT_EQ(values1[1],3);
309 ASSERT_EQ(values1[2],4);
310 values1 = { 2, -1, 9, 13 };
311 ASSERT_EQ(values1.
size(),4);
312 ASSERT_EQ(values1[0],2);
313 ASSERT_EQ(values1[1],-1);
314 ASSERT_EQ(values1[2],9);
315 ASSERT_EQ(values1[3],13);
317 ASSERT_EQ(values2,values1);
320 ASSERT_EQ(values1.
size(),0);
321 ASSERT_EQ(values2.
size(),0);
329 std::copy(std::begin(values2), std::end(values2), std::back_inserter(values1));
330 std::cout <<
"** VALUES1 = " << values1 <<
"\n";
331 ARCCORE_UT_CHECK((values1.size() == 5),
"BI: Bad size");
332 ARCCORE_UT_CHECK((values1[0] == 2),
"BI: Bad value [0]");
333 ARCCORE_UT_CHECK((values1[1] == 5),
"BI: Bad value [1]");
334 ARCCORE_UT_CHECK((values1[2] == 4),
"BI: Bad value [2]");
335 ARCCORE_UT_CHECK((values1[3] == 9),
"BI: Bad value [3]");
336 ARCCORE_UT_CHECK((values1[4] == 7),
"BI: Bad value [4]");
342 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
'\n';
345 ASSERT_EQ(values1.size(),2);
346 ASSERT_EQ(values1[0],-7);
347 ASSERT_EQ(values1[1],3);
350 ASSERT_EQ(values1.size(),0);
356 values1.
copy(values2);
357 std::cout <<
"** VALUES1 = " << values1 <<
"\n";
358 ARCCORE_UT_CHECK((values1.size() == 5),
"BI: Bad size");
359 ARCCORE_UT_CHECK((values1[0] == 4),
"BI2: Bad value [0]");
360 ARCCORE_UT_CHECK((values1[1] == 9),
"BI2: Bad value [1]");
361 ARCCORE_UT_CHECK((values1[2] == 7),
"BI2: Bad value [2]");
362 ARCCORE_UT_CHECK((values1[3] == 6),
"BI2: Bad value [3]");
363 ARCCORE_UT_CHECK((values1[4] == 3),
"BI2: Bad value [4]");
369 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
'\n';
376 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
'\n';
379 std::cout <<
"V=" << cicvx->m_v <<
'\n';
387 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
" " << (iend - i) <<
'\n';
390 std::cout <<
"V=" << cicvx->m_v <<
'\n';
391 std::copy(std::begin(vx), std::end(vx), std::begin(vx));
396 std::cout << *i <<
'\n';
399 std::cout << *i <<
'\n';
401 for (
auto i : values.range()) {
402 std::cout << i <<
'\n';
404 for (
auto i : values.constView().range()) {
405 std::cout << i <<
'\n';
409 auto r1 = std::make_reverse_iterator(values.
end());
410 auto r2 = std::make_reverse_iterator(values.
begin());
411 for (; r1 != r2; ++r1) {
412 std::cout <<
"RVALUE = " << *r1 <<
'\n';
416 auto r1 = values.
rbegin();
429 ARCCORE_UT_CHECK((c2.
size() == 3),
"Bad value [3]");
430 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
431 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
432 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
433 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
434 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
435 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
452 _testArrayNewInternal();
455 std::cerr <<
"Exception ex=" << ex <<
"\n";
486 std::cout <<
" Value: " << x <<
'\n';
488 v.printInfos(std::cout);
495 v.printInfos(std::cout);
499 v.printInfos(std::cout);
501 v.printInfos(std::cout);
506 v.printInfos(std::cout);
508 std::cout <<
" Value: " << v[i] <<
'\n';
514 for (
int i = 0; i < 10; ++i)
517 std::cout <<
" Value: " << v[i] <<
'\n';
523 for (
int i = 0; i < 27500; ++i) {
527 for (
int i = 0; i < 5000; ++i) {
531 for (
int i = 0; i < 27500; ++i) {
535 std::cout <<
" ValueSize= " << v.
size() <<
" values=" << v <<
'\n';
537 for (
Integer i = 0; i < 100; ++i) {
546 std::cout <<
" Size: " << v.
size() <<
'\n';
547 ASSERT_EQ(v.
size(), 230000);
562 for (
Int32 i = 0, n = v.
size(); i < n; ++i)
565 auto sub_view1 = v.
subView(50, 5);
566 ASSERT_EQ(sub_view1.data(),
nullptr);
567 ASSERT_EQ(sub_view1.size(), 0);
569 auto sub_view2 = v.
subView(2, 8);
570 ASSERT_EQ(sub_view2.size(), 8);
571 for (
Int32 i = 0, n = sub_view2.size(); i < n; ++i)
572 ASSERT_EQ(sub_view2[i], v[2 + i]);
574 auto sub_view3 = v.
subView(20, 8);
575 ASSERT_EQ(sub_view3.size(), 3);
576 for (
Int32 i = 0, n = sub_view3.size(); i < n; ++i)
577 ASSERT_EQ(sub_view3[i], v[20 + i]);
580 ASSERT_EQ(sub_const_view1.data(),
nullptr);
581 ASSERT_EQ(sub_const_view1.size(), 0);
584 ASSERT_EQ(sub_const_view2.size(), 8);
585 for (
Int32 i = 0, n = sub_const_view2.size(); i < n; ++i)
586 ASSERT_EQ(sub_const_view2[i], v[2 + i]);
589 ASSERT_EQ(sub_const_view3.size(), 3);
590 for (
Int32 i = 0, n = sub_const_view3.size(); i < n; ++i)
591 ASSERT_EQ(sub_const_view3[i], v[20 + i]);
604template <
typename DataType>
622 const Int32 ref_value1 = 12;
623 const Int32 ref_value2 = 7;
626 std::cout <<
"C1=" << c <<
"\n";
628 ASSERT_EQ(x, ref_value1);
631 ASSERT_EQ(c.size(), 21);
632 std::cout <<
"C2=" << c <<
"\n";
637 std::cout <<
"C4=" << c <<
"\n";
638 for (
Int32 i = 9, s = c.size(); i < s; ++i)
639 ASSERT_EQ(c[i], ref_value2);
640 for (
Int32 i = 9, s = c.size(); i < s; ++i)
642 for (
Int32 i = 9, s = c.size(); i < s; ++i)
643 ASSERT_EQ(c[i], (i + 2));
654template<
typename ArrayType>
658 static void doTestBase()
667 std::cout <<
"Array a\n";
668 ArrayType a(allocator1);
669 ASSERT_EQ(a.allocator(),allocator1);
675 std::cout <<
"Array b\n";
676 ArrayType b(allocator2);
677 ASSERT_EQ(b.capacity(),0);
678 ASSERT_EQ(b.size(),0);
679 ASSERT_EQ(b.allocator(),allocator2);
682 ASSERT_EQ(b.size(),a.size());
683 ASSERT_EQ(b.allocator(),a.allocator());
685 std::cout <<
"Array c\n";
686 ArrayType c(a.clone());
687 ASSERT_EQ(c.allocator(),a.allocator());
688 ASSERT_EQ(c.size(),a.size());
689 ASSERT_EQ(c.constSpan(),a.constSpan());
691 std::cout <<
"Array d\n";
692 ArrayType d(allocator2,a);
693 ASSERT_EQ(d.allocator(),allocator2);
694 ASSERT_EQ(d.size(),a.size());
695 ASSERT_EQ(d.constSpan(),a.constSpan());
697 std::cout <<
"Array e\n";
698 ArrayType e(allocator2,25);
699 ASSERT_EQ(e.allocator(),allocator2);
700 ASSERT_EQ(e.size(),25);
702 ArrayType f(allocator2);
704 ASSERT_EQ(f.allocator(),e.allocator());
705 ASSERT_EQ(f.size(),e.size());
708 ASSERT_EQ(f.allocator(),e.allocator());
709 ASSERT_EQ(f.size(),e.size());
731 std::cout <<
"Sizeof(ArrayMetaData)=" <<
sizeof(
ArrayMetaData) <<
"\n";
740 std::cout <<
"Array a1\n";
742 ASSERT_EQ(a1.allocator(), allocator2);
743 ASSERT_EQ(a1.size(), 0);
744 ASSERT_EQ(a1.capacity(), 0);
745 ASSERT_EQ(a1.data(),
nullptr);
747 std::cout <<
"Array a2\n";
749 ASSERT_EQ(a1.allocator(), a2.allocator());
750 ASSERT_EQ(a2.capacity(), 0);
751 ASSERT_EQ(a2.data(),
nullptr);
758 ASSERT_EQ(a1.size(), 5);
760 std::cout <<
"Array a3\n";
765 ASSERT_EQ(a3.size(), 3);
767 ASSERT_EQ(a3.allocator(), a1.allocator());
768 ASSERT_EQ(a3.size(), a1.size());
769 ASSERT_EQ(a3.constSpan(), a1.constSpan());
771 std::cout <<
"Array a4\n";
776 ASSERT_EQ(a4.size(), 3);
778 ASSERT_EQ(a4.allocator(), allocator1);
787 ASSERT_EQ(array[0].allocator(), allocator3);
788 ASSERT_EQ(array[1].allocator(), allocator3);
799 std::cout <<
"Sizeof(ArrayMetaData)=" <<
sizeof(
ArrayMetaData) <<
"\n";
808 std::cout <<
"Array a1\n";
810 ASSERT_EQ(a1.allocator(), allocator2);
811 ASSERT_EQ(a1.size(), 0);
812 ASSERT_EQ(a1.capacity(), 0);
813 ASSERT_EQ(a1.data(),
nullptr);
815 std::cout <<
"Array a2\n";
817 ASSERT_EQ(a1.allocator(), a2.allocator());
818 ASSERT_EQ(a2.capacity(), 0);
819 ASSERT_EQ(a2.data(),
nullptr);
826 ASSERT_EQ(a1.size(), 5);
828 std::cout <<
"Array a3\n";
833 ASSERT_EQ(a3.size(), 3);
835 ASSERT_EQ(a3.allocator(), a1.allocator());
836 ASSERT_EQ(a3.size(), a1.size());
837 ASSERT_EQ(a3.constSpan(), a1.constSpan());
839 std::cout <<
"Array a4\n";
844 ASSERT_EQ(a4.size(), 3);
846 ASSERT_EQ(a4.allocator(), allocator1);
855 ASSERT_EQ(array[0].allocator(), allocator3);
856 ASSERT_EQ(array[1].allocator(), allocator3);
880 return m_default_allocator.
allocate(args,new_size);
885 return m_default_allocator.
reallocate(args, current_ptr, new_size);
895 return m_default_allocator.
adjustedCapacity(args, wanted_capacity, element_size);
906 ASSERT_EQ(old_args.memoryLocationHint(), eMemoryLocationHint::None);
907 ASSERT_EQ(new_args.memoryLocationHint(), eMemoryLocationHint::MainlyHost);
908 ASSERT_EQ(ptr.
size(), 8);
920 bool v1 = args.memoryLocationHint() == eMemoryLocationHint::None;
921 bool v2 = args.memoryLocationHint() == eMemoryLocationHint::MainlyHost;
922 bool v3 = args.memoryLocationHint() == eMemoryLocationHint::HostAndDeviceMostlyRead;
923 bool is_valid = v1 || v2 || v3;
928#define ASSERT_SAME_ARRAY_INFOS(a,b) \
929 ASSERT_EQ(a.allocationOptions(), b.allocationOptions());\
930 ASSERT_EQ(a.size(), b.size());\
931 ASSERT_EQ(a.capacity(), b.capacity())
933TEST(
Array, AllocatorV2)
942 opt3.setMemoryLocationHint(eMemoryLocationHint::HostAndDeviceMostlyRead);
943 ASSERT_EQ(opt3, allocate_options1);
946 std::cout <<
"Array a1\n";
948 ASSERT_EQ(a1.allocationOptions(), allocate_options2);
949 ASSERT_EQ(a1.size(), 0);
950 ASSERT_EQ(a1.capacity(), 0);
951 ASSERT_EQ(a1.data(),
nullptr);
953 std::cout <<
"Array a2\n";
955 ASSERT_SAME_ARRAY_INFOS(a2, a1);
956 ASSERT_EQ(a2.data(),
nullptr);
963 ASSERT_EQ(a1.size(), 5);
967 a2.setMemoryLocationHint(eMemoryLocationHint::MainlyHost);
969 std::cout <<
"Array a3\n";
974 ASSERT_EQ(a3.size(), 3);
976 ASSERT_EQ(a3.allocator(), a1.allocator());
977 ASSERT_EQ(a3.size(), a1.size());
978 ASSERT_EQ(a3.constSpan(), a1.constSpan());
980 std::cout <<
"Array a4\n";
985 ASSERT_EQ(a4.size(), 3);
987 ASSERT_EQ(a4.allocationOptions(), allocate_options1);
993 for (
Integer i = 0; i < 2; ++i) {
996 ASSERT_EQ(array[0].allocationOptions(), allocator3);
997 ASSERT_EQ(array[1].allocationOptions(), allocator3);
1004TEST(
Array, DebugInfo)
1010 String a1_name(
"Array1");
1013 std::cout <<
"Array a1\n";
1015 a1.setDebugName(a1_name);
1016 ASSERT_EQ(a1.allocationOptions(), allocate_options2);
1017 ASSERT_EQ(a1.size(), 0);
1018 ASSERT_EQ(a1.capacity(), 0);
1019 ASSERT_EQ(a1.data(),
nullptr);
1020 ASSERT_EQ(a1.debugName(), a1_name);
1022 std::cout <<
"Array a2\n";
1024 ASSERT_SAME_ARRAY_INFOS(a2, a1);
1025 ASSERT_EQ(a2.data(),
nullptr);
1026 ASSERT_EQ(a2.debugName(), a1_name);
1033 ASSERT_EQ(a1.size(), 5);
1036 ASSERT_EQ(a2.debugName(), a1_name);
1037 ASSERT_EQ(a2.size(), 2);
1042 ASSERT_EQ(a3.
size(), 2);
1048TEST(Collections, Memory)
1051 std::cout << eHostDeviceMemoryLocation::Unknown <<
" "
1052 << eHostDeviceMemoryLocation::Device <<
" "
1053 << eHostDeviceMemoryLocation::Host <<
" "
1054 << eHostDeviceMemoryLocation::ManagedMemoryDevice <<
" "
1055 << eHostDeviceMemoryLocation::ManagedMemoryHost <<
"\n";
1057 std::cout << eMemoryResource::Unknown <<
" "
1058 << eMemoryResource::Host <<
" "
1059 << eMemoryResource::HostPinned <<
" "
1060 << eMemoryResource::Device <<
" "
1061 << eMemoryResource::UnifiedMemory <<
"\n";
#define ASSERT_TRUE(condition)
Vérifie que condition est vrai.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
String debugName() const
Nom de debug (nul si aucun nom spécifié)
Classe abstraite de base d'un vecteur.
void _internalSetHostDeviceMemoryLocation(eHostDeviceMemoryLocation location)
Positionne l'emplacement physique de la zone mémoire.
eHostDeviceMemoryLocation hostDeviceMemoryLocation() const
Positionne l'emplacement physique de la zone mémoire.
Integer size() const
Nombre d'éléments du vecteur.
static constexpr Integer simdAlignment()
Alignement pour les structures utilisant la vectorisation.
static AlignedMemoryAllocator3 * Simd()
Allocateur garantissant l'alignement pour utiliser la vectorisation sur la plateforme cible.
static AlignedMemoryAllocator * Simd()
Allocateur garantissant l'alignement pour utiliser la vectorisation sur la plateforme cible.
Informations sur une zone mémoire allouée.
Int64 size() const
Taille en octets de la zone mémoire utilisée. (-1) si inconnue.
Classe de base des vecteurs 1D de données.
Span< const T > span() const
Vue immutable sur ce tableau.
iterator begin()
Itérateur sur le premier élément du tableau.
void copy(Span< const T > rhs)
Copie les valeurs de rhs dans l'instance.
reverse_iterator rbegin()
Itérateur inverse sur le premier élément du tableau.
void resizeNoInit(Int64 s)
Redimensionne sans initialiser les nouvelles valeurs.
void reserve(Int64 new_capacity)
Réserve le mémoire pour new_capacity éléments.
SmallSpan< const T > smallSpan() const
Vue immutable sur ce tableau.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
ArrayView< T > subView(Int64 abegin, Integer asize)
Sous-vue à partir de l'élément abegin et contenant asize éléments.
void remove(Int64 index)
Supprime l'entité ayant l'indice index.
ConstArrayView< T > constView() const
Vue constante sur ce tableau.
ArrayView< T > view() const
Vue mutable sur ce tableau.
SmallSpan< const T > constSmallSpan() const
Vue immutable sur ce tableau.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
Span< const T > constSpan() const
Vue constante sur ce tableau.
reverse_iterator rend()
Itérateur inverse sur le premier élément après la fin du tableau.
ConstArrayView< T > subConstView(Int64 abegin, Int32 asize) const
Sous-vue à partir de l'élément abegin et contenant asize éléments.
iterator end()
Itérateur sur le premier élément après la fin du tableau.
interval d'itérateurs constant
Allocateur mémoire via malloc/realloc/free.
bool hasRealloc(MemoryAllocationArgs) const override
Indique si l'allocateur supporte la sémantique de realloc.
AllocatedMemoryInfo reallocate(MemoryAllocationArgs, AllocatedMemoryInfo current_ptr, Int64 new_size) override
Réalloue de la mémoire pour new_size octets et retourne le pointeur.
Int64 adjustedCapacity(MemoryAllocationArgs, Int64 wanted_capacity, Int64 element_size) const override
Ajuste la capacité suivant la taille d'élément.
void deallocate(MemoryAllocationArgs, AllocatedMemoryInfo ptr) override
Libère la mémoire dont l'adresse de base est ptr.
AllocatedMemoryInfo allocate(MemoryAllocationArgs, Int64 new_size) override
Alloue de la mémoire pour new_size octets et retourne le pointeur.
Classe de base d'une exception.
Interface de la version 3 de IMemoryAllocator.
Interface d'un allocateur pour la mémoire.
virtual size_t guaranteedAlignment(MemoryAllocationArgs args) const
Valeur de l'alignement garanti par l'allocateur.
virtual void notifyMemoryArgsChanged(MemoryAllocationArgs old_args, MemoryAllocationArgs new_args, AllocatedMemoryInfo ptr)
Notifie du changement des arguments spécifiques à l'instance.
Classe contenant des informations pour spécialiser les allocations.
Options pour configurer les allocations.
Allocateur mémoire via malloc/realloc/free avec impression listing.
Vecteur 1D de données avec sémantique par référence.
SharedArray< T > clone() const
Clone le tableau.
Vue d'un tableau d'éléments de type T.
Chaîne de caractères unicode.
Vecteur 1D de données avec sémantique par valeur (style STL).
Allocateur pour tester les arguments.
void notifyMemoryArgsChanged(MemoryAllocationArgs old_args, MemoryAllocationArgs new_args, AllocatedMemoryInfo ptr) override
Notifie du changement des arguments spécifiques à l'instance.
AllocatedMemoryInfo reallocate(MemoryAllocationArgs args, AllocatedMemoryInfo current_ptr, Int64 new_size) override
Réalloue de la mémoire pour new_size octets et retourne le pointeur.
size_t guarantedAlignment(MemoryAllocationArgs args) const override
Valeur de l'alignement garanti par l'allocateur.
void deallocate(MemoryAllocationArgs args, AllocatedMemoryInfo ptr) override
Libère la mémoire dont l'adresse de base est ptr.
AllocatedMemoryInfo allocate(MemoryAllocationArgs args, Int64 new_size) override
Alloue de la mémoire pour new_size octets et retourne le pointeur.
Int64 adjustedCapacity(MemoryAllocationArgs args, Int64 wanted_capacity, Int64 element_size) const override
Ajuste la capacité suivant la taille d'élément.
bool hasRealloc(MemoryAllocationArgs args) const override
Indique si l'allocateur supporte la sémantique de realloc.
Concept for allocating, resizing and freeing memory block.
Espace de nom de Arccore.
void swap(UniqueArray< T > &v1, UniqueArray< T > &v2)
Échange les valeurs de v1 et v2.
double Real
Type représentant un réel.
Int32 Integer
Type représentant un entier.
std::int64_t Int64
Type entier signé sur 64 bits.