本文整理汇总了C++中Get_NX函数的典型用法代码示例。如果您正苦于以下问题:C++ Get_NX函数的具体用法?C++ Get_NX怎么用?C++ Get_NX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get_NX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZeroToNoData
void CSinuosity::ZeroToNoData(void){
for(int y=0; y<Get_NY() && Set_Progress(y); y++){
for(int x=0; x<Get_NX(); x++){
if (m_pSinuosity->asDouble(x,y) == 0){
m_pSinuosity->Set_Value(x,y,m_pSinuosity->Get_NoData_Value());
}//if
}// for
}// for
}//method
示例2: switch
//---------------------------------------------------------
CSG_Grid & CSG_Grid::_Operation_Arithmetic(double Value, TSG_Grid_Operation Operation)
{
//-----------------------------------------------------
switch( Operation )
{
case GRID_OPERATION_Addition:
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Addition"));
break;
case GRID_OPERATION_Subtraction:
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Subtraction"));
Value = -Value;
break;
case GRID_OPERATION_Multiplication:
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Multiplication"));
break;
case GRID_OPERATION_Division:
if( Value == 0.0 )
return( *this );
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Division"));
Value = 1.0 / Value;
break;
}
//-----------------------------------------------------
for(int y=0; y<Get_NY() && SG_UI_Process_Set_Progress(y, Get_NY()); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( !is_NoData(x, y) )
{
switch( Operation )
{
case GRID_OPERATION_Addition:
case GRID_OPERATION_Subtraction:
Add_Value(x, y, Value);
break;
case GRID_OPERATION_Multiplication:
case GRID_OPERATION_Division:
Mul_Value(x, y, Value);
break;
}
}
}
}
SG_UI_Process_Set_Ready();
return( *this );
}
示例3: Tension_Change
//---------------------------------------------------------
double CGrid_Gaps::Tension_Step(int iStep)
{
int x, y;
double d, dMax;
dMax = 0.0;
for(y=0; y<Get_NY(); y+=iStep)
{
for(x=0; x<Get_NX(); x+=iStep)
{
if( pTension_Keep->asByte(x, y) == false )
{
d = Tension_Change(x, y, iStep);
pTension_Temp->Set_Value(x, y, d);
d = fabs(d - pResult->asDouble(x, y));
if( d > dMax )
{
dMax = d;
}
}
}
}
for(y=0; y<Get_NY(); y+=iStep)
{
for(x=0; x<Get_NX(); x+=iStep)
{
if( pTension_Keep->asByte(x, y) == false )
{
pResult->Set_Value(x, y, pTension_Temp->asDouble(x, y));
}
}
}
return( dMax );
}
示例4: Get_Allocation
//---------------------------------------------------------
bool CCost_Accumulated::Get_Allocation(void)
{
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
Get_Allocation(x, y);
}
}
return( true );
}
示例5: Get_NX
//---------------------------------------------------------
void CGrid_3D_Image::_Set_Grid(void)
{
T3DPoint *a, *b, *c, *d, p[3];
//-----------------------------------------------------
a = (T3DPoint *)SG_Malloc(sizeof(T3DPoint) * Get_NX());
b = (T3DPoint *)SG_Malloc(sizeof(T3DPoint) * Get_NX());
c = (T3DPoint *)SG_Malloc(sizeof(T3DPoint) * (Get_NX() - 1));
//-----------------------------------------------------
_Get_Line(0, b);
for(int y=1; y<Get_NY() && Set_Progress(y); y++)
{
d = a;
a = b;
b = d;
_Get_Line(y, b);
_Get_Line(a, b, c);
for(int ax=0, bx=1; bx<Get_NX(); ax++, bx++)
{
DRAW_TRIANGLE(a[ax], a[bx], c[ax]);
DRAW_TRIANGLE(b[ax], b[bx], c[ax]);
DRAW_TRIANGLE(a[ax], b[ax], c[ax]);
DRAW_TRIANGLE(a[bx], b[bx], c[ax]);
}
}
//-----------------------------------------------------
SG_Free(a);
SG_Free(b);
SG_Free(c);
//-----------------------------------------------------
DataObject_Add(m_pRGB_Z);
DataObject_Add(m_pRGB);
DataObject_Set_Colors(m_pRGB, 100, SG_COLORS_BLACK_WHITE);
}
示例6: DataObject_Set_Colors
//---------------------------------------------------------
bool CKinWav_D8::Initialize(double Roughness)
{
m_Flow_Last .Create(*Get_System(), SG_DATATYPE_Float);
m_Alpha .Create(*Get_System(), SG_DATATYPE_Float);
m_Direction .Create(*Get_System(), SG_DATATYPE_Char);
m_Direction .Set_NoData_Value(-1);
m_pFlow->Assign(0.0);
DataObject_Set_Colors(m_pFlow, 100, SG_COLORS_WHITE_BLUE);
DataObject_Update(m_pFlow, 0.0, 100.0, SG_UI_DATAOBJECT_SHOW);
//-----------------------------------------------------
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( !m_pDEM->is_NoData(x, y) )
{
int i, ix, iy, iMax;
double z, d, dMax;
for(i=0, iMax=-1, dMax=0.0, z=m_pDEM->asDouble(x, y); i<8; i++)
{
ix = Get_xTo(i, x);
iy = Get_yTo(i, y);
if( is_InGrid(ix, iy) && (d = (z - m_pDEM->asDouble(ix, iy)) / Get_Length(i)) > dMax )
{
dMax = d;
iMax = i;
}
}
if( iMax < 0 )
{
m_Direction .Set_NoData(x, y);
}
else
{
m_Direction .Set_Value(x, y, iMax);
m_Alpha .Set_Value(x, y, pow(Roughness / sqrt(dMax), Beta_0));
if( m_Alpha.asDouble(x, y) > 10 )
m_Alpha.Set_Value(x, y, 10);
}
}
}
}
return( true );
}
示例7: Calculate
//---------------------------------------------------------
bool CFlow_Parallel::Calculate(void)
{
for(int y=0; y<Get_NY() && Set_Progress(y); y+=m_Step)
{
#pragma omp parallel for
for(int x=0; x<Get_NX(); x+=m_Step)
{
Init_Cell(x, y);
}
}
return( Set_Flow() );
}
示例8: Parameters
//---------------------------------------------------------
bool CLand_Surface_Temperature::On_Execute(void)
{
double Z_reference, T_reference, T_gradient, C_Factor, LAI_max, Z, SWR, LAI, LST;
CSG_Grid *pDEM, *pSWR, *pLAI, *pLST;
//-----------------------------------------------------
pDEM = Parameters("DEM") ->asGrid();
pSWR = Parameters("SWR") ->asGrid();
pLAI = Parameters("LAI") ->asGrid();
pLST = Parameters("LST") ->asGrid();
Z_reference = Parameters("Z_REFERENCE") ->asDouble();
T_reference = Parameters("T_REFERENCE") ->asDouble();
T_gradient = Parameters("T_GRADIENT") ->asDouble();
C_Factor = Parameters("C_FACTOR") ->asDouble();
LAI_max = pLAI->Get_ZMax();
//-----------------------------------------------------
if( LAI_max > 0.0 )
{
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( pDEM->is_NoData(x, y) || pSWR->is_NoData(x, y) || pLAI->is_NoData(x, y) || (SWR = pSWR->asDouble(x, y)) <= 0.0 )
{
pLST->Set_NoData(x, y);
}
else
{
Z = pDEM->asDouble(x, y);
SWR = pSWR->asDouble(x, y);
LAI = pLAI->asDouble(x, y);
LST = T_reference
- (T_gradient * (Z - Z_reference)) / 1000.0
+ C_Factor * (SWR - 1.0 / SWR) * (1.0 - LAI / LAI_max);
pLST->Set_Value(x, y, LST);
}
}
}
return( true );
}
//-----------------------------------------------------
return( false );
}
示例9: Fill_Sinks
//---------------------------------------------------------
bool CPit_Eliminator::Fill_Sinks(void)
{
int x, y;
for(y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(x=0; x<Get_NX(); x++)
{
Fill_Check(x, y);
}
}
return( is_Progress() );
}
示例10: CSG_Table
//---------------------------------------------------------
CvMat* COpenCV_NNet::GetEvalMatrix(CSG_Parameter_Grid_List *gl_grids, int type)
{
bool b_NoData;
int x,y,i_Grid;
CSG_Table *t_data;
CSG_Table_Record *tr_rec;
TSG_Point p;
CvMat *mat;
// We will use this table as a temporary data store,
// since we cannot dynamically resize the CvMat
t_data = new CSG_Table();
// We need a column for each grid and the output lable
for (int i = 0; i < gl_grids->Get_Count(); i++)
{
t_data->Add_Field(CSG_String::Format(SG_T("GRID_%d"), i), SG_DATATYPE_Float, i);
}
// Traverse all grids, every point
for(y=0, p.y=Get_YMin(); y<Get_NY() && Set_Progress(y); y++, p.y+=Get_Cellsize())
{
for(x=0, p.x=Get_XMin(); x<Get_NX(); x++, p.x+=Get_Cellsize())
{
for(i_Grid=0, b_NoData=false; i_Grid<gl_grids->Get_Count() && !b_NoData; i_Grid++)
{
// If there is one grid that has no data in this point p, then set the no data flag
if( gl_grids->asGrid(i_Grid)->is_NoData(x, y) )
{
b_NoData = true;
}
}
if (!b_NoData)
{
// We have data in all grids, so lets add them to the eval data table
tr_rec = t_data->Add_Record();
for(i_Grid=0; i_Grid<gl_grids->Get_Count(); i_Grid++)
{
tr_rec->Set_Value(i_Grid, (float) gl_grids->asGrid(i_Grid)->asFloat(x, y));
}
}
}
}
// Now create the matrix and add all data from the table to the matrix
mat = GetEvalMatrix(t_data, type);
return mat;
}
示例11: while
//---------------------------------------------------------
bool CExercise_03::Method_02(void)
{
int x, y, ix;
double a, b, c;
//-----------------------------------------------------
for(y=0; y<Get_NY() && Set_Progress(y); y++)
{
x = 0; // initialize x...
while( x < Get_NX() - 1 ) // condition for x...
{
ix = x + 1;
if( m_pInput->is_NoData(x, y) || m_pInput->is_NoData(ix, y) ) // don't work with 'no data'...
{
m_pOutput->Set_NoData(x, y);
}
else
{
a = m_pInput->asDouble( x, y);
b = m_pInput->asDouble(ix, y);
c = a - b;
m_pOutput->Set_Value(x, y, c);
}
x++; // increment x...
}
m_pOutput->Set_NoData(Get_NX() - 1, y); // what shall we do with the last cell in a row ??!!
}
//-----------------------------------------------------
return( true );
}
示例12: Get_Shade
//---------------------------------------------------------
bool CSADO_SolarRadiation::Set_Insolation(double Decline, double Azimuth)
{
int x, y;
double a, e, Direct, Diffus;
Get_Shade(Decline, Azimuth);
e = Get_Vapour_Exponent (m_VP);
a = Get_Vapour_A (m_VP);
for(y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(x=0; x<Get_NX(); x++)
{
if( m_pDEM->is_NoData(x, y) )
{
if( m_pSumDirect ) m_pSumDirect->Set_NoData(x, y);
if( m_pSumDiffus ) m_pSumDiffus->Set_NoData(x, y);
if( m_pSumTotal ) m_pSumTotal ->Set_NoData(x, y);
}
else
{
if( m_pVP != NULL )
{
e = Get_Vapour_Exponent (m_pVP->asDouble(x, y));
a = Get_Vapour_A (m_pVP->asDouble(x, y));
}
if( m_bBending )
{
Azimuth = m_Azimuth.asDouble(x, y);
Decline = m_Decline.asDouble(x, y);
}
if( Decline > 0.0 )
{
Direct = Get_Solar_Direct(x, y, Decline, Azimuth, e);
Diffus = Get_Solar_Diffus(x, y, Decline, a , e);
if( m_pSumDirect ) m_pSumDirect->Add_Value(x, y, Direct);
if( m_pSumDiffus ) m_pSumDiffus->Add_Value(x, y, Diffus);
if( m_pSumTotal ) m_pSumTotal ->Add_Value(x, y, Direct + Diffus);
}
}
}
}
return( true );
}
示例13: Parameters
//---------------------------------------------------------
bool CGrids_Sum::On_Execute(void)
{
//-----------------------------------------------------
CSG_Parameter_Grid_List *pGrids = Parameters("GRIDS" )->asGridList();
if( pGrids->Get_Count() < 1 )
{
Error_Set(_TL("no grid in list"));
return( false );
}
//-----------------------------------------------------
CSG_Grid *pResult = Parameters("RESULT")->asGrid();
bool bNoData = Parameters("NODATA")->asBool();
//-----------------------------------------------------
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
#pragma omp parallel for
for(int x=0; x<Get_NX(); x++)
{
int n = 0;
double d = 0.0;
for(int i=0; i<pGrids->Get_Count(); i++)
{
if( pGrids->asGrid(i)->is_InGrid(x, y) )
{
n ++;
d += pGrids->asGrid(i)->asDouble(x, y);
}
}
if( bNoData ? n > 0 : n == pGrids->Get_Count() )
{
pResult->Set_Value(x, y, d);
}
else
{
pResult->Set_NoData(x, y);
}
}
}
//-----------------------------------------------------
return( true );
}
示例14: sizeof
//---------------------------------------------------------
void CSG_Grid::Flip(void)
{
int x, yA, yB;
double *Line, d;
if( is_Valid() )
{
Line = (double *)SG_Malloc(Get_NX() * sizeof(double));
for(yA=0, yB=Get_NY()-1; yA<yB && SG_UI_Process_Set_Progress(2 * yA, Get_NY()); yA++, yB--)
{
for(x=0; x<Get_NX(); x++)
{
Line[x] = asDouble(x, yA);
}
for(x=0; x<Get_NX(); x++)
{
d = Line[x];
Line[x] = asDouble(x, yB);
Set_Value(x, yB, d);
}
for(x=0; x<Get_NX(); x++)
{
Set_Value(x, yA, Line[x]);
}
}
SG_UI_Process_Set_Ready();
SG_Free(Line);
Get_History().Add_Child(SG_T("GRID_OPERATION"), LNG("Vertically mirrored"));
}
}
示例15: Parameters
//---------------------------------------------------------
void CGrid_Gaps::Tension_Main(void)
{
int iStep, iStart, n;
double max, Threshold;
Threshold = Parameters("THRESHOLD")->asDouble();
n = Get_NX() > Get_NY() ? Get_NX() : Get_NY();
iStep = 0;
do { iStep++; } while( pow(2.0, iStep + 1) < n );
iStart = (int)pow(2.0, iStep);
pTension_Keep = new CSG_Grid(pResult, SG_DATATYPE_Byte);
pTension_Temp = new CSG_Grid(pResult);
pResult->Assign_NoData();
for(iStep=iStart; iStep>=1; iStep/=2)
{
Tension_Init(iStep);
do
{
max = Tension_Step(iStep);
Process_Set_Text(CSG_String::Format(SG_T("[%d] %s: %f"), iStep, _TL("max. change"), max));
}
while( max > Threshold && Process_Get_Okay(true) );
DataObject_Update(pResult, pInput->Get_ZMin(), pInput->Get_ZMax(), true);
}
delete(pTension_Keep);
delete(pTension_Temp);
}