9 if (m_nx != src.size() || m_ny != src.size() || m_nz != src.size()) {
10 this->resize(src.nx(), src.ny(), src.nz());
26 this->resize(nx, ny, nz);
34 void resize(
const uint nx,
const uint ny,
const uint nz);
40 inline const VkDeviceArray3D<T>* handle()
const {
return &m_data; }
41 inline VkDeviceArray3D<T>* handle() {
return &m_data; }
43 VkBuffer buffer()
const {
return m_data.bufferHandle(); }
45 uint32_t bufferSize() {
return m_data.bufferSize(); }
47 inline T* begin()
const {
return m_data; }
49 inline uint nx()
const {
return m_nx; }
50 inline uint ny()
const {
return m_ny; }
51 inline uint nz()
const {
return m_nz; }
78 inline size_t index(
const uint i,
const uint j,
const uint k)
const
80 return i + j * m_nx + k * m_nx * m_ny;
83 inline size_t size()
const {
return m_nx * m_ny * m_nz; }
84 inline bool isCPU()
const {
return false; }
85 inline bool isGPU()
const {
return true; }
87 void assign(
const std::vector<T>& src);
88 void assign(
const Array3D<T, DeviceType::GPU>& src);
89 void assign(
const Array3D<T, DeviceType::CPU>& src);
97 VkDeviceArray3D<T> m_data;
111 uint total = nx * ny * nz;
112 if (m_data.size() == total)
return;
120 m_data.resize(nx, ny, nz);
123 m_nx = nx; m_ny = ny; m_nz = nz;
148 assert(m_nx * m_ny * m_nz == src.size());
157 if (m_nx != src.nx() || m_ny != src.ny() || m_nz != src.nz()) {
158 this->resize(src.nx(), src.ny(), src.nz());
168 if (m_nx != src.nx() || m_ny != src.ny() || m_nz != src.nz()) {
169 this->resize(src.nx(), src.ny(), src.nz());
This is an implementation of AdditiveCCD based on peridyno.
Array3D< T, DeviceType::GPU > DArray3D
bool vkTransfer(VkHostArray< T > &dst, const VkDeviceArray< T > &src)