SWE
/import/home/rettenbs/src/SWE/src/blocks/rusanov/SWE_RusanovBlockCUDA.hh
Go to the documentation of this file.
00001 
00028 #ifndef __SWE_RUSANOVBLOCKCUDA_HH
00029 #define __SWE_RUSANOVBLOCKCUDA_HH
00030 
00031 #include <iostream>
00032 #include <stdio.h>
00033 #include <fstream>
00034 #include <cuda_runtime.h>
00035 #include "tools/help.hh"
00036 #include "SWE_Block.hh"
00037 #include "SWE_BlockCUDA.hh"
00038 
00039 using namespace std;
00040 
00047 class SWE_RusanovBlockCUDA : public SWE_BlockCUDA {
00048 
00049   public:
00050     // Constructor und Destructor
00051     SWE_RusanovBlockCUDA(float _offsetX = 0, float _offsetY = 0, const int i_cudaDevice = 0);
00052     virtual ~SWE_RusanovBlockCUDA();
00053     
00054   // object methods
00055 
00056     virtual void computeNumericalFluxes();
00057     // simulate for specified time range
00058     // execute Euler time step
00059     virtual void updateUnknowns(float dt);
00061     virtual void simulateTimestep(float dt);
00062     // compute flux terms on edges
00063     virtual float simulate(float tStart, float tEnd);
00064     
00065   private:
00066      
00067     // compute bathymetry source terms
00068     void computeBathymetrySources();
00069 
00070     // determine maximum possible time step
00071     void computeMaxTimestepCUDA();
00072 
00073     // arrays to hold the values of the flux terms at cell edges
00074     float* Fhd;
00075     float* Fhud;
00076     float* Fhvd;
00077     float* Ghd;
00078     float* Ghud;
00079     float* Ghvd;
00080 
00081     // arrays to hold the bathymetry source terms for the hu and hv equations
00082     float* Bxd;
00083     float* Byd;
00084     
00085     // helper arrays: store maximum height and velocities to determine time step
00086     float* maxhd;
00087     float* maxvd;
00088 
00089     // overload operator<< such that data can be written via cout <<
00090     // -> needs to be declared as friend to be allowed to access private data
00091     friend ostream& operator<< (ostream& os, const SWE_RusanovBlockCUDA& swe);
00092 
00093 #ifdef DBG
00094     // --- only required for debugging purposes ---
00095     // arrays for fluxes for h,hu,hv in main memory
00096     Float2D Fh; 
00097     Float2D Fhu;
00098     Float2D Fhv;
00099     Float2D Gh; 
00100     Float2D Ghu;
00101     Float2D Ghv;
00102     // dump fluxes for h,hu,hv from CUDA device memory into main memory
00103     void cudaDumpFlux();
00104 #endif
00105     
00106 };
00107 
00108 ostream& operator<< (ostream& os, const SWE_RusanovBlockCUDA& swe);
00109 
00110 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends