本文整理汇总了C++中Get_yTo函数的典型用法代码示例。如果您正苦于以下问题:C++ Get_yTo函数的具体用法?C++ Get_yTo怎么用?C++ Get_yTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get_yTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pow
//---------------------------------------------------------
void CFlow_by_Slope::Set_Area(int x, int y)
{
double Decay;
if( Get_Decay(x, y, Decay) )
{
int i, ix, iy;
double z, dzSum, dz[8];
for(i=0, dzSum=0.0, z=m_pDEM->asDouble(x, y); i<8; i++)
{
if( m_pDEM->is_InGrid(ix = Get_xTo(i, x), iy = Get_yTo(i, y)) && (dz[i] = z - m_pDEM->asDouble(ix, iy)) > 0.0 )
{
dzSum += (dz[i] = pow(dz[i] / Get_Length(i), 1.1));
}
else
{
dz[i] = 0.0;
}
}
if( dzSum > 0.0 )
{
Decay *= m_pFlow->asDouble(x, y) / dzSum;
for(i=0; i<8; i++)
{
if( dz[i] > 0.0 )
{
m_pFlow->Add_Value(Get_xTo(i, x), Get_yTo(i, y), Decay * dz[i]);
}
}
}
}
}
示例2: Get_Gradient
//---------------------------------------------------------
void CFlow_Parallel::BRM_GetOrtho(int Dir, int x, int y, int ix[3], int iy[3], double nnei[6], int nexp[6])
{
int jx, jy, i,
i0 = (Dir + 2) % 8,
i4 = (Dir + 6) % 8;
double Slope, Aspect;
for(i=0; i<3; i++)
{
jx = ix[i];
jy = iy[i];
Get_Gradient(jx, jy, Slope, Aspect);
nnei[i] = M_RAD_TO_DEG * Slope;
nexp[i] = (int)(M_RAD_TO_DEG * Aspect);
}
jx = Get_xTo(i0,x);
jy = Get_yTo(i0,y);
Get_Gradient(jx, jy, Slope, Aspect);
nnei[3] = M_RAD_TO_DEG * Slope;
nexp[3] = (int)(M_RAD_TO_DEG * Aspect);
jx = Get_xTo(i4,x);
jy = Get_yTo(i4,y);
Get_Gradient(jx, jy, Slope, Aspect);
nnei[5] = M_RAD_TO_DEG * Slope;
nexp[5] = (int)(M_RAD_TO_DEG * Aspect);
Get_Gradient(x, y, Slope, Aspect);
nnei[4] = M_RAD_TO_DEG * Slope;
nexp[4] = (int)(M_RAD_TO_DEG * Aspect); //[jy][jx]) ????!!!!...;
for(i=0; i<6; i++)
if(nexp[i]<0)
nexp[i] = nexp[4];
for(i=0; i<6; i++)
{
nexp[i] += BRM_idreh[Dir];
if(nexp[i]>360)
nexp[i] -= 360;
}
}
示例3: Get_xTo
//---------------------------------------------------------
void CFlow_Parallel::Set_MFD(int x, int y)
{
int i, ix, iy;
double z, d, dzSum, dz[8];
//-----------------------------------------------------
for(i=0, dzSum=0.0, z=m_pDTM->asDouble(x, y); i<8; i++)
{
ix = Get_xTo(i, x);
iy = Get_yTo(i, y);
if( m_pDTM->is_InGrid(ix, iy) )
{
d = z - m_pDTM->asDouble(ix, iy);
}
else
{
ix = Get_xTo(i + 4, x);
iy = Get_yTo(i + 4, y);
if( m_pDTM->is_InGrid(ix, iy) )
{
d = m_pDTM->asDouble(ix, iy) - z;
}
else
{
d = 0.0;
}
}
if( d > 0.0 )
{
dzSum += (dz[i] = pow(d / Get_Length(i), m_Converge));
}
else
{
dz[i] = 0.0;
}
}
//-----------------------------------------------------
if( dzSum > 0.0 )
{
for(i=0; i<8; i++)
{
if( dz[i] > 0.0 )
{
Add_Fraction(x, y, i, dz[i] / dzSum);
}
}
}
}
示例4: pow
//---------------------------------------------------------
void CChannelNetwork_Distance::Initialize_MFD(int x, int y)
{
const double MFD_Convergence = 1.1;
double Flow[8], dz, zSum = 0.0, z = m_pDEM->asDouble(x, y);
if( m_pRoute )
{
for(int i=0, ix, iy; i<8; i++)
{
if( m_pDEM->is_InGrid(ix=Get_xTo(i, x), iy=Get_yTo(i, y)) && !m_pRoute->is_NoData(ix, iy) && (dz = z - m_pDEM->asDouble(ix, iy)) > 0.0 )
{
zSum += (Flow[i] = pow(dz / Get_Length(i), MFD_Convergence));
}
else
{
Flow[i] = 0.0;
}
}
}
if( zSum == 0.0 )
{
for(int i=0, ix, iy; i<8; i++)
{
if( m_pDEM->is_InGrid(ix=Get_xTo(i, x), iy=Get_yTo(i, y)) && (dz = z - m_pDEM->asDouble(ix, iy)) > 0.0 )
{
zSum += (Flow[i] = pow(dz / Get_Length(i), MFD_Convergence));
}
else
{
Flow[i] = 0.0;
}
}
}
if( zSum > 0.0 )
{
m_Flow[8].Set_Value(x, y, zSum);
for(int i=0; i<8; i++)
{
if( Flow[i] > 0.0 )
{
m_Flow[i].Set_Value(x, y, Flow[i] / zSum);
}
}
}
}
示例5: Get_xTo
//---------------------------------------------------------
void CChannelNetwork::Set_Route_Standard(int x, int y)
{
int i, ix, iy, iMin;
double z, dz, dzMin;
z = pDTM->asDouble(x,y);
iMin = 0;
for(i=1; i<=8; i++)
{
ix = Get_xTo(i,x);
iy = Get_yTo(i,y);
if( !pDTM->is_InGrid(ix,iy) )
{
iMin = i;
break;
}
else
{
dz = (z - pDTM->asDouble(ix,iy)) / Get_Length(i);
if( iMin <= 0 || dzMin < dz )
{
iMin = i;
dzMin = dz;
}
}
}
pChannels->Set_Value(x,y, iMin );
}
示例6: Get_xTo
//---------------------------------------------------------
void CPit_Eliminator::Dig_Channel(int x, int y)
{
bool bContinue;
int goDir;
double z;
z = pDTM->asDouble(x, y);
bContinue = true;
do
{
z -= M_ALMOST_ZERO;
goDir = goRoute->asChar(x, y);
if( goDir < 0 )
{
bContinue = false;
}
else
{
x = Get_xTo(goDir, x);
y = Get_yTo(goDir, y);
if( !is_InGrid(x, y) || z > pDTM->asDouble(x, y) )
{
bContinue = false;
}
else
{
pDTM->Set_Value(x, y, z);
}
}
}
while( bContinue );
}
示例7: Parameters
//---------------------------------------------------------
void CHillslope_Evolution_FTCS::Set_Diffusion(double dFactor)
{
int iStep = Parameters("NEIGHBOURS")->asInt() == 1 ? 1 : 2;
m_pDEM_Old->Assign(m_pDEM);
#pragma omp parallel for
for(int y=0; y<Get_NY(); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( !m_pDEM_Old->is_NoData(x, y) )
{
double z = m_pDEM_Old->asDouble(x, y);
double dz = 0.0;
for(int i=0; i<8; i+=iStep)
{
int ix = Get_xTo(i, x);
int iy = Get_yTo(i, y);
if( m_pDEM_Old->is_InGrid(ix, iy) )
{
dz += (m_pDEM_Old->asDouble(ix, iy) - z) / Get_UnitLength(i);
}
}
m_pDEM->Add_Value(x, y, dFactor * dz);
}
}
}
}
示例8: Lock_Set
//---------------------------------------------------------
void CFlow_RecursiveUp::Get_Flow(int x, int y)
{
int i, ix, iy, j;
double jFlow;
if( !is_Locked(x,y) )
{
Lock_Set(x,y);
Init_Cell(x,y);
for(i=0, j=4; i<8; i++, j=(j+1)%8)
{
ix = Get_xTo(i,x);
iy = Get_yTo(i,y);
if( is_InGrid(ix,iy) )
{
jFlow = Flow[iy][ix][j];
if( jFlow > 0 )
{
Get_Flow(ix,iy);
Add_Fraction(ix,iy,j,jFlow);
}
}
}
}
}
示例9: return
//---------------------------------------------------------
bool CChannelNetwork_Distance::Set_D8(int x, int y)
{
int Direction;
if( !Get_D8(x, y, Direction) )
{
return( false );
}
int ix = Get_xTo(Direction, x), iy = Get_yTo(Direction, y);
double dz = m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy);
double dx = Get_Length(Direction);
m_pDistance->Set_Value(x, y, m_pDistance->asDouble(ix, iy) + sqrt(dz*dz + dx*dx));
m_pDistVert->Set_Value(x, y, m_pDistVert->asDouble(ix, iy) + dz);
m_pDistHorz->Set_Value(x, y, m_pDistHorz->asDouble(ix, iy) + dx);
if( m_pTime )
{
double dt = Get_Travel_Time(x, y, Direction);
m_pTime->Set_Value(x, y, m_pTime->asDouble(ix, iy) + dt);
}
if( m_pFields )
{
int Crossed = m_pFields->asDouble(ix, iy) == m_pFields->asDouble(x, y) ? 0 : 1;
m_pPasses->Set_Value(x, y, m_pPasses->asInt(ix, iy) + Crossed);
}
return( true );
}
示例10: Get_xTo
//---------------------------------------------------------
inline double CChannelNetwork_Distance::Get_Travel_Time(int x, int y, int Direction)
{
int ix = Get_xTo(Direction, x), iy = Get_yTo(Direction, y);
double v, k, R, dz, dx;
dz = m_pDEM->is_InGrid(ix, iy) ? m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy) : 0.1;
dx = Get_Length(Direction);
// k = m_pFlow_K && !m_pFlow_K->is_NoData(x, y) ? m_pFlow_K->asDouble(x, y) : m_Flow_K;
k = !m_pFlow_K || (m_pFlow_K->is_NoData(x, y) && m_pFlow_K->is_NoData(ix, iy)) ? m_Flow_K
: m_pFlow_K->is_NoData( x, y) ? m_pFlow_K->asDouble(ix, iy)
: m_pFlow_K->is_NoData(ix, iy) ? m_pFlow_K->asDouble( x, y)
: (m_pFlow_K->asDouble(x, y) + m_pFlow_K->asDouble(ix, iy)) / 2.0;
// R = m_pFlow_R && !m_pFlow_R->is_NoData(x, y) ? m_pFlow_R->asDouble(x, y) : m_Flow_R;
R = !m_pFlow_R || (m_pFlow_R->is_NoData(x, y) && m_pFlow_R->is_NoData(ix, iy)) ? m_Flow_R
: m_pFlow_R->is_NoData( x, y) ? m_pFlow_R->asDouble(ix, iy)
: m_pFlow_R->is_NoData(ix, iy) ? m_pFlow_R->asDouble( x, y)
: (m_pFlow_R->asDouble(x, y) + m_pFlow_R->asDouble(ix, iy)) / 2.0;
v = k * pow(R, 2.0 / 3.0) * sqrt(dz / dx); // [m / s], simplified Manning equation
return( dx / (v * 3600.0) ); // return travel time in hours
}
示例11: Get_xTo
//---------------------------------------------------------
void CChannelNetwork_Distance::Initialize_D8(int x, int y)
{
int i, iMax, iRoute;
double z, dz, dzMax, dzRoute;
for(i=0, iMax=-1, dzMax=0.0, iRoute=-1, dzRoute=0.0, z=m_pDEM->asDouble(x, y); i<8; i++)
{
int ix = Get_xTo(i, x);
int iy = Get_yTo(i, y);
if( is_InGrid(ix, iy) && (dz = (z - m_pDEM->asDouble(ix, iy)) / Get_Length(i)) > 0.0 )
{
if( dz > dzMax )
{
iMax = i;
dzMax = dz;
}
if( m_pRoute && !m_pRoute->is_NoData(ix, iy) && dz > dzRoute )
{
iRoute = i;
dzRoute = dz;
}
}
}
m_Dir.Set_Value(x, y, iRoute >= 0 ? iRoute : iMax);
}
示例12: Get_Cellsize
//---------------------------------------------------------
double CExercise_14::Vectorise(int x, int y, CSG_Shape *pSegment)
{
int Dir, ix, iy;
double Length;
Length = 0.0;
pSegment->Add_Point(Get_XMin() + x * Get_Cellsize(), Get_YMin() + y * Get_Cellsize());
if( (Dir = m_pDir->asInt(x, y)) >= 0 )
{
Length = Get_Length(Dir);
ix = Get_xTo(Dir, x);
iy = Get_yTo(Dir, y);
switch( m_pChnl->asInt(ix, iy) )
{
case CHANNEL:
Length += Vectorise(ix, iy, pSegment); // recursive function call...
break;
case MOUTH:
Length += Get_Length(Dir);
pSegment->Add_Point(Get_XMin() + ix * Get_Cellsize(), Get_YMin() + iy * Get_Cellsize());
break;
}
}
return( Length );
}
示例13: Get_xTo
//---------------------------------------------------------
void CFlow_RecursiveUp::Set_MFD(int x, int y)
{
int i, ix, iy;
double z, d, *dz, dzSum;
z = pDTM->asDouble(x,y);
dz = Flow[y][x];
dzSum = 0;
for(i=0; i<8; i++)
{
ix = Get_xTo(i,x);
iy = Get_yTo(i,y);
if( is_InGrid(ix,iy) )
{
d = z - pDTM->asDouble(ix,iy);
if( d > 0 )
dzSum += dz[i] = pow(d / Get_Length(i), MFD_Converge);
}
}
if( dzSum )
{
for(i=0; i<8; i++)
if( dz[i] > 0 )
dz[i] /= dzSum;
}
}
示例14: DataObject_Add
//---------------------------------------------------------
bool CKinWav_D8::Gauges_Initialise(void)
{
if( m_pGauges_Flow != NULL )
{
if( m_pGauges == NULL )
{
DataObject_Add(m_pGauges = SG_Create_Shapes(SHAPE_TYPE_Point, _TL("Gauges")));
Parameters("GAUGES")->Set_Value(m_pGauges);
m_pGauges->Add_Field(_TL("ID"), SG_DATATYPE_Int);
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
bool bBorder = false;
bool bLowest = true;
for(int i=0; i<8; i++)
{
int ix = Get_xTo(i, x);
int iy = Get_yTo(i, y);
if( !m_pDEM->is_InGrid(ix, iy) )
{
bBorder = true;
}
else if( m_pDEM->asDouble(ix, iy) < m_pDEM->asDouble(x, y) )
{
bLowest = false;
}
}
if( bLowest && bBorder )
{
CSG_Shape *pGauge = m_pGauges->Add_Shape();
pGauge->Add_Point(Get_System()->Get_Grid_to_World(x, y));
pGauge->Set_Value(0, m_pGauges->Get_Count() + 1);
}
}
}
}
m_pGauges_Flow->Destroy();
m_pGauges_Flow->Set_Name(_TL("Outlet Hydrographs"));
m_pGauges_Flow->Add_Field("TIME", SG_DATATYPE_Double);
for(int i=0; i<m_pGauges->Get_Count(); i++)
{
m_pGauges_Flow->Add_Field(CSG_String::Format(SG_T("GAUGE_%02d"), i + 1), SG_DATATYPE_Double);
}
return( true );
}
return( false );
}
示例15: Get_xTo
//---------------------------------------------------------
void CFlow_Distance::Set_Length_MFD(int x, int y)
{
int i, ix, iy;
double z, d, dzSum, dz[8];
if( m_pDTM->is_InGrid(x, y) )
{
z = m_pDTM->asDouble(x, y);
dzSum = 0.0;
for(i=0; i<8; i++)
{
ix = Get_xTo(i, x);
iy = Get_yTo(i, y);
if( m_pDTM->is_InGrid(ix, iy) && (d = z - m_pDTM->asDouble(ix, iy)) > 0.0 )
{
dz[i] = pow(d / Get_Length(i), m_Converge);
dzSum += dz[i];
}
else
{
dz[i] = 0.0;
}
}
if( dzSum > 0.0 )
{
d = m_pLength->asDouble(x, y);
for(i=0; i<8; i++)
{
if( dz[i] > 0.0 )
{
ix = Get_xTo(i, x);
iy = Get_yTo(i, y);
dz[i] /= dzSum;
m_pLength->Add_Value(ix, iy, dz[i] * (d + Get_Length(i)));
m_pWeight->Add_Value(ix, iy, dz[i]);
}
}
}
}
}