本文整理汇总了C++中Get_System函数的典型用法代码示例。如果您正苦于以下问题:C++ Get_System函数的具体用法?C++ Get_System怎么用?C++ Get_System使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get_System函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Get_System
//---------------------------------------------------------
double CGrid_Gaps::Tension_Change(int x, int y, int iStep)
{
int i, ix, iy;
double n, d, dz;
for(i=0, d=0.0, n=0.0; i<8; i++)
{
ix = x + iStep * Get_System()->Get_xTo(i);
iy = y + iStep * Get_System()->Get_yTo(i);
if( pResult->is_InGrid(ix, iy) )
{
dz = 1.0 / Get_System()->Get_UnitLength(i);
d += dz * pResult->asDouble(ix, iy);
n += dz;
}
}
if( n > 0.0 )
{
d /= n;
return( d );
}
return( pResult->asDouble(x, y) );
}
示例2: Construct_Object
*/ void Init_Errors(REBVAL *errors)
/*
***********************************************************************/
{
REBSER *errs;
REBVAL *val;
// Create error objects and error type objects:
*ROOT_ERROBJ = *Get_System(SYS_STANDARD, STD_ERROR);
errs = Construct_Object(0, VAL_BLK(errors), 0);
Set_Object(Get_System(SYS_CATALOG, CAT_ERRORS), errs);
Set_Root_Series(TASK_ERR_TEMPS, Make_Block(3));
// Create objects for all error types:
for (val = BLK_SKIP(errs, 1); NOT_END(val); val++) {
errs = Construct_Object(0, VAL_BLK(val), 0);
SET_OBJECT(val, errs);
}
// Catch top level errors, to provide decent output:
PUSH_STATE(Top_State, Saved_State);
if (SET_JUMP(Top_State)) {
POP_STATE(Top_State, Saved_State);
DSP++; // Room for return value
Catch_Error(DS_TOP); // Stores error value here
Print_Value(DS_TOP, 0, FALSE);
Crash(RP_NO_CATCH);
}
SET_STATE(Top_State, Saved_State);
}
示例3: Parameters
//---------------------------------------------------------
bool CFilter_Resample::On_Execute(void)
{
double Cellsize;
CSG_Grid *pGrid, *pLoPass, *pHiPass;
//-----------------------------------------------------
pGrid = Parameters("GRID" )->asGrid();
pLoPass = Parameters("LOPASS")->asGrid();
pHiPass = Parameters("HIPASS")->asGrid();
Cellsize = Parameters("SCALE" )->asDouble() * Get_Cellsize();
//-----------------------------------------------------
if( Cellsize > 0.5 * SG_Get_Length(Get_System()->Get_XRange(), Get_System()->Get_YRange()) )
{
Error_Set(_TL("resampling cell size is too large"));
return( false );
}
//-----------------------------------------------------
CSG_Grid Grid(CSG_Grid_System(Cellsize, Get_XMin(), Get_YMin(), Get_XMax(), Get_YMax()), SG_DATATYPE_Float);
Grid.Assign(pGrid, GRID_RESAMPLING_Mean_Cells);
//-----------------------------------------------------
pLoPass->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), _TL("Low Pass")));
pHiPass->Set_Name(CSG_String::Format(SG_T("%s [%s]"), pGrid->Get_Name(), _TL("High Pass")));
CSG_Colors Colors;
DataObject_Get_Colors(pGrid , Colors);
DataObject_Set_Colors(pLoPass, Colors);
DataObject_Set_Colors(pHiPass, 11, SG_COLORS_RED_GREY_BLUE);
//-----------------------------------------------------
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
double py = Get_YMin() + y * Get_Cellsize();
#pragma omp parallel for
for(int x=0; x<Get_NX(); x++)
{
double z, px = Get_XMin() + x * Get_Cellsize();
if( !pGrid->is_NoData(x, y) && Grid.Get_Value(px, py, z) )
{
pLoPass->Set_Value(x, y, z);
pHiPass->Set_Value(x, y, pGrid->asDouble(x, y) - z);
}
else
{
pLoPass->Set_NoData(x, y);
pHiPass->Set_NoData(x, y);
}
}
}
//-----------------------------------------------------
return( true );
}
示例4: return
//---------------------------------------------------------
bool CSG_Module_Grid::Set_Progress_NCells(int iCell)
{
if( Get_System()->is_Valid() && (Get_System()->Get_NCells() <= 100 || !(iCell % (Get_System()->Get_NCells() / 100))) )
{
return( CSG_Module::Set_Progress(iCell, Get_System()->Get_NCells()) );
}
return( is_Progress() );
}
示例5: return
//---------------------------------------------------------
bool CSG_Module_Grid::Set_Progress_NCells(sLong iCell)
{
if( Get_System()->is_Valid() )
{
return( CSG_Module::Set_Progress((double)iCell, (double)Get_System()->Get_NCells()) );
}
return( is_Progress() );
}
示例6: pow
//---------------------------------------------------------
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: Get_System
*/ REBVAL *Find_Last_Event (REBINT model, REBINT type)
/*
** Find the last event in the queue by the model
** Check its type, if it matches, then return the event or NULL
**
**
***********************************************************************/
{
REBVAL *port;
REBVAL *value;
REBVAL *state;
port = Get_System(SYS_PORTS, PORTS_SYSTEM);
if (!IS_PORT(port)) return NULL; // verify it is a port object
// Get queue block:
state = VAL_OBJ_VALUE(port, STD_PORT_STATE);
if (!IS_BLOCK(state)) return NULL;
for (value = VAL_BLK_TAIL(state) - 1; value >= VAL_BLK(state); -- value) {
if (VAL_EVENT_MODEL(value) == model) {
if (VAL_EVENT_TYPE(value) == type) {
return value;
} else {
return NULL;
}
}
}
return NULL;
}
示例8: VAL_OBJ_FRAME
*/ REBVAL *Find_Error_Info(ERROR_OBJ *error, REBINT *num)
/*
** Return the error message needed to print an error.
** Must scan the error catalog and its error lists.
** Note that the error type and id words no longer need
** to be bound to the error catalog context.
** If the message is not found, return null.
**
***********************************************************************/
{
REBSER *frame;
REBVAL *obj1;
REBVAL *obj2;
if (!IS_WORD(&error->type) || !IS_WORD(&error->id)) return 0;
// Find the correct error type object in the catalog:
frame = VAL_OBJ_FRAME(Get_System(SYS_CATALOG, CAT_ERRORS));
obj1 = Find_Word_Value(frame, VAL_WORD_SYM(&error->type));
if (!obj1) return 0;
// Now find the correct error message for that type:
frame = VAL_OBJ_FRAME(obj1);
obj2 = Find_Word_Value(frame, VAL_WORD_SYM(&error->id));
if (!obj2) return 0;
if (num) {
obj1 = Find_Word_Value(frame, SYM_CODE);
*num = VAL_INT32(obj1)
+ Find_Word_Index(frame, VAL_WORD_SYM(&error->id), FALSE)
- Find_Word_Index(frame, SYM_TYPE, FALSE) - 1;
}
return obj2;
}
示例9: VAL_INT32
*/ void Set_Error_Type(ERROR_OBJ *error)
/*
** Sets error type and id fields based on code number.
**
***********************************************************************/
{
REBSER *cats; // Error catalog object
REBSER *cat; // Error category object
REBCNT n; // Word symbol number
REBCNT code;
code = VAL_INT32(&error->code);
// Set error category:
n = code / 100 + 1;
cats = VAL_OBJ_FRAME(Get_System(SYS_CATALOG, CAT_ERRORS));
if (code >= 0 && n < SERIES_TAIL(cats) &&
NZ(cat = VAL_SERIES(BLK_SKIP(cats, n)))
) {
Set_Word(&error->type, FRM_WORD_SYM(cats, n), cats, n);
// Find word related to the error itself:
n = code % 100 + 3;
if (n < SERIES_TAIL(cat))
Set_Word(&error->id, FRM_WORD_SYM(cat, n), cat, n);
}
}
示例10: Parameters
//---------------------------------------------------------
bool CGrid_Fill::On_Execute(void)
{
CSG_Shapes *pPoints = Parameters("POINTS")->asShapes();
if( !pPoints->is_Valid() || !pPoints->Get_Extent().Intersects(Get_System().Get_Extent()) || !Parameters_Set(Parameters) )
{
return( false );
}
//-----------------------------------------------------
int nReplaced = 0;
#define GET_NPOINTS (bSelection ? pPoints->Get_Selection_Count() : pPoints->Get_Count())
#define GET_POINT(i) (bSelection ? pPoints->Get_Selection(i)->Get_Point(0) : pPoints->Get_Shape(i)->Get_Point(0))
bool bSelection = pPoints->Get_Selection_Count() > 0;
for(int i=0; i<GET_NPOINTS && Process_Get_Okay(); i++)
{
nReplaced += Fill(GET_POINT(i));
}
Message_Fmt("\n%d %s\n", nReplaced, _TL("replacements"));
return( true );
}
示例11: Get_System
*/ REBVAL *Append_Event()
/*
** Append an event to the end of the current event port queue.
** Return a pointer to the event value.
**
** Note: this function may be called from out of environment,
** so do NOT extend the event queue here. If it does not have
** space, return 0. (Should it overwrite or wrap???)
**
***********************************************************************/
{
REBVAL *port;
REBVAL *value;
REBVAL *state;
port = Get_System(SYS_PORTS, PORTS_SYSTEM);
if (!IS_PORT(port)) return 0; // verify it is a port object
// Get queue block:
state = VAL_BLK_SKIP(port, STD_PORT_STATE);
if (!IS_BLOCK(state)) return 0;
// Append to tail if room:
if (SERIES_FULL(VAL_SERIES(state))) Crash(RP_MAX_EVENTS);
VAL_TAIL(state)++;
value = VAL_BLK_TAIL(state);
SET_END(value);
value--;
SET_NONE(value);
//Dump_Series(VAL_SERIES(state), "state");
//Print("Tail: %d %d", VAL_TAIL(state), nn++);
return value;
}
示例12: Parameters
//---------------------------------------------------------
bool CCost_Accumulated::Get_Destinations(CPoints &Points)
{
Points.Clear();
m_pAccumulated->Set_NoData_Value(-1.0); m_pAccumulated->Assign(-1.0);
m_pAllocation ->Set_NoData_Value(-1.0); m_pAllocation ->Assign( 0.0);
if( Parameters("DEST_TYPE")->asInt() == 0 ) // Point
{
CSG_Shapes *pDestinations = Parameters("DEST_POINTS")->asShapes();
for(int i=0, x, y; i<pDestinations->Get_Count(); i++)
{
if( Get_System().Get_World_to_Grid(x, y, pDestinations->Get_Shape(i)->Get_Point(0)) && !m_pCost->is_NoData(x, y) )
{
Points.Add(x, y); m_pAllocation->Set_Value(x, y, Points.Get_Count()); m_pAccumulated->Set_Value(x, y, 0.0);
}
}
}
else // Grid
{
CSG_Grid *pDestinations = Parameters("DEST_GRID")->asGrid();
for(int y=0; y<Get_NY(); y++) for(int x=0; x<Get_NX(); x++)
{
if( !pDestinations->is_NoData(x, y) && !m_pCost->is_NoData(x, y) )
{
Points.Add(x, y); m_pAllocation->Set_Value(x, y, Points.Get_Count()); m_pAccumulated->Set_Value(x, y, 0.0);
}
}
}
return( Points.Get_Count() > 0 );
}
示例13: Get_System
*/ void Sieve_Ports(REBSER *ports)
/*
** Remove all ports not found in the WAKE list.
** ports could be NULL, in which case the WAKE list is cleared.
**
***********************************************************************/
{
REBVAL *port;
REBVAL *waked;
REBVAL *val;
REBCNT n;
port = Get_System(SYS_PORTS, PORTS_SYSTEM);
if (!IS_PORT(port)) return;
waked = VAL_OBJ_VALUE(port, STD_PORT_DATA);
if (!IS_BLOCK(waked)) return;
for (n = 0; ports && n < SERIES_TAIL(ports);) {
val = BLK_SKIP(ports, n);
if (IS_PORT(val)) {
assert(VAL_TAIL(waked) != 0);
if (VAL_TAIL(waked) == Find_Block_Simple(VAL_SERIES(waked), 0, val)) {//not found
Remove_Series(ports, n, 1);
continue;
}
}
n++;
}
//clear waked list
RESET_SERIES(VAL_SERIES(waked));
}
示例14: DEM
//---------------------------------------------------------
bool CHillslope_Evolution_FTCS::On_Execute(void)
{
//-----------------------------------------------------
CSG_Grid DEM(Get_System());
m_pDEM_Old = &DEM;
m_pDEM = Parameters("MODEL")->asGrid();
m_pDEM->Assign(Parameters("DEM")->asGrid());
DataObject_Set_Colors(Parameters("DIFF")->asGrid(), 10, SG_COLORS_RED_GREY_BLUE, true);
//-----------------------------------------------------
double k, dTime, nTime;
k = Parameters("KAPPA" )->asDouble();
nTime = Parameters("DURATION")->asDouble();
if( Parameters("TIMESTEP")->asInt() == 0 )
{
dTime = Parameters("DTIME")->asDouble();
}
else
{
dTime = 0.5 * Get_Cellarea() / (2.0 * k);
if( Parameters("NEIGHBOURS")->asInt() == 1 )
{
dTime /= sqrt(2.0);
}
}
if( dTime > nTime )
{
Message_Fmt("\n%s: %s [%f]", _TL("Warning"), _TL("Time step exceeds duration"), dTime);
dTime = nTime;
}
Message_Fmt("\n%s: %f", _TL("Time Step"), dTime);
Message_Fmt("\n%s: %d", _TL("Steps"), (int)(nTime / dTime));
//-----------------------------------------------------
for(double iTime=dTime; iTime<=nTime && Set_Progress(iTime, nTime); iTime+=dTime)
{
Process_Set_Text("%s: %.2f [%.2f]", _TL("Simulation Time"), iTime, nTime);
SG_UI_Progress_Lock(true);
Set_Diffusion(dTime * k / Get_Cellarea());
Set_Difference();
SG_UI_Progress_Lock(false);
}
//-----------------------------------------------------
return( true );
}
示例15: switch
//---------------------------------------------------------
bool CGrid_Profile::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
{
switch( Mode )
{
default:
break;
case MODULE_INTERACTIVE_LDOWN:
if( !m_bAdd )
{
m_bAdd = true;
m_pLine->Create(SHAPE_TYPE_Line, CSG_String::Format(SG_T("Profile [%s]"), m_pDEM->Get_Name()));
m_pLine->Add_Field("ID" , SG_DATATYPE_Int);
m_pLine->Add_Shape()->Set_Value(0, 1);
}
m_pLine->Get_Shape(0)->Add_Point(Get_System()->Fit_to_Grid_System(ptWorld));
DataObject_Update(m_pLine);
break;
case MODULE_INTERACTIVE_RDOWN:
Set_Profile();
m_bAdd = false;
break;
}
return( true );
}