Skip to content

Commit

Permalink
Reduce warning step2
Browse files Browse the repository at this point in the history
  • Loading branch information
CyprienBosserelle committed Oct 9, 2023
1 parent 6f671bf commit 716826e
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions src/InitEvolv.cu
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,11 @@ void warmstart(Param XParam,Forcing<float> XForcing, BlockP<T> XBlock, T* zb, Ev

if (XForcing.Atmp.uniform)
{
atmpi = T(XForcing.Atmp.nowvalue);
atmpi = float(XForcing.Atmp.nowvalue);
}
else
{
atmpi = interp2BUQ(xi, yi, XForcing.Atmp);
atmpi = float(interp2BUQ(xi, yi, XForcing.Atmp));
}
zsbnd = zsbnd - (atmpi- (T)XParam.Paref) * (T)XParam.Pa2m;
}
Expand Down
6 changes: 3 additions & 3 deletions src/InitialConditions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ template <class T> void FindTSoutNodes(Param& XParam, BlockP<T> XBlock, Bndblock

dxblk = (T)(XParam.blkwidth) * levdx;

blkxmin = ((T)XParam.xo + XBlock.xo[ib] - 0.5 * levdx);
blkymin = ((T)XParam.yo + XBlock.yo[ib] - 0.5 * levdx);
blkxmin = ((T)XParam.xo + XBlock.xo[ib] - T(0.5) * levdx);
blkymin = ((T)XParam.yo + XBlock.yo[ib] - T(0.5) * levdx);

blkxmax = (blkxmin + dxblk);
blkymax = (blkymin + dxblk);
Expand Down Expand Up @@ -639,7 +639,7 @@ template <class T> void Findoutzoneblks(Param& XParam, BlockP<T>& XBlock)
std::vector<int> cornerblk; //index of the blocks at the corner of the zone
outzoneP Xzone; //info on outzone given by the user
outzoneB XzoneB; //info on outzone computed and used actually for writing nc files
double eps;
//double eps;

// Find the blocks to output and the corners of this area for each zone
for (int o = 0; o < XParam.outzone.size(); o++)
Expand Down
4 changes: 2 additions & 2 deletions src/Poly.cu
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ bool PolygonIntersect(Polygon P, Polygon Q)

if (intersect)
{
i = P.vertices.size();
j = Q.vertices.size();
i = (int)P.vertices.size();
j = (int)Q.vertices.size();
break;
}

Expand Down
12 changes: 6 additions & 6 deletions src/ReadForcing.cu
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void readforcing(Param & XParam, Forcing<T> & XForcing)
XForcing.rivers[Rin].flowinput = readFlowfile(XForcing.rivers[Rin].Riverflowfile, XParam.reftime);

//Check the time range of the river forcing
nt = XForcing.rivers[Rin].flowinput.size();
nt = (int)XForcing.rivers[Rin].flowinput.size();
XForcing.rivers[Rin].to = XForcing.rivers[Rin].flowinput[0].time;
XForcing.rivers[Rin].tmax = XForcing.rivers[Rin].flowinput[nt-1].time;
if ( XForcing.rivers[Rin].tmax < XParam.endtime)
Expand Down Expand Up @@ -260,7 +260,7 @@ void readforcing(Param & XParam, Forcing<T> & XForcing)
}

