Commit e1bfee69 authored by Houman Mirzaalian Dastjerdi's avatar Houman Mirzaalian Dastjerdi
Browse files

CUDA_ComplexGeometry

- tmpPdf
- numFluidCells
parent 3bec9d9a
......@@ -53,16 +53,21 @@ namespace walberla {
class ListOnGpu {
public:
typedef Index_T index_t;
ListOnGpu() : pdfs_(nullptr), pullIdxs_(nullptr), size_(0) {}
ListOnGpu() : pdfs_(nullptr), tmpPdfs_(nullptr), pullIdxs_(nullptr), size_(0), numFluidCells_(0) {}
~ListOnGpu() {};
void resize(const size_t newSize) {
void resize(const size_t newSize, const uint_t newNumFluidCells) {
cudaFree(pdfs_);
cudaFree(tmpPdfs_);
cudaFree(pullIdxs_);
cudaMalloc(&pdfs_, sizeof(real_t) * newSize);
cudaMalloc(&tmpPdfs_, sizeof(real_t) * newSize);
cudaMalloc(&pullIdxs_, sizeof(Index_T) * newSize);
size_ = newSize;
numFluidCells_ = newNumFluidCells;
//free old ptr and reallocate
......@@ -72,17 +77,26 @@ namespace walberla {
const real_t *getPdfData() const { return pdfs_; }
real_t *getTmpPdfData() { return tmpPdfs_; }
const real_t *getTmpPdfData() const { return tmpPdfs_; }
Index_T *getPullIndicesData() { return pullIdxs_; }
const Index_T *getPullIndicesData() const { return pullIdxs_; }
size_t getSize() const { return size_; }
size_t getNumFluidCells() const { return numFluidCells_; }
private:
real_t *pdfs_;
real_t *tmpPdfs_;
Index_T *pullIdxs_;
size_t size_;
uint_t numFluidCells_;
};
template< typename Index_T >
......@@ -101,6 +115,7 @@ namespace walberla {
auto pdfs_cpu = src.getPdfData();
auto pullIdxs_cpu = src.getPullIndicesData();
auto size_cpu = src.getSize();
auto size_FluidCells = src.getNumFluidCells();
auto pdfs_gpu = dst.getPdfData();
......@@ -110,7 +125,7 @@ namespace walberla {
if (size_cpu != size_gpu ){
dst.resize(size_cpu);
dst.resize(size_cpu, size_FluidCells);
} // check if size matches, if not reallocate
......
......@@ -243,6 +243,9 @@ public:
real_t * getPdfData() { return pdfs_.data(); }
const real_t * getPdfData() const { return pdfs_.data(); }
real_t * getTmpPdfData() { return tmpPdfs_.data(); }
const real_t * getTmpPdfData() const { return tmpPdfs_.data(); }
Index_T * getPullIndicesData() { return pullIdxs_.data(); }
const Index_T * getPullIndicesData() const { return pullIdxs_.data(); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment