From 8a86728b2ba16484fef050d38300e53ec43e9e28 Mon Sep 17 00:00:00 2001 From: alaamroue Date: Wed, 3 Apr 2024 22:10:36 +0200 Subject: [PATCH] Fix gpu crashing bug --- .../solvergpu/source_code/CDomainCartesian.cpp | 11 +---------- .../solvergpu/source_code/CDomainCartesian.h | 2 +- .../solvergpu/source_code/CSchemeGodunov.cpp | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.cpp b/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.cpp index 373c68b..3a82b06 100644 --- a/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.cpp +++ b/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.cpp @@ -1035,7 +1035,7 @@ void CDomainCartesian::memoryDump() } //Output the result members per timestep to Paraview -void CDomainCartesian::output_to_vtk_file(std::string path, double time, std::string rasterName, int sizeX, int sizeY, double* opt_z, double* opt_zx_max, double* opt_zy_max, double* opt_h, double* opt_s, double* opt_v_x, double* opt_v_y, double* opt_boundary) { +void CDomainCartesian::output_to_vtk_file(std::string path, double time, std::string rasterName, int sizeX, int sizeY, double* opt_z, double* opt_zx_max, double* opt_zy_max, double* opt_h, double* opt_s, double* opt_v_x, double* opt_v_y) { //get the file name double temp_double; @@ -1151,15 +1151,6 @@ void CDomainCartesian::output_to_vtk_file(std::string path, double time, std::st Util::SwapEnd(temp_double); txt.write(reinterpret_cast(&temp_double), sizeof(double)); } - txt << std::endl; - - txt << "SCALARS opt_bound double" << std::endl; - txt << "LOOKUP_TABLE default" << std::endl; - for (int i = 0; i < sizeT; i++) { - temp_double = opt_boundary[i]; - Util::SwapEnd(temp_double); - txt.write(reinterpret_cast(&temp_double), sizeof(double)); - } txt.close(); diff --git a/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.h b/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.h index 5e367b6..b07aa65 100644 --- a/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.h +++ b/source_code/system_hydraulic/source_code/solvergpu/source_code/CDomainCartesian.h @@ -152,7 +152,7 @@ class CDomainCartesian void memoryDump(); // Dumps memory for debugging void output_to_vtk_file(std::string path, double time, std::string rasterName, // Output various data into a ParaView file (useful for debugging) int sizeX, int sizeY, double* opt_z, double* opt_zx_max, double* opt_zy_max, - double* opt_h, double* opt_s, double* opt_v_x, double* opt_v_y, double* boundary); + double* opt_h, double* opt_s, double* opt_v_x, double* opt_v_y); private: diff --git a/source_code/system_hydraulic/source_code/solvergpu/source_code/CSchemeGodunov.cpp b/source_code/system_hydraulic/source_code/solvergpu/source_code/CSchemeGodunov.cpp index 3b44e50..e9315e0 100644 --- a/source_code/system_hydraulic/source_code/solvergpu/source_code/CSchemeGodunov.cpp +++ b/source_code/system_hydraulic/source_code/solvergpu/source_code/CSchemeGodunov.cpp @@ -1325,21 +1325,18 @@ void CSchemeGodunov::outputAllFloodplainDataToVtk() { double* opt_zx_max = new double[this->getDomain()->getCellCount()]; double* opt_zy_max = new double[this->getDomain()->getCellCount()]; double* opt_s_gpu = new double[this->getDomain()->getCellCount()]; - double* opt_boundary = new double[this->getDomain()->getCellCount()]; for (unsigned long i = 0; i < this->getDomain()->getCellCount(); i++){ opt_z[i] = this->getDomain()->getBedElevation(i); opt_zx_max[i] = this->getDomain()->getZxmax(i); opt_zy_max[i] = this->getDomain()->getZymax(i); opt_s_gpu[i] = this->getDomain()->getBedElevation(i) + opt_h_gpu[i]; - opt_boundary[i] = this->getDomain()->getBoundaryCondition(i); } - this->getDomain()->output_to_vtk_file(path, dCurrentTime, "rasterName", this->getDomain()->getCols(), this->getDomain()->getRows(), opt_z, opt_zx_max, opt_zy_max, opt_h_gpu, opt_s_gpu, opt_v_x_gpu, opt_v_y_gpu, opt_boundary); + this->getDomain()->output_to_vtk_file(path, dCurrentTime, "rasterName", this->getDomain()->getCols(), this->getDomain()->getRows(), opt_z, opt_zx_max, opt_zy_max, opt_h_gpu, opt_s_gpu, opt_v_x_gpu, opt_v_y_gpu); delete[] opt_h_gpu; delete[] opt_v_x_gpu; delete[] opt_v_y_gpu; - delete[] opt_boundary; delete[] opt_z; delete[] opt_zx_max; delete[] opt_zy_max;