Skip to content

Commit

Permalink
Merge pull request #3 from alaamroue/master
Browse files Browse the repository at this point in the history
Fix GPU crashing bug
  • Loading branch information
dabachma authored Apr 4, 2024
2 parents 11265cd + 8a86728 commit 0fec62c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<char*>(&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<char*>(&temp_double), sizeof(double));
}

txt.close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0fec62c

Please # to comment.