//Sanity check on the time range of the forcing
nt = XForcing.UWind.unidata.size();
nt = (int)XForcing.UWind.unidata.size();
if (XForcing.UWind.unidata[nt - 1].time < XParam.endtime || XForcing.VWind.unidata[nt - 1].time < XParam.endtime)
{
XParam.endtime = min(XForcing.UWind.unidata[nt - 1].time, XForcing.VWind.unidata[nt - 1].time);
Expand Down Expand Up @@ -309,7 +309,7 @@ void readforcing(Param & XParam, Forcing<T> & XForcing)
InitDynforcing(gpgpu, XParam, XForcing.Atmp);
// Deflault is zero wich is terrible so change to Paref so limitwaves generated at the edge of forcing
// Users should insure there forcing extend well beyond the intended model extent.
XForcing.Atmp.clampedge = XParam.Paref;
XForcing.Atmp.clampedge = T(XParam.Paref);
//readDynforcing(gpgpu, XParam.totaltime, XForcing.Atmp);
}
}
Expand Down Expand Up @@ -819,7 +819,7 @@ std::vector<SLTS> readNestfile(std::string ncfile,std::string varname, int hor ,
std::vector<double> WLS,Unest,Vnest;
//Define NC file variables
int nnx, nny, nt, nbndpts, indxx, indyy, indx, indy,nx, ny;
double dx, dy, xxo, yyo, to, xmax, ymax, tmax,xo,yo;
double dx, dy, xxo, yyo, tmax,xo,yo;
double * ttt, *zsa;
bool checkhh = false;
int iswet;
Expand Down Expand Up @@ -1480,8 +1480,8 @@ template<class T> T readforcinghead(T ForcingParam)
}
if (ForcingParam.extension.compare("nc") == 0)
{
int dummy;
double dummyb, dummyc;
//int dummy;
//double dummyb, dummyc;
//log("netcdf file");

//readgridncsize(ForcingParam.inputfile, ForcingParam.varname, ForcingParam.nx, ForcingParam.ny, dummy, ForcingParam.dx, ForcingParam.xo, ForcingParam.yo, dummyb, ForcingParam.xmax, ForcingParam.ymax, dummyc, ForcingParam.flipxx, ForcingParam.flipyy);
Expand Down
4 changes: 2 additions & 2 deletions src/ReadInput.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ void checkparamsanity(Param& XParam, Forcing<float>& XForcing)
XForcing.bot.isright = 0;
XForcing.bot.istop = -1;

XForcing.Atmp.clampedge = XParam.Paref;
XForcing.Atmp.clampedge = float(XParam.Paref);

if (!XForcing.Atmp.inputfile.empty())
{
Expand Down Expand Up @@ -1484,7 +1484,7 @@ std::vector<std::string> split(const std::string s, const std::string delim)

if (ide < (rem.length() - delim.length()))
{
loc = ide + delim.length();
loc = int(ide + delim.length());
rem = rem.substr(loc);
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/Read_netcdf.cu
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void readgridncsize(const std::string ncfilestr, const std::string varstr, std::
double * ytempvar;
ytempvar = (double *)malloc(ny*sizeof(double));
size_t start[] = { 0 };
size_t count[] = { ny };
size_t count[] = { (size_t)ny };
status = nc_get_vara_double(ncid, varid, start, count, ytempvar);
if (status != NC_NOERR) handle_ncerror(status);

Expand All @@ -200,7 +200,7 @@ void readgridncsize(const std::string ncfilestr, const std::string varstr, std::
else
{
size_t start[] = { 0, 0 };
size_t count[] = { ny, nx };
size_t count[] = { (size_t)ny, (size_t)nx };
status = nc_get_vara_double(ncid, varid, start, count, ycoord);
if (status != NC_NOERR) handle_ncerror(status);

Expand All @@ -220,7 +220,7 @@ void readgridncsize(const std::string ncfilestr, const std::string varstr, std::
double * xtempvar;
xtempvar = (double *)malloc(nx*sizeof(double));
size_t start[] = { 0 };
size_t count[] = { nx };
size_t count[] = { (size_t)nx };
status = nc_get_vara_double(ncid, varid, start, count, xtempvar);
if (status != NC_NOERR) handle_ncerror(status);

Expand All @@ -238,7 +238,7 @@ void readgridncsize(const std::string ncfilestr, const std::string varstr, std::
else
{
size_t start[] = { 0, 0 };
size_t count[] = { ny, nx };
size_t count[] = { (size_t)ny, (size_t)nx };
status = nc_get_vara_double(ncid, varid, start, count, xcoord);
if (status != NC_NOERR) handle_ncerror(status);

Expand Down Expand Up @@ -276,8 +276,8 @@ void readgridncsize(const std::string ncfilestr, const std::string varstr, std::
//allocate temporary array and read time vector
double * ttempvar;
ttempvar = (double *)malloc(nt * sizeof(double));
size_t start[] = { 0 };
size_t count[] = { nt };
//size_t start[] = { 0 };
//size_t count[] = { (size_t)nt };
//status = nc_get_vara_double(ncid, varid, start, count, ttempvar);
status = readnctime2(ncid, reftime, nt, ttempvar);

Expand Down Expand Up @@ -332,7 +332,7 @@ void readgridncsize(forcingmap& Fmap, Param XParam)
template<class T> void readgridncsize(T& Imap)
{
double a, b, c;
int duma, dumb, dumc;
int duma;
readgridncsize(Imap.inputfile, Imap.varname, "2000-01-01T00:00:00", Imap.nx, Imap.ny, duma, Imap.dx, Imap.dy, a, Imap.xo, Imap.yo, b, Imap.xmax, Imap.ymax, c, Imap.flipxx, Imap.flipyy);
}
template void readgridncsize<inputmap>(inputmap &Imap);
Expand Down Expand Up @@ -634,7 +634,7 @@ int readncslev1(std::string filename, std::string varstr, size_t indx, size_t in

if (sferr == NC_NOERR || oferr == NC_NOERR) // data must be packed
{
zsa[0] = zsa[0] * scalefac + offset;
zsa[0] = zsa[0] * (T)scalefac + (T)offset;
}

if (checkhh)
Expand Down Expand Up @@ -679,17 +679,17 @@ int readncslev1(std::string filename, std::string varstr, size_t indx, size_t in

if (sferr == NC_NOERR || oferr == NC_NOERR) // data must be packed
{
zsa[0] = zsa[0] * scalefac + offset;
zsa[0] = zsa[0] * (T)scalefac + (T)offset;
}

hha = zsa[0];
if (hha > eps)
{
zsa[0] = zza;
zsa[0] = T(zza);
}
else
{
zsa[0] = 0.0;
zsa[0] = T(0.0);
wet = 0;
}

Expand Down Expand Up @@ -961,9 +961,9 @@ void readWNDstep(forcingmap WNDUmap, forcingmap WNDVmap, int steptoread, float *
//size_t startl[]={hdstep-1,lev,0,0};
//size_t countlu[]={1,1,netau,nxiu};
//size_t countlv[]={1,1,netav,nxiv};
size_t startl[] = { steptoread, 0, 0 };
size_t countlu[] = { 1, WNDUmap.ny, WNDUmap.nx };
size_t countlv[] = { 1, WNDVmap.ny, WNDVmap.nx };
size_t startl[] = { (size_t)steptoread, 0, 0 };
size_t countlu[] = { 1, (size_t)WNDUmap.ny, (size_t)WNDUmap.nx };
size_t countlv[] = { 1, (size_t)WNDVmap.ny, (size_t)WNDVmap.nx };

//static ptrdiff_t stridel[]={1,1,1,1};
//static ptrdiff_t stridel[] = { 1, 1, 1 };
Expand Down Expand Up @@ -1052,8 +1052,8 @@ void readATMstep(forcingmap ATMPmap, int steptoread, float *&Po)
//size_t startl[]={hdstep-1,lev,0,0};
//size_t countlu[]={1,1,netau,nxiu};
//size_t countlv[]={1,1,netav,nxiv};
size_t startl[] = { steptoread, 0, 0 };
size_t countlu[] = { 1, ATMPmap.ny, ATMPmap.nx };
size_t startl[] = { (size_t)steptoread, 0, 0 };
size_t countlu[] = { 1, (size_t)ATMPmap.ny, (size_t)ATMPmap.nx };
//size_t countlv[] = { 1, WNDVmap.ny, WNDVmap.nx };

//static ptrdiff_t stridel[]={1,1,1,1};
Expand Down
24 changes: 12 additions & 12 deletions src/Reimann.cu
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ template <class T> __global__ void UpdateButtingerXGPU(Param XParam, BlockP<T> X
vr = vi - dx * dvdxi;
}
if (hn > eps) {
ul = uli + (1. - dx * dhdxil / hn) * dx * dudxil;
vl = vli + (1. - dx * dhdxil / hn) * dx * dvdxil;
ul = uli + (T(1.0) - dx * dhdxil / hn) * dx * dudxil;
vl = vli + (T(1.0) - dx * dhdxil / hn) * dx * dvdxil;
}
else {
ul = uli + dx * dudxil;
Expand Down Expand Up @@ -299,16 +299,16 @@ template <class T> __host__ void UpdateButtingerXCPU(Param XParam, BlockP<T> XBl
//To avoid high velocities near dry cells, we reconstruct velocities according to Bouchut.
T ul, ur, vl, vr, sl, sr;
if (hi > eps) {
ur = ui - (1. + dx * dhdxi / hi) * dx * dudxi;
vr = vi - (1. + dx * dhdxi / hi) * dx * dvdxi;
ur = ui - (T(1.0) + dx * dhdxi / hi) * dx * dudxi;
vr = vi - (T(1.0) + dx * dhdxi / hi) * dx * dvdxi;
}
else {
ur = ui - dx * dudxi;
vr = vi - dx * dvdxi;
}
if (hn > eps) {
ul = uli + (1. - dx * dhdxil / hn) * dx * dudxil;
vl = vli + (1. - dx * dhdxil / hn) * dx * dvdxil;
ul = uli + (T(1.0) - dx * dhdxil / hn) * dx * dudxil;
vl = vli + (T(1.0) - dx * dhdxil / hn) * dx * dvdxil;
}
else {
ul = uli + dx * dudxil;
Expand Down Expand Up @@ -680,16 +680,16 @@ template <class T> __host__ void UpdateButtingerYCPU(Param XParam, BlockP<T> XBl
//To avoid high velocities near dry cells, we reconstruct velocities according to Bouchut.
T ul, ur, vl, vr, sl, sr;
if (hi > eps) {
ur = ui - (1. + dx * dhdyi / hi) * dx * dudyi;
vr = vi - (1. + dx * dhdyi / hi) * dx * dvdyi;
ur = ui - (T(1.0) + dx * dhdyi / hi) * dx * dudyi;
vr = vi - (T(1.0) + dx * dhdyi / hi) * dx * dvdyi;
}
else {
ur = ui - dx * dudyi;
vr = vi - dx * dvdyi;
}
if (hn > eps) {
ul = uli + (1. - dx * dhdyil / hn) * dx * dudyil;
vl = vli + (1. - dx * dhdyil / hn) * dx * dvdyil;
ul = uli + (T(1.0) - dx * dhdyil / hn) * dx * dudyil;
vl = vli + (T(1.0) - dx * dhdyil / hn) * dx * dvdyil;
}
else {
ul = uli + dx * dudyil;
Expand All @@ -712,7 +712,7 @@ template <class T> __host__ void UpdateButtingerYCPU(Param XParam, BlockP<T> XBl
}


fv = (fh > 0. ? ul : ur) * fh;
fv = (fh > T(0.0) ? ul : ur) * fh;


// Topographic source term
Expand Down Expand Up @@ -812,7 +812,7 @@ template <class T> __host__ __device__ T hllc(T g, T delta, T epsi, T CFL, T cm,
double a = max(fabs(SL), fabs(SR));
if (a > epsi) {
dlt = delta * cm / fm;
dt = CFL * dlt / a;
dt = CFL * dlt / T(a);

}
else
Expand Down
6 changes: 3 additions & 3 deletions src/Spherical.cu
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ __host__ __device__ T haversin(T Radius, T lon1, T lat1, T lon2, T lat2)
phi1 = lat1 * T(pi / 180.0);
phi2 = lat2 * T(pi / 180.0);

T sindphid2 = sin(dphi / 2.0);
T sindlbdad2 = sin(dlbda / 2.0);
T sindphid2 = sin(dphi / T(2.0));
T sindlbdad2 = sin(dlbda / T(2.0));

a = sindphid2 * sindphid2 + cos(phi1) * cos(phi2) * sindlbdad2 * sindlbdad2;

c = 2.0 * atan2(sqrt(a), sqrt(1.0 - a));
c = T(2.0) * atan2(sqrt(a), sqrt(T(1.0) - a));

return Radius * c;

Expand Down
2 changes: 1 addition & 1 deletion src/Updateforcing.cu
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ template <class T> void deformstep(Param XParam, Loop<T> XLoop, std::vector<defo
T dtdef = min(XLoop.dt, XLoop.totaltime - deform[nd].startime);
if (XLoop.totaltime > deform[nd].startime + deform[nd].duration)
{
dtdef = min(XLoop.dt, XLoop.totaltime - (deform[nd].startime + deform[nd].duration));
dtdef = (T)min(XLoop.dt, XLoop.totaltime - (deform[nd].startime + deform[nd].duration));
}


Expand Down
2 changes: 1 addition & 1 deletion src/Util_CPU.cu
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ __host__ __device__ T calcres(Param XParam, T dx, int level)

if (XParam.spherical)
{
ddx = ddx * XParam.Radius * pi / T(180.0);
ddx = ddx * T(XParam.Radius * pi / 180.0);
}

return ddx;
Expand Down

0 comments on commit 716826e

Please sign in to comment.