PeriDyno 1.0.0
Loading...
Searching...
No Matches
List.h
Go to the documentation of this file.
1#ifndef LIST_H
2#define LIST_H
3
4#include "Platform.h"
5#include "STLBuffer.h"
6
7#ifdef CUDA_BACKEND
8#include <cuda.h>
9#include <cuda_runtime.h>
10#endif
11//#include <device_atomic_functions.h>
12namespace dyno
13{
19 template <typename T>
20 class List : public STLBuffer<T>
21 {
22 public:
23 using iterator = T*;
24
25 DYN_FUNC List();
26
27 DYN_FUNC iterator find(T val);
28
29 DYN_FUNC inline iterator begin() {
30 return this->m_startLoc;
31 }
32
33 DYN_FUNC inline iterator end(){
34 return this->m_startLoc + m_size;
35 }
36
37 DYN_FUNC inline T& operator [] (uint id) {
38 return this->m_startLoc[id];
39 }
40
41 DYN_FUNC inline T& operator [] (uint id) const {
42 return this->m_startLoc[id];
43 }
44
45 DYN_FUNC void assign(T* beg, int num, int buffer_size) {
46 this->m_startLoc = beg;
47 m_size = num;
48 this->m_maxSize = buffer_size;
49 }
50
51 DYN_FUNC void clear();
52
53 DYN_FUNC uint size();
54
55 DYN_FUNC inline iterator insert(T val);
56
57#ifdef CUDA_BACKEND
58 GPU_FUNC inline iterator atomicInsert(T val);
59#endif
60
61 DYN_FUNC inline T front();
62 DYN_FUNC inline T back();
63
64 DYN_FUNC bool empty();
65
66 private:
68 };
69
70}
71
72#include "List.inl"
73
74#endif // LIST_H
uint m_size
Definition List.h:67
DYN_FUNC iterator insert(T val)
Definition List.inl:19
DYN_FUNC void clear()
Definition List.inl:63
DYN_FUNC iterator end()
Definition List.h:33
DYN_FUNC iterator begin()
Definition List.h:29
DYN_FUNC bool empty()
Definition List.inl:75
DYN_FUNC iterator find(T val)
Definition List.inl:12
T * iterator
Definition List.h:23
DYN_FUNC T & operator[](uint id)
Definition List.h:37
DYN_FUNC T front()
Definition List.inl:81
DYN_FUNC void assign(T *beg, int num, int buffer_size)
Definition List.h:45
DYN_FUNC List()
Definition List.inl:7
DYN_FUNC T back()
Definition List.inl:87
DYN_FUNC uint size()
Definition List.inl:69
DYN_FUNC STLBuffer()
Definition STLBuffer.h:19
#define T(t)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
unsigned int uint
Definition VkProgram.h:14