26 template<
class ElementType, DeviceType deviceType>
class ArrayList;
28 template<
class ElementType>
35 bool resize(
uint num);
45 bool resize(
const uint arraySize,
const uint eleSize);
65 inline bool isCPU()
const {
return true; }
66 inline bool isGPU()
const {
return false; }
80 for (
uint i = 0; i < aList.size(); i++)
83 out <<
"List " << i <<
" (" << lst.
size() <<
"):";
84 for (
auto it = lst.
begin(); it != lst.
end(); it++)
86 std::cout <<
" " << *it;
109 template<
class ElementType>
112 for (
int i = 0; i <
mLists.size(); i++)
122 template<
class ElementType>
128 template<
class ElementType>
131 assert(counts.size() > 0);
133 if (
mIndex.size() != counts.size())
135 mIndex.resize(counts.size());
136 mLists.resize(counts.size());
164 template<
class ElementType>
169 if (
mIndex.size() != arraySize)
191 template<
class ElementType>
194 mIndex.assign(src.index());
197 mLists.assign(src.lists());
200 for (
uint i = 0; i < src.size(); i++)
ArrayList< ElementType, DeviceType::CPU > & operator=(const ArrayList< ElementType, DeviceType::CPU > &)=delete
To avoid erroneous shallow copy.
friend std::ostream & operator<<(std::ostream &out, const ArrayList< ElementType, DeviceType::CPU > &aList)
CArray< List< ElementType > > mLists
CArray< ElementType > mElements
const CArray< ElementType > & elements() const
const CArray< uint > & index() const
const CArray< List< ElementType > > & lists() const
Be aware do not use this structure on GPU if the data size is large.
DYN_FUNC iterator begin()
This is an implementation of AdditiveCCD based on peridyno.
ArrayList< T, DeviceType::CPU > CArrayList
Array< T, DeviceType::CPU > CArray