7    template<
class ElementType>
 
   28        bool resize(
const uint arraySize, 
const uint eleSize);
 
   32        template<
typename ET2>
 
   46        DYN_FUNC 
inline bool isCPU()
 const { 
return false; }
 
   47        DYN_FUNC 
inline bool isGPU()
 const { 
return true; }
 
   54        void assign(std::vector<std::map<int, ElementType>>& src);
 
 
   84    template<
class ElementType>
 
   92    template<
class ElementType>
 
   97        if (
m_index.size() != counts.size())
 
  100            m_maps.resize(counts.size());
 
 
  118    template<
class ElementType>
 
  124    template<
class ElementType>
 
  130        if (
m_index.size() != arraySize)
 
  137        hIndex.resize(arraySize);
 
  139        for (
size_t i = 0; i < arraySize; i++)
 
  141            hIndex[i] = (
uint)accNum;
 
 
  154    template<
typename ElementType>
 
  155    template<
typename ET2>
 
  157        uint arraySize = src.size();
 
  158        if (
m_index.size() != arraySize)
 
 
  172    template<
class ElementType>
 
  178        m_maps.assign(src.maps());
 
 
  184    template<
class ElementType>
 
  190        m_maps.assign(src.maps());
 
 
  196    template<
class ElementType>
 
  199        size_t indNum = src.size();
 
  205        for (
int i = 0; i < src.size(); i++)
 
  207            hIndex[i] = (
uint)eleNum;
 
  208            eleNum += src[i].size();
 
  210            if (src[i].
size() > 0)
 
  212                for (
typename std::map<int, ElementType>::iterator map_it = src[i].begin(); map_it != src[i].end(); map_it++)
 
  215                    hElements.pushBack(mypair);
 
  227        for (
int i = 0; i < src.size(); i++)
 
  229            size_t num_i = src[i].size();
 
  231            mmap.
assign(strAdr + eleNum, num_i, num_i);
 
  235            eleNum += src[i].
size();
 
 
  241    template<
class ElementType>
 
  252    template<
class ElementType>
 
  258    template<
class ElementType>
 
  261        for (
int i = 0; i < 
m_maps.size(); i++)
 
 
  271    template<
class ElementType>
 
  277        m_maps.assign(src.maps());
 
  280        for (
int i = 0; i < src.size(); i++)
 
 
  286    template<
class ElementType>
 
  292        m_maps.assign(src.maps());
 
  295        for (
int i = 0; i < src.size(); i++)
 
 
CArray< Pair< int, ElementType > > m_elements
 
CArray< Map< int, ElementType > > m_maps
 
DYN_FUNC bool isEmpty() const
 
const DArray< uint > & index() const
 
DYN_FUNC uint elementSize() const
 
ArrayMap< ElementType, DeviceType::GPU > & operator=(const ArrayMap< ElementType, DeviceType::GPU > &)=delete
To avoid erroneous shallow copy.
 
DArray< Map< int, ElementType > > m_maps
 
DYN_FUNC bool isCPU() const
 
const DArray< Map< int, ElementType > > & maps() const
 
~ArrayMap()
Do not release memory here, call clear() explicitly.
 
friend std::ostream & operator<<(std::ostream &out, const ArrayMap< ElementType, DeviceType::GPU > &aMap)
 
const DArray< Pair< int, ElementType > > & elements() const
 
DYN_FUNC bool isGPU() const
 
DArray< Pair< int, ElementType > > m_elements
 
DYN_FUNC uint size() const
 
Be aware do not use this structure on GPU if the data size is large.
 
DYN_FUNC void assign(Pair< MKey, T > *beg, int num, int buffer_size)
 
T accumulate(const T *val, const uint num)
 
void exclusive(T *output, const T *input, size_t length, bool bcao=true)
 
This is an implementation of AdditiveCCD based on peridyno.
 
void parallel_init_for_map(void *maps, void *elements, size_t ele_size, DArray< uint > &index)
 
Array< T, DeviceType::GPU > DArray
 
ArrayMap< T, DeviceType::GPU > DArrayMap
 
void parallel_allocate_for_map(void *maps, void *elements, size_t ele_size, DArray< uint > &index)
 
Array< T, DeviceType::CPU > CArray