Skip to content

Commit

Permalink
Change DDX and DD in dinf.cpp to double to correct MacOS compiler err…
Browse files Browse the repository at this point in the history
…or reported in #197
  • Loading branch information
dtarb committed Jan 8, 2019
1 parent f927ca6 commit bf94171
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion Taudem5PCVS2015/Taudem5PC.sln
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ Global
{70C7E2B0-D60E-4EFF-B296-F18876870EC4}.Release|Win32.ActiveCfg = Release|Win32
{70C7E2B0-D60E-4EFF-B296-F18876870EC4}.Release|Win32.Build.0 = Release|Win32
{70C7E2B0-D60E-4EFF-B296-F18876870EC4}.Release|x64.ActiveCfg = Release|x64
{70C7E2B0-D60E-4EFF-B296-F18876870EC4}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 7 additions & 7 deletions src/dinf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ int setdir( char* demfile, char* angfile, char *slopefile, char *flowfile, int u
return 0;
}
void VSLOPE(float E0,float E1, float E2,
float D1,float D2,float DD,
double D1,double D2,double DD,
float *S,float *A)
{
//SUBROUTINE TO RETURN THE SLOPE AND ANGLE ASSOCIATED WITH A DEM PANEL
Expand Down Expand Up @@ -313,7 +313,7 @@ void VSLOPE(float E0,float E1, float E2,
// Sets only flowDir only where there is a positive slope
// Returns number of cells which are flat

void SET2(int I, int J,float *DXX,float DD, tdpartition *elevDEM, tdpartition *flowDir, tdpartition *slope)
void SET2(int I, int J,double *DXX,double DD, tdpartition *elevDEM, tdpartition *flowDir, tdpartition *slope)
{
double dxA = elevDEM->getdxA();
double dyA = elevDEM->getdyA();
Expand Down Expand Up @@ -368,7 +368,7 @@ void SET2(int I, int J,float *DXX,float DD, tdpartition *elevDEM, tdpartition
slope->setData(J,I,SMAX);
}
//Overloaded SET2 for use in resolve flats when slope is no longer recorded. Also uses artificial elevations and actual elevations
void SET2(int I, int J,float *DXX,float DD, tdpartition *elevDEM, tdpartition *elev2, tdpartition *flowDir, tdpartition *dn)
void SET2(int I, int J,double *DXX,double DD, tdpartition *elevDEM, tdpartition *elev2, tdpartition *flowDir, tdpartition *dn)
{
float SK[9];
float ANGLE[9];
Expand Down Expand Up @@ -568,8 +568,8 @@ long setPosDirDinf(tdpartition *elevDEM, tdpartition *flowDir, tdpartition *slop
elevDEM->getdxdyc(j,tempdxc,tempdyc);


float DXX[3] = {0,tempdxc,tempdyc};//tardemlib.cpp ln 1291
float DD = sqrt(tempdxc*tempdxc+tempdyc*tempdyc);//tardemlib.cpp ln 1293
double DXX[3] = {0,tempdxc,tempdyc};//tardemlib.cpp ln 1291
double DD = sqrt(tempdxc*tempdxc+tempdyc*tempdyc);//tardemlib.cpp ln 1293
SET2(j,i,DXX,DD, elevDEM,flowDir,slope);//i=y in function form old code j is x switched on purpose
// Use SET2 from serial code here modified to get what it has as felevg.d from elevDEM partition
// Modify to return 0 if there is a 0 slope. Modify SET2 to output flowDIR as no data (do nothing
Expand Down Expand Up @@ -799,8 +799,8 @@ long resolveflats( tdpartition *elevDEM, tdpartition *flowDir, queue<node> *que,
// direction based on the artificial elevations

elevDEM->getdxdyc(j,tempdxc,tempdyc);
float DXX[3] = {0,tempdxc,tempdyc};//tardemlib.cpp ln 1291
float DD = sqrt(tempdxc*tempdxc+tempdyc*tempdyc);//tardemlib.cpp ln 1293
double DXX[3] = {0,tempdxc,tempdyc};//tardemlib.cpp ln 1291
double DD = sqrt(tempdxc*tempdxc+tempdyc*tempdyc);//tardemlib.cpp ln 1293

SET2(j,i,DXX,DD,elevDEM,elev2,flowDir,dn); //use new elevations to calculate flowDir.
if(!flowDir->isNodata(i,j)&& flowDir->getData(i,j,tempFloat)< 0.) //this is still a flat
Expand Down

0 comments on commit bf94171

Please sign in to comment.