Skip to content

Commit

Permalink
Reduce warnings step 1
Browse files Browse the repository at this point in the history
  • Loading branch information
CyprienBosserelle committed Oct 9, 2023
1 parent e78dd3f commit 9510c34
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/Advection.cu
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ template <class T>__host__ void updateEVCPU(Param XParam, BlockP<T> XBlock, Evol
lev = XBlock.level[ib];
delta = calcres(T(XParam.delta), lev);

ybo = XParam.yo + XBlock.yo[ib];
ybo = (T)XParam.yo + XBlock.yo[ib];

for (int iy = 0; iy < XParam.blkwidth; iy++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Boundary.cu
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ template <class T> __host__ void bndCPU(Param XParam, bndparam side, BlockP<T> X
{
atmpi = interp2BUQ(XParam.xo + xx, XParam.yo + yy, Atmp);
}
zsatm = -(atmpi - XParam.Paref) * XParam.Pa2m;
zsatm = -(atmpi - (T)XParam.Paref) * (T)XParam.Pa2m;
}


Expand Down
2 changes: 1 addition & 1 deletion src/Halo.cu
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ template <class T> void Recalculatehh(Param XParam, BlockP<T> XBlock, EvolvingP<
{
n = memloc(XParam.halowidth, XParam.blkmemwidth, i, j, ib);

Xev.h[n] = max(Xev.zs[n]- zb[n],0.0) ;
Xev.h[n] = max(Xev.zs[n]- zb[n],(T)0.0) ;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/InitEvolv.cu
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void warmstart(Param XParam,Forcing<float> XForcing, BlockP<T> XBlock, T* zb, Ev
{
atmpi = interp2BUQ(xi, yi, XForcing.Atmp);
}
zsbnd = zsbnd - (atmpi- XParam.Paref) * XParam.Pa2m;
zsbnd = zsbnd - (atmpi- (T)XParam.Paref) * (T)XParam.Pa2m;
}

XEv.zs[n] = utils::max(zsbnd, zb[n]);
Expand Down
8 changes: 4 additions & 4 deletions src/InitialConditions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ template <class T> void FindTSoutNodes(Param& XParam, BlockP<T> XBlock, Bndblock
ib = XBlock.active[blk];
levdx = T(calcres(XParam.dx,XBlock.level[ib]));

x = XParam.TSnodesout[o].x;
y = XParam.TSnodesout[o].y;
x = (T)XParam.TSnodesout[o].x;
y = (T)XParam.TSnodesout[o].y;

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

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

blkxmax = (blkxmin + dxblk);
blkymax = (blkymin + dxblk);
Expand Down
22 changes: 11 additions & 11 deletions src/Mesh.cu
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ template <class T> void InitBlockxoyo(Param XParam, Forcing<float> XForcing, Blo
if ((nmask < (XParam.blkwidth * XParam.blkwidth)) && insidepoly)
{
//
XBlock.xo[blkid] = nblkx * ((T)XParam.blkwidth) * levdx + T(0.5) * levdx;
XBlock.yo[blkid] = nblky * ((T)XParam.blkwidth) * levdx + T(0.5) * levdx;
XBlock.xo[blkid] = nblkx * ((T)XParam.blkwidth) * (T)levdx + T(0.5) * (T)levdx;
XBlock.yo[blkid] = nblky * ((T)XParam.blkwidth) * (T)levdx + T(0.5) * (T)levdx;
XBlock.active[blkid] = blkid;
//printf("blkxo=%f\tblkyo=%f\n", blockxo_d[blkid], blockyo_d[blkid]);
blkid++;
Expand All @@ -307,25 +307,25 @@ template <class T> void InitBlockneighbours(Param &XParam,Forcing<float> &XForci
//====================================
// First setp up neighbours

T levdx = calcres(XParam.dx, XParam.initlevel);
double levdx = calcres(XParam.dx, XParam.initlevel);
for (int ibl = 0; ibl < XParam.nblk; ibl++)
{

int bl = XBlock.active[ibl];
//T espdist = std::numeric_limits<T>::epsilon() * (T)100.0; // i.e. distances are calculated within 100x theoretical machine precision
// This too theoretical error definition has been modified to allow more flexibility
T espdist = levdx/3;
T espdist = (T)levdx/3;


leftxo = XBlock.xo[bl] - ((T)XParam.blkwidth) * levdx;
leftxo = XBlock.xo[bl] - ((T)XParam.blkwidth) * (T)levdx;

leftyo = XBlock.yo[bl];
rightxo = XBlock.xo[bl] + ((T)XParam.blkwidth) * levdx;
rightxo = XBlock.xo[bl] + ((T)XParam.blkwidth) * (T)levdx;
rightyo = XBlock.yo[bl];
topxo = XBlock.xo[bl];
topyo = XBlock.yo[bl] + ((T)XParam.blkwidth) * levdx;
topyo = XBlock.yo[bl] + ((T)XParam.blkwidth) * (T)levdx;
botxo = XBlock.xo[bl];
botyo = XBlock.yo[bl] - ((T)XParam.blkwidth) * levdx;
botyo = XBlock.yo[bl] - ((T)XParam.blkwidth) * (T)levdx;

// by default neighbour block refer to itself. i.e. if the neighbour block is itself then there are no neighbour
XBlock.LeftBot[bl] = bl;
Expand Down Expand Up @@ -382,12 +382,12 @@ template <class T> int CalcMaskblk(Param XParam, BlockP<T> XBlock)
int nmask = 0;
bool neighbourmask = false;
T leftxo, rightxo, topyo, botyo;
T initlevdx = calcres(XParam.dx, XParam.initlevel);
T initlevdx = calcres((T)XParam.dx, XParam.initlevel);

for (int ibl = 0; ibl < XParam.nblk; ibl++)
{
int ib = XBlock.active[ibl];
T levdx = calcres(XParam.dx, XBlock.level[ib]);
T levdx = calcres((T)XParam.dx, XBlock.level[ib]);

leftxo = XBlock.xo[ib]; // in adaptive this shoulbe be a range

Expand Down Expand Up @@ -449,7 +449,7 @@ template <class T> void FindMaskblk(Param XParam, BlockP<T> &XBlock)
for (int ibl = 0; ibl < XParam.nblk; ibl++)
{
int ib = XBlock.active[ibl];
T levdx = calcres(XParam.dx, XBlock.level[ib]);
T levdx = calcres((T)XParam.dx, XBlock.level[ib]);

leftxo = XBlock.xo[ib]; // in adaptive this shoulbe be a range

Expand Down
2 changes: 1 addition & 1 deletion src/ReadInput.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ void checkparamsanity(Param& XParam, Forcing<float>& XForcing)
log("\t" + std::to_string(XParam.xo) + "/" + std::to_string(XParam.xmax) + "/" + std::to_string(XParam.yo) + "/" + std::to_string(XParam.ymax));
log("\t Initial resolution (level " + std::to_string(XParam.initlevel) + ") = " + std::to_string(levdx));

if (XParam.spherical < 1)
if (XParam.spherical == false)
{
XParam.delta = XParam.dx;
XParam.grdalpha = XParam.grdalpha * pi / 180.0; // grid rotation
Expand Down
10 changes: 5 additions & 5 deletions src/Testing.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ template <class T> bool RiverOnBoundary(Param XParam,T slope, int Dir, int Bound

MainLoop(XParam, XForcing, XModel, XModel_g);

T TheoryInput = Q * XParam.endtime;
T TheoryInput = Q * (T)XParam.endtime;


T SimulatedVolume = T(0.0);
Expand Down Expand Up @@ -3339,8 +3339,8 @@ template <class T> bool ZoneOutputTest(int nzones, T zsinit)
{
for (int i = 0; i < XForcing.Bathy[0].nx; i++)
{
x = XForcing.Bathy[0].xo + i * XForcing.Bathy[0].dx;
y = XForcing.Bathy[0].yo + j * XForcing.Bathy[0].dx;
x = float(XForcing.Bathy[0].xo + i * XForcing.Bathy[0].dx);
y = float(XForcing.Bathy[0].yo + j * XForcing.Bathy[0].dx);
r = sqrt(x * x + y * y);
if (r < rs)
{
Expand Down Expand Up @@ -3374,8 +3374,8 @@ template <class T> bool ZoneOutputTest(int nzones, T zsinit)
{
for (int i = 0; i < XForcing.targetadapt[0].nx; i++)
{
x = XForcing.targetadapt[0].xo + i * XForcing.targetadapt[0].dx;
y = XForcing.targetadapt[0].yo + j * XForcing.targetadapt[0].dx;
x = float(XForcing.targetadapt[0].xo + i * XForcing.targetadapt[0].dx);
y = float(XForcing.targetadapt[0].yo + j * XForcing.targetadapt[0].dx);
if (x < 0.0)
{
XForcing.targetadapt[0].val[i + j * XForcing.targetadapt[0].nx] = -1;
Expand Down
Loading

0 comments on commit 9510c34

Please sign in to comment